mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 04:29:21 +00:00
Reuse the values if they are constants: this is important so that we index into the right structure field
This fixes bug: BasicAA/2003-07-03-BasicAACrash.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7093 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c863c41903
commit
5bfccb9def
@ -288,8 +288,13 @@ BasicAliasAnalysis::CheckGEPInstructions(GetElementPtrInst *GEP1, unsigned G1S,
|
|||||||
const Value *Op1 = GEP1->getOperand(i);
|
const Value *Op1 = GEP1->getOperand(i);
|
||||||
const Value *Op2 = GEP2->getOperand(i);
|
const Value *Op2 = GEP2->getOperand(i);
|
||||||
if (Op1 == Op2) { // If they are equal, use a zero index...
|
if (Op1 == Op2) { // If they are equal, use a zero index...
|
||||||
Indices1.push_back(Constant::getNullValue(Op1->getType()));
|
if (!isa<Constant>(Op1)) {
|
||||||
Indices2.push_back(Indices1.back());
|
Indices1.push_back(Constant::getNullValue(Op1->getType()));
|
||||||
|
Indices2.push_back(Indices1.back());
|
||||||
|
} else {
|
||||||
|
Indices1.push_back((Value*)Op1);
|
||||||
|
Indices2.push_back((Value*)Op2);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (const ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
|
if (const ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
|
||||||
// If this is an array index, make sure the array element is in range...
|
// If this is an array index, make sure the array element is in range...
|
||||||
|
Loading…
Reference in New Issue
Block a user