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

--- Comment #4 from davidxl <xinliangli at gmail dot com> 2010-11-04 00:55:35 
UTC ---

Another case that needs to be handled (none of the compiler tested handle it)

For ifcvt to happen, control flow needs to be simplified (for case of
if-then-else if ..) this is possible when the conditions tested are exclusive.
Some cost heuristics needs to be developed, as the transformation makes the
second cmp to be done unconditionally. In the following example, ifcvt does not
happen for function foo, but for foo2.

int  foo (int i,  int j, int t)
{
   int r1 = 0, r2 = 0;
   if (i > j)
   {
     r1 = t + 1;
   }
   else if (i == j)
   {
      r2 = t + 3;
   }

   return r1+r2;
}

int  foo2 (int i,  int j, int t)
{
   int r1 = 0, r2 = 0;
   if (i > j)
   {
     r1 = t + 1;
   }

   if (i == j)
   {
      r2 = t + 3;
   }

   return r1+r2;
}

Reply via email to