diff options
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
| -rw-r--r-- | llvm/test/Transforms/FunctionAttrs/liveness.ll | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/liveness.ll b/llvm/test/Transforms/FunctionAttrs/liveness.ll index e16677dc158..eef674b53ec 100644 --- a/llvm/test/Transforms/FunctionAttrs/liveness.ll +++ b/llvm/test/Transforms/FunctionAttrs/liveness.ll @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes ; RUN: opt -attributor --attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s ; UTC_ARGS: --turn off @@ -8,6 +8,8 @@ declare void @normal_call() readnone declare i32 @foo() +declare i32 @foo_nounwind() nounwind + declare i32 @foo_noreturn_nounwind() noreturn nounwind declare i32 @foo_noreturn() noreturn @@ -162,7 +164,7 @@ cond.end: ; preds = %cond.false, %cond.t ret i32 %cond } -; TEST 5 noreturn invoke instruction with a unreachable normal successor block. +; TEST 5.1 noreturn invoke instruction with a unreachable normal successor block. ; CHECK: define i32 @invoke_noreturn(i32 %a) define i32 @invoke_noreturn(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { @@ -197,7 +199,7 @@ cleanup: ret i32 0 } -; TEST 4.1 noreturn invoke instruction replaced by a call and an unreachable instruction +; TEST 5.2 noreturn invoke instruction replaced by a call and an unreachable instruction ; put after it. ; CHECK: define i32 @invoke_noreturn_nounwind(i32 %a) @@ -234,6 +236,45 @@ cleanup: ret i32 0 } +; TEST 5.3 unounwind invoke instruction replaced by a call and a branch instruction put after it. +define i32 @invoke_nounwind(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind +; CHECK: cond.true: +; CHECK-NEXT: call void @normal_call() +; CHECK-NEXT: [[CALL:%.*]] = call i32 @foo_nounwind() +; CHECK-NEXT: br label [[CONTINUE:%.*]] +; CHECK: continue: +; CHECK-NEXT: br label [[COND_END:%.*]] +; +entry: + %cmp = icmp eq i32 %a, 0 + br i1 %cmp, label %cond.true, label %cond.false + +cond.true: ; preds = %entry + call void @normal_call() + %call = invoke i32 @foo_nounwind() to label %continue + unwind label %cleanup + +cond.false: ; preds = %entry + call void @normal_call() + %call1 = call i32 @bar() + br label %cond.end + +cond.end: ; preds = %cond.false, %continue + %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ] + ret i32 %cond + +continue: + br label %cond.end + +cleanup: + %res = landingpad { i8*, i32 } + catch i8* null + ret i32 0 +} + +; UTC_ARGS: --turn off + ; TEST 6: Undefined behvior, taken from LangRef. ; FIXME: Should be able to detect undefined behavior. |

