aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 16:41:36 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 16:41:36 +0000
commit16e66f590132791c2bbd9b69594a3a7f56809ce7 (patch)
tree228651e4a07dfe01dadd95fd9420a2d42cb9f947 /llvm/lib/CodeGen/MachinePipeliner.cpp
parent92327c50d39586feeedd046eb73095dd9705cac6 (diff)
downloadllvm-16e66f590132791c2bbd9b69594a3a7f56809ce7.zip
llvm-16e66f590132791c2bbd9b69594a3a7f56809ce7.tar.gz
llvm-16e66f590132791c2bbd9b69594a3a7f56809ce7.tar.bz2
[Pipeliner] Fix renaming in pipeliner when eliminating phis
The phi renaming code in the pipeliner uses the wrong value when rewriting phi uses, which results in an undefined value. In this case, the original phi is no longer needed due to the order of instruction in the pipelined loop. The pipeliner was assuming, in this case, the the phi loop definition should be used to rewrite the uses. However, the pipeliner needs to check to make sure that the loop definition has already been scheduled. If not, then the phi initial value needs to be used instead. Patch by Brendon Cahoon. llvm-svn: 328545
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 2a438ec..a3c6003 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2624,7 +2624,7 @@ void SwingSchedulerDAG::generateExistingPhis(
// of the Phi value.
unsigned NewReg = VRMap[PrevStage][LoopVal];
rewriteScheduledInstr(NewBB, Schedule, InstrMap, CurStageNum, 0, &*BBI,
- Def, NewReg);
+ Def, InitVal, NewReg);
if (VRMap[CurStageNum].count(LoopVal))
VRMap[CurStageNum][Def] = VRMap[CurStageNum][LoopVal];
}