[llvm] r293112 - [NewGVN] Simplify folding a lambda used only once. NFCI.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 15:37:49 PST 2017


Author: davide
Date: Wed Jan 25 17:37:49 2017
New Revision: 293112

URL: http://llvm.org/viewvc/llvm-project?rev=293112&view=rev
Log:
[NewGVN] Simplify folding a lambda used only once. 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=293112&r1=293111&r2=293112&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Wed Jan 25 17:37:49 2017
@@ -430,12 +430,10 @@ PHIExpression *NewGVN::createPHIExpressi
   E->setType(I->getType());
   E->setOpcode(I->getOpcode());
 
-  auto ReachablePhiArg = [&](const Use &U) {
+  // Filter out unreachable phi operands.
+  auto Filtered = make_filter_range(PN->operands(), [&](const Use &U) {
     return ReachableBlocks.count(PN->getIncomingBlock(U));
-  };
-
-  // Filter out unreachable operands
-  auto Filtered = make_filter_range(PN->operands(), ReachablePhiArg);
+  });
 
   std::transform(Filtered.begin(), Filtered.end(), op_inserter(E),
                  [&](const Use &U) -> Value * {




More information about the llvm-commits mailing list