[PATCH] D134410: [clang][CodeGen] Add noundef metadata to load instructions (preliminary 1 or 2)
Nikita Popov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 30 12:59:25 PDT 2022
nikic added a comment.
In D134410#3894995 <https://reviews.llvm.org/D134410#3894995>, @nlopes wrote:
> We wanted this patch to make us switch uninitialized loads to poison at will, since they become UB. In practice, this helps us fixing bugs in SROA and etc without perf degradation.
Can you elaborate on this? I don't see how this is necessary for switching uninitialized loads to poison.
> As long as ubsan/valgrind can detect these uninitialized loads, I think we should be ok to deploy this change.
Valgrind cannot detect uninitialized loads, it only detects branching on uninitialized data. Valgrind works on the assembly level, and as such does not have the necessary information to tell whether a mov of uninitialized data is problematic or not.
The only sanitizer that can detect this is msan (with the patch referenced above), which is incidentally also the sanitizer that sees the least use in practice, because it is much harder to deploy than ubsan and asan.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134410/new/
https://reviews.llvm.org/D134410
More information about the cfe-commits
mailing list