[llvm-bugs] [Bug 31626] New: [DAGCombine] enableAggressiveFMAFusion incorrectly uses associativity of addition
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 13 04:00:52 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31626
Bug ID: 31626
Summary: [DAGCombine] enableAggressiveFMAFusion incorrectly
uses associativity of addition
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: nhaehnle at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The following transforms:
// fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z))
// fold (fadd x, (fma y, z, (fmul u, v)) -> (fma y, z (fma u, v, x))
// fold (fsub (fma x, y, (fmul u, v)), z)
// -> (fma x, y (fma u, v, (fneg z)))
// fold (fsub x, (fma y, z, (fmul u, v)))
// -> (fma (fneg y), z, (fma (fneg u), v, x))
make use of associativity of addition (and the last one probably even more).
Other parts of the compiler take pains not to use associativity unless
UnsafeFPMath is enabled.
However, these transforms are only guarded by: ((AllowFusion || HasFMAD) &&
Aggressive).
Aggressive is defined by
/// Return true if target always beneficiates from combining into FMA for a
/// given value type. This must typically return false on targets where FMA
/// takes more cycles to execute than FADD.
i.e. it is only about the relative performance of different code sequences
which produce the same result.
I think the guard for the transforms above should instead be: ((AllowFusion ||
HasFMAD) && Options.UnsafeFPMath && Aggressive)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170113/a4de7fd6/attachment.html>
More information about the llvm-bugs
mailing list