[llvm] r355589 - [IDF] Delete a redundant J-edge test

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 03:42:59 PST 2019


Author: maskray
Date: Thu Mar  7 03:42:59 2019
New Revision: 355589

URL: http://llvm.org/viewvc/llvm-project?rev=355589&view=rev
Log:
[IDF] Delete a redundant J-edge test

In the DJ-graph based computation of iterated dominance frontiers,
SuccNode->getIDom() == Node is one of the tests to check if (Node,Succ)
is a J-edge. If it is true, since Node is dominated by Root,

  SuccLevel = level(Node)+1 > RootLevel

which means the next test SuccLevel > RootLevel will also be true. test
the check is redundant and can be deleted as it also involves one
indirection and provides no speed-up.

Modified:
    llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp

Modified: llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp?rev=355589&r1=355588&r2=355589&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp (original)
+++ llvm/trunk/lib/Analysis/IteratedDominanceFrontier.cpp Thu Mar  7 03:42:59 2019
@@ -64,11 +64,6 @@ void IDFCalculator<NodeTy, IsPostDom>::c
       auto DoWork = [&](BasicBlock *Succ) {
         DomTreeNode *SuccNode = DT.getNode(Succ);
 
-        // Quickly skip all CFG edges that are also dominator tree edges instead
-        // of catching them below.
-        if (SuccNode->getIDom() == Node)
-          return;
-
         const unsigned SuccLevel = SuccNode->getLevel();
         if (SuccLevel > RootLevel)
           return;




More information about the llvm-commits mailing list