aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/StrongPHIElimination.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-03-12 04:22:57 +0000
committerOwen Anderson <resistor@mac.com>2008-03-12 04:22:57 +0000
commitdfd07eab24394659ad445d6f7998fa31c1908d73 (patch)
tree67b0a5af2661a9dd0df33368110f9724b0a6cb7d /lib/CodeGen/StrongPHIElimination.cpp
parent0031671b414f3abb9f2b97a073207957749c80bc (diff)
downloadexternal_llvm-dfd07eab24394659ad445d6f7998fa31c1908d73.zip
external_llvm-dfd07eab24394659ad445d6f7998fa31c1908d73.tar.gz
external_llvm-dfd07eab24394659ad445d6f7998fa31c1908d73.tar.bz2
We also need to collect the VN IDs for the PHI instructions for later updating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index 6467afe..9dd7ddc 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/lib/CodeGen/StrongPHIElimination.cpp
@@ -52,8 +52,12 @@ namespace {
std::set<unsigned> UsedByAnother;
// RenameSets are the sets of operands (and their VNInfo IDs) to a PHI
- // (the defining instruction of the key) that can be renamed without copies
+ // (the defining instruction of the key) that can be renamed without copies.
std::map<unsigned, std::map<unsigned, unsigned> > RenameSets;
+
+ // PhiValueNumber holds the ID numbers of the VNs for each phi that we're
+ // eliminating, indexed by the register defined by that phi.
+ std::map<unsigned, unsigned> PhiValueNumber;
// Store the DFS-in number of each block
DenseMap<MachineBasicBlock*, unsigned> preorder;
@@ -405,6 +409,11 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
while (P != MBB->end() && P->getOpcode() == TargetInstrInfo::PHI) {
unsigned DestReg = P->getOperand(0).getReg();
+ LiveInterval& PI = LI.getOrCreateInterval(DestReg);
+ unsigned pIdx = LI.getInstructionIndex(P);
+ VNInfo* PVN = PI.getLiveRangeContaining(pIdx)->valno;
+ PhiValueNumber.insert(std::make_pair(DestReg, PVN->id));
+
// PHIUnion is the set of incoming registers to the PHI node that
// are going to be renames rather than having copies inserted. This set
// is refinded over the course of this function. UnionedBlocks is the set