Skip to content

Commit eabf7ec

Browse files
committed
[GlobalISel] Fix misaligned read after #74429
1 parent c3fa4b7 commit eabf7ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ class GIMatchTableExecutor {
690690
bool isObviouslySafeToFold(MachineInstr &MI, MachineInstr &IntoMI) const;
691691

692692
template <typename Ty> static Ty readBytesAs(const uint8_t *MatchTable) {
693-
return *reinterpret_cast<const Ty *>(MatchTable);
693+
Ty res;
694+
memcpy(&res, MatchTable, sizeof(res));
695+
return res;
694696
}
695697
};
696698

0 commit comments

Comments
 (0)