summaryrefslogtreecommitdiff
path: root/test/Transforms/TailCallElim
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2014-05-05 23:59:03 +0000
committerNick Lewycky <nicholas@mxc.ca>2014-05-05 23:59:03 +0000
commit05da4dd998a212a262aca58e49a1c5e04c8844f3 (patch)
tree5fb381a8bd5abff639e0a1937934415e52aa1116 /test/Transforms/TailCallElim
parent59c397de1a18d0368c003ceae0794f4168a26f3c (diff)
downloadllvm-05da4dd998a212a262aca58e49a1c5e04c8844f3.tar.gz
llvm-05da4dd998a212a262aca58e49a1c5e04c8844f3.tar.bz2
llvm-05da4dd998a212a262aca58e49a1c5e04c8844f3.tar.xz
Improve 'tail' call marking in TRE. A bootstrap of clang goes from 375k calls marked tail in the IR to 470k, however this improvement does not carry into an improvement of the call/jmp ratio on x86. The most common pattern is a tail call + br to a block with nothing but a 'ret'.
The number of tail call to loop conversions remains the same (1618 by my count). The new algorithm does a local scan over the use-def chains to identify local "alloca-derived" values, as well as points where the alloca could escape. Then, a visit over the CFG marks blocks as being before or after the allocas have escaped, and annotates the calls accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208017 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/TailCallElim')
-rw-r--r--test/Transforms/TailCallElim/basic.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/TailCallElim/basic.ll b/test/Transforms/TailCallElim/basic.ll
index 5582ee33ed..341736d48e 100644
--- a/test/Transforms/TailCallElim/basic.ll
+++ b/test/Transforms/TailCallElim/basic.ll
@@ -151,3 +151,26 @@ define void @test9(i32* byval %a) {
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
+}