Skip to content

Commit 64fe323

Browse files
[llvm] Migrate away from ArrayRef(std::nullopt) (NFC) (#144967)
ArrayRef has a constructor that accepts std::nullopt. This constructor dates back to the days when we still had llvm::Optional. Since the use of std::nullopt outside the context of std::optional is kind of abuse and not intuitive to new comers, I would like to move away from the constructor and eventually remove it. This patch takes care of the llvm side of the migration.
1 parent bb51c5d commit 64fe323

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,8 +2376,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
23762376
CostKind, 1, nullptr, nullptr);
23772377
Cost += thisT()->getVectorInstrCost(Instruction::InsertElement, SearchTy,
23782378
CostKind, 0, nullptr, nullptr);
2379-
Cost += thisT()->getShuffleCost(TTI::SK_Broadcast, SearchTy, std::nullopt,
2380-
CostKind, 0, nullptr);
2379+
Cost += thisT()->getShuffleCost(TTI::SK_Broadcast, SearchTy, {}, CostKind,
2380+
0, nullptr);
23812381
Cost += thisT()->getCmpSelInstrCost(BinaryOperator::ICmp, SearchTy, RetTy,
23822382
CmpInst::ICMP_EQ, CostKind);
23832383
Cost +=

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5994,7 +5994,7 @@ static bool isMaskedLoadCompress(
59945994
InstructionCost InterleavedCost =
59955995
VectorGEPCost + TTI.getInterleavedMemoryOpCost(
59965996
Instruction::Load, AlignedLoadVecTy,
5997-
CompressMask[1], std::nullopt, CommonAlignment,
5997+
CompressMask[1], {}, CommonAlignment,
59985998
LI->getPointerAddressSpace(), CostKind, IsMasked);
59995999
if (InterleavedCost < GatherCost) {
60006000
InterleaveFactor = CompressMask[1];
@@ -13561,7 +13561,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1356113561
case TreeEntry::Vectorize:
1356213562
if (unsigned Factor = E->getInterleaveFactor()) {
1356313563
VecLdCost = TTI->getInterleavedMemoryOpCost(
13564-
Instruction::Load, VecTy, Factor, std::nullopt, LI0->getAlign(),
13564+
Instruction::Load, VecTy, Factor, {}, LI0->getAlign(),
1356513565
LI0->getPointerAddressSpace(), CostKind);
1356613566

1356713567
} else {
@@ -13602,7 +13602,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1360213602
Align CommonAlignment = LI0->getAlign();
1360313603
if (InterleaveFactor) {
1360413604
VecLdCost = TTI->getInterleavedMemoryOpCost(
13605-
Instruction::Load, LoadVecTy, InterleaveFactor, std::nullopt,
13605+
Instruction::Load, LoadVecTy, InterleaveFactor, {},
1360613606
CommonAlignment, LI0->getPointerAddressSpace(), CostKind);
1360713607
} else if (IsMasked) {
1360813608
VecLdCost = TTI->getMaskedMemoryOpCost(
@@ -13677,8 +13677,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1367713677
"No reused shuffles expected");
1367813678
CommonCost = 0;
1367913679
VecStCost = TTI->getInterleavedMemoryOpCost(
13680-
Instruction::Store, VecTy, Factor, std::nullopt,
13681-
BaseSI->getAlign(), BaseSI->getPointerAddressSpace(), CostKind);
13680+
Instruction::Store, VecTy, Factor, {}, BaseSI->getAlign(),
13681+
BaseSI->getPointerAddressSpace(), CostKind);
1368213682
} else {
1368313683
TTI::OperandValueInfo OpInfo = getOperandInfo(E->getOperand(0));
1368413684
VecStCost = TTI->getMemoryOpCost(

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3478,8 +3478,7 @@ InstructionCost VPInterleaveRecipe::computeCost(ElementCount VF,
34783478

34793479
return Cost + IG->getNumMembers() *
34803480
Ctx.TTI.getShuffleCost(TargetTransformInfo::SK_Reverse,
3481-
VectorTy, std::nullopt, Ctx.CostKind,
3482-
0);
3481+
VectorTy, {}, Ctx.CostKind, 0);
34833482
}
34843483

34853484
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

0 commit comments

Comments
 (0)