Prior to this change, LLVM would attempt to optimize an
aligned_alloc(33, ...) call to the stack. This flunked an assertion when
trying to emit the alloca, which crashed LLVM. Avoid that with extra
checks.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/IPO/AttributorAttributes.cpp | ||
---|---|---|
6371–6372 | It's best to avoid conversion to integer, to avoid a crash when the alignment is larger than 64-bit. |
Comment Actions
I'm a little confused: isn't it fine for them to still be UB? The only point of this change was to avoid a crash in the compiler when encountering such an alignment.
Comment Actions
It's not UB to provide invalid alignments to aligned_alloc, but that's not something the langref covers.
This change avoids using that invalid alignment on the LLVM-side, avoiding turning defined C-side invalid alignment into a crash/UB on the LLVM side.
It's best to avoid conversion to integer, to avoid a crash when the alignment is larger than 64-bit.