]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
alias.c (true_dependence): Only apply MEM_IN_STRUCT_P tests when flag_structure_noali...
authorToon Moene <toon@moene.indiv.nluug.nl>
Sat, 27 Feb 1999 18:33:05 +0000 (19:33 +0100)
committerJeff Law <law@gcc.gnu.org>
Sat, 27 Feb 1999 18:33:05 +0000 (11:33 -0700)
        * alias.c (true_dependence): Only apply MEM_IN_STRUCT_P tests
        when flag_structure_noalias is set.
        * toplev.c (flag_structure_noalias): New variable.
        (f_options): Add -fstructure-noalias.
        * flags.h (flag_structure_noalias): Declare.
        * invoke.texi: Update documentation.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>
Co-Authored-By: Mark Mitchell <mark@markmitchell.com>
From-SVN: r25483

gcc/ChangeLog
gcc/alias.c
gcc/flags.h
gcc/invoke.texi
gcc/toplev.c

index e7ecc3e5fea33070ed97d4796de2e4b138485756..0f5b4a8841632275f1d8c84a0360011c2d6f359b 100644 (file)
@@ -1,3 +1,14 @@
+Sat Feb 27 19:29:46 1999  Toon Moene  <toon@moene.indiv.nluug.nl>
+                         Mark Mitchell  <mark@markmitchell.com>
+                         Jeffrey A Law  (law@cygnus.com)
+
+       * alias.c (true_dependence): Only apply MEM_IN_STRUCT_P tests
+       when flag_structure_noalias is set.
+       * toplev.c (flag_structure_noalias): New variable.
+       (f_options): Add -fstructure-noalias.
+       * flags.h (flag_structure_noalias): Declare.
+       * invoke.texi: Update documentation.
+
 Sat Feb 27 19:19:36 1999  Jeffrey A Law  (law@cygnus.com)
 
        * SERVICE: Update from the FSF.
index 281e353e10134fbdb7626be27126330bda6bd01e..172b6769f76fb4f14d875156faeaa29edf015422 100644 (file)
@@ -942,9 +942,15 @@ true_dependence (mem, mem_mode, x, varies)
 
      If either memory reference is a variable structure the other is a
      fixed scalar and there is no aliasing.  */
-  if ((MEM_IN_STRUCT_P (mem) && varies (mem_addr))
-      || (MEM_IN_STRUCT_P (x) && varies (x_addr)))
-    return 0;
+
+  /* Disabled by default for egcs 1.1.x as alias analysis isn't good
+     enough yet to discover all cases where this doesn't apply.  */
+  if (flag_structure_noalias)
+    {
+      if ((MEM_IN_STRUCT_P (mem) && varies (mem_addr))
+         || (MEM_IN_STRUCT_P (x) && varies (x_addr)))
+       return 0;
+    }
 
   return 1;
 }
index 37c1bd96a91bbb2aab435303b91b707bb6a69b38..9fa976bf872b4f87813f3a91f81f1e04d828b74d 100644 (file)
@@ -291,6 +291,11 @@ extern int flag_fast_math;
 
 extern int flag_rerun_loop_opt;
 
+/* Nonzero means to assume that a structure or an array reference at
+   a varying address cannot alias a scalar at a fixed address. */
+
+extern int flag_structure_noalias;
+
 /* Nonzero means make functions that look like good inline candidates
    go inline.  */
 
index 5287f53e4a62cef2e3753345ff31f375ebb80e0c..01dd7a8860566a92a1a59ea29ae59fd676d3eb4c 100644 (file)
@@ -158,6 +158,7 @@ in the following sections.
 -fschedule-insns2  -fstrength-reduce  -fthread-jumps
 -funroll-all-loops  -funroll-loops
 -fmove-all-movables  -freduce-all-givs -fstrict-aliasing
+-fstructure-noalias
 -O  -O0  -O1  -O2  -O3 -Os
 @end smallexample
 
@@ -2501,6 +2502,17 @@ allowed to alias.  For an example, see the C front-end function
 @code{c_get_alias_set}.
 @end ifset
 
+@item -fstructure-noalias
+Allows the compiler to assume that structure / varying array references
+do not alias fixed scalars.
+
+Although this optimization is safe, GCC can occasionally lose track
+of which references refer to scalars and which to structures,
+leading it to perform unsafe transformations.  Release 1.2 of EGCS
+will incorporate changes which allow GCC to track the
+scalar/structure distinction safely.  Thus, the optimization will
+always be same, and this option will likely be removed or will have
+no effect.
 @end table
 
 @node Preprocessor Options
index 9b7c50674adeba6f730b4650573d28deb52c144c..497359e0e2a85a60f8e565aacd947e4a77c5bc64 100644 (file)
@@ -554,6 +554,11 @@ static int flag_gcse;
 
 static int flag_rerun_cse_after_loop;
 
+/* Nonzero means to assume that a structure or an array reference at
+   a varying address cannot alias a scalar at a fixed address. */
+
+int flag_structure_noalias = 0;
+
 /* Nonzero means to run loop optimizations twice.  */
 
 int flag_rerun_loop_opt;
@@ -840,6 +845,8 @@ lang_independent_options f_options[] =
    "Perform the global common subexpression elimination" },
   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
    "Run CSE pass after loop optimisations"},
+  {"structure-noalias", &flag_structure_noalias, 1,
+   "Assume structure / array reference and fixed scalar cannot alias"},
   {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
    "Run the loop optimiser twice"},
   {"pretend-float", &flag_pretend_float, 1,