[llvm] 6cbfffb - [AMDGPU] Declare TableRef in terms of ArrayRef (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 16 10:56:25 PDT 2022
Author: Kazu Hirata
Date: 2022-07-16T10:56:20-07:00
New Revision: 6cbfffb3a3a98032f93bc1b686a9d6fe3d9b3d14
URL: https://github.com/llvm/llvm-project/commit/6cbfffb3a3a98032f93bc1b686a9d6fe3d9b3d14
DIFF: https://github.com/llvm/llvm-project/commit/6cbfffb3a3a98032f93bc1b686a9d6fe3d9b3d14.diff
LOG: [AMDGPU] Declare TableRef in terms of ArrayRef (NFC)
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index 78e092b2e8727..763b0f769c69e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -376,15 +376,7 @@ static bool HasNative(AMDGPULibFunc::EFuncId id) {
return false;
}
-struct TableRef {
- size_t size;
- const TableEntry *table; // variable size: from 0 to (size - 1)
-
- TableRef() : size(0), table(nullptr) {}
-
- template <size_t N>
- TableRef(const TableEntry (&tbl)[N]) : size(N), table(&tbl[0]) {}
-};
+using TableRef = ArrayRef<TableEntry>;
static TableRef getOptTable(AMDGPULibFunc::EFuncId id) {
switch(id) {
@@ -698,11 +690,11 @@ bool AMDGPULibCalls::fold(CallInst *CI, AliasAnalysis *AA) {
bool AMDGPULibCalls::TDOFold(CallInst *CI, const FuncInfo &FInfo) {
// Table-Driven optimization
const TableRef tr = getOptTable(FInfo.getId());
- if (tr.size==0)
+ if (tr.empty())
return false;
- int const sz = (int)tr.size;
- const TableEntry * const ftbl = tr.table;
+ int const sz = (int)tr.size();
+ const TableEntry * const ftbl = tr.data();
Value *opr0 = CI->getArgOperand(0);
if (getVecSize(FInfo) > 1) {
More information about the llvm-commits
mailing list