aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2024-09-19 16:16:38 +0100
committerGitHub <noreply@github.com>2024-09-19 16:16:38 +0100
commite03f427196ec67a8a5cfbdd658f9eabe9bce83ce (patch)
tree5c39989033e45fe09b7d589f923e0b6c9d20f917 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parent14120227a34365e829d05c1413033d235d7d272c (diff)
downloadllvm-e03f427196ec67a8a5cfbdd658f9eabe9bce83ce.zip
llvm-e03f427196ec67a8a5cfbdd658f9eabe9bce83ce.tar.gz
llvm-e03f427196ec67a8a5cfbdd658f9eabe9bce83ce.tar.bz2
[LLVM] Use {} instead of std::nullopt to initialize empty ArrayRef (#109133)
It is almost always simpler to use {} instead of std::nullopt to initialize an empty ArrayRef. This patch changes all occurrences I could find in LLVM itself. In future the ArrayRef(std::nullopt_t) constructor could be deprecated or removed.
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 788cdfe..59257fd 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -966,7 +966,7 @@ public:
auto &Ctx = Fn.getContext();
for (auto &FragMemLoc : FragMemLocs) {
- DIExpression *Expr = DIExpression::get(Ctx, std::nullopt);
+ DIExpression *Expr = DIExpression::get(Ctx, {});
if (FragMemLoc.SizeInBits !=
*Aggregates[FragMemLoc.Var].first->getSizeInBits())
Expr = *DIExpression::createFragmentExpression(
@@ -1398,7 +1398,7 @@ ArrayRef<VariableID>
AssignmentTrackingLowering::getContainedFragments(VariableID Var) const {
auto R = VarContains.find(Var);
if (R == VarContains.end())
- return std::nullopt;
+ return {};
return R->second;
}
@@ -1638,7 +1638,7 @@ void AssignmentTrackingLowering::processUntaggedInstruction(
//
// DIExpression: Add fragment and offset.
DebugVariable V = FnVarLocs->getVariable(Var);
- DIExpression *DIE = DIExpression::get(I.getContext(), std::nullopt);
+ DIExpression *DIE = DIExpression::get(I.getContext(), {});
if (auto Frag = V.getFragment()) {
auto R = DIExpression::createFragmentExpression(DIE, Frag->OffsetInBits,
Frag->SizeInBits);
@@ -2419,7 +2419,7 @@ bool AssignmentTrackingLowering::run(FunctionVarLocsBuilder *FnVarLocsBuilder) {
// built appropriately rather than always using an empty DIExpression.
// The assert below is a reminder.
assert(Simple);
- VarLoc.Expr = DIExpression::get(Fn.getContext(), std::nullopt);
+ VarLoc.Expr = DIExpression::get(Fn.getContext(), {});
DebugVariable Var = FnVarLocs->getVariable(VarLoc.VariableID);
FnVarLocs->addSingleLocVar(Var, VarLoc.Expr, VarLoc.DL, VarLoc.Values);
InsertedAnyIntrinsics = true;