aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/StrongPHIElimination.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-06 20:29:20 +0000
committerOwen Anderson <resistor@mac.com>2008-08-06 20:29:20 +0000
commit9860b71b6a23bc0ae620d7dfc621ea1ffafbf8d8 (patch)
tree98a2a1052556a0fdbb14d7a5b9bbe8d3ef573a46 /lib/CodeGen/StrongPHIElimination.cpp
parent9b49120408e6c0e10e18ce38cae7120c954fe708 (diff)
downloadexternal_llvm-9860b71b6a23bc0ae620d7dfc621ea1ffafbf8d8.zip
external_llvm-9860b71b6a23bc0ae620d7dfc621ea1ffafbf8d8.tar.gz
external_llvm-9860b71b6a23bc0ae620d7dfc621ea1ffafbf8d8.tar.bz2
We don't need to try to coalesce input vregs that are the same as the output vreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index b276e80..11b8ca3 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/lib/CodeGen/StrongPHIElimination.cpp
@@ -421,6 +421,7 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
while (P != MBB->end() && P->getOpcode() == TargetInstrInfo::PHI) {
unsigned DestReg = P->getOperand(0).getReg();
+
// Don't both doing PHI elimination for dead PHI's.
if (P->registerDefIsDead(DestReg)) {
++P;
@@ -442,6 +443,12 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
// Iterate over the operands of the PHI node
for (int i = P->getNumOperands() - 1; i >= 2; i-=2) {
unsigned SrcReg = P->getOperand(i-1).getReg();
+
+ // Don't need to try to coalesce a register with itself.
+ if (SrcReg == DestReg) {
+ ProcessedNames.insert(SrcReg);
+ continue;
+ }
// Check for trivial interferences via liveness information, allowing us
// to avoid extra work later. Any registers that interfere cannot both