SSA renaming scheme is dangerous
|
|
Bugzilla Link |
42 |
Created on |
Aug 04, 2004 17:19 |
Resolution |
FIXED |
Resolved on |
Aug 05, 2004 23:15 |
Version |
1.00beta |
OS |
All |
Architecture |
Sun |
Attachments |
ssabug.sac |
Extended Description
Multiple SSA transformations can lead to multiple declarations of variables due
to SSATransforms renaming scheme.
Take a look at the following example:
int[.], int[.] buggy( int[.] z)
{
unew = with (. <= iv <= .)
{
zsum = 2 * z[iv];
}
genarray ([1024], zsum);
unew = with ([0] <= iv <= [0])
modarray (unew, iv, unew[[1023]]);
vnew = with (. <= iv <= .)
{
zsum = 2 * z[iv];
}
genarray ([1024], zsum);
return (unew, vnew);
}
As the syntaxtree is converted in and out of SSA form during WLEnhancement
(activated via -khf), zsum in the second with-loop is renamed into zsum__SSA1.
After UndoSSATransform in WLEnhancment, zsum__SSA1 is not re-renamed into zsum.
Now, with-loop folding folds the first two with-loops, yielding a new with-loop
with two generators whose results are both names zsum. The subsequent call of
RestoreSSAOneFunction will rename the second result into zsum__SSA1 which
already exists!