r368295 - [OPENMP]Add support for analysis of linear variables and step.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 8 06:42:46 PDT 2019
Author: abataev
Date: Thu Aug 8 06:42:45 2019
New Revision: 368295
URL: http://llvm.org/viewvc/llvm-project?rev=368295&view=rev
Log:
[OPENMP]Add support for analysis of linear variables and step.
Summary:
Added support for basic analysis of the linear variables and linear step
expression. Linear loop iteration variables must be excluded from this
analysis, only non-loop iteration variables must be analyzed.
Reviewers: NoQ
Subscribers: guansong, cfe-commits, caomhin, kkwli0
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65461
Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/Analysis/cfg-openmp.cpp
cfe/trunk/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/distribute_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/for_linear_messages.cpp
cfe/trunk/test/OpenMP/for_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/parallel_for_linear_messages.cpp
cfe/trunk/test/OpenMP/parallel_for_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/simd_linear_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_for_linear_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_for_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/target_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/taskloop_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp
cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp
Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu Aug 8 06:42:45 2019
@@ -3216,6 +3216,14 @@ class OMPLinearClause final
return llvm::makeArrayRef(getUpdates().end(), varlist_size());
}
+ /// Gets the list of used expressions for linear variables.
+ MutableArrayRef<Expr *> getUsedExprs() {
+ return MutableArrayRef<Expr *>(getFinals().end() + 2, varlist_size() + 1);
+ }
+ ArrayRef<const Expr *> getUsedExprs() const {
+ return llvm::makeArrayRef(getFinals().end() + 2, varlist_size() + 1);
+ }
+
/// Sets the list of the copies of original linear variables.
/// \param PL List of expressions.
void setPrivates(ArrayRef<Expr *> PL);
@@ -3295,6 +3303,9 @@ public:
/// \param FL List of expressions.
void setFinals(ArrayRef<Expr *> FL);
+ /// Sets the list of used expressions for the linear clause.
+ void setUsedExprs(ArrayRef<Expr *> UE);
+
using privates_iterator = MutableArrayRef<Expr *>::iterator;
using privates_const_iterator = ArrayRef<const Expr *>::iterator;
using privates_range = llvm::iterator_range<privates_iterator>;
@@ -3347,6 +3358,21 @@ public:
return finals_const_range(getFinals().begin(), getFinals().end());
}
+ using used_expressions_iterator = MutableArrayRef<Expr *>::iterator;
+ using used_expressions_const_iterator = ArrayRef<const Expr *>::iterator;
+ using used_expressions_range =
+ llvm::iterator_range<used_expressions_iterator>;
+ using used_expressions_const_range =
+ llvm::iterator_range<used_expressions_const_iterator>;
+
+ used_expressions_range used_expressions() {
+ return finals_range(getUsedExprs().begin(), getUsedExprs().end());
+ }
+
+ used_expressions_const_range used_expressions() const {
+ return finals_const_range(getUsedExprs().begin(), getUsedExprs().end());
+ }
+
child_range children() {
return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
reinterpret_cast<Stmt **>(varlist_end()));
@@ -3357,11 +3383,11 @@ public:
return const_child_range(Children.begin(), Children.end());
}
- child_range used_children() {
- return child_range(child_iterator(), child_iterator());
- }
+ child_range used_children();
+
const_child_range used_children() const {
- return const_child_range(const_child_iterator(), const_child_iterator());
+ auto Children = const_cast<OMPLinearClause *>(this)->used_children();
+ return const_child_range(Children.begin(), Children.end());
}
static bool classof(const OMPClause *T) {
Modified: cfe/trunk/lib/AST/OpenMPClause.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OpenMPClause.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/lib/AST/OpenMPClause.cpp (original)
+++ cfe/trunk/lib/AST/OpenMPClause.cpp Thu Aug 8 06:42:45 2019
@@ -429,15 +429,23 @@ void OMPLinearClause::setFinals(ArrayRef
std::copy(FL.begin(), FL.end(), getUpdates().end());
}
+void OMPLinearClause::setUsedExprs(ArrayRef<Expr *> UE) {
+ assert(
+ UE.size() == varlist_size() + 1 &&
+ "Number of used expressions is not the same as the preallocated buffer");
+ std::copy(UE.begin(), UE.end(), getFinals().end() + 2);
+}
+
OMPLinearClause *OMPLinearClause::Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep,
Stmt *PreInit, Expr *PostUpdate) {
- // Allocate space for 4 lists (Vars, Inits, Updates, Finals) and 2 expressions
- // (Step and CalcStep).
- void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2));
+ // Allocate space for 5 lists (Vars, Inits, Updates, Finals), 2 expressions
+ // (Step and CalcStep), list of used expression + step.
+ void *Mem =
+ C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2 + VL.size() + 1));
OMPLinearClause *Clause = new (Mem) OMPLinearClause(
StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc, EndLoc, VL.size());
Clause->setVarRefs(VL);
@@ -449,6 +457,8 @@ OMPLinearClause *OMPLinearClause::Create
nullptr);
std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
nullptr);
+ std::fill(Clause->getUsedExprs().begin(), Clause->getUsedExprs().end(),
+ nullptr);
Clause->setStep(Step);
Clause->setCalcStep(CalcStep);
Clause->setPreInitStmt(PreInit);
@@ -458,12 +468,19 @@ OMPLinearClause *OMPLinearClause::Create
OMPLinearClause *OMPLinearClause::CreateEmpty(const ASTContext &C,
unsigned NumVars) {
- // Allocate space for 4 lists (Vars, Inits, Updates, Finals) and 2 expressions
- // (Step and CalcStep).
- void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2));
+ // Allocate space for 5 lists (Vars, Inits, Updates, Finals), 2 expressions
+ // (Step and CalcStep), list of used expression + step.
+ void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2 + NumVars +1));
return new (Mem) OMPLinearClause(NumVars);
}
+OMPClause::child_range OMPLinearClause::used_children() {
+ // Range includes only non-nullptr elements.
+ return child_range(
+ reinterpret_cast<Stmt **>(getUsedExprs().begin()),
+ reinterpret_cast<Stmt **>(llvm::find(getUsedExprs(), nullptr)));
+}
+
OMPAlignedClause *
OMPAlignedClause::Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation ColonLoc,
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Aug 8 06:42:45 2019
@@ -12724,6 +12724,7 @@ static bool FinishOpenMPLinearClause(OMP
// Walk the vars and build update/final expressions for the CodeGen.
SmallVector<Expr *, 8> Updates;
SmallVector<Expr *, 8> Finals;
+ SmallVector<Expr *, 8> UsedExprs;
Expr *Step = Clause.getStep();
Expr *CalcStep = Clause.getCalcStep();
// OpenMP [2.14.3.7, linear clause]
@@ -12799,16 +12800,24 @@ static bool FinishOpenMPLinearClause(OMP
if (!Update.isUsable() || !Final.isUsable()) {
Updates.push_back(nullptr);
Finals.push_back(nullptr);
+ UsedExprs.push_back(nullptr);
HasErrors = true;
} else {
Updates.push_back(Update.get());
Finals.push_back(Final.get());
+ if (!Info.first)
+ UsedExprs.push_back(SimpleRefExpr);
}
++CurInit;
++CurPrivate;
}
+ if (Expr *S = Clause.getStep())
+ UsedExprs.push_back(S);
+ // Fill the remaining part with the nullptr.
+ UsedExprs.append(Clause.varlist_size() + 1 - UsedExprs.size(), nullptr);
Clause.setUpdates(Updates);
Clause.setFinals(Finals);
+ Clause.setUsedExprs(UsedExprs);
return HasErrors;
}
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Aug 8 06:42:45 2019
@@ -12736,6 +12736,10 @@ void OMPClauseReader::VisitOMPLinearClau
C->setFinals(Vars);
C->setStep(Record.readSubExpr());
C->setCalcStep(Record.readSubExpr());
+ Vars.clear();
+ for (unsigned I = 0; I != NumVars + 1; ++I)
+ Vars.push_back(Record.readSubExpr());
+ C->setUsedExprs(Vars);
}
void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) {
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Thu Aug 8 06:42:45 2019
@@ -6846,6 +6846,8 @@ void OMPClauseWriter::VisitOMPLinearClau
}
Record.AddStmt(C->getStep());
Record.AddStmt(C->getCalcStep());
+ for (auto *VE : C->used_expressions())
+ Record.AddStmt(VE);
}
void OMPClauseWriter::VisitOMPAlignedClause(OMPAlignedClause *C) {
Modified: cfe/trunk/test/Analysis/cfg-openmp.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cfg-openmp.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/cfg-openmp.cpp (original)
+++ cfe/trunk/test/Analysis/cfg-openmp.cpp Thu Aug 8 06:42:45 2019
@@ -7,7 +7,9 @@ void xxx(int argc) {
// CHECK-NEXT: 2: int cond;
// CHECK-NEXT: 3: int fp;
// CHECK-NEXT: 4: int rd;
- int x, cond, fp, rd;
+// CHECK-NEXT: 5: int lin;
+// CHECK-NEXT: 6: int step;
+ int x, cond, fp, rd, lin, step;
// CHECK-NEXT: [[#ATOM:]]: x
// CHECK-NEXT: [[#ATOM+1]]: [B1.[[#ATOM]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#ATOM+2]]: argc
@@ -68,20 +70,26 @@ void xxx(int argc) {
// CHECK-NEXT: [[#FOR+1]]: [B1.[[#FOR]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#FOR+2]]: argc
// CHECK-NEXT: [[#FOR+3]]: [B1.[[#FOR+2]]] = [B1.[[#FOR+1]]]
-// CHECK-NEXT: [[#FOR+4]]: #pragma omp for
+// CHECK-NEXT: [[#FOR+4]]: lin
+// CHECK-NEXT: [[#FOR+5]]: step
+// CHECK-NEXT: [[#FOR+6]]: [B1.[[#FOR+5]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#FOR+7]]: #pragma omp for linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#FOR+3]]];
-#pragma omp for
+#pragma omp for linear(lin : step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#FS:]]: x
// CHECK-NEXT: [[#FS+1]]: [B1.[[#FS]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#FS+2]]: argc
// CHECK-NEXT: [[#FS+3]]: [B1.[[#FS+2]]] = [B1.[[#FS+1]]]
-// CHECK-NEXT: [[#FS+4]]: #pragma omp for simd
+// CHECK-NEXT: [[#FS+4]]: lin
+// CHECK-NEXT: [[#FS+5]]: step
+// CHECK-NEXT: [[#FS+6]]: [B1.[[#FS+5]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#FS+7]]: #pragma omp for simd linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#FS+3]]];
-#pragma omp for simd
+#pragma omp for simd linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#MASTER:]]: x
@@ -115,10 +123,13 @@ void xxx(int argc) {
// CHECK-NEXT: [[#PF+6]]: [B1.[[#PF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
// CHECK-NEXT: [[#PF+7]]: fp
// CHECK-NEXT: [[#PF+8]]: rd
-// CHECK-NEXT: [[#PF+9]]: #pragma omp parallel for if(cond) firstprivate(fp) reduction(&: rd)
+// CHECK-NEXT: [[#PF+9]]: lin
+// CHECK-NEXT: [[#PF+10]]: step
+// CHECK-NEXT: [[#PF+11]]: [B1.[[#PF+10]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#PF+12]]: #pragma omp parallel for if(cond) firstprivate(fp) reduction(&: rd) linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#PF+3]]];
-#pragma omp parallel for if(cond) firstprivate(fp) reduction(&:rd)
+#pragma omp parallel for if(cond) firstprivate(fp) reduction(&:rd) linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#PFS:]]: x
@@ -130,10 +141,13 @@ void xxx(int argc) {
// CHECK-NEXT: [[#PFS+6]]: [B1.[[#PFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
// CHECK-NEXT: [[#PFS+7]]: fp
// CHECK-NEXT: [[#PFS+8]]: rd
-// CHECK-NEXT: [[#PFS+9]]: #pragma omp parallel for simd if(cond) firstprivate(fp) reduction(|: rd)
+// CHECK-NEXT: [[#PFS+9]]: lin
+// CHECK-NEXT: [[#PFS+10]]: step
+// CHECK-NEXT: [[#PFS+11]]: [B1.[[#PFS+10]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#PFS+12]]: #pragma omp parallel for simd if(cond) firstprivate(fp) reduction(|: rd) linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#PFS+3]]];
-#pragma omp parallel for simd if(cond) firstprivate(fp) reduction(|:rd)
+#pragma omp parallel for simd if(cond) firstprivate(fp) reduction(|:rd) linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#PAR:]]: x
@@ -170,10 +184,13 @@ void xxx(int argc) {
// CHECK-NEXT: [[#SIMD+1]]: [B1.[[#SIMD]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#SIMD+2]]: argc
// CHECK-NEXT: [[#SIMD+3]]: [B1.[[#SIMD+2]]] = [B1.[[#SIMD+1]]]
-// CHECK-NEXT: [[#SIMD+4]]: #pragma omp simd
+// CHECK-NEXT: [[#SIMD+4]]: lin
+// CHECK-NEXT: [[#SIMD+5]]: step
+// CHECK-NEXT: [[#SIMD+6]]: [B1.[[#SIMD+5]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#SIMD+7]]: #pragma omp simd linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#SIMD+3]]];
-#pragma omp simd
+#pragma omp simd linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#SINGLE:]]: x
@@ -202,39 +219,45 @@ void xxx(int argc) {
: argc) if(cond) firstprivate(fp) reduction(-:rd)
argc = x;
// CHECK-NEXT: [[#TPF:]]:
-// CHECK-SAME: [B1.[[#TPF+10]]]
-// CHECK-NEXT: [[#TPF+1]]: [B1.[[#TPF+10]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT: [[#TPF+2]]: [B1.[[#TPF+9]]]
-// CHECK-NEXT: [[#TPF+3]]: [B1.[[#TPF+9]]] = [B1.[[#TPF+1]]]
+// CHECK-SAME: [B1.[[#TPF+13]]]
+// CHECK-NEXT: [[#TPF+1]]: [B1.[[#TPF+13]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TPF+2]]: [B1.[[#TPF+12]]]
+// CHECK-NEXT: [[#TPF+3]]: [B1.[[#TPF+12]]] = [B1.[[#TPF+1]]]
// CHECK-NEXT: [[#TPF+4]]: cond
// CHECK-NEXT: [[#TPF+5]]: [B1.[[#TPF+4]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#TPF+6]]: [B1.[[#TPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
// CHECK-NEXT: [[#TPF+7]]: fp
// CHECK-NEXT: [[#TPF+8]]: rd
-// CHECK-NEXT: [[#TPF+9]]: argc
-// CHECK-NEXT: [[#TPF+10]]: x
-// CHECK-NEXT: [[#TPF+11]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp) reduction(max: rd)
+// CHECK-NEXT: [[#TPF+9]]: lin
+// CHECK-NEXT: [[#TPF+10]]: step
+// CHECK-NEXT: [[#TPF+11]]: [B1.[[#TPF+10]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TPF+12]]: argc
+// CHECK-NEXT: [[#TPF+13]]: x
+// CHECK-NEXT: [[#TPF+14]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp) reduction(max: rd) linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#TPF+3]]];
-#pragma omp target parallel for if(parallel:cond) firstprivate(fp) reduction(max:rd)
+#pragma omp target parallel for if(parallel:cond) firstprivate(fp) reduction(max:rd) linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#TPFS:]]:
-// CHECK-SAME: [B1.[[#TPFS+10]]]
-// CHECK-NEXT: [[#TPFS+1]]: [B1.[[#TPFS+10]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT: [[#TPFS+2]]: [B1.[[#TPFS+9]]]
-// CHECK-NEXT: [[#TPFS+3]]: [B1.[[#TPFS+9]]] = [B1.[[#TPFS+1]]]
+// CHECK-SAME: [B1.[[#TPFS+13]]]
+// CHECK-NEXT: [[#TPFS+1]]: [B1.[[#TPFS+13]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TPFS+2]]: [B1.[[#TPFS+12]]]
+// CHECK-NEXT: [[#TPFS+3]]: [B1.[[#TPFS+12]]] = [B1.[[#TPFS+1]]]
// CHECK-NEXT: [[#TPFS+4]]: cond
// CHECK-NEXT: [[#TPFS+5]]: [B1.[[#TPFS+4]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#TPFS+6]]: [B1.[[#TPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
// CHECK-NEXT: [[#TPFS+7]]: fp
// CHECK-NEXT: [[#TPFS+8]]: rd
-// CHECK-NEXT: [[#TPFS+9]]: argc
-// CHECK-NEXT: [[#TPFS+10]]: x
-// CHECK-NEXT: [[#TPFS+11]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp) reduction(*: rd)
+// CHECK-NEXT: [[#TPFS+9]]: lin
+// CHECK-NEXT: [[#TPFS+10]]: step
+// CHECK-NEXT: [[#TPFS+11]]: [B1.[[#TPFS+10]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TPFS+12]]: argc
+// CHECK-NEXT: [[#TPFS+13]]: x
+// CHECK-NEXT: [[#TPFS+14]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp) reduction(*: rd) linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#TPFS+3]]];
-#pragma omp target parallel for simd if(target:cond) firstprivate(fp) reduction(*:rd)
+#pragma omp target parallel for simd if(target:cond) firstprivate(fp) reduction(*:rd) linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#TP:]]:
@@ -254,21 +277,24 @@ void xxx(int argc) {
#pragma omp target parallel if(cond) firstprivate(fp) reduction(+:rd)
argc = x;
// CHECK-NEXT: [[#TSIMD:]]:
-// CHECK-SAME: [B1.[[#TSIMD+10]]]
-// CHECK-NEXT: [[#TSIMD+1]]: [B1.[[#TSIMD+10]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT: [[#TSIMD+2]]: [B1.[[#TSIMD+9]]]
-// CHECK-NEXT: [[#TSIMD+3]]: [B1.[[#TSIMD+9]]] = [B1.[[#TSIMD+1]]]
+// CHECK-SAME: [B1.[[#TSIMD+13]]]
+// CHECK-NEXT: [[#TSIMD+1]]: [B1.[[#TSIMD+13]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TSIMD+2]]: [B1.[[#TSIMD+12]]]
+// CHECK-NEXT: [[#TSIMD+3]]: [B1.[[#TSIMD+12]]] = [B1.[[#TSIMD+1]]]
// CHECK-NEXT: [[#TSIMD+4]]: cond
// CHECK-NEXT: [[#TSIMD+5]]: [B1.[[#TSIMD+4]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#TSIMD+6]]: [B1.[[#TSIMD+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
// CHECK-NEXT: [[#TSIMD+7]]: fp
// CHECK-NEXT: [[#TSIMD+8]]: rd
-// CHECK-NEXT: [[#TSIMD+9]]: argc
-// CHECK-NEXT: [[#TSIMD+10]]: x
-// CHECK-NEXT: [[#TSIMD+11]]: #pragma omp target simd if(cond) firstprivate(fp) reduction(+: rd)
+// CHECK-NEXT: [[#TSIMD+9]]: lin
+// CHECK-NEXT: [[#TSIMD+10]]: step
+// CHECK-NEXT: [[#TSIMD+11]]: [B1.[[#TSIMD+10]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TSIMD+12]]: argc
+// CHECK-NEXT: [[#TSIMD+13]]: x
+// CHECK-NEXT: [[#TSIMD+14]]: #pragma omp target simd if(cond) firstprivate(fp) reduction(+: rd) linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#TSIMD+3]]];
-#pragma omp target simd if(cond) firstprivate(fp) reduction(+:rd)
+#pragma omp target simd if(cond) firstprivate(fp) reduction(+:rd) linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#TTD:]]:
@@ -406,21 +432,24 @@ void xxx(int argc) {
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#TLS:]]:
-// CHECK-SAME: [B1.[[#TLS+10]]]
-// CHECK-NEXT: [[#TLS+1]]: [B1.[[#TLS+10]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT: [[#TLS+2]]: [B1.[[#TLS+9]]]
-// CHECK-NEXT: [[#TLS+3]]: [B1.[[#TLS+9]]] = [B1.[[#TLS+1]]]
+// CHECK-SAME: [B1.[[#TLS+13]]]
+// CHECK-NEXT: [[#TLS+1]]: [B1.[[#TLS+13]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TLS+2]]: [B1.[[#TLS+12]]]
+// CHECK-NEXT: [[#TLS+3]]: [B1.[[#TLS+12]]] = [B1.[[#TLS+1]]]
// CHECK-NEXT: [[#TLS+4]]: cond
// CHECK-NEXT: [[#TLS+5]]: [B1.[[#TLS+4]]] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: [[#TLS+6]]: [B1.[[#TLS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
// CHECK-NEXT: [[#TLS+7]]: fp
// CHECK-NEXT: [[#TLS+8]]: rd
-// CHECK-NEXT: [[#TLS+9]]: argc
-// CHECK-NEXT: [[#TLS+10]]: x
-// CHECK-NEXT: [[#TLS+11]]: #pragma omp taskloop simd if(cond) firstprivate(fp) reduction(+: rd)
+// CHECK-NEXT: [[#TLS+9]]: lin
+// CHECK-NEXT: [[#TLS+10]]: step
+// CHECK-NEXT: [[#TLS+11]]: [B1.[[#TLS+10]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT: [[#TLS+12]]: argc
+// CHECK-NEXT: [[#TLS+13]]: x
+// CHECK-NEXT: [[#TLS+14]]: #pragma omp taskloop simd if(cond) firstprivate(fp) reduction(+: rd) linear(lin: step)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: [B1.[[#TLS+3]]];
-#pragma omp taskloop simd if(cond) firstprivate(fp) reduction(+:rd)
+#pragma omp taskloop simd if(cond) firstprivate(fp) reduction(+:rd) linear(lin: step)
for (int i = 0; i < 10; ++i)
argc = x;
// CHECK-NEXT: [[#TDPF:]]: x
Modified: cfe/trunk/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target -Wuninitialized
extern int omp_default_mem_alloc;
+
+void xxx(int argc) {
+ int i;
+#pragma omp distribute parallel for simd linear(i)
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/distribute_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/distribute_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/distribute_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/distribute_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+
+void xxx(int argc) {
+ int i;
+#pragma omp distribute simd linear(i)
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/for_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp for linear(lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/for_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/parallel_for_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp parallel for linear(lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/parallel_for_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,13 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp parallel for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,13 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/target_parallel_for_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_parallel_for_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_parallel_for_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -12,6 +12,13 @@ extern const omp_allocator_handle_t omp_
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp target parallel for linear(lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/target_parallel_for_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_parallel_for_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_parallel_for_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -12,6 +12,13 @@ extern const omp_allocator_handle_t omp_
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp target parallel for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/target_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -12,6 +12,13 @@ extern const omp_allocator_handle_t omp_
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp target simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -12,6 +12,13 @@ extern const omp_allocator_handle_t omp_
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
+void xxx(int argc) {
+ int i, step; // expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp target teams distribute parallel for simd linear(i : step) // expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -12,6 +12,13 @@ extern const omp_allocator_handle_t omp_
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
+void xxx(int argc) {
+ int i, step; // expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp target teams distribute simd linear(i : step) // expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/taskloop_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/taskloop_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -12,6 +12,13 @@ extern const omp_allocator_handle_t omp_
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
+void xxx(int argc) {
+ int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
+#pragma omp taskloop simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+void xxx(int argc) {
+ int i, step; // expected-note {{initialize the variable 'step' to silence this warning}} expected-note {{initialize the variable 'i' to silence this warning}}
+#pragma omp target
+#pragma omp teams distribute parallel for simd linear(i : step) // expected-warning {{variable 'i' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
Modified: cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp?rev=368295&r1=368294&r2=368295&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp Thu Aug 8 06:42:45 2019
@@ -3,6 +3,14 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc;
+void xxx(int argc) {
+ int i, step; // expected-note {{initialize the variable 'step' to silence this warning}} expected-note {{initialize the variable 'i' to silence this warning}}
+#pragma omp target
+#pragma omp teams distribute simd linear(i : step) // expected-warning {{variable 'i' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
+ for (i = 0; i < 10; ++i)
+ ;
+}
+
namespace X {
int x;
};
More information about the cfe-commits
mailing list