llvm.org GIT mirror llvm / ec51f45
Revert "TRE: make TRE a bit more aggressive" This reverts commit r219899. This also updates byval-tail-call.ll to make it clear what was breaking. Adding r219899 again will cause the load/store to disappear. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220093 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
4 changed file(s) with 14 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
248248 return false;
249249 AllCallsAreTailCalls = true;
250250
251 // The local stack holds all alloca instructions and all byval arguments.
251252 AllocaDerivedValueTracker Tracker;
253 for (Argument &Arg : F.args()) {
254 if (Arg.hasByValAttr())
255 Tracker.walk(&Arg);
256 }
252257 for (auto &BB : F) {
253258 for (auto &I : BB)
254259 if (AllocaInst *AI = dyn_cast(&I))
304309 for (auto &Arg : CI->arg_operands()) {
305310 if (isa(Arg.getUser()))
306311 continue;
307 if (isa(Arg.getUser()))
308 continue;
312 if (Argument *A = dyn_cast(Arg.getUser()))
313 if (!A->hasByValAttr())
314 continue;
309315 SafeToTail = false;
310316 break;
311317 }
None ; RUN: opt < %s -tailcallelim -inline -instcombine -dse -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -tailcallelim -inline -instcombine -dse -S | FileCheck %s
11 ; PR7272
22
33 ; Calls that capture byval parameters cannot be marked as tail calls. Other
2929
3030 define void @frob(i32* %x) {
3131 ; CHECK-LABEL: define void @frob(
32 ; CHECK: alloca i32
33 ; CHECK: {{^ *}}tail call void @ext(
32 ; CHECK: %[[POS:.*]] = alloca i32
33 ; CHECK: %[[VAL:.*]] = load i32* %x
34 ; CHECK: store i32 %[[VAL]], i32* %[[POS]]
35 ; CHECK: {{^ *}}call void @ext(i32* %[[POS]]
3436 ; CHECK: tail call void @ext(i32* null)
3537 ; CHECK: ret void
3638 tail call void @qux(i32* byval %x)
146146 ; Don't tail call if a byval arg is captured.
147147 define void @test9(i32* byval %a) {
148148 ; CHECK-LABEL: define void @test9(
149 ; CHECK: {{^ *}}tail call void @use(
149 ; CHECK: {{^ *}}call void @use(
150150 call void @use(i32* %a)
151151 ret void
152152 }
+0
-34
test/Transforms/TailCallElim/byval.ll less more
None ; RUN: opt -mtriple i386 -Os -S %s -o - | FileCheck %s
1 ; RUN: opt -mtriple x86_64 -Os -S %s -o - | FileCheck %s
2 ; RUN: opt -mtriple armv7 -Os -S %s -o - | FileCheck %s
3
4 %struct.D16 = type { [16 x double] }
5
6 declare void @_Z2OpP3D16PKS_S2_(%struct.D16*, %struct.D16*, %struct.D16*)
7
8 define void @_Z7TestRefRK3D16S1_(%struct.D16* noalias sret %agg.result, %struct.D16* %RHS, %struct.D16* %LHS) {
9 %1 = alloca %struct.D16*, align 8
10 %2 = alloca %struct.D16*, align 8
11 store %struct.D16* %RHS, %struct.D16** %1, align 8
12 store %struct.D16* %LHS, %struct.D16** %2, align 8
13 %3 = load %struct.D16** %1, align 8
14 %4 = load %struct.D16** %2, align 8
15 call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %3, %struct.D16* %4)
16 ret void
17 }
18
19 ; CHECK: define void @_Z7TestRefRK3D16S1_({{.*}}) {
20 ; CHECK: tail call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %RHS, %struct.D16* %LHS)
21 ; CHECK: ret void
22 ; CHECK: }
23
24 define void @_Z7TestVal3D16S_(%struct.D16* noalias sret %agg.result, %struct.D16* byval align 8 %RHS, %struct.D16* byval align 8 %LHS) {
25 call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %RHS, %struct.D16* %LHS)
26 ret void
27 }
28
29 ; CHECK: define void @_Z7TestVal3D16S_({{.*}}) {
30 ; CHECK: tail call void @_Z2OpP3D16PKS_S2_(%struct.D16* %agg.result, %struct.D16* %RHS, %struct.D16* %LHS)
31 ; CHECK: ret void
32 ; CHECK: }
33