Skip to content

Commit 39f8f8a

Browse files
committed
Fix a PHI bug in the BlockDisambiguate pass.
If we have a high-level block, BBX, that loops to itself, then the BlockDisambiguate pass will insert a disambiguation block, BBY, for it. But if there are PHI nodes at the top of BBX with incoming values from the bottom of BBX, then we need to update the incoming block from BBX to BBY. We were failing to do this and it was making the compiler crash when I amended a test to use YkLocations.
1 parent dfa2d98 commit 39f8f8a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/Transforms/Yk/BlockDisambiguate.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class YkBlockDisambiguate : public ModulePass {
204204
if (SuccBB == &BB) {
205205
BasicBlock *DBB = makeDisambiguationBB(Context, &BB, NewBBs);
206206
BI->setSuccessor(SuccIdx, DBB);
207+
BB.replacePhiUsesWith(&BB, DBB);
207208
}
208209
}
209210
} else if (isa<SwitchInst>(TI)) {
@@ -214,6 +215,7 @@ class YkBlockDisambiguate : public ModulePass {
214215
if (SuccBB == &BB) {
215216
BasicBlock *DBB = makeDisambiguationBB(Context, &BB, NewBBs);
216217
SI->setSuccessor(SuccIdx, DBB);
218+
BB.replacePhiUsesWith(&BB, DBB);
217219
}
218220
}
219221
}

0 commit comments

Comments
 (0)