avoid infinite looping when folding vector multiplies of constants (PR22698)
authorSanjay Patel <spatel@rotateright.com>
Sun, 1 Mar 2015 00:09:35 +0000 (00:09 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 1 Mar 2015 00:09:35 +0000 (00:09 +0000)
commit821bba7fda8acb85a173f731a09e6818fd0b58e2
tree80f90f44051700c03787896a7b9b5f0cc8da0c8f
parent74978345165881d2f59c0046445db4b414ef115c
avoid infinite looping when folding vector multiplies of constants (PR22698)

We were missing a check for the following fold in DAGCombiner:

// fold (fmul (fmul x, c1), c2) -> (fmul x, (fmul c1, c2))

If 'x' is also a constant, then we shouldn't do anything. Otherwise, we could end up swapping the operands back and forth forever.

This should fix:
http://llvm.org/bugs/show_bug.cgi?id=22698

Differential Revision: http://reviews.llvm.org/D7917

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230884 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/fmul-combines.ll