mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
For now, only hoist re-materilizable instructions. LICM will increase register pressure. We want to avoid spilling more instructions if it's possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63725 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -186,18 +186,27 @@ bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) {
|
|||||||
if (TID.mayStore() || TID.isCall() || TID.isTerminator() ||
|
if (TID.mayStore() || TID.isCall() || TID.isTerminator() ||
|
||||||
TID.hasUnmodeledSideEffects())
|
TID.hasUnmodeledSideEffects())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool isInvLoad = false;
|
||||||
if (TID.mayLoad()) {
|
if (TID.mayLoad()) {
|
||||||
// Okay, this instruction does a load. As a refinement, we allow the target
|
// Okay, this instruction does a load. As a refinement, we allow the target
|
||||||
// to decide whether the loaded value is actually a constant. If so, we can
|
// to decide whether the loaded value is actually a constant. If so, we can
|
||||||
// actually use it as a load.
|
// actually use it as a load.
|
||||||
if (!TII->isInvariantLoad(&I))
|
isInvLoad = TII->isInvariantLoad(&I);
|
||||||
|
if (!isInvLoad)
|
||||||
// FIXME: we should be able to sink loads with no other side effects if
|
// FIXME: we should be able to sink loads with no other side effects if
|
||||||
// there is nothing that can change memory from here until the end of
|
// there is nothing that can change memory from here until the end of
|
||||||
// block. This is a trivial form of alias analysis.
|
// block. This is a trivial form of alias analysis.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: For now, only hoist re-materilizable instructions. LICM will
|
||||||
|
// increase register pressure. We want to make sure it doesn't increase
|
||||||
|
// spilling.
|
||||||
|
if (!isInvLoad && (!TID.isRematerializable() ||
|
||||||
|
!TII->isTriviallyReMaterializable(&I)))
|
||||||
|
return false;
|
||||||
|
|
||||||
DEBUG({
|
DEBUG({
|
||||||
DOUT << "--- Checking if we can hoist " << I;
|
DOUT << "--- Checking if we can hoist " << I;
|
||||||
if (I.getDesc().getImplicitUses()) {
|
if (I.getDesc().getImplicitUses()) {
|
||||||
|
Reference in New Issue
Block a user