These should preserve the fast math flags on the initial fcmp.
Without this, the nodes may later be expanded to use an
unnecessary quieting operation.
Details
Diff Detail
Event Timeline
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
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
1091–1094 | I forgot about this problem. I don't understand why it was trying to strip these flags in the first place, but it will always do it |
I forgot about this problem. I don't understand why it was trying to strip these flags in the first place, but it will always do it