[llvm] 92fe6c6 - Silence illegal address computation warning (#83244)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 08:11:16 PST 2024
Author: Martin Wehking
Date: 2024-03-01T21:41:12+05:30
New Revision: 92fe6c61f900d6479f7ab708784c9e62d7523768
URL: https://github.com/llvm/llvm-project/commit/92fe6c61f900d6479f7ab708784c9e62d7523768
DIFF: https://github.com/llvm/llvm-project/commit/92fe6c61f900d6479f7ab708784c9e62d7523768.diff
LOG: Silence illegal address computation warning (#83244)
Add an assertion before an access of ValMappings to ensure that it is
within the array bounds.
Silence a static analyzer warning through this.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def b/llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
index d6a94c972340ea..0d41d5d2186fd8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
+++ b/llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
@@ -284,6 +284,7 @@ const RegisterBankInfo::ValueMapping *getValueMapping(unsigned BankID,
break;
}
+ assert(Idx < std::size(ValMappings));
assert(Log2_32_Ceil(Size) == Log2_32_Ceil(ValMappings[Idx].BreakDown->Length));
assert(BankID == ValMappings[Idx].BreakDown->RegBank->getID());
More information about the llvm-commits
mailing list