aboutsummaryrefslogtreecommitdiff
path: root/gcc/passes.def
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-07-13 11:04:22 +0200
committerJakub Jelinek <jakub@redhat.com>2021-07-13 11:04:22 +0200
commitdddb6ffdc5c25264dd75ad82dad8e48a0718d2d9 (patch)
tree35d686b02d359687426fa3ecc944083704d7a3cd /gcc/passes.def
parent42f10ba5b57250506d69a0391ea7771c843ea286 (diff)
downloadgcc-dddb6ffdc5c25264dd75ad82dad8e48a0718d2d9.zip
gcc-dddb6ffdc5c25264dd75ad82dad8e48a0718d2d9.tar.gz
gcc-dddb6ffdc5c25264dd75ad82dad8e48a0718d2d9.tar.bz2
passes: Fix up subobject __bos [PR101419]
The following testcase is miscompiled, because VN during cunrolli changes __bos argument from address of a larger field to address of a smaller field and so __builtin_object_size (, 1) then folds into smaller value than the actually available size. copy_reference_ops_from_ref has a hack for this, but it was using cfun->after_inlining as a check whether the hack can be ignored, and cunrolli is after_inlining. This patch uses a property to make it exact (set at the end of objsz pass that doesn't do insert_min_max_p) and additionally based on discussions in the PR moves the objsz pass earlier after IPA. 2021-07-13 Jakub Jelinek <jakub@redhat.com> Richard Biener <rguenther@suse.de> PR tree-optimization/101419 * tree-pass.h (PROP_objsz): Define. (make_pass_early_object_sizes): Declare. * passes.def (pass_all_early_optimizations): Rename pass_object_sizes there to pass_early_object_sizes, drop parameter. (pass_all_optimizations): Move pass_object_sizes right after pass_ccp, drop parameter, move pass_post_ipa_warn right after that. * tree-object-size.c (pass_object_sizes::execute): Rename to... (object_sizes_execute): ... this. Add insert_min_max_p argument. (pass_data_object_sizes): Move after object_sizes_execute. (pass_object_sizes): Likewise. In execute method call object_sizes_execute, drop set_pass_param method and insert_min_max_p non-static data member and its initializer in the ctor. (pass_data_early_object_sizes, pass_early_object_sizes, make_pass_early_object_sizes): New. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Use (cfun->curr_properties & PROP_objsz) instead of cfun->after_inlining. * gcc.dg/builtin-object-size-10.c: Pass -fdump-tree-early_objsz-details instead of -fdump-tree-objsz1-details in dg-options and adjust names of dump file in scan-tree-dump. * gcc.dg/pr101419.c: New test.
Diffstat (limited to 'gcc/passes.def')
-rw-r--r--gcc/passes.def6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/passes.def b/gcc/passes.def
index 945d2bc..f5d88a6 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_all_early_optimizations);
PUSH_INSERT_PASSES_WITHIN (pass_all_early_optimizations)
NEXT_PASS (pass_remove_cgraph_callee_edges);
- NEXT_PASS (pass_object_sizes, true /* insert_min_max_p */);
+ NEXT_PASS (pass_early_object_sizes);
/* Don't record nonzero bits before IPA to avoid
using too much memory. */
NEXT_PASS (pass_ccp, false /* nonzero_p */);
@@ -194,14 +194,14 @@ along with GCC; see the file COPYING3. If not see
They ensure memory accesses are not indirect wherever possible. */
NEXT_PASS (pass_strip_predict_hints, false /* early_p */);
NEXT_PASS (pass_ccp, true /* nonzero_p */);
- NEXT_PASS (pass_post_ipa_warn);
/* After CCP we rewrite no longer addressed locals into SSA
form if possible. */
+ NEXT_PASS (pass_object_sizes);
+ NEXT_PASS (pass_post_ipa_warn);
NEXT_PASS (pass_complete_unrolli);
NEXT_PASS (pass_backprop);
NEXT_PASS (pass_phiprop);
NEXT_PASS (pass_forwprop);
- NEXT_PASS (pass_object_sizes, false /* insert_min_max_p */);
/* pass_build_alias is a dummy pass that ensures that we
execute TODO_rebuild_alias at this point. */
NEXT_PASS (pass_build_alias);