diff options
author | Jeff Law <law@redhat.com> | 2013-12-04 20:18:18 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2013-12-04 20:18:18 -0700 |
commit | ae93744d3bca8ba3e54e6f48ec7d80593eb3d6d9 (patch) | |
tree | 065fb58430d1417a0032a8917f79040a59ad7213 /gcc/gimple.c | |
parent | 97d7fffaaf636dae8ece215661935482c854d5aa (diff) | |
download | gcc-ae93744d3bca8ba3e54e6f48ec7d80593eb3d6d9.zip gcc-ae93744d3bca8ba3e54e6f48ec7d80593eb3d6d9.tar.gz gcc-ae93744d3bca8ba3e54e6f48ec7d80593eb3d6d9.tar.bz2 |
common.opt: Split up -fisolate-erroneous-paths into -fisolate-erroneous-paths-dereference...
* common.opt: Split up -fisolate-erroneous-paths into
-fisolate-erroneous-paths-dereference and
-fisolate-erroneous-paths-attribute.
* invoke.texi: Corresponding changes.
* gimple.c (infer_nonnull_range): Add and use new arguments
to control what kind of statements can be used to infer a
non-null range.
* gimple.h (infer_nonnull_range): Update prototype.
* tree-vrp.c (infer_value_range): Corresponding changes.
* opts.c (default_options_table): Update due to option split.
* gimple-ssa-isolate-paths.c: Fix trailing whitespace.
(find_implicit_erroneous_behaviour): Pass additional arguments
to infer_nonnull_range.
(find_explicit_erroneous_behaviour): Similarly.
(gate_isolate_erroneous_paths): Check both of the new
options.
testsuite/
* gcc.dg/pr38984.c: Use -fno-isolate-erroneous-paths-dereference.
* gcc.dg/tree-ssa/isolate-2.c: Explicitly turn on
-fisolate-erroneous-paths-attribute.
* gcc.dg/tree-ssa/isolate-4.c: Likewise.
From-SVN: r205689
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r-- | gcc/gimple.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index 7bc87bc..f11362a 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2502,10 +2502,16 @@ check_loadstore (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) return false; } -/* If OP can be inferred to be non-zero after STMT executes, return true. */ +/* If OP can be inferred to be non-NULL after STMT executes, return true. + + DEREFERENCE is TRUE if we can use a pointer dereference to infer a + non-NULL range, FALSE otherwise. + + ATTRIBUTE is TRUE if we can use attributes to infer a non-NULL range + for function arguments and return values. FALSE otherwise. */ bool -infer_nonnull_range (gimple stmt, tree op) +infer_nonnull_range (gimple stmt, tree op, bool dereference, bool attribute) { /* We can only assume that a pointer dereference will yield non-NULL if -fdelete-null-pointer-checks is enabled. */ @@ -2514,11 +2520,13 @@ infer_nonnull_range (gimple stmt, tree op) || gimple_code (stmt) == GIMPLE_ASM) return false; - if (walk_stmt_load_store_ops (stmt, (void *)op, - check_loadstore, check_loadstore)) + if (dereference + && walk_stmt_load_store_ops (stmt, (void *)op, + check_loadstore, check_loadstore)) return true; - if (is_gimple_call (stmt) && !gimple_call_internal_p (stmt)) + if (attribute + && is_gimple_call (stmt) && !gimple_call_internal_p (stmt)) { tree fntype = gimple_call_fntype (stmt); tree attrs = TYPE_ATTRIBUTES (fntype); @@ -2557,7 +2565,8 @@ infer_nonnull_range (gimple stmt, tree op) /* If this function is marked as returning non-null, then we can infer OP is non-null if it is used in the return statement. */ - if (gimple_code (stmt) == GIMPLE_RETURN + if (attribute + && gimple_code (stmt) == GIMPLE_RETURN && gimple_return_retval (stmt) && operand_equal_p (gimple_return_retval (stmt), op, 0) && lookup_attribute ("returns_nonnull", |