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 16:46:15 +0000 (11:46 -0500)
commit70ff6fbeb9b5acb4995dc42286954b762d0937fd
treea74c0ab006f0507597f974860853a3bc9a8ccdbe
parent6adf4b039e095224edbbecda5972e5e3353b53b6
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