This is the mail archive of the gcc@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]

Strange missing tree constant propagation


Hi,

Consider this embarassingly trivial function:

void
foo (int a)
{
  while (a--) ;
}


Here is the .optimized tree dump that we produce for this test:

;; Function foo (foo)

Analyzing Edge Insertions.
foo (a)
{
  int D.1476;

<L3>:;

<L0>:;
  a = a - 1;
  D.1476 = -000000001;
  if (a != D.1476) goto <L0>; else goto <L2>;

<L2>:;
  return;

}

Why is D.1476 not being propagated?  IVOPTS introduces it,
but I don't see any reason why...

Also, why all the leading zeros?  Is there something special
about that constant?  The initial RTL gcc produces for the
assignment to D.1476 is also suboptimal:

;; D.1476 = -000000001
(insn 21 19 22 (set (reg:SI 64)
        (const_int -1 [0xffffffffffffffff])) -1 (nil)
    (nil))

(insn 22 21 0 (set (reg:SI 62 [ D.1476 ])
        (reg:SI 64)) -1 (nil)
    (nil))

Strange...  Does anyone know a reason for why this happens?

Gr.
Steven



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