diff options
Diffstat (limited to 'test/Transforms/TailCallElim/basic.ll')
| -rw-r--r-- | test/Transforms/TailCallElim/basic.ll | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/Transforms/TailCallElim/basic.ll b/test/Transforms/TailCallElim/basic.ll index 35420ab08c33..8e9814b52bbc 100644 --- a/test/Transforms/TailCallElim/basic.ll +++ b/test/Transforms/TailCallElim/basic.ll @@ -143,3 +143,48 @@ cond_false: call void @noarg() ret i32* null } + +; Don't tail call if a byval arg is captured. +define void @test9(i32* byval %a) { +; CHECK-LABEL: define void @test9( +; CHECK: {{^ *}}call void @use( + call void @use(i32* %a) + ret void +} + +%struct.X = type { i8* } + +declare void @ctor(%struct.X*) +define void @test10(%struct.X* noalias sret %agg.result, i1 zeroext %b) { +; CHECK-LABEL @test10 +entry: + %x = alloca %struct.X, align 8 + br i1 %b, label %if.then, label %if.end + +if.then: ; preds = %entry + call void @ctor(%struct.X* %agg.result) +; CHECK: tail call void @ctor + br label %return + +if.end: + call void @ctor(%struct.X* %x) +; CHECK: call void @ctor + br label %return + +return: + ret void +} + +declare void @test11_helper1(i8** nocapture, i8*) +declare void @test11_helper2(i8*) +define void @test11() { +; CHECK-LABEL: @test11 +; CHECK-NOT: tail + %a = alloca i8* + %b = alloca i8 + call void @test11_helper1(i8** %a, i8* %b) ; a = &b + %c = load i8** %a + call void @test11_helper2(i8* %c) +; CHECK: call void @test11_helper2 + ret void +} |
