-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Clang][OpenMP] Bug fix Default clause variable category #165276
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
Merged
Ritanya-B-Bharadwaj
merged 12 commits into
llvm:main
from
SunilKuravinakop:bug_fix_variable_category
Nov 14, 2025
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
822dd15
1) In the default clause, changing check for allocatable type in
60af1ee
Merge branch 'main' into bug_fix_variable_category
SunilKuravinakop 10fef55
Merge branch 'main' into bug_fix_variable_category
SunilKuravinakop f6ef21e
1) Correcting the expected output of llvm IR in clang/test/OpenMP/par…
8329e11
Merge branch 'main' into bug_fix_variable_category
99310f5
Removing unnecessary variable in the CHECK: for
d96b1ff
Merge branch 'main' into bug_fix_variable_category
ee86fd0
Changes to avoid failure on Windows.
d4ee726
Taking care of llvm-lit failure on windows.
528fd62
Removing handling of "allocatable". I do not find a way to handle it at
f7178a8
Avoiding compilation error with Ninja.
cc1c533
Merge branch 'main' into bug_fix_variable_category
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
clang/test/OpenMP/parallel_default_variableCategory_codegen.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| // RUN: %clangxx -DOMP60 -Xclang -verify -Wno-vla -fopenmp -fopenmp-version=60 -x c++ -S -emit-llvm %s -o - | FileCheck --check-prefixes=OMP60 %s | ||
| // expected-no-diagnostics | ||
| #ifndef HEADER | ||
| #define HEADER | ||
|
|
||
| #include <vector> | ||
|
|
||
| int global; | ||
| #define VECTOR_SIZE 4 | ||
| int main (int argc, char **argv) { | ||
| int i,n; | ||
| int x; | ||
|
|
||
| n = VECTOR_SIZE; | ||
|
|
||
| #pragma omp parallel masked firstprivate(x) num_threads(2) | ||
| { | ||
| int *xPtr = nullptr; | ||
| // scalar | ||
| #pragma omp task default(shared:scalar) | ||
| { | ||
| xPtr = &x; | ||
| } | ||
| #pragma omp taskwait | ||
|
|
||
| // pointer | ||
| #pragma omp task default(shared:pointer) shared(x) | ||
| { | ||
| xPtr = &x; | ||
| } | ||
| #pragma omp taskwait | ||
| } | ||
|
|
||
| int *aggregate[VECTOR_SIZE] = {0,0,0,0}; | ||
| std::vector<int *> arr(VECTOR_SIZE,0); | ||
|
|
||
| #pragma omp parallel masked num_threads(2) | ||
| { | ||
| // aggregate | ||
| #pragma omp task default(shared:aggregate) | ||
| for(i=0;i<n;i++) { | ||
| aggregate[i] = &x; | ||
| } | ||
| #pragma omp taskwait | ||
|
|
||
| #pragma omp task default(shared:aggregate) shared(x) | ||
| for(i=0;i<n;i++) { | ||
| aggregate[i] = &x; | ||
| } | ||
| #pragma omp taskwait | ||
|
|
||
| // allocatable | ||
| #pragma omp task default(shared:allocatable) | ||
| for(i=0;i<n;i++) { | ||
| arr[i] = &x; | ||
| } | ||
| #pragma omp taskwait | ||
|
|
||
| #pragma omp task default(shared:allocatable) shared(x) | ||
| for(i=0;i<n;i++) { | ||
| arr[i] = &x; | ||
| } | ||
| #pragma omp taskwait | ||
|
|
||
| // all | ||
| #pragma omp task default(shared:all) | ||
| for(i=0;i<n;i++) { | ||
| aggregate[i] = &x; | ||
| } | ||
| #pragma omp taskwait | ||
| } | ||
| } | ||
|
|
||
| #endif | ||
|
|
||
| // OMP60-LABEL: define {{.*}}main.omp_outlined{{.*}} | ||
| // OMP60-NEXT: entry: | ||
| // OMP60-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8 | ||
| // OMP60-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8 | ||
| // OMP60: [[X_ADDR:%.*]] = alloca{{.*}} | ||
| // OMP60: [[xPTR:%.*]] = alloca{{.*}} | ||
| // OMP60: store ptr null, ptr [[xPTR]]{{.*}} | ||
| // OMP60: store ptr [[xPTR]]{{.*}} | ||
| // OMP60: store ptr [[X_ADDR]]{{.*}} | ||
| // OMP60-NEXT: {{.*}}call{{.*}}__kmpc_omp_task_alloc{{.*}} | ||
| // OMP60: ret void | ||
| // | ||
| // OMP60: define {{.*}}main.omp_outlined{{.*}} | ||
| // OMP60-NEXT: entry: | ||
| // OMP60-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8 | ||
| // OMP60-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8 | ||
| // OMP60: [[I_ADDR:%.*]] = alloca{{.*}} | ||
| // OMP60-NEXT: [[N_ADDR:%.*]] = alloca{{.*}} | ||
| // OMP60-NEXT: [[AGGREGATE_ADDR:%.*]] = alloca{{.*}} | ||
| // OMP60-NEXT: [[X_ADDR:%.*]] = alloca{{.*}} | ||
| // OMP60-NEXT: [[ARR_ADDR:%.*]] = alloca{{.*}} | ||
| // OMP60: [[TMP0:%.*]] = load{{.*}}[[I_ADDR]] | ||
| // OMP60-NEXT: [[TMP1:%.*]] = load{{.*}}[[N_ADDR]] | ||
| // OMP60-NEXT: [[TMP2:%.*]] = load{{.*}}[[AGGREGATE_ADDR]] | ||
| // OMP60-NEXT: [[TMP3:%.*]] = load{{.*}}[[X_ADDR]] | ||
| // OMP60-NEXT: [[TMP4:%.*]] = load{{.*}}[[ARR_ADDR]] | ||
| // OMP60: store ptr [[TMP2]]{{.*}} | ||
| // OMP60-NEXT: {{.*}}call{{.*}}__kmpc_omp_task_alloc{{.*}} | ||
| // OMP60: store ptr [[TMP2]]{{.*}} | ||
| // OMP60: store ptr [[TMP3]]{{.*}} | ||
| // OMP60-NEXT: {{.*}}call{{.*}}__kmpc_omp_task_alloc{{.*}} | ||
| // OMP60: store ptr [[TMP4]]{{.*}} | ||
| // OMP60-NEXT: {{.*}}call{{.*}}__kmpc_omp_task_alloc{{.*}} | ||
| // OMP60: store ptr [[TMP4]]{{.*}} | ||
| // OMP60: store ptr [[TMP3]]{{.*}} | ||
| // OMP60-NEXT: {{.*}}call{{.*}}__kmpc_omp_task_alloc{{.*}} | ||
| // OMP60: store ptr [[TMP0]]{{.*}} | ||
| // OMP60: store ptr [[TMP1]]{{.*}} | ||
| // OMP60: store ptr [[TMP2]]{{.*}} | ||
| // OMP60: store ptr [[TMP3]]{{.*}} | ||
| // OMP60-NEXT: {{.*}}call{{.*}}__kmpc_omp_task_alloc{{.*}} | ||
| // OMP60: ret void |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Poor check, it should not check the names, should check the members