Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions llvm/lib/Analysis/VectorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ bool llvm::maskIsAllZeroOrUndef(Value *Mask) {
auto *ConstMask = dyn_cast<Constant>(Mask);
if (!ConstMask)
return false;
if (ConstMask->isNullValue() || isa<UndefValue>(ConstMask))
if (match(ConstMask, m_CombineOr(m_Zero(), m_Undef())))
return true;
if (isa<ScalableVectorType>(ConstMask->getType()))
return false;
Expand All @@ -1272,7 +1272,7 @@ bool llvm::maskIsAllZeroOrUndef(Value *Mask) {
E = cast<FixedVectorType>(ConstMask->getType())->getNumElements();
I != E; ++I) {
if (auto *MaskElt = ConstMask->getAggregateElement(I))
if (MaskElt->isNullValue() || isa<UndefValue>(MaskElt))
if (match(MaskElt, m_CombineOr(m_Zero(), m_Undef())))
continue;
return false;
}
Expand All @@ -1289,7 +1289,7 @@ bool llvm::maskIsAllOneOrUndef(Value *Mask) {
auto *ConstMask = dyn_cast<Constant>(Mask);
if (!ConstMask)
return false;
if (ConstMask->isAllOnesValue() || isa<UndefValue>(ConstMask))
if (match(ConstMask, m_CombineOr(m_AllOnes(), m_Undef())))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isAllOnesValue can see through ConstantFP - can m_AllOnes()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! It can't; there are other issues with this patch including the fact that we're matching undef instead of just poison -- abandoning.

return true;
if (isa<ScalableVectorType>(ConstMask->getType()))
return false;
Expand All @@ -1298,7 +1298,7 @@ bool llvm::maskIsAllOneOrUndef(Value *Mask) {
E = cast<FixedVectorType>(ConstMask->getType())->getNumElements();
I != E; ++I) {
if (auto *MaskElt = ConstMask->getAggregateElement(I))
if (MaskElt->isAllOnesValue() || isa<UndefValue>(MaskElt))
if (match(MaskElt, m_CombineOr(m_AllOnes(), m_Undef())))
continue;
return false;
}
Expand All @@ -1315,7 +1315,7 @@ bool llvm::maskContainsAllOneOrUndef(Value *Mask) {
auto *ConstMask = dyn_cast<Constant>(Mask);
if (!ConstMask)
return false;
if (ConstMask->isAllOnesValue() || isa<UndefValue>(ConstMask))
if (match(ConstMask, m_CombineOr(m_AllOnes(), m_Undef())))
return true;
if (isa<ScalableVectorType>(ConstMask->getType()))
return false;
Expand All @@ -1324,7 +1324,7 @@ bool llvm::maskContainsAllOneOrUndef(Value *Mask) {
E = cast<FixedVectorType>(ConstMask->getType())->getNumElements();
I != E; ++I) {
if (auto *MaskElt = ConstMask->getAggregateElement(I))
if (MaskElt->isAllOnesValue() || isa<UndefValue>(MaskElt))
if (match(MaskElt, m_CombineOr(m_AllOnes(), m_Undef())))
return true;
}
return false;
Expand Down
Loading