[PATCH] D86607: [RDA] Don't visit the BB of the instruction in getUniqueReachingMIDef

Sam Tebbs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 03:26:14 PDT 2020


samtebbs created this revision.
samtebbs added reviewers: samparker, t.p.northover, SjoerdMeijer, dmgreen, simon_tatham, olista01.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
samtebbs requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86607

Files:
  llvm/lib/CodeGen/ReachingDefAnalysis.cpp


Index: llvm/lib/CodeGen/ReachingDefAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -421,7 +421,9 @@
 
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86607.287901.patch
Type: text/x-patch
Size: 632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200826/76afb4aa/attachment.bin>


More information about the llvm-commits mailing list