[llvm] 51bc0c1 - [HLSL][NFC] Fix range check in verifyRegisterSpace (#152615)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 10:04:38 PDT 2025


Author: Shafik Yaghmour
Date: 2025-08-08T10:04:34-07:00
New Revision: 51bc0c1d6bb9ab2c1c2acb3f37d00ed919202973

URL: https://github.com/llvm/llvm-project/commit/51bc0c1d6bb9ab2c1c2acb3f37d00ed919202973
DIFF: https://github.com/llvm/llvm-project/commit/51bc0c1d6bb9ab2c1c2acb3f37d00ed919202973.diff

LOG: [HLSL][NFC] Fix range check in verifyRegisterSpace (#152615)

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.

Added: 
    

Modified: 
    llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp

Removed: 
    


################################################################################
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) {


        


More information about the llvm-commits mailing list