From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19544 invoked by alias); 18 Nov 2014 11:13:58 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19499 invoked by uid 48); 18 Nov 2014 11:13:53 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63844] [4.8/4.9/5 Regression] open mp parallelization prevents vectorization Date: Tue, 18 Nov 2014 11:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.9.3 X-Bugzilla-Keywords: missed-optimization, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01627.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63844 --- Comment #7 from Richard Biener --- Ok, I think Tom had a similar patch for this but passing the .omp_data_i by effective "reference" (restrict qualified pointer and DECL_BY_REFERENCE) fixes this. Index: gcc/omp-low.c =================================================================== --- gcc/omp-low.c (revision 217692) +++ gcc/omp-low.c (working copy) @@ -1517,7 +1517,8 @@ fixup_child_record_type (omp_context *ct layout_type (type); } - TREE_TYPE (ctx->receiver_decl) = build_pointer_type (type); + TREE_TYPE (ctx->receiver_decl) + = build_qualified_type (build_pointer_type (type), TYPE_QUAL_RESTRICT); } /* Instantiate decls as necessary in CTX to satisfy the data sharing @@ -2006,6 +2007,7 @@ create_omp_child_function (omp_context * DECL_NAMELESS (t) = 1; DECL_ARG_TYPE (t) = ptr_type_node; DECL_CONTEXT (t) = current_function_decl; + DECL_BY_REFERENCE (t) = 1; TREE_USED (t) = 1; if (cilk_for_count) DECL_CHAIN (t) = DECL_ARGUMENTS (decl); there are more similar objects built, so the above may not fully optimize all cases.