aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalaji V. Iyer <balaji.v.iyer@intel.com>2012-12-14 05:03:10 +0000
committerBalaji V. Iyer <balaji.v.iyer@intel.com>2012-12-14 05:03:10 +0000
commit453e017cda6ec2e434029ac20a3d13007696b7be (patch)
tree6e1dbf289f1b73c533c4cd61a2156dac8c8fd7b3
parentf4d5a299b5ec1b940a1bbfc74f8d9b1ab0a47ec3 (diff)
Fixed an issue pragma simd index being lost and checking if [simd]assert
is called. +2012-12-13 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * tree-vect-loop.c (vect_determine_vectorization_factor): Added a + check if assert is requested in simd pragma. + (vect_analyze_loop_form): Likewise. + (vect_analyze_loop_operations): Likewise. + (vect_analyze_loop): Likewise. + * tree-cfgcleanup.c (remove_forwarder_block): Copied the pragma + simd struct index from the removed bb to the destination basic block. + * cfgloop.c (flow_loops_find): Added flag_enable_cilk check. + * tree-cfg.c (gimple_merge_blocks): Copied the pragma simd struct + index from the source to destination. + (remove_bb): Likewise. + git-svn-id: https://gcc.gnu.org/svn/gcc/branches/cilkplus@194496 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.cilkplus14
-rw-r--r--gcc/cfgloop.c10
-rw-r--r--gcc/tree-cfg.c11
-rw-r--r--gcc/tree-cfgcleanup.c5
-rw-r--r--gcc/tree-vect-loop.c156
5 files changed, 169 insertions, 27 deletions
diff --git a/gcc/ChangeLog.cilkplus b/gcc/ChangeLog.cilkplus
index 227c4b0ce29..bd210e35205 100644
--- a/gcc/ChangeLog.cilkplus
+++ b/gcc/ChangeLog.cilkplus
@@ -1,3 +1,17 @@
+2012-12-13 Balaji V. Iyer <balaji.v.iyer@intel.com>
+
+ * tree-vect-loop.c (vect_determine_vectorization_factor): Added a
+ check if assert is requested in simd pragma.
+ (vect_analyze_loop_form): Likewise.
+ (vect_analyze_loop_operations): Likewise.
+ (vect_analyze_loop): Likewise.
+ * tree-cfgcleanup.c (remove_forwarder_block): Copied the pragma
+ simd struct index from the removed bb to the destination basic block.
+ * cfgloop.c (flow_loops_find): Added flag_enable_cilk check.
+ * tree-cfg.c (gimple_merge_blocks): Copied the pragma simd struct
+ index from the source to destination.
+ (remove_bb): Likewise.
+
2012-12-12 Balaji V. Iyer <balaji.v.iyer@intel.com>
* c/c-objc-common.h (LANG_HOOKS_CILK_CHECK_CTRL_FLOW): New define.
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 372d5c20ffc..a3a62773ff7 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -423,8 +423,11 @@ flow_loops_find (struct loops *loops)
bitmap_set_bit (headers, header->index);
/* Here we are going to copy the pragma simd value from
the latch to the header. */
- if ((header->pragma_simd_index == 0)
- && (latch->pragma_simd_index != 0))
+ if (flag_enable_cilk
+ && (header->pragma_simd_index == 0
+ || header->pragma_simd_index == INVALID_PRAGMA_SIMD_SLOT)
+ && (latch->pragma_simd_index != 0
+ || latch->pragma_simd_index != INVALID_PRAGMA_SIMD_SLOT))
header->pragma_simd_index = latch->pragma_simd_index;
num_loops++;
}
@@ -466,7 +469,8 @@ flow_loops_find (struct loops *loops)
loop->header = header;
loop->num = num_loops;
- loop->pragma_simd_index = header->pragma_simd_index;
+ if (flag_enable_cilk)
+ loop->pragma_simd_index = header->pragma_simd_index;
num_loops++;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 4d08559db5f..33a5e2d00d7 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1631,6 +1631,11 @@ gimple_merge_blocks (basic_block a, basic_block b)
if (dump_file)
fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
+ if (flag_enable_cilk && b->pragma_simd_index != 0
+ && (a->pragma_simd_index == 0
+ || a->pragma_simd_index == INVALID_PRAGMA_SIMD_SLOT))
+ a->pragma_simd_index = b->pragma_simd_index;
+
/* Remove all single-valued PHI nodes from block B of the form
V_i = PHI <V_j> by propagating V_j to all the uses of V_i. */
gsi = gsi_last_bb (a);
@@ -1897,7 +1902,11 @@ remove_bb (basic_block bb)
remove_phi_nodes_and_edges_for_unreachable_block (bb);
bb->il.gimple.seq = NULL;
bb->il.gimple.phi_nodes = NULL;
- bb->next_bb->pragma_simd_index = bb->pragma_simd_index;
+ if (flag_enable_cilk
+ && bb->next_bb->pragma_simd_index == 0
+ && bb->pragma_simd_index != 0
+ && bb->pragma_simd_index != INVALID_PRAGMA_SIMD_SLOT)
+ bb->next_bb->pragma_simd_index = bb->pragma_simd_index;
}
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index f838e809982..13f60b3f326 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -346,6 +346,11 @@ remove_forwarder_block (basic_block bb)
if (dest == bb)
return false;
+ if (flag_enable_cilk && bb->pragma_simd_index != 0
+ && (dest->pragma_simd_index == 0
+ || dest->pragma_simd_index == INVALID_PRAGMA_SIMD_SLOT))
+ dest->pragma_simd_index = bb->pragma_simd_index;
+
/* If the destination block consists of a nonlocal label or is a
EH landing pad, do not merge it. */
label = first_stmt (dest);
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 34eeadad643..9dc009636a9 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -234,8 +234,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by Pragma SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
}
return false;
}
@@ -412,8 +412,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by PRAGMA SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by PRAGMA SIMD");
}
return false;
}
@@ -429,8 +429,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by PRAGMA SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by PRAGMA SIMD");
}
return false;
}
@@ -470,8 +470,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by PRAGMA SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by PRAGMA SIMD");
}
return false;
}
@@ -518,8 +518,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by PRAGMA SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by PRAGMA SIMD");
}
return false;
}
@@ -541,8 +541,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by PRAGMA SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by PRAGMA SIMD");
}
return false;
}
@@ -607,8 +607,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (flag_enable_cilk && pragma_simd_assert_requested_p
(loop->pragma_simd_index))
{
- error ("Loop not vectorized. "
- "Exiting as requested by Pragma SIMD");
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
}
return false;
}
@@ -1188,17 +1188,25 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: control flow in loop.");
+ "not vectorized: control flow in loop.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return NULL;
}
if (empty_block_p (loop->header))
- {
+ {
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: empty loop.");
- return NULL;
- }
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
+ return NULL;
+ }
}
else
{
@@ -1227,6 +1235,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: multiple nested loops.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return NULL;
}
@@ -1237,6 +1249,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: Bad inner loop.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return NULL;
}
@@ -1246,6 +1262,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: inner-loop count not invariant.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
}
@@ -1255,6 +1275,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: control flow in loop.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
}
@@ -1271,6 +1295,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: unsupported outerloop form.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
}
@@ -1286,11 +1314,21 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
{
if (!single_exit (loop))
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: multiple exits.");
+ {
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: multiple exits.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
+ }
else if (EDGE_COUNT (loop->header->preds) != 2)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: too many incoming edges.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
}
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
@@ -1307,6 +1345,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: unexpected loop form.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1327,6 +1369,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: abnormal loop exit edge.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1339,6 +1385,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: complicated exit condition.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1350,6 +1400,10 @@ vect_analyze_loop_form (struct loop *loop)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: number of iterations cannot be "
"computed.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1379,6 +1433,10 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: number of iterations = 0.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, false);
return NULL;
@@ -1540,6 +1598,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: value used after loop.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1550,6 +1612,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: scalar dependence cycle.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1568,6 +1634,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
"not vectorized: relevant phi not "
"supported: ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, phi, 0);
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
}
return false;
}
@@ -1595,6 +1665,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: redundant loop. no profit to "
"vectorize.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1616,6 +1690,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: iteration count smaller than "
"vectorization factor.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1638,6 +1716,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: vector version will never be "
"profitable.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1665,6 +1747,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
"not vectorized: iteration count smaller than user "
"specified loop bound parameter or minimum profitable "
"iterations (whichever is more conservative).");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1682,6 +1768,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
"than specified loop bound parameter or minimum "
"profitable iterations (whichever is more "
"conservative).");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
@@ -1696,6 +1786,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: can't create epilog loop 1.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
@@ -1703,6 +1797,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: can't create epilog loop 2.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
return false;
}
}
@@ -1735,7 +1833,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data references.");
+ "bad data references.");
return false;
}
@@ -1903,6 +2001,13 @@ vect_analyze_loop (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"bad loop form.");
+ if (flag_enable_cilk && pragma_simd_assert_requested_p
+ (loop->pragma_simd_index))
+ {
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
+ }
+
return NULL;
}
@@ -1918,8 +2023,13 @@ vect_analyze_loop (struct loop *loop)
vector_sizes &= ~current_vector_size;
if (vector_sizes == 0
|| current_vector_size == 0)
- return NULL;
-
+ {
+ if (flag_enable_cilk
+ && pragma_simd_assert_requested_p (loop->pragma_simd_index))
+ fatal_error ("Loop not vectorized. "
+ "Exiting as requested by Pragma SIMD");
+ return NULL;
+ }
/* Try the next biggest vector size. */
current_vector_size = 1 << floor_log2 (vector_sizes);
if (dump_enabled_p ())