[Bug tree-optimization/101419] [9/10/11/12 Regression] collapsing memset() calls can break __builtin_object_size()

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 12 11:51:17 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think none of

      NEXT_PASS (pass_complete_unrolli);
      NEXT_PASS (pass_backprop);
      NEXT_PASS (pass_phiprop);
      NEXT_PASS (pass_forwprop);

are useful for objsize so IMHO we should move pass_object_sizes earlier.  CCP
and it's into SSA are probably useful though.  Like the following (untested):

diff --git a/gcc/passes.def b/gcc/passes.def
index 945d2bc797c..fd38e1f2d8e 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -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, false /* insert_min_max_p */);
+      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);


More information about the Gcc-bugs mailing list