forked from OSchip/llvm-project
				
			Move the EliminateIVUsers call back out to its original location. Now that
a ScalarEvolution bug with overflow handling is fixed, the normal analysis code will automatically decline to operate on the icmp instructions which are responsible for the loop exit. llvm-svn: 101032
This commit is contained in:
		
							parent
							
								
									7531ca96f7
								
							
						
					
					
						commit
						07f6563e81
					
				| 
						 | 
					@ -406,6 +406,9 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
 | 
				
			||||||
  if (!isa<SCEVCouldNotCompute>(BackedgeTakenCount))
 | 
					  if (!isa<SCEVCouldNotCompute>(BackedgeTakenCount))
 | 
				
			||||||
    RewriteLoopExitValues(L, Rewriter);
 | 
					    RewriteLoopExitValues(L, Rewriter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Simplify ICmp IV users.
 | 
				
			||||||
 | 
					  EliminateIVComparisons();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Compute the type of the largest recurrence expression, and decide whether
 | 
					  // Compute the type of the largest recurrence expression, and decide whether
 | 
				
			||||||
  // a canonical induction variable should be inserted.
 | 
					  // a canonical induction variable should be inserted.
 | 
				
			||||||
  const Type *LargestType = 0;
 | 
					  const Type *LargestType = 0;
 | 
				
			||||||
| 
						 | 
					@ -471,20 +474,11 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
 | 
				
			||||||
      ExitingBlock) {
 | 
					      ExitingBlock) {
 | 
				
			||||||
    assert(NeedCannIV &&
 | 
					    assert(NeedCannIV &&
 | 
				
			||||||
           "LinearFunctionTestReplace requires a canonical induction variable");
 | 
					           "LinearFunctionTestReplace requires a canonical induction variable");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Can't rewrite non-branch yet.
 | 
					    // Can't rewrite non-branch yet.
 | 
				
			||||||
    if (BranchInst *BI = dyn_cast<BranchInst>(ExitingBlock->getTerminator())) {
 | 
					    if (BranchInst *BI = dyn_cast<BranchInst>(ExitingBlock->getTerminator()))
 | 
				
			||||||
      // Eliminate comparisons which are always true or always false, due to
 | 
					 | 
				
			||||||
      // the known backedge-taken count. This may include comparisons which
 | 
					 | 
				
			||||||
      // are currently controlling (part of) the loop exit, so we can only do
 | 
					 | 
				
			||||||
      // it when we know we're going to insert our own loop exit code.
 | 
					 | 
				
			||||||
      EliminateIVComparisons();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // Insert new loop exit code.
 | 
					 | 
				
			||||||
      NewICmp = LinearFunctionTestReplace(L, BackedgeTakenCount, IndVar,
 | 
					      NewICmp = LinearFunctionTestReplace(L, BackedgeTakenCount, IndVar,
 | 
				
			||||||
                                          ExitingBlock, BI, Rewriter);
 | 
					                                          ExitingBlock, BI, Rewriter);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Rewrite IV-derived expressions. Clears the rewriter cache.
 | 
					  // Rewrite IV-derived expressions. Clears the rewriter cache.
 | 
				
			||||||
  RewriteIVExpressions(L, Rewriter);
 | 
					  RewriteIVExpressions(L, Rewriter);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue