I'm surprised a Rust alignment bug is fixed this late. Performance degradation issues due to bad alignment is usually pretty obvious and somewhat easy to notice. I'm assuming vectorized (SSE) code is often generated for 128-bit loads and stores.
Obviously something must have obscured it until now. Anyone knows why?
That and also if you already have other large values, half the time you'd hit the right alignment by accident. Sometimes consistently every time in your app if you're lucky.
8 comments
[ 2.0 ms ] story [ 26.1 ms ] threadObviously something must have obscured it until now. Anyone knows why?
Edit: So it was an LLVM issue. Even weirder. https://reviews.llvm.org/D86310
Edit2: Ok, it's obvious: if you "fix" something like this you can break a lot of code that relies on specific struct alignment. Ouch.
https://blog.rust-lang.org/2024/03/30/i128-layout-update.htm...
Note also that this involves LLVM, so clang < 18 had the same u128 behavior as Rust < 1.77/1.78.
> Clang uses the correct alignment only because of a workaround, where the alignment is manually set to 16 bytes before handing the type to LLVM.
Maybe it took long to notice because it was assumed to be working in LLVM since clang worked?