[PATCH] [BUG][INDVAR] Fix for PR21014: wrong SCEV operands commuting for non-commutative instructions

Zinovy Nis zinovy.nis at gmail.com
Thu Oct 2 04:14:27 PDT 2014


Hi atrick, hfinkel, joerg,

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. The patch attached fixes it. 
Thanks to Jörg Sonnenberger for pointing.

http://reviews.llvm.org/D5576

Files:
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5576.14315.patch
Type: text/x-patch
Size: 2392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141002/60908544/attachment.bin>


More information about the llvm-commits mailing list