summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-19 20:08:00 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-19 20:08:00 +0000
commite11cdf8cc8132ada1f9e622a9aef243e5c4b92a1 (patch)
treeba428e49d3364dd1300818d009907f1960e45aea /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
parent59a61fd7cc0e47311a408f737e791e38d8746b50 (diff)
downloadbcm5719-llvm-e11cdf8cc8132ada1f9e622a9aef243e5c4b92a1.tar.gz
bcm5719-llvm-e11cdf8cc8132ada1f9e622a9aef243e5c4b92a1.zip
TwoAddressInstructionPass doesn't really know how to merge live intervals when
lowering REG_SEQUENCE instructions. Insert copies for REG_SEQUENCE sources not killed to avoid breaking later passes. llvm-svn: 104146
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index fdecc5f14af..21e5a5a9f24 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1275,9 +1275,10 @@ bool TwoAddressInstructionPass::EliminateRegSequences() {
if (!Seen.insert(SrcReg) ||
MI->getParent() != DefMI->getParent() ||
+ !MI->getOperand(i).isKill() ||
HasOtherRegSequenceUses(SrcReg, MI, MRI)) {
// REG_SEQUENCE cannot have duplicated operands, add a copy.
- // Also add an copy if the source if live-in the block. We don't want
+ // Also add an copy if the source is live-in the block. We don't want
// to end up with a partial-redef of a livein, e.g.
// BB0:
// reg1051:10<def> =
@@ -1287,6 +1288,10 @@ bool TwoAddressInstructionPass::EliminateRegSequences() {
// BB2:
// reg1051:9<def> =
// LiveIntervalAnalysis won't like it.
+ //
+ // If the REG_SEQUENCE doesn't kill its source, keeping live variables
+ // correctly up to date becomes very difficult. Insert a copy.
+ //
const TargetRegisterClass *RC = MRI->getRegClass(SrcReg);
unsigned NewReg = MRI->createVirtualRegister(RC);
MachineBasicBlock::iterator InsertLoc = MI;
OpenPOWER on IntegriCloud