[LLVMdev] [PATCH] parallel loop metadata

Sebastian Pop spop at codeaurora.org
Mon Feb 4 08:10:50 PST 2013


Pekka Jääskeläinen wrote:
> Index: llvm/include/llvm/Analysis/LoopInfo.h
> ===================================================================
> --- llvm.orig/include/llvm/Analysis/LoopInfo.h	2013-02-04 11:35:13.036349427 +0200
> +++ llvm/include/llvm/Analysis/LoopInfo.h	2013-02-04 11:37:29.428349395 +0200
> @@ -381,6 +381,20 @@
>    /// isSafeToClone - Return true if the loop body is safe to clone in practice.
>    bool isSafeToClone() const;
>  
> +  /// Returns true if the loop is parallel.

s/is parallel/is annotated parallel/

> +  ///
> +  /// A parallel loop can be assumed to not contain any dependencies between
> +  /// iterations by the compiler. That is, any loop-carried dependency checking
> +  /// can be skipped completely when parallelizing the loop on the target
> +  /// machine. Thus, if the parallel loop information originates from the
> +  /// programmer, e.g. via the OpenMP parallel for pragma, it is the
> +  /// programmer's responsibility to ensure the are no loop-carried

s/the are/there are/

> +  /// dependencies. The final execution order of the instructions across
> +  /// iterations is not guaranteed, thus, the end result might or might
> +  /// implement actual concurrent execution of instructions across multiple
> +  /// iterations.
> +  bool isParallel() const;

I would also make the name of this function a bit more specific to the fact that
it does not compute this property like a data dependence analysis would do: it
expects the code to be tagged with the parallel annotations, so I would suggest:
s/isParallel/isAnnotatedParallel/g

> Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
> ===================================================================
> --- llvm.orig/lib/Transforms/Vectorize/LoopVectorize.cpp	2013-02-04 11:35:13.088349234 +0200
> +++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	2013-02-04 11:37:29.428349395 +0200
> @@ -2265,6 +2265,12 @@
>  }
>  
>  bool LoopVectorizationLegality::canVectorizeMemory() {
> +
> +  if (TheLoop->isParallel()) {
> +    DEBUG(dbgs() << "LV: A parallel loop, ignore memory dependency checks.\n");

s/A parallel loop/A loop annotated parallel/


The patch looks good.

Thanks,
Sebastian
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation



More information about the llvm-commits mailing list