[SROA] pr37267: fix assertion failure in integer widening
authorHiroshi Inoue <inouehrs@jp.ibm.com>
Thu, 17 May 2018 06:32:17 +0000 (06:32 +0000)
committerHiroshi Inoue <inouehrs@jp.ibm.com>
Thu, 17 May 2018 06:32:17 +0000 (06:32 +0000)
commitf5c0e6c285d29b7b31d54e690f40fc1122ac6907
tree76ed9f978a880a3bbb1153e7739be1d3e1998cc1
parentcea6db0480b4d9675c81f52a6ea3643994f4865e
[SROA] pr37267: fix assertion failure in integer widening

The current integer widening does not support rewriting partial split slices in rewriteIntegerStore (and rewriteIntegerLoad).
This patch adds explicit checks for this case in isIntegerWideningViableForSlice.
Before r322533, splitting is allowed only for the whole-alloca slice and hence the above case is implicitly rejected by another check `if (DL.getTypeStoreSize(ValueTy) > Size)` because whole-alloca slice is larger than the partition.

Differential Revision: https://reviews.llvm.org/D46750

llvm-svn: 332575
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/Transforms/SROA/pr37267.ll [new file with mode: 0644]