Simplify code by using ConstantInt::getRawValue instead of checking to see
[oota-llvm.git] / lib / Transforms / Scalar / ScalarReplAggregates.cpp
index f0e51e589d7bfa5f375e992eeddba0f2704ee891..fceaccc89a507c21527894380359e109eb9e1a68 100644 (file)
@@ -103,11 +103,7 @@ bool SROA::runOnFunction(Function &F) {
       Instruction *User = cast<Instruction>(*I);
       if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(User)) {
         // We now know that the GEP is of the form: GEP <ptr>, 0, <cst>
-        uint64_t Idx;
-        if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(GEPI->getOperand(2)))
-          Idx = CSI->getValue();
-        else
-          Idx = cast<ConstantUInt>(GEPI->getOperand(2))->getValue();
+        uint64_t Idx = cast<ConstantInt>(GEPI->getOperand(2))->getRawValue();
         
         assert(Idx < ElementAllocas.size() && "Index out of range?");
         AllocaInst *AllocaToUse = ElementAllocas[Idx];