[Bug optimization/14753] New: [tree-ssa] some missed forward propagation opportunities

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Sat Mar 27 16:13:00 GMT 2004


void bar (void);

void
foo (unsigned int a)
{
  /* This one is equivalent to a >= (3 << 2).  */
  if ((a >> 2) >= 3)
    bar ();
}

void
baz (unsigned int a)
{
  /* This one is equivalent to a <= 7.  */
  if ((a & ~7) == 0)
    bar ();
}

The last tree in SSA form looks like:

;; Function foo (foo)

foo (a)
{
  unsigned int T.0;

<bb 0>:
  T.0_2 = a_1 >> 2;
  if (T.0_2 > 2) goto <L0>; else goto <L1>;

<L0>:;
  bar () [tail call];

<L1>:;
  return;

}



;; Function baz (baz)

baz (a)
{
  unsigned int T.1;

<bb 0>:
  T.1_2 = a_1 & 0fffffff8;
  if (T.1_2 == 0) goto <L0>; else goto <L1>;

<L0>:;
  bar () [tail call];

<L1>:;
  return;

}

Note that in baz(), if "a" were of int, we would first have to create
a temporary variable holding unsigned version of "a" before we can
use an ordered comparison.

-- 
           Summary: [tree-ssa] some missed forward propagation opportunities
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          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=14753



More information about the Gcc-bugs mailing list