aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 15:58:16 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 15:58:16 +0000
commit3a0a15afe7289730238c9ea311b2823900311a3c (patch)
treea5dfc418230d3e362fe9ce4c254c1e220fe49bb4 /llvm/lib/CodeGen/MachinePipeliner.cpp
parentb9b75b8cb639016dc8093204124b7ba1f942f35c (diff)
downloadllvm-3a0a15afe7289730238c9ea311b2823900311a3c.zip
llvm-3a0a15afe7289730238c9ea311b2823900311a3c.tar.gz
llvm-3a0a15afe7289730238c9ea311b2823900311a3c.tar.bz2
[Pipeliner] Fix in the pipeliner phi reuse code
When the definition of a phi is used by a phi in the next iteration, the pipeliner was assuming that the definition is processed first. Because of the assumption, an incorrect phi name was used. This patch has a check to see if the phi definition has been processed already. Patch by Brendon Cahoon. llvm-svn: 328510
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 527f1e4..34e6c63 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2723,7 +2723,8 @@ void SwingSchedulerDAG::generateExistingPhis(
int LVNumStages = Schedule.getStagesForPhi(LoopVal);
int StageDiff = (StageScheduled - LoopValStage);
LVNumStages -= StageDiff;
- if (LVNumStages > (int)np) {
+ // Make sure the loop value Phi has been processed already.
+ if (LVNumStages > (int)np && VRMap[CurStageNum].count(LoopVal)) {
NewReg = PhiOp2;
unsigned ReuseStage = CurStageNum;
if (Schedule.isLoopCarried(this, *PhiInst))