[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Evan Cheng evan.cheng at apple.com
Fri Mar 23 17:03:02 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.280 -> 1.281
---
Log message:

Adjust offset to compensate for big endian machines.

---
Diffs of the changes:  (+5 -7)

 DAGCombiner.cpp |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.280 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.281
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.280	Fri Mar 23 17:13:36 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Mar 23 19:02:43 2007
@@ -2292,7 +2292,6 @@
         N0 = N0.getOperand(0);
         if (MVT::getSizeInBits(N0.getValueType()) <= EVTBits)
           return SDOperand();
-        ShAmt /= 8;
         CombineSRL = true;
       }
     }
@@ -2308,12 +2307,11 @@
            "Cannot truncate to larger type!");
     LoadSDNode *LN0 = cast<LoadSDNode>(N0);
     MVT::ValueType PtrType = N0.getOperand(1).getValueType();
-    // For big endian targets, we need to add an offset to the pointer to load
-    // the correct bytes.  For little endian systems, we merely need to read
-    // fewer bytes from the same pointer.
-    uint64_t PtrOff =  ShAmt
-      ? ShAmt : (TLI.isLittleEndian() ? 0
-                 : (MVT::getSizeInBits(N0.getValueType()) - EVTBits) / 8);
+    // For big endian targets, we need to adjust the offset to the pointer to
+    // load the correct bytes.
+    if (!TLI.isLittleEndian())
+      ShAmt = MVT::getSizeInBits(N0.getValueType()) - ShAmt - EVTBits;
+    uint64_t PtrOff =  ShAmt / 8;
     SDOperand NewPtr = DAG.getNode(ISD::ADD, PtrType, LN0->getBasePtr(),
                                    DAG.getConstant(PtrOff, PtrType));
     AddToWorkList(NewPtr.Val);






More information about the llvm-commits mailing list