aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp4
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 747abc2..eb4f1e3 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2947,7 +2947,7 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) {
assert(CU->getValue() < STy->getNumElements() &&
"Struct index out of range!");
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) {
- C = cast<Constant>(CS->getValues()[CU->getValue()]);
+ C = CS->getOperand(CU->getValue());
} else if (isa<ConstantAggregateZero>(C)) {
C = Constant::getNullValue(STy->getElementType(CU->getValue()));
} else {
@@ -2957,7 +2957,7 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) {
const ArrayType *ATy = cast<ArrayType>(*I);
if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) return 0;
if (ConstantArray *CA = dyn_cast<ConstantArray>(C))
- C = cast<Constant>(CA->getValues()[CI->getRawValue()]);
+ C = CA->getOperand(CI->getRawValue());
else if (isa<ConstantAggregateZero>(C))
C = Constant::getNullValue(ATy->getElementType());
else
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 3557cad..1c39160 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -753,13 +753,13 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) {
if (ConstantUInt *CU = dyn_cast<ConstantUInt>(CE->getOperand(i))) {
ConstantStruct *CS = dyn_cast<ConstantStruct>(C);
if (CS == 0) return 0;
- if (CU->getValue() >= CS->getValues().size()) return 0;
- C = cast<Constant>(CS->getValues()[CU->getValue()]);
+ if (CU->getValue() >= CS->getNumOperands()) return 0;
+ C = CS->getOperand(CU->getValue());
} else if (ConstantSInt *CS = dyn_cast<ConstantSInt>(CE->getOperand(i))) {
ConstantArray *CA = dyn_cast<ConstantArray>(C);
if (CA == 0) return 0;
- if ((uint64_t)CS->getValue() >= CA->getValues().size()) return 0;
- C = cast<Constant>(CA->getValues()[CS->getValue()]);
+ if ((uint64_t)CS->getValue() >= CA->getNumOperands()) return 0;
+ C = CA->getOperand(CS->getValue());
} else
return 0;
return C;