Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 0 additions & 5 deletions llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3794,11 +3794,6 @@ static Constant *ConstantFoldScalableVectorCall(
SplatOps.push_back(Op);
continue;
}
// TODO: Should getSplatValue return a poison scalar for a poison vector?
if (isa<PoisonValue>(Op)) {
SplatOps.push_back(PoisonValue::get(Op->getType()->getScalarType()));
continue;
}
Constant *Splat = Op->getSplatValue();
if (!Splat)
return nullptr;
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/IR/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,8 @@ void ConstantVector::destroyConstantImpl() {

Constant *Constant::getSplatValue(bool AllowPoison) const {
assert(this->getType()->isVectorTy() && "Only valid for vectors!");
if (isa<PoisonValue>(this))
return PoisonValue::get(cast<VectorType>(getType())->getElementType());
if (isa<ConstantAggregateZero>(this))
return getNullValue(cast<VectorType>(getType())->getElementType());
if (auto *CI = dyn_cast<ConstantInt>(this))
Expand Down
Loading