[llvm-commits] [llvm] r48278 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Owen Anderson resistor at mac.com
Tue Mar 11 21:22:57 PDT 2008


Author: resistor
Date: Tue Mar 11 23:22:57 2008
New Revision: 48278

URL: http://llvm.org/viewvc/llvm-project?rev=48278&view=rev
Log:
We also need to collect the VN IDs for the PHI instructions for later updating.

Modified:
    llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=48278&r1=48277&r2=48278&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Mar 11 23:22:57 2008
@@ -52,8 +52,12 @@
     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 @@
   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





More information about the llvm-commits mailing list