summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-09-26 21:58:13 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-08-30 20:10:54 +0200
commitfa497e3548e0dc0d11b259d299ee39c11db0d98f (patch)
tree990f0617d28df3855a701d9030eccbe6fc82e6ee
parent93b7840902ae6da75f8000a34b619dac352e3b5e (diff)
Add commandline option to bypass aliasing-checks.
This patch introduces the flag -fnoalias to bypass alias-checks in the SSA alias analyser. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r--gcc/common.opt4
-rw-r--r--gcc/tree-ssa-structalias.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/gcc/common.opt b/gcc/common.opt
index 658c0798720c..6f43ef937e95 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2717,6 +2717,10 @@ funroll-more
Common Report Var(flag_unroll_more) Optimization
Unroll a bit more.
+fnoalias
+Common Report Var(flag_noalias) Optimization
+Assume no aliasing in the whole program.
+
funwind-tables
Common Report Var(flag_unwind_tables) Optimization
Just generate unwind tables for exception handling.
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 373946f518ab..0cb4afaf1e55 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5655,7 +5655,7 @@ push_fields_onto_fieldstack (tree type, vec<fieldoff_s> *fieldstack,
e.only_restrict_pointers
= (!has_unknown_size
&& POINTER_TYPE_P (field_type)
- && TYPE_RESTRICT (field_type));
+ && (TYPE_RESTRICT (field_type) || flag_noalias));
if (e.only_restrict_pointers)
e.restrict_pointed_type = TREE_TYPE (field_type);
fieldstack->safe_push (e);
@@ -6013,7 +6013,7 @@ create_variable_info_for_1 (tree decl, const char *name, bool add_id,
vi->size = vi->fullsize;
vi->is_full_var = true;
if (POINTER_TYPE_P (decl_type)
- && TYPE_RESTRICT (decl_type))
+ && (TYPE_RESTRICT (decl_type) || flag_noalias))
vi->only_restrict_pointers = 1;
if (vi->only_restrict_pointers
&& !type_contains_placeholder_p (TREE_TYPE (decl_type))
@@ -6127,7 +6127,7 @@ create_variable_info_for (tree decl, const char *name, bool add_id)
/* Mark global restrict qualified pointers. */
if ((POINTER_TYPE_P (TREE_TYPE (decl))
- && TYPE_RESTRICT (TREE_TYPE (decl)))
+ && (TYPE_RESTRICT (TREE_TYPE (decl)) || flag_noalias))
|| vi->only_restrict_pointers)
{
varinfo_t rvi