https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125571
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #13)
> (In reply to Drea Pinski from comment #12)
> > (In reply to Drea Pinski from comment #11)
> > > Created attachment 64612 [details]
> > > hack to gimplifier to gimplify COND_EXPR as COND_EXPR for -O0/-O1
> > >
> > > This hacks up the gimplifier and improves comment #9 compile time a lot.
> > > Both at -O0 and -O1.
> >
> > Seems to helps the original testcase too.
> > 60s at -O1
> > 12s at -O0
> > (this is with -fno-checking but still with checking).
>
> tree PTA : 18.63 ( 33%) 6847k ( 1%)
> tree SSA rewrite : 0.22 ( 0%) 18M ( 3%)
But it's a hack. The following hack also helps exactly this testcase:
diff --git a/gcc/bitmap.cc b/gcc/bitmap.cc
index 91c1019cb34..90c64fbe4bb 100644
--- a/gcc/bitmap.cc
+++ b/gcc/bitmap.cc
@@ -404,8 +404,11 @@ bitmap_list_find_element (bitmap head, unsigned int indx)
/* `element' is the nearest to the one we want. If it's not the one we
want, the one we want doesn't exist. */
gcc_checking_assert (element != NULL);
- head->current = element;
- head->indx = element->indx;
+ if (element != head->first)
+ {
+ head->current = element;
+ head->indx = element->indx;
+ }
if (element->indx != indx)
element = 0;
return element;