[llvm-commits] Fold multiply by 0 and 1 when in UnsafeFPMath mode in SelectionDAG::getNode()

Owen Anderson resistor at mac.com
Fri Sep 7 14:24:27 PDT 2012


Chandler,

We can't write a test case to exercise specifically this path, because it is not an observable change on any in-tree targets, since the DAG combiner also performs the same transform.  Observing the difference between the two requires specific interactions with target-specific DAG combine's.  The best we could do would be to write a test that will exercise whichever path happens to get run, but it will not break if this code gets broken.

That said, it's still worthwhile from a compile time perspective to aggressively prevent the creation of new SDNode's (with all their associated baggage) rather than leaving it up to the DAG combiner.  You'll notice that the code this patch touches already does the same thing for FADD and FSUB.

--Owen

On Sep 7, 2012, at 1:53 PM, Chandler Carruth <chandlerc at google.com> wrote:

> Test cases please.
> 
> 
> On Fri, Sep 7, 2012 at 4:50 PM, Michael Ilseman <milseman at apple.com> wrote:
> Attached is a patch to fold multiply by 0 or 1 when in UnsafeFPMath mode in SelectionDAG::getNode(). This is in getNode() for performance reasons, and to make sure it isn't foiled by other transforms (e.g. forming FMAs).
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120907/bdb18521/attachment.html>


More information about the llvm-commits mailing list