diff options
author | Craig Topper <craig.topper@intel.com> | 2018-09-27 21:28:46 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-09-27 21:28:46 +0000 |
commit | dfc0f289faa6d7284113df4795d4e22657f42d7d (patch) | |
tree | aa6d60c704633184aec04ef4c09f7bc836c2af4f /llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp | |
parent | a6478ac5d4931967ec22cbc86c4f5014f0e7d3c4 (diff) | |
download | bcm5719-llvm-dfc0f289faa6d7284113df4795d4e22657f42d7d.tar.gz bcm5719-llvm-dfc0f289faa6d7284113df4795d4e22657f42d7d.zip |
[ScalarizeMaskedMemIntrin] Handle the case where the mask is an all zero vector.
This shouldn't really happen in practice I hope, but we tried to handle other constant cases. We missed this one because we checked for ConstantVector without realizing that zero becomes ConstantAggregateZero instead.
So instead just check for Constant and use getAggregateElement which will do the dirty work for us.
llvm-svn: 343270
Diffstat (limited to 'llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp index 549697c7139..35580df42f1 100644 --- a/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp +++ b/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp @@ -151,9 +151,9 @@ static void scalarizeMaskedLoad(CallInst *CI) { // The result vector Value *VResult = UndefVal; - if (isa<ConstantVector>(Mask)) { + if (isa<Constant>(Mask)) { for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) { - if (cast<ConstantVector>(Mask)->getOperand(Idx)->isNullValue()) + if (cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) continue; Value *Gep = Builder.CreateInBoundsGEP(EltTy, FirstEltPtr, Builder.getInt32(Idx)); @@ -280,9 +280,9 @@ static void scalarizeMaskedStore(CallInst *CI) { Value *FirstEltPtr = Builder.CreateBitCast(Ptr, NewPtrType); unsigned VectorWidth = VecType->getNumElements(); - if (isa<ConstantVector>(Mask)) { + if (isa<Constant>(Mask)) { for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) { - if (cast<ConstantVector>(Mask)->getOperand(Idx)->isNullValue()) + if (cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) continue; Value *OneElt = Builder.CreateExtractElement(Src, Builder.getInt32(Idx)); Value *Gep = @@ -385,9 +385,9 @@ static void scalarizeMaskedGather(CallInst *CI) { unsigned VectorWidth = VecType->getNumElements(); // Shorten the way if the mask is a vector of constants. - if (isa<ConstantVector>(Mask)) { + if (isa<Constant>(Mask)) { for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) { - if (cast<ConstantVector>(Mask)->getOperand(Idx)->isNullValue()) + if (cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) continue; Value *Ptr = Builder.CreateExtractElement(Ptrs, Builder.getInt32(Idx), "Ptr" + Twine(Idx)); @@ -504,9 +504,9 @@ static void scalarizeMaskedScatter(CallInst *CI) { unsigned VectorWidth = Src->getType()->getVectorNumElements(); // Shorten the way if the mask is a vector of constants. - if (isa<ConstantVector>(Mask)) { + if (isa<Constant>(Mask)) { for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) { - if (cast<ConstantVector>(Mask)->getOperand(Idx)->isNullValue()) + if (cast<ConstantVector>(Mask)->getAggregateElement(Idx)->isNullValue()) continue; Value *OneElt = Builder.CreateExtractElement(Src, Builder.getInt32(Idx), "Elt" + Twine(Idx)); |