Skip to content

[ESIMD] Fix removal of "llvm.used" global in sycl-post-link #5853

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 1 commit into from
Mar 22, 2022

Conversation

v-klochkov
Copy link
Contributor

The code removing llvm.used global in sycl-post-link wrongly
assumed that all elements of the global array are either functions
or function declarations. In fact llvm.used also may contain specialization
constants as well.
The fix adds additional check of IR before removal.

Signed-off-by: Vyacheslav N Klochkov [email protected]

The code removing llvm.used global in sycl-post-link wrongly
assumed that all elements of the global array are either functions
or function declarations. In fact llvm.used also may contain specialization
constants as well.
The fix adds additional check of IR before removal.

Signed-off-by: Vyacheslav N Klochkov <[email protected]>
@v-klochkov v-klochkov requested a review from a team as a code owner March 21, 2022 23:58
@v-klochkov v-klochkov requested a review from mlychkov March 22, 2022 03:05
@@ -859,10 +859,11 @@ static bool removeSYCLKernelsConstRefArray(GlobalVariable *GV) {
for (auto It = IOperands.begin(); It != IOperands.end(); It++) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (auto It = IOperands.begin(); It != IOperands.end(); It++) {
for (auto *It = IOperands.begin(); It != IOperands.end(); It++) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested change is NFC, both syntax variants mean the same here.
I prefer 'auto It = ...'. It is also way more typical syntax (about 2000 cases in sources vs 54 cases of 'auto *It = ' )

@AlexeySachkov AlexeySachkov merged commit 840fffd into intel:sycl Mar 22, 2022
@v-klochkov v-klochkov deleted the esimd_static_linking_fix branch March 22, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants