]> granicus.if.org Git - llvm/commit
[Reassociate] try harder to convert negative FP constants to positive
authorSanjay Patel <spatel@rotateright.com>
Sat, 10 Aug 2019 13:17:54 +0000 (13:17 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 10 Aug 2019 13:17:54 +0000 (13:17 +0000)
commit9c2eeb6c0c8947a7c68d56a0a3074654f848234d
tree0f80f84259e1894a14f7f263ca003bfa06c5e040
parenteaa074be158749f5f03630f83793191019c35aa1
[Reassociate] try harder to convert negative FP constants to positive

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
D5363 (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

Differential Revision: https://reviews.llvm.org/D65954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368512 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Scalar/Reassociate.h
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/canonicalize-neg-const.ll
test/Transforms/Reassociate/fast-ReassociateVector.ll
test/Transforms/Reassociate/reassoc-intermediate-fnegs.ll