[polly] r249010 - [FIX] Parallel codegen for invariant loads
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 06:40:36 PDT 2015
Author: jdoerfert
Date: Thu Oct 1 08:40:36 2015
New Revision: 249010
URL: http://llvm.org/viewvc/llvm-project?rev=249010&view=rev
Log:
[FIX] Parallel codegen for invariant loads
Hand down all preloaded values to the parallel subfunction.
Added:
polly/trunk/test/Isl/CodeGen/OpenMP/invariant_base_pointer_preloaded.ll
Modified:
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=249010&r1=249009&r2=249010&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Thu Oct 1 08:40:36 2015
@@ -590,6 +590,11 @@ void IslNodeBuilder::createForParallel(_
SubtreeValues.insert(V);
}
+ // Values preloaded prior to the SCoP need to be available in the subfunction.
+ const auto &InvariantAccesses = S.getInvariantAccesses();
+ for (const InvariantAccessTy &IA : InvariantAccesses)
+ SubtreeValues.insert(ValueMap[IA.first->getAccessInstruction()]);
+
ParallelLoopGenerator::ValueToValueMapTy NewValues;
ParallelLoopGenerator ParallelLoopGen(Builder, P, LI, DT, DL);
Added: polly/trunk/test/Isl/CodeGen/OpenMP/invariant_base_pointer_preloaded.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/OpenMP/invariant_base_pointer_preloaded.ll?rev=249010&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/OpenMP/invariant_base_pointer_preloaded.ll (added)
+++ polly/trunk/test/Isl/CodeGen/OpenMP/invariant_base_pointer_preloaded.ll Thu Oct 1 08:40:36 2015
@@ -0,0 +1,33 @@
+; RUN: opt %loadPolly -polly-codegen -polly-parallel \
+; RUN: -polly-parallel-force -polly-detect-unprofitable -S < %s | FileCheck %s
+;
+; Test to verify that we hand down the preloaded A[0] to the OpenMP subfunction.
+;
+; void f(float *A) {
+; for (int i = 1; i < 1000; i++)
+; A[i] += A[0];
+; }
+;
+; CHECK: %polly.subfn.storeaddr.polly.access.A.load = getelementptr inbounds { float*, float }, { float*, float }* %polly.par.userContext, i32 0, i32 1
+; CHECK: store float %polly.access.A.load, float* %polly.subfn.storeaddr.polly.access.A.load
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f(float* nocapture %A) {
+entry:
+ br label %for.body
+
+for.cond.cleanup: ; preds = %for.body
+ ret void
+
+for.body: ; preds = %for.body, %entry
+ %indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.body ]
+ %tmp = load float, float* %A, align 4
+ %arrayidx1 = getelementptr inbounds float, float* %A, i64 %indvars.iv
+ %tmp1 = load float, float* %arrayidx1, align 4
+ %add = fadd float %tmp, %tmp1
+ store float %add, float* %arrayidx1, align 4
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %exitcond = icmp eq i64 %indvars.iv.next, 1000
+ br i1 %exitcond, label %for.cond.cleanup, label %for.body
+}
More information about the llvm-commits
mailing list