https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85730

--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> Not sure whether targets should have a special-case pattern here or whether
> that's for combine to un-canonicalize it?

Is the shift defined anywhere as the canonical form?

We already get a shift at expand time, for e.g.

  long f(long a) { return a+a; }

I cannot find the code that does this easily, it is quite a maze :-)  There
is code for changing a multiplication by a power of two (which we have in
Gimple already) into a shift, but then there should be something changing
the addition with self into a multiplication, and I cannot find that either.

Combine should absolutely not un-canonicalise it.  It could try multiple
ways of writing this, but is it important enough to allow this, to justify
the (potential) combinatorial explosion this causes?

If we want combine to try many ways of writing something (not a bad idea an
sich btw, I support it), we need ways to battle such an explosion, and esp.
to make the amount of garbage RTL created manageable (it is not, currently).
Currently combine has to create GC'ed RTL to recog() it.  Maybe we could
have some "GC stuff created between points X and Y" interface?

Reply via email to