[BUG][INDVAR] Fix for PR21014: wrong SCEV operands commuting for non-commutative...
authorZinovy Nis <zinovy.nis@gmail.com>
Thu, 2 Oct 2014 13:01:15 +0000 (13:01 +0000)
committerZinovy Nis <zinovy.nis@gmail.com>
Thu, 2 Oct 2014 13:01:15 +0000 (13:01 +0000)
commit31713943aac87baba0792c250a606b33eda36fbe
treecb33173c01e8048b45631439b12d9671c19aacc1
parentfd94d1bd76ae927433b59aebee1a5fb4c5dcdc79
[BUG][INDVAR] Fix for PR21014: wrong SCEV operands commuting for non-commutative instructions

My commit rL216160 introduced a bug PR21014: IndVars widens code 'for (i = ; i < ...; i++) arr[ CONST - i]' into 'for (i = ; i < ...; i++) arr[ i - CONST]'
thus inverting index expression. This patch fixes it.
Thanks to Jörg Sonnenberger for pointing.

Differential Revision: http://reviews.llvm.org/D5576

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218867 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll