[PATCH] D67434: [InstCombine] Limit FMul constant folding for fma simplifications.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 03:03:30 PDT 2019
fhahn created this revision.
fhahn added reviewers: spatel, lebedev.ri, reames.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
As @reames pointed out post-commit, rL371518 <https://reviews.llvm.org/rL371518> adds additional rounding
in some cases, when doing constant folding of the multiplication.
This breaks a guarantee llvm.fma makes and must be avoided.
This patch guards the simplification by additional conditions, to
ensure we do not constant fold when there could be rounding.
It should be fine to use SimplifyFMulInst, if either
- one of the operands is not constant (no constant folding)
- Either operands is either 1.0 or 0.0. The result won't require rounding.
- we are processing a fmuladd intrinsic (no rounding guarantees)
It also expands on the legality reasoning in a comment.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D67434
Files:
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/fma.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67434.219679.patch
Type: text/x-patch
Size: 5323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190911/3516ae63/attachment.bin>
More information about the llvm-commits
mailing list