forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
[clang-sycl-linker] Replace llvm-link with API calls #4
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
Draft
asudarsa
wants to merge
16
commits into
master
Choose a base branch
from
replace_llvm_link
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ce34ccd
[clang-sycl-linker] Replace llvm-link with API calls
asudarsa ae0210f
More changes
asudarsa ee487ff
More changes
asudarsa a9255b4
Add tests
asudarsa e0d1859
Major refactoring to address review comments and also add back .bc su…
asudarsa c1611f0
Minor changes
asudarsa 596488c
Modify testcase and update CMakeLists.txt to make sure shared build w…
asudarsa 454c386
Adding more tests and remove support for non-bitcode inputs
asudarsa f4cc3cf
Pruned some tests
asudarsa d76a3a1
Minor fix
asudarsa 7249cb8
Minor fix
asudarsa 59c0bcd
Simplify tests and update comments
asudarsa a5acaa3
Added -dry-run option to testing
asudarsa 0649b61
Remove unnecessary file
asudarsa 987ab66
Valid LLVM IR bitcode input files are required
asudarsa 917987d
Minor changes to align with changes in SPIR-V backend PR
asudarsa 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| target triple = "spirv64" | ||
|
|
||
| define spir_func i32 @bar_func1(i32 %a, i32 %b) { | ||
| entry: | ||
| %res = add nsw i32 %b, %a | ||
| ret i32 %res | ||
| } |
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,15 @@ | ||
| target triple = "spirv64" | ||
|
|
||
| define spir_func i32 @bar_func1(i32 %a, i32 %b) { | ||
| entry: | ||
| %mul = shl nsw i32 %a, 1 | ||
| %res = add nsw i32 %mul, %b | ||
| ret i32 %res | ||
| } | ||
|
|
||
| define spir_func i32 @baz_func1(i32 %a) { | ||
| entry: | ||
| %add = add nsw i32 %a, 5 | ||
| %res = tail call spir_func i32 @bar_func1(i32 %a, i32 %add) | ||
| ret i32 %res | ||
| } |
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,19 @@ | ||
| target triple = "spirv64" | ||
|
|
||
| define spir_func i32 @foo_func1(i32 %a, i32 %b) { | ||
| entry: | ||
| %call = tail call spir_func i32 @addFive(i32 %b) | ||
| %res = tail call spir_func i32 @bar_func1(i32 %a, i32 %call) | ||
| ret i32 %res | ||
| } | ||
|
|
||
| declare spir_func i32 @bar_func1(i32, i32) | ||
|
|
||
| declare spir_func i32 @addFive(i32) | ||
|
|
||
| define spir_func i32 @foo_func2(i32 %c, i32 %d, i32 %e) { | ||
| entry: | ||
| %call = tail call spir_func i32 @foo_func1(i32 %c, i32 %d) | ||
| %res = mul nsw i32 %call, %e | ||
| ret i32 %res | ||
| } |
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,13 @@ | ||
| target triple = "spirv64" | ||
|
|
||
| define spir_func i32 @addFive(i32 %a) { | ||
| entry: | ||
| %res = add nsw i32 %a, 5 | ||
| ret i32 %res | ||
| } | ||
|
|
||
| define spir_func i32 @unusedFunc(i32 %a) { | ||
| entry: | ||
| %res = mul nsw i32 %a, 5 | ||
| ret i32 %res | ||
| } |
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,23 @@ | ||
| # RUN: llvm-as %S/Inputs/SYCL/foo.ll -o %t.foo.bc | ||
| # RUN: llvm-as %S/Inputs/SYCL/bar.ll -o %t.bar.bc | ||
| # RUN: llvm-as %S/Inputs/SYCL/baz.ll -o %t.baz.bc | ||
| # RUN: llvm-as %S/Inputs/SYCL/libsycl.ll -o %t.libsycl.bc | ||
| # RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -triple spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-SIMPLE | ||
|
|
||
| # RUN: not clang-sycl-linker %t.bar.bc %t.baz.bc -triple spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-DEFS | ||
|
|
||
| # RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -device-libs=%t.libsycl.bc -library-path=/ -triple spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-LIB | ||
|
|
||
| ; CHECK-SIMPLE: define {{.*}}foo_func1{{.*}} | ||
| ; CHECK-SIMPLE: define {{.*}}foo_func2{{.*}} | ||
| ; CHECK-SIMPLE: define {{.*}}bar_func1{{.*}} | ||
| ; CHECK-SIMPLE-NOT: define {{.*}}addFive{{.*}} | ||
| ; CHECK-SIMPLE-NOT: define {{.*}}unusedFunc{{.*}} | ||
|
|
||
| ;CHECK-MULTIPLE-DEFS: error: Linking globals named {{.*}}bar_func1{{.*}} symbol multiply defined! | ||
|
|
||
| ; CHECK-DEVICE-LIB: define {{.*}}foo_func1{{.*}} | ||
| ; CHECK-DEVICE-LIB: define {{.*}}foo_func2{{.*}} | ||
| ; CHECK-DEVICE-LIB: define {{.*}}bar_func1{{.*}} | ||
| ; CHECK-DEVICE-LIB: define {{.*}}addFive{{.*}} | ||
| ; CHECK-DEVICE-LIB-NOT: define {{.*}}unusedFunc{{.*}} |
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.
Please, remove this file.
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.
Ah. I deleted that specifically before merge