1; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=1 < %s | FileCheck %s 2 3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4 5; Make sure we can vectorize loops which contain lifetime markers. 6 7; CHECK-LABEL: @test( 8; CHECK: call void @llvm.lifetime.end 9; CHECK: store <2 x i32> 10; CHECK: call void @llvm.lifetime.start 11 12define void @test(i32 *%d) { 13entry: 14 %arr = alloca [1024 x i32], align 16 15 %0 = bitcast [1024 x i32]* %arr to i8* 16 call void @llvm.lifetime.start(i64 4096, i8* %0) #1 17 br label %for.body 18 19for.body: 20 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 21 call void @llvm.lifetime.end(i64 4096, i8* %0) #1 22 %arrayidx = getelementptr inbounds i32, i32* %d, i64 %indvars.iv 23 %1 = load i32, i32* %arrayidx, align 8 24 store i32 100, i32* %arrayidx, align 8 25 call void @llvm.lifetime.start(i64 4096, i8* %0) #1 26 %indvars.iv.next = add i64 %indvars.iv, 1 27 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 28 %exitcond = icmp ne i32 %lftr.wideiv, 128 29 br i1 %exitcond, label %for.body, label %for.end 30 31for.end: 32 call void @llvm.lifetime.end(i64 4096, i8* %0) #1 33 ret void 34} 35 36; CHECK-LABEL: @testbitcast( 37; CHECK: call void @llvm.lifetime.end 38; CHECK: store <2 x i32> 39; CHECK: call void @llvm.lifetime.start 40 41define void @testbitcast(i32 *%d) { 42entry: 43 %arr = alloca [1024 x i32], align 16 44 %0 = bitcast [1024 x i32]* %arr to i8* 45 call void @llvm.lifetime.start(i64 4096, i8* %0) #1 46 br label %for.body 47 48for.body: 49 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 50 %1 = bitcast [1024 x i32]* %arr to i8* 51 call void @llvm.lifetime.end(i64 4096, i8* %1) #1 52 %arrayidx = getelementptr inbounds i32, i32* %d, i64 %indvars.iv 53 %2 = load i32, i32* %arrayidx, align 8 54 store i32 100, i32* %arrayidx, align 8 55 call void @llvm.lifetime.start(i64 4096, i8* %1) #1 56 %indvars.iv.next = add i64 %indvars.iv, 1 57 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 58 %exitcond = icmp ne i32 %lftr.wideiv, 128 59 br i1 %exitcond, label %for.body, label %for.end 60 61for.end: 62 call void @llvm.lifetime.end(i64 4096, i8* %0) #1 63 ret void 64} 65 66; CHECK-LABEL: @testloopvariant( 67; CHECK: call void @llvm.lifetime.end 68; CHECK: store <2 x i32> 69; CHECK: call void @llvm.lifetime.start 70 71define void @testloopvariant(i32 *%d) { 72entry: 73 %arr = alloca [1024 x i32], align 16 74 br label %for.body 75 76for.body: 77 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 78 %0 = getelementptr [1024 x i32], [1024 x i32]* %arr, i32 0, i64 %indvars.iv 79 %1 = bitcast [1024 x i32]* %arr to i8* 80 call void @llvm.lifetime.end(i64 4096, i8* %1) #1 81 %arrayidx = getelementptr inbounds i32, i32* %d, i64 %indvars.iv 82 %2 = load i32, i32* %arrayidx, align 8 83 store i32 100, i32* %arrayidx, align 8 84 call void @llvm.lifetime.start(i64 4096, i8* %1) #1 85 %indvars.iv.next = add i64 %indvars.iv, 1 86 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 87 %exitcond = icmp ne i32 %lftr.wideiv, 128 88 br i1 %exitcond, label %for.body, label %for.end 89 90for.end: 91 ret void 92} 93 94declare void @llvm.lifetime.start(i64, i8* nocapture) #1 95 96declare void @llvm.lifetime.end(i64, i8* nocapture) #1 97