r322393 - [OPENMP] Replace calls of getAssociatedStmt().
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 12 11:39:11 PST 2018
Author: abataev
Date: Fri Jan 12 11:39:11 2018
New Revision: 322393
URL: http://llvm.org/viewvc/llvm-project?rev=322393&view=rev
Log:
[OPENMP] Replace calls of getAssociatedStmt().
getAssociatedStmt() returns the outermost captured statement for the
OpenMP directive. It may return incorrect region in case of combined
constructs. Reworked the code to reduce the number of calls of
getAssociatedStmt() and used getInnermostCapturedStmt() and
getCapturedStmt() functions instead.
In case of firstprivate variables it may lead to an extra allocas
generation for private copies even if the variable is passed by value
into outlined function and could be used directly as private copy.
Modified:
cfe/trunk/include/clang/AST/StmtOpenMP.h
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/OpenMP/nvptx_target_teams_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/StmtOpenMP.h Fri Jan 12 11:39:11 2018
@@ -222,6 +222,25 @@ public:
llvm_unreachable("Incorrect RegionKind specified for directive.");
}
+ /// Get innermost captured statement for the construct.
+ CapturedStmt *getInnermostCapturedStmt() {
+ assert(hasAssociatedStmt() && getAssociatedStmt() &&
+ "Must have associated statement.");
+ SmallVector<OpenMPDirectiveKind, 4> CaptureRegions;
+ getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind());
+ assert(!CaptureRegions.empty() &&
+ "At least one captured statement must be provided.");
+ auto *CS = cast<CapturedStmt>(getAssociatedStmt());
+ for (unsigned Level = CaptureRegions.size(); Level > 1; --Level)
+ CS = cast<CapturedStmt>(CS->getCapturedStmt());
+ return CS;
+ }
+
+ const CapturedStmt *getInnermostCapturedStmt() const {
+ return const_cast<OMPExecutableDirective *>(this)
+ ->getInnermostCapturedStmt();
+ }
+
OpenMPDirectiveKind getDirectiveKind() const { return Kind; }
static bool classof(const Stmt *S) {
@@ -903,9 +922,8 @@ public:
}
const Stmt *getBody() const {
// This relies on the loop form is already checked by Sema.
- const Stmt *Body = getAssociatedStmt()->IgnoreContainers(true);
- while(const auto *CS = dyn_cast<CapturedStmt>(Body))
- Body = CS->getCapturedStmt();
+ const Stmt *Body =
+ getInnermostCapturedStmt()->getCapturedStmt()->IgnoreContainers();
Body = cast<ForStmt>(Body)->getBody();
for (unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
Body = Body->IgnoreContainers();
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri Jan 12 11:39:11 2018
@@ -1034,12 +1034,8 @@ void StmtPrinter::PrintOMPExecutableDire
OS << ' ';
}
OS << "\n";
- if (S->hasAssociatedStmt() && S->getAssociatedStmt() && !ForceNoStmt) {
- assert(isa<CapturedStmt>(S->getAssociatedStmt()) &&
- "Expected captured statement!");
- Stmt *CS = cast<CapturedStmt>(S->getAssociatedStmt())->getCapturedStmt();
- PrintStmt(CS);
- }
+ if (!ForceNoStmt && S->hasAssociatedStmt())
+ PrintStmt(S->getInnermostCapturedStmt()->getCapturedStmt());
}
void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
@@ -1142,7 +1138,7 @@ void StmtPrinter::VisitOMPFlushDirective
void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) {
Indent() << "#pragma omp ordered ";
- PrintOMPExecutableDirective(Node);
+ PrintOMPExecutableDirective(Node, Node->hasClausesOfKind<OMPDependClause>());
}
void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) {
Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Fri Jan 12 11:39:11 2018
@@ -1371,7 +1371,10 @@ llvm::Value *CGOpenMPRuntime::emitTaskOu
CodeGen.setAction(Action);
assert(!ThreadIDVar->getType()->isPointerType() &&
"thread id variable must be of type kmp_int32 for tasks");
- auto *CS = cast<CapturedStmt>(D.getAssociatedStmt());
+ const OpenMPDirectiveKind Region =
+ isOpenMPTaskLoopDirective(D.getDirectiveKind()) ? OMPD_taskloop
+ : OMPD_task;
+ auto *CS = D.getCapturedStmt(Region);
auto *TD = dyn_cast<OMPTaskDirective>(&D);
CodeGenFunction CGF(CGM, true);
CGOpenMPTaskOutlinedRegionInfo CGInfo(*CS, ThreadIDVar, CodeGen,
@@ -5885,7 +5888,7 @@ void CGOpenMPRuntime::emitTargetOutlined
<< llvm::format("_%x_", FileID) << ParentName << "_l" << Line;
}
- const CapturedStmt &CS = *cast<CapturedStmt>(D.getAssociatedStmt());
+ const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
CodeGenFunction CGF(CGM, true);
CGOpenMPTargetRegionInfo CGInfo(CS, CodeGen, EntryFnName);
@@ -5979,7 +5982,7 @@ emitNumTeamsForTargetDirective(CGOpenMPR
// the expression is captured in the enclosing target environment when the
// teams directive is not combined with target.
- const CapturedStmt &CS = *cast<CapturedStmt>(D.getAssociatedStmt());
+ const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
if (auto *TeamsDir = dyn_cast_or_null<OMPExecutableDirective>(
ignoreCompoundStmts(CS.getCapturedStmt()))) {
@@ -6082,7 +6085,7 @@ emitNumThreadsForTargetDirective(CGOpenM
// the expression is captured in the enclosing target environment when the
// teams directive is not combined with target.
- const CapturedStmt &CS = *cast<CapturedStmt>(D.getAssociatedStmt());
+ const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
if (auto *TeamsDir = dyn_cast_or_null<OMPExecutableDirective>(
ignoreCompoundStmts(CS.getCapturedStmt()))) {
@@ -7059,7 +7062,7 @@ void CGOpenMPRuntime::emitTargetCall(Cod
// Get mappable expression information.
MappableExprsHandler MEHandler(D, CGF);
- const CapturedStmt &CS = *cast<CapturedStmt>(D.getAssociatedStmt());
+ const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
auto RI = CS.getCapturedRecordDecl()->field_begin();
auto CV = CapturedVars.begin();
for (CapturedStmt::const_capture_iterator CI = CS.capture_begin(),
@@ -7314,12 +7317,11 @@ void CGOpenMPRuntime::scanForTargetRegio
}
if (const OMPExecutableDirective *E = dyn_cast<OMPExecutableDirective>(S)) {
- if (!E->hasAssociatedStmt())
+ if (!E->hasAssociatedStmt() || !E->getAssociatedStmt())
return;
scanForTargetRegionsFunctions(
- cast<CapturedStmt>(E->getAssociatedStmt())->getCapturedStmt(),
- ParentName);
+ E->getInnermostCapturedStmt()->getCapturedStmt(), ParentName);
return;
}
Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Fri Jan 12 11:39:11 2018
@@ -2428,7 +2428,7 @@ void CGOpenMPRuntimeNVPTX::emitOutlinedF
llvm::Function *CGOpenMPRuntimeNVPTX::createDataSharingWrapper(
llvm::Function *OutlinedParallelFn, const OMPExecutableDirective &D) {
ASTContext &Ctx = CGM.getContext();
- const auto &CS = *cast<CapturedStmt>(D.getAssociatedStmt());
+ const CapturedStmt &CS = *D.getCapturedStmt(OMPD_parallel);
// Create a function that takes as argument the source thread.
FunctionArgList WrapperArgs;
Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Fri Jan 12 11:39:11 2018
@@ -53,34 +53,35 @@ class OMPLexicalScope : public CodeGenFu
}
public:
- OMPLexicalScope(CodeGenFunction &CGF, const OMPExecutableDirective &S,
- bool AsInlined = false, bool EmitPreInitStmt = true)
+ OMPLexicalScope(
+ CodeGenFunction &CGF, const OMPExecutableDirective &S,
+ const llvm::Optional<OpenMPDirectiveKind> CapturedRegion = llvm::None,
+ const bool EmitPreInitStmt = true)
: CodeGenFunction::LexicalScope(CGF, S.getSourceRange()),
InlinedShareds(CGF) {
if (EmitPreInitStmt)
emitPreInitStmt(CGF, S);
- if (AsInlined) {
- if (S.hasAssociatedStmt()) {
- auto *CS = cast<CapturedStmt>(S.getAssociatedStmt());
- for (auto &C : CS->captures()) {
- if (C.capturesVariable() || C.capturesVariableByCopy()) {
- auto *VD = C.getCapturedVar();
- assert(VD == VD->getCanonicalDecl() &&
- "Canonical decl must be captured.");
- DeclRefExpr DRE(const_cast<VarDecl *>(VD),
- isCapturedVar(CGF, VD) ||
- (CGF.CapturedStmtInfo &&
- InlinedShareds.isGlobalVarCaptured(VD)),
- VD->getType().getNonReferenceType(), VK_LValue,
- SourceLocation());
- InlinedShareds.addPrivate(VD, [&CGF, &DRE]() -> Address {
- return CGF.EmitLValue(&DRE).getAddress();
- });
- }
- }
- (void)InlinedShareds.Privatize();
+ if (!CapturedRegion.hasValue())
+ return;
+ assert(S.hasAssociatedStmt() &&
+ "Expected associated statement for inlined directive.");
+ const CapturedStmt *CS = S.getCapturedStmt(*CapturedRegion);
+ for (auto &C : CS->captures()) {
+ if (C.capturesVariable() || C.capturesVariableByCopy()) {
+ auto *VD = C.getCapturedVar();
+ assert(VD == VD->getCanonicalDecl() &&
+ "Canonical decl must be captured.");
+ DeclRefExpr DRE(
+ const_cast<VarDecl *>(VD),
+ isCapturedVar(CGF, VD) || (CGF.CapturedStmtInfo &&
+ InlinedShareds.isGlobalVarCaptured(VD)),
+ VD->getType().getNonReferenceType(), VK_LValue, SourceLocation());
+ InlinedShareds.addPrivate(VD, [&CGF, &DRE]() -> Address {
+ return CGF.EmitLValue(&DRE).getAddress();
+ });
}
}
+ (void)InlinedShareds.Privatize();
}
};
@@ -96,9 +97,8 @@ class OMPParallelScope final : public OM
public:
OMPParallelScope(CodeGenFunction &CGF, const OMPExecutableDirective &S)
- : OMPLexicalScope(CGF, S,
- /*AsInlined=*/false,
- /*EmitPreInitStmt=*/EmitPreInitStmt(S)) {}
+ : OMPLexicalScope(CGF, S, /*CapturedRegion=*/llvm::None,
+ EmitPreInitStmt(S)) {}
};
/// Lexical scope for OpenMP teams construct, that handles correct codegen
@@ -112,9 +112,8 @@ class OMPTeamsScope final : public OMPLe
public:
OMPTeamsScope(CodeGenFunction &CGF, const OMPExecutableDirective &S)
- : OMPLexicalScope(CGF, S,
- /*AsInlined=*/false,
- /*EmitPreInitStmt=*/EmitPreInitStmt(S)) {}
+ : OMPLexicalScope(CGF, S, /*CapturedRegion=*/llvm::None,
+ EmitPreInitStmt(S)) {}
};
/// Private scope for OpenMP loop-based directives, that supports capturing
@@ -738,7 +737,12 @@ bool CodeGenFunction::EmitOMPFirstprivat
cast<VarDecl>(cast<DeclRefExpr>(D)->getDecl())->getCanonicalDecl());
}
llvm::DenseSet<const VarDecl *> EmittedAsFirstprivate;
- CGCapturedStmtInfo CapturesInfo(cast<CapturedStmt>(*D.getAssociatedStmt()));
+ llvm::SmallVector<OpenMPDirectiveKind, 4> CaptureRegions;
+ getOpenMPCaptureRegions(CaptureRegions, D.getDirectiveKind());
+ // Force emission of the firstprivate copy if the directive does not emit
+ // outlined function, like omp for, omp simd, omp distribute etc.
+ bool MustEmitFirstprivateCopy =
+ CaptureRegions.size() == 1 && CaptureRegions.back() == OMPD_unknown;
for (const auto *C : D.getClausesOfKind<OMPFirstprivateClause>()) {
auto IRef = C->varlist_begin();
auto InitsRef = C->inits().begin();
@@ -746,9 +750,8 @@ bool CodeGenFunction::EmitOMPFirstprivat
auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
bool ThisFirstprivateIsLastprivate =
Lastprivates.count(OrigVD->getCanonicalDecl()) > 0;
- auto *CapFD = CapturesInfo.lookup(OrigVD);
auto *FD = CapturedStmtInfo->lookup(OrigVD);
- if (!ThisFirstprivateIsLastprivate && FD && (FD == CapFD) &&
+ if (!MustEmitFirstprivateCopy && !ThisFirstprivateIsLastprivate && FD &&
!FD->getType()->isReferenceType()) {
EmittedAsFirstprivate.insert(OrigVD->getCanonicalDecl());
++IRef;
@@ -1272,7 +1275,7 @@ void CodeGenFunction::EmitOMPParallelDir
CGF.EmitOMPPrivateClause(S, PrivateScope);
CGF.EmitOMPReductionClauseInit(S, PrivateScope);
(void)PrivateScope.Privatize();
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getCapturedStmt(OMPD_parallel)->getCapturedStmt());
CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_parallel);
};
emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen,
@@ -1734,7 +1737,7 @@ void CodeGenFunction::EmitOMPSimdDirecti
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
emitOMPSimdRegion(CGF, S, Action);
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_simd, CodeGen);
}
@@ -2122,7 +2125,7 @@ void CodeGenFunction::EmitOMPDistributeP
CGF.EmitOMPDistributeLoop(S, emitInnerParallelForWhenCombined,
S.getDistInc());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_parallel);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_distribute, CodeGen);
}
@@ -2132,7 +2135,7 @@ void CodeGenFunction::EmitOMPDistributeP
CGF.EmitOMPDistributeLoop(S, emitInnerParallelForWhenCombined,
S.getDistInc());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_parallel);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_distribute, CodeGen);
}
@@ -2141,7 +2144,7 @@ void CodeGenFunction::EmitOMPDistributeS
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
CGF.EmitOMPDistributeLoop(S, emitOMPLoopBodyWithStopPoint, S.getInc());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_simd, CodeGen);
}
@@ -2169,12 +2172,11 @@ void CodeGenFunction::EmitOMPTargetSimdD
void CodeGenFunction::EmitOMPTargetTeamsDistributeParallelForSimdDirective(
const OMPTargetTeamsDistributeParallelForSimdDirective &S) {
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(
*this, OMPD_target_teams_distribute_parallel_for_simd,
[&S](CodeGenFunction &CGF, PrePostActionTy &) {
- CGF.EmitStmt(
- cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
});
}
@@ -2414,7 +2416,7 @@ void CodeGenFunction::EmitOMPForDirectiv
emitDispatchForLoopBounds);
};
{
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_for, CodeGen,
S.hasCancel());
}
@@ -2434,7 +2436,7 @@ void CodeGenFunction::EmitOMPForSimdDire
emitDispatchForLoopBounds);
};
{
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_simd, CodeGen);
}
@@ -2454,8 +2456,8 @@ static LValue createSectionLVal(CodeGenF
}
void CodeGenFunction::EmitSections(const OMPExecutableDirective &S) {
- auto *Stmt = cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt();
- auto *CS = dyn_cast<CompoundStmt>(Stmt);
+ const Stmt *Stmt = S.getInnermostCapturedStmt()->getCapturedStmt();
+ const auto *CS = dyn_cast<CompoundStmt>(Stmt);
bool HasLastprivates = false;
auto &&CodeGen = [&S, Stmt, CS, &HasLastprivates](CodeGenFunction &CGF,
PrePostActionTy &) {
@@ -2595,7 +2597,7 @@ void CodeGenFunction::EmitSections(const
void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
{
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
EmitSections(S);
}
// Emit an implicit barrier at the end.
@@ -2607,9 +2609,9 @@ void CodeGenFunction::EmitOMPSectionsDir
void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &S) {
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_section, CodeGen,
S.hasCancel());
}
@@ -2638,10 +2640,10 @@ void CodeGenFunction::EmitOMPSingleDirec
(void)CGF.EmitOMPFirstprivateClause(S, SingleScope);
CGF.EmitOMPPrivateClause(S, SingleScope);
(void)SingleScope.Privatize();
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
};
{
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getLocStart(),
CopyprivateVars, DestExprs,
SrcExprs, AssignmentOps);
@@ -2658,21 +2660,21 @@ void CodeGenFunction::EmitOMPSingleDirec
void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) {
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
Action.Enter(CGF);
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitMasterRegion(*this, CodeGen, S.getLocStart());
}
void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) {
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) {
Action.Enter(CGF);
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
};
Expr *Hint = nullptr;
if (auto *HintClause = S.getSingleClause<OMPHintClause>())
Hint = HintClause->getHint();
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitCriticalRegion(*this,
S.getDirectiveName().getAsString(),
CodeGen, S.getLocStart(), Hint);
@@ -2714,12 +2716,12 @@ void CodeGenFunction::EmitOMPParallelSec
emitEmptyBoundParameters);
}
-void CodeGenFunction::EmitOMPTaskBasedDirective(const OMPExecutableDirective &S,
- const RegionCodeGenTy &BodyGen,
- const TaskGenTy &TaskGen,
- OMPTaskDataTy &Data) {
+void CodeGenFunction::EmitOMPTaskBasedDirective(
+ const OMPExecutableDirective &S, const OpenMPDirectiveKind CapturedRegion,
+ const RegionCodeGenTy &BodyGen, const TaskGenTy &TaskGen,
+ OMPTaskDataTy &Data) {
// Emit outlined function for task construct.
- auto CS = cast<CapturedStmt>(S.getAssociatedStmt());
+ const CapturedStmt *CS = S.getCapturedStmt(CapturedRegion);
auto *I = CS->getCapturedDecl()->param_begin();
auto *PartId = std::next(I);
auto *TaskT = std::next(I, 4);
@@ -2820,8 +2822,9 @@ void CodeGenFunction::EmitOMPTaskBasedDi
for (const auto *C : S.getClausesOfKind<OMPDependClause>())
for (auto *IRef : C->varlists())
Data.Dependences.push_back(std::make_pair(C->getDependencyKind(), IRef));
- auto &&CodeGen = [&Data, &S, CS, &BodyGen, &LastprivateDstsOrigs](
- CodeGenFunction &CGF, PrePostActionTy &Action) {
+ auto &&CodeGen = [&Data, &S, CS, &BodyGen, &LastprivateDstsOrigs,
+ CapturedRegion](CodeGenFunction &CGF,
+ PrePostActionTy &Action) {
// Set proper addresses for generated private copies.
OMPPrivateScope Scope(CGF);
if (!Data.PrivateVars.empty() || !Data.FirstprivateVars.empty() ||
@@ -2878,7 +2881,7 @@ void CodeGenFunction::EmitOMPTaskBasedDi
}
}
if (Data.Reductions) {
- OMPLexicalScope LexScope(CGF, S, /*AsInlined=*/true);
+ OMPLexicalScope LexScope(CGF, S, CapturedRegion);
ReductionCodeGen RedCG(Data.ReductionVars, Data.ReductionCopies,
Data.ReductionOps);
llvm::Value *ReductionsPtr = CGF.Builder.CreateLoad(
@@ -3096,8 +3099,7 @@ void CodeGenFunction::EmitOMPTargetTaskB
CGF.GetAddrOfLocalVar(SVD), /*Index=*/0, CGF.getSizeSize());
Action.Enter(CGF);
- OMPLexicalScope LexScope(CGF, S, /*AsInlined=*/true,
- /*EmitPreInitStmt=*/false);
+ OMPLexicalScope LexScope(CGF, S, OMPD_task, /*EmitPreInitStmt=*/false);
BodyGen(CGF);
};
auto *OutlinedFn = CGM.getOpenMPRuntime().emitTaskOutlinedFunction(
@@ -3114,7 +3116,7 @@ void CodeGenFunction::EmitOMPTargetTaskB
void CodeGenFunction::EmitOMPTaskDirective(const OMPTaskDirective &S) {
// Emit outlined function for task construct.
- auto CS = cast<CapturedStmt>(S.getAssociatedStmt());
+ const CapturedStmt *CS = S.getCapturedStmt(OMPD_task);
auto CapturedStruct = GenerateCapturedStmtArgument(*CS);
auto SharedsTy = getContext().getRecordType(CS->getCapturedRecordDecl());
const Expr *IfCond = nullptr;
@@ -3139,7 +3141,7 @@ void CodeGenFunction::EmitOMPTaskDirecti
SharedsTy, CapturedStruct, IfCond,
Data);
};
- EmitOMPTaskBasedDirective(S, BodyGen, TaskGen, Data);
+ EmitOMPTaskBasedDirective(S, OMPD_task, BodyGen, TaskGen, Data);
}
void CodeGenFunction::EmitOMPTaskyieldDirective(
@@ -3188,9 +3190,9 @@ void CodeGenFunction::EmitOMPTaskgroupDi
CGF.EmitStoreOfScalar(ReductionDesc, CGF.GetAddrOfLocalVar(VD),
/*Volatile=*/false, E->getType());
}
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitTaskgroupRegion(*this, CodeGen, S.getLocStart());
}
@@ -3398,7 +3400,7 @@ void CodeGenFunction::EmitOMPDistributeD
CGF.EmitOMPDistributeLoop(S, emitOMPLoopBodyWithStopPoint, S.getInc());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_distribute, CodeGen);
}
@@ -3413,7 +3415,9 @@ static llvm::Function *emitOutlinedOrder
}
void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
- if (!S.getAssociatedStmt()) {
+ if (S.hasClausesOfKind<OMPDependClause>()) {
+ assert(!S.getAssociatedStmt() &&
+ "No associated statement must be in ordered depend construct.");
for (const auto *DC : S.getClausesOfKind<OMPDependClause>())
CGM.getOpenMPRuntime().emitDoacrossOrdered(*this, DC);
return;
@@ -3421,8 +3425,8 @@ void CodeGenFunction::EmitOMPOrderedDire
auto *C = S.getSingleClause<OMPSIMDClause>();
auto &&CodeGen = [&S, C, this](CodeGenFunction &CGF,
PrePostActionTy &Action) {
+ const CapturedStmt *CS = S.getInnermostCapturedStmt();
if (C) {
- auto CS = cast<CapturedStmt>(S.getAssociatedStmt());
llvm::SmallVector<llvm::Value *, 16> CapturedVars;
CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars);
auto *OutlinedFn = emitOutlinedOrderedFunction(CGM, CS);
@@ -3430,11 +3434,10 @@ void CodeGenFunction::EmitOMPOrderedDire
OutlinedFn, CapturedVars);
} else {
Action.Enter(CGF);
- CGF.EmitStmt(
- cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(CS->getCapturedStmt());
}
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitOrderedRegion(*this, CodeGen, S.getLocStart(), !C);
}
@@ -3878,8 +3881,7 @@ void CodeGenFunction::EmitOMPAtomicDirec
}
}
- const auto *CS =
- S.getAssociatedStmt()->IgnoreContainers(/*IgnoreCaptured=*/true);
+ const auto *CS = S.getInnermostCapturedStmt()->IgnoreContainers();
if (const auto *EWC = dyn_cast<ExprWithCleanups>(CS)) {
enterFullExpression(EWC);
}
@@ -3899,7 +3901,7 @@ void CodeGenFunction::EmitOMPAtomicDirec
S.getV(), S.getExpr(), S.getUpdateExpr(),
S.isXLHSInRHSPart(), S.getLocStart());
};
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_unknown);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_atomic, CodeGen);
}
@@ -3971,7 +3973,7 @@ static void emitTargetRegion(CodeGenFunc
(void)PrivateScope.Privatize();
Action.Enter(CGF);
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getCapturedStmt(OMPD_target)->getCapturedStmt());
}
void CodeGenFunction::EmitOMPTargetDeviceFunction(CodeGenModule &CGM,
@@ -4028,7 +4030,7 @@ void CodeGenFunction::EmitOMPTeamsDirect
CGF.EmitOMPPrivateClause(S, PrivateScope);
CGF.EmitOMPReductionClauseInit(S, PrivateScope);
(void)PrivateScope.Privatize();
- CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getCapturedStmt(OMPD_teams)->getCapturedStmt());
CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_teams);
};
emitCommonOMPTeamsDirective(*this, S, OMPD_distribute, CodeGen);
@@ -4421,10 +4423,9 @@ void CodeGenFunction::EmitOMPTargetDataD
DevicePointerPrivActionTy PrivAction(PrivatizeDevicePointers);
auto &&CodeGen = [&S, &Info, &PrivatizeDevicePointers](
- CodeGenFunction &CGF, PrePostActionTy &Action) {
+ CodeGenFunction &CGF, PrePostActionTy &Action) {
auto &&InnermostCodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
- CGF.EmitStmt(
- cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
};
// Codegen that selects wheather to generate the privatization code or not.
@@ -4506,7 +4507,7 @@ void CodeGenFunction::EmitOMPTargetEnter
if (auto *C = S.getSingleClause<OMPDeviceClause>())
Device = C->getDevice();
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_task);
CGM.getOpenMPRuntime().emitTargetDataStandAloneCall(*this, S, IfCond, Device);
}
@@ -4527,7 +4528,7 @@ void CodeGenFunction::EmitOMPTargetExitD
if (auto *C = S.getSingleClause<OMPDeviceClause>())
Device = C->getDevice();
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_task);
CGM.getOpenMPRuntime().emitTargetDataStandAloneCall(*this, S, IfCond, Device);
}
@@ -4664,7 +4665,7 @@ static void mapParam(CodeGenFunction &CG
void CodeGenFunction::EmitOMPTaskLoopBasedDirective(const OMPLoopDirective &S) {
assert(isOpenMPTaskLoopDirective(S.getDirectiveKind()));
// Emit outlined function for task construct.
- auto CS = cast<CapturedStmt>(S.getAssociatedStmt());
+ const CapturedStmt *CS = S.getCapturedStmt(OMPD_taskloop);
auto CapturedStruct = GenerateCapturedStmtArgument(*CS);
auto SharedsTy = getContext().getRecordType(CS->getCapturedRecordDecl());
const Expr *IfCond = nullptr;
@@ -4786,15 +4787,16 @@ void CodeGenFunction::EmitOMPTaskLoopBas
CGF.CGM.getOpenMPRuntime().emitInlinedDirective(CGF, OMPD_taskloop,
CodeGen);
};
- if (Data.Nogroup)
- EmitOMPTaskBasedDirective(S, BodyGen, TaskGen, Data);
- else {
+ if (Data.Nogroup) {
+ EmitOMPTaskBasedDirective(S, OMPD_taskloop, BodyGen, TaskGen, Data);
+ } else {
CGM.getOpenMPRuntime().emitTaskgroupRegion(
*this,
[&S, &BodyGen, &TaskGen, &Data](CodeGenFunction &CGF,
PrePostActionTy &Action) {
Action.Enter(CGF);
- CGF.EmitOMPTaskBasedDirective(S, BodyGen, TaskGen, Data);
+ CGF.EmitOMPTaskBasedDirective(S, OMPD_taskloop, BodyGen, TaskGen,
+ Data);
},
S.getLocStart());
}
@@ -4827,7 +4829,7 @@ void CodeGenFunction::EmitOMPTargetUpdat
if (auto *C = S.getSingleClause<OMPDeviceClause>())
Device = C->getDevice();
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPLexicalScope Scope(*this, S, OMPD_task);
CGM.getOpenMPRuntime().emitTargetDataStandAloneCall(*this, S, IfCond, Device);
}
@@ -4849,10 +4851,7 @@ void CodeGenFunction::EmitSimpleOMPExecu
}
}
}
- const auto *CS = cast<CapturedStmt>(D.getAssociatedStmt());
- while (const auto *CCS = dyn_cast<CapturedStmt>(CS->getCapturedStmt()))
- CS = CCS;
- CGF.EmitStmt(CS->getCapturedStmt());
+ CGF.EmitStmt(D.getInnermostCapturedStmt()->getCapturedStmt());
}
};
OMPSimdLexicalScope Scope(*this, D);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Jan 12 11:39:11 2018
@@ -2832,6 +2832,7 @@ public:
const OMPTaskDataTy & /*Data*/)>
TaskGenTy;
void EmitOMPTaskBasedDirective(const OMPExecutableDirective &S,
+ const OpenMPDirectiveKind CapturedRegion,
const RegionCodeGenTy &BodyGen,
const TaskGenTy &TaskGen, OMPTaskDataTy &Data);
struct OMPTargetDataInfo {
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Jan 12 11:39:11 2018
@@ -7642,11 +7642,7 @@ StmtResult TreeTransform<Derived>::Trans
StmtResult Body;
{
Sema::CompoundScopeRAII CompoundScope(getSema());
- int ThisCaptureLevel =
- Sema::getOpenMPCaptureLevels(D->getDirectiveKind());
- Stmt *CS = D->getAssociatedStmt();
- while (--ThisCaptureLevel >= 0)
- CS = cast<CapturedStmt>(CS)->getCapturedStmt();
+ Stmt *CS = D->getInnermostCapturedStmt()->getCapturedStmt();
Body = getDerived().TransformStmt(CS);
}
AssociatedStmt =
Modified: cfe/trunk/test/OpenMP/nvptx_target_teams_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nvptx_target_teams_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/nvptx_target_teams_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/nvptx_target_teams_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -121,9 +121,7 @@ int bar(int n){
// CHECK: [[ACV:%.+]] = load i[[SZ]], i[[SZ]]* [[AC]], align
// CHECK: store i[[SZ]] [[ACV]], i[[SZ]]* [[A_ADDR_T:%.+]], align
// CHECK: [[CONV2:%.+]] = bitcast i[[SZ]]* [[A_ADDR_T]] to i8*
- // CHECK: [[LD_CONV2:%.+]] = load i8, i8* [[CONV2]],
- // CHECK: store i8 [[LD_CONV2]], i8* [[A_PRIV:%[^,]+]],
- // CHECK: store i8 49, i8* [[A_PRIV]], align
+ // CHECK: store i8 49, i8* [[CONV2]], align
// CHECK: br label {{%?}}[[TERMINATE:.+]]
//
// CHECK: [[TERMINATE]]
@@ -209,9 +207,7 @@ int bar(int n){
// CHECK: [[ACV:%.+]] = load i[[SZ]], i[[SZ]]* [[AC]], align
// CHECK: store i[[SZ]] [[ACV]], i[[SZ]]* [[AA_ADDR_T:%.+]], align
// CHECK: [[CONV2:%.+]] = bitcast i[[SZ]]* [[AA_ADDR_T]] to i16*
- // CHECK: [[LD_CONV2:%.+]] = load i16, i16* [[CONV2]],
- // CHECK: store i16 [[LD_CONV2]], i16* [[A_PRIV:%[^,]+]],
- // CHECK: store i16 1, i16* [[A_PRIV]], align
+ // CHECK: store i16 1, i16* [[CONV2]], align
// CHECK: br label {{%?}}[[TERMINATE:.+]]
//
// CHECK: [[TERMINATE]]
Modified: cfe/trunk/test/OpenMP/target_teams_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -345,7 +345,8 @@ int foo(int n) {
//
//
// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias %.global_tid., i32* noalias %.bound_tid., i[[SZ]] {{[^)]+}})
-// CHECK: alloca i16,
+// CHECK: alloca i[[SZ]],
+// CHECK: bitcast i[[SZ]]* {{.+}} to i16*
// CHECK: ret void
// CHECK-NEXT: }
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -355,7 +355,8 @@ int foo(int n) {
//
//
// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias %.global_tid., i32* noalias %.bound_tid., i[[SZ]] {{[^)]+}})
-// CHECK: alloca i16,
+// CHECK: alloca i[[SZ]],
+// CHECK: bitcast i[[SZ]]* {{.+}} to i16*
// CHECK: ret void
// CHECK-NEXT: }
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -110,16 +110,7 @@ int main() {
// LAMBDA: [[G_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: [[G_PRIV_ADDR:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_PRIV_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_TMP:%.+]] = alloca i32*,
- // LAMBDA: [[SIVAR_PRIV_ADDR:%.+]] = alloca i{{[0-9]+}},
// skip loop vars
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G1_ADDR]],
@@ -127,15 +118,15 @@ int main() {
// LAMBDA-DAG: [[G_CONV:%.+]] = bitcast {{.+}} [[G_ADDR]] to
// LAMBDA-DAG: [[G1_CONV:%.+]] = bitcast {{.+}} [[G1_ADDR]] to
// LAMBDA-DAG: [[SIVAR_CONV:%.+]] = bitcast {{.+}} [[SIVAR_ADDR]] to
- // LAMBDA-DAG: store{{.+}} [[G1_PRIV_ADDR]], {{.+}} [[G1_TMP]],
+ // LAMBDA-DAG: store{{.+}} [[G1_CONV]], {{.+}} [[G1_TMP]],
g = 1;
g1 = 1;
sivar = 2;
// LAMBDA: call void @__kmpc_for_static_init_4(
- // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_PRIV_ADDR]],
+ // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_CONV]],
// LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP]]
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1]],
- // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_PRIV_ADDR]],
+ // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_CONV]],
// LAMBDA-DAG: [[G1_REF:%.+]] = load{{.+}}, {{.+}} [[G1_TMP]],
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1_REF]],
// LAMBDA: call void [[INNER_LAMBDA:@.+]](
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -163,16 +163,6 @@ int main() {
// LAMBDA: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_TMP:%.+]] = alloca i32*,
// skip loop vars
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: [[G_PRIV:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_PRIV:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_TMP_PRIV:%.+]] = alloca i{{[0-9]+}}*,
- // LAMBDA: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G1_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[SIVAR_ADDR]],
@@ -182,10 +172,10 @@ int main() {
// LAMBDA-DAG: store{{.+}} [[G1_CONV]], {{.+}} [[G1_TMP]],
// use of private vars
- // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_PRIV]],
- // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP_PRIV]]
+ // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_CONV]],
+ // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP]]
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1]],
- // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_PRIV]],
+ // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_CONV]],
// LAMBDA-DAG: [[G1_REF:%.+]] = load{{.+}}, {{.+}} [[G1_TMP]],
// LAMBDA: call void [[INNER_LAMBDA:@.+]](
// LAMBDA: call void @__kmpc_for_static_fini(
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -345,7 +345,8 @@ int foo(int n) {
//
//
// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias %.global_tid., i32* noalias %.bound_tid., i[[SZ]] {{[^)]+}})
-// CHECK: alloca i16,
+// CHECK: alloca i[[SZ]],
+// CHECK: bitcast i[[SZ]]* {{.+}} to i16*
// CHECK: ret void
// CHECK-NEXT: }
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -110,16 +110,7 @@ int main() {
// LAMBDA: [[G_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
- // LAMBDA: [[G_PRIV_ADDR:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_PRIV_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_TMP:%.+]] = alloca i32*,
- // LAMBDA: [[SIVAR_PRIV_ADDR:%.+]] = alloca i{{[0-9]+}},
// skip loop vars
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G1_ADDR]],
@@ -127,15 +118,15 @@ int main() {
// LAMBDA-DAG: [[G_CONV:%.+]] = bitcast {{.+}} [[G_ADDR]] to
// LAMBDA-DAG: [[G1_CONV:%.+]] = bitcast {{.+}} [[G1_ADDR]] to
// LAMBDA-DAG: [[SIVAR_CONV:%.+]] = bitcast {{.+}} [[SIVAR_ADDR]] to
- // LAMBDA-DAG: store{{.+}} [[G1_PRIV_ADDR]], {{.+}} [[G1_TMP]],
+ // LAMBDA-DAG: store{{.+}} [[G1_CONV]], {{.+}} [[G1_TMP]],
g = 1;
g1 = 1;
sivar = 2;
// LAMBDA: call void @__kmpc_for_static_init_4(
- // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_PRIV_ADDR]],
+ // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_CONV]],
// LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP]]
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1]],
- // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_PRIV_ADDR]],
+ // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_CONV]],
// LAMBDA-DAG: [[G1_REF:%.+]] = load{{.+}}, {{.+}} [[G1_TMP]],
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1_REF]],
// LAMBDA: call void [[INNER_LAMBDA:@.+]](
Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -140,16 +140,6 @@ int main() {
// LAMBDA: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_TMP:%.+]] = alloca i32*,
// skip loop vars
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: [[G_PRIV:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_PRIV:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_TMP_PRIV:%.+]] = alloca i{{[0-9]+}}*,
- // LAMBDA: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G1_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[SIVAR_ADDR]],
@@ -159,10 +149,10 @@ int main() {
// LAMBDA-DAG: store{{.+}} [[G1_CONV]], {{.+}} [[G1_TMP]],
// use of private vars
- // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_PRIV]],
- // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP_PRIV]]
+ // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_CONV]],
+ // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP]]
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1]],
- // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_PRIV]],
+ // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_CONV]],
// LAMBDA-DAG: [[G1_REF:%.+]] = load{{.+}}, {{.+}} [[G1_TMP]],
// LAMBDA: call void [[INNER_LAMBDA:@.+]](
// LAMBDA: call void @__kmpc_for_static_fini(
Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp?rev=322393&r1=322392&r2=322393&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp Fri Jan 12 11:39:11 2018
@@ -140,16 +140,6 @@ int main() {
// LAMBDA: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
// LAMBDA: [[G1_TMP:%.+]] = alloca i32*,
// skip loop vars
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: alloca i32,
- // LAMBDA: [[G_PRIV:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_PRIV:%.+]] = alloca i{{[0-9]+}},
- // LAMBDA: [[G1_TMP_PRIV:%.+]] = alloca i{{[0-9]+}}*,
- // LAMBDA: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[G1_ADDR]],
// LAMBDA-DAG: store {{.+}}, {{.+}} [[SIVAR_ADDR]],
@@ -159,10 +149,10 @@ int main() {
// LAMBDA-DAG: store{{.+}} [[G1_CONV]], {{.+}} [[G1_TMP]],
// use of private vars
- // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_PRIV]],
- // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP_PRIV]]
+ // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_CONV]],
+ // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP]]
// LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1]],
- // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_PRIV]],
+ // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_CONV]],
// LAMBDA-DAG: [[G1_REF:%.+]] = load{{.+}}, {{.+}} [[G1_TMP]],
// LAMBDA: call void [[INNER_LAMBDA:@.+]](
// LAMBDA: call void @__kmpc_for_static_fini(
More information about the cfe-commits
mailing list