summaryrefslogtreecommitdiffstats
path: root/polly
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2017-03-18 20:10:07 +0000
committerTobias Grosser <tobias@grosser.es>2017-03-18 20:10:07 +0000
commit7693b116a1565d7428460d66c17a2e9b50148dcc (patch)
treeef29083bf059e192cbb9619282eea0152da89965 /polly
parentd55e153b8777268c10c33a2210a2ad994114a90d (diff)
downloadbcm5719-llvm-7693b116a1565d7428460d66c17a2e9b50148dcc.tar.gz
bcm5719-llvm-7693b116a1565d7428460d66c17a2e9b50148dcc.zip
[OpenMP] Do not emit lifetime markers for context
In commit r219005 lifetime markers have been introduced to mark the lifetime of the OpenMP context data structure. However, their use seems incorrect and recently caused a miscompile in ASC_Sequoia/CrystalMk after r298053 which was not at all related to r298053. r298053 only caused a change in the loop order, as this change resulted in a different isl internal representation which caused the scheduler to derive a different schedule. This change then caused the IR to change, which apparently created a pattern in which LLVM exploites the lifetime markers. It seems we are using the OpenMP context outside of the lifetime markers. Even though CrystalMk could probably be fixed by expanding the scope of the lifetime markers, it is not clear what happens in case the OpenMP function call is in a loop which will cause a sequence of starting and ending lifetimes. As it is unlikely that the lifetime markers give any performance benefit, we just drop them to remove complexity. llvm-svn: 298192
Diffstat (limited to 'polly')
-rw-r--r--polly/include/polly/CodeGen/LoopGenerators.h5
-rw-r--r--polly/lib/CodeGen/LoopGenerators.cpp9
-rw-r--r--polly/test/Isl/CodeGen/OpenMP/loop-body-references-outer-values.ll2
-rw-r--r--polly/test/Isl/CodeGen/OpenMP/loop-bounds-reference-outer-ids.ll4
-rw-r--r--polly/test/Isl/CodeGen/OpenMP/single_loop.ll8
5 files changed, 4 insertions, 24 deletions
diff --git a/polly/include/polly/CodeGen/LoopGenerators.h b/polly/include/polly/CodeGen/LoopGenerators.h
index a991a93fe1d..023ebbf9f37 100644
--- a/polly/include/polly/CodeGen/LoopGenerators.h
+++ b/polly/include/polly/CodeGen/LoopGenerators.h
@@ -101,7 +101,7 @@ public:
/// Create a parallel loop generator for the current function.
ParallelLoopGenerator(PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
DominatorTree &DT, const DataLayout &DL)
- : Builder(Builder), P(P), LI(LI), DT(DT), DL(DL),
+ : Builder(Builder), P(P), LI(LI), DT(DT),
LongType(
Type::getIntNTy(Builder.getContext(), DL.getPointerSizeInBits())),
M(Builder.GetInsertBlock()->getParent()->getParent()) {}
@@ -140,9 +140,6 @@ private:
/// The dominance tree of the current function we need to update.
DominatorTree &DT;
- /// The target layout to get the right size for types.
- const DataLayout &DL;
-
/// The type of a "long" on this hardware used for backend calls.
Type *LongType;
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index d01e85fc2dd..fe7e95368c3 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -167,11 +167,6 @@ Value *ParallelLoopGenerator::createParallelLoop(
Builder.CreateCall(SubFn, SubFnParam);
createCallJoinThreads();
- // Mark the end of the lifetime for the parameter struct.
- Type *Ty = Struct->getType();
- ConstantInt *SizeOf = Builder.getInt64(DL.getTypeAllocSize(Ty));
- Builder.CreateLifetimeEnd(Struct, SizeOf);
-
return IV;
}
@@ -294,10 +289,6 @@ ParallelLoopGenerator::storeValuesIntoStruct(SetVector<Value *> &Values) {
StructType *Ty = StructType::get(Builder.getContext(), Members);
AllocaInst *Struct = new AllocaInst(Ty, nullptr, "polly.par.userContext", IP);
- // Mark the start of the lifetime for the parameter struct.
- ConstantInt *SizeOf = Builder.getInt64(DL.getTypeAllocSize(Ty));
- Builder.CreateLifetimeStart(Struct, SizeOf);
-
for (unsigned i = 0; i < Values.size(); i++) {
Value *Address = Builder.CreateStructGEP(Ty, Struct, i);
Address->setName("polly.subfn.storeaddr." + Values[i]->getName());
diff --git a/polly/test/Isl/CodeGen/OpenMP/loop-body-references-outer-values.ll b/polly/test/Isl/CodeGen/OpenMP/loop-body-references-outer-values.ll
index 32f88d558ea..9bbc125acf6 100644
--- a/polly/test/Isl/CodeGen/OpenMP/loop-body-references-outer-values.ll
+++ b/polly/test/Isl/CodeGen/OpenMP/loop-body-references-outer-values.ll
@@ -15,8 +15,6 @@
; AST: Stmt_for_body(c0);
; IR-LABEL: polly.parallel.for:
-; IR-NEXT: %0 = bitcast { float* }* %polly.par.userContext to i8*
-; IR-NEXT: call void @llvm.lifetime.start(i64 8, i8* %0)
; IR-NEXT: %polly.subfn.storeaddr.A = getelementptr inbounds { float* }, { float* }* %polly.par.userContext, i32 0, i32 0
; IR-NEXT: store float* %A, float** %polly.subfn.storeaddr.A
; IR-NEXT: %polly.par.userContext1 = bitcast { float* }* %polly.par.userContext to i8*
diff --git a/polly/test/Isl/CodeGen/OpenMP/loop-bounds-reference-outer-ids.ll b/polly/test/Isl/CodeGen/OpenMP/loop-bounds-reference-outer-ids.ll
index 85cd46d41dd..f72e89377f7 100644
--- a/polly/test/Isl/CodeGen/OpenMP/loop-bounds-reference-outer-ids.ll
+++ b/polly/test/Isl/CodeGen/OpenMP/loop-bounds-reference-outer-ids.ll
@@ -23,9 +23,7 @@
; AST: Stmt_for_body6(c0, c1, c2);
; IR: %polly.par.userContext = alloca { i64, i64 }
-; IR: %[[R0:[0-9a-z.]+]] = bitcast { i64, i64 }* %polly.par.userContext to i8*
-; IR-NEXT: call void @llvm.lifetime.start(i64 16, i8* %[[R0]])
-; IR-NEXT: %[[R1:[0-9a-z.]+]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %polly.par.userContext, i32 0, i32 0
+; IR: %[[R1:[0-9a-z.]+]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %polly.par.userContext, i32 0, i32 0
; IR-NEXT: store i64 %n, i64* %[[R1]]
; IR-NEXT: %[[R2:[0-9a-z.]+]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* %polly.par.userContext, i32 0, i32 1
; IR-NEXT: store i64 %polly.indvar, i64* %[[R2]]
diff --git a/polly/test/Isl/CodeGen/OpenMP/single_loop.ll b/polly/test/Isl/CodeGen/OpenMP/single_loop.ll
index f43d1c395a3..eced8ea3a09 100644
--- a/polly/test/Isl/CodeGen/OpenMP/single_loop.ll
+++ b/polly/test/Isl/CodeGen/OpenMP/single_loop.ll
@@ -31,17 +31,13 @@
; IR-NEXT: %polly.par.userContext = alloca
; IR-LABEL: polly.parallel.for:
-; IR-NEXT: %0 = bitcast {}* %polly.par.userContext to i8*
-; IR-NEXT: call void @llvm.lifetime.start(i64 0, i8* %0)
; IR-NEXT: %polly.par.userContext1 = bitcast {}* %polly.par.userContext to i8*
; IR-NEXT: call void @GOMP_parallel_loop_runtime_start(void (i8*)* @single_parallel_loop_polly_subfn, i8* %polly.par.userContext1, i32 0, i64 0, i64 1024, i64 1)
; IR-NEXT: call void @single_parallel_loop_polly_subfn(i8* %polly.par.userContext1)
; IR-NEXT: call void @GOMP_parallel_end()
-; IR-NEXT: %1 = bitcast {}* %polly.par.userContext to i8*
-; IR-NEXT: call void @llvm.lifetime.end(i64 8, i8* %1)
; IR-NEXT: br label %polly.exiting
-; IR: define internal void @single_parallel_loop_polly_subfn(i8* %polly.par.userContext) #2
+; IR: define internal void @single_parallel_loop_polly_subfn(i8* %polly.par.userContext) #1
; IR-LABEL: polly.par.setup:
; IR-NEXT: %polly.par.LBPtr = alloca i64
; IR-NEXT: %polly.par.UBPtr = alloca i64
@@ -81,7 +77,7 @@
; IR-LABEL: polly.loop_preheader:
; IR-NEXT: br label %polly.loop_header
-; IR: attributes #2 = { "polly.skip.fn" }
+; IR: attributes #1 = { "polly.skip.fn" }
; IR-STRIDE4: call void @GOMP_parallel_loop_runtime_start(void (i8*)* @single_parallel_loop_polly_subfn, i8* %polly.par.userContext1, i32 0, i64 0, i64 1024, i64 4)
; IR-STRIDE4: add nsw i64 %polly.indvar, 3
OpenPOWER on IntegriCloud