-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[Clang][OpenMP] Fixing Clang error for metadirective with multiple when clauses and no otherwise #148583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang Author: None (Ritanya-B-Bharadwaj) ChangesFixing - #147336 Full diff: https://github.com/llvm/llvm-project/pull/148583.diff 1 Files Affected:
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index aa6a0c61a2c17..5db2f2e2ccf86 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2704,7 +2704,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
// If no match is found and no otherwise clause is present, skip
// OMP5.2 Chapter 7.4: If no otherwise clause is specified the effect is as
// if one was specified without an associated directive variant.
- if (BestIdx == -1 && Idx == 1) {
+ if (BestIdx == -1 && Idx > 0) {
assert(Tok.is(tok::annot_pragma_openmp_end) &&
"Expecting the end of the pragma here");
ConsumeAnnotationToken();
|
You need to add a LIT test. |
Done! |
: parallel for) when(implementation = {extension(match_none)} \ | ||
: parallel) | ||
for (int i=0; i<10; i++) | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LIT test is passing even without your change above. It needs a bit more work. Furthermore your patch doesn't seem to be enough. The reproducer in #147336 is still failing with your patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the lit test case. The reproducer passes with this patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest adding this:
#pragma omp metadirective when(user = {condition(0)} \
: parallel for) when(user = {condition(0)} \
: target teams distribute parallel for)
for (int i = 0; i < 100; i++)
;
to OpenMP/metadirective_otherwise.cpp
instead. You will need to edit the IR generated.
8c75b3c
to
d6c4b97
Compare
Fixing - #147336