AttributorAttributes: avoid a crashing on bad alignments
authorAugie Fackler <augie@google.com>
Fri, 11 Feb 2022 23:32:38 +0000 (18:32 -0500)
committerAugie Fackler <augie@google.com>
Wed, 23 Feb 2022 19:21:02 +0000 (14:21 -0500)
commit95f3cc222a510b31c1890ab0e840828634805204
treed9413f969b124aa3367f66ad3b59443b0d9bb3ec
parent280d41d9bbf00a3978d943bc3e56381eed1544ba
AttributorAttributes: avoid a crashing on bad alignments

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.

Differential Revision: https://reviews.llvm.org/D119604
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/heap_to_stack.ll