[PATCH] D104648: [Mem2Reg] Use poison instead of undef for read of uninitialized memory

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 04:56:03 PDT 2021


nlopes added a comment.

> @nlopes Ugh, this is ugly. The fact that clang is using this also means that we can't just ignore bitcode autoupgrade. Adding a freeze on every load seems like a really big hammer, but I'm not sure what else could be done.

It would be just loads for bitfields. They are not common, so I guess it's ok.

There are technically better solutions, but require more functionality in the IR. But I don't think it's worth it for such an uncommon feature.
A better solution come to mind:
Introduce "really packed" structs, where we push all the ABI work to the frontend. LLVM's packed structs still go through the ABI code and may get extra padding, while we would need something that bypasses the padding so we could encode bitfields precisely.
This solution doesn't require any freezing, but it's more complicated: requires additional IR features, backend work, etc. So the load+freeze for bitfields sounds better to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104648/new/

https://reviews.llvm.org/D104648



More information about the llvm-commits mailing list