diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-04-04 07:40:01 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-04-04 07:40:01 +0000 |
commit | 9193514e2e3e599e241220b72bc9add25a80a8fd (patch) | |
tree | 95f39e7153c60d608d59f99a8c3397b37f266297 /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | a96c5b30408a42cd6b8f335bd0816f2b2e58bdf5 (diff) | |
download | external_llvm-9193514e2e3e599e241220b72bc9add25a80a8fd.zip external_llvm-9193514e2e3e599e241220b72bc9add25a80a8fd.tar.gz external_llvm-9193514e2e3e599e241220b72bc9add25a80a8fd.tar.bz2 |
Re-materialize all loads from fixed stack slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 3858a98..8cfc587 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -167,8 +167,10 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) { LiveInterval &RegInt = getInterval(reg); float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth); // If the definition instruction is re-materializable, its spill - // weight is half of what it would have been normally. - if (RegInt.remat) + // weight is half of what it would have been normally unless it's + // a load from fixed stack slot. + int Dummy; + if (RegInt.remat && !tii_->isLoadFromStackSlot(RegInt.remat, Dummy)) w /= 2; RegInt.weight += w; } @@ -430,8 +432,13 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, // done once for the vreg. We use an empty interval to detect the first // time we see a vreg. if (interval.empty()) { - // Remember if the definition can be rematerialized. - if (vi.DefInst && tii_->isReMaterializable(vi.DefInst->getOpcode())) + // Remember if the definition can be rematerialized. All load's from fixed + // stack slots are re-materializable. + int FrameIdx = 0; + if (vi.DefInst && + (tii_->isReMaterializable(vi.DefInst->getOpcode()) || + (tii_->isLoadFromStackSlot(vi.DefInst, FrameIdx) && + mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx)))) interval.remat = vi.DefInst; // Get the Idx of the defining instructions. @@ -509,7 +516,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, } } else { - // Can't safely assume definition is rematierializable anymore. + // Can no longer safely assume definition is rematerializable. interval.remat = NULL; // If this is the second time we see a virtual register definition, it |