public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix PR tree-optimization/70884
@ 2016-05-07 21:22 Eric Botcazou
  2016-05-09 10:02 ` Richard Biener
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2016-05-07 21:22 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

this is a tentative fix for the regression introduced in SRA by the machinery 
which deals with the constant pool.  initialize_constant_pool_replacements is 
supposed to issues new loads from the pool for scalarized variables, but it 
fails to do so for variables that are only partially scalarized.

Tested on PowerPC/Linux and x86-64/Linux, OK for mainline and 6 branch?


2016-05-07  Eric Botcazou  <ebotcazou@adacore.com>

	PR tree-optimization/70884
	* tree-sra.c (initialize_constant_pool_replacements): Process all the
	candidate variables.


2016-05-07  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/pr70884.c: New test.

-- 
Eric Botcazou

[-- Attachment #2: pr70884.diff --]
[-- Type: text/x-patch, Size: 463 bytes --]

Index: tree-sra.c
===================================================================
--- tree-sra.c	(revision 235544)
+++ tree-sra.c	(working copy)
@@ -3559,8 +3559,6 @@ initialize_constant_pool_replacements (v
   unsigned i;
 
   EXECUTE_IF_SET_IN_BITMAP (candidate_bitmap, 0, i, bi)
-    if (bitmap_bit_p (should_scalarize_away_bitmap, i)
-	&& !bitmap_bit_p (cannot_scalarize_away_bitmap, i))
       {
 	tree var = candidate (i);
 	if (!constant_decl_p (var))

[-- Attachment #3: pr70884.c --]
[-- Type: text/x-csrc, Size: 469 bytes --]

/* { dg-do run } */
/* { dg-options "-O -fno-tree-fre" } */

extern void abort (void);

typedef __UINTPTR_TYPE__ uintptr_t;

struct S { uintptr_t a; int i; };

static void __attribute__((noclone, noinline)) foo (struct S s)
{
  if (!s.a)
    abort ();
}

int i;

static void f1 (void)
{
  struct S s1 = { (uintptr_t) &i, 1 };
  foo (s1);
}

static void f2 (void)
{
  struct S s2 = { (uintptr_t) &i, 1 };
  foo (s2);
}

int main (void)
{
  f1 ();
  f2 ();
  return 0;
}

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

end of thread, other threads:[~2016-05-20  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-07 21:22 [patch] Fix PR tree-optimization/70884 Eric Botcazou
2016-05-09 10:02 ` Richard Biener
2016-05-13 11:01   ` Eric Botcazou
2016-05-13 11:52     ` Richard Biener
2016-05-13 15:24     ` Martin Jambor
2016-05-20  7:34       ` Eric Botcazou
2016-05-20  9:32         ` Richard Biener

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