[PATCH] D121243: [InstCombine] Preserve FMF in foldLogicOfFCmps.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 13:40:03 PST 2022


spatel added a comment.

In D121243#3368116 <https://reviews.llvm.org/D121243#3368116>, @lebedev.ri wrote:

> https://llvm.org/docs/LangRef.html#id306 says:
>
>> Any set of fast-math flags are legal on an fcmp instruction, but the only flags that have any effect on its semantics are those that allow assumptions to be made about the values of input arguments; namely nnan, ninf, and reassoc. See Fast-Math Flags for more information.
>
> So please add tests with `reassoc`?

"fast" implicitly covers that, so more tests with individual flags wouldn't add much IMO.

For this transform only -- because we are guaranteed to repeat the values in each fcmp -- I was expecting that we could 'or' the relevant flags. But there's a surprising corner case with `true` and `false` fcmp predicates according to Alive2:
https://alive2.llvm.org/ce/z/Nffn3L

The behavior -- blocking poison via predicate? -- does not seem to be documented in the LangRef.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121243/new/

https://reviews.llvm.org/D121243



More information about the llvm-commits mailing list