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

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 20:22:34 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL251486: [SelectionDAG] Don't inspect !range metadata for extended loads (authored by sanjoy).

Changed prior to commit:
  http://reviews.llvm.org/D14107?vs=38614&id=38622#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14107

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/trunk/test/CodeGen/PowerPC/selectiondag-extload-computeknownbits.ll

Index: llvm/trunk/test/CodeGen/PowerPC/selectiondag-extload-computeknownbits.ll
===================================================================
--- llvm/trunk/test/CodeGen/PowerPC/selectiondag-extload-computeknownbits.ll
+++ llvm/trunk/test/CodeGen/PowerPC/selectiondag-extload-computeknownbits.ll
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=powerpc64-bgq-linux < %s
+
+; Check that llc does not crash due to an illegal APInt operation
+
+define i1 @f(i8* %ptr) {
+ entry:
+  %val = load i8, i8* %ptr, align 8, !range !0
+  %tobool = icmp eq i8 %val, 0
+  ret i1 %tobool
+}
+
+!0 = !{i8 0, i8 2}
Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/trunk/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.38622.patch
Type: text/x-patch
Size: 1256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151028/a5328a1b/attachment.bin>


More information about the llvm-commits mailing list