diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-02-23 03:38:34 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-23 03:38:34 +0000 |
commit | 249ded3fa8884f91fded869fb6e251b8aebb0376 (patch) | |
tree | ffadae6a55002ddf90fbd09e68d738e994ba3480 /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | aaa1d4265e93ade9db6ab815ed5680d8e59e3c6b (diff) |
Rematerialization logic was overly conservative when it comes to loads from fixed stack slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index a18f36afb7..2ff8afdeb8 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -646,27 +646,9 @@ bool LiveIntervals::isReMaterializable(const LiveInterval &li, int FrameIdx = 0; if (tii_->isLoadFromStackSlot(MI, FrameIdx) && - mf_->getFrameInfo()->isImmutableObjectIndex(FrameIdx)) { - // This is a load from fixed stack slot. It can be rematerialized unless - // it's re-defined by a two-address instruction. - isLoad = true; - for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = li.vni_end(); - i != e; ++i) { - const VNInfo *VNI = *i; - if (VNI == ValNo) - continue; - unsigned DefIdx = VNI->def; - if (DefIdx == ~1U) - continue; // Dead val#. - MachineInstr *DefMI = (DefIdx == ~0u) - ? NULL : getInstructionFromIndex(DefIdx); - if (DefMI && DefMI->isRegReDefinedByTwoAddr(li.reg)) { - isLoad = false; - return false; - } - } + mf_->getFrameInfo()->isImmutableObjectIndex(FrameIdx)) + // This is a load from fixed stack slot. It can be rematerialized. return true; - } if (tii_->isTriviallyReMaterializable(MI)) { isLoad = TID.isSimpleLoad(); @@ -754,6 +736,10 @@ bool LiveIntervals::tryFoldMemoryOperand(MachineInstr* &MI, FoldOps.push_back(OpIdx); } + // Can't fold a load from fixed stack slot into a two address instruction. + if (isSS && DefMI && (MRInfo & VirtRegMap::isMod)) + return false; + MachineInstr *fmi = isSS ? tii_->foldMemoryOperand(*mf_, MI, FoldOps, Slot) : tii_->foldMemoryOperand(*mf_, MI, FoldOps, DefMI); if (fmi) { |