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/21694] New: Missed forwprop opportunity into COND_EXPR


Consider:

enum tree_code {
  AAA,
  BBB,
  CCC
};

struct tree_common {
  enum tree_code code : 8;
};

int
foo (struct tree_common *p)
{
  enum tree_code code = p->code;
  if (code == 0)
    return p->code;
  return 123;
}

After forwprop, the code leading up to the COND_EXPR looks like so:

  D.1240_3 = p_2->code;
  code_4 = (tree_code) D.1240_3;
  if (code_4 == 0) goto <L0>; else goto <L2>;

After DOM, the code leading up to the COND_EXPR looks like so:

  D.1240_3 = p_2->code;
  code_4 = (tree_code) D.1240_3;
  if (D.1240_3 == 0) goto <L0>; else goto <L2>;

Note that the COND_EXPR now uses D.1240_3.

-- 
           Summary: Missed forwprop opportunity into COND_EXPR
           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: gcc-bugs at gcc dot gnu dot org


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


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