Skip to content

Commit a6512e2

Browse files
Fix deduction for definition of FixupInfo<Kind>::Opcode
1 parent 7998df6 commit a6512e2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/ExecutionEngine/JITLink/aarch32.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ template <EdgeKind_aarch32 K> constexpr bool isThumb() {
264264

265265
template <EdgeKind_aarch32 K> constexpr bool hasOpcode(...) { return false; }
266266
template <EdgeKind_aarch32 K, auto _ = FixupInfo<K>::Opcode>
267-
constexpr bool hasOpcode(int) {
268-
return true;
269-
}
267+
constexpr bool hasOpcode(int) { return true; }
268+
template <EdgeKind_aarch32 K, auto _ = FixupInfo<K>::Opcode.Lo>
269+
constexpr bool hasOpcode(unsigned) { return true; }
270270

271271
template <EdgeKind_aarch32 K> static bool checkOpcodeArm(uint32_t Wd) {
272272
return (Wd & FixupInfo<K>::OpcodeMask) == FixupInfo<K>::Opcode;
@@ -282,12 +282,11 @@ template <EdgeKind_aarch32 K>
282282
static std::unique_ptr<FixupInfoBase> initFixupInfo() {
283283
auto Entry = std::make_unique<FixupInfo<K>>();
284284
if constexpr (hasOpcode<K>(0)) {
285+
static_assert(isArm<K>() != isThumb<K>(), "Classes are mutually exclusive");
285286
if constexpr (isArm<K>())
286287
Entry->checkOpcode = checkOpcodeArm<K>;
287-
else if constexpr (isThumb<K>())
288+
if constexpr (isThumb<K>())
288289
Entry->checkOpcode = checkOpcodeThumb<K>;
289-
else
290-
llvm_unreachable("Visited edge kinds must either be Arm or Thumb");
291290
}
292291
return Entry;
293292
}

0 commit comments

Comments
 (0)