X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FUtils%2FLocal.cpp;h=28864fd613aff3249bb098b1cc6939d9c686bb11;hb=b83eb6447ba155342598f0fabe1f08f5baa9164a;hp=3d1faff0184f8aaed2440cad93e75ef566811cc2;hpb=6e7dd9db6bf677c9161a6ecc12f90651cf1231e0;p=oota-llvm.git diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 3d1faff0184..28864fd613a 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -272,10 +272,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, gep_type_iterator I = gep_type_begin(CE), E = gep_type_end(CE); for (++I; I != E; ++I) if (const StructType *STy = dyn_cast(*I)) { - ConstantUInt *CU = cast(I.getOperand()); - assert(CU->getValue() < STy->getNumElements() && + ConstantInt *CU = cast(I.getOperand()); + assert(CU->getZExtValue() < STy->getNumElements() && "Struct index out of range!"); - unsigned El = (unsigned)CU->getValue(); + unsigned El = (unsigned)CU->getZExtValue(); if (ConstantStruct *CS = dyn_cast(C)) { C = CS->getOperand(El); } else if (isa(C)) { @@ -287,10 +287,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, } } else if (ConstantInt *CI = dyn_cast(I.getOperand())) { if (const ArrayType *ATy = dyn_cast(*I)) { - if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) + if (CI->getZExtValue() >= ATy->getNumElements()) return 0; if (ConstantArray *CA = dyn_cast(C)) - C = CA->getOperand((unsigned)CI->getRawValue()); + C = CA->getOperand(CI->getZExtValue()); else if (isa(C)) C = Constant::getNullValue(ATy->getElementType()); else if (isa(C)) @@ -298,10 +298,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, else return 0; } else if (const PackedType *PTy = dyn_cast(*I)) { - if ((uint64_t)CI->getRawValue() >= PTy->getNumElements()) + if (CI->getZExtValue() >= PTy->getNumElements()) return 0; if (ConstantPacked *CP = dyn_cast(C)) - C = CP->getOperand((unsigned)CI->getRawValue()); + C = CP->getOperand(CI->getZExtValue()); else if (isa(C)) C = Constant::getNullValue(PTy->getElementType()); else if (isa(C))