Patchwork Fix PR54634

login
register
mail settings
Submitter Richard Guenther
Date Sept. 20, 2012, 2:40 p.m.
Message ID <alpine.LNX.2.00.1209201639550.4063@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/185411/
State New
Headers show

Comments

Richard Guenther - Sept. 20, 2012, 2:40 p.m.
This fixes PR54634, data-ref analysis does not properly model
"reads of global memory" done by pure functions.  So just give
up.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-09-20  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/54634
	* tree-data-ref.c (get_references_in_stmt): For now give
	up for pure functions.

Patch

Index: gcc/tree-data-ref.c
===================================================================
--- gcc/tree-data-ref.c	(revision 191561)
+++ gcc/tree-data-ref.c	(working copy)
@@ -4307,10 +4307,10 @@  get_references_in_stmt (gimple stmt, VEC
   *references = NULL;
 
   /* ASM_EXPR and CALL_EXPR may embed arbitrary side effects.
-     Calls have side-effects, except those to const or pure
-     functions.  */
+     As we cannot model data-references to not spelled out
+     accesses give up if they may occur.  */
   if ((stmt_code == GIMPLE_CALL
-       && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
+       && !(gimple_call_flags (stmt) & ECF_CONST))
       || (stmt_code == GIMPLE_ASM
 	  && (gimple_asm_volatile_p (stmt) || gimple_vuse (stmt))))
     clobbers_memory = true;