-
Notifications
You must be signed in to change notification settings - Fork 752
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
[clang-linker-wrapper][NFC] Remove dead code #16879
base: sycl
Are you sure you want to change the base?
Conversation
InputFiles variable defined in the function is not used. If statements below define local scope variables with the same name.
@@ -2364,14 +2364,6 @@ Expected<SmallVector<StringRef>> linkAndWrapDeviceFiles( | |||
HasNonSYCLOffloadKinds = true; | |||
} | |||
|
|||
// Write any remaining device inputs to an output 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.
This seems to be a community code: https://github.com/llvm/llvm-project/blame/main/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp#L939
I would suggest to drop our own copy within HasSYCLOffloadKind
instead to reduce divergence with the upstream.
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.
"HasNonSYCLOffloadKinds
branch" builds similar vector differently. I think this is the reason to sink InputFiles
initialization into if-conditions.
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.
"
HasNonSYCLOffloadKinds
branch" builds similar vector differently. I think this is the reason to sinkInputFiles
initialization into if-conditions.
It modifies InputFiles
, but the code to initialize seems to be absolutely the same. In that case it is not clear to me as to why we can't re-use the community code here.
If your concern is that we have some other if
and other scopes below which also define InputFiles
and shadow the original variable, then I would say we should fix those. Shadowing variables is not a good idea
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.
It modifies
InputFiles
, but the code to initialize seems to be absolutely the same. In that case it is not clear to me as to why we can't re-use the community code here.
They are different. Please compare:
https://github.com/intel/llvm/blob/sycl/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp#L2376-L2383 and https://github.com/intel/llvm/blob/sycl/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp#L2464-L2475.
Shadowing variables is not a good idea
That's the reason I remove it. If we go with your proposal, we still have to use shadowing due to the difference I mentioned above.
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.
That's the reason I remove it. If we go with your proposal, we still have to use shadowing due to the difference I mentioned above.
Isn't better to fix shadowing in our own code which was added on top of the upstream instead of dropping the upstream code?
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.
If you have any suggestions, I'm all ears.
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.
If you have any suggestions, I'm all ears.
#16926 is an alternative proposal. I would love to see even more unification, but I can't quickly propose anything as it requires more investigation
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.
Your proposal doesn't work. I left a comment in #16926.
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.
Good catch Alexey. I think this variable was missed as the code evolved over time.
Also, there will be considerable cleanup if/when we fully move to using clang-sycl-linker.
Thanks
InputFiles variable defined in the function is not used. If statements below define local scope variables with the same name.