[DAGCombiner] Check term use before applying aggressive FSUB optimisations
authorCarl Ritson <carl.ritson@amd.com>
Fri, 20 Dec 2019 03:51:50 +0000 (12:51 +0900)
committerCarl Ritson <carl.ritson@amd.com>
Mon, 23 Dec 2019 00:37:58 +0000 (09:37 +0900)
commit2791667d2e3fb8c1f0abaff93fd8caaabb2b00b9
tree5041be7e66c6e7eaae72c4befb2a0b531faea344
parent2046d72e91670114625c87e122db6e013ba089d5
[DAGCombiner] Check term use before applying aggressive FSUB optimisations

Summary:
Without this check unnecessary FMA instructions are generated when the FSUB terms are reused.
This also has the side-effect that the same value is computed to different levels of precision, which can create undesirable effects if the results are used together in subsequent computation.

Reviewers: arsenm, nhaehnle, foad, tpr, dstuttard, spatel

Reviewed By: arsenm

Subscribers: jvesely, wdng, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71656
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AMDGPU/fadd-fma-fmul-combine.ll