https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71078
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 9 Aug 2016, thopre01 at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71078 > > Thomas Preud'homme <thopre01 at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|RESOLVED |REOPENED > CC| |thopre01 at gcc dot gnu.org > Resolution|FIXED |--- > > --- Comment #10 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> --- > Hi, > > The following tests are still failing for me on arm-none-eabi targets: > > FAIL: gcc.dg/tree-ssa/pr71078-1.c scan-tree-dump forwprop1 > "__builtin_copysignf" > FAIL: gcc.dg/tree-ssa/pr71078-1-double.c scan-tree-dump forwprop1 > "__builtin_copysign" > FAIL: gcc.dg/tree-ssa/pr71078-2.c scan-tree-dump forwprop1 > "__builtin_copysignf" > FAIL: gcc.dg/tree-ssa/pr71078-2-double.c scan-tree-dump forwprop1 > "__builtin_copysign" > FAIL: gcc.dg/tree-ssa/pr71078-3.c scan-tree-dump forwprop1 > "__builtin_copysign" > > > My investigation for pr71078-1.c led me to the first if block in > gimple_fold_stmt_to_constant_1. if gimple_simplify returns true as it does > when > matching the x / abs(x) -> copysign (1.0, x) match.pd pattern. However > gimple_simplified_result_is_gimple_val is false because copysign is a builtin > and mprts_hook is NULL at this point. > > The switch that follows goes in GIMPLE_BINARY_RHS case to return NULL_TREE > because it does not recognize an operation it knows about. > > I suspect the same happens for the other testcases. forwprop uses fold_stmt, not gimple_fold_stmt_to_constant. The relevant condition is in replace_stmt_with_simplification / maybe_push_res_to_seq: /* Find the function we want to call. */ tree decl = builtin_decl_implicit (as_builtin_fn (fn)); if (!decl) return NULL;