[PATCH] Correct an operand inversion for fmul instcombine in fast math mode

Quentin Colombet qcolombet at apple.com
Thu Feb 28 11:43:49 PST 2013


Hi,

I've attached a patch that fixes 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

The actual code inverts the operand of the resulting add/sub instruction. This leads to incorrect code when the resulting operation is fsub.

The fix is straight forward. The new first operand is created form the old first operand and the new second operand is created from the old second operand. Previously, this was inverted.

The patch also contains a test case.

Thanks for the reviews.

Quentin
PS: I've also fixed the consistency of a comment to reflect the actual variable naming.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fast-math-fmul.patch
Type: application/octet-stream
Size: 1835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130228/225b6e43/attachment.obj>


More information about the llvm-commits mailing list