summaryrefslogtreecommitdiff
path: root/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-09 22:08:26 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-09 22:08:26 +0000
commit988069e2291f62dced081dd54da38b9683bdbdca (patch)
tree67a740437e8165221a0143ed1d37fa1085971c28 /lib/CodeGen/TwoAddressInstructionPass.cpp
parent69a0aa87f8d64895af082cb52c7ecee0f6021d20 (diff)
downloadllvm-988069e2291f62dced081dd54da38b9683bdbdca.tar.gz
llvm-988069e2291f62dced081dd54da38b9683bdbdca.tar.bz2
llvm-988069e2291f62dced081dd54da38b9683bdbdca.tar.xz
Fix a future TwoAddressInstructionPass crash.
No test case, the crash only happens when the default use list order is changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161627 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--lib/CodeGen/TwoAddressInstructionPass.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp
index d22274496a..9a219a6b00 100644
--- a/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -235,7 +235,7 @@ bool TwoAddressInstructionPass::Sink3AddrInstruction(MachineBasicBlock *MBB,
// appropriate location, we can try to sink the current instruction
// past it.
if (!KillMI || KillMI->getParent() != MBB || KillMI == MI ||
- KillMI->isTerminator())
+ KillMI == OldPos || KillMI->isTerminator())
return false;
// If any of the definitions are used by another instruction between the
@@ -278,6 +278,7 @@ bool TwoAddressInstructionPass::Sink3AddrInstruction(MachineBasicBlock *MBB,
}
}
}
+ assert(KillMO && "Didn't find kill");
// Update kill and LV information.
KillMO->setIsKill(false);