[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp LoopStrengthReduce.cpp LoopUnroll.cpp Reassociate.cpp ScalarReplAggregates.cpp

Reid Spencer reid at x10sys.com
Thu Oct 19 17:35:19 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.520.2.1 -> 1.520.2.2
LoopStrengthReduce.cpp updated: 1.89.2.1 -> 1.89.2.2
LoopUnroll.cpp updated: 1.28 -> 1.28.2.1
Reassociate.cpp updated: 1.62 -> 1.62.2.1
ScalarReplAggregates.cpp updated: 1.44.2.1 -> 1.44.2.2
---
Log message:

Make some simplifications for ConstantInt:
1. Get rid of getRawValue, replace with getZExtValue
2. Single constructor (uint64_t) and get method (int64_t)
3. Canonicalize the constant to a zero extended unsigned 64-bit integer when
   it is created.
4. Adjust getZExtValue() to be a do-nothing (just returns the already
   canonicalized value).
5. Compensate for above changes everywhere else.


---
Diffs of the changes:  (+50 -50)

 InstructionCombining.cpp |   78 +++++++++++++++++++++++------------------------
 LoopStrengthReduce.cpp   |    2 -
 LoopUnroll.cpp           |    4 +-
 Reassociate.cpp          |    2 -
 ScalarReplAggregates.cpp |   14 ++++----
 5 files changed, 50 insertions(+), 50 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.1 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.2
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.1	Wed Oct 18 22:57:56 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Oct 19 19:34:44 2006
@@ -1798,14 +1798,14 @@
       if (Anded == CRHS) {
         // See if all bits from the first bit set in the Add RHS up are included
         // in the mask.  First, get the rightmost bit.
-        uint64_t AddRHSV = CRHS->getRawValue();
+        uint64_t AddRHSV = CRHS->getZExtValue();
 
         // Form a mask of all bits from the lowest bit added through the top.
         uint64_t AddRHSHighBits = ~((AddRHSV & -AddRHSV)-1);
         AddRHSHighBits &= C2->getType()->getIntegralTypeMask();
 
         // See if the and mask includes all of these bits.
-        uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getRawValue();
+        uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getZExtValue();
 
         if (AddRHSHighBits == AddRHSHighBitsAnd) {
           // Okay, the xform is safe.  Insert the new add pronto.
@@ -1848,7 +1848,7 @@
 // highest order bit set.
 static bool isSignBit(ConstantInt *CI) {
   unsigned NumBits = CI->getType()->getPrimitiveSizeInBits();
-  return (CI->getRawValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1));
+  return (CI->getZExtValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1));
 }
 
 /// RemoveNoopCast - Strip off nonconverting casts from the value.
@@ -2064,7 +2064,7 @@
       if (CI->isAllOnesValue())              // X * -1 == 0 - X
         return BinaryOperator::createNeg(Op0, I.getName());
 
-      int64_t Val = (int64_t)cast<ConstantInt>(CI)->getRawValue();
+      int64_t Val = (int64_t)cast<ConstantInt>(CI)->getZExtValue();
       if (isPowerOf2_64(Val)) {          // Replace X*(2^C) with X << C
         uint64_t C = Log2_64(Val);
         return new ShiftInst(Instruction::Shl, Op0,
@@ -2290,7 +2290,7 @@
       if (RHSI->getOpcode() == Instruction::Shl &&
           isa<ConstantInt>(RHSI->getOperand(0)) &&
           RHSI->getOperand(0)->getType()->isUnsigned()) {
-        uint64_t C1 = cast<ConstantInt>(RHSI->getOperand(0))->getRawValue();
+        uint64_t C1 = cast<ConstantInt>(RHSI->getOperand(0))->getZExtValue();
         if (isPowerOf2_64(C1)) {
           uint64_t C2 = Log2_64(C1);
           Value *Add = RHSI->getOperand(1);
@@ -2515,17 +2515,17 @@
 // isOneBitSet - Return true if there is exactly one bit set in the specified
 // constant.
 static bool isOneBitSet(const ConstantInt *CI) {
-  uint64_t V = CI->getRawValue();
+  uint64_t V = CI->getZExtValue();
   return V && (V & (V-1)) == 0;
 }
 
 #if 0   // Currently unused
 // isLowOnes - Return true if the constant is of the form 0+1+.
 static bool isLowOnes(const ConstantInt *CI) {
-  uint64_t V = CI->getRawValue();
+  uint64_t V = CI->getZExtValue();
 
   // There won't be bits set in parts that the type doesn't contain.
-  V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue();
+  V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue();
 
   uint64_t U = V+1;  // If it is low ones, this should be a power of two.
   return U && V && (U & V) == 0;
@@ -2535,11 +2535,11 @@
 // isHighOnes - Return true if the constant is of the form 1+0+.
 // This is the same as lowones(~X).
 static bool isHighOnes(const ConstantInt *CI) {
-  uint64_t V = ~CI->getRawValue();
+  uint64_t V = ~CI->getZExtValue();
   if (~V == 0) return false;  // 0's does not match "1+"
 
   // There won't be bits set in parts that the type doesn't contain.
-  V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue();
+  V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue();
 
   uint64_t U = V+1;  // If it is low ones, this should be a power of two.
   return U && V && (U & V) == 0;
@@ -2664,7 +2664,7 @@
       // Adding a one to a single bit bit-field should be turned into an XOR
       // of the bit.  First thing to check is to see if this AND is with a
       // single bit constant.
-      uint64_t AndRHSV = cast<ConstantInt>(AndRHS)->getRawValue();
+      uint64_t AndRHSV = cast<ConstantInt>(AndRHS)->getZExtValue();
 
       // Clear bits that are not part of the constant.
       AndRHSV &= AndRHS->getType()->getIntegralTypeMask();
@@ -2674,7 +2674,7 @@
         // Ok, at this point, we know that we are masking the result of the
         // ADD down to exactly one bit.  If the constant we are adding has
         // no bits set below this bit, then we can eliminate the ADD.
-        uint64_t AddRHS = cast<ConstantInt>(OpRHS)->getRawValue();
+        uint64_t AddRHS = cast<ConstantInt>(OpRHS)->getZExtValue();
 
         // Check to see if any bits below the one bit set in AndRHSV are set.
         if ((AddRHS & (AndRHSV-1)) == 0) {
@@ -2810,7 +2810,7 @@
 // MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs.  0x0F0F0000 is
 // not, since all 1s are not contiguous.
 static bool isRunOfOnes(ConstantIntegral *Val, unsigned &MB, unsigned &ME) {
-  uint64_t V = Val->getRawValue();
+  uint64_t V = Val->getZExtValue();
   if (!isShiftedMask_64(V)) return false;
 
   // look for the first zero bit after the run of ones
@@ -2846,7 +2846,7 @@
   case Instruction::And:
     if (ConstantExpr::getAnd(N, Mask) == Mask) {
       // If the AndRHS is a power of two minus one (0+1+), this is simple.
-      if ((Mask->getRawValue() & Mask->getRawValue()+1) == 0)
+      if ((Mask->getZExtValue() & Mask->getZExtValue()+1) == 0)
         break;
 
       // Otherwise, if Mask is 0+1+0+, and if B is known to have the low 0+
@@ -2864,7 +2864,7 @@
   case Instruction::Or:
   case Instruction::Xor:
     // If the AndRHS is a power of two minus one (0+1+), and N&Mask == 0
-    if ((Mask->getRawValue() & Mask->getRawValue()+1) == 0 &&
+    if ((Mask->getZExtValue() & Mask->getZExtValue()+1) == 0 &&
         ConstantExpr::getAnd(N, Mask)->isNullValue())
       break;
     return 0;
@@ -3178,7 +3178,7 @@
   // defines a byte.  We only handle unsigned types here.
   if (isa<ShiftInst>(I) && isa<ConstantInt>(I->getOperand(1))) {
     // Not shifting the entire input by N-1 bytes?
-    if (cast<ConstantInt>(I->getOperand(1))->getRawValue() !=
+    if (cast<ConstantInt>(I->getOperand(1))->getZExtValue() !=
         8*(ByteValues.size()-1))
       return true;
     
@@ -3209,19 +3209,19 @@
   Instruction *SI = cast<Instruction>(Shift);
 
   // Make sure that the shift amount is by a multiple of 8 and isn't too big.
-  if (ShiftAmt->getRawValue() & 7 ||
-      ShiftAmt->getRawValue() > 8*ByteValues.size())
+  if (ShiftAmt->getZExtValue() & 7 ||
+      ShiftAmt->getZExtValue() > 8*ByteValues.size())
     return true;
   
   // Turn 0xFF -> 0, 0xFF00 -> 1, 0xFF0000 -> 2, etc.
   unsigned DestByte;
   for (DestByte = 0; DestByte != ByteValues.size(); ++DestByte)
-    if (AndAmt->getRawValue() == uint64_t(0xFF) << 8*DestByte)
+    if (AndAmt->getZExtValue() == uint64_t(0xFF) << 8*DestByte)
       break;
   // Unknown mask for bswap.
   if (DestByte == ByteValues.size()) return true;
   
-  unsigned ShiftBytes = ShiftAmt->getRawValue()/8;
+  unsigned ShiftBytes = ShiftAmt->getZExtValue()/8;
   unsigned SrcByte;
   if (SI->getOpcode() == Instruction::Shl)
     SrcByte = DestByte - ShiftBytes;
@@ -3382,7 +3382,7 @@
     // replace with V+N.
     if (C1 == ConstantExpr::getNot(C2)) {
       Value *V1 = 0, *V2 = 0;
-      if ((C2->getRawValue() & (C2->getRawValue()+1)) == 0 && // C2 == 0+1+
+      if ((C2->getZExtValue() & (C2->getZExtValue()+1)) == 0 && // C2 == 0+1+
           match(A, m_Add(m_Value(V1), m_Value(V2)))) {
         // Add commutes, try both ways.
         if (V1 == B && MaskedValueIsZero(V2, C2->getZExtValue()))
@@ -3391,7 +3391,7 @@
           return ReplaceInstUsesWith(I, A);
       }
       // Or commutes, try both ways.
-      if ((C1->getRawValue() & (C1->getRawValue()+1)) == 0 &&
+      if ((C1->getZExtValue() & (C1->getZExtValue()+1)) == 0 &&
           match(B, m_Add(m_Value(V1), m_Value(V2)))) {
         // Add commutes, try both ways.
         if (V1 == A && MaskedValueIsZero(V2, C1->getZExtValue()))
@@ -5082,7 +5082,7 @@
         // operation.
         //
         if (isValid && !isLeftShift && isSignedShift) {
-          uint64_t Val = Op0C->getRawValue();
+          uint64_t Val = Op0C->getZExtValue();
           isValid = ((Val & (1 << (TypeBits-1))) != 0) == highBitSet;
         }
         
@@ -5961,9 +5961,9 @@
   if (ConstantInt *TrueValC = dyn_cast<ConstantInt>(TrueVal))
     if (ConstantInt *FalseValC = dyn_cast<ConstantInt>(FalseVal)) {
       // select C, 1, 0 -> cast C to int
-      if (FalseValC->isNullValue() && TrueValC->getRawValue() == 1) {
+      if (FalseValC->isNullValue() && TrueValC->getZExtValue() == 1) {
         return new CastInst(CondVal, SI.getType());
-      } else if (TrueValC->isNullValue() && FalseValC->getRawValue() == 1) {
+      } else if (TrueValC->isNullValue() && FalseValC->getZExtValue() == 1) {
         // select C, 0, 1 -> cast !C to int
         Value *NotCond =
           InsertNewInstBefore(BinaryOperator::createNot(CondVal,
@@ -5983,7 +5983,7 @@
                          IC->getOpcode() == Instruction::SetLT;
             else {
               unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits();
-              CanXForm = (CmpCst->getRawValue() == ~0ULL >> (64-Bits+1)) &&
+              CanXForm = (CmpCst->getZExtValue() == ~0ULL >> (64-Bits+1)) &&
                          IC->getOpcode() == Instruction::SetGT;
             }
             
@@ -6265,7 +6265,7 @@
       if (NumBytes->isNullValue()) return EraseInstFromFunction(CI);
 
       if (ConstantInt *CI = dyn_cast<ConstantInt>(NumBytes))
-        if (CI->getRawValue() == 1) {
+        if (CI->getZExtValue() == 1) {
           // Replace the instruction with just byte operations.  We would
           // transform other cases to loads/stores, but we don't know if
           // alignment is sufficient.
@@ -6298,13 +6298,13 @@
       unsigned Alignment1 = GetKnownAlignment(MI->getOperand(1), TD);
       unsigned Alignment2 = GetKnownAlignment(MI->getOperand(2), TD);
       unsigned Align = std::min(Alignment1, Alignment2);
-      if (MI->getAlignment()->getRawValue() < Align) {
+      if (MI->getAlignment()->getZExtValue() < Align) {
         MI->setAlignment(ConstantInt::get(Type::UIntTy, Align));
         Changed = true;
       }
     } else if (isa<MemSetInst>(MI)) {
       unsigned Alignment = GetKnownAlignment(MI->getDest(), TD);
-      if (MI->getAlignment()->getRawValue() < Alignment) {
+      if (MI->getAlignment()->getZExtValue() < Alignment) {
         MI->setAlignment(ConstantInt::get(Type::UIntTy, Alignment));
         Changed = true;
       }
@@ -6388,7 +6388,7 @@
           for (unsigned i = 0; i != 16; ++i) {
             if (isa<UndefValue>(Mask->getOperand(i)))
               continue;
-            unsigned Idx =cast<ConstantInt>(Mask->getOperand(i))->getRawValue();
+            unsigned Idx =cast<ConstantInt>(Mask->getOperand(i))->getZExtValue();
             Idx &= 31;  // Match the hardware behavior.
             
             if (ExtractedElts[Idx] == 0) {
@@ -7086,11 +7086,11 @@
 
         // If the index will be to exactly the right offset with the scale taken
         // out, perform the transformation.
-        if (Scale && Scale->getRawValue() % ArrayEltSize == 0) {
+        if (Scale && Scale->getZExtValue() % ArrayEltSize == 0) {
           if (ConstantInt *C = dyn_cast<ConstantInt>(Scale))
             Scale = ConstantInt::get(Scale->getType(),
-                                      Scale->getRawValue() / ArrayEltSize);
-          if (Scale->getRawValue() != 1) {
+                                      Scale->getZExtValue() / ArrayEltSize);
+          if (Scale->getZExtValue() != 1) {
             Constant *C = ConstantExpr::getCast(Scale, NewIdx->getType());
             Instruction *Sc = BinaryOperator::createMul(NewIdx, C, "idxscale");
             NewIdx = InsertNewInstBefore(Sc, GEP);
@@ -7887,7 +7887,7 @@
     
     if (!isa<ConstantInt>(IdxOp))
       return false;
-    unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getRawValue();
+    unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();
     
     if (isa<UndefValue>(ScalarOp)) {  // inserting undef into vector.
       // Okay, we can handle this if the vector we are insertinting into is
@@ -7901,7 +7901,7 @@
       if (isa<ConstantInt>(EI->getOperand(1)) &&
           EI->getOperand(0)->getType() == V->getType()) {
         unsigned ExtractedIdx =
-          cast<ConstantInt>(EI->getOperand(1))->getRawValue();
+          cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
         
         // This must be extracting from either LHS or RHS.
         if (EI->getOperand(0) == LHS || EI->getOperand(0) == RHS) {
@@ -7955,8 +7955,8 @@
       if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) &&
           EI->getOperand(0)->getType() == V->getType()) {
         unsigned ExtractedIdx =
-          cast<ConstantInt>(EI->getOperand(1))->getRawValue();
-        unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getRawValue();
+          cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
+        unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();
         
         // Either the extracted from or inserted into vector must be RHSVec,
         // otherwise we'd end up with a shuffle of three inputs.
@@ -8005,8 +8005,8 @@
     if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) &&
         EI->getOperand(0)->getType() == IE.getType()) {
       unsigned NumVectorElts = IE.getType()->getNumElements();
-      unsigned ExtractedIdx=cast<ConstantInt>(EI->getOperand(1))->getRawValue();
-      unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getRawValue();
+      unsigned ExtractedIdx=cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
+      unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();
       
       if (ExtractedIdx >= NumVectorElts) // Out of range extract.
         return ReplaceInstUsesWith(IE, VecOp);


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.89.2.1 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.89.2.2
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.89.2.1	Wed Oct 18 22:57:56 2006
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Thu Oct 19 19:34:44 2006
@@ -861,7 +861,7 @@
 ///
 static bool isZero(SCEVHandle &V) {
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V))
-    return SC->getValue()->getRawValue() == 0;
+    return SC->getValue()->getZExtValue() == 0;
   return false;
 }
 


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.28 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.28.2.1
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.28	Tue Aug 29 01:10:56 2006
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp	Thu Oct 19 19:34:44 2006
@@ -190,8 +190,8 @@
   ConstantInt *TripCountC = dyn_cast_or_null<ConstantInt>(L->getTripCount());
   if (!TripCountC) return Changed;  // Must have constant trip count!
 
-  uint64_t TripCountFull = TripCountC->getRawValue();
-  if (TripCountFull != TripCountC->getRawValue() || TripCountFull == 0)
+  uint64_t TripCountFull = TripCountC->getZExtValue();
+  if (TripCountFull != TripCountC->getZExtValue() || TripCountFull == 0)
     return Changed; // More than 2^32 iterations???
 
   unsigned LoopSize = ApproximateLoopSize(L);


Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.62 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.62.2.1
--- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.62	Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp	Thu Oct 19 19:34:44 2006
@@ -549,7 +549,7 @@
       if (CstVal->isNullValue()) {           // ... * 0 -> 0
         ++NumAnnihil;
         return CstVal;
-      } else if (cast<ConstantInt>(CstVal)->getRawValue() == 1) {
+      } else if (cast<ConstantInt>(CstVal)->getZExtValue() == 1) {
         Ops.pop_back();                      // ... * 1 -> ...
       }
       break;


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.44.2.1 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.44.2.2
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.44.2.1	Wed Oct 18 22:57:56 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Thu Oct 19 19:34:44 2006
@@ -203,7 +203,7 @@
       GetElementPtrInst *GEPI = cast<GetElementPtrInst>(User);
       // We now know that the GEP is of the form: GEP <ptr>, 0, <cst>
       unsigned Idx =
-         (unsigned)cast<ConstantInt>(GEPI->getOperand(2))->getRawValue();
+         (unsigned)cast<ConstantInt>(GEPI->getOperand(2))->getZExtValue();
 
       assert(Idx < ElementAllocas.size() && "Index out of range?");
       AllocaInst *AllocaToUse = ElementAllocas[Idx];
@@ -306,7 +306,7 @@
       // Check to make sure that index falls within the array.  If not,
       // something funny is going on, so we won't do the optimization.
       //
-      if (cast<ConstantInt>(GEPI->getOperand(2))->getRawValue() >= NumElements)
+      if (cast<ConstantInt>(GEPI->getOperand(2))->getZExtValue() >= NumElements)
         return 0;
 
       // We cannot scalar repl this level of the array unless any array
@@ -320,7 +320,7 @@
         const ArrayType *SubArrayTy = cast<ArrayType>(*I);
         uint64_t NumElements = SubArrayTy->getNumElements();
         if (!isa<ConstantInt>(I.getOperand())) return 0;
-        if (cast<ConstantInt>(I.getOperand())->getRawValue() >= NumElements)
+        if (cast<ConstantInt>(I.getOperand())->getZExtValue() >= NumElements)
           return 0;
       }
       
@@ -499,7 +499,7 @@
     } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(User)) {
       // Check to see if this is stepping over an element: GEP Ptr, int C
       if (GEP->getNumOperands() == 2 && isa<ConstantInt>(GEP->getOperand(1))) {
-        unsigned Idx = cast<ConstantInt>(GEP->getOperand(1))->getRawValue();
+        unsigned Idx = cast<ConstantInt>(GEP->getOperand(1))->getZExtValue();
         unsigned ElSize = TD.getTypeSize(PTy->getElementType());
         unsigned BitOffset = Idx*ElSize*8;
         if (BitOffset > 64 || !isPowerOf2_32(ElSize)) return 0;
@@ -520,7 +520,7 @@
         // We are stepping into an element, e.g. a structure or an array:
         // GEP Ptr, int 0, uint C
         const Type *AggTy = PTy->getElementType();
-        unsigned Idx = cast<ConstantInt>(GEP->getOperand(2))->getRawValue();
+        unsigned Idx = cast<ConstantInt>(GEP->getOperand(2))->getZExtValue();
         
         if (const ArrayType *ATy = dyn_cast<ArrayType>(AggTy)) {
           if (Idx >= ATy->getNumElements()) return 0;  // Out of range.
@@ -688,7 +688,7 @@
       // Check to see if this is stepping over an element: GEP Ptr, int C
       unsigned NewOffset = Offset;
       if (GEP->getNumOperands() == 2) {
-        unsigned Idx = cast<ConstantInt>(GEP->getOperand(1))->getRawValue();
+        unsigned Idx = cast<ConstantInt>(GEP->getOperand(1))->getZExtValue();
         unsigned BitOffset = Idx*AggSizeInBits;
         
         if (TD.isLittleEndian() || isVectorInsert)
@@ -698,7 +698,7 @@
         
       } else if (GEP->getNumOperands() == 3) {
         // We know that operand #2 is zero.
-        unsigned Idx = cast<ConstantInt>(GEP->getOperand(2))->getRawValue();
+        unsigned Idx = cast<ConstantInt>(GEP->getOperand(2))->getZExtValue();
         const Type *AggTy = AggPtrTy->getElementType();
         if (const SequentialType *SeqTy = dyn_cast<SequentialType>(AggTy)) {
           unsigned ElSizeBits = TD.getTypeSize(SeqTy->getElementType())*8;






More information about the llvm-commits mailing list