diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h index 73308925e9142..724f39634297a 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h @@ -690,7 +690,9 @@ class GIMatchTableExecutor { bool isObviouslySafeToFold(MachineInstr &MI, MachineInstr &IntoMI) const; template static Ty readBytesAs(const uint8_t *MatchTable) { - return *reinterpret_cast(MatchTable); + Ty res; + memcpy(&res, MatchTable, sizeof(res)); + return res; } };