[FunctionAttrs] Fix an iterator wraparound bug
[oota-llvm.git] / test / Transforms / Mem2Reg / ignore-lifetime.ll
1 ; RUN: opt -mem2reg -S -o - < %s | FileCheck %s
2
3 declare void @llvm.lifetime.start(i64 %size, i8* nocapture %ptr)
4 declare void @llvm.lifetime.end(i64 %size, i8* nocapture %ptr)
5
6 define void @test1() {
7 ; CHECK: test1
8 ; CHECK-NOT: alloca
9   %A = alloca i32
10   %B = bitcast i32* %A to i8*
11   call void @llvm.lifetime.start(i64 2, i8* %B)
12   store i32 1, i32* %A
13   call void @llvm.lifetime.end(i64 2, i8* %B)
14   ret void
15 }
16
17 define void @test2() {
18 ; CHECK: test2
19 ; CHECK-NOT: alloca
20   %A = alloca {i8, i16}
21   %B = getelementptr {i8, i16}, {i8, i16}* %A, i32 0, i32 0
22   call void @llvm.lifetime.start(i64 2, i8* %B)
23   store {i8, i16} zeroinitializer, {i8, i16}* %A
24   call void @llvm.lifetime.end(i64 2, i8* %B)
25   ret void
26 }