[llvm] r275468 - [SCCP] Pass the Solver by reference, copies are expensive ...

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 13:25:55 PDT 2016


Author: davide
Date: Thu Jul 14 15:25:54 2016
New Revision: 275468

URL: http://llvm.org/viewvc/llvm-project?rev=275468&view=rev
Log:
[SCCP] Pass the Solver by reference, copies are expensive ...

.. enough to cause LTO compile time to regress insanely.
Thanks *a lot* to Rafael for reporting the problem and testing
the fix!

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

Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=275468&r1=275467&r2=275468&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Thu Jul 14 15:25:54 2016
@@ -1510,7 +1510,7 @@ bool SCCPSolver::ResolvedUndefsIn(Functi
   return false;
 }
 
-static bool tryToReplaceWithConstant(SCCPSolver Solver, Value *V) {
+static bool tryToReplaceWithConstant(SCCPSolver &Solver, Value *V) {
   Constant *Const = nullptr;
   if (V->getType()->isStructTy()) {
     std::vector<LatticeVal> IVs = Solver.getStructLatticeValueFor(V);
@@ -1540,7 +1540,7 @@ static bool tryToReplaceWithConstant(SCC
   return true;
 }
 
-static bool tryToReplaceInstWithConstant(SCCPSolver Solver, Instruction *Inst,
+static bool tryToReplaceInstWithConstant(SCCPSolver &Solver, Instruction *Inst,
                                          bool shouldEraseFromParent) {
   if (!tryToReplaceWithConstant(Solver, Inst))
     return false;




More information about the llvm-commits mailing list