diff options
author | Jinsong Ji <jji@us.ibm.com> | 2019-07-12 01:59:42 +0000 |
---|---|---|
committer | Jinsong Ji <jji@us.ibm.com> | 2019-07-12 01:59:42 +0000 |
commit | 9577086628750230cfcb288b4a31a10e4880f0a7 (patch) | |
tree | e3a7bd32f2e7a169d9c497544691cc67387daf93 /llvm/lib/CodeGen/MachinePipeliner.cpp | |
parent | c559e63798e69be1d7c66847b662b53ba88f0f9c (diff) | |
download | bcm5719-llvm-9577086628750230cfcb288b4a31a10e4880f0a7.tar.gz bcm5719-llvm-9577086628750230cfcb288b4a31a10e4880f0a7.zip |
[MachinePipeliner] Fix order for nodes with Anti dependence in same cycle
Summary:
Problem exposed in PowerPC functional testing.
We did not consider Anti dependence for nodes in same cycle,
so we may end up generating bad machine code.
eg: the reduced test won't verify.
*** Bad machine code: Using an undefined physical register ***
- function: lame_encode_buffer_interleaved
- basic block: %bb.4 (0x4bde4e12928)
- instruction: %29:gprc = ADDZE %27:gprc, implicit-def dead $carry, implicit $carry
- operand 3: implicit $carry
Reviewers: bcahoon, kparzysz, hfinkel
Subscribers: MaskRay, wuzish, nemanjai, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64192
llvm-svn: 365859
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 9c0c5cc5c70..54df522d371 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -3559,6 +3559,14 @@ void SMSchedule::orderDependence(SwingSchedulerDAG *SSD, SUnit *SU, if (Pos < MoveUse) MoveUse = Pos; } + // We did not handle HW dependences in previous for loop, + // and we normally set Latency = 0 for Anti deps, + // so may have nodes in same cycle with Anti denpendent on HW regs. + else if (S.getKind() == SDep::Anti && stageScheduled(*I) == StageInst1) { + OrderBeforeUse = true; + if ((MoveUse == 0) || (Pos < MoveUse)) + MoveUse = Pos; + } } for (auto &P : SU->Preds) { if (P.getSUnit() != *I) |