summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Inline
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/Transforms/Inline
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/Transforms/Inline')
-rw-r--r--llvm/test/Transforms/Inline/PR25155.ll21
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/test/Transforms/Inline/PR25155.ll b/llvm/test/Transforms/Inline/PR25155.ll
index f2a9ec32fda..aed9a58ab3d 100644
--- a/llvm/test/Transforms/Inline/PR25155.ll
+++ b/llvm/test/Transforms/Inline/PR25155.ll
@@ -8,21 +8,23 @@ entry:
to label %try.cont unwind label %catch.dispatch
catch.dispatch: ; preds = %entry
- %0 = catchpad [i8* null, i32 64, i8* null]
- to label %catch unwind label %catchendblock
+ %cs1 = catchswitch within none [label %catch] unwind to caller
catch: ; preds = %catch.dispatch
+ %0 = catchpad within %cs1 [i8* null, i32 64, i8* null]
invoke void @dtor()
- to label %invoke.cont.1 unwind label %catchendblock
+ to label %invoke.cont.1 unwind label %ehcleanup
invoke.cont.1: ; preds = %catch
- catchret %0 to label %try.cont
+ catchret from %0 to label %try.cont
try.cont: ; preds = %entry, %invoke.cont.1
ret void
-catchendblock: ; preds = %catch, %catch.dispatch
- catchendpad unwind to caller
+ehcleanup:
+ %cp2 = cleanuppad within none []
+ call void @g()
+ cleanupret from %cp2 unwind to caller
}
; CHECK-LABEL: define void @f(
@@ -31,10 +33,7 @@ catchendblock: ; preds = %catch, %catch.dispa
; CHECK: to label %dtor.exit unwind label %terminate.i
; CHECK: terminate.i:
-; CHECK-NEXT: terminatepad [void ()* @terminate] unwind label %catchendblock
-
-; CHECK: catchendblock:
-; CHECK-NEXT: catchendpad unwind to caller
+; CHECK-NEXT: terminatepad within %0 [void ()* @terminate] unwind label %ehcleanup
declare i32 @__CxxFrameHandler3(...)
@@ -47,7 +46,7 @@ invoke.cont: ; preds = %entry
ret void
terminate: ; preds = %entry
- terminatepad [void ()* @terminate] unwind to caller
+ terminatepad within none [void ()* @terminate] unwind to caller
}
declare void @g()
OpenPOWER on IntegriCloud