[Bug tree-optimization/14741] missing transformations lead to poorly optimized code

rakdver at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jan 18 11:35:00 GMT 2005


------- Additional Comments From rakdver at gcc dot gnu dot org  2005-01-18 11:35 -------
The relevant part of the code looks like this:

do
{
  k_2 = phi(...,k_1);

  k_1 = k_2 + 1
} while (k_2 != endvalue)

/* k_1 unused outside of the loop */

Ivopts decide that it makes more sense to perform increment after the comparison:

while (1)
{
  k_2 = phi(...,k_1);

  if (k_2 == endvalue)
    break;
  k_1 = k_2 + 1
}

Which sort of is true; number of executions of the increment is decreased by one
per loop execution, and also we need one less register, since k_1 and k_2 can be
coalesced now.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14741



More information about the Gcc-bugs mailing list