re PR target/89578 (5% runtime regression for 481.wrf at -Ofast -flto)
authorRichard Biener <rguenther@suse.de>
Fri, 8 Mar 2019 10:20:12 +0000 (10:20 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 8 Mar 2019 10:20:12 +0000 (10:20 +0000)
2019-03-08  Richard Biener  <rguenther@suse.de>

PR middle-end/89578
* cfgloop.h (struct loop): Add owned_clique field.
* cfgloopmanip.c (copy_loop_info): Copy it.
* tree-cfg.c (gimple_duplicate_bb): Do not remap owned_clique
cliques.
* tree-inline.c (copy_loops): Remap owned_clique.
* lto-streamer-in.c (input_cfg): Stream owned_clique.
* lto-streamer-out.c (output_cfg): Likewise.

From-SVN: r269484

gcc/ChangeLog
gcc/cfgloop.h
gcc/cfgloopmanip.c
gcc/lto-streamer-in.c
gcc/lto-streamer-out.c
gcc/tree-cfg.c
gcc/tree-inline.c

index 72a1c3f26fe0a5ab90eadfe6efc3dd4dabe201ae..b46c5aff26618b4a5d7c6ac19f6de09decb8962f 100644 (file)
@@ -1,3 +1,14 @@
+2019-03-08  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/89578
+       * cfgloop.h (struct loop): Add owned_clique field.
+       * cfgloopmanip.c (copy_loop_info): Copy it.
+       * tree-cfg.c (gimple_duplicate_bb): Do not remap owned_clique
+       cliques.
+       * tree-inline.c (copy_loops): Remap owned_clique.
+       * lto-streamer-in.c (input_cfg): Stream owned_clique.
+       * lto-streamer-out.c (output_cfg): Likewise.
+
 2019-03-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/80190
index 2e93af39a1a0f4ef63dc3d34bb47f7fd1203a420..e82cd7a034a43d275f044c9fc3529c6ae1b76f00 100644 (file)
@@ -227,6 +227,10 @@ struct GTY ((chain_next ("%h.next"))) loop {
      Other values means unroll with the given unrolling factor.  */
   unsigned short unroll;
 
+  /* If this loop was inlined the main clique of the callee which does
+     not need remapping when copying the loop body.  */
+  unsigned short owned_clique;
+
   /* For SIMD loops, this is a unique identifier of the loop, referenced
      by IFN_GOMP_SIMD_VF, IFN_GOMP_SIMD_LANE and IFN_GOMP_SIMD_LAST_LANE
      builtins.  */
index 7eb587aaf6157292c7c20e33560e6206c2a59fb1..bfee48ed8ccdea326d56bf252df03f0c2b814fb4 100644 (file)
@@ -1024,6 +1024,7 @@ copy_loop_info (struct loop *loop, struct loop *target)
   target->force_vectorize = loop->force_vectorize;
   target->in_oacc_kernels_region = loop->in_oacc_kernels_region;
   target->unroll = loop->unroll;
+  target->owned_clique = loop->owned_clique;
 }
 
 /* Copies copy of LOOP as subloop of TARGET loop, placing newly
index 6d78e66bc31780d6a36c56d672e2649c273af585..7727b9be760f34e6dcfb49a4c5c7bf0479585e2c 100644 (file)
@@ -826,6 +826,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
       /* Read OMP SIMD related info.  */
       loop->safelen = streamer_read_hwi (ib);
       loop->unroll = streamer_read_hwi (ib);
+      loop->owned_clique = streamer_read_hwi (ib);
       loop->dont_vectorize = streamer_read_hwi (ib);
       loop->force_vectorize = streamer_read_hwi (ib);
       loop->simduid = stream_read_tree (ib, data_in);
index a72016a48432f251d229f4d1de4a80e76e29e5df..b6e395b53fd994cf5171a23a74338316e95fb191 100644 (file)
@@ -1938,6 +1938,7 @@ output_cfg (struct output_block *ob, struct function *fn)
       /* Write OMP SIMD related info.  */
       streamer_write_hwi (ob, loop->safelen);
       streamer_write_hwi (ob, loop->unroll);
+      streamer_write_hwi (ob, loop->owned_clique);
       streamer_write_hwi (ob, loop->dont_vectorize);
       streamer_write_hwi (ob, loop->force_vectorize);
       stream_write_tree (ob, loop->simduid, true);
index 088fc7b47dfeb1c3e0e0f4d6c2a888e54997fb24..f433efc89c0fc53c8a038773d238314543d983ac 100644 (file)
@@ -6244,7 +6244,8 @@ gimple_duplicate_bb (basic_block bb, copy_bb_data *id)
              op = TREE_OPERAND (op, 0);
            if ((TREE_CODE (op) == MEM_REF
                 || TREE_CODE (op) == TARGET_MEM_REF)
-               && MR_DEPENDENCE_CLIQUE (op) > 1)
+               && MR_DEPENDENCE_CLIQUE (op) > 1
+               && MR_DEPENDENCE_CLIQUE (op) != bb->loop_father->owned_clique)
              {
                if (!id->dependence_map)
                  id->dependence_map = new hash_map<dependence_hash,
index d3e53d2cb38804f4e324c8816e6d6ee896b4ab70..956e39f97682a83042782b9127b751ae8eb3d75d 100644 (file)
@@ -2670,6 +2670,11 @@ copy_loops (copy_body_data *id,
            cfun->has_unroll = true;
          if (dest_loop->force_vectorize)
            cfun->has_force_vectorize_loops = true;
+         if (id->src_cfun->last_clique != 0)
+           dest_loop->owned_clique
+             = remap_dependence_clique (id,
+                                        src_loop->owned_clique
+                                        ? src_loop->owned_clique : 1);
 
          /* Finally place it into the loop array and the loop tree.  */
          place_new_loop (cfun, dest_loop);