aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-02-23 01:44:27 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-02-23 01:44:27 +0000
commitc2855324fb3a9a48f9c0f8311feb5e1de971aa1f (patch)
treee1630a3ce8f42c8764a0d4c7e36ea8e72440dcba
parent3d5a1e86a3093183f4a179e6b7d6d3136fa4bdee (diff)
downloadexternal_llvm-c2855324fb3a9a48f9c0f8311feb5e1de971aa1f.zip
external_llvm-c2855324fb3a9a48f9c0f8311feb5e1de971aa1f.tar.gz
external_llvm-c2855324fb3a9a48f9c0f8311feb5e1de971aa1f.tar.bz2
Recognize loads of arguments as re-materializable first. Therefore if isReallyTriviallyReMaterializable() returns true it doesn't confuse it as a "normal" re-materializable instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47520 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 35f0723..f1de4d1 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -643,6 +643,31 @@ bool LiveIntervals::isReMaterializable(const LiveInterval &li,
const TargetInstrDesc &TID = MI->getDesc();
if (TID.isImplicitDef())
return true;
+
+ 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;
+ }
+ }
+ return true;
+ }
+
if (tii_->isTriviallyReMaterializable(MI)) {
isLoad = TID.isSimpleLoad();
@@ -663,30 +688,7 @@ bool LiveIntervals::isReMaterializable(const LiveInterval &li,
return true;
}
- int FrameIdx = 0;
- if (!tii_->isLoadFromStackSlot(MI, FrameIdx) ||
- !mf_->getFrameInfo()->isImmutableObjectIndex(FrameIdx))
- return false;
-
- // 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;
- }
- }
- return true;
+ return false;
}
/// isReMaterializable - Returns true if every definition of MI of every