diff options
author | Joseph Tremoulet <jotrem@microsoft.com> | 2015-08-23 00:26:33 +0000 |
---|---|---|
committer | Joseph Tremoulet <jotrem@microsoft.com> | 2015-08-23 00:26:33 +0000 |
commit | 8220bcc5700305452e823ad2d37d769f8f15a497 (patch) | |
tree | 3498781194fdabe5977d69f40bb8bb28514a6271 /llvm/test/Feature/exception.ll | |
parent | 0732e16e690e251e92463d25b0de16c4a71a41b9 (diff) | |
download | bcm5719-llvm-8220bcc5700305452e823ad2d37d769f8f15a497.tar.gz bcm5719-llvm-8220bcc5700305452e823ad2d37d769f8f15a497.zip |
[WinEH] Require token linkage in EH pad/ret signatures
Summary:
WinEHPrepare is going to require that cleanuppad and catchpad produce values
of token type which are consumed by any cleanupret or catchret exiting the
pad. This change updates the signatures of those operators to require/enforce
that the type produced by the pads is token type and that the rets have an
appropriate argument.
The catchpad argument of a `CatchReturnInst` must be a `CatchPadInst` (and
similarly for `CleanupReturnInst`/`CleanupPadInst`). To accommodate that
restriction, this change adds a notion of an operator constraint to both
LLParser and BitcodeReader, allowing appropriate sentinels to be constructed
for forward references and appropriate error messages to be emitted for
illegal inputs.
Also add a verifier rule (noted in LangRef) that a catchpad with a catchpad
predecessor must have no other predecessors; this ensures that WinEHPrepare
will see the expected linear relationship between sibling catches on the
same try.
Lastly, remove some superfluous/vestigial casts from instruction operand
setters operating on BasicBlocks.
Reviewers: rnk, majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D12108
llvm-svn: 245797
Diffstat (limited to 'llvm/test/Feature/exception.ll')
-rw-r--r-- | llvm/test/Feature/exception.ll | 102 |
1 files changed, 71 insertions, 31 deletions
diff --git a/llvm/test/Feature/exception.ll b/llvm/test/Feature/exception.ll index e2635c2de42..de458bb7e4e 100644 --- a/llvm/test/Feature/exception.ll +++ b/llvm/test/Feature/exception.ll @@ -28,60 +28,100 @@ declare i32 @__gxx_personality_v0(...) define void @cleanupret0() personality i32 (...)* @__gxx_personality_v0 { entry: - br label %try.cont - -try.cont: invoke void @_Z3quxv() optsize - to label %try.cont unwind label %bb -bb: - cleanuppad void [i7 4] - cleanupret i8 0 unwind label %bb + to label %exit unwind label %pad +pad: + %cp = cleanuppad [i7 4] + cleanupret %cp unwind to caller +exit: + ret void } +; forward ref by name define void @cleanupret1() personality i32 (...)* @__gxx_personality_v0 { entry: - br label %try.cont - -try.cont: invoke void @_Z3quxv() optsize - to label %try.cont unwind label %bb -bb: - cleanuppad void [i7 4] - cleanupret void unwind label %bb + to label %exit unwind label %pad +cleanup: + cleanupret %cp unwind label %pad +pad: + %cp = cleanuppad [] + br label %cleanup +exit: + ret void } +; forward ref by ID define void @cleanupret2() personality i32 (...)* @__gxx_personality_v0 { entry: - cleanupret i8 0 unwind to caller + invoke void @_Z3quxv() optsize + to label %exit unwind label %pad +cleanup: + cleanupret %0 unwind label %pad +pad: + %0 = cleanuppad [] + br label %cleanup +exit: + ret void } -define void @cleanupret3() personality i32 (...)* @__gxx_personality_v0 { - cleanupret void unwind to caller +define void @catchret0() personality i32 (...)* @__gxx_personality_v0 { +entry: + invoke void @_Z3quxv() optsize + to label %exit unwind label %pad +pad: + %cp = catchpad [i7 4] + to label %catch unwind label %endpad +catch: + catchret %cp to label %exit +endpad: + catchendpad unwind to caller +exit: + ret void } -define void @catchret() personality i32 (...)* @__gxx_personality_v0 { +; forward ref by name +define void @catchret1() personality i32 (...)* @__gxx_personality_v0 { entry: - br label %bb -bb: - catchret void to label %bb + invoke void @_Z3quxv() optsize + to label %exit unwind label %pad +catch: + catchret %cp to label %exit +pad: + %cp = catchpad [] + to label %catch unwind label %endpad +endpad: + catchendpad unwind to caller +exit: + ret void } -define i8 @catchpad() personality i32 (...)* @__gxx_personality_v0 { +; forward ref by ID +define void @catchret2() personality i32 (...)* @__gxx_personality_v0 { entry: - br label %try.cont + invoke void @_Z3quxv() optsize + to label %exit unwind label %pad +catch: + catchret %0 to label %exit +pad: + %0 = catchpad [] + to label %catch unwind label %endpad +endpad: + catchendpad unwind to caller +exit: + ret void +} -try.cont: +define i8 @catchpad() personality i32 (...)* @__gxx_personality_v0 { +entry: invoke void @_Z3quxv() optsize to label %exit unwind label %bb2 -bb: - catchret token %cbv to label %exit - -exit: - ret i8 0 bb2: - %cbv = catchpad token [i7 4] to label %bb unwind label %bb3 + catchpad [i7 4] to label %exit unwind label %bb3 bb3: catchendpad unwind to caller +exit: + ret i8 0 } define void @terminatepad0() personality i32 (...)* @__gxx_personality_v0 { @@ -114,7 +154,7 @@ try.cont: invoke void @_Z3quxv() optsize to label %try.cont unwind label %bb bb: - cleanuppad void [i7 4] + cleanuppad [i7 4] ret void } |