constant propagation issue
|
|
Bugzilla Link |
746 |
Created on |
Sep 17, 2010 07:27 |
Resolution |
FIXED |
Resolved on |
Oct 05, 2010 13:33 |
Version |
svn |
OS |
All |
Architecture |
All |
Extended Description
Our current optimisation cycle ( rev 17026) triggers
some rather obscure non-intentional constant propagation.
Look at the following code:
int main()
{
a = with {
} : genarray([200], 42);
iv = [22];
if( id( true) ) {
sum = _sel_VxA_( iv, a);
} else {
sum = 0;
}
return( sum);
}
This is compiled rather straight-forwardly.
Now, let us replace
sum = _sel_VxA_( iv, a);
by
jv = iv;
sum = _sel_VxA_( jv, a);
.
One would expect no change, right?
WRONG! What happens is that our constant folder
"computes" jv and, thus propagates [22] into
the conditional.
Although this, in this particular case, is what we want,
it may, in general, lead to unexpected constant propagations.
How to fix this properly is not obvious to me.