Adjustments to support the new ConstantAggregateZero class

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-02-15 05:55:15 +00:00
parent cfb0fd2ce8
commit de512b5b2e
10 changed files with 79 additions and 41 deletions

View File

@@ -2088,11 +2088,13 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) {
// addressing...
for (unsigned i = 2, e = CE->getNumOperands(); i != e; ++i)
if (ConstantUInt *CU = dyn_cast<ConstantUInt>(CE->getOperand(i))) {
ConstantStruct *CS = cast<ConstantStruct>(C);
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()]);
} else if (ConstantSInt *CS = dyn_cast<ConstantSInt>(CE->getOperand(i))) {
ConstantArray *CA = cast<ConstantArray>(C);
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()]);
} else