// consider this code where boolean how is invariant in the loop.
for ( int i=0; i<n; i++ )
   {
   if ( how )
      {
      a( i );
      }
   else
      {
      b( i );
      }
   }
// A clever compiler might convert that to something like this
// to avoid testing how every time inside the loop.

if ( how )
   {
   for ( int i=0; i<n; i++ )
      {
      a( i );
      }
   }
else
   {
   for ( int i=0; i<n; i++ )
      {
      b( i );
      }
   }