[llvm] Fix Valgrind false-positive in Value::getPointerAlignment for Functions (PR #175714)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 13 11:08:06 PST 2026
boomanaiden154 wrote:
> In our experience the issue appears in Debug and RelWithDebInfo builds and not in Release builds. I've been chasing this for long time and I cannot fully claim that I understand it. MaybeAlign derives from std::optional and perhaps the compiler fails to optimize the union inside it. There are a few valgrind false positive complaints around std::optional on the internet, too. I do not know how to reproduce this issue upstream with a small test... That causes a lot of suppression files to be created, hence my push for this patch to get in.
I'm not a huge fan of pessimizing our code quality to satisfy valgrind. We already have coverage for the sorts of failures that valgrind would find with sanitizers (and with the sanitizer bots through CI). And I'm especially not a huge fan of landing a change like this without a complete understanding of what is actually happening. If there is a claim that valgrind is wrong, there should be sufficient evidence that valgrind is actually wrong. The last time I found code mentioning it was hacking around a valgrind bug in LLVM, it turned out the code in LLVM was wrong (although the hacky patch did correctly fix the issue). I would not expect the compiler failing to optimize something would trip up valgrind.
https://github.com/llvm/llvm-project/pull/175714
More information about the llvm-commits
mailing list