diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-06-04 23:50:03 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-04 23:50:03 +0000 |
| commit | 2482e1c01754210b197293ef50bafc72a166df10 (patch) | |
| tree | 25b0bd1832b5a388a42ce9e715e8fc65178b6e07 /llvm/test/Transforms/SimplifyCFG | |
| parent | e1979aed0a153d690bfaf4abfd9ed62d63439ecb (diff) | |
| download | bcm5719-llvm-2482e1c01754210b197293ef50bafc72a166df10.tar.gz bcm5719-llvm-2482e1c01754210b197293ef50bafc72a166df10.zip | |
[SimplifyCFG] Don't kill empty cleanuppads with multiple uses
A basic block could contain:
%cp = cleanuppad []
cleanupret from %cp unwind to caller
This basic block is empty and is thus a candidate for removal. However,
there can be other uses of %cp outside of this basic block. This is
only possible in unreachable blocks.
Make our transform more correct by checking that the pad has a single
user before removing the BB.
This fixes PR28005.
llvm-svn: 271816
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll b/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll index e83cbb50e58..9f657a81a05 100644 --- a/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll +++ b/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll @@ -434,6 +434,30 @@ try.cont: ret i32 0 } +; CHECK-LABEL: define void @f10( +define void @f10(i32 %V) personality i32 (...)* @__CxxFrameHandler3 { +entry: + invoke void @g() + to label %unreachable unwind label %cleanup +; CHECK: call void @g() +; CHECK-NEXT: unreachable + +unreachable: + unreachable + +cleanup: + %cp = cleanuppad within none [] + switch i32 %V, label %cleanupret1 [ + i32 0, label %cleanupret2 + ] + +cleanupret1: + cleanupret from %cp unwind to caller + +cleanupret2: + cleanupret from %cp unwind to caller +} + %struct.S = type { i8 } %struct.S2 = type { i8 } declare void @"\01??1S2@@QEAA@XZ"(%struct.S2*) |

