-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LinkerWrapper] Extend with usual pass options #96704
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
jdenny-ornl
merged 5 commits into
llvm:main
from
jdenny-ornl:linker-wrapper-pass-options
Jul 11, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
98e04dd
[LinkerWrapper] Extend with usual pass options
jdenny-ornl 5b0cee2
Drop unnecessary amdgpu_kernel from test
jdenny-ornl e345a61
Avoid unnecessary split-file
jdenny-ornl b3bb0b4
Convert test from .ll to .c
jdenny-ornl 7f9093a
Merge branch 'main' into linker-wrapper-pass-options
jdenny-ornl 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,10 @@ | ||
// Check that these simple command lines for listing LLVM options are supported, | ||
// as claimed by 'clang-linker-wrapper --help'. | ||
|
||
// RUN: clang-linker-wrapper -mllvm --help 2>&1 | FileCheck %s | ||
// RUN: clang-linker-wrapper --offload-opt=--help 2>&1 | FileCheck %s | ||
|
||
// Look for a few options supported only after -mllvm and --offload-opt. | ||
// CHECK: OPTIONS: | ||
// CHECK-DAG: --passes=<string> | ||
// CHECK-DAG: --load-pass-plugin=<string> |
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,72 @@ | ||
// Check various clang-linker-wrapper pass options after -offload-opt. | ||
|
||
// REQUIRES: llvm-plugins, llvm-examples | ||
// REQUIRES: x86-registered-target | ||
// REQUIRES: amdgpu-registered-target | ||
|
||
// Setup. | ||
// RUN: mkdir -p %t | ||
// RUN: %clang -cc1 -emit-llvm-bc -o %t/host-x86_64-unknown-linux-gnu.bc \ | ||
// RUN: -disable-O0-optnone -triple=x86_64-unknown-linux-gnu %s | ||
// RUN: %clang -cc1 -emit-llvm-bc -o %t/openmp-amdgcn-amd-amdhsa.bc \ | ||
// RUN: -disable-O0-optnone -triple=amdgcn-amd-amdhsa %s | ||
// RUN: opt %t/openmp-amdgcn-amd-amdhsa.bc -o %t/openmp-amdgcn-amd-amdhsa.bc \ | ||
// RUN: -passes=forceattrs -force-remove-attribute=f:noinline | ||
// RUN: clang-offload-packager -o %t/openmp-x86_64-unknown-linux-gnu.out \ | ||
// RUN: --image=file=%t/openmp-amdgcn-amd-amdhsa.bc,triple=amdgcn-amd-amdhsa | ||
// RUN: %clang -cc1 -S -o %t/host-x86_64-unknown-linux-gnu.s \ | ||
// RUN: -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \ | ||
// RUN: -fembed-offload-object=%t/openmp-x86_64-unknown-linux-gnu.out \ | ||
// RUN: %t/host-x86_64-unknown-linux-gnu.bc | ||
// RUN: %clang -cc1as -o %t/host-x86_64-unknown-linux-gnu.o \ | ||
// RUN: -triple x86_64-unknown-linux-gnu -filetype obj -target-cpu x86-64 \ | ||
// RUN: %t/host-x86_64-unknown-linux-gnu.s | ||
|
||
// Check plugin, -passes, and no remarks. | ||
// RUN: clang-linker-wrapper -o a.out --embed-bitcode \ | ||
// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ | ||
// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ | ||
// RUN: --offload-opt=-passes="function(goodbye),module(inline)" 2>&1 | \ | ||
// RUN: FileCheck -match-full-lines -check-prefixes=OUT %s | ||
|
||
// Check plugin, -p, and remarks. | ||
// RUN: clang-linker-wrapper -o a.out --embed-bitcode \ | ||
// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ | ||
// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ | ||
// RUN: --offload-opt=-p="function(goodbye),module(inline)" \ | ||
// RUN: --offload-opt=-pass-remarks=inline \ | ||
// RUN: --offload-opt=-pass-remarks-output=%t/remarks.yml \ | ||
// RUN: --offload-opt=-pass-remarks-filter=inline \ | ||
// RUN: --offload-opt=-pass-remarks-format=yaml 2>&1 | \ | ||
// RUN: FileCheck -match-full-lines -check-prefixes=OUT,REM %s | ||
// RUN: FileCheck -input-file=%t/remarks.yml -match-full-lines \ | ||
// RUN: -check-prefixes=YML %s | ||
|
||
// Check handling of bad plugin. | ||
// RUN: not clang-linker-wrapper \ | ||
// RUN: --offload-opt=-load-pass-plugin=%t/nonexistent.so 2>&1 | \ | ||
// RUN: FileCheck -match-full-lines -check-prefixes=BAD-PLUGIN %s | ||
|
||
// OUT-NOT: {{.}} | ||
// OUT: Bye: f | ||
// OUT-NEXT: Bye: test | ||
// REM-NEXT: remark: {{.*}} 'f' inlined into 'test' {{.*}} | ||
// OUT-NOT: {{.}} | ||
|
||
// YML-NOT: {{.}} | ||
// YML: --- !Passed | ||
// YML-NEXT: Pass: inline | ||
// YML-NEXT: Name: Inlined | ||
// YML-NEXT: Function: test | ||
// YML-NEXT: Args: | ||
// YML: - Callee: f | ||
// YML: - Caller: test | ||
// YML: ... | ||
// YML-NOT: {{.}} | ||
|
||
// BAD-PLUGIN-NOT: {{.}} | ||
// BAD-PLUGIN: {{.*}}Could not load library {{.*}}nonexistent.so{{.*}} | ||
// BAD-PLUGIN-NOT: {{.}} | ||
|
||
void f() {} | ||
void test() { f(); } |
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
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
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.
Do we have any other tests that just check the output for
--help
? Might be a little excessive.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.
Grepping for -help in llvm's test suite finds various such tests. The point here is to make sure `--offload-opt=--help can list these opt-like options as opposed to the normal clang-linker-wrapper options. Seems like an important feature.