summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorBrendon Cahoon <bcahoon@codeaurora.org>2018-08-27 22:04:50 +0000
committerBrendon Cahoon <bcahoon@codeaurora.org>2018-08-27 22:04:50 +0000
commite3841eea87b6f2a0e4d1acfe8749020f60825b6a (patch)
tree2e9e41dae7a6d81b3675dd78778185f93bd2603e /llvm/test/CodeGen
parent211874d2f301da5e4e201a0c9f335e960c396808 (diff)
downloadbcm5719-llvm-e3841eea87b6f2a0e4d1acfe8749020f60825b6a.tar.gz
bcm5719-llvm-e3841eea87b6f2a0e4d1acfe8749020f60825b6a.zip
[Pipeliner] Fix incorrect phi values in the epilog and kernel
The code that generates the loop definition operand for phis in the epilog and kernel is incorrect in some cases. In the kernel, when a phi refers to another phi, the code that updates PhiOp2 needs to include the stage difference between the two phis. In the epilog, the check for using the loop definition instead of the phi definition uses the StageDiffAdj value (the difference between the phi stage and the loop definition stage), but the adjustment is not needed to determine if the current stage contains an iteration with the loop definition. Differential Revision: https://reviews.llvm.org/D51167 llvm-svn: 340782
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/Hexagon/swp-epilog-phi11.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Hexagon/swp-epilog-phi11.ll b/llvm/test/CodeGen/Hexagon/swp-epilog-phi11.ll
new file mode 100644
index 00000000000..1fd6757326c
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/swp-epilog-phi11.ll
@@ -0,0 +1,33 @@
+; RUN: llc -mtriple=hexagon-unknown-elf -mcpu=hexagonv55 -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
+
+; Test that the pipeliner correctly generates the operands in the
+; epilog.
+
+; CHECK: loop0
+; CHECK: r{{[0-9]+}} = sfsub([[REG0:r([0-9]+)]],[[REG1:r([0-9]+)]])
+; CHECK: endloop0
+; CHECK: r{{[0-9]+}} = sfsub([[REG0]],[[REG1]])
+; CHECK: r{{[0-9]+}} = sfsub([[REG0]],r{{[0-9]+}})
+
+define dso_local void @test(i32 %m) local_unnamed_addr #0 {
+entry:
+ %div = sdiv i32 %m, 2
+ %sub = add nsw i32 %div, -1
+ br label %for.body.prol
+
+for.body.prol:
+ %i.0106.prol = phi i32 [ undef, %for.body.prol ], [ %sub, %entry ]
+ %sr.prol = phi float [ %0, %for.body.prol ], [ undef, %entry ]
+ %sr109.prol = phi float [ %sr.prol, %for.body.prol ], [ undef, %entry ]
+ %prol.iter = phi i32 [ %prol.iter.sub, %for.body.prol ], [ undef, %entry ]
+ %0 = load float, float* undef, align 4
+ %sub7.prol = fsub contract float %sr109.prol, %0
+ store float %sub7.prol, float* null, align 4
+ %prol.iter.sub = add i32 %prol.iter, -1
+ %prol.iter.cmp = icmp eq i32 %prol.iter.sub, 0
+ br i1 %prol.iter.cmp, label %for.body.prol.loopexit, label %for.body.prol
+
+for.body.prol.loopexit:
+ unreachable
+}
+
OpenPOWER on IntegriCloud