SROA: The alloca type isn't a candidate promotion type for vectors

The alloca's type is irrelevant, only those types which are used in a
load or store of the exact size of the slice should be considered.

This manifested as an assertion failure when we compared the various
types: we had a size mismatch.

This fixes PR21480.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-11-21 02:34:55 +00:00
parent 57ec3b5488
commit 9970214474
3 changed files with 28 additions and 3 deletions
+7
View File
@@ -394,6 +394,13 @@ static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) {
BinaryOperator *Res = CreateMul(Neg->getOperand(1), NegOne, "", Neg, Neg);
Neg->setOperand(1, Constant::getNullValue(Ty)); // Drop use of op.
Res->takeName(Neg);
if (Ty->isIntegerTy()) {
bool NSW = cast<BinaryOperator>(Neg)->hasNoSignedWrap();
bool NUW = cast<BinaryOperator>(Neg)->hasNoUnsignedWrap();
if (NSW || NUW)
Res->setHasNoSignedWrap(true);
Res->setHasNoUnsignedWrap(NUW);
}
Neg->replaceAllUsesWith(Res);
Res->setDebugLoc(Neg->getDebugLoc());
return Res;