[Bug tree-optimization/63844] [4.8/4.9/5 Regression] open mp parallelization prevents vectorization

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 18 11:34:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63844

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> 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.

For the invalid testcase the DECL_BY_REFERENCE setting isn't needed and
its positive effect on PTA could also be seen if using build_reference_type
instead of build_pointer_type in the first hunk.



More information about the Gcc-bugs mailing list