[llvm] r302332 - [SCEV] Avoid a couple APInt copies by capturing by reference since the method returns a reference.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 22:15:09 PDT 2017


Author: ctopper
Date: Sat May  6 00:15:09 2017
New Revision: 302332

URL: http://llvm.org/viewvc/llvm-project?rev=302332&view=rev
Log:
[SCEV] Avoid a couple APInt copies by capturing by reference since the method returns a reference.

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

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=302332&r1=302331&r2=302332&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat May  6 00:15:09 2017
@@ -8943,7 +8943,7 @@ bool ScalarEvolution::isImpliedCondOpera
   if (!Addend)
     return false;
 
-  APInt ConstFoundRHS = cast<SCEVConstant>(FoundRHS)->getAPInt();
+  const APInt &ConstFoundRHS = cast<SCEVConstant>(FoundRHS)->getAPInt();
 
   // `FoundLHSRange` is the range we know `FoundLHS` to be in by virtue of the
   // antecedent "`FoundLHS` `Pred` `FoundRHS`".
@@ -8955,7 +8955,7 @@ bool ScalarEvolution::isImpliedCondOpera
 
   // We can also compute the range of values for `LHS` that satisfy the
   // consequent, "`LHS` `Pred` `RHS`":
-  APInt ConstRHS = cast<SCEVConstant>(RHS)->getAPInt();
+  const APInt &ConstRHS = cast<SCEVConstant>(RHS)->getAPInt();
   ConstantRange SatisfyingLHSRange =
       ConstantRange::makeSatisfyingICmpRegion(Pred, ConstRHS);
 




More information about the llvm-commits mailing list