[llvm] r309790 - [NewGVN] Fold single-use variables. NFCI.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 21:05:49 PDT 2017


Author: davide
Date: Tue Aug  1 21:05:49 2017
New Revision: 309790

URL: http://llvm.org/viewvc/llvm-project?rev=309790&view=rev
Log:
[NewGVN] Fold single-use variables. NFCI.

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

Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=309790&r1=309789&r2=309790&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Tue Aug  1 21:05:49 2017
@@ -781,11 +781,9 @@ bool StoreExpression::equals(const Expre
 
 // Determine if the edge From->To is a backedge
 bool NewGVN::isBackedge(BasicBlock *From, BasicBlock *To) const {
-  if (From == To)
-    return true;
-  auto *FromDTN = DT->getNode(From);
-  auto *ToDTN = DT->getNode(To);
-  return RPOOrdering.lookup(FromDTN) >= RPOOrdering.lookup(ToDTN);
+  return From == To ||
+         RPOOrdering.lookup(DT->getNode(From)) >=
+             RPOOrdering.lookup(DT->getNode(To));
 }
 
 #ifndef NDEBUG




More information about the llvm-commits mailing list