aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/InlineSpiller.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-08 19:33:55 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-08 19:33:55 +0000
commit7b1f498a7648b790929a4f97fd82228aa7ac7bea (patch)
treec983336ec4d92658f5f10ada2aff82ad8e207215 /lib/CodeGen/InlineSpiller.cpp
parentf125a298853e883c7c0630db544460723a610663 (diff)
Avoid folding a load instruction into an instruction that redefines the register.
The target hook doesn't know how to do that. (Neither do I). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/InlineSpiller.cpp')
-rw-r--r--lib/CodeGen/InlineSpiller.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/InlineSpiller.cpp b/lib/CodeGen/InlineSpiller.cpp
index 3e4f6c8303..00ca3d5bb6 100644
--- a/lib/CodeGen/InlineSpiller.cpp
+++ b/lib/CodeGen/InlineSpiller.cpp
@@ -157,7 +157,8 @@ bool InlineSpiller::reMaterializeFor(MachineBasicBlock::iterator MI) {
// Finally we can rematerialize OrigMI before MI.
SlotIndex DefIdx = edit_->rematerializeAt(*MI->getParent(), MI, NewLI.reg, RM,
lis_, tii_, tri_);
- DEBUG(dbgs() << "\tremat: " << DefIdx << '\n');
+ DEBUG(dbgs() << "\tremat: " << DefIdx << '\t'
+ << *lis_.getInstructionFromIndex(DefIdx));
// Replace operands
for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
@@ -270,6 +271,9 @@ bool InlineSpiller::foldMemoryOperand(MachineBasicBlock::iterator MI,
// FIXME: Teach targets to deal with subregs.
if (MO.getSubReg())
return false;
+ // We cannot fold a load instruction into a def.
+ if (LoadMI && MO.isDef())
+ return false;
// Tied use operands should not be passed to foldMemoryOperand.
if (!MI->isRegTiedToDefOperand(Idx))
FoldOps.push_back(Idx);