From b83eb6447ba155342598f0fabe1f08f5baa9164a Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Fri, 20 Oct 2006 07:07:24 +0000 Subject: For PR950: This patch implements the first increment for the Signless Types feature. All changes pertain to removing the ConstantSInt and ConstantUInt classes in favor of just using ConstantInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/Local.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/Transforms/Utils/Local.cpp') diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 3d1faff018..28864fd613 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)) -- cgit v1.2.3