[llvm] 5290f50 - [AMDGPU] Fix off by one in assert
Sebastian Neubauer via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 03:46:36 PDT 2020
Author: Sebastian Neubauer
Date: 2020-10-21T12:37:52+02:00
New Revision: 5290f50e44b632c22800df15c691394e768796be
URL: https://github.com/llvm/llvm-project/commit/5290f50e44b632c22800df15c691394e768796be
DIFF: https://github.com/llvm/llvm-project/commit/5290f50e44b632c22800df15c691394e768796be.diff
LOG: [AMDGPU] Fix off by one in assert
D89217 did not subtract one when accessing SubRegFromChannelTable in one
place.
Differential Revision: https://reviews.llvm.org/D89804
Added:
Modified:
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
index c7a0121b058b..6000c8a2a7fd 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -98,9 +98,10 @@ SIRegisterInfo::SIRegisterInfo(const GCNSubtarget &ST)
Width = SubRegFromChannelTableWidthMap[Width];
if (Width == 0)
continue;
- assert((Width - 1) < SubRegFromChannelTable.size());
- assert(Offset < SubRegFromChannelTable[Width].size());
- SubRegFromChannelTable[Width - 1][Offset] = Idx;
+ unsigned TableIdx = Width - 1;
+ assert(TableIdx < SubRegFromChannelTable.size());
+ assert(Offset < SubRegFromChannelTable[TableIdx].size());
+ SubRegFromChannelTable[TableIdx][Offset] = Idx;
}
};
More information about the llvm-commits
mailing list