[llvm-commits] [llvm] r152831 - /llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Duncan Sands baldrick at free.fr
Thu Mar 15 13:14:42 PDT 2012


Author: baldrick
Date: Thu Mar 15 15:14:42 2012
New Revision: 152831

URL: http://llvm.org/viewvc/llvm-project?rev=152831&view=rev
Log:
Type sizes and fields offsets inside structs are unsigned.  This is a highly
theoretical fix since it only matters for types with >= 2^63 bits (!) and also
only matters if pointers have more than 64 bits, which is not supported anyway.

Modified:
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=152831&r1=152830&r2=152831&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Thu Mar 15 15:14:42 2012
@@ -673,13 +673,11 @@
     if (StructType *STy = dyn_cast<StructType>(*GTI)) {
       unsigned ElementIdx = OpC->getZExtValue();
       const StructLayout *SL = TD.getStructLayout(STy);
-      Offset += APInt(IntPtrWidth, SL->getElementOffset(ElementIdx),
-                      /*isSigned=*/true);
+      Offset += APInt(IntPtrWidth, SL->getElementOffset(ElementIdx));
       continue;
     }
 
-    APInt TypeSize(IntPtrWidth, TD.getTypeAllocSize(GTI.getIndexedType()),
-                   /*isSigned=*/true);
+    APInt TypeSize(IntPtrWidth, TD.getTypeAllocSize(GTI.getIndexedType()));
     Offset += OpC->getValue().sextOrTrunc(IntPtrWidth) * TypeSize;
   }
   return true;





More information about the llvm-commits mailing list