mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
94e5a9afe1
The next big change was the introduction of seemingly useless volatile variables into the State structure between aithmetic flag bytes and general purpose registers. I observed that a lot of times LLVM would merge adjacent kills of flags into either a memset intrinsic or into a wider store. This is basically write combining, and these extra volatile fields ensure that writes to adjacent flags are independent. Ancedotally, this also helps dead store elimination. The next change was to the optimizer plugin. Originally this did two things: first, remove calls to __mcsema_defer_inlining, and mark the callers of this function as having to always be inlined. This was to help dead flag elimination as a form of dead store elimination, because removing a pure callinst is fairly trivial. The next thing the optimizer did was replace all __mcsema_undefined_X intrinsics with Undef values. This was generally good but it didn't always do what I wanted. The resulting undef stores would sometimes be eliminated, and other times be replaced with 0-value stores. The latter is suboptimal. The new addition goes through all functions and removes stores of undef values.