This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ipa/60315] [4.8/4.9 Regression] template constructor switch optimization


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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note that we seem to fail to update BB predicates for switch stmts.

    size:0.000000, time:0.000000, predicate:(true)
    size:3.000000, time:2.000000, predicate:(not inlined)
    size:2.000000, time:2.000000, predicate:(op1 changed)
    size:8.000000, time:3.200000, predicate:(op1 changed) && (op1 != 2)

I cannot interpret the size 2 case (what is "op1 changed"?), but in that
case we actually shrink compared to not inlining.  As && op1 != 2 makes
it more restrictive it's odd that that increases the metrics.

As inliner I would inline all the (op1 changed) cases, thus in the above
case op1 == 2.

We seem to inline fully until hitting the case where only recursive edges
are left.  Even for only two switch cases we inline 5(!) calls into Test<E1>.

Ah, the switch isn't handled by the predicates because

 BB 3 predicate:(op1 != 1)
  s.1_4 = (int) s_2(D);
                freq:0.80 size:  0 time:  0
  switch (s.1_4) <default: <L8>, case 0: <L1>, case 1: <L2>>

it is not unmodified_parm_or_parm_agg_item ().  The parameter is unsigned int
so the cast is not value-preserving.

Of course in general we can't rely on "proper" predicates so we need to avoid
exploding reliably.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]