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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, so it started with ipa modref change, I was able to reduce it 5
pre-processed source files. Unfortunately, one needs at least 2 LTRANS.
What happens is that:

builtin/fetch.c:
...
static int iterate_ref_map2(void *cb_data, struct object_id *oid)
{
        struct ref **rm = cb_data;
        struct ref *ref = *rm;

        while (ref && ref->status == REF_STATUS_REJECT_SHALLOW)
                ref = ref->next;
        if (!ref)
                return -1; /* end of the list */
        *rm = ref->next;
        oidcpy(oid, &ref->old_oid);
        return 0;
}

the following 2 statements are optimized out (I think in PRE in ltrans1):

        *rm = ref->next;
        oidcpy(oid, &ref->old_oid);

Bad run:
gcc -flto=auto -o xxx -fdump-tree-optimized -shared -fPIC -fipa-pta *.i -O2

Good one:
gcc -flto=auto -o xxx -fdump-tree-optimized -shared -fPIC *.i -O2

$ diff -u xxx.ltrans1.ltrans.248t.optimized.good
xxx.ltrans1.ltrans.248t.optimized.bad

-;; Function iterate_ref_map2 (iterate_ref_map2, funcdef_no=7, decl_uid=4567,
cgraph_uid=27, symbol_order=7008)
+;; Function iterate_ref_map2 (iterate_ref_map2, funcdef_no=65, decl_uid=4567,
cgraph_uid=27, symbol_order=7008)

+Removing basic block 6
 Removing basic block 7
 Removing basic block 8
 Removing basic block 9
@@ -264,51 +265,39 @@
 {
   struct ref * ref;
   <unnamed type> _1;
-  struct ref * pretmp_4;
   int _5;
-  const unsigned char[32] * _13;
-  unsigned char[32] * _14;
-  int _15;

   <bb 2> [local count: 114863530]:
   ref_9 = MEM[(struct ref * *)cb_data_7(D)];
   if (ref_9 != 0B)
     goto <bb 4>; [94.50%]
   else
-    goto <bb 6>; [5.50%]
+    goto <bb 5>; [5.50%]

   <bb 3> [local count: 958878296]:
-  if (pretmp_4 != 0B)
+  ref_10 = ref_3->next;
+  if (ref_10 != 0B)
     goto <bb 4>; [94.50%]
   else
-    goto <bb 6>; [5.50%]
+    goto <bb 5>; [5.50%]

   <bb 4> [local count: 1014686026]:
-  # ref_21 = PHI <pretmp_4(3), ref_9(2)>
-  _1 = ref_21->status;
-  pretmp_4 = ref_21->next;
+  # ref_3 = PHI <ref_10(3), ref_9(2)>
+  _1 = ref_3->status;
   if (_1 == 8)
     goto <bb 3>; [94.50%]
   else
     goto <bb 5>; [5.50%]

-  <bb 5> [local count: 55807731]:
-  MEM[(struct ref * *)cb_data_7(D)] = pretmp_4;
-  _13 = &MEM[(const struct object_id *)ref_21 + 8B].hash;
-  _14 = &oid_12(D)->hash;
-  memcpy (_14, _13, 32);
-  _15 = MEM[(const struct object_id *)ref_21 + 8B].algo;
-  oid_12(D)->algo = _15;
-
-  <bb 6> [local count: 114863531]:
-  # _5 = PHI <-1(3), 0(5), -1(2)>
+  <bb 5> [local count: 114863531]:
+  # _5 = PHI <-1(3), 0(4), -1(2)>
   return _5;

 }

I'm trying reducing that even more..

Reply via email to