[Bug tree-optimization/79333] New: FRE/PRE do not fold calls not-in-place and do not allow folding to look at SSA defs during elimination

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 2 08:51:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79333

            Bug ID: 79333
           Summary: FRE/PRE do not fold calls not-in-place and do not
                    allow folding to look at SSA defs during elimination
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

This for example shows as not folding memory builtins or not doing any complex
match.pd replacements for gcc.dg/tree-ssa/pr71078-3.c when match.h provides
for example

extern __inline __attribute__ ((__always_inline__)) __attribute__
((__gnu_inline__)) double __attribute__ ((__nothrow__ , __leaf__)) fabs (double
__x) { return __builtin_fabs (__x); }

as opposed to just a prototype.  This results in

  <bb 2> [100.00%]:
  _1 = (double) f_3(D);
  _8 = ABS_EXPR <_1>;
  _2 = (double) f_3(D);
  t2_5 = _2 / _8;
  return t2_5;

which is not matched by the x / abs(x) -> copysign (1.0, x) pattern.  You'd
expect FRE1 to do the CSE (it does) and elimination folding of the stmt
to turn op the __builtin_copysign but that doesn't happen because the fold_stmt
done by elimination doesn't allow SSA name following.


More information about the Gcc-bugs mailing list