mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
In cases where a pointer value is an operand of a multiplication or
division operation, don't attempt to use the operation's value as the base of a getelementptr. This fixes PR4271. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -448,9 +448,14 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
|
||||
ExposePointerBase(Base, RestArray[0], SE);
|
||||
// If we found a pointer, expand the AddRec with a GEP.
|
||||
if (const PointerType *PTy = dyn_cast<PointerType>(Base->getType())) {
|
||||
Value *StartV = expand(Base);
|
||||
assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!");
|
||||
return expandAddToGEP(RestArray, RestArray+1, PTy, Ty, StartV);
|
||||
// Make sure the Base isn't something exotic, such as a multiplied
|
||||
// or divided pointer value. In those cases, the result type isn't
|
||||
// actually a pointer type.
|
||||
if (!isa<SCEVMulExpr>(Base) && !isa<SCEVUDivExpr>(Base)) {
|
||||
Value *StartV = expand(Base);
|
||||
assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!");
|
||||
return expandAddToGEP(RestArray, RestArray+1, PTy, Ty, StartV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user