Skip to content

[HLSL][NFC] Fix range check in verifyRegisterSpace #152615

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
Aug 8, 2025

Conversation

shafik
Copy link
Collaborator

@shafik shafik commented Aug 7, 2025

Static analysis flagged the second part of this range check as always true. RegisterSpace is uint32_t therefore the max value is 0xFFFFFFFF and so the first check is sufficient.

Static analysis flagged the second part of this range check as always true.
RegisterSpace is uint32_t therefore the max value is 0xFFFFFFFF and so the
first check is sufficient.
@llvmbot llvmbot added the HLSL HLSL Language Support label Aug 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 7, 2025

@llvm/pr-subscribers-hlsl

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged the second part of this range check as always true. RegisterSpace is uint32_t therefore the max value is 0xFFFFFFFF and so the first check is sufficient.


Full diff: https://github.com/llvm/llvm-project/pull/152615.diff

1 Files Affected:

  • (modified) llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp (+1-1)
diff --git a/llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp b/llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp
index 9d84aa838f476..72308a3de5fd4 100644
--- a/llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp
+++ b/llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp
@@ -29,7 +29,7 @@ bool verifyRegisterValue(uint32_t RegisterValue) {
 // This Range is reserverved, therefore invalid, according to the spec
 // https://github.com/llvm/wg-hlsl/blob/main/proposals/0002-root-signature-in-clang.md#all-the-values-should-be-legal
 bool verifyRegisterSpace(uint32_t RegisterSpace) {
-  return !(RegisterSpace >= 0xFFFFFFF0 && RegisterSpace <= 0xFFFFFFFF);
+  return !(RegisterSpace >= 0xFFFFFFF0);
 }
 
 bool verifyRootDescriptorFlag(uint32_t Version, uint32_t FlagsVal) {

@shafik shafik merged commit 51bc0c1 into llvm:main Aug 8, 2025
11 of 12 checks passed
@shafik shafik deleted the verifyRegisterSpace_range_check_fix branch August 8, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants