summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorJinsong Ji <jji@us.ibm.com>2019-07-09 02:27:35 +0000
committerJinsong Ji <jji@us.ibm.com>2019-07-09 02:27:35 +0000
commitcbd64f7648fe491f20bba9840f7637196e07ccb7 (patch)
treef4752a99da110c5f09f2542d6763ba6152a377d0 /llvm/lib/CodeGen/MachinePipeliner.cpp
parent18301fa82bf00a0bb5bef87cb83aecacf4336c0f (diff)
downloadbcm5719-llvm-cbd64f7648fe491f20bba9840f7637196e07ccb7.tar.gz
bcm5719-llvm-cbd64f7648fe491f20bba9840f7637196e07ccb7.zip
[MachinePipeliner] Fix Phi refers to Phi in same stage in 1st epilogue
Summary: This is exposed by functional testing on PowerPC. In some pipelined loops, Phi refer to phi did not get value defined by the Phi, hence getting wrong value later. As the comment mentioned, we should "use the value defined by the Phi, unless we're generating the firstepilog and the Phi refers to a Phi in a different stage.", so Phi refering to same stage Phi should use the value defined by the Phi here. Reviewers: bcahoon, hfinkel Reviewed By: hfinkel Subscribers: MaskRay, wuzish, nemanjai, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64035 llvm-svn: 365428
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 167c05f9ef4..9c0c5cc5c70 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2430,7 +2430,7 @@ void SwingSchedulerDAG::generateExistingPhis(
// Use the value defined by the Phi, unless we're generating the first
// epilog and the Phi refers to a Phi in a different stage.
else if (VRMap[PrevStage - np].count(Def) &&
- (!LoopDefIsPhi || PrevStage != LastStageNum))
+ (!LoopDefIsPhi || (PrevStage != LastStageNum) || (LoopValStage == StageScheduled)))
PhiOp2 = VRMap[PrevStage - np][Def];
}
OpenPOWER on IntegriCloud