----- Original Message ----- > From: "Alexey Bataev" <[email protected]> > To: [email protected] > Sent: Tuesday, May 5, 2015 3:48:39 AM > Subject: r236490 - Revert revision 236487: [OPENMP] Fixed incorrect work with > cleanups, NFC. > > Author: abataev > Date: Tue May 5 03:48:39 2015 > New Revision: 236490 > > URL: http://llvm.org/viewvc/llvm-project?rev=236490&view=rev > Log: > Revert revision 236487: [OPENMP] Fixed incorrect work with cleanups, > NFC.
Why? -Hal > > Modified: > cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp > > Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=236490&r1=236489&r2=236490&view=diff > ============================================================================== > --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue May 5 03:48:39 > 2015 > @@ -1154,16 +1154,16 @@ llvm::Value *CGOpenMPRuntime::getCritica > } > > namespace { > -template <size_t 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, ArrayRef<llvm::Value *> > CleanupArgs) > - : Callee(Callee) { > - assert(CleanupArgs.size() == N); > - std::copy(CleanupArgs.begin(), CleanupArgs.end(), > std::begin(Args)); > - } > + CallEndCleanup(llvm::Value *Callee, CleanupValuesTy Args) > + : Callee(Callee), Args(Args.begin(), Args.end()) {} > void Emit(CodeGenFunction &CGF, Flags /*flags*/) override { > CGF.EmitRuntimeCall(Callee, Args); > } > @@ -1184,7 +1184,7 @@ void CGOpenMPRuntime::emitCriticalRegion > getCriticalRegionLock(CriticalName)}; > CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_critical), > Args); > // Build a call to __kmpc_end_critical > - > > CGF.EHStack.pushCleanup<CallEndCleanup<std::extent<decltype(Args)>::value>>( > + CGF.EHStack.pushCleanup<CallEndCleanup>( > NormalAndEHCleanup, > createRuntimeFunction(OMPRTL__kmpc_end_critical), > llvm::makeArrayRef(Args)); > emitInlinedDirective(CGF, CriticalOpGen); > @@ -1222,7 +1222,7 @@ void CGOpenMPRuntime::emitMasterRegion(C > CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_master), > Args); > emitIfStmt(CGF, IsMaster, [&](CodeGenFunction &CGF) -> void { > CodeGenFunction::RunCleanupsScope Scope(CGF); > - > > CGF.EHStack.pushCleanup<CallEndCleanup<std::extent<decltype(Args)>::value>>( > + CGF.EHStack.pushCleanup<CallEndCleanup>( > NormalAndEHCleanup, > createRuntimeFunction(OMPRTL__kmpc_end_master), > llvm::makeArrayRef(Args)); > MasterOpGen(CGF); > @@ -1328,7 +1328,7 @@ void CGOpenMPRuntime::emitSingleRegion(C > CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_single), > Args); > emitIfStmt(CGF, IsSingle, [&](CodeGenFunction &CGF) -> void { > CodeGenFunction::RunCleanupsScope Scope(CGF); > - > > CGF.EHStack.pushCleanup<CallEndCleanup<std::extent<decltype(Args)>::value>>( > + CGF.EHStack.pushCleanup<CallEndCleanup>( > NormalAndEHCleanup, > createRuntimeFunction(OMPRTL__kmpc_end_single), > llvm::makeArrayRef(Args)); > SingleOpGen(CGF); > @@ -1391,7 +1391,7 @@ void CGOpenMPRuntime::emitOrderedRegion( > 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<std::extent<decltype(Args)>::value>>( > + CGF.EHStack.pushCleanup<CallEndCleanup>( > NormalAndEHCleanup, > createRuntimeFunction(OMPRTL__kmpc_end_ordered), > llvm::makeArrayRef(Args)); > emitInlinedDirective(CGF, OrderedOpGen); > @@ -1999,8 +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<std::extent<decltype(TaskArgs)>::value>>( > + CGF.EHStack.pushCleanup<CallEndCleanup>( > NormalAndEHCleanup, > createRuntimeFunction(OMPRTL__kmpc_omp_task_complete_if0), > llvm::makeArrayRef(TaskArgs)); > @@ -2192,12 +2191,11 @@ void CGOpenMPRuntime::emitReduction(Code > ThreadId, // i32 <gtid> > Lock // kmp_critical_name *&<lock> > }; > - CGF.EHStack > - > .pushCleanup<CallEndCleanup<std::extent<decltype(EndArgs)>::value>>( > - NormalAndEHCleanup, > - createRuntimeFunction(WithNowait ? > OMPRTL__kmpc_end_reduce_nowait > - : > OMPRTL__kmpc_end_reduce), > - llvm::makeArrayRef(EndArgs)); > + CGF.EHStack.pushCleanup<CallEndCleanup>( > + NormalAndEHCleanup, > + createRuntimeFunction(WithNowait ? > OMPRTL__kmpc_end_reduce_nowait > + : OMPRTL__kmpc_end_reduce), > + llvm::makeArrayRef(EndArgs)); > for (auto *E : ReductionOps) { > CGF.EmitIgnoredExpr(E); > } > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > -- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
