On Sun, Oct 23, 2011 at 10:56 AM, Eric Botcazou <ebotca...@adacore.com> wrote: > Hi, > > the comment of the function reads: > > /* Given a tree comparison code, return the code that is the logical inverse > of the given code. It is not safe to do this for floating-point > comparisons, except for NE_EXPR and EQ_EXPR, so we receive a machine mode > as well: if reversing the comparison is unsafe, return ERROR_MARK. */ > > but the function starts with: > > if (honor_nans && flag_trapping_math) > return ERROR_MARK;
Do you have an idea why we test flag_trapping_math here? > so, for example, it refuses to fold !(x == y) to x != y for FP, which is > valid. > > Fixed by letting EQ_EXPR and NE_EXPR go through. This makes tree-opt/44683 > regress though, but it's clear that the original fix only papered over the > problem, as you can't infer a simple equivalence from a condition when you can > have signed zeros around; so the patch also includes the proper fix. > > Tested on x86_64-suse-linux, OK for mainline? Ok. Thanks, Richard. > > 2011-10-23 Eric Botcazou <ebotca...@adacore.com> > > * fold-const.c (invert_tree_comparison): Always invert EQ_EXPR/NE_EXPR. > > PR tree-optimization/44683 > * tree-ssa-dom.c (record_edge_info): Record simple equivalences only if > we can be sure that there are no signed zeros involved. > > > -- > Eric Botcazou >