OSDN Git Service

Fix a somewhat surprising miscompile where code relying on an ABI
authorChandler Carruth <chandlerc@gmail.com>
Sat, 29 Sep 2012 10:41:21 +0000 (10:41 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 29 Sep 2012 10:41:21 +0000 (10:41 +0000)
commitb67c9a5b0295faaab40c6c64c433ab679d225a70
tree9ffd2d4f59d8e308ad39667f9335e8031bcecade
parent454627252b1cc43e81949d41eb20e9ea9560da58
Fix a somewhat surprising miscompile where code relying on an ABI
alignment could lose it due to the alloca type moving down to a much
smaller alignment guarantee.

Now SROA will actively compute a proper alignment, factoring the target
data, any explicit alignment, and the offset within the struct. This
will in some cases lower the alignment requirements, but when we lower
them below those of the type, we drop the alignment entirely to give
freedom to the code generator to align it however is convenient.

Thanks to Duncan for the lovely test case that pinned this down. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164891 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/alignment.ll