[llvm-commits] [llvm] r115666 - /llvm/trunk/lib/CodeGen/SplitKit.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Oct 5 13:36:28 PDT 2010
Author: stoklund
Date: Tue Oct 5 15:36:28 2010
New Revision: 115666
URL: http://llvm.org/viewvc/llvm-project?rev=115666&view=rev
Log:
When we find a reaching definition, make sure it is visited from all paths by
erasing it from the visited set. That ensures we create the right phi defs.
Modified:
llvm/trunk/lib/CodeGen/SplitKit.cpp
Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=115666&r1=115665&r2=115666&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Oct 5 15:36:28 2010
@@ -424,10 +424,14 @@
// This may change during the DFS as we create new phi-defs.
typedef DenseMap<MachineBasicBlock*, VNInfo*> MBBValueMap;
MBBValueMap DomValue;
+ typedef SplitAnalysis::BlockPtrSet BlockPtrSet;
+ BlockPtrSet Visited;
- for (idf_iterator<MachineBasicBlock*>
- IDFI = idf_begin(IdxMBB),
- IDFE = idf_end(IdxMBB); IDFI != IDFE;) {
+ // Iterate over IdxMBB predecessors in a depth-first order.
+ // Skip begin() since that is always IdxMBB.
+ for (idf_ext_iterator<MachineBasicBlock*, BlockPtrSet>
+ IDFI = llvm::next(idf_ext_begin(IdxMBB, Visited)),
+ IDFE = idf_ext_end(IdxMBB, Visited); IDFI != IDFE;) {
MachineBasicBlock *MBB = *IDFI;
SlotIndex End = lis_.getMBBEndIdx(MBB).getPrevSlot();
@@ -444,7 +448,10 @@
continue;
}
- // Yes, VNI dominates MBB. Track the path back to IdxMBB, creating phi-defs
+ // Yes, VNI dominates MBB. Make sure we visit MBB again from other paths.
+ Visited.erase(MBB);
+
+ // Track the path back to IdxMBB, creating phi-defs
// as needed along the way.
for (unsigned PI = IDFI.getPathLength()-1; PI != 0; --PI) {
// Start from MBB's immediate successor. End at IdxMBB.
More information about the llvm-commits
mailing list