-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Codegen changes for strict modifier with grainsize/num_tasks of taskloop construct #117196
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d19f41d
Initial Codegen changes for strict modifier with grainsize/num_tasks …
01db551
clang-format changes
45fbfad
Merge branch 'main' into strict_modifier
chandraghale 315287d
using smallvector to reduce redundant code
35062a0
Fix for review comment
b92e403
Merge branch 'main' into strict_modifier
chandraghale ef63bdd
Merge branch 'main' into strict_modifier
chandraghale cbaef60
Merge branch 'main' into strict_modifier
chandraghale 6bc0e3f
updated with auto gen check lines
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
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
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
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,165 @@ | ||
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --prefix-filecheck-ir-name _ --version 5 | ||
// RUN: %clang_cc1 -fopenmp -O1 -x c++ -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK | ||
// expected-no-diagnostics | ||
#ifndef HEADER | ||
#define HEADER | ||
|
||
int main(int argc, char **argv) { | ||
#pragma omp task | ||
#pragma omp master taskloop priority(argc) | ||
for (int i = 0; i < 10; ++i) | ||
; | ||
#pragma omp master taskloop nogroup grainsize(strict:argc) | ||
for (int i = 0; i < 10; ++i) | ||
; | ||
int i; | ||
#pragma omp master taskloop if(argc) shared(argc, argv) collapse(2) num_tasks(strict: 4) | ||
for (i = 0; i < argc; ++i) | ||
for (int j = argc; j < argv[argc][argc]; ++j) | ||
; | ||
#pragma omp master taskloop | ||
for (int i = 0; i < 10; ++i) { | ||
#pragma omp cancel taskgroup | ||
#pragma omp cancellation point taskgroup | ||
} | ||
} | ||
struct S { | ||
int a; | ||
S(int c) { | ||
#pragma omp master taskloop shared(c) num_tasks(strict:a) | ||
for (a = 0; a < c; ++a) | ||
; | ||
} | ||
} s(1); | ||
|
||
#endif | ||
|
||
// CHECK-LABEL: define noundef i32 @main( | ||
// CHECK-SAME: i32 noundef [[ARGC:%.*]], ptr noundef [[ARGV:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { | ||
// CHECK-NEXT: [[ENTRY:.*:]] | ||
// CHECK-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4 | ||
// CHECK-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8 | ||
// CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @__kmpc_global_thread_num(ptr nonnull @[[GLOB1:[0-9]+]]) | ||
// CHECK-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4, !tbaa [[TBAA3:![0-9]+]] | ||
// CHECK-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8, !tbaa [[TBAA7:![0-9]+]] | ||
// CHECK-NEXT: [[TMP1:%.*]] = tail call ptr @__kmpc_omp_task_alloc(ptr nonnull @[[GLOB1]], i32 [[TMP0]], i32 1, i64 48, i64 1, ptr nonnull @.omp_task_entry..2) | ||
// CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP1]], i64 40 | ||
// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4, !tbaa [[TBAA3]] | ||
// CHECK-NEXT: store i32 [[TMP3]], ptr [[TMP2]], align 8, !tbaa [[TBAA9:![0-9]+]] | ||
// CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @__kmpc_omp_task(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr [[TMP1]]) | ||
// CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @__kmpc_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP5]], 0 | ||
// CHECK-NEXT: br i1 [[DOTNOT]], label %[[OMP_IF_END:.*]], label %[[OMP_IF_THEN:.*]] | ||
// CHECK: [[OMP_IF_THEN]]: | ||
// CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4, !tbaa [[TBAA3]] | ||
// CHECK-NEXT: [[TMP7:%.*]] = tail call ptr @__kmpc_omp_task_alloc(ptr nonnull @[[GLOB1]], i32 [[TMP0]], i32 1, i64 80, i64 1, ptr nonnull @.omp_task_entry..4) | ||
// CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP7]], i64 40 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP8]], align 8, !tbaa [[TBAA13:![0-9]+]] | ||
// CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP7]], i64 48 | ||
// CHECK-NEXT: store i64 9, ptr [[TMP9]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP7]], i64 56 | ||
// CHECK-NEXT: store i64 1, ptr [[TMP10]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP7]], i64 72 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP11]], align 8 | ||
// CHECK-NEXT: [[TMP12:%.*]] = zext i32 [[TMP6]] to i64 | ||
// CHECK-NEXT: tail call void @__kmpc_taskloop_5(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr [[TMP7]], i32 1, ptr nonnull [[TMP8]], ptr nonnull [[TMP9]], i64 1, i32 1, i32 1, i64 [[TMP12]], i32 1, ptr null) #[[ATTR1:[0-9]+]] | ||
// CHECK-NEXT: tail call void @__kmpc_end_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: br label %[[OMP_IF_END]] | ||
// CHECK: [[OMP_IF_END]]: | ||
// CHECK-NEXT: [[TMP13:%.*]] = tail call i32 @__kmpc_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[DOTNOT22:%.*]] = icmp eq i32 [[TMP13]], 0 | ||
// CHECK-NEXT: br i1 [[DOTNOT22]], label %[[OMP_IF_END17:.*]], label %[[OMP_IF_THEN2:.*]] | ||
// CHECK: [[OMP_IF_THEN2]]: | ||
// CHECK-NEXT: tail call void @__kmpc_taskgroup(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[TMP14:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4, !tbaa [[TBAA3]] | ||
// CHECK-NEXT: [[TMP15:%.*]] = load ptr, ptr [[ARGV_ADDR]], align 8, !tbaa [[TBAA7]] | ||
// CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP14]] to i64 | ||
// CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds ptr, ptr [[TMP15]], i64 [[IDXPROM]] | ||
// CHECK-NEXT: [[TMP16:%.*]] = load ptr, ptr [[ARRAYIDX]], align 8, !tbaa [[TBAA7]] | ||
// CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds i8, ptr [[TMP16]], i64 [[IDXPROM]] | ||
// CHECK-NEXT: [[TMP17:%.*]] = load i8, ptr [[ARRAYIDX9]], align 1, !tbaa [[TBAA15:![0-9]+]] | ||
// CHECK-NEXT: [[CONV:%.*]] = sext i8 [[TMP17]] to i32 | ||
// CHECK-NEXT: [[SUB12:%.*]] = sub i32 [[CONV]], [[TMP14]] | ||
// CHECK-NEXT: [[CONV15:%.*]] = zext i32 [[SUB12]] to i64 | ||
// CHECK-NEXT: [[MUL:%.*]] = mul nsw i64 [[CONV15]], [[IDXPROM]] | ||
// CHECK-NEXT: [[SUB16:%.*]] = add nsw i64 [[MUL]], -1 | ||
// CHECK-NEXT: [[TMP18:%.*]] = tail call ptr @__kmpc_omp_task_alloc(ptr nonnull @[[GLOB1]], i32 [[TMP0]], i32 1, i64 80, i64 16, ptr nonnull @.omp_task_entry..6) | ||
// CHECK-NEXT: [[TMP19:%.*]] = load ptr, ptr [[TMP18]], align 8, !tbaa [[TBAA16:![0-9]+]] | ||
// CHECK-NEXT: store ptr [[ARGC_ADDR]], ptr [[TMP19]], align 8, !tbaa [[TBAA7]] | ||
// CHECK-NEXT: [[AGG_CAPTURED3_SROA_2_0__SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[TMP19]], i64 8 | ||
// CHECK-NEXT: store ptr [[ARGV_ADDR]], ptr [[AGG_CAPTURED3_SROA_2_0__SROA_IDX]], align 8, !tbaa [[TBAA7]] | ||
// CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4, !tbaa [[TBAA3]] | ||
// CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[TMP20]], 0 | ||
// CHECK-NEXT: [[TMP21:%.*]] = sext i1 [[TOBOOL]] to i32 | ||
// CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP18]], i64 40 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP22]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP18]], i64 48 | ||
// CHECK-NEXT: store i64 [[SUB16]], ptr [[TMP23]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP18]], i64 56 | ||
// CHECK-NEXT: store i64 1, ptr [[TMP24]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP18]], i64 72 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP25]], align 8 | ||
// CHECK-NEXT: call void @__kmpc_taskloop_5(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr nonnull [[TMP18]], i32 [[TMP21]], ptr nonnull [[TMP22]], ptr nonnull [[TMP23]], i64 1, i32 1, i32 2, i64 4, i32 1, ptr null) #[[ATTR1]] | ||
// CHECK-NEXT: call void @__kmpc_end_taskgroup(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: call void @__kmpc_end_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: br label %[[OMP_IF_END17]] | ||
// CHECK: [[OMP_IF_END17]]: | ||
// CHECK-NEXT: [[TMP26:%.*]] = call i32 @__kmpc_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[DOTNOT23:%.*]] = icmp eq i32 [[TMP26]], 0 | ||
// CHECK-NEXT: br i1 [[DOTNOT23]], label %[[OMP_IF_END21:.*]], label %[[OMP_IF_THEN18:.*]] | ||
// CHECK: [[OMP_IF_THEN18]]: | ||
// CHECK-NEXT: call void @__kmpc_taskgroup(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[TMP27:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr nonnull @[[GLOB1]], i32 [[TMP0]], i32 1, i64 80, i64 1, ptr nonnull @.omp_task_entry..8) | ||
// CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP27]], i64 40 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP28]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP27]], i64 48 | ||
// CHECK-NEXT: store i64 9, ptr [[TMP29]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP27]], i64 56 | ||
// CHECK-NEXT: store i64 1, ptr [[TMP30]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP27]], i64 72 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP31]], align 8 | ||
// CHECK-NEXT: call void @__kmpc_taskloop(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr [[TMP27]], i32 1, ptr nonnull [[TMP28]], ptr nonnull [[TMP29]], i64 1, i32 1, i32 0, i64 0, ptr null) | ||
// CHECK-NEXT: call void @__kmpc_end_taskgroup(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: call void @__kmpc_end_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: br label %[[OMP_IF_END21]] | ||
// CHECK: [[OMP_IF_END21]]: | ||
// CHECK-NEXT: ret i32 0 | ||
// | ||
// | ||
// | ||
// CHECK-LABEL: define linkonce_odr void @_ZN1SC2Ei( | ||
// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[C:%.*]]) unnamed_addr #[[ATTR6:[0-9]+]] align 2 { | ||
// CHECK-NEXT: [[ENTRY:.*:]] | ||
// CHECK-NEXT: [[C_ADDR:%.*]] = alloca i32, align 4 | ||
// CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @__kmpc_global_thread_num(ptr nonnull @[[GLOB1]]) | ||
// CHECK-NEXT: store i32 [[C]], ptr [[C_ADDR]], align 4, !tbaa [[TBAA3]] | ||
// CHECK-NEXT: [[TMP1:%.*]] = tail call i32 @__kmpc_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[TMP1]], 0 | ||
// CHECK-NEXT: br i1 [[DOTNOT]], label %[[OMP_IF_END:.*]], label %[[OMP_IF_THEN:.*]] | ||
// CHECK: [[OMP_IF_THEN]]: | ||
// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[THIS]], align 4, !tbaa [[TBAA27:![0-9]+]] | ||
// CHECK-NEXT: tail call void @__kmpc_taskgroup(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[C_ADDR]], align 4, !tbaa [[TBAA3]] | ||
// CHECK-NEXT: [[SUB4:%.*]] = add nsw i32 [[TMP3]], -1 | ||
// CHECK-NEXT: [[TMP4:%.*]] = tail call ptr @__kmpc_omp_task_alloc(ptr nonnull @[[GLOB1]], i32 [[TMP0]], i32 1, i64 80, i64 16, ptr nonnull @.omp_task_entry..10) | ||
// CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8, !tbaa [[TBAA16]] | ||
// CHECK-NEXT: store ptr [[THIS]], ptr [[TMP5]], align 8, !tbaa [[TBAA7]] | ||
// CHECK-NEXT: [[AGG_CAPTURED_SROA_2_0__SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[TMP5]], i64 8 | ||
// CHECK-NEXT: store ptr [[C_ADDR]], ptr [[AGG_CAPTURED_SROA_2_0__SROA_IDX]], align 8, !tbaa [[TBAA7]] | ||
// CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP4]], i64 40 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP6]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP4]], i64 48 | ||
// CHECK-NEXT: [[CONV:%.*]] = sext i32 [[SUB4]] to i64 | ||
// CHECK-NEXT: store i64 [[CONV]], ptr [[TMP7]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP4]], i64 56 | ||
// CHECK-NEXT: store i64 1, ptr [[TMP8]], align 8, !tbaa [[TBAA13]] | ||
// CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP4]], i64 72 | ||
// CHECK-NEXT: store i64 0, ptr [[TMP9]], align 8 | ||
// CHECK-NEXT: [[TMP10:%.*]] = zext i32 [[TMP2]] to i64 | ||
// CHECK-NEXT: call void @__kmpc_taskloop_5(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr nonnull [[TMP4]], i32 1, ptr nonnull [[TMP6]], ptr nonnull [[TMP7]], i64 1, i32 1, i32 2, i64 [[TMP10]], i32 1, ptr null) #[[ATTR1]] | ||
// CHECK-NEXT: call void @__kmpc_end_taskgroup(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: call void @__kmpc_end_master(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) | ||
// CHECK-NEXT: br label %[[OMP_IF_END]] | ||
// CHECK: [[OMP_IF_END]]: | ||
// CHECK-NEXT: ret void | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.