summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPawel Wodnicki <pawel@32bitmicro.com>2012-11-21 18:55:44 +0000
committerPawel Wodnicki <pawel@32bitmicro.com>2012-11-21 18:55:44 +0000
commitb30ce3e484f1e7f37a709e6fa7a91712a3d85e97 (patch)
tree0c134f5448d3cda5f093b14aaa1fe9d18248d467 /test
parent36915224aa459ce855d7ce56b36307d468ab44a8 (diff)
downloadllvm-b30ce3e484f1e7f37a709e6fa7a91712a3d85e97.tar.gz
llvm-b30ce3e484f1e7f37a709e6fa7a91712a3d85e97.tar.bz2
llvm-b30ce3e484f1e7f37a709e6fa7a91712a3d85e97.tar.xz
Merging r168035: into 3.2 release branch.
Fix a crash observed by Shuxin Yang. The issue here is that LinearizeExprTree, the utility for extracting a chain of operations from the IR, thought that it might as well combine any constants it came across (rather than just returning them along with everything else). On the other hand, the factorization code would like to see the individual constants (this is quite reasonable: it is much easier to pull a factor of 3 out of 2*3 than it is to pull it out of 6; you may think 6/3 isn't so hard, but due to overflow it's not as easy to undo multiplications of constants as it may at first appear). This patch therefore makes LinearizeExprTree stupider: it now leaves optimizing to the optimization part of reassociate, and sticks to just analysing the IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/Reassociate/crash.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/crash.ll b/test/Transforms/Reassociate/crash.ll
index ce586e15fb..a617e9f327 100644
--- a/test/Transforms/Reassociate/crash.ll
+++ b/test/Transforms/Reassociate/crash.ll
@@ -144,3 +144,12 @@ define i32 @sozefx_(i32 %x, i32 %y) {
%t6 = add i32 %t4, %t5
ret i32 %t6
}
+
+define i32 @bar(i32 %arg, i32 %arg1, i32 %arg2) {
+ %tmp1 = mul i32 %arg1, 2
+ %tmp2 = mul i32 %tmp1, 3
+ %tmp3 = mul i32 %arg2, 2
+ %tmp4 = add i32 %tmp1, 1 ; dead code
+ %ret = add i32 %tmp2, %tmp3
+ ret i32 %ret
+}