diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-02-04 07:17:49 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-02-04 07:17:49 +0000 |
commit | 0649abdfe2c44352a6518c2d2c1606e7bcbb7063 (patch) | |
tree | 355a4dffc631b6a859cfa09fecf3c43117591be1 /llvm/lib/CodeGen/MachineLICM.cpp | |
parent | 11e9214ee6f864636c48a6572d4111c7622ad5ef (diff) | |
download | bcm5719-llvm-0649abdfe2c44352a6518c2d2c1606e7bcbb7063.tar.gz bcm5719-llvm-0649abdfe2c44352a6518c2d2c1606e7bcbb7063.zip |
For now, only hoist re-materilizable instructions. LICM will increase register pressure. We want to avoid spilling more instructions if it's possible.
llvm-svn: 63725
Diffstat (limited to 'llvm/lib/CodeGen/MachineLICM.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineLICM.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp index fbf21139ac4..4e2d9eeb18d 100644 --- a/llvm/lib/CodeGen/MachineLICM.cpp +++ b/llvm/lib/CodeGen/MachineLICM.cpp @@ -186,18 +186,27 @@ bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) { if (TID.mayStore() || TID.isCall() || TID.isTerminator() || TID.hasUnmodeledSideEffects()) return false; - + + bool isInvLoad = false; if (TID.mayLoad()) { // 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 // 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 // there is nothing that can change memory from here until the end of // block. This is a trivial form of alias analysis. 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({ DOUT << "--- Checking if we can hoist " << I; if (I.getDesc().getImplicitUses()) { |