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

Liao, Michael via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 14:25:23 PDT 2015


Hi Bill

I just verified that on my x86-64 machine. That test passed

Program,CC,CC_Time,CC_Real_Time,CC_Hash,Exec,Exec_Time,Exec_Real_Time
hexxagon,pass, 9.1260, 9.2154,a9c4918e7084e3deca4939bd6f02a6b8,pass,
6.6212, 6.6214

Since I don't have access to ppc64. Could you help me dump the assembly
 code before and after to figure out what's wrong? Or, is it a
potential PPC64 backend bug?

Thanks
- Michael

On Wed, 2015-10-21 at 15:20 -0500, Bill Seurer wrote:
> 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
> 
-- 
Thanks
- Michael


More information about the llvm-commits mailing list