diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-04-06 01:11:52 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-04-06 01:11:52 +0000 |
commit | 6bbab86af959a8819ddadfe8909bcfa5aa53ce9f (patch) | |
tree | e13e9adda7545aa316f8d62d9cf0a203ba9fd2ee /test/Transforms/Inline | |
parent | f16936e5923156863906c915de657b134db4fb16 (diff) | |
download | external_llvm-6bbab86af959a8819ddadfe8909bcfa5aa53ce9f.zip external_llvm-6bbab86af959a8819ddadfe8909bcfa5aa53ce9f.tar.gz external_llvm-6bbab86af959a8819ddadfe8909bcfa5aa53ce9f.tar.bz2 |
Sink the return instruction collection until after we're done deleting
dead code, including dead return instructions in some cases. Otherwise,
we end up having a bogus poniter to a return instruction that blows up
much further down the road.
It turns out that this pattern is both simpler to code, easier to update
in the face of enhancements to the inliner cleanup, and likely cheaper
given that it won't add dead instructions to the list.
Thanks to John Regehr's numerous test cases for teasing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Inline')
-rw-r--r-- | test/Transforms/Inline/inline_cleanup.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Transforms/Inline/inline_cleanup.ll b/test/Transforms/Inline/inline_cleanup.ll index 27ee617..1dd94f3 100644 --- a/test/Transforms/Inline/inline_cleanup.ll +++ b/test/Transforms/Inline/inline_cleanup.ll @@ -136,3 +136,40 @@ entry: call void @inner2(i32 0, i32 -1, i32 %z, i1 %b) ret void } + +define void @PR12470_inner(i16 signext %p1) nounwind uwtable { +entry: + br i1 undef, label %cond.true, label %cond.false + +cond.true: + br label %cond.end + +cond.false: + %conv = sext i16 %p1 to i32 + br label %cond.end + +cond.end: + %cond = phi i32 [ undef, %cond.true ], [ 0, %cond.false ] + %tobool = icmp eq i32 %cond, 0 + br i1 %tobool, label %if.end5, label %if.then + +if.then: + ret void + +if.end5: + ret void +} + +define void @PR12470_outer() { +; This previously crashed during inliner cleanup and folding inner return +; instructions. Check that we don't crash and we produce a function with a single +; crash. +; CHECK: define void @PR12470_outer +; CHECK: ret void +; CHECK-NOT: ret void +; CHECK: } + +entry: + call void @PR12470_inner(i16 signext 1) + ret void +} |