mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	Update -mem2reg to use succ_iterator instead of iterating across TerminatorInst
successors. This makes it support nounwind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48320 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -884,12 +884,10 @@ NextIteration:
 | 
				
			|||||||
      // operands so far.  Remember this count.
 | 
					      // operands so far.  Remember this count.
 | 
				
			||||||
      unsigned NewPHINumOperands = APN->getNumOperands();
 | 
					      unsigned NewPHINumOperands = APN->getNumOperands();
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      TerminatorInst *PredTerm = Pred->getTerminator();
 | 
					 | 
				
			||||||
      unsigned NumEdges = 0;
 | 
					      unsigned NumEdges = 0;
 | 
				
			||||||
      for (unsigned i = 0, e = PredTerm->getNumSuccessors(); i != e; ++i) {
 | 
					      for (succ_iterator I = succ_begin(Pred), E = succ_end(Pred); I != E; ++I)
 | 
				
			||||||
        if (PredTerm->getSuccessor(i) == BB)
 | 
					        if (*I == BB)
 | 
				
			||||||
          ++NumEdges;
 | 
					          ++NumEdges;
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      assert(NumEdges && "Must be at least one edge from Pred to BB!");
 | 
					      assert(NumEdges && "Must be at least one edge from Pred to BB!");
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      // Add entries for all the phis.
 | 
					      // Add entries for all the phis.
 | 
				
			||||||
@@ -952,18 +950,17 @@ NextIteration:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 'Recurse' to our successors.
 | 
					  // 'Recurse' to our successors.
 | 
				
			||||||
  TerminatorInst *TI = BB->getTerminator();
 | 
					  succ_iterator I = succ_begin(BB), E = succ_end(BB);
 | 
				
			||||||
  unsigned NumSuccs = TI->getNumSuccessors();
 | 
					  if (I == E) return;
 | 
				
			||||||
  if (NumSuccs == 0) return;
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  // Add all-but-one successor to the worklist.
 | 
					 | 
				
			||||||
  for (unsigned i = 0; i != NumSuccs-1; i++)
 | 
					 | 
				
			||||||
    Worklist.push_back(RenamePassData(TI->getSuccessor(i), BB, IncomingVals));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Handle the last successor without using the worklist.  This allows us to
 | 
					  // Handle the last successor without using the worklist.  This allows us to
 | 
				
			||||||
  // handle unconditional branches directly, for example.
 | 
					  // handle unconditional branches directly, for example.
 | 
				
			||||||
 | 
					  --E;
 | 
				
			||||||
 | 
					  for (; I != E; ++I)
 | 
				
			||||||
 | 
					    Worklist.push_back(RenamePassData(*I, BB, IncomingVals));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Pred = BB;
 | 
					  Pred = BB;
 | 
				
			||||||
  BB = TI->getSuccessor(NumSuccs-1);
 | 
					  BB = *I;
 | 
				
			||||||
  goto NextIteration;
 | 
					  goto NextIteration;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user