diff options
Diffstat (limited to 'test/Transforms/PruneEH')
-rw-r--r-- | test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll | 15 | ||||
-rw-r--r-- | test/Transforms/PruneEH/recursivetest.ll | 5 | ||||
-rw-r--r-- | test/Transforms/PruneEH/seh-nounwind.ll | 31 | ||||
-rw-r--r-- | test/Transforms/PruneEH/simpletest.ll | 4 |
4 files changed, 40 insertions, 15 deletions
diff --git a/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll b/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll deleted file mode 100644 index a010703..0000000 --- a/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: opt < %s -prune-eh -disable-output - -define internal void @callee() { - ret void -} - -define i32 @caller() { -; <label>:0 - invoke void @callee( ) - to label %E unwind label %E -E: ; preds = %0, %0 - %X = phi i32 [ 0, %0 ], [ 0, %0 ] ; <i32> [#uses=1] - ret i32 %X -} - diff --git a/test/Transforms/PruneEH/recursivetest.ll b/test/Transforms/PruneEH/recursivetest.ll index 724c7cf..bc002ae 100644 --- a/test/Transforms/PruneEH/recursivetest.ll +++ b/test/Transforms/PruneEH/recursivetest.ll @@ -6,6 +6,8 @@ define internal i32 @foo() { Normal: ; preds = %0 ret i32 12 Except: ; preds = %0 + landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + catch i8* null ret i32 123 } @@ -15,6 +17,9 @@ define i32 @caller() { Normal: ; preds = %0 ret i32 0 Except: ; preds = %0 + landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + catch i8* null ret i32 1 } +declare i32 @__gxx_personality_v0(...) diff --git a/test/Transforms/PruneEH/seh-nounwind.ll b/test/Transforms/PruneEH/seh-nounwind.ll new file mode 100644 index 0000000..4b69ae4 --- /dev/null +++ b/test/Transforms/PruneEH/seh-nounwind.ll @@ -0,0 +1,31 @@ +; RUN: opt -S -prune-eh < %s | FileCheck %s + +; Don't remove invokes of nounwind functions if the personality handles async +; exceptions. The @div function in this test can fault, even though it can't +; throw a synchronous exception. + +define i32 @div(i32 %n, i32 %d) nounwind { +entry: + %div = sdiv i32 %n, %d + ret i32 %div +} + +define i32 @main() nounwind { +entry: + %call = invoke i32 @div(i32 10, i32 0) + to label %__try.cont unwind label %lpad + +lpad: + %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) + catch i8* null + br label %__try.cont + +__try.cont: + %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ] + ret i32 %retval.0 +} + +; CHECK-LABEL: define i32 @main() +; CHECK: invoke i32 @div(i32 10, i32 0) + +declare i32 @__C_specific_handler(...) diff --git a/test/Transforms/PruneEH/simpletest.ll b/test/Transforms/PruneEH/simpletest.ll index 77c429d..6154a80 100644 --- a/test/Transforms/PruneEH/simpletest.ll +++ b/test/Transforms/PruneEH/simpletest.ll @@ -15,5 +15,9 @@ Normal: ; preds = %0 ret i32 0 Except: ; preds = %0 + landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0 + catch i8* null ret i32 1 } + +declare i32 @__gxx_personality_v0(...) |