aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-11-08 15:53:47 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-11-08 15:53:47 +0000
commit0274dd3f8d6bcbc4935fae1e0cc815197c48bb0c (patch)
treeb0226107b3a22640d2d717c7b833cb9b7f5a9201 /gcc/ada/gcc-interface/trans.c
parent4174a33ac66f45536e3d7bd46167d7f678310931 (diff)
downloadgcc-0274dd3f8d6bcbc4935fae1e0cc815197c48bb0c.zip
gcc-0274dd3f8d6bcbc4935fae1e0cc815197c48bb0c.tar.gz
gcc-0274dd3f8d6bcbc4935fae1e0cc815197c48bb0c.tar.bz2
fe.h (Suppress_Checks): Declare.
* fe.h (Suppress_Checks): Declare. * gcc-interface/misc.c (gnat_init_gcc_eh): Set -fnon-call-exceptions only if checks are not suppressed and -faggressive-loop-optimizations only if they are. * gcc-interface/trans.c (struct loop_info_d): Remove has_checks and warned_aggressive_loop_optimizations fields. (gigi): Do not clear warn_aggressive_loop_optimizations here. (Raise_Error_to_gnu): Do not set has_checks. (gnat_to_gnu) <N_Indexed_Component>: Remove support for aggressive loop optimizations. From-SVN: r265921
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index ce2d43f..2cd7102 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -198,8 +198,6 @@ struct GTY(()) loop_info_d {
tree high_bound;
vec<range_check_info, va_gc> *checks;
bool artificial;
- bool has_checks;
- bool warned_aggressive_loop_optimizations;
};
typedef struct loop_info_d *loop_info;
@@ -679,10 +677,6 @@ gigi (Node_Id gnat_root,
/* Now translate the compilation unit proper. */
Compilation_Unit_to_gnu (gnat_root);
- /* Disable -Waggressive-loop-optimizations since we implement our own
- version of the warning. */
- warn_aggressive_loop_optimizations = 0;
-
/* Then process the N_Validate_Unchecked_Conversion nodes. We do this at
the very end to avoid having to second-guess the front-end when we run
into dummy nodes during the regular processing. */
@@ -5720,7 +5714,6 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
rci->inserted_cond
= build1 (SAVE_EXPR, boolean_type_node, boolean_true_node);
vec_safe_push (loop->checks, rci);
- loop->has_checks = true;
gnu_cond = build_noreturn_cond (gnat_to_gnu (gnat_cond));
if (flag_unswitch_loops)
gnu_cond = build_binary_op (TRUTH_ANDIF_EXPR,
@@ -5733,14 +5726,6 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
gnu_cond,
rci->inserted_cond);
}
-
- /* Or else, if aggressive loop optimizations are enabled, we just
- record that there are checks applied to iteration variables. */
- else if (optimize
- && flag_aggressive_loop_optimizations
- && inside_loop_p ()
- && (loop = find_loop_for (gnu_index)))
- loop->has_checks = true;
}
break;
@@ -6359,45 +6344,9 @@ gnat_to_gnu (Node_Id gnat_node)
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
gnat_temp = gnat_expr_array[i];
gnu_expr = maybe_character_value (gnat_to_gnu (gnat_temp));
- struct loop_info_d *loop;
gnu_result
= build_binary_op (ARRAY_REF, NULL_TREE, gnu_result, gnu_expr);
-
- /* Array accesses are bound-checked so they cannot trap, but this
- is valid only if they are not hoisted ahead of the check. We
- need to mark them as no-trap to get decent loop optimizations
- in the presence of -fnon-call-exceptions, so we do it when we
- know that the original expression had no side-effects. */
- if (TREE_CODE (gnu_result) == ARRAY_REF
- && !(Nkind (gnat_temp) == N_Identifier
- && Ekind (Entity (gnat_temp)) == E_Constant))
- TREE_THIS_NOTRAP (gnu_result) = 1;
-
- /* If aggressive loop optimizations are enabled, we warn for loops
- overrunning a simple array of size 1 not at the end of a record.
- This is aimed to catch misuses of the trailing array idiom. */
- if (optimize
- && flag_aggressive_loop_optimizations
- && inside_loop_p ()
- && TREE_CODE (TREE_TYPE (gnu_type)) != ARRAY_TYPE
- && TREE_CODE (gnu_array_object) != ARRAY_REF
- && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_type)),
- TYPE_MAX_VALUE (TYPE_DOMAIN (gnu_type)))
- && !array_at_struct_end_p (gnu_result)
- && (loop = find_loop_for (gnu_expr))
- && !loop->artificial
- && !loop->has_checks
- && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_type)),
- loop->low_bound)
- && can_be_lower_p (loop->low_bound, loop->high_bound)
- && !loop->warned_aggressive_loop_optimizations
- && warning (OPT_Waggressive_loop_optimizations,
- "out-of-bounds access may be optimized away"))
- {
- inform (EXPR_LOCATION (loop->stmt), "containing loop");
- loop->warned_aggressive_loop_optimizations = true;
- }
}
gnu_result_type = get_unpadded_type (Etype (gnat_node));