diff options
author | Florian Hahn <florian.hahn@arm.com> | 2018-11-09 10:23:46 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2018-11-09 10:23:46 +0000 |
commit | 52578f95c9fcf7b85beea921d401f49b2f6e9d1d (patch) | |
tree | 4da059d5b168c54a586dd0562a3a528c58e2a7d5 /llvm/test | |
parent | e6b727e552844168c53ca1aff9c87b196f221a23 (diff) | |
download | bcm5719-llvm-52578f95c9fcf7b85beea921d401f49b2f6e9d1d.tar.gz bcm5719-llvm-52578f95c9fcf7b85beea921d401f49b2f6e9d1d.zip |
[CallSiteSplitting] Only record conditions up to the IDom(call site).
We can stop recording conditions once we reached the immediate dominator
for the block containing the call site. Conditions in predecessors of the
that node will be the same for all paths to the call site and splitting
is not beneficial.
This patch makes CallSiteSplitting dependent on the DT anlysis. because
the immediate dominators seem to be the easiest way of finding the node
to stop at.
I had to update some exiting tests, because they were checking for
conditions that were true/false on all paths to the call site. Those
should now be handled by instcombine/ipsccp.
Reviewers: davide, junbuml
Reviewed By: junbuml
Differential Revision: https://reviews.llvm.org/D44627
llvm-svn: 346483
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Other/new-pm-lto-defaults.ll | 4 | ||||
-rw-r--r-- | llvm/test/Other/opt-O3-pipeline.ll | 1 | ||||
-rw-r--r-- | llvm/test/Transforms/CallSiteSplitting/callsite-split-or-phi.ll | 41 |
3 files changed, 36 insertions, 10 deletions
diff --git a/llvm/test/Other/new-pm-lto-defaults.ll b/llvm/test/Other/new-pm-lto-defaults.ll index 03f4804a2ba..ee2f0414e62 100644 --- a/llvm/test/Other/new-pm-lto-defaults.ll +++ b/llvm/test/Other/new-pm-lto-defaults.ll @@ -38,13 +38,13 @@ ; CHECK-O2-NEXT: Running pass: CallSiteSplittingPass on foo ; CHECK-O2-NEXT: Running analysis: TargetLibraryAnalysis on foo ; CHECK-O2-NEXT: Running analysis: TargetIRAnalysis on foo +; CHECK-O2-NEXT: Running analysis: DominatorTreeAnalysis on foo ; CHECK-O2-NEXT: Finished llvm::Function pass manager run. ; CHECK-O2-NEXT: PGOIndirectCallPromotion ; CHECK-O2-NEXT: Running analysis: ProfileSummaryAnalysis ; CHECK-O2-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis ; CHECK-O2-NEXT: Running pass: IPSCCPPass -; CHECK-O2-DAG: Running analysis: AssumptionAnalysis on foo -; CHECK-O2-DAG: Running analysis: DominatorTreeAnalysis on foo +; CHECK-O2-NEXT: Running analysis: AssumptionAnalysis on foo ; CHECK-O2-NEXT: Running pass: CalledValuePropagationPass ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}PostOrderFunctionAttrsPass> ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}SCC diff --git a/llvm/test/Other/opt-O3-pipeline.ll b/llvm/test/Other/opt-O3-pipeline.ll index 33033fef183..51b6a6d4386 100644 --- a/llvm/test/Other/opt-O3-pipeline.ll +++ b/llvm/test/Other/opt-O3-pipeline.ll @@ -28,6 +28,7 @@ ; CHECK-NEXT: Force set function attributes ; CHECK-NEXT: Infer set function attributes ; CHECK-NEXT: FunctionPass Manager +; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Call-site splitting ; CHECK-NEXT: Interprocedural Sparse Conditional Constant Propagation ; CHECK-NEXT: Unnamed pass: implement Pass::getPassName() diff --git a/llvm/test/Transforms/CallSiteSplitting/callsite-split-or-phi.ll b/llvm/test/Transforms/CallSiteSplitting/callsite-split-or-phi.ll index d5f31f9ac91..2a400c93ae2 100644 --- a/llvm/test/Transforms/CallSiteSplitting/callsite-split-or-phi.ll +++ b/llvm/test/Transforms/CallSiteSplitting/callsite-split-or-phi.ll @@ -123,14 +123,14 @@ End: ;CHECK-LABEL: Header2.split: ;CHECK: %[[CALL1:.*]] = call i32 @callee(i32* nonnull %a, i32 %v, i32 10) ;CHECK-LABEL: TBB.split: -;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* nonnull %a, i32 %v, i32 %p) +;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* %a, i32 %v, i32 %p) ;CHECK-LABEL: Tail ;CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header2.split ], [ %[[CALL2]], %TBB.split ] ;CHECK: ret i32 %[[MERGED]] define i32 @test_ne_eq_ne(i32* %a, i32 %v, i32 %p) { Header: %tobool1 = icmp ne i32* %a, null - br i1 %tobool1, label %Header2, label %End + br i1 %tobool1, label %Header2, label %TBB Header2: %tobool2 = icmp eq i32 %p, 10 @@ -178,14 +178,14 @@ End: ;CHECK-LABEL: Header2.split: ;CHECK: %[[CALL1:.*]] = call i32 @callee(i32* nonnull %a, i32 %v, i32 %p) ;CHECK-LABEL: TBB.split: -;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* nonnull %a, i32 %v, i32 %p) +;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* %a, i32 %v, i32 %p) ;CHECK-LABEL: Tail ;CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header2.split ], [ %[[CALL2]], %TBB.split ] ;CHECK: ret i32 %[[MERGED]] define i32 @test_ne_ne_ne_constrain_same_pointer_arg(i32* %a, i32 %v, i32 %p, i32* %a2, i32* %a3) { Header: %tobool1 = icmp ne i32* %a, null - br i1 %tobool1, label %Header2, label %End + br i1 %tobool1, label %Header2, label %TBB Header2: %tobool2 = icmp ne i32* %a, %a2 @@ -235,14 +235,14 @@ End: ;CHECK-LABEL: Header2.split: ;CHECK: %[[CALL1:.*]] = call i32 @callee(i32* nonnull %a, i32 %v, i32 10) ;CHECK-LABEL: TBB.split: -;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* nonnull %a, i32 1, i32 %p) +;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* %a, i32 1, i32 %p) ;CHECK-LABEL: Tail ;CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header2.split ], [ %[[CALL2]], %TBB.split ] ;CHECK: ret i32 %[[MERGED]] define i32 @test_eq_eq_eq_untaken(i32* %a, i32 %v, i32 %p) { Header: %tobool1 = icmp eq i32* %a, null - br i1 %tobool1, label %End, label %Header2 + br i1 %tobool1, label %TBB, label %Header2 Header2: %tobool2 = icmp eq i32 %p, 10 @@ -290,14 +290,14 @@ End: ;CHECK-LABEL: Header2.split: ;CHECK: %[[CALL1:.*]] = call i32 @callee(i32* null, i32 %v, i32 10) ;CHECK-LABEL: TBB.split: -;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* null, i32 %v, i32 %p) +;CHECK: %[[CALL2:.*]] = call i32 @callee(i32* %a, i32 %v, i32 %p) ;CHECK-LABEL: Tail ;CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header2.split ], [ %[[CALL2]], %TBB.split ] ;CHECK: ret i32 %[[MERGED]] define i32 @test_ne_eq_ne_untaken(i32* %a, i32 %v, i32 %p) { Header: %tobool1 = icmp ne i32* %a, null - br i1 %tobool1, label %End, label %Header2 + br i1 %tobool1, label %TBB, label %Header2 Header2: %tobool2 = icmp eq i32 %p, 10 @@ -489,6 +489,31 @@ End: ret i32 %v } +;CHECK-LABEL: @test_cond_no_effect +;CHECK-NOT: Header.split: +;CHECK-NOT: TBB.split: +;CHECK-LABEL: Tail: +;CHECK: %r = call i32 @callee(i32* %a, i32 %v, i32 0) +;CHECK: ret i32 %r +define i32 @test_cond_no_effect(i32* %a, i32 %v) { +Entry: + %tobool1 = icmp eq i32* %a, null + br i1 %tobool1, label %Header, label %End + +Header: + br i1 undef, label %Tail, label %TBB + +TBB: + br i1 undef, label %Tail, label %End + +Tail: + %r = call i32 @callee(i32* %a, i32 %v, i32 0) + ret i32 %r + +End: + ret i32 %v +} + ;CHECK-LABEL: @test_unreachable ;CHECK-LABEL: Header.split: ;CHECK: %[[CALL1:.*]] = call i32 @callee(i32* %a, i32 %v, i32 10) |