aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-12-12 23:12:09 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-12-12 23:12:09 +0000
commit6e141fd04897e5eb4925bb6351297170ebd8a756 (patch)
tree67154492dd48eec8a801c213a8e7c9bceaf0488a /lib/CodeGen/LiveIntervalAnalysis.cpp
parent67f1c493d105fdfb8ffa980ff82ff7d9e3fafefc (diff)
Implicit def instructions, e.g. X86::IMPLICIT_DEF_GR32, are always re-materializable and they should not be spilled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 0761e05a26..3496b6f6eb 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -613,8 +613,10 @@ bool LiveIntervals::isReMaterializable(const LiveInterval &li,
return false;
isLoad = false;
- if (tii_->isTriviallyReMaterializable(MI)) {
- isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG;
+ const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
+ if ((TID->Flags & M_IMPLICIT_DEF_FLAG) ||
+ tii_->isTriviallyReMaterializable(MI)) {
+ isLoad = TID->Flags & M_LOAD_FLAG;
return true;
}
@@ -677,6 +679,15 @@ bool LiveIntervals::tryFoldMemoryOperand(MachineInstr* &MI,
bool isSS, int Slot, unsigned Reg) {
unsigned MRInfo = 0;
const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
+ // If it is an implicit def instruction, just delete it.
+ if (TID->Flags & M_IMPLICIT_DEF_FLAG) {
+ RemoveMachineInstrFromMaps(MI);
+ vrm.RemoveMachineInstrFromMaps(MI);
+ MI->eraseFromParent();
+ ++numFolds;
+ return true;
+ }
+
SmallVector<unsigned, 2> FoldOps;
for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
unsigned OpIdx = Ops[i];
@@ -852,7 +863,8 @@ rewriteInstructionForSpills(const LiveInterval &li, bool TrySplit,
} else {
CanFold = canFoldMemoryOperand(MI, Ops);
}
- } else CanFold = false;
+ } else
+ CanFold = false;
// Create a new virtual register for the spill interval.
bool CreatedNewVReg = false;