Skip to content

Commit 5fe2210

Browse files
committed
update test, use stringmap
1 parent a05d4cd commit 5fe2210

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

clang/test/SemaOpenCL/builtins-amdgcn-error.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ void test_ds_fmaxf(local float *out, float src, int a) {
155155
void test_fence() {
156156
__builtin_amdgcn_fence(__ATOMIC_SEQ_CST + 1, "workgroup"); // expected-warning {{memory order argument to atomic operation is invalid}}
157157
__builtin_amdgcn_fence(__ATOMIC_ACQUIRE - 1, "workgroup"); // expected-warning {{memory order argument to atomic operation is invalid}}
158-
__builtin_amdgcn_fence(4); // expected-error {{too few arguments to function call, expected 2}}
159-
__builtin_amdgcn_fence(4, 4, 4); // expected-error {{too many arguments to function call, expected 2}}
158+
__builtin_amdgcn_fence(4); // expected-error {{too few arguments to function call, expected at least 2, have 1}}
159+
__builtin_amdgcn_fence(4, 4, 4); // expected-error {{incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'}}
160160
__builtin_amdgcn_fence(3.14, ""); // expected-warning {{implicit conversion from 'double' to 'unsigned int' changes value from 3.14 to 3}}
161161
__builtin_amdgcn_fence(__ATOMIC_ACQUIRE, 5); // expected-error {{incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'}}
162162
const char ptr[] = "workgroup";

llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ class SIMemoryLegalizer final : public MachineFunctionPass {
680680
bool runOnMachineFunction(MachineFunction &MF) override;
681681
};
682682

683-
static std::array<std::pair<StringLiteral, SIAtomicAddrSpace>, 3> ASNames = {{
683+
static const StringMap<SIAtomicAddrSpace> ASNames = {{
684684
{"global", SIAtomicAddrSpace::GLOBAL},
685685
{"local", SIAtomicAddrSpace::LDS},
686686
{"image", SIAtomicAddrSpace::SCRATCH},
@@ -715,11 +715,7 @@ static SIAtomicAddrSpace getFenceAddrSpaceMMRA(const MachineInstr &MI,
715715
if (Prefix != FenceASPrefix)
716716
continue;
717717

718-
auto It = find_if(ASNames, [Suffix = Suffix](auto &Pair) {
719-
return Pair.first == Suffix;
720-
});
721-
722-
if (It != ASNames.end())
718+
if (auto It = ASNames.find(Suffix); It != ASNames.end())
723719
Result |= It->second;
724720
else
725721
diagnoseUnknownMMRAASName(MI, Suffix);

0 commit comments

Comments
 (0)