-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm] Migrate away from ArrayRef(std::nullopt) (NFC) #144967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm] Migrate away from ArrayRef(std::nullopt) (NFC) #144967
Conversation
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.
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-transforms Author: Kazu Hirata (kazutakahirata) ChangesArrayRef has a constructor that accepts std::nullopt. This Since the use of std::nullopt outside the context of std::optional is This patch takes care of the llvm side of the migration. Full diff: https://github.com/llvm/llvm-project/pull/144967.diff 3 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 3b87978fe3fab..90a75c3d352e4 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -2376,8 +2376,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
CostKind, 1, nullptr, nullptr);
Cost += thisT()->getVectorInstrCost(Instruction::InsertElement, SearchTy,
CostKind, 0, nullptr, nullptr);
- Cost += thisT()->getShuffleCost(TTI::SK_Broadcast, SearchTy, std::nullopt,
- CostKind, 0, nullptr);
+ Cost += thisT()->getShuffleCost(TTI::SK_Broadcast, SearchTy, {}, CostKind,
+ 0, nullptr);
Cost += thisT()->getCmpSelInstrCost(BinaryOperator::ICmp, SearchTy, RetTy,
CmpInst::ICMP_EQ, CostKind);
Cost +=
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 4551a365a6967..5eef2497cf90b 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5994,7 +5994,7 @@ static bool isMaskedLoadCompress(
InstructionCost InterleavedCost =
VectorGEPCost + TTI.getInterleavedMemoryOpCost(
Instruction::Load, AlignedLoadVecTy,
- CompressMask[1], std::nullopt, CommonAlignment,
+ CompressMask[1], {}, CommonAlignment,
LI->getPointerAddressSpace(), CostKind, IsMasked);
if (InterleavedCost < GatherCost) {
InterleaveFactor = CompressMask[1];
@@ -13561,7 +13561,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
case TreeEntry::Vectorize:
if (unsigned Factor = E->getInterleaveFactor()) {
VecLdCost = TTI->getInterleavedMemoryOpCost(
- Instruction::Load, VecTy, Factor, std::nullopt, LI0->getAlign(),
+ Instruction::Load, VecTy, Factor, {}, LI0->getAlign(),
LI0->getPointerAddressSpace(), CostKind);
} else {
@@ -13602,7 +13602,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
Align CommonAlignment = LI0->getAlign();
if (InterleaveFactor) {
VecLdCost = TTI->getInterleavedMemoryOpCost(
- Instruction::Load, LoadVecTy, InterleaveFactor, std::nullopt,
+ Instruction::Load, LoadVecTy, InterleaveFactor, {},
CommonAlignment, LI0->getPointerAddressSpace(), CostKind);
} else if (IsMasked) {
VecLdCost = TTI->getMaskedMemoryOpCost(
@@ -13677,8 +13677,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
"No reused shuffles expected");
CommonCost = 0;
VecStCost = TTI->getInterleavedMemoryOpCost(
- Instruction::Store, VecTy, Factor, std::nullopt,
- BaseSI->getAlign(), BaseSI->getPointerAddressSpace(), CostKind);
+ Instruction::Store, VecTy, Factor, {}, BaseSI->getAlign(),
+ BaseSI->getPointerAddressSpace(), CostKind);
} else {
TTI::OperandValueInfo OpInfo = getOperandInfo(E->getOperand(0));
VecStCost = TTI->getMemoryOpCost(
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 22861eb1c7dfc..f45ce46763c57 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -3478,8 +3478,7 @@ InstructionCost VPInterleaveRecipe::computeCost(ElementCount VF,
return Cost + IG->getNumMembers() *
Ctx.TTI.getShuffleCost(TargetTransformInfo::SK_Reverse,
- VectorTy, std::nullopt, Ctx.CostKind,
- 0);
+ VectorTy, {}, Ctx.CostKind, 0);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/13831 Here is the relevant piece of the build log for the reference
|
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.