Skip to content

Commit 4100dfe

Browse files
committed
Removed unncessary warning and updated tests accordingly
1 parent e6e00ae commit 4100dfe

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
@@ -11558,9 +11558,6 @@ def note_omp_implicit_dsa : Note<
1155811558
"implicitly determined as %0">;
1155911559
def err_omp_loop_var_dsa : Error<
1156011560
"loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
11561-
def warn_omp_different_loop_ind_var_types : Warning <
11562-
"loop sequence following '#pragma omp %0' contains induction variables of differing types: %1 and %2">,
11563-
InGroup<OpenMPLoopForm>;
1156411561
def err_omp_not_canonical_loop : Error <
1156511562
"loop after '#pragma omp %0' is not in canonical form">;
1156611563
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
@@ -14323,31 +14323,12 @@ bool SemaOpenMP::analyzeLoopSequence(
1432314323
OpenMPDirectiveKind Kind) {
1432414324

1432514325
VarsWithInheritedDSAType TmpDSA;
14326-
QualType BaseInductionVarType;
1432714326
/// Helper Lambda to handle storing initialization and body statements for
14328-
/// both ForStmt and CXXForRangeStmt and checks for any possible mismatch
14329-
/// between induction variables types
14327+
/// both ForStmt and CXXForRangeStmt
1433014328
auto StoreLoopStatements = [&](Stmt *LoopStmt) {
1433114329
if (auto *For = dyn_cast<ForStmt>(LoopStmt)) {
1433214330
OriginalInits.back().push_back(For->getInit());
1433314331
ForStmts.push_back(For);
14334-
// Extract induction variable
14335-
if (auto *InitStmt = dyn_cast_or_null<DeclStmt>(For->getInit())) {
14336-
if (auto *InitDecl = dyn_cast<VarDecl>(InitStmt->getSingleDecl())) {
14337-
QualType InductionVarType = InitDecl->getType().getCanonicalType();
14338-
14339-
// Compare with first loop type
14340-
if (BaseInductionVarType.isNull()) {
14341-
BaseInductionVarType = InductionVarType;
14342-
} else if (!Context.hasSameType(BaseInductionVarType,
14343-
InductionVarType)) {
14344-
Diag(InitDecl->getBeginLoc(),
14345-
diag::warn_omp_different_loop_ind_var_types)
14346-
<< getOpenMPDirectiveName(OMPD_fuse) << BaseInductionVarType
14347-
<< InductionVarType;
14348-
}
14349-
}
14350-
}
1435114332
} else {
1435214333
auto *CXXFor = cast<CXXForRangeStmt>(LoopStmt);
1435314334
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)