Fix a crash observed by Shuxin Yang. The issue here is that LinearizeExprTree,
authorDuncan Sands <baldrick@free.fr>
Thu, 15 Nov 2012 09:58:38 +0000 (09:58 +0000)
committerDuncan Sands <baldrick@free.fr>
Thu, 15 Nov 2012 09:58:38 +0000 (09:58 +0000)
commit7ecfcc163956a9e27845ac217f6c650658631030
treebd729b42e44f9d21b7b9c336390c02d7e8ec7708
parent116bd168e1dd46ed5b1b46aabfc566128836fb70
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/trunk@168035 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/crash.ll