<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I confirmed that with a patch in our backend (an extremely FP-heavy GPU backend with tons of combines) to propagate fast-math flags on our own target DAG combines, the fast-math change Sanjay committed is NFC. Hopefully anyone else having to do the same sort of thing with their backend has the same result!<div class=""><br class=""></div><div class="">—escha</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 23, 2015, at 9:48 AM, Sanjay Patel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi backend maintainers/hackers,<br class=""><br class=""></div>With r247815: <br class=""><div class=""><a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=247815" target="_blank" class="">http://llvm.org/viewvc/llvm-project?view=revision&revision=247815</a><br class=""><br class=""></div><div class="">...we're propagating fast-math-flags (FMF) from IR to DAG nodes by default. This has been reverted before...<br class="">But it's been one week since the commit and I haven't heard any complaints yet, so I'm hoping it sticks this time.<br class=""><br class="">If you have target-specific DAG combines on FP nodes, you probably want to propagate the optimization flags from incoming nodes to nodes that you are creating. Otherwise, you may fail to get CSE optimizations that happened before this change. See the test case in the patch for an example of how that might manifest.<br class=""><div class=""><br class="">The code change when creating a node that should have FMF looks something like this: <br class=""></div><pre class="">-      Tmp1 = DAG.getNode(ISD::FADD, dl, VT, Node->getOperand(0), Tmp1);
+      Tmp1 = DAG.getNode(ISD::FADD, dl, VT, Node->getOperand(0), Tmp1, Node->getFlags());
</pre><br class="">FMF only applies to binary FP ops at the moment, but as noted in the commit message, the plan is to extend the flags to more DAG node types.<br class=""><br class=""></div>Going forward, we can use the node-level flags to trigger optimizations that the global target settings (eg, DAG.getTarget().Options.UnsafeFPMath) might not allow. And some day, we may be able to remove global FP optimization flags entirely.<br class=""><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>