[Bug optimization/14701] New: [tree-ssa] pure function optimization is not done until CSE.

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Wed Mar 24 02:17:00 GMT 2004


The second call to bar() is not removed until CSE pass (at RTL level).
This testcase was found while I was investigating those cases where CSE
simplifies conditional jumps.

/* Reduced from can_address_p() in alias.c.  */

extern int bar (int) __attribute__ ((__pure__));
extern void abort (void) __attribute__ ((__noreturn__));

void
foo (int t)
{
  if (bar (t))
    abort ();

  if (bar (t))
    abort ();
}

To give you where this thing comes from,
the original "if" statement before reduction looks like

  if (!(strchr ("<12ers", (__c)) != 0))
    tree_class_check_failed (...)

Here is the final tree.

foo (t)
{
  int T.1;
  int T.0;

<bb 0>:
  if (bar (t) != 0) goto <L0>; else goto <L1>;

<L0>:;
  abort ();

<L1>:;
  if (bar (t) != 0) goto <L2>; else goto <L3>;

<L2>:;
  abort ();

<L3>:;
  return;

}

-- 
           Summary: [tree-ssa] pure function optimization is not done until
                    CSE.
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14701



More information about the Gcc-bugs mailing list