public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix oversight in tuplification of DOM
@ 2011-06-28 21:50 Eric Botcazou
  2011-06-28 22:18 ` Jeff Law
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Botcazou @ 2011-06-28 21:50 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

the attached testcase triggers an ICE when compiled at -O or above, on all the 
open branches.  This is a regression introduced with the tuplification.  The 
problem is that 2 ARRAY_RANGE_REFs are recognized as equivalent, although they 
don't have the same number of elements.  This is so because their type isn't 
taken into account by the hash equality function as it simply isn't recorded 
in initialize_hash_element (GIMPLE_SINGLE_RHS case).  Now in all the other 
cases it is recorded so this very likely is an oversight.

Tested on x86_64-suse-linux, OK for all branches?


2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-dom.c (initialize_hash_element): Fix oversight.


2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/opt17.ad[sb]: New test.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 448 bytes --]

Index: tree-ssa-dom.c
===================================================================
--- tree-ssa-dom.c	(revision 175408)
+++ tree-ssa-dom.c	(working copy)
@@ -214,6 +214,7 @@ initialize_hash_element (gimple stmt, tr
         {
         case GIMPLE_SINGLE_RHS:
 	  expr->kind = EXPR_SINGLE;
+	  expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
 	  expr->ops.single.rhs = gimple_assign_rhs1 (stmt);
 	  break;
         case GIMPLE_UNARY_RHS:

[-- Attachment #3: opt17.adb --]
[-- Type: text/x-adasrc, Size: 196 bytes --]

-- { dg-do compile }
-- { dg-options "-O" }

package body Opt17 is

  function Func return S is
    V : String (1 .. 6);
  begin
    V (1 .. 3) := "ABC";
    return V (1 .. 5);
  end;

end Opt17;

[-- Attachment #4: opt17.ads --]
[-- Type: text/x-adasrc, Size: 89 bytes --]

package Opt17 is

  subtype S is String (1 .. 5);

  function Func return S;

end Opt17;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix oversight in tuplification of DOM
  2011-06-28 21:50 [patch] Fix oversight in tuplification of DOM Eric Botcazou
@ 2011-06-28 22:18 ` Jeff Law
  2011-06-29  7:32 ` Hans-Peter Nilsson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jeff Law @ 2011-06-28 22:18 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/28/11 14:36, Eric Botcazou wrote:
> Hi,
> 
> the attached testcase triggers an ICE when compiled at -O or above, on all the 
> open branches.  This is a regression introduced with the tuplification.  The 
> problem is that 2 ARRAY_RANGE_REFs are recognized as equivalent, although they 
> don't have the same number of elements.  This is so because their type isn't 
> taken into account by the hash equality function as it simply isn't recorded 
> in initialize_hash_element (GIMPLE_SINGLE_RHS case).  Now in all the other 
> cases it is recorded so this very likely is an oversight.
> 
> Tested on x86_64-suse-linux, OK for all branches?
> 
> 
> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* tree-ssa-dom.c (initialize_hash_element): Fix oversight.
> 
> 
> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* gnat.dg/opt17.ad[sb]: New test.
OK.
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOCkOJAAoJEBRtltQi2kC7d74H/1UxVoJCRtAJyLBzwPvVCKni
7uowRbHYTWVpB5y+LrrrIh8vkcuM/SZ6LAB6SuowK00G+4zQJtmvnA9DBLq65WSZ
/vOiond3LljmH8E5m7lg9umx5VO7jdErScB7xORfEezNy4857Y0p78UOkZxKiDpI
RqKThfRYK/0mjizTlDaPaBQH/LIRJU8MgxWA8SDxLKZ1FmmqhOqcyH7Z+wbGdNPf
QoHAd5xrQsA7Ga3kmwI/eBjNqlKkWS92L0ggQnn6aKsJJNeDuLdfolFKw4Fi4waN
X8BV4vYDlDVywRoFRzo1lvBIjeJ9hpJsT3cLuW6Kp3BUvEzQjyv7d0o/BRxWYfw=
=lvG1
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix oversight in tuplification of DOM
  2011-06-28 21:50 [patch] Fix oversight in tuplification of DOM Eric Botcazou
  2011-06-28 22:18 ` Jeff Law
@ 2011-06-29  7:32 ` Hans-Peter Nilsson
  2011-06-29  9:38 ` Richard Guenther
  2011-06-30 20:47 ` Eric Botcazou
  3 siblings, 0 replies; 5+ messages in thread
From: Hans-Peter Nilsson @ 2011-06-29  7:32 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Tue, 28 Jun 2011, Eric Botcazou wrote:
> Hi,
>
> the attached testcase triggers an ICE when compiled at -O or above, on all the
> open branches.  This is a regression introduced with the tuplification.  The
> problem is that 2 ARRAY_RANGE_REFs are recognized as equivalent, although they
> don't have the same number of elements.  This is so because their type isn't
> taken into account by the hash equality function as it simply isn't recorded
> in initialize_hash_element (GIMPLE_SINGLE_RHS case).  Now in all the other
> cases it is recorded so this very likely is an oversight.
>
> Tested on x86_64-suse-linux, OK for all branches?
>
>
> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* tree-ssa-dom.c (initialize_hash_element): Fix oversight.

This caused a regression on 4.4 for cris-elf (at least), see
PR49572.

brgds, H-P

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix oversight in tuplification of DOM
  2011-06-28 21:50 [patch] Fix oversight in tuplification of DOM Eric Botcazou
  2011-06-28 22:18 ` Jeff Law
  2011-06-29  7:32 ` Hans-Peter Nilsson
@ 2011-06-29  9:38 ` Richard Guenther
  2011-06-30 20:47 ` Eric Botcazou
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Guenther @ 2011-06-29  9:38 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Tue, Jun 28, 2011 at 10:36 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the attached testcase triggers an ICE when compiled at -O or above, on all the
> open branches.  This is a regression introduced with the tuplification.  The
> problem is that 2 ARRAY_RANGE_REFs are recognized as equivalent, although they
> don't have the same number of elements.  This is so because their type isn't
> taken into account by the hash equality function as it simply isn't recorded
> in initialize_hash_element (GIMPLE_SINGLE_RHS case).  Now in all the other
> cases it is recorded so this very likely is an oversight.
>
> Tested on x86_64-suse-linux, OK for all branches?

Oops.  This would also make two MEM-REFs equivalent which access
different amount of memory.

Ok.

Thanks,
Richard.

>
> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * tree-ssa-dom.c (initialize_hash_element): Fix oversight.
>
>
> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gnat.dg/opt17.ad[sb]: New test.
>
>
> --
> Eric Botcazou
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix oversight in tuplification of DOM
  2011-06-28 21:50 [patch] Fix oversight in tuplification of DOM Eric Botcazou
                   ` (2 preceding siblings ...)
  2011-06-29  9:38 ` Richard Guenther
@ 2011-06-30 20:47 ` Eric Botcazou
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Botcazou @ 2011-06-30 20:47 UTC (permalink / raw)
  To: gcc-patches

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

> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* tree-ssa-dom.c (initialize_hash_element): Fix oversight.

As reported under PR tree-optimization/49572, using the type of the LHS like in 
the other cases leads to optimization regressions.  The attached patch changes 
this to use the type of RHS instead in the GIMPLE_SINGLE_RHS case.

Tested on x86_64-suse-linux, pre-approved by Richard in the PR, applied.


2011-06-30  Eric Botcazou  <ebotcazou@adacore.com>

	PR tree-optimization/49572
	* tree-ssa-dom.c (initialize_hash_element) <GIMPLE_SINGLE_RHS>: Use the
	type of the RHS instead of that of the LHS for the expression type.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 658 bytes --]

Index: tree-ssa-dom.c
===================================================================
--- tree-ssa-dom.c	(revision 175621)
+++ tree-ssa-dom.c	(working copy)
@@ -208,13 +208,11 @@ initialize_hash_element (gimple stmt, tr
     {
       enum tree_code subcode = gimple_assign_rhs_code (stmt);
 
-      expr->type = NULL_TREE;
-
       switch (get_gimple_rhs_class (subcode))
         {
         case GIMPLE_SINGLE_RHS:
 	  expr->kind = EXPR_SINGLE;
-	  expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
+	  expr->type = TREE_TYPE (gimple_assign_rhs1 (stmt));
 	  expr->ops.single.rhs = gimple_assign_rhs1 (stmt);
 	  break;
         case GIMPLE_UNARY_RHS:

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-30 19:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-28 21:50 [patch] Fix oversight in tuplification of DOM Eric Botcazou
2011-06-28 22:18 ` Jeff Law
2011-06-29  7:32 ` Hans-Peter Nilsson
2011-06-29  9:38 ` Richard Guenther
2011-06-30 20:47 ` Eric Botcazou

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).