Skip to content

Commit 92fe6c6

Browse files
author
Martin Wehking
authored
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.
1 parent b92c3fe commit 92fe6c6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ const RegisterBankInfo::ValueMapping *getValueMapping(unsigned BankID,
284284
break;
285285
}
286286

287+
assert(Idx < std::size(ValMappings));
287288
assert(Log2_32_Ceil(Size) == Log2_32_Ceil(ValMappings[Idx].BreakDown->Length));
288289
assert(BankID == ValMappings[Idx].BreakDown->RegBank->getID());
289290

0 commit comments

Comments
 (0)