[llvm] [InstCombine] Fold more 'fcmp' 'select' instrs idioms into 'fabs' (PR #83381)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 00:36:02 PDT 2024


sushgokh wrote:

>Is there anything preventing us from allowing FMF on loads? Or at least the nnan, ninf and nsz flags? (The others don't make much sense.)

Current patch is trying to deduce flags on the instructions from the fast-math attributes on the function and this approach is pretty similar to how clang might be using the cmd-line flags for deducing the instruction level flags.

If we want to deduce flags on loads, for this specific case, we need
1. Fast-math attributes on the function args which might not always be possible especially if `x` is local/global var
2. Have some data flow analysis to propagate those flags.
Correct me if wrong.

If only inlining the issue with using function level attributes, I think that needs to be handled separately. 

https://github.com/llvm/llvm-project/pull/83381


More information about the llvm-commits mailing list