summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2016-09-01 12:58:13 +0000
committerJames Molloy <james.molloy@arm.com>2016-09-01 12:58:13 +0000
commit88cad7e5cf465fdb995424058e0e111a65493f6e (patch)
tree63c10e700ddf02c75cb921d4d075b3e2214a710b /llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll
parentf1fb439d31fb0634cb48c836b4d7ab60b3e814e2 (diff)
downloadbcm5719-llvm-88cad7e5cf465fdb995424058e0e111a65493f6e.tar.gz
bcm5719-llvm-88cad7e5cf465fdb995424058e0e111a65493f6e.zip
[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches
This was a real restriction in the original version of SinkIfThenCodeToEnd. Now it's been rewritten, the restriction can be lifted. As part of this, we handle a very common and useful case where one of the incoming branches is actually conditional. Consider: if (a) x(1); else if (b) x(2); This produces the following CFG: [if] / \ [x(1)] [if] | | \ | | \ | [x(2)] | \ | / [ end ] [end] has two unconditional predecessor arcs and one conditional. The conditional refers to the implicit empty 'else' arc. This same pattern can also be caused by an empty default block in a switch. We can't sink the call to x() down to end because no call to x() happens on the third incoming arc (assume that x() has sideeffects for the sake of argument; if something is safe to speculate we could indeed sink nevertheless but this cannot happen in the general case and causes many extra selects). We are now able to detect this case and split off the unconditional arcs to a common successor: [if] / \ [x(1)] [if] | | \ | | \ | [x(2)] | \ / | [sink.split] | \ / [ end ] Now we can sink the call to x() into %sink.split. This can cause significant code simplification in many testcases. llvm-svn: 280364
Diffstat (limited to 'llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll')
-rw-r--r--llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll b/llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll
index 12e6f2d4889..3ecb1d49ee1 100644
--- a/llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll
+++ b/llvm/test/CodeGen/AArch64/branch-folder-merge-mmos.ll
@@ -3,7 +3,7 @@ target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
; Function Attrs: norecurse nounwind
define void @foo(i32 %a, i32 %b, float* nocapture %foo_arr) #0 {
-; CHECK: (load 4 from %ir.arrayidx1.{{i[1-2]}}), (load 4 from %ir.arrayidx1.{{i[1-2]}})
+; CHECK: (load 4 from %ir.arrayidx1.{{i[1-2]}})
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %if.then, label %if.end
OpenPOWER on IntegriCloud