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 | 6cad113f9d7ddc2bc1e25290a1a1910932a2c477 (patch) | |
tree | e04ae3440fcc6d72c2a15f21b6c0680afeaaa30e /lib/CodeGen/MachineLICM.cpp | |
parent | 0235b627935ad90e3ad5650075e372bc2af8a85d (diff) | |
download | external_llvm-6cad113f9d7ddc2bc1e25290a1a1910932a2c477.zip external_llvm-6cad113f9d7ddc2bc1e25290a1a1910932a2c477.tar.gz external_llvm-6cad113f9d7ddc2bc1e25290a1a1910932a2c477.tar.bz2 |
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
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
-rw-r--r-- | lib/CodeGen/MachineLICM.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index fbf2113..4e2d9ee 100644 --- a/lib/CodeGen/MachineLICM.cpp +++ b/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()) { |