Skip to content

Commit 6cbfffb

Browse files
[AMDGPU] Declare TableRef in terms of ArrayRef (NFC)
1 parent 9aea9ab commit 6cbfffb

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,7 @@ static bool HasNative(AMDGPULibFunc::EFuncId id) {
376376
return false;
377377
}
378378

379-
struct TableRef {
380-
size_t size;
381-
const TableEntry *table; // variable size: from 0 to (size - 1)
382-
383-
TableRef() : size(0), table(nullptr) {}
384-
385-
template <size_t N>
386-
TableRef(const TableEntry (&tbl)[N]) : size(N), table(&tbl[0]) {}
387-
};
379+
using TableRef = ArrayRef<TableEntry>;
388380

389381
static TableRef getOptTable(AMDGPULibFunc::EFuncId id) {
390382
switch(id) {
@@ -698,11 +690,11 @@ bool AMDGPULibCalls::fold(CallInst *CI, AliasAnalysis *AA) {
698690
bool AMDGPULibCalls::TDOFold(CallInst *CI, const FuncInfo &FInfo) {
699691
// Table-Driven optimization
700692
const TableRef tr = getOptTable(FInfo.getId());
701-
if (tr.size==0)
693+
if (tr.empty())
702694
return false;
703695

704-
int const sz = (int)tr.size;
705-
const TableEntry * const ftbl = tr.table;
696+
int const sz = (int)tr.size();
697+
const TableEntry * const ftbl = tr.data();
706698
Value *opr0 = CI->getArgOperand(0);
707699

708700
if (getVecSize(FInfo) > 1) {

0 commit comments

Comments
 (0)