From 5c8bead46da91c348d37bcbefb431f5ff122ab19 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Tue, 6 Oct 2015 21:44:49 +0000 Subject: [IndVars] Don't break dominance in `eliminateIdentitySCEV` Summary: After r249211, `getSCEV(X) == getSCEV(Y)` does not guarantee that X and Y are related in the dominator tree, even if X is an operand to Y (I've included a toy example in comments, and a real example as a test case). This commit changes `SimplifyIndVar` to require a `DominatorTree`. I don't think this is a problem because `ScalarEvolution` requires it anyway. Fixes PR25051. Depends on D13459. Reviewers: atrick, hfinkel Subscribers: joker.eph, llvm-commits, sanjoy Differential Revision: http://reviews.llvm.org/D13460 llvm-svn: 249471 --- llvm/lib/Transforms/Utils/LoopUnroll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Utils/LoopUnroll.cpp') diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index 95d31d86644..b7e248860c5 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -499,7 +499,7 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, // Simplify any new induction variables in the partially unrolled loop. if (SE && !CompletelyUnroll) { SmallVector DeadInsts; - simplifyLoopIVs(L, SE, LPM, DeadInsts); + simplifyLoopIVs(L, SE, DT, LPM, DeadInsts); // Aggressively clean up dead instructions that simplifyLoopIVs already // identified. Any remaining should be cleaned up below. -- cgit v1.2.3