[InstCombine] try to forward-propagate some FMF to select
authorSanjay Patel <spatel@rotateright.com>
Sun, 11 Dec 2022 13:50:42 +0000 (08:50 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sun, 11 Dec 2022 13:58:42 +0000 (08:58 -0500)
commit0ee6bad6a6725c2913116a8fa7769b067c219f00
tree364f4f79f91cb12c51b2d5df9b7203ef709ccd1b
parentd15365522a7189fd0b937c2602a5ed0cebaaa4d5
[InstCombine] try to forward-propagate some FMF to select

This is intended to mitigate potential regressions that
would result from restricting this fold for NANs as
discussed in issue #59279.

Ideally, we could do this more generally because we have
known problems seeing/generating FMF on a select, but there
are likely many corner cases that need to verified.

For example, I thought this propagation would be valid
without looking at the condition value and for 'nsz' too,
but according to Alive2, it is not:
https://alive2.llvm.org/ce/z/AnG6As
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/fabs.ll
llvm/test/Transforms/InstCombine/fneg-fabs.ll