This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]