2016-02-01 04:29:38 +01:00
|
|
|
; RUN: opt -mtriple=x86_x64-pc-windows-msvc -S -winehprepare -disable-demotion -disable-cleanups < %s | FileCheck %s
|
2015-09-16 20:40:37 +02:00
|
|
|
|
|
|
|
declare i32 @__CxxFrameHandler3(...)
|
|
|
|
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
declare i32 @__C_specific_handler(...)
|
|
|
|
|
2015-09-16 20:40:37 +02:00
|
|
|
declare void @f()
|
|
|
|
|
|
|
|
declare i32 @g()
|
|
|
|
|
|
|
|
declare void @h(i32)
|
|
|
|
|
|
|
|
; CHECK-LABEL: @test1(
|
2015-12-15 22:27:27 +01:00
|
|
|
define void @test1(i1 %bool) personality i32 (...)* @__C_specific_handler {
|
2015-09-16 20:40:37 +02:00
|
|
|
entry:
|
|
|
|
invoke void @f()
|
2015-12-15 22:27:27 +01:00
|
|
|
to label %invoke.cont unwind label %left
|
2015-09-16 20:40:37 +02:00
|
|
|
|
2015-12-15 22:27:27 +01:00
|
|
|
invoke.cont:
|
2015-09-16 20:40:37 +02:00
|
|
|
invoke void @f()
|
|
|
|
to label %exit unwind label %inner
|
|
|
|
|
|
|
|
left:
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
%0 = cleanuppad within none []
|
2015-12-15 22:27:27 +01:00
|
|
|
br i1 %bool, label %shared, label %cleanupret
|
|
|
|
|
|
|
|
cleanupret:
|
|
|
|
cleanupret from %0 unwind label %right
|
2015-09-16 20:40:37 +02:00
|
|
|
|
|
|
|
right:
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
%1 = cleanuppad within none []
|
2015-09-16 20:40:37 +02:00
|
|
|
br label %shared
|
|
|
|
|
|
|
|
shared:
|
|
|
|
%x = call i32 @g()
|
2016-01-10 05:30:02 +01:00
|
|
|
invoke void @f()
|
2015-09-16 20:40:37 +02:00
|
|
|
to label %shared.cont unwind label %inner
|
|
|
|
|
|
|
|
shared.cont:
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
inner:
|
2015-12-15 22:27:27 +01:00
|
|
|
%phi = phi i32 [ %x, %shared ], [ 0, %invoke.cont ]
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
%i = cleanuppad within none []
|
2015-09-16 20:40:37 +02:00
|
|
|
call void @h(i32 %phi)
|
|
|
|
unreachable
|
|
|
|
|
2015-12-15 22:27:27 +01:00
|
|
|
; CHECK: %phi = phi i32 [ %x, %shared ], [ 0, %invoke.cont ], [ %x.for.left, %shared.for.left ]
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
; CHECK: %i = cleanuppad within none []
|
|
|
|
; CHECK: call void @h(i32 %phi)
|
2015-11-09 20:59:02 +01:00
|
|
|
|
2015-09-16 20:40:37 +02:00
|
|
|
exit:
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: @test2(
|
2015-12-15 22:27:27 +01:00
|
|
|
define void @test2(i1 %bool) personality i32 (...)* @__C_specific_handler {
|
2015-09-16 20:40:37 +02:00
|
|
|
entry:
|
|
|
|
invoke void @f()
|
2015-12-15 22:27:27 +01:00
|
|
|
to label %shared.cont unwind label %left
|
2015-09-16 20:40:37 +02:00
|
|
|
|
|
|
|
left:
|
2015-12-15 22:27:27 +01:00
|
|
|
%0 = cleanuppad within none []
|
|
|
|
br i1 %bool, label %shared, label %cleanupret
|
|
|
|
|
|
|
|
cleanupret:
|
|
|
|
cleanupret from %0 unwind label %right
|
2015-09-16 20:40:37 +02:00
|
|
|
|
|
|
|
right:
|
2015-12-15 22:27:27 +01:00
|
|
|
%1 = cleanuppad within none []
|
2015-09-16 20:40:37 +02:00
|
|
|
br label %shared
|
|
|
|
|
|
|
|
shared:
|
|
|
|
%x = call i32 @g()
|
2016-01-10 05:30:02 +01:00
|
|
|
invoke void @f()
|
2015-09-16 20:40:37 +02:00
|
|
|
to label %shared.cont unwind label %inner
|
|
|
|
|
|
|
|
shared.cont:
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
inner:
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
%i = cleanuppad within none []
|
2015-09-16 20:40:37 +02:00
|
|
|
call void @h(i32 %x)
|
|
|
|
unreachable
|
|
|
|
|
2015-12-15 22:27:27 +01:00
|
|
|
; CHECK: %x1 = phi i32 [ %x.for.left, %shared.for.left ], [ %x, %shared ]
|
|
|
|
; CHECK: %i = cleanuppad within none []
|
|
|
|
; CHECK: call void @h(i32 %x1)
|
2015-11-09 20:59:02 +01:00
|
|
|
|
2015-09-16 20:40:37 +02:00
|
|
|
exit:
|
|
|
|
unreachable
|
|
|
|
}
|
2015-09-16 22:42:16 +02:00
|
|
|
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
; CHECK-LABEL: @test4(
|
|
|
|
define void @test4(i1 %x) personality i32 (...)* @__CxxFrameHandler3 {
|
|
|
|
entry:
|
|
|
|
invoke void @f()
|
|
|
|
to label %invoke.cont1 unwind label %left
|
|
|
|
|
|
|
|
invoke.cont1:
|
|
|
|
invoke void @f()
|
|
|
|
to label %exit unwind label %right
|
|
|
|
|
|
|
|
left:
|
|
|
|
%0 = cleanuppad within none []
|
|
|
|
br label %shared
|
|
|
|
|
|
|
|
right:
|
|
|
|
%1 = cleanuppad within none []
|
|
|
|
br i1 %x, label %shared, label %right.other
|
|
|
|
|
|
|
|
right.other:
|
|
|
|
br label %shared
|
|
|
|
|
|
|
|
shared:
|
|
|
|
%phi = phi i32 [ 1, %left ], [ 0, %right ], [ -1, %right.other ]
|
|
|
|
call void @h(i32 %phi)
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
; CHECK: %phi = phi i32 [ 0, %right ], [ -1, %right.other ]
|
|
|
|
; CHECK: call void @h(i32 %phi)
|
|
|
|
|
2015-12-15 22:27:27 +01:00
|
|
|
; CHECK: %phi.for.left = phi i32 [ 1, %left ]
|
|
|
|
; CHECK: call void @h(i32 %phi.for.left)
|
|
|
|
|
[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
2015-12-12 06:38:55 +01:00
|
|
|
exit:
|
|
|
|
unreachable
|
2015-09-16 22:42:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
declare void @__std_terminate()
|