[Bug tree-optimization/21090] New: VRP does not notice nonzero-ness from a PHI node

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Mon Apr 18 17:39:00 GMT 2005


Consider:

int g, h;

int
foo (int a)
{
  int *p;

  if (a)
    p = &g;
  else
    p = &h;

  if (p != 0)
    return 1;
  else
    return 0;
}

With -O2 -fno-dominator-opts, VRP does not optimize away the "if" statement.

This is because VRP does not run the propagator when it does not insert
any ASSERT_EXPR.

Even if I force it to run the propagator by forcing vrp_initialize to
return true, the meet function decides that the lattice value of p
at the second "if" statement is VARYING.

I guess we can teach the meet function to generate ~[0, 0] when we meet
&g and &h.

-- 
           Summary: VRP does not notice nonzero-ness from a PHI node
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org


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



More information about the Gcc-bugs mailing list