public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/51244] [SH] Inefficient conditional branch and code around T bit
Date: Sat, 20 Jul 2013 14:38:00 -0000	[thread overview]
Message-ID: <bug-51244-4-uKWATcm7kJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51244-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #60 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Laurent Aflonsi from comment #59)
> I have a functional regression due to this improvement when we are compiling
> the enclosed example in -O2.
>  $ sh-superh-elf-gcc -O2 pr51244-20-main.c pr51244-20.c
>  $ sh-superh-elf-run a.out
>  FAIL
> 
> Thus, the code is transformed from :
>   _get_request:
> 	mov.l	@(12,r4),r1
> 	tst	r1,r1
> 	bt	.L2
> 	mov.l	@(4,r4),r2
> 	tst	r2,r2
> 	mov	#-1,r2
>  	negc	r2,r2
>   .L3:
> 	tst	r2,r2
> 	bt/s	.L11
> 	mov	#-100,r0
>         mov	#1,r2
>         [...]
> 
> to : 
>   _get_request:
> 	mov.l	@(12,r4),r1
> 	tst	r1,r1
> 	bt	.L2
> 	mov.l	@(4,r4),r2
> 	tst	r2,r2
> 	mov	#-1,r2
> 	negc	r2,r2
>   .L3:
> 	bf/s	.L11
> 	mov	#-100,r0
>         mov	#1,r2
>         [...]
> 
> With the inputs encoded in the main function, we are supposed to follow the
> simpliest flow (no jump), but when this optimization is enabled, we are
> jumping to L11 to to the bt -> bf transfrmation.

The idea was that sequences such as
  tst r2,r2
  mov #-1,r2
  negc r2,r2
  tst r2,r2
  bt  ...

should be folded to
  tst r2,r2
  bt  ...

... if r2 is dead afterwards (which it seems to be).  I guess I missed to
handle some cases where the tested register is in a loop or can be reached by
some other basic block.  I'll check out the details.
>From gcc-bugs-return-426410-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jul 20 16:17:32 2013
Return-Path: <gcc-bugs-return-426410-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32147 invoked by alias); 20 Jul 2013 16:17:31 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29879 invoked by uid 48); 20 Jul 2013 16:15:28 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/57940] [PATCH] Rerun df_analyze after delete_unmarked_insns during DCE
Date: Sat, 20 Jul 2013 16:17:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-57940-4-vw01eVc78c@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57940-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57940-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg00917.txt.bz2
Content-length: 945

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW940

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-07-20
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> If delete_unmarked_insns deletes some insn, DF state might be
> out of date, and, regs_ever_live might contain unused registers till the end.

I presume this occurs after reload?

> Fixed by forcing regs_ever_live update and rerunning df_analyze () at
> fini_dce().

No, calling df_compute_regs_ever_live (true) is incorrect after reload, see the
comment in rest_of_handle_df_initialize.


  parent reply	other threads:[~2013-07-20 14:38 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-20 20:29 [Bug target/51244] New: SH Target: Inefficient conditional branch oleg.endo@t-online.de
2011-11-22 23:36 ` [Bug target/51244] " kkojima at gcc dot gnu.org
2011-12-27 22:03 ` oleg.endo@t-online.de
2011-12-27 23:17 ` oleg.endo@t-online.de
2011-12-28  0:42 ` oleg.endo@t-online.de
2011-12-28  4:57 ` oleg.endo@t-online.de
2011-12-28 16:07 ` oleg.endo@t-online.de
2011-12-28 22:30 ` kkojima at gcc dot gnu.org
2011-12-30 22:18 ` oleg.endo@t-online.de
2012-02-26 23:36 ` olegendo at gcc dot gnu.org
2012-03-02 21:57 ` olegendo at gcc dot gnu.org
2012-03-03 12:32 ` olegendo at gcc dot gnu.org
2012-03-04 17:25 ` olegendo at gcc dot gnu.org
2012-03-05 23:13 ` olegendo at gcc dot gnu.org
2012-03-05 23:38 ` olegendo at gcc dot gnu.org
2012-03-06  8:28 ` olegendo at gcc dot gnu.org
2012-03-06  8:50 ` kkojima at gcc dot gnu.org
2012-03-06  9:48 ` olegendo at gcc dot gnu.org
2012-03-06 10:36 ` kkojima at gcc dot gnu.org
2012-03-06 10:38 ` kkojima at gcc dot gnu.org
2012-03-06 10:39 ` kkojima at gcc dot gnu.org
2012-03-06 10:40 ` kkojima at gcc dot gnu.org
2012-03-06 11:30 ` olegendo at gcc dot gnu.org
2012-03-06 23:43 ` olegendo at gcc dot gnu.org
2012-03-08  1:26 ` olegendo at gcc dot gnu.org
2012-03-08 11:12 ` kkojima at gcc dot gnu.org
2012-03-08 11:15 ` kkojima at gcc dot gnu.org
2012-03-08 11:17 ` kkojima at gcc dot gnu.org
2012-03-09  0:27 ` olegendo at gcc dot gnu.org
2012-03-09  1:45 ` kkojima at gcc dot gnu.org
2012-03-09  8:41 ` kkojima at gcc dot gnu.org
2012-03-09 10:02 ` olegendo at gcc dot gnu.org
2012-03-09 10:37 ` kkojima at gcc dot gnu.org
2012-03-11 13:18 ` olegendo at gcc dot gnu.org
2012-03-15  8:11 ` kkojima at gcc dot gnu.org
2012-03-20  1:46 ` olegendo at gcc dot gnu.org
2012-03-20  2:33 ` kkojima at gcc dot gnu.org
2012-03-20 20:41 ` olegendo at gcc dot gnu.org
2012-05-07 20:53 ` olegendo at gcc dot gnu.org
2012-05-08 21:43 ` olegendo at gcc dot gnu.org
2012-06-30 12:01 ` olegendo at gcc dot gnu.org
2012-07-02 19:24 ` olegendo at gcc dot gnu.org
2012-07-08 15:03 ` olegendo at gcc dot gnu.org
2012-07-23 22:58 ` olegendo at gcc dot gnu.org
2012-07-23 23:29 ` olegendo at gcc dot gnu.org
2012-07-26  0:20 ` olegendo at gcc dot gnu.org
2012-07-30  6:46 ` olegendo at gcc dot gnu.org
2012-08-09 15:55 ` olegendo at gcc dot gnu.org
2012-08-12 22:47 ` olegendo at gcc dot gnu.org
2012-08-20 20:51 ` olegendo at gcc dot gnu.org
2012-08-30 22:54 ` olegendo at gcc dot gnu.org
2012-08-31 10:55 ` kkojima at gcc dot gnu.org
2012-08-31 15:50 ` olegendo at gcc dot gnu.org
2012-09-04  8:03 ` olegendo at gcc dot gnu.org
2012-09-23 21:36 ` [Bug target/51244] [SH] Inefficient conditional branch and code around T bit olegendo at gcc dot gnu.org
2012-09-23 21:42 ` olegendo at gcc dot gnu.org
2012-10-03 21:39 ` olegendo at gcc dot gnu.org
2012-10-12  0:41 ` olegendo at gcc dot gnu.org
2012-10-15 22:08 ` olegendo at gcc dot gnu.org
2012-11-03 12:01 ` olegendo at gcc dot gnu.org
2013-07-18 16:11 ` laurent.alfonsi at st dot com
2013-07-18 16:12 ` laurent.alfonsi at st dot com
2013-07-20 14:38 ` olegendo at gcc dot gnu.org [this message]
2013-07-23  8:21 ` laurent.alfonsi at st dot com
2013-07-27 19:28 ` olegendo at gcc dot gnu.org
2013-07-28  8:51 ` olegendo at gcc dot gnu.org
2013-07-28 12:26 ` olegendo at gcc dot gnu.org
2013-07-31 21:46 ` olegendo at gcc dot gnu.org
2013-08-23  0:13 ` olegendo at gcc dot gnu.org
2013-08-23  0:25 ` kkojima at gcc dot gnu.org
2013-09-24 22:43 ` olegendo at gcc dot gnu.org
2013-10-03 22:50 ` olegendo at gcc dot gnu.org
2013-10-12 20:47 ` olegendo at gcc dot gnu.org
2013-10-12 21:26 ` olegendo at gcc dot gnu.org
2013-12-05 17:54 ` olegendo at gcc dot gnu.org
2013-12-06 10:47 ` olegendo at gcc dot gnu.org
2014-05-10 20:19 ` olegendo at gcc dot gnu.org
2014-05-16 22:55 ` olegendo at gcc dot gnu.org
2014-09-13 18:48 ` olegendo at gcc dot gnu.org
2014-11-22 15:07 ` olegendo at gcc dot gnu.org
2014-11-22 15:50 ` olegendo at gcc dot gnu.org
2014-11-22 16:08 ` olegendo at gcc dot gnu.org
2014-12-01  6:50 ` olegendo at gcc dot gnu.org
2014-12-17 22:53 ` olegendo at gcc dot gnu.org
2014-12-17 23:08 ` olegendo at gcc dot gnu.org
2014-12-17 23:15 ` olegendo at gcc dot gnu.org
2014-12-24 21:56 ` olegendo at gcc dot gnu.org
2015-01-24 13:06 ` olegendo at gcc dot gnu.org
2015-03-01 19:16 ` olegendo at gcc dot gnu.org

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=bug-51244-4-uKWATcm7kJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).