mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user