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

Yashwant Singh via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 00:33:16 PDT 2024


yashssh 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.)

That won't solve the problem here, `instcombine` still won't deduce the fast flags correctly on the select instruction as one of the operand is coming from function arguments(IR on right https://godbolt.org/z/P1Pe4vesj ).

Possible solutions discussed in the thread
1) Introduce fast flags on function parameters (long work)
2) Use function attributes to assume it's safe to do such foldings (easy workaround but not the best as pointed out by reviewers)

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


More information about the llvm-commits mailing list