Handle unused reduction in create_loads_for_reductions
authorTom de Vries <tom@codesourcery.com>
Thu, 16 Jul 2015 11:51:28 +0000 (11:51 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 16 Jul 2015 11:51:28 +0000 (11:51 +0000)
2015-07-16  Tom de Vries  <tom@codesourcery.com>

* tree-parloops.c (create_loads_for_reductions): Handle case that
reduction is unused.

From-SVN: r225872

gcc/ChangeLog
gcc/tree-parloops.c

index 1d5434c3bb9127e2725a450fa8d53b25a3c63993..cfdf5e75747f318df23598441563d155289b41ad 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-16  Tom de Vries  <tom@codesourcery.com>
+
+       * tree-parloops.c (create_loads_for_reductions): Handle case that
+       reduction is unused.
+
 2015-07-16  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/66894
index 036677bb123f59a578df92d4d394c378ca95d213..2390d9ec5058dfca0cacca1b86655744d3128315 100644 (file)
@@ -1145,6 +1145,10 @@ create_loads_for_reductions (reduction_info **slot, struct clsn_data *clsn_data)
   tree name;
   tree x;
 
+  /* If there's no exit phi, the result of the reduction is unused.  */
+  if (red->keep_res == NULL)
+    return 1;
+
   gsi = gsi_after_labels (clsn_data->load_bb);
   load_struct = build_simple_mem_ref (clsn_data->load);
   load_struct = build3 (COMPONENT_REF, type, load_struct, red->field,