-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[OpenMP][FIX] Remove unsound omp_get_thread_limit deduplication #79524
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
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function main --scrub-attributes --filter "@omp_get_thread_limit|@use" --version 4 | ||
; RUN: opt -passes=openmp-opt-cgscc -S < %s | FileCheck %s | ||
|
||
declare void @use(i32 noundef) | ||
declare i32 @omp_get_thread_limit() | ||
declare void @__kmpc_set_thread_limit(ptr, i32, i32) | ||
declare i32 @__kmpc_global_thread_num(ptr) | ||
declare noalias ptr @__kmpc_omp_task_alloc(ptr, i32, i32, i64, i64, ptr) | ||
declare void @__kmpc_omp_task_complete_if0(ptr, i32, ptr) | ||
declare void @__kmpc_omp_task_begin_if0(ptr, i32, ptr) | ||
|
||
%struct.ident_t = type { i32, i32, i32, i32, ptr } | ||
|
||
@0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1 | ||
@1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8 | ||
|
||
define i32 @main() local_unnamed_addr { | ||
; CHECK-LABEL: define i32 @main() local_unnamed_addr { | ||
; CHECK: [[CALL_I_I_I:%.*]] = call i32 @omp_get_thread_limit() | ||
; CHECK: call void @use(i32 noundef [[CALL_I_I_I]]) | ||
; CHECK: [[CALL_I_I_I2:%.*]] = call i32 @omp_get_thread_limit() | ||
; CHECK: call void @use(i32 noundef [[CALL_I_I_I2]]) | ||
; | ||
entry: | ||
%0 = call i32 @__kmpc_global_thread_num(ptr nonnull @1) | ||
%1 = call ptr @__kmpc_omp_task_alloc(ptr nonnull @1, i32 %0, i32 1, i64 40, i64 0, ptr nonnull @.omp_task_entry.) | ||
call void @__kmpc_omp_task_begin_if0(ptr nonnull @1, i32 %0, ptr %1) | ||
call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 4) | ||
%call.i.i.i = call i32 @omp_get_thread_limit() | ||
call void @use(i32 noundef %call.i.i.i) | ||
call void @__kmpc_omp_task_complete_if0(ptr nonnull @1, i32 %0, ptr %1) | ||
%2 = call ptr @__kmpc_omp_task_alloc(ptr nonnull @1, i32 %0, i32 1, i64 40, i64 0, ptr nonnull @.omp_task_entry..2) | ||
call void @__kmpc_omp_task_begin_if0(ptr nonnull @1, i32 %0, ptr %2) | ||
call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 3) | ||
%call.i.i.i2 = call i32 @omp_get_thread_limit() | ||
call void @use(i32 noundef %call.i.i.i2) | ||
call void @__kmpc_omp_task_complete_if0(ptr nonnull @1, i32 %0, ptr %2) | ||
ret i32 0 | ||
} | ||
|
||
define internal noundef i32 @.omp_task_entry.(i32 noundef %0, ptr noalias nocapture noundef readonly %1) { | ||
entry: | ||
tail call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 4) | ||
%call.i.i = tail call i32 @omp_get_thread_limit() | ||
tail call void @use(i32 noundef %call.i.i) | ||
ret i32 0 | ||
} | ||
|
||
define internal noundef i32 @.omp_task_entry..2(i32 noundef %0, ptr noalias nocapture noundef readonly %1) { | ||
entry: | ||
tail call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 3) | ||
%call.i.i = tail call i32 @omp_get_thread_limit() | ||
tail call void @use(i32 noundef %call.i.i) | ||
ret i32 0 | ||
} | ||
|
||
!llvm.module.flags = !{!0} | ||
|
||
!0 = !{i32 7, !"openmp", i32 51} |
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.
For a test like this I'd recommend generating the check lines with
llvm/utils/update_test_checks.py --function-signature
.Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks! I'd prefer this too, if possible; will see if there's a way to avoid generating more check lines than I already have (in the past had to use
UTC_ARGS
for in certain cases, but perhaps won't be needed here).Edit:
UTC_ARGS: --function main --scrub-attributes --filter "@omp_get_thread_limit|@use"
does it.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.
Done!