summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitc6a2041d997ffa2a7c19b76d8838852f37d04f55 (patch)
treebcb22f8b4d56db4c6258706da4c316be91373c02 /llvm/lib
parent968fa38e0a5afcd79f2b06f9e448e751f5ff4ff0 (diff)
downloadbcm5719-llvm-c6a2041d997ffa2a7c19b76d8838852f37d04f55.tar.gz
bcm5719-llvm-c6a2041d997ffa2a7c19b76d8838852f37d04f55.zip
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). llvm-svn: 125108
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/InlineSpiller.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index 3e4f6c83036..00ca3d5bb64 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud