[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 00:33:54 PDT 2024


andykaylor wrote:

> Yeah, the conditional operator doesn't do any floating-path math itself. If the first operand is a floating-point expression, we should always be modeling that with a float-to-boolean conversion, and the flags should go there (if they're necessary — I didn't think comparisons were flag-sensitive).

Any instruction that returns a floating-point value can have fast-math flags attached to it, and because we need to check the fast-math flags on input operands, the select instruction generated by the conditional operator needs the flags set when fast-math is enabled. That's happening in the general case, but it isn't currently being modified correctly in the presence of pragmas.

https://godbolt.org/z/91zPx5ha4

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


More information about the cfe-commits mailing list