No ifcvt during ce1 pass (fails i386/ssefp-2.c)

Uros Bizjak ubizjak@gmail.com
Thu Mar 15 08:04:00 GMT 2007


On 3/15/07, Alexandre Oliva <aoliva@redhat.com> wrote:

> > Recent committed patch breaks i386ssefp-2.c testcase, where maxsd is
> > not generated anymore.
>
> FWIW, I saw it both before and after the patch for PR 31127.  I've
> just tried reverting PR 30643 as well, but the problem remains.  So
> it's unrelated.
>
> Have you been able to narrow it down to any other patch?

Yes, bisection found that steven's patch is guilty  as charged ;>

--- gcc/ChangeLog       (revision 122856)
+++ gcc/ChangeLog       (revision 122858)
@@ -1,3 +1,12 @@
+2007-03-12  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * tree-pass.h (pass_into_cfg_layout_mode,
+       pass_outof_cfg_layout_mode): Declare.
+       * cfglayout.c (into_cfg_layout_mode, outof_cfg_layout_mode,
+       pass_into_cfg_layout_mode, pass_outof_cfg_layout_mode): New.
+       * passes.c (pass_into_cfg_layout_mode): Schedule before jump2.
+       (pass_outof_cfg_layout_mode): Schedule after pass_rtl_ifcvt.
+

Steven, I have been looking into this failure a bit, and found that
ifcvt during first pass is rejected in find_if_block(), at:

  /* The THEN block of an IF-THEN combo must have exactly one predecessor,
     other than any || blocks which jump to the THEN block.  */
  if ((EDGE_COUNT (then_bb->preds) - ce_info->num_or_or_blocks) != 1)
    return FALSE;

For some reason, EDGE_COUNT (then_bb->preds) returns 2 (where
ce_info->n_o_o_blocks = 0). Strangely, bb3 ("else" block that fails)
has:

Basic block 3 , prev 2, next 4, loop_depth 0, count 0, freq 4600, maybe hot.
Predecessors:  2 [46.0%]
Successors:  4 [100.0%]  (fallthru)

The testcase is:

double x;
q()
{
  x=x<5?5:x;
}

compile this with -O2 -msse2 -mfpmath=sse, and this testcase should
compile to maxsd.

Uros.



More information about the Gcc mailing list