[RDA] Don't visit the BB of the instruction in getReachingUniqueMIDef

If the basic block of the instruction passed to getUniqueReachingMIDef
is a transitive predecessor of itself and has a definition of the
register, the function will return that definition even if it is after
the instruction given to the function. This patch stops the function
from scanning the instruction's basic block to prevent this.

Differential Revision: https://reviews.llvm.org/D86607
This commit is contained in:
Sam Tebbs 2020-08-26 11:11:15 +01:00
parent fc13d3d50e
commit 85dd852a0d
1 changed files with 3 additions and 1 deletions

View File

@ -423,7 +423,9 @@ MachineInstr *ReachingDefAnalysis::getUniqueReachingMIDef(MachineInstr *MI,
SmallPtrSet<MachineBasicBlock*, 4> VisitedBBs;
SmallPtrSet<MachineInstr*, 2> Incoming;
for (auto *Pred : MI->getParent()->predecessors())
MachineBasicBlock *Parent = MI->getParent();
VisitedBBs.insert(Parent);
for (auto *Pred : Parent->predecessors())
getLiveOuts(Pred, PhysReg, Incoming, VisitedBBs);
// If we have a local def and an incoming instruction, then there's not a