[llvm-branch-commits] [llvm-branch] r70370 - in /llvm/branches/Apple/Dib: lib/CodeGen/SelectionDAG/TargetLowering.cpp test/CodeGen/Generic/2009-04-28-i128-cmp-crash.ll

Bill Wendling isanbard at gmail.com
Tue Apr 28 22:06:43 PDT 2009


Author: void
Date: Wed Apr 29 00:06:43 2009
New Revision: 70370

URL: http://llvm.org/viewvc/llvm-project?rev=70370&view=rev
Log:
--- Merging r70360 into '.':
A    test/CodeGen/Generic/2009-04-28-i128-cmp-crash.ll
U    lib/CodeGen/SelectionDAG/TargetLowering.cpp

Disable the load-shrinking optimization from looking at
anything larger than 64-bits, avoiding a crash.  This should
really be fixed to use APInts, though type legalization happens
to help us out and we get good code on the attached testcase at
least.

This fixes rdar://6836460

Added:
    llvm/branches/Apple/Dib/test/CodeGen/Generic/2009-04-28-i128-cmp-crash.ll
      - copied unchanged from r70360, llvm/trunk/test/CodeGen/Generic/2009-04-28-i128-cmp-crash.ll
Modified:
    llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=70370&r1=70369&r2=70370&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Apr 29 00:06:43 2009
@@ -1538,19 +1538,22 @@
           N0.getOperand(0).getNode()->hasOneUse() &&
           isa<ConstantSDNode>(N0.getOperand(1))) {
         LoadSDNode *Lod = cast<LoadSDNode>(N0.getOperand(0));
-        uint64_t Mask = cast<ConstantSDNode>(N0.getOperand(1))->getZExtValue();
         uint64_t bestMask = 0;
         unsigned bestWidth = 0, bestOffset = 0;
-        if (!Lod->isVolatile() && Lod->isUnindexed()) {
+        if (!Lod->isVolatile() && Lod->isUnindexed() &&
+            // FIXME: This uses getZExtValue() below so it only works on i64 and
+            // below.
+            N0.getValueType().getSizeInBits() <= 64) {
           unsigned origWidth = N0.getValueType().getSizeInBits();
           // We can narrow (e.g.) 16-bit extending loads on 32-bit target to 
           // 8 bits, but have to be careful...
           if (Lod->getExtensionType() != ISD::NON_EXTLOAD)
             origWidth = Lod->getMemoryVT().getSizeInBits();
+          uint64_t Mask =cast<ConstantSDNode>(N0.getOperand(1))->getZExtValue();
           for (unsigned width = origWidth / 2; width>=8; width /= 2) {
             uint64_t newMask = (1ULL << width) - 1;
             for (unsigned offset=0; offset<origWidth/width; offset++) {
-              if ((newMask & Mask)==Mask) {
+              if ((newMask & Mask) == Mask) {
                 if (!TD->isLittleEndian())
                   bestOffset = (origWidth/width - offset - 1) * (width/8);
                 else





More information about the llvm-branch-commits mailing list