[llvm] r303523 - [SimplifyCFG] Prevent a few APInt copies on method calls that return const reference. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun May 21 17:49:35 PDT 2017


Author: ctopper
Date: Sun May 21 19:49:35 2017
New Revision: 303523

URL: http://llvm.org/viewvc/llvm-project?rev=303523&view=rev
Log:
[SimplifyCFG] Prevent a few APInt copies on method calls that return const reference. NFCI

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=303523&r1=303522&r2=303523&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Sun May 21 19:49:35 2017
@@ -4380,7 +4380,7 @@ static bool EliminateDeadSwitchCases(Swi
   // Gather dead cases.
   SmallVector<ConstantInt *, 8> DeadCases;
   for (auto &Case : SI->cases()) {
-    APInt CaseVal = Case.getCaseValue()->getValue();
+    const APInt &CaseVal = Case.getCaseValue()->getValue();
     if (Known.Zero.intersects(CaseVal) || !Known.One.isSubsetOf(CaseVal) ||
         (CaseVal.getMinSignedBits() > MaxSignificantBitsInCond)) {
       DeadCases.push_back(Case.getCaseValue());
@@ -4946,7 +4946,7 @@ SwitchLookupTable::SwitchLookupTable(
         LinearMappingPossible = false;
         break;
       }
-      APInt Val = ConstVal->getValue();
+      const APInt &Val = ConstVal->getValue();
       if (I != 0) {
         APInt Dist = Val - PrevVal;
         if (I == 1) {




More information about the llvm-commits mailing list