diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-27 05:39:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-27 05:39:41 +0000 |
commit | c581acbbba3cb1af6a08e17314b26344333f9267 (patch) | |
tree | 942a87ef901f5e4fefcbdb33a74aa4e013f6ab6f /test | |
parent | 744f19aa15a4fe89631d3ee39955973f85196977 (diff) | |
download | llvm-c581acbbba3cb1af6a08e17314b26344333f9267.tar.gz llvm-c581acbbba3cb1af6a08e17314b26344333f9267.tar.bz2 llvm-c581acbbba3cb1af6a08e17314b26344333f9267.tar.xz |
Fix a pretty serious misfeature of the inliner: if it inlines a function
with multiple return values it inserts a PHI to merge them all together.
However, if the return values are all the same, it ends up with a pointless
PHI and this pointless PHI happens to really block SRoA from happening in
at least a silly C++ example written by Doug, but probably others. This
fixes rdar://7339069.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85206 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/Inline/basictest.ll | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/Transforms/Inline/basictest.ll b/test/Transforms/Inline/basictest.ll index 451b8cbdfd..e61f50c760 100644 --- a/test/Transforms/Inline/basictest.ll +++ b/test/Transforms/Inline/basictest.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -inline -S | FileCheck %s +; RUN: opt < %s -inline -scalarrepl -S | FileCheck %s define i32 @test1f(i32 %i) { ret i32 %i @@ -13,3 +13,34 @@ define i32 @test1(i32 %W) { ; CHECK-NEXT: ret i32 %Y } + + +; rdar://7339069 + +%T = type { i32, i32 } + +; CHECK-NOT: @test2f +define internal %T* @test2f(i1 %cond, %T* %P) { + br i1 %cond, label %T, label %F + +T: + %A = getelementptr %T* %P, i32 0, i32 0 + store i32 42, i32* %A + ret %T* %P + +F: + ret %T* %P +} + +define i32 @test2(i1 %cond) { + %A = alloca %T + + %B = call %T* @test2f(i1 %cond, %T* %A) + %C = getelementptr %T* %B, i32 0, i32 0 + %D = load i32* %C + ret i32 %D + +; CHECK: @test2( +; CHECK-NOT: = alloca +; CHECK: ret i32 42 +} |