aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
diff options
context:
space:
mode:
authorSam Tebbs <samuel.tebbs@arm.com>2020-08-26 11:11:15 +0100
committerSam Tebbs <samuel.tebbs@arm.com>2020-08-26 12:40:39 +0100
commit85dd852a0d46684883fe3b4b19e780ba5d915b06 (patch)
tree5ea1d02bb5651384eb5a873579938e59645f8794 /llvm/lib/CodeGen/ReachingDefAnalysis.cpp
parentfc13d3d50e60e67b485720d5b2d049e8699249cc (diff)
downloadllvm-85dd852a0d46684883fe3b4b19e780ba5d915b06.zip
llvm-85dd852a0d46684883fe3b4b19e780ba5d915b06.tar.gz
llvm-85dd852a0d46684883fe3b4b19e780ba5d915b06.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/ReachingDefAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/ReachingDefAnalysis.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
index 4e18c7d..cb53ea4 100644
--- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -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