[llvm] Initialize PreferredAlign in Function (PR #192156)
Schuyler Eldridge via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 20:38:31 PDT 2026
seldridge wrote:
@boomanaiden154 wrote:
> Do you have a test case that exposes this with msan/asan? I'm surprised we haven't seen this with any of our internal sanitizer enabled testing.
I don't have a nice test case, only the CIRCT build of a tool called `arcilator` and a valgrind run of that with a small MLIR test case. I can provide this if useful. I'm also getting more people on our side to check this and see if they can dig up anything better than what I have here.
@pcc wrote:
> MaybeAlign derives from std::optional whose default constructor initializes the object as empty. So this looks like a false positive.
Yeah, something doesn't seem right about the fix. I may have pulled the trigger on the LLM output too quickly, even if it is "fixing" this.
> I don't think we want to land workarounds for false positives in old compilers (assuming this does in fact work around the bug, which is unclear) without a good reason, and it looks like you've already upgraded the compiler in circt CI, so I think I'd prefer to keep this as is.
Ignoring older compilers, which I've been want to do, has been met with some resistance. CIRCT users (people working in or adjacent to the hardware industry) are often stuck on older Linux distributions (usually some RHEL) as the hardware tool vendors only officially support these and IT departments are reluctant to deviate. Hence, there's been requests to ensure that CIRCT continues to build with older compilers available by default on older distributions or "industry" distributions that ship older compilers. This, admittedly, is not any kind of crash, but a likely valgrind false positive which wouldn't preclude the older distribution use case.
I don't, yet, have this working in our CI. Only with non-CI tests with Clang 21 and 22.
What I will do is to change the version of clang that we're using for the valgrind build and also expand our build matrix to do more testing of different clang versions without valgrind. I'll try clang 19 first (as I've seen the valgrind issue in both 17 and 18).
This specific valgrind error is somewhat annoying as it is triggered by the default clang version (17) available in the default Linux GitHub Actions runner (Ubuntu 24.04).
https://github.com/llvm/llvm-project/pull/192156
More information about the llvm-commits
mailing list