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 middle-end/27986] [4.0/4.1/4.2 Regression] jump to middle of loop on entry with using old version of an variable



------- Comment #4 from amacleod at redhat dot com  2006-10-02 13:56 -------
This is not something out of ssa can resolve on its own.

given this sequence:
  # s_2 = PHI <s_5(0), s_9(1)>;
  # d_1 = PHI <d_6(0), d_10(1)>;
<L0>:;
  D.1287_8 = MEM[base: d_1];
  s_9 = s_2 + D.1287_8;          <<<---  s_2 and s_9 have different values
  d_10 = d_1 + 4B;
  if (s_9 < g_11) goto <L0>; else goto <L1>;

  # s_7 = PHI <s_2(1)>;          <<<--- original value of s_2 used here
<L1>:;
  *v_3 = s_7;

When s_9 is assigned s_2 + D.1287_8  , they have different values, so when s_2
is used in the PHI assigned to s_7, there is a stretch over which s_9 and s_2
are both live, and contain different values.

out of ssa cannot assign them to the same variable.

you are going to have a copy in the loop no matter what you do... 

right now we get:
<bb 2>:
  s = *(v + 4B);

<L0>:;
  s.31 = s + MEM[base: d]{*d};
  d = d + 4B;
  if (s.31 < g) goto <L6>; else goto <L1>;

<L6>:;
  s = s.31;
  goto <bb 3> (<L0>);

<L1>:;
  *v = s;
  return;


the other alternative would be:
<L0>:;
  s.31 = s
  s = s + MEM[base: d]{*d};
  d = d + 4B;
  if (s < g) goto <L6>; else goto <L1>;

<L6>:;
  goto <bb 3> (<L0>);

<L1>:;
  *v = s.31;


Is that any better? It looks pretty much the same to me.  It might help on a 2
address machine where you need r1 = r1 + exp, but that about it.


so Im not sure I understand what you want out of ssa to do with the code here.


-- 


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


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