llvm/test/Transforms/Reassociate
Chris Lattner 9506c930aa When factoring multiply expressions across adds, factor both
positive and negative forms of constants together.  This 
allows us to compile:

int foo(int x, int y) {
    return (x-y) + (x-y) + (x-y);
}

into:

_foo:                                                       ## @foo
	subl	%esi, %edi
	leal	(%rdi,%rdi,2), %eax
	ret

instead of (where the 3 and -3 were not factored):

_foo:
        imull   $-3, 8(%esp), %ecx
        imull   $3, 4(%esp), %eax
        addl    %ecx, %eax
        ret

this started out as:
    movl    12(%ebp), %ecx
    imull   $3, 8(%ebp), %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    ret

This comes from PR5359.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:13:15 +00:00
..
2002-05-15-AgressiveSubMove.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2002-05-15-MissedTree.ll Use opt -S instead of piping bitcode output through llvm-dis. 2009-09-08 22:34:10 +00:00
2002-05-15-SubReassociate2.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2002-05-15-SubReassociate.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2002-07-09-DominanceProblem.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-08-12-InfiniteLoop.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-08-24-Crash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-09-01-ArrayOutOfBounds.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-04-27-ReassociateVector.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
basictest.ll When factoring multiply expressions across adds, factor both 2010-01-01 01:13:15 +00:00
dg.exp sabre brings to my attention that the 'tr' suffix is also obsolete 2008-05-20 21:00:03 +00:00
inverses.ll Use "opt < %s" instead of "opt %s" so that opt doesn't print the test 2009-09-08 22:57:49 +00:00
looptest.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
mulfactor2.ll Convert more tests to avoid llvm-as. 2009-09-11 18:36:27 +00:00
mulfactor.ll Use opt -S instead of piping bitcode output through llvm-dis. 2009-09-08 22:34:10 +00:00
negation.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
otherops.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
shift-factor.ll Convert more tests to avoid llvm-as. 2009-09-11 18:36:27 +00:00
shifttest.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
subtest2.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
subtest.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00