[llvm-commits] [llvm] r53065 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Dan Gohman gohman at apple.com
Wed Jul 2 17:52:03 PDT 2008


Author: djg
Date: Wed Jul  2 19:52:03 2008
New Revision: 53065

URL: http://llvm.org/viewvc/llvm-project?rev=53065&view=rev
Log:
Avoid unnecessarily copying APInt objects.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53065&r1=53064&r2=53065&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul  2 19:52:03 2008
@@ -1601,7 +1601,7 @@
   }
   case ISD::SREM:
     if (ConstantSDNode *Rem = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
-      APInt RA = Rem->getAPIntValue();
+      const APInt &RA = Rem->getAPIntValue();
       if (RA.isPowerOf2() || (-RA).isPowerOf2()) {
         APInt LowBits = RA.isStrictlyPositive() ? (RA - 1) : ~RA;
         APInt Mask2 = LowBits | APInt::getSignBit(BitWidth);
@@ -1623,7 +1623,7 @@
     return;
   case ISD::UREM: {
     if (ConstantSDNode *Rem = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
-      APInt RA = Rem->getAPIntValue();
+      const APInt &RA = Rem->getAPIntValue();
       if (RA.isPowerOf2()) {
         APInt LowBits = (RA - 1);
         APInt Mask2 = LowBits & Mask;
@@ -2305,7 +2305,7 @@
 
   if (N1C) {
     if (N2C) {
-      APInt C1 = N1C->getAPIntValue(), C2 = N2C->getAPIntValue();
+      const APInt &C1 = N1C->getAPIntValue(), &C2 = N2C->getAPIntValue();
       switch (Opcode) {
       case ISD::ADD: return getConstant(C1 + C2, VT);
       case ISD::SUB: return getConstant(C1 - C2, VT);





More information about the llvm-commits mailing list