This change is to fix rdar://12571717 which is about assertion in Reassociate pass.
authorShuxin Yang <shuxin.llvm@gmail.com>
Mon, 12 Nov 2012 19:34:11 +0000 (19:34 +0000)
committerShuxin Yang <shuxin.llvm@gmail.com>
Mon, 12 Nov 2012 19:34:11 +0000 (19:34 +0000)
commit0a46bf13a3b6c412749b874b52c8234b027b7134
tree9f5167c84dd2188798cfc9ac5f136037969991b8
parentae692f2baedf53504af2715993b166950e185a55
This change is to fix rdar://12571717 which is about assertion in Reassociate pass.

The assertion is trigged when the Reassociater tries to transform expression
     ... + 2 * n * 3 + 2 * m + ...
  into:
     ... + 2 * (n*3 + m).

In the process of the transformation, a helper routine folds the constant 2*3 into 6,
confusing optimizer which is trying the to eliminate the common factor 2, and cannot
find 2 any more.

Review is pending. But I'd like commit first in order to help those who are waiting
for this fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167740 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/mul_neg.ll [new file with mode: 0644]
test/Transforms/Reassociate/multistep.ll