public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,  gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix mult expansion ICE (PR middle-end/82875)
Date: Wed, 22 Nov 2017 09:55:00 -0000	[thread overview]
Message-ID: <87wp2izlxh.fsf@linaro.org> (raw)
In-Reply-To: <20171122091718.GH14653@tucnak> (Jakub Jelinek's message of "Wed,	22 Nov 2017 10:17:18 +0100")

Really sorry for missing this PR -- don't know that happened :-(

Jakub Jelinek <jakub@redhat.com> writes:
> On these two testcases, we end up expanding MULT_EXPR where both arguments
> end up being VOIDmode.  For smul_optab that isn't a problem, we have
> the mode next to it, but in some cases we want to use {u,s}mul_widen_optab
> which is a conversion optab which needs two modes expand_binop is called
> just with one mode, the result mode, so the other mode is guessed from
> the operands and if both are VOIDmode, then a fallback is chosen to use
> return mode.  The new find_widening* changes ICE on that though, previously
> we'd just do something.

What do you think about passing the modes of the operands down to
expand_binop too, a bit like simplify_unary_operation?  We could have
an overloaded wrapper with the current interface to avoid updating every
caller.  That at least would cut down on some of the guessing that
the function currently does.

I can have a go at that if it sounds OK, but the posted patch LGTM too
as an alternative.

> In any case, I think we need to make sure this doesn't happen while we
> still know both modes for the {u,s}mul_widen_optab.  Bootstrapped/regtested
> on x86_64-linux and i686-linux, ok for trunk?
>
> Perhaps additionally we could have somewhere a case which for both arguments
> constant (unlikely case, as the gimple optimizers should usually optimize
> that out) and selected optabs for which we know the corresponding RTL code
> we could use simplify_const_binary_operation and see if it optimizes into a
> constant and just return that.  Though, these functions are large and it
> is still possible a constant could be uncovered later, so I think we want
> this patch even if we do something like that.

(FWIW, I agree we need this either way, although folding sounds good too.)

Thanks,
Richard

  parent reply	other threads:[~2017-11-22  9:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  9:26 Jakub Jelinek
2017-11-22  9:43 ` Richard Biener
2017-11-22 10:09   ` Jakub Jelinek
2017-11-22 10:16     ` Richard Biener
2017-11-22 13:34       ` Richard Sandiford
2017-11-22 13:50         ` Jakub Jelinek
2017-11-22  9:55 ` Richard Sandiford [this message]
2017-12-04  7:01 ` [testsuite, committed] Require effective target alloca for pr82875.c Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wp2izlxh.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).