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 | 504c645b3ed295a4abe05633d7d7677e2ae14e9d (patch) | |
| tree | 3aaa8ae455fa8942ccd889e7603bae52d7277b34 /llvm/lib | |
| parent | 405827dc265103fbc9359a929daf38505204c800 (diff) | |
| download | bcm5719-llvm-504c645b3ed295a4abe05633d7d7677e2ae14e9d.tar.gz bcm5719-llvm-504c645b3ed295a4abe05633d7d7677e2ae14e9d.zip | |
Rematerialization logic was overly conservative when it comes to loads from fixed stack slots.
llvm-svn: 47529
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index a18f36afb7f..2ff8afdeb8c 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/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) { |

