I suppose most of the calls to tree_expr_nonnegative_p that apply to floats in match.pd and tree-ssa-math-opts.cc are guarded by !HONOR_NANS || tree_expr_nonnegative_p. Still feels kinda delicate...
Aldy On Sun, Nov 13, 2022 at 4:56 PM Aldy Hernandez <al...@redhat.com> wrote: > > Based on discussions in the last few weeks, aren't most of the cases in > tree_call_nonnegative_warnv_p() wrong when honoring NANS? > > For example: > CASE_CFN_ACOS: > CASE_CFN_ACOS_FN: > CASE_CFN_ACOSH: > CASE_CFN_ACOSH_FN: > ... > ... > /* Always true. */ > return true; > > But are we guaranteed a +NAN for any NAN input? I thought we were only > guaranteed the NAN sign for abs, copysign, assignment, etc? Similarly > for most other cases in this function. > > Hmmm. I really think a good chunk of fold-const.cc should live in > range-ops. It seems we're duplicating a lot of functionality. > Similarly to bit-CCP as I've mentioned. > > Aldy