From 52b1733df4bb3cafa7a81384da7e81a1fa66cea5 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 2 Apr 2008 03:00:13 +0000 Subject: [PATCH] In some situations, we need to check for local interferences between the PHI node and its inputs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49070 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/StrongPHIElimination.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp index 6416690e29f..a632da6de09 100644 --- a/lib/CodeGen/StrongPHIElimination.cpp +++ b/lib/CodeGen/StrongPHIElimination.cpp @@ -483,8 +483,17 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) { std::vector > localInterferences; processPHIUnion(P, PHIUnion, DF, localInterferences); + // If one of the inputs is defined in the same block as the current PHI + // then we need to check for a local interference between that input and + // the PHI. + for (std::map::iterator I = PHIUnion.begin(), + E = PHIUnion.end(); I != E; ++I) + if (MRI.getVRegDef(I->first)->getParent() == P->getParent()) + localInterferences.push_back(std::make_pair(I->first, + P->getOperand(0).getReg())); + // The dominator forest walk may have returned some register pairs whose - // interference cannot be determines from dominator analysis. We now + // interference cannot be determined from dominator analysis. We now // examine these pairs for local interferences. for (std::vector >::iterator I = localInterferences.begin(), E = localInterferences.end(); I != E; ++I) { @@ -527,7 +536,7 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) { } } - // Add the renaming set for this PHI node to our overal renaming information + // Add the renaming set for this PHI node to our overall renaming information RenameSets.insert(std::make_pair(P->getOperand(0).getReg(), PHIUnion)); // Remember which registers are already renamed, so that we don't try to