[llvm] r250746 - [InstCombine] Optimize icmp of inc/dec at RHS

Bill Seurer via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 13:20:52 PDT 2015


On 10/19/2015 05:08 PM, Michael Liao via llvm-commits wrote:
> Author: hliao
> Date: Mon Oct 19 17:08:14 2015
> New Revision: 250746
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250746&view=rev
> Log:
> [InstCombine] Optimize icmp of inc/dec at RHS
>
> Allow LLVM to optimize the sequence like the following:
>
>    %inc = add nsw i32 %i, 1
>    %cmp = icmp slt %n, %inc
>
> into:
>
>    %cmp = icmp sle i32 %n, %i
>
> The case is not handled previously due to the complexity of compuation of %n.
> Hence, LLVM cannot swap operands of icmp accordingly.
>
>
> Modified:
>      llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
>      llvm/trunk/test/Transforms/InstCombine/icmp.ll

This revision causes the test case MultiSource/Applications/hexxagon in 
the lnt tests on power (and perhaps other architectures) to fail.

http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux/builds/11775

The output of the hexxagon program is different before this change and 
after.  The 3rd iteration (?) and afterward is where the output differs:

Before (expected output):

Bricks: x 3, o 3. Empty 55.
Next to move: x
          A B C D E F G H I
         / / / / / / / / /
1-     x . . . o
2-    . . . . . .
3-   . . . . . . .
4-  . . . . . . . x
5- o . . . . . . . x
6-  . . . . . . . .
7-   . . . . . . .
8-    . . . . . .
9-     x . . . o


After:

Bricks: x 3, o 3. Empty 55.
Next to move: x
          A B C D E F G H I
         / / / / / / / / /
1-     x . . . o
2-    . . . . . .
3-   . . . . . . .
4-  . . . . . . . .
5- o . . . . . . . x
6-  . . . . . . . .
7-   . . . . . . .
8-    x . . . . .
9-     x . . . o

-- 

-Bill Seurer



More information about the llvm-commits mailing list