[PATCH] D65954: [Reassociate] try harder to convert negative FP constants to positive
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 08:19:50 PDT 2019
spatel created this revision.
spatel added reviewers: mcrosier, cameron.mcinally, lebedev.ri, reames, escha, mcberg2017.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
This is an extension of a transform that tries to produce positive floating-point constants to improve canonicalization (and hopefully lead to more reassociation and CSE).
The original patches were:
D4904 <https://reviews.llvm.org/D4904>
D5363 <https://reviews.llvm.org/D5363> (rL221721 <https://reviews.llvm.org/rL221721>)
But as the test diffs show, these were limited to basic patterns by walking from an instruction to its single user rather than recursively moving up the def-use sequence. No fast-math is required here because we're only rearranging implicit FP negations in intermediate ops.
A motivating bug is:
https://bugs.llvm.org/show_bug.cgi?id=32939
...but unfortunately the transform in that example gets inverted in the backend, so we end up with the same code. I'll investigate that case as a follow-up, but I think the changes here can be viewed as an independent improvement.
https://reviews.llvm.org/D65954
Files:
llvm/include/llvm/Transforms/Scalar/Reassociate.h
llvm/lib/Transforms/Scalar/Reassociate.cpp
llvm/test/Transforms/Reassociate/canonicalize-neg-const.ll
llvm/test/Transforms/Reassociate/fast-ReassociateVector.ll
llvm/test/Transforms/Reassociate/reassoc-intermediate-fnegs.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65954.214158.patch
Type: text/x-patch
Size: 28939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190808/75bd9f9d/attachment.bin>
More information about the llvm-commits
mailing list