SROA: Don't drop atomic load/store alignments (PR45010)
authorHans Wennborg <hans@chromium.org>
Thu, 27 Feb 2020 16:01:09 +0000 (17:01 +0100)
committerHans Wennborg <hans@chromium.org>
Fri, 28 Feb 2020 09:38:40 +0000 (10:38 +0100)
commitd48c981697a49653efff9dd14fa692d99e6fa868
tree65ae4a6f72c03bc626f2f074183042a4d724e873
parent6d15c4deab51498b70825fb6cefbbfe8f3d9bdcf
SROA: Don't drop atomic load/store alignments (PR45010)

SROA will drop the explicit alignment on allocas when the ABI guarantees
enough alignment. Because the alignment on new load/store instructions
are set based on the alloca's alignment, that means SROA would end up
dropping the alignment from atomic loads and stores, which is not
allowed (see bug). For those, make sure to always carry over the
alignment from the previous instruction.

Differential revision: https://reviews.llvm.org/D75266
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/Transforms/SROA/alignment.ll