Skip to content

Commit e294777

Browse files
committed
Removed unncessary warning and updated tests accordingly
1 parent b252aa9 commit e294777

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11612,9 +11612,6 @@ def note_omp_implicit_dsa : Note<
1161211612
"implicitly determined as %0">;
1161311613
def err_omp_loop_var_dsa : Error<
1161411614
"loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
11615-
def warn_omp_different_loop_ind_var_types : Warning <
11616-
"loop sequence following '#pragma omp %0' contains induction variables of differing types: %1 and %2">,
11617-
InGroup<OpenMPLoopForm>;
1161811615
def err_omp_not_canonical_loop : Error <
1161911616
"loop after '#pragma omp %0' is not in canonical form">;
1162011617
def err_omp_not_a_loop_sequence : Error <

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14360,31 +14360,12 @@ bool SemaOpenMP::analyzeLoopSequence(
1436014360
OpenMPDirectiveKind Kind) {
1436114361

1436214362
VarsWithInheritedDSAType TmpDSA;
14363-
QualType BaseInductionVarType;
1436414363
/// Helper Lambda to handle storing initialization and body statements for
14365-
/// both ForStmt and CXXForRangeStmt and checks for any possible mismatch
14366-
/// between induction variables types
14364+
/// both ForStmt and CXXForRangeStmt
1436714365
auto StoreLoopStatements = [&](Stmt *LoopStmt) {
1436814366
if (auto *For = dyn_cast<ForStmt>(LoopStmt)) {
1436914367
OriginalInits.back().push_back(For->getInit());
1437014368
ForStmts.push_back(For);
14371-
// Extract induction variable
14372-
if (auto *InitStmt = dyn_cast_or_null<DeclStmt>(For->getInit())) {
14373-
if (auto *InitDecl = dyn_cast<VarDecl>(InitStmt->getSingleDecl())) {
14374-
QualType InductionVarType = InitDecl->getType().getCanonicalType();
14375-
14376-
// Compare with first loop type
14377-
if (BaseInductionVarType.isNull()) {
14378-
BaseInductionVarType = InductionVarType;
14379-
} else if (!Context.hasSameType(BaseInductionVarType,
14380-
InductionVarType)) {
14381-
Diag(InitDecl->getBeginLoc(),
14382-
diag::warn_omp_different_loop_ind_var_types)
14383-
<< getOpenMPDirectiveName(OMPD_fuse) << BaseInductionVarType
14384-
<< InductionVarType;
14385-
}
14386-
}
14387-
}
1438814369
} else {
1438914370
auto *CXXFor = cast<CXXForRangeStmt>(LoopStmt);
1439014371
OriginalInits.back().push_back(CXXFor->getBeginStmt());

clang/test/OpenMP/fuse_messages.cpp

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ void func() {
7070
for(int j = 0; j < 10; ++j);
7171
}
7272

73-
//expected-warning@+5 {{loop sequence following '#pragma omp fuse' contains induction variables of differing types: 'int' and 'unsigned int'}}
74-
//expected-warning@+5 {{loop sequence following '#pragma omp fuse' contains induction variables of differing types: 'int' and 'long long'}}
75-
#pragma omp fuse
76-
{
77-
for(int i = 0; i < 10; ++i);
78-
for(unsigned int j = 0; j < 10; ++j);
79-
for(long long k = 0; k < 100; ++k);
80-
}
81-
8273
//expected-warning@+2 {{loop range in '#pragma omp fuse' contains only a single loop, resulting in redundant fusion}}
8374
#pragma omp fuse
8475
{
@@ -123,6 +114,40 @@ void func() {
123114
for(int j = 0; j < 100; ++j);
124115
for(int k = 0; k < 50; ++k);
125116
}
117+
118+
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '6' is greater than the total number of loops '5'}}
119+
#pragma omp fuse looprange(1,6)
120+
{
121+
for(int i = 0; i < 10; ++i);
122+
for(int j = 0; j < 100; ++j);
123+
for(int k = 0; k < 50; ++k);
124+
// This fusion results in 2 loops
125+
#pragma omp fuse looprange(1,2)
126+
{
127+
for(int i = 0; i < 10; ++i);
128+
for(int j = 0; j < 100; ++j);
129+
for(int k = 0; k < 50; ++k);
130+
}
131+
}
132+
133+
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '4' is greater than the total number of loops '3'}}
134+
#pragma omp fuse looprange(2,3)
135+
{
136+
#pragma omp unroll partial(2)
137+
for(int i = 0; i < 10; ++i);
138+
139+
#pragma omp reverse
140+
for(int j = 0; j < 10; ++j);
141+
142+
#pragma omp fuse
143+
{
144+
{
145+
#pragma omp reverse
146+
for(int j = 0; j < 10; ++j);
147+
}
148+
for(int k = 0; k < 50; ++k);
149+
}
150+
}
126151
}
127152

128153
// In a template context, but expression itself not instantiation-dependent

0 commit comments

Comments
 (0)