------- Comment #3 from mikael at gcc dot gnu dot org 2010-08-28 17:42 -------
Ouch!
We need some sort of lazy evaluation.
Like (pseudo-code)
bool scalar_ever_evaluated = false;
whatever_type scalar_value;
while(1)
{
/* loop handling stuff */
if (scalar_ever_evaluated)
{
scalar_value = <whatever complicated expression>;
scalar_ever_evaluated = true;
}
/* normal code using scalar_value */
}
We have to move back se->pre into se->expr so that it is not moved outside the
loop. Or move it outside the loop conditionally and conditionally add se->pre
inside the loop while evaluating the scalar.
BTW I thought there was already some where-specific code generation for scalar
values.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45425