summaryrefslogtreecommitdiffstats
path: root/llvm/test/Feature/exception.ll
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-12 05:38:55 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-12 05:38:55 +0000
commit8a1c45d6e86d54c40835fa8638d1fd900071783c (patch)
treee485010342db16bc7c4de112e89d5b5e23b29bba /llvm/test/Feature/exception.ll
parenta38312a9a4eeb8ab8976adf5712fadd68dd763cf (diff)
downloadbcm5719-llvm-8a1c45d6e86d54c40835fa8638d1fd900071783c.tar.gz
bcm5719-llvm-8a1c45d6e86d54c40835fa8638d1fd900071783c.zip
[IR] Reformulate LLVM's EH funclet IR
While we have successfully implemented a funclet-oriented EH scheme on top of LLVM IR, our scheme has some notable deficiencies: - catchendpad and cleanupendpad are necessary in the current design but they are difficult to explain to others, even to seasoned LLVM experts. - catchendpad and cleanupendpad are optimization barriers. They cannot be split and force all potentially throwing call-sites to be invokes. This has a noticable effect on the quality of our code generation. - catchpad, while similar in some aspects to invoke, is fairly awkward. It is unsplittable, starts a funclet, and has control flow to other funclets. - The nesting relationship between funclets is currently a property of control flow edges. Because of this, we are forced to carefully analyze the flow graph to see if there might potentially exist illegal nesting among funclets. While we have logic to clone funclets when they are illegally nested, it would be nicer if we had a representation which forbade them upfront. Let's clean this up a bit by doing the following: - Instead, make catchpad more like cleanuppad and landingpad: no control flow, just a bunch of simple operands; catchpad would be splittable. - Introduce catchswitch, a control flow instruction designed to model the constraints of funclet oriented EH. - Make funclet scoping explicit by having funclet instructions consume the token produced by the funclet which contains them. - Remove catchendpad and cleanupendpad. Their presence can be inferred implicitly using coloring information. N.B. The state numbering code for the CLR has been updated but the veracity of it's output cannot be spoken for. An expert should take a look to make sure the results are reasonable. Reviewers: rnk, JosephTremoulet, andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D15139 llvm-svn: 255422
Diffstat (limited to 'llvm/test/Feature/exception.ll')
-rw-r--r--llvm/test/Feature/exception.ll129
1 files changed, 28 insertions, 101 deletions
diff --git a/llvm/test/Feature/exception.ll b/llvm/test/Feature/exception.ll
index c6c436ae83d..05dbfe89645 100644
--- a/llvm/test/Feature/exception.ll
+++ b/llvm/test/Feature/exception.ll
@@ -31,8 +31,8 @@ entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %pad
pad:
- %cp = cleanuppad [i7 4]
- cleanupret %cp unwind to caller
+ %cp = cleanuppad within none [i7 4]
+ cleanupret from %cp unwind to caller
exit:
ret void
}
@@ -43,9 +43,9 @@ entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %pad
cleanup:
- cleanupret %cp unwind label %pad
+ cleanupret from %cp unwind label %pad
pad:
- %cp = cleanuppad []
+ %cp = cleanuppad within none []
br label %cleanup
exit:
ret void
@@ -57,9 +57,9 @@ entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %pad
cleanup:
- cleanupret %0 unwind label %pad
+ cleanupret from %0 unwind label %pad
pad:
- %0 = cleanuppad []
+ %0 = cleanuppad within none []
br label %cleanup
exit:
ret void
@@ -70,12 +70,10 @@ entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %pad
pad:
- %cp = catchpad [i7 4]
- to label %catch unwind label %endpad
+ %cs1 = catchswitch within none [label %catch] unwind to caller
catch:
- catchret %cp to label %exit
-endpad:
- catchendpad unwind to caller
+ %cp = catchpad within %cs1 [i7 4]
+ catchret from %cp to label %exit
exit:
ret void
}
@@ -85,13 +83,13 @@ define void @catchret1() personality i32 (...)* @__gxx_personality_v0 {
entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %pad
-catch:
- catchret %cp to label %exit
+catchret:
+ catchret from %cp to label %exit
pad:
- %cp = catchpad []
- to label %catch unwind label %endpad
-endpad:
- catchendpad unwind to caller
+ %cs1 = catchswitch within none [label %catch] unwind to caller
+catch:
+ %cp = catchpad within %cs1 [i7 4]
+ br label %catchret
exit:
ret void
}
@@ -101,13 +99,13 @@ define void @catchret2() personality i32 (...)* @__gxx_personality_v0 {
entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %pad
-catch:
- catchret %0 to label %exit
+catchret:
+ catchret from %0 to label %exit
pad:
- %0 = catchpad []
- to label %catch unwind label %endpad
-endpad:
- catchendpad unwind to caller
+ %cs1 = catchswitch within none [label %catch] unwind to caller
+catch:
+ %0 = catchpad within %cs1 [i7 4]
+ br label %catchret
exit:
ret void
}
@@ -117,9 +115,10 @@ entry:
invoke void @_Z3quxv() optsize
to label %exit unwind label %bb2
bb2:
- catchpad [i7 4] to label %exit unwind label %bb3
-bb3:
- catchendpad unwind to caller
+ %cs1 = catchswitch within none [label %catch] unwind to caller
+catch:
+ catchpad within %cs1 [i7 4]
+ br label %exit
exit:
ret i8 0
}
@@ -132,7 +131,7 @@ try.cont:
invoke void @_Z3quxv() optsize
to label %try.cont unwind label %bb
bb:
- terminatepad [i7 4] unwind label %bb
+ terminatepad within none [i7 4] unwind label %bb
}
define void @terminatepad1() personality i32 (...)* @__gxx_personality_v0 {
@@ -143,7 +142,7 @@ try.cont:
invoke void @_Z3quxv() optsize
to label %try.cont unwind label %bb
bb:
- terminatepad [i7 4] unwind to caller
+ terminatepad within none [i7 4] unwind to caller
}
define void @cleanuppad() personality i32 (...)* @__gxx_personality_v0 {
@@ -154,78 +153,6 @@ try.cont:
invoke void @_Z3quxv() optsize
to label %try.cont unwind label %bb
bb:
- cleanuppad [i7 4]
- ret void
-}
-
-define void @catchendpad0() personality i32 (...)* @__gxx_personality_v0 {
-entry:
- br label %try.cont
-
-try.cont:
- invoke void @_Z3quxv() optsize
- to label %try.cont unwind label %bb
-bb:
- catchendpad unwind label %bb
-}
-
-define void @catchendpad1() personality i32 (...)* @__gxx_personality_v0 {
-entry:
- br label %try.cont
-
-try.cont:
- invoke void @_Z3quxv() optsize
- to label %try.cont unwind label %bb
-bb:
- catchendpad unwind to caller
-}
-
-define void @cleanupendpad0() personality i32 (...)* @__gxx_personality_v0 {
-entry:
- invoke void @_Z3quxv() optsize
- to label %exit unwind label %pad
-pad:
- %cp = cleanuppad [i7 4]
- invoke void @_Z3quxv() optsize
- to label %stop unwind label %endpad
-stop:
- unreachable
-endpad:
- cleanupendpad %cp unwind label %pad
-exit:
- ret void
-}
-
-; forward ref by name
-define void @cleanupendpad1() personality i32 (...)* @__gxx_personality_v0 {
-entry:
- invoke void @_Z3quxv() optsize
- to label %exit unwind label %pad
-endpad:
- cleanupendpad %cp unwind to caller
-pad:
- %cp = cleanuppad []
- invoke void @_Z3quxv() optsize
- to label %stop unwind label %endpad
-stop:
- unreachable
-exit:
- ret void
-}
-
-; forward ref by ID
-define void @cleanupendpad2() personality i32 (...)* @__gxx_personality_v0 {
-entry:
- invoke void @_Z3quxv() optsize
- to label %exit unwind label %pad
-endpad:
- cleanupendpad %0 unwind label %pad
-pad:
- %0 = cleanuppad []
- invoke void @_Z3quxv() optsize
- to label %stop unwind label %endpad
-stop:
- unreachable
-exit:
+ cleanuppad within none [i7 4]
ret void
}
OpenPOWER on IntegriCloud