public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: gcc-patches@gcc.gnu.org,  Roman Zippel <zippel@linux-m68k.org>,
	 Bernd Schmidt <bernds_cb1@t-online.de>,
	 Diego Novillo <dnovillo@acm.org>,
	 Daniel Berlin <dberlin@dberlin.org>,
	 Andrew Pinski <pinskia@gmail.com>
Subject: Re: SRA bit-field optimization
Date: Wed, 03 Oct 2007 07:45:00 -0000	[thread overview]
Message-ID: <200710030947.34535.ebotcazou@adacore.com> (raw)
In-Reply-To: <orzlz7iis1.fsf@free.oliva.athome.lsd.ic.unicamp.br>

[-- Attachment #1: Type: text/plain, Size: 2868 bytes --]

> Ping^2?
>
> Tests on ppc* passed back then, BTW.

It apparently still misbehaves in some cases for Ada and has introduced an 
ACATS regression at -O2 on x86-64 (c37213b):

<bb 4>:
  # D.857_26 = PHI <D.857_11(3), D.857_27(7)>
  D.860_25 = (<unnamed-signed:64>) D.857_26;
  _init = VIEW_CONVERT_EXPR<struct p__cons[D.859:D.861]>(*x.1_3)[D.860_25]{lb: 
D.859_24 sz: 12};
  SR.57_139 = VIEW_CONVERT_EXPR<UNSIGNED_64>(_init.c1);
  _init.c1 = VIEW_CONVERT_EXPR<struct p__cons__T2b>(SR.57_139);
  D.976 = VIEW_CONVERT_EXPR<struct p__rec>(4294967297);
  SR.45_155 = VIEW_CONVERT_EXPR<UNSIGNED_64>(D.976);
  D.978.c1 = VIEW_CONVERT_EXPR<struct p__cons__T2b>(SR.45_155);
  D.978.d3 = 1;
  D.960 = D.978;
  VIEW_CONVERT_EXPR<struct p__cons[D.859:D.861]>(*x.1_3)[D.860_25]{lb: 
D.859_24 sz: 12} = D.960;

<bb 5>:
  if (D.858_23 == D.857_26)
    goto <bb 6>;
  else
    goto <bb 7>;

is now turned into

<bb 4>:
  # SR.128_80 = PHI <SR.128_164(3), SR.128_197(7)>
  # D.857_26 = PHI <D.857_11(3), D.857_27(7)>
  D.860_25 = (<unnamed-signed:64>) D.857_26;
  _init$d3_69 = VIEW_CONVERT_EXPR<struct p__cons[D.859:D.861]>(*x.1_3)
[D.860_25]{lb: D.859_24 sz: 12}.d3;
  SR.131_67 = VIEW_CONVERT_EXPR<UNSIGNED_64>(VIEW_CONVERT_EXPR<struct 
p__cons[D.859:D.861]>(*x.1_3)[D.860_25]{lb: D.859_24 sz: 12}.c1);
  _init$c1$B0F64_65 = SR.131_67;
  SR.132_63 = _init$c1$B0F64_65;
  _init.c1 = VIEW_CONVERT_EXPR<struct p__cons__T2b>(SR.132_63);
  SR.57_139 = VIEW_CONVERT_EXPR<UNSIGNED_64>(_init.c1);
  SR.133_6 = SR.57_139;
  _init$c1$B0F64_154 = SR.133_6;
  D.976 = VIEW_CONVERT_EXPR<struct p__rec>(4294967297);
  SR.45_155 = VIEW_CONVERT_EXPR<UNSIGNED_64>(D.976);
  SR.134_142 = SR.45_155;
  SR.130_124 = SR.134_142;
  SR.129_148 = 1;
  SR.135_147 = SR.128_80 & 4294967295;
  SR.138_83 = SR.130_124 >> 32;
  SR.136_141 = (p__sm___XDLU_1__10) SR.138_83;
  SR.139_140 = (UNSIGNED_64) SR.136_141;
  SR.140_138 = SR.139_140 << 32;
  SR.128_92 = SR.135_147 | SR.140_138;
  SR.141_201 = SR.128_92 & 0x0ffffffff00000000;
  SR.142_200 = (p__sm___XDLU_1__10) SR.130_124;
  SR.144_199 = (UNSIGNED_64) SR.142_200;
  SR.128_137 = SR.141_201 | SR.144_199;
  SR.128_197 = SR.130_124;
  SR.127_136 = SR.129_148;
  SR.145_135 = SR.128_197;

<bb 5>:
  VIEW_CONVERT_EXPR<struct p__cons[D.859:D.861]>(*x.1_3)[D.860_25]{lb: 
D.859_24 sz: 12}.c1 = VIEW_CONVERT_EXPR<struct p__cons__T2b>(SR.145_135);
  VIEW_CONVERT_EXPR<struct p__cons[D.859:D.861]>(*x.1_3)[D.860_25]{lb: 
D.859_24 sz: 12}.d3 = SR.127_136;
  if (D.858_23 == D.857_26)
    goto <bb 6>;
  else
    goto <bb 7>;


The correctness problem is that the last statement of BB 4 is not 
tree_could_throw_p anymore, yielding:

p.adb: In function 'P':
p.adb:1: error: statement marked for throw, but doesn't
SR.145_135 = SR.128_197;

The optimization problem is the junk now present at the end of BB 4.

Testcase attached, compile at -O2.

-- 
Eric Botcazou

[-- Attachment #2: p.adb --]
[-- Type: text/x-adasrc, Size: 582 bytes --]

PROCEDURE P IS

   SUBTYPE SM IS INTEGER RANGE 1..10;

   TYPE REC (D1, D2 : SM) IS RECORD NULL; END RECORD;

   F1_CONS : INTEGER := 2;

   FUNCTION F1 RETURN INTEGER IS
   BEGIN
      F1_CONS := F1_CONS - 1;
      RETURN F1_CONS;
   END F1;

   TYPE CONS (D3 : INTEGER := 1) IS
      RECORD
         C1 : REC(D3, F1);
      END RECORD;

   Y : CONS;

   TYPE ARR IS ARRAY (1..5) OF CONS;

BEGIN

   DECLARE
      X : ARR;
   BEGIN
      IF X /= (1..5 => (1, (1, 1))) THEN
         raise Program_Error;
      END IF;
   END;
   EXCEPTION
      WHEN CONSTRAINT_ERROR => NULL;

END;

  parent reply	other threads:[~2007-10-03  7:45 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  0:29 Reload bug & SRA oddness Bernd Schmidt
2007-04-20  3:19 ` Andrew Pinski
2007-04-20  3:53 ` Daniel Berlin
2007-04-20  4:30   ` Bernd Schmidt
2007-04-20  4:48     ` Andrew Pinski
2007-04-20  7:32     ` Alexandre Oliva
2007-04-20 12:57       ` Bernd Schmidt
2007-04-20 18:28         ` Alexandre Oliva
2007-04-20 18:40         ` Alexandre Oliva
2007-04-30 10:09           ` Bernd Schmidt
2007-04-30 19:04             ` Alexandre Oliva
2007-04-30 19:08               ` Alexandre Oliva
2007-05-01 15:38             ` Alexandre Oliva
2007-05-01 15:45               ` Eric Botcazou
2007-05-04  0:19                 ` Alexandre Oliva
2007-05-01 15:53               ` Diego Novillo
2007-05-01 16:03                 ` Eric Botcazou
2007-05-01 16:51                   ` Arnaud Charlet
2007-05-01 16:54                     ` Arnaud Charlet
2007-05-01 17:31                   ` Andreas Schwab
2007-05-01 16:24               ` Roman Zippel
2007-05-04  4:07                 ` Alexandre Oliva
2007-05-04  5:24                   ` Alexandre Oliva
2007-05-05 18:19                     ` Roman Zippel
2007-05-06  5:13                       ` Alexandre Oliva
2007-05-06 12:13                         ` Bernd Schmidt
2007-05-06 14:27                           ` Alexandre Oliva
2007-05-06 15:01                             ` Alexandre Oliva
2007-05-06 23:44                               ` Alexandre Oliva
2007-05-06 23:51                                 ` Diego Novillo
2007-05-07  0:14                                   ` Alexandre Oliva
2007-05-07  2:21                                     ` Andrew Pinski
2007-05-09 12:25                                     ` Bernd Schmidt
2007-05-10  7:47                                       ` Alexandre Oliva
2007-05-10 11:00                                         ` Bernd Schmidt
2007-05-22  7:09                                           ` Alexandre Oliva
2007-05-22 17:34                                             ` Roman Zippel
2007-05-22 20:49                                               ` Alexandre Oliva
2007-05-23 13:07                                                 ` Roman Zippel
2007-05-22 21:23                                             ` Alexandre Oliva
2007-05-09 18:32                                     ` Roman Zippel
2007-05-10  7:49                                       ` Alexandre Oliva
2007-05-15 17:39                                         ` Alexandre Oliva
2007-05-17 21:17                                           ` Andrew Pinski
2007-05-28 10:49                                           ` Bernd Schmidt
2007-05-31 20:57                                             ` Alexandre Oliva
2007-06-02 17:41                                               ` Bernd Schmidt
2007-06-06  3:18                                                 ` Alexandre Oliva
2007-06-25 18:48                                                   ` Alexandre Oliva
2007-06-26 23:01                                                   ` Bernd Schmidt
2007-06-28  4:50                                                     ` Alexandre Oliva
2007-07-03  0:52                                                       ` Roman Zippel
2007-07-06  9:21                                                         ` Alexandre Oliva
2007-08-24  7:28                                                           ` SRA bit-field optimization (was: Re: Reload bug & SRA oddness) Alexandre Oliva
2007-09-28  9:17                                                             ` SRA bit-field optimization Alexandre Oliva
2007-10-02 17:15                                                               ` Richard Guenther
2007-10-03  8:38                                                                 ` Richard Sandiford
2007-10-03 16:50                                                                   ` Alexandre Oliva
2007-10-03 18:23                                                                     ` Richard Sandiford
2007-10-04 19:56                                                                     ` Richard Sandiford
2007-10-05 17:43                                                                       ` Alexandre Oliva
2007-10-06  8:02                                                                         ` Richard Sandiford
2007-10-06 21:06                                                                           ` John David Anglin
2007-10-06 22:12                                                                             ` Richard Sandiford
2007-10-07 23:44                                                                               ` Alexandre Oliva
2007-10-08 21:14                                                                                 ` John David Anglin
2007-10-08 23:51                                                                                   ` Alexandre Oliva
2007-10-09  0:31                                                                                     ` John David Anglin
2007-10-09  4:41                                                                                       ` Alexandre Oliva
2007-10-09  4:45                                                                                 ` Alexandre Oliva
2007-10-06 16:01                                                                         ` David Daney
2007-10-03 14:37                                                                 ` Daniel Berlin
2007-10-03 14:44                                                                   ` Diego Novillo
2007-10-05 15:03                                                                 ` Richard Guenther
2007-10-05 16:20                                                                   ` Alexandre Oliva
2007-10-05 16:24                                                                     ` Richard Guenther
2007-10-05 16:26                                                                     ` Diego Novillo
2007-10-05 20:08                                                                       ` Alexandre Oliva
2007-10-09  4:55                                                                     ` Alexandre Oliva
2007-10-03  7:45                                                               ` Eric Botcazou [this message]
2007-10-03 21:36                                                                 ` Eric Botcazou
2007-10-08 20:28                                                                 ` Alexandre Oliva
2007-10-05  6:24                                                                   ` Eric Botcazou
2007-10-05 16:03                                                                     ` Alexandre Oliva
2007-10-07  9:01                                                                       ` Eric Botcazou
2007-10-07 23:58                                                                         ` Alexandre Oliva
2007-10-08  5:13                                                                           ` Eric Botcazou
2007-10-08 20:29                                                                             ` Alexandre Oliva
2007-10-08 21:00                                                                               ` Eric Botcazou
2007-10-08 23:56                                                                                 ` Alexandre Oliva
2007-09-29 17:52                                                           ` Reload bug & SRA oddness Diego Novillo
2007-04-20 17:07     ` Daniel Berlin
2007-04-28 20:48   ` Bernd Schmidt
2007-04-28 21:26     ` Richard Guenther
2007-04-28 21:49       ` Daniel Berlin
2007-04-29 10:04         ` Richard Guenther
2007-04-29 10:27           ` Richard Guenther
2007-04-29 10:31             ` Richard Guenther
2007-04-29 11:16               ` Richard Guenther
2007-04-20 14:01 ` Bernd Schmidt
2007-04-20 22:00   ` Eric Botcazou
2007-04-28 16:25     ` Bernd Schmidt
2007-04-28 17:46       ` Eric Botcazou
2007-04-29  6: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=200710030947.34535.ebotcazou@adacore.com \
    --to=ebotcazou@adacore.com \
    --cc=aoliva@redhat.com \
    --cc=bernds_cb1@t-online.de \
    --cc=dberlin@dberlin.org \
    --cc=dnovillo@acm.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=zippel@linux-m68k.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).