Skip to content

Fix/clang tidy found issue#32

Merged
diptorupd merged 1 commit intoROCm:amd-integrationfrom
diptorupd:fix/clang-tidy-found-issue
May 8, 2026
Merged

Fix/clang tidy found issue#32
diptorupd merged 1 commit intoROCm:amd-integrationfrom
diptorupd:fix/clang-tidy-found-issue

Conversation

@diptorupd
Copy link
Copy Markdown
Collaborator

@diptorupd diptorupd commented May 8, 2026

The existing clang-tidy workflow never ran on the AMDGPU backend. #30 enables an AMDGPU-specific clang-tidy check. The new check flags an existing bit of code as a false positive:

Root cause: clang-tidy's modernize-use-nullptr heuristic flags integer literal 0 as a null-pointer-constant in any context where it's convertible. IRBuilder::CreateSub(Value*, Value*, …) takes pointers, and clang-tidy thought 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-tidy happy — no // NOLINT suppression needed.

@diptorupd diptorupd force-pushed the fix/clang-tidy-found-issue branch from f2c2f3e to a614aeb Compare May 8, 2026 19:22
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.
@diptorupd diptorupd force-pushed the fix/clang-tidy-found-issue branch from a614aeb to df615d5 Compare May 8, 2026 19:24
@diptorupd diptorupd requested review from deepsek and npoulad1 May 8, 2026 19:24
Copy link
Copy Markdown
Collaborator

@deepsek deepsek left a comment

Choose a reason for hiding this comment

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

LGTM! Not only safer, but more correct than existing.

@diptorupd diptorupd merged commit 47459de into ROCm:amd-integration May 8, 2026
2 checks passed
@diptorupd diptorupd deleted the fix/clang-tidy-found-issue branch May 8, 2026 20:25
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.

3 participants