re PR tree-optimization/51987 (Predictive commoning wrong-code with non-volatile asm)

PR tree-optimization/51987
	* tree-data-ref.c (get_references_in_stmt): Handle references in
	non-volatile GIMPLE_ASM.

	* gcc.target/i386/pr51987.c: New test.

From-SVN: r183524
This commit is contained in:
Jakub Jelinek 2012-01-25 16:38:51 +01:00 committed by Jakub Jelinek
parent 8bf43909f8
commit 06e1d03dc9
4 changed files with 46 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2012-01-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/51987
* tree-data-ref.c (get_references_in_stmt): Handle references in
non-volatile GIMPLE_ASM.
2012-01-25 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.c (vn_reference_eq): Also compare if both

View File

@ -1,3 +1,8 @@
2012-01-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/51987
* gcc.target/i386/pr51987.c: New test.
2012-01-25 Greta Yorsh <Greta.Yorsh@arm.com>
* gcc.dg/tm/lto-1.c: Require lto support in target.

View File

@ -0,0 +1,33 @@
/* PR tree-optimization/51987 */
/* { dg-do run { target { ! { ia32 } } } } */
/* { dg-options "-O3" } */
extern void abort (void);
union U { unsigned long long l; struct { unsigned int l, h; } i; };
__attribute__((noinline, noclone)) void
foo (char *x, char *y)
{
int i;
for (i = 0; i < 64; i++)
{
union U u;
asm ("movl %1, %k0; salq $32, %0" : "=r" (u.l) : "r" (i));
x[i] = u.i.h;
union U v;
asm ("movl %1, %k0; salq $32, %0" : "=r" (v.l) : "r" (i));
y[i] = v.i.h;
}
}
int
main ()
{
char a[64], b[64];
int i;
foo (a, b);
for (i = 0; i < 64; i++)
if (a[i] != i || b[i] != i)
abort ();
return 0;
}

View File

@ -1,5 +1,5 @@
/* Data references and dependences detectors.
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Sebastian Pop <pop@cri.ensmp.fr>
@ -4185,7 +4185,7 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
if ((stmt_code == GIMPLE_CALL
&& !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
|| (stmt_code == GIMPLE_ASM
&& gimple_asm_volatile_p (stmt)))
&& (gimple_asm_volatile_p (stmt) || gimple_vuse (stmt))))
clobbers_memory = true;
if (!gimple_vuse (stmt))