mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
Make DecomposeGEPExpression check SimplifyInstruction only
after checking for a GEP, so that it matches what GetUnderlyingObject does. This fixes an obscure bug turned up by bugpoint in the testcase for PR9931. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131971 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -281,17 +281,20 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (const Instruction *I = dyn_cast<Instruction>(V))
|
||||
// TODO: Get a DominatorTree and use it here.
|
||||
if (const Value *Simplified =
|
||||
SimplifyInstruction(const_cast<Instruction *>(I), TD)) {
|
||||
V = Simplified;
|
||||
continue;
|
||||
}
|
||||
|
||||
const GEPOperator *GEPOp = dyn_cast<GEPOperator>(Op);
|
||||
if (GEPOp == 0)
|
||||
if (GEPOp == 0) {
|
||||
// If it's not a GEP, hand it off to SimplifyInstruction to see if it
|
||||
// can come up with something. This matches what GetUnderlyingObject does.
|
||||
if (const Instruction *I = dyn_cast<Instruction>(V))
|
||||
// TODO: Get a DominatorTree and use it here.
|
||||
if (const Value *Simplified =
|
||||
SimplifyInstruction(const_cast<Instruction *>(I), TD)) {
|
||||
V = Simplified;
|
||||
continue;
|
||||
}
|
||||
|
||||
return V;
|
||||
}
|
||||
|
||||
// Don't attempt to analyze GEPs over unsized objects.
|
||||
if (!cast<PointerType>(GEPOp->getOperand(0)->getType())
|
||||
|
Reference in New Issue
Block a user