It is common for compilers, and LLVM in particular, to transform calls to memcpy or memmove to a number of integer loads and stores of the corresponding bit width. After, load and store instructions can be optimised further. However, semantics of memcpy and memmove specify that the memory is copied as-is in bytes, and LLVM does not have a type to represent the handle to the raw memory (like unsigned char or std::byte in C/C++). This leads to incorrect transformations and miscompilations.

This project aims at introducing a new byte type to LLVM IR to fix miscompilation issues and to make the semantics of type punning in LLVM consistent.


George Mitenkov


  • Juneyoung Lee
  • Nuno Lopes