public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bschmidt@redhat.com>
To: Kyrill Tkachov <kyrylo.tkachov@arm.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Jeff Law <law@redhat.com>
Subject: Re: [PATCH][RTL-ree] PR rtl-optimization/68194: Restrict copy instruction in presence of conditional moves
Date: Mon, 16 Nov 2015 18:41:00 -0000	[thread overview]
Message-ID: <564A2339.3030308@redhat.com> (raw)
In-Reply-To: <5649E333.4090904@arm.com>

On 11/16/2015 03:07 PM, Kyrill Tkachov wrote:

> I've explained in the comments in the patch what's going on but the
> short version is trying to change the destination of a defining insn
> that feeds into an extend insn is not valid if the defining insn
> doesn't feed directly into the extend insn. In the ree pass the only
> way this can happen is if there is an intermediate conditional move
> that the pass tries to handle in a special way. An equivalent fix
> would have been to check on that path (when copy_needed in
> combine_reaching_defs is true) that the state->copies_list vector
> (that contains the conditional move insns feeding into the extend
> insn) is empty.

I ran this through gdb, and I think I see what's going on. For 
reference, here's a comment from the source:

       /* Considering transformation of
          (set (reg1) (expression))
          ...
          (set (reg2) (any_extend (reg1)))

          into

          (set (reg2) (any_extend (expression)))
          (set (reg1) (reg2))
          ...  */

I was thinking that another possible fix would be to also check 
!reg_used_between_p for reg1 to ensure it's not used. I'm thinking this 
might be a little clearer - what is your opinion?

The added comment could lead to some confusion since it's placed in 
front of an existing if statement that also tests a different condition. 
Also, if we go with your fix,

> +	  || !reg_overlap_mentioned_p (tmp_reg, SET_SRC (PATTERN (cand->insn))))

Shouldn't this really be !rtx_equal_p?


Bernd

  reply	other threads:[~2015-11-16 18:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 14:08 Kyrill Tkachov
2015-11-16 18:41 ` Bernd Schmidt [this message]
2015-11-17  9:08   ` Kyrill Tkachov
2015-11-17  9:49     ` Kyrill Tkachov
2015-11-17 10:17       ` Kyrill Tkachov
2015-11-17 12:10     ` Bernd Schmidt
2015-11-17 13:03       ` Kyrill Tkachov
2015-11-17 23:11         ` Bernd Schmidt
2015-11-18  9:11           ` Kyrill Tkachov
2015-11-19 10:28             ` Kyrill Tkachov
2015-11-20  1:41               ` Bernd Schmidt
2015-11-20  9:16                 ` Kyrill Tkachov
2015-11-23 15:12                 ` Kyrill Tkachov
2015-11-24 13:33                   ` Kyrill Tkachov
2015-11-24 13:42                     ` Bernd Schmidt

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=564A2339.3030308@redhat.com \
    --to=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=law@redhat.com \
    /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).