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 <ebotca...@adacore.com>
PR tree-optimization/70884
* tree-sra.c (initialize_constant_pool_replacements): Process all the
candidate variables.
2016-05-07 Eric Botcazou <ebotca...@adacore.com>
* gcc.dg/pr70884.c: New test.
--
Eric Botcazou
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))
/* { 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;
}