Fix a bug in instcombine for fmul in fast math mode.
authorQuentin Colombet <qcolombet@apple.com>
Thu, 28 Feb 2013 21:12:40 +0000 (21:12 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Thu, 28 Feb 2013 21:12:40 +0000 (21:12 +0000)
commite684a6d4aa09502b2865f82511abaea71158b488
tree4638d0bcaa071c14ed767b7b18c017874e7b0a2f
parentda288955975c07d8f59ecb8ec3c15c2948d2f514
Fix a bug in instcombine for fmul in fast math mode.
The instcombine recognized pattern looks like:
a = b * c
d = a +/- Cst
or
a = b * c
d = Cst +/- a

When creating the new operands for fadd or fsub instruction following the related fmul, the first operand was created with the second original operand (M0 was created with C1) and the second with the first (M1 with Opnd0).

The fix consists in creating the new operands with the appropriate original operand, i.e., M0 with Opnd0 and M1 with C1.

llvm-svn: 176300
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/fast-math.ll