Fix/clang tidy found issue#32
Merged
diptorupd merged 1 commit intoROCm:amd-integrationfrom May 8, 2026
Merged
Conversation
f2c2f3e to
a614aeb
Compare
quadrants/codegen/amdgpu/codegen_amdgpu.cpp: replace the literal `0` in builder->CreateSub(0, input) with tlctx->get_constant(0). The old form tripped modernize-use-nullptr (false positive given CreateSub's Value* signature), and the explicit i32 constant is also more idiomatic — matches the pattern at lines 255, 265, 395, 449 of the same file.
a614aeb to
df615d5
Compare
deepsek
approved these changes
May 8, 2026
Collaborator
deepsek
left a comment
There was a problem hiding this comment.
LGTM! Not only safer, but more correct than existing.
npoulad1
approved these changes
May 8, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The existing
clang-tidyworkflow never ran on the AMDGPU backend. #30 enables an AMDGPU-specificclang-tidycheck. The new check flags an existing bit of code as a false positive:Root cause:
clang-tidy'smodernize-use-nullptrheuristic flags integer literal 0 as a null-pointer-constant in any context where it's convertible.IRBuilder::CreateSub(Value*, Value*, …)takes pointers, andclang-tidythought 0 here meant a null pointer. It's a false positive (the actual semantic is "subtract input from integer zero"), but the cleaner fix is also semantically more correct — explicitly construct the i32 LLVM constant the way the surrounding code does (tlctx->get_constant(...)is the project's idiomatic helper, used at lines 255, 265, 395, 449 of the same file).The changes here updates the code to match the project's pattern and makes both the human reader and
clang-tidyhappy — no // NOLINT suppression needed.