This tries to tackle https://bugs.llvm.org/show_bug.cgi?id=52259
Intersect the FMF of the select's operands. If the operand is not a FPMathOperator e.g. an argument then try to take the flag from the function's attributes.
mnadeem on Oct 21 2021, 5:06 PM.Authored by
Using function attributes is what we're trying to get away from by having instruction-level FMF, so this would have to be clearly labeled as a hack or temporary fix.
That said, I don't think anyone is working on a real fix that would apply FMF to all FP values. That was a comment I made in:
I think that's also the root cause for the failure in the motivating bug/test for this patch:
This fabs example is worth posting to llvm-dev for wider discussion. I think we do need to do something to optimize that code, but there's no clear fix that I know of.