[llvm] r298232 - Remove unnecessary IDom check

Xin Tong via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 19 17:30:19 PDT 2017


Author: trentxintong
Date: Sun Mar 19 19:30:19 2017
New Revision: 298232

URL: http://llvm.org/viewvc/llvm-project?rev=298232&view=rev
Log:
Remove unnecessary IDom check

Summary: This Idom check seems unnecessary. The immediate children of a node on the Dominator Tree should always be the IDom of its immediate children in this case.

Reviewers: hfinkel, majnemer, dberlin

Reviewed By: dberlin

Subscribers: dberlin, davide, llvm-commits

Differential Revision: https://reviews.llvm.org/D26954

Modified:
    llvm/trunk/lib/Transforms/Scalar/Sink.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/Sink.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Sink.cpp?rev=298232&r1=298231&r2=298232&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Sink.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Sink.cpp Sun Mar 19 19:30:19 2017
@@ -164,13 +164,14 @@ static bool SinkInstruction(Instruction
 
   // Instructions can only be sunk if all their uses are in blocks
   // dominated by one of the successors.
-  // Look at all the postdominators and see if we can sink it in one.
+  // Look at all the dominated blocks and see if we can sink it in one.
   DomTreeNode *DTN = DT.getNode(Inst->getParent());
   for (DomTreeNode::iterator I = DTN->begin(), E = DTN->end();
       I != E && SuccToSinkTo == nullptr; ++I) {
     BasicBlock *Candidate = (*I)->getBlock();
-    if ((*I)->getIDom()->getBlock() == Inst->getParent() &&
-        IsAcceptableTarget(Inst, Candidate, DT, LI))
+    // A node always immediate-dominates its children on the dominator
+    // tree.
+    if (IsAcceptableTarget(Inst, Candidate, DT, LI))
       SuccToSinkTo = Candidate;
   }
 




More information about the llvm-commits mailing list