[PATCH] D14107: [SelectionDAG] Don't inspect !range metadata for extended loads

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 23:13:56 PDT 2015


sanjoy created this revision.
sanjoy added a reviewer: nlewycky.
sanjoy added a subscriber: llvm-commits.

Don't call `computeKnownBitsFromRangeMetadata` for extended loads --
this can cause a mismatch between the width of the !range metadata and
the width of the APInt's accumulating `KnownZero` (and `KnownOne` in the
future).  This isn't a problem now, but will be after a future change.

Note: this can be made more aggressive in the future.

http://reviews.llvm.org/D14107

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2284,7 +2284,8 @@
       unsigned MemBits = VT.getScalarType().getSizeInBits();
       KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - MemBits);
     } else if (const MDNode *Ranges = LD->getRanges()) {
-      computeKnownBitsFromRangeMetadata(*Ranges, KnownZero);
+      if (LD->getExtensionType() == ISD::NON_EXTLOAD)
+        computeKnownBitsFromRangeMetadata(*Ranges, KnownZero);
     }
     break;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14107.38504.patch
Type: text/x-patch
Size: 629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151027/98a34908/attachment.bin>


More information about the llvm-commits mailing list