From patchwork Fri Dec 14 04:59:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iyer, Balaji V" X-Patchwork-Id: 206292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 255222C0097 for ; Fri, 14 Dec 2012 15:59:29 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356065970; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Subject:Date:Message-ID:Content-Type: MIME-Version:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=1JhjcNA zV/kfk1GrdtYfKtll/bA=; b=QLPbzvA7XeRDxjoyigOpQ1ng7zxtoSHgJghs8qB XYWpptWfgGSWICYHGLkwVF+a26zoYdLx6iFmb2louRaqMM5Ag8wyJ9r4swoxb/si YpO7p8tngVn45uxqNbkYvtPDaVuaK4bTmixqwOK7HvgFPBYiisNUIwlJ5L5fR5Lo hBgA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-ExtLoop1:Received:Received:Received:From:To:Subject:Date:Message-ID:Content-Type:MIME-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=w4sVpDeRJD0msOmy+IYTA+7vQRo8NtLwukoewE5jMAJLq9/SKFKVfX+q5Kvm9L mXpC2f44rVmKCqT8DKqAN5GXx2Sf42L61Mydl/mU25japQSb1hH8cGB/2VCXlzQJ fRjp+HYehxFB3sVAC5nT/39E580fxqm25uCUViDqC2h5A=; Received: (qmail 14098 invoked by alias); 14 Dec 2012 04:59:16 -0000 Received: (qmail 14040 invoked by uid 22791); 14 Dec 2012 04:59:15 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, TW_BJ, TW_TM X-Spam-Check-By: sourceware.org Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Dec 2012 04:59:08 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 13 Dec 2012 20:59:04 -0800 X-ExtLoop1: 1 Received: from fmsmsx106.amr.corp.intel.com ([10.19.9.37]) by fmsmga001.fm.intel.com with ESMTP; 13 Dec 2012 20:59:03 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.19.9.52) by FMSMSX106.amr.corp.intel.com (10.19.9.37) with Microsoft SMTP Server (TLS) id 14.1.355.2; Thu, 13 Dec 2012 20:59:03 -0800 Received: from fmsmsx102.amr.corp.intel.com ([169.254.2.188]) by FMSMSX101.amr.corp.intel.com ([169.254.1.247]) with mapi id 14.01.0355.002; Thu, 13 Dec 2012 20:59:03 -0800 From: "Iyer, Balaji V" To: "gcc-patches@gcc.gnu.org" Subject: [PATCH][Cilkplus] Fix pragma simd info being lost Date: Fri, 14 Dec 2012 04:59:02 +0000 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello Everyone, This patch is for the Cilk Plus branch mainly affecting both C and C++ compilers. Some of the pragma simd structure's indices were getting lost and this patch will restore them. It will also insert the appropriate error messages when assert (in pragma simd) is requested in some places that were omitted. Thanks, Balaji V. Iyer. Index: ChangeLog.cilkplus =================================================================== --- ChangeLog.cilkplus (revision 194483) +++ ChangeLog.cilkplus (working copy) @@ -1,3 +1,17 @@ +2012-12-13 Balaji V. Iyer + + * 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 * c/c-objc-common.h (LANG_HOOKS_CILK_CHECK_CTRL_FLOW): New define. Index: tree-vect-loop.c =================================================================== --- tree-vect-loop.c (revision 194483) +++ tree-vect-loop.c (working copy) @@ -234,8 +234,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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,18 +1188,26 @@ { 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 { struct loop *innerloop = loop->inner; @@ -1227,6 +1235,10 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ "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 @@ 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 @@ 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 @@ 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 @@ "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 @@ "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 @@ 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 @@ 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 @@ { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "bad data references."); + "bad data references."); return false; } @@ -1903,6 +2001,13 @@ 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 @@ 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 ()) Index: tree-cfgcleanup.c =================================================================== --- tree-cfgcleanup.c (revision 194483) +++ tree-cfgcleanup.c (working copy) @@ -346,6 +346,11 @@ 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); Index: cfgloop.c =================================================================== --- cfgloop.c (revision 194483) +++ cfgloop.c (working copy) @@ -423,8 +423,11 @@ 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 @@ 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++; Index: tree-cfg.c =================================================================== --- tree-cfg.c (revision 194483) +++ tree-cfg.c (working copy) @@ -1631,6 +1631,11 @@ 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 by propagating V_j to all the uses of V_i. */ gsi = gsi_last_bb (a); @@ -1897,7 +1902,11 @@ 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; }