-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][Clang] Permit virtual functions in SYCL #7255
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
steffenlarsen
merged 22 commits into
intel:sycl
from
KornevNikita:virtual-function-crash
Nov 10, 2022
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1b46d5c
[SYCL][Clang] Permit virtual functions in SYCL
KornevNikita 341418c
Apply suggestions
KornevNikita 204d44e
Format
KornevNikita 5feaff5
Update clang/include/clang/Driver/Options.td
KornevNikita f95e4ae
Add a comment
KornevNikita f517858
Merge branch 'virtual-function-crash' of https://github.com/KornevNik…
KornevNikita 8b4784d
Adjust comment
KornevNikita c810c23
Guard changes
KornevNikita 763f7dc
Add LIT-test
KornevNikita f324326
Update clang/test/CodeGenSYCL/simple-sycl-virtual-function.cpp
KornevNikita 9673e95
Update clang/test/CodeGenSYCL/simple-sycl-virtual-function.cpp
KornevNikita 8a49409
Remove redundant check
KornevNikita 614537b
Format & add comm & remove redundant
KornevNikita d5c52f1
Apply suggestions
KornevNikita cb3051b
Fix test
KornevNikita b53a25b
Update clang/test/CodeGenSYCL/simple-sycl-virtual-function.cpp
KornevNikita e5ab819
Apply suggestions
KornevNikita 629494a
Merge branch 'virtual-function-crash' of https://github.com/KornevNik…
KornevNikita 1ba9a23
Update clang/lib/CodeGen/ItaniumCXXABI.cpp
KornevNikita d84e31f
Apply suggestions
KornevNikita 34b17dc
Apply suggestion
KornevNikita d04efa2
Adjust test
KornevNikita 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
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,33 @@ | ||
// This test checks that the FE generates global variables corresponding to the | ||
// virtual table in the global address space (addrspace(1)) when | ||
// -fsycl-allow-virtual-functions is passed. | ||
|
||
// RUN: %clang_cc1 -triple spir64 -fsycl-allow-virtual-functions -fsycl-is-device -emit-llvm %s -o - | FileCheck %s --check-prefixes CHECK,CHECK-PTR | ||
// RUN: %clang_cc1 -triple spir64 -fsycl-allow-virtual-functions -fsycl-is-device -fexperimental-relative-c++-abi-vtables -emit-llvm %s -o - | FileCheck %s --check-prefixes CHECK,CHECK-REL | ||
|
||
KornevNikita marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// CHECK: @_ZTVN10__cxxabiv120__si_class_type_infoE = external addrspace(1) global ptr addrspace(1) | ||
// CHECK: @_ZTVN10__cxxabiv117__class_type_infoE = external addrspace(1) global ptr addrspace(1) | ||
// CHECK-PTR: @_ZTI4Base = linkonce_odr constant { ptr addrspace(1), ptr } { ptr addrspace(1) getelementptr inbounds (ptr addrspace(1), ptr addrspace(1) @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) | ||
// CHECK-PTR: @_ZTI8Derived1 = linkonce_odr constant { ptr addrspace(1), ptr, ptr } { ptr addrspace(1) getelementptr inbounds (ptr addrspace(1), ptr addrspace(1) @_ZTVN10__cxxabiv120__si_class_type_infoE, i64 2) | ||
// CHECK-REL: @_ZTI4Base = linkonce_odr constant { ptr addrspace(1), ptr } { ptr addrspace(1) getelementptr inbounds (i8, ptr addrspace(1) @_ZTVN10__cxxabiv117__class_type_infoE, i32 8) | ||
// CHECK-REL: @_ZTI8Derived1 = linkonce_odr constant { ptr addrspace(1), ptr, ptr } { ptr addrspace(1) getelementptr inbounds (i8, ptr addrspace(1) @_ZTVN10__cxxabiv120__si_class_type_infoE, i32 8) | ||
|
||
SYCL_EXTERNAL bool rand(); | ||
|
||
class Base { | ||
public: | ||
virtual void display() {} | ||
}; | ||
|
||
class Derived1 : public Base { | ||
public: | ||
void display() {} | ||
}; | ||
|
||
SYCL_EXTERNAL void test() { | ||
Derived1 d1; | ||
Base *b = nullptr; | ||
if (rand()) | ||
b = &d1; | ||
b->display(); | ||
} |
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.