[PATCH] D25297: [DAG] use SDNode flags 'nsz' to enable fadd/fsub with zero folds

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 17:02:39 PDT 2016


spatel created this revision.
spatel added reviewers: mehdi_amini, echristo, hfinkel.
spatel added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

As discussed in https://reviews.llvm.org/D24815, let's start the process of killing off the broken fast-math global state housed in TargetOptions and eliminate the need for function-level fast-math attributes.

Looks like I started this mission in https://reviews.llvm.org/D9708...and promptly got distracted for almost a year. :)

Here we enable two similar folds that are possible when we don't care about signed-zero:
fadd nsz x, 0 --> x
fsub nsz 0, x --> -x

Note that although the test cases include a 'sin' function call, I'm side-stepping the FMF-on-calls question (and lack of support in the DAG) for now. It's not needed for these tests - isNegatibleForFree/GetNegatedExpression just look through a ISD::FSIN node.


https://reviews.llvm.org/D25297

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/negative-sin.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25297.73711.patch
Type: text/x-patch
Size: 5575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161006/a6f3991b/attachment.bin>


More information about the llvm-commits mailing list