1 ; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=1 < %s | FileCheck %s
3 target 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"
5 ; Make sure we can vectorize loops which contain lifetime markers.
8 ; CHECK: call void @llvm.lifetime.end
9 ; CHECK: store <2 x i32>
10 ; CHECK: call void @llvm.lifetime.start
12 define void @test(i32 *%d) {
14 %arr = alloca [1024 x i32], align 16
15 %0 = bitcast [1024 x i32]* %arr to i8*
16 call void @llvm.lifetime.start.p0i8(i64 4096, i8* %0) #1
20 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
21 call void @llvm.lifetime.end.p0i8(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.p0i8(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
32 call void @llvm.lifetime.end.p0i8(i64 4096, i8* %0) #1
36 ; CHECK-LABEL: @testbitcast(
37 ; CHECK: call void @llvm.lifetime.end
38 ; CHECK: store <2 x i32>
39 ; CHECK: call void @llvm.lifetime.start
41 define void @testbitcast(i32 *%d) {
43 %arr = alloca [1024 x i32], align 16
44 %0 = bitcast [1024 x i32]* %arr to i8*
45 call void @llvm.lifetime.start.p0i8(i64 4096, i8* %0) #1
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.p0i8(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.p0i8(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
62 call void @llvm.lifetime.end.p0i8(i64 4096, i8* %0) #1
66 ; CHECK-LABEL: @testloopvariant(
67 ; CHECK: call void @llvm.lifetime.end
68 ; CHECK: store <2 x i32>
69 ; CHECK: call void @llvm.lifetime.start
71 define void @testloopvariant(i32 *%d) {
73 %arr = alloca [1024 x i32], align 16
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.p0i8(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.p0i8(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
94 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
96 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1