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]

Help in understanding ccp propagator


Hello,

I will greatly appreciate any suggestions regarding the following
problem I have with the ccp propagator. I am testing the new store
ccp patch which propagates constants by walking the virtual use-def
chain (http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00055.html) and I
encountered the following problem while testing tree_join.cc file which
is under libstdc++-v3 testsuite:

The final propagator replaces the right operand (D.65705_98) in the
following if condition with a constant zero which causes the program to be
aborted as i0_62 is not always zero:

  # i0_62 = PHI <i0_5(29), 0(3)>
<L139>:;
  D.61410.first = i0_62;
...
   D.65705_98 = D.61410.first;
-  if (D.65704_96 >= 0)
+  if (D.65704_96 >= D.65705_98)
     goto <bb 11>;
   else
     goto <bb 14>;

Tracing the execution of the propagator it seems that the if statement
is first been propogated with zero after simulating the execution; but not
updated after the lattice value of the variables it depends on changed.

Here is the scenario of the propagator:

1) D.61410.first is been updated to zero:

19921 Visiting PHI node: i0_62 = PHI <i0_5(29), 0(3)>
19922     Argument #0 (29 -> 4 not executable)
19923
19924     Argument #1 (3 -> 4 executable)
19925         0       Value: CONSTANT 0
19926
19927     PHI node value: CONSTANT 0
19928
19929 Lattice value changed to CONSTANT 0.  Adding SSA edges to worklist.
19930
19931 Visiting statement:
19932 D.61410.first = i0_62;
19933
19934 Lattice value changed to CONSTANT 0.  Adding SSA edges to worklist.
19935

2) D.65705_98 is been upadted to zero:

20235 Visiting statement:
20236 D.65705_98 = D.61410.first;
20237
20238 Lattice value changed to CONSTANT 0.  Adding SSA edges to worklist.
20239
20240 Visiting statement:
20241 if (D.65704_96 >= D.65705_98)
....

3) D.61410.first latice value changed to VARYING.

20360 Simulating statement (from ssa_edges): D.61410.first = i0_62;
20361
20362 Visiting statement:
20363 D.61410.first = i0_62;
20364
20365 Lattice value changed to VARYING.  Adding SSA edges to worklist.

4) if D.65705_98 is been replaced to zero:

25422 Substituing values and folding statements
25423
25424 Folded statement Folded statement: if (D.65704_96 >= D.65705_98)
25425             into: if (D.65704_96 >= 0)

I am not sure why after the lattice value of D.61410.first has been
changed to VARYING D.65705_98 and the if statement is not been updated
as well.

Thanks,
Revital


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