[PATCH] D26954: Remove unnecessary IDom check

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 19 14:56:49 PDT 2017


trentxintong updated this revision to Diff 92295.
trentxintong added a comment.

Address davide's comment


https://reviews.llvm.org/D26954

Files:
  lib/Transforms/Scalar/Sink.cpp


Index: lib/Transforms/Scalar/Sink.cpp
===================================================================
--- lib/Transforms/Scalar/Sink.cpp
+++ lib/Transforms/Scalar/Sink.cpp
@@ -169,8 +169,11 @@
   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 should always immediate-dominate its children on the dominator
+    // tree.
+    assert((*I)->getIDom()->getBlock() == Inst->getParent() &&
+           "Broken dominator tree ?");
+    if (IsAcceptableTarget(Inst, Candidate, DT, LI))
       SuccToSinkTo = Candidate;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26954.92295.patch
Type: text/x-patch
Size: 762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170319/8f6cf187/attachment.bin>


More information about the llvm-commits mailing list