[IndVars] Don't break dominance in `eliminateIdentitySCEV`
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 6 Oct 2015 21:44:49 +0000 (21:44 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 6 Oct 2015 21:44:49 +0000 (21:44 +0000)
commitd15cdb7b13fb7b274aeba4951e3eadec4072bce9
treec6efb725978dc8b1100820f657f5d17b79bc9b7b
parent3692363a2cb8ca632c8dcbe05e37303bad518707
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249471 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/SimplifyIndVar.h
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Utils/LoopUnroll.cpp
lib/Transforms/Utils/SimplifyIndVar.cpp
test/Transforms/IndVarSimplify/pr25051.ll [new file with mode: 0644]