diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-05-21 05:12:32 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-05-21 05:12:32 +0000 |
| commit | 9f92f4c497734abc8104a3b2219fdae765691e13 (patch) | |
| tree | 20f73c40ba9e751f44ff9450e4b239e20b25d7c5 /llvm/test/Transforms | |
| parent | 73f48f4662f30b837743a02ab9256558521fb20a (diff) | |
| download | bcm5719-llvm-9f92f4c497734abc8104a3b2219fdae765691e13.tar.gz bcm5719-llvm-9f92f4c497734abc8104a3b2219fdae765691e13.zip | |
[SimplifyCFG] Remove cleanuppads which are empty except for calls to lifetime.end
A cleanuppad is not cheap, they turn into many instructions and result
in additional spills and fills. It is not worth keeping a cleanuppad
around if all it does is hold a lifetime.end instruction.
N.B. We first try to merge the cleanuppad with another cleanuppad to
avoid dropping the lifetime and debug info markers.
llvm-svn: 270314
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll b/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll index 57b36288995..e83cbb50e58 100644 --- a/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll +++ b/llvm/test/Transforms/SimplifyCFG/empty-cleanuppad.ll @@ -404,6 +404,35 @@ catch.cont: ; preds = %catch return: ; preds = %invoke.cont, %catch.cont ret void } +; CHECK-LABEL: define i32 @f9() +; CHECK: entry: +; CHECK: invoke void @"\01??1S2@@QEAA@XZ"( +; CHECK-NOT: cleanuppad +; CHECK: catch.dispatch: +; CHECK: } +define i32 @f9() personality i32 (...)* @__CxxFrameHandler3 { +entry: + %s = alloca i8, align 1 + call void @llvm.lifetime.start(i64 1, i8* nonnull %s) + %bc = bitcast i8* %s to %struct.S2* + invoke void @"\01??1S2@@QEAA@XZ"(%struct.S2* %bc) + to label %try.cont unwind label %ehcleanup + +ehcleanup: + %cleanup.pad = cleanuppad within none [] + call void @llvm.lifetime.end(i64 1, i8* nonnull %s) + cleanupret from %cleanup.pad unwind label %catch.dispatch + +catch.dispatch: + %catch.switch = catchswitch within none [label %catch] unwind to caller + +catch: + %catch.pad = catchpad within %catch.switch [i8* null, i32 0, i8* null] + catchret from %catch.pad to label %try.cont + +try.cont: + ret i32 0 +} %struct.S = type { i8 } %struct.S2 = type { i8 } @@ -413,3 +442,5 @@ declare void @use_x(i32 %x) declare i32 @__CxxFrameHandler3(...) +declare void @llvm.lifetime.start(i64, i8* nocapture) +declare void @llvm.lifetime.end(i64, i8* nocapture) |

