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/21086] New: VRP does not extract a value from a comparison expression.


Consider:


int
foo (int *p)
{
  int a = *p;
  int b = p != 0;

  *p = b;

  if (b)
    return a;
  else
    return 0;
}

Here is what I get with -O2 -fno-tree-dominator-opts
foo (p)
{
  int b;
  int a;
  int D.1235;

<bb 0>:
  a_3 = *p_2;
  p_7 = p_2;
  b_4 = p_7 != 0B;
  *p_7 = b_4;
  p_10 = p_7;
  if (b_4 != 0) goto <L2>; else goto <L1>;

<L1>:;
  a_6 = 0;

  # a_1 = PHI <a_3(0), a_6(1)>;
<L2>:;
  return a_1;

}

Note that the "if" statement is not optimized away.

This is because VRP does not extract a value from a comparison expression.

-- 
           Summary: VRP does not extract a value from a comparison
                    expression.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: kazu at cs dot umass dot edu
        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=21086


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