forked from OSchip/llvm-project
[SelectionDAG] Make getUniformBase in SelectionDAGBuilder fail if any of the middle GEP indices are non-constant.
This is a fix for a bug in r317947. We were supposed to check that all the indices are are constant 0, but instead we're only make sure that indices that are constant are 0. Non-constant indices are being ignored. llvm-svn: 317950
This commit is contained in:
parent
c631ba5f52
commit
bdb8db4589
|
@ -3884,10 +3884,11 @@ static bool getUniformBase(const Value* &Ptr, SDValue& Base, SDValue& Index,
|
|||
Value *IndexVal = GEP->getOperand(FinalIndex);
|
||||
|
||||
// Ensure all the other indices are 0.
|
||||
for (unsigned i = 1; i < FinalIndex; ++i)
|
||||
if (auto *C = dyn_cast<ConstantInt>(GEP->getOperand(i)))
|
||||
if (!C->isZero())
|
||||
return false;
|
||||
for (unsigned i = 1; i < FinalIndex; ++i) {
|
||||
auto *C = dyn_cast<ConstantInt>(GEP->getOperand(i));
|
||||
if (!C || !C->isZero())
|
||||
return false;
|
||||
}
|
||||
|
||||
// The operands of the GEP may be defined in another basic block.
|
||||
// In this case we'll not find nodes for the operands.
|
||||
|
|
Loading…
Reference in New Issue