[PATCH] D51646: DAG: Preserve FMF when creating fminnum/fmaxnum

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 11:52:34 PDT 2018


arsenm added a comment.

In https://reviews.llvm.org/D51646#1224799, @spatel wrote:

> Is this just about 'nnan' behavior? If so, can we just use/expand the existing SelectPatternNaNBehavior?
>
> IOW, why is 'nsz' relevant?
>  Eli raised a question about 'nsz' on fcmp:
>  https://bugs.llvm.org/show_bug.cgi?id=38086
>
> Does the motivation for this patch make any of the proposed fixes more or less appealing?
>
> Regardless to any answers to the above, I think we should split this into separate IR/DAG patches with tests for each side.


The combine to form minnum/maxnum from cmp/select depends on nsz. The DAG version of the combine checks the global NSZ flag, but I think the direct-from-ir version  is broken. I've never really liked the matching here in SelectionDAGBuilder, but haven't looked into what regresses if I try just ripping out the IR matching.

There's also another bug from doing this I've noticed, where the dead nodes are left which breaks hasOneUse optimizations


https://reviews.llvm.org/D51646





More information about the llvm-commits mailing list