diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-08-13 22:51:58 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-08-13 22:51:58 +0000 |
commit | 6c1fa7caaefc88a5a867add402d90115823bd0eb (patch) | |
tree | 23c65c096ef3dc872b667afde7c3404c977e6dc4 /test/Transforms | |
parent | 0fe3792a2fd6ed9c20d8bf8eb3689672cb30c1c7 (diff) | |
download | external_llvm-6c1fa7caaefc88a5a867add402d90115823bd0eb.zip external_llvm-6c1fa7caaefc88a5a867add402d90115823bd0eb.tar.gz external_llvm-6c1fa7caaefc88a5a867add402d90115823bd0eb.tar.bz2 |
Revert r187191, which broke opt -mem2reg on the testcases included in PR16867.
However, opt -O2 doesn't run mem2reg directly so nobody noticed until r188146
when SROA started sending more things directly down the PromoteMemToReg path.
In order to revert r187191, I also revert dependent revisions r187296, r187322
and r188146. Fixes PR16867. Does not add the testcases from that PR, but both
of them should get added for both mem2reg and sroa when this revert gets
unreverted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188327 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/Mem2Reg/ignore-lifetime.ll | 52 | ||||
-rw-r--r-- | test/Transforms/Mem2Reg/use-analysis.ll | 70 |
2 files changed, 52 insertions, 70 deletions
diff --git a/test/Transforms/Mem2Reg/ignore-lifetime.ll b/test/Transforms/Mem2Reg/ignore-lifetime.ll new file mode 100644 index 0000000..3d5368c --- /dev/null +++ b/test/Transforms/Mem2Reg/ignore-lifetime.ll @@ -0,0 +1,52 @@ +; RUN: opt -mem2reg -S -o - < %s | FileCheck %s + +declare void @llvm.lifetime.start(i64 %size, i8* nocapture %ptr) +declare void @llvm.lifetime.end(i64 %size, i8* nocapture %ptr) + +define void @test1() { +; CHECK: test1 +; CHECK-NOT: alloca + %A = alloca i32 + %B = bitcast i32* %A to i8* + call void @llvm.lifetime.start(i64 2, i8* %B) + store i32 1, i32* %A + call void @llvm.lifetime.end(i64 2, i8* %B) + ret void +} + +define void @test2() { +; CHECK: test2 +; CHECK-NOT: alloca + %A = alloca {i8, i16} + %B = getelementptr {i8, i16}* %A, i32 0, i32 0 + call void @llvm.lifetime.start(i64 2, i8* %B) + store {i8, i16} zeroinitializer, {i8, i16}* %A + call void @llvm.lifetime.end(i64 2, i8* %B) + ret void +} +; RUN: opt -mem2reg -S -o - < %s | FileCheck %s + +declare void @llvm.lifetime.start(i64 %size, i8* nocapture %ptr) +declare void @llvm.lifetime.end(i64 %size, i8* nocapture %ptr) + +define void @test1() { +; CHECK: test1 +; CHECK-NOT: alloca + %A = alloca i32 + %B = bitcast i32* %A to i8* + call void @llvm.lifetime.start(i64 2, i8* %B) + store i32 1, i32* %A + call void @llvm.lifetime.end(i64 2, i8* %B) + ret void +} + +define void @test2() { +; CHECK: test2 +; CHECK-NOT: alloca + %A = alloca {i8, i16} + %B = getelementptr {i8, i16}* %A, i32 0, i32 0 + call void @llvm.lifetime.start(i64 2, i8* %B) + store {i8, i16} zeroinitializer, {i8, i16}* %A + call void @llvm.lifetime.end(i64 2, i8* %B) + ret void +} diff --git a/test/Transforms/Mem2Reg/use-analysis.ll b/test/Transforms/Mem2Reg/use-analysis.ll deleted file mode 100644 index b08b1f1..0000000 --- a/test/Transforms/Mem2Reg/use-analysis.ll +++ /dev/null @@ -1,70 +0,0 @@ -; RUN: opt -mem2reg -S -o - < %s | FileCheck %s - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64" - -declare void @llvm.lifetime.start(i64 %size, i8* nocapture %ptr) -declare void @llvm.lifetime.end(i64 %size, i8* nocapture %ptr) - -define void @test1() { -; Ensure we can look through a bitcast to i8* and the addition of lifetime -; markers. -; -; CHECK-LABEL: @test1( -; CHECK-NOT: alloca -; CHECK: ret void - - %A = alloca i32 - %B = bitcast i32* %A to i8* - call void @llvm.lifetime.start(i64 2, i8* %B) - store i32 1, i32* %A - call void @llvm.lifetime.end(i64 2, i8* %B) - ret void -} - -define void @test2() { -; Ensure we can look through a GEP to i8* and the addition of lifetime -; markers. -; -; CHECK-LABEL: @test2( -; CHECK-NOT: alloca -; CHECK: ret void - - %A = alloca {i8, i16} - %B = getelementptr {i8, i16}* %A, i32 0, i32 0 - call void @llvm.lifetime.start(i64 2, i8* %B) - store {i8, i16} zeroinitializer, {i8, i16}* %A - call void @llvm.lifetime.end(i64 2, i8* %B) - ret void -} - -define i32 @test3(i32 %x) { -; CHECK-LABEL: @test3( -; -; Check that we recursively walk the uses of the alloca and thus can see -; through round trip bitcasts, dead bitcasts, GEPs, multiple GEPs, and lifetime -; markers. -entry: - %a = alloca i32 -; CHECK-NOT: alloca - - %b = bitcast i32* %a to i8* - %b2 = getelementptr inbounds i8* %b, i32 0 - %b3 = getelementptr inbounds i8* %b2, i32 0 - call void @llvm.lifetime.start(i64 -1, i8* %b3) -; CHECK-NOT: call void @llvm.lifetime.start - - store i32 %x, i32* %a -; CHECK-NOT: store - - %dead = bitcast i32* %a to i4096* - %dead1 = bitcast i4096* %dead to i42* - %dead2 = getelementptr inbounds i32* %a, i32 %x -; CHECK-NOT: bitcast -; CHECK-NOT: getelementptr - - %ret = load i32* %a -; CHECK-NOT: load - - ret i32 %ret -; CHECK: ret i32 %x -} |