diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-12-22 18:49:55 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-12-22 18:49:55 +0000 |
commit | 2272dc886cc27388d06f256db084b891c1f0cbfd (patch) | |
tree | 21e67474cb8ad78a233ef0ced4507288d2da0e46 /lib/CodeGen/MachinePipeliner.cpp | |
parent | ad47821c65d3791228def588aafb27a095c06433 (diff) |
Fix two bugs in the pipeliner in renaming phis in the prolog and epilog
When the pipeliner is renaming phi values, it may need to iterate through
the phi operands to check for other phis. However, the pipeliner should
stop once it reaches a phi that is outside the pipelined loop.
Also, when the generateExistingPhis code is unable to reuse an existing
phi, the default code that computes the PhiOp2 is only to be used when
the pipeliner is generating the kernel. Otherwise, the phi may be a value
computed earlier in the same epilog.
Patch by Brendon Cahoon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290355 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | lib/CodeGen/MachinePipeliner.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/MachinePipeliner.cpp b/lib/CodeGen/MachinePipeliner.cpp index c908681df2e..d9528cdc25b 100644 --- a/lib/CodeGen/MachinePipeliner.cpp +++ b/lib/CodeGen/MachinePipeliner.cpp @@ -2676,7 +2676,7 @@ void SwingSchedulerDAG::generateExistingPhis( replaceRegUsesAfterLoop(Def, NewReg, BB, MRI, LIS); continue; } - } else if (StageDiff > 0 && + } else if (InKernel && StageDiff > 0 && VRMap[CurStageNum - StageDiff - np].count(LoopVal)) PhiOp2 = VRMap[CurStageNum - StageDiff - np][LoopVal]; } @@ -3216,7 +3216,7 @@ unsigned SwingSchedulerDAG::getPrevMapVal(unsigned StageNum, unsigned PhiStage, // The previous name is defined in the current stage when the instruction // order is swapped. PrevVal = VRMap[StageNum][LoopVal]; - else if (!LoopInst->isPHI()) + else if (!LoopInst->isPHI() || LoopInst->getParent() != BB) // The loop value hasn't yet been scheduled. PrevVal = LoopVal; else if (StageNum == PhiStage + 1) |