diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-05-05 04:56:26 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-05-05 04:56:26 +0000 |
commit | f4497be0bbb98a6ebc00dc7ee7af4c6d56a9c9d6 (patch) | |
tree | bd547f99eda00c377310f34e4f41ae9f42bc1d98 /clang/lib/CodeGen/CGOpenMPRuntime.cpp | |
parent | 329731ea759b1083512fe328a4178b17f625ac38 (diff) | |
download | bcm5719-llvm-f4497be0bbb98a6ebc00dc7ee7af4c6d56a9c9d6.tar.gz bcm5719-llvm-f4497be0bbb98a6ebc00dc7ee7af4c6d56a9c9d6.zip |
Revert revision 236480: [OPENMP] Fixed incorrect work with cleanups, NFC.
Due to some incompatibilities with Windows.
llvm-svn: 236481
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index d15faeb5771..a0c02ce8682 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1154,22 +1154,16 @@ llvm::Value *CGOpenMPRuntime::getCriticalRegionLock(StringRef CriticalName) { } namespace { -template <int N> class CallEndCleanup : public EHScopeStack::Cleanup { +class CallEndCleanup : public EHScopeStack::Cleanup { public: typedef ArrayRef<llvm::Value *> CleanupValuesTy; - private: llvm::Value *Callee; - llvm::Value *Args[N]; + llvm::SmallVector<llvm::Value *, 8> Args; public: - CallEndCleanup(llvm::Value *Callee, CleanupValuesTy CleanupArgs) - : Callee(Callee) { - assert(CleanupArgs.size() == N); - for (unsigned i = 0; i < N; ++i) { - Args[i] = CleanupArgs[i]; - } - } + CallEndCleanup(llvm::Value *Callee, CleanupValuesTy Args) + : Callee(Callee), Args(Args.begin(), Args.end()) {} void Emit(CodeGenFunction &CGF, Flags /*flags*/) override { CGF.EmitRuntimeCall(Callee, Args); } @@ -1190,7 +1184,7 @@ void CGOpenMPRuntime::emitCriticalRegion(CodeGenFunction &CGF, getCriticalRegionLock(CriticalName)}; CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_critical), Args); // Build a call to __kmpc_end_critical - CGF.EHStack.pushCleanup<CallEndCleanup<array_lengthof(Args)>>( + CGF.EHStack.pushCleanup<CallEndCleanup>( NormalAndEHCleanup, createRuntimeFunction(OMPRTL__kmpc_end_critical), llvm::makeArrayRef(Args)); emitInlinedDirective(CGF, CriticalOpGen); @@ -1228,7 +1222,7 @@ void CGOpenMPRuntime::emitMasterRegion(CodeGenFunction &CGF, CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_master), Args); emitIfStmt(CGF, IsMaster, [&](CodeGenFunction &CGF) -> void { CodeGenFunction::RunCleanupsScope Scope(CGF); - CGF.EHStack.pushCleanup<CallEndCleanup<array_lengthof(Args)>>( + CGF.EHStack.pushCleanup<CallEndCleanup>( NormalAndEHCleanup, createRuntimeFunction(OMPRTL__kmpc_end_master), llvm::makeArrayRef(Args)); MasterOpGen(CGF); @@ -1334,7 +1328,7 @@ void CGOpenMPRuntime::emitSingleRegion(CodeGenFunction &CGF, CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_single), Args); emitIfStmt(CGF, IsSingle, [&](CodeGenFunction &CGF) -> void { CodeGenFunction::RunCleanupsScope Scope(CGF); - CGF.EHStack.pushCleanup<CallEndCleanup<array_lengthof(Args)>>( + CGF.EHStack.pushCleanup<CallEndCleanup>( NormalAndEHCleanup, createRuntimeFunction(OMPRTL__kmpc_end_single), llvm::makeArrayRef(Args)); SingleOpGen(CGF); @@ -1397,7 +1391,7 @@ void CGOpenMPRuntime::emitOrderedRegion(CodeGenFunction &CGF, llvm::Value *Args[] = {emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc)}; CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_ordered), Args); // Build a call to __kmpc_end_ordered - CGF.EHStack.pushCleanup<CallEndCleanup<array_lengthof(Args)>>( + CGF.EHStack.pushCleanup<CallEndCleanup>( NormalAndEHCleanup, createRuntimeFunction(OMPRTL__kmpc_end_ordered), llvm::makeArrayRef(Args)); emitInlinedDirective(CGF, OrderedOpGen); @@ -2005,7 +1999,7 @@ void CGOpenMPRuntime::emitTaskCall( createRuntimeFunction(OMPRTL__kmpc_omp_task_begin_if0), TaskArgs); // Build void __kmpc_omp_task_complete_if0(ident_t *, kmp_int32 gtid, // kmp_task_t *new_task); - CGF.EHStack.pushCleanup<CallEndCleanup<array_lengthof(TaskArgs)>>( + CGF.EHStack.pushCleanup<CallEndCleanup>( NormalAndEHCleanup, createRuntimeFunction(OMPRTL__kmpc_omp_task_complete_if0), llvm::makeArrayRef(TaskArgs)); @@ -2197,7 +2191,7 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc, ThreadId, // i32 <gtid> Lock // kmp_critical_name *&<lock> }; - CGF.EHStack.pushCleanup<CallEndCleanup<array_lengthof(EndArgs)>>( + CGF.EHStack.pushCleanup<CallEndCleanup>( NormalAndEHCleanup, createRuntimeFunction(WithNowait ? OMPRTL__kmpc_end_reduce_nowait : OMPRTL__kmpc_end_reduce), |