mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
Provide size information when checking to see if we can LICM a load, this
allows us to hoist more loads in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1ed80b66b1
commit
f3e1d6977e
@ -170,9 +170,9 @@ namespace {
|
|||||||
/// pointerInvalidatedByLoop - Return true if the body of this loop may
|
/// pointerInvalidatedByLoop - Return true if the body of this loop may
|
||||||
/// store into the memory location pointed to by V.
|
/// store into the memory location pointed to by V.
|
||||||
///
|
///
|
||||||
bool pointerInvalidatedByLoop(Value *V) {
|
bool pointerInvalidatedByLoop(Value *V, unsigned Size) {
|
||||||
// Check to see if any of the basic blocks in CurLoop invalidate *V.
|
// Check to see if any of the basic blocks in CurLoop invalidate *V.
|
||||||
return CurAST->getAliasSetForPointer(V, 0).isMod();
|
return CurAST->getAliasSetForPointer(V, Size).isMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canSinkOrHoistInst(Instruction &I);
|
bool canSinkOrHoistInst(Instruction &I);
|
||||||
@ -351,7 +351,10 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
|
|||||||
return false; // Don't hoist volatile loads!
|
return false; // Don't hoist volatile loads!
|
||||||
|
|
||||||
// Don't hoist loads which have may-aliased stores in loop.
|
// Don't hoist loads which have may-aliased stores in loop.
|
||||||
return !pointerInvalidatedByLoop(LI->getOperand(0));
|
unsigned Size = 0;
|
||||||
|
if (LI->getType()->isSized())
|
||||||
|
Size = AA->getTargetData().getTypeSize(LI->getType());
|
||||||
|
return !pointerInvalidatedByLoop(LI->getOperand(0), Size);
|
||||||
} else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
|
} else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
|
||||||
// Handle obvious cases efficiently.
|
// Handle obvious cases efficiently.
|
||||||
if (Function *Callee = CI->getCalledFunction()) {
|
if (Function *Callee = CI->getCalledFunction()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user