https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 15 Nov 2023, juzhe.zhong at rivai dot ai wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088 > > --- Comment #19 from JuzheZhong <juzhe.zhong at rivai dot ai> --- > I have added: > > + if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (PHI_RESULT (phi))) For TYPE_OVERFLOW_UNDEFINED you have to convert the ops to unsigned to avoid spurious undefined overflow. > + && !(FLOAT_TYPE_P (TREE_TYPE (PHI_RESULT (phi))) > + && !HONOR_SIGNED_ZEROS (TREE_TYPE (PHI_RESULT (phi))) > + && !HONOR_SIGN_DEPENDENT_ROUNDING (TREE_TYPE (PHI_RESULT > (phi))) > + && !HONOR_NANS (TREE_TYPE (PHI_RESULT (phi))))) You should check flag_associative_math which covers one half and !flag_trapping_math which covers spurious FP exceptions. > + return false; > > for floating-point. I failed to see which situation will cause FP exceptions ? Ops with NaN cause INVALID, but there's also INEXACT which can be set differently after re-association.