From 1ca496bd611591193432aee2d913a4db3618db45 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 16 Apr 2023 00:40:05 -0700 Subject: [PATCH] Remove redundant initialization of std::optional (NFC) --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 2 +- llvm/include/llvm/Transforms/Scalar/JumpThreading.h | 4 ++-- llvm/lib/Transforms/Scalar/SROA.cpp | 2 +- mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h | 2 +- mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | 2 +- mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp | 2 +- mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index d685e4d..c0f0cb6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -575,7 +575,7 @@ protected: /// no dSYM file is being used, this file index will be set to a /// valid value that can be used in DIERef objects which will contain /// an index that identifies the .DWO or .o file. - std::optional m_file_index = std::nullopt; + std::optional m_file_index; }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H diff --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h index e1ff43a..3364d7e 100644 --- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h +++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h @@ -83,8 +83,8 @@ class JumpThreadingPass : public PassInfoMixin { LazyValueInfo *LVI = nullptr; AAResults *AA = nullptr; std::unique_ptr DTU; - std::optional BFI = std::nullopt; - std::optional BPI = std::nullopt; + std::optional BFI; + std::optional BPI; bool ChangedSinceLastAnalysisUpdate = false; bool HasGuards = false; #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index a58dcff..d533f8f 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -241,7 +241,7 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit, bool SetKillLocation = false; if (IsSplit) { - std::optional BaseFragment = std::nullopt; + std::optional BaseFragment; { auto R = BaseFragments.find(getAggregateVariable(DbgAssign)); if (R == BaseFragments.end()) diff --git a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h index 0c55abc..b4d070a 100644 --- a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h +++ b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h @@ -77,7 +77,7 @@ protected: ValueBoundsConstraintSet &cstr; Value value; - std::optional dim = std::nullopt; + std::optional dim; }; public: diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp index c593f84..9595c18 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -732,7 +732,7 @@ static bool isTypeCompatibleWithAtomicOp(Type type, bool isPointerTypeAllowed) { if (type.isa()) return isPointerTypeAllowed; - std::optional bitWidth = std::nullopt; + std::optional bitWidth; if (auto floatType = type.dyn_cast()) { if (!isCompatibleFloatingPointType(type)) return false; diff --git a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp index 668629a..cc6541e 100644 --- a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp @@ -77,7 +77,7 @@ struct ForOpInterface // Check if computed bound equals the corresponding iter_arg. Value singleValue = nullptr; - std::optional singleDim = std::nullopt; + std::optional singleDim; if (auto dimExpr = bound.getResult(0).dyn_cast()) { int64_t idx = dimExpr.getPosition(); singleValue = boundOperands[idx].first; diff --git a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp index 0fe1801..9c2baa3 100644 --- a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp +++ b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp @@ -495,7 +495,7 @@ void transform::TransformState::recordValueHandleInvalidationByOpHandleOne( for (Operation *ancestor : potentialAncestors) { Operation *definingOp; - std::optional resultNo = std::nullopt; + std::optional resultNo; unsigned argumentNo, blockNo, regionNo; if (auto opResult = payloadValue.dyn_cast()) { definingOp = opResult.getOwner(); @@ -1495,7 +1495,7 @@ LogicalResult transform::detail::verifyTransformOpInterface(Operation *op) { }); }; - std::optional firstConsumedOperand = std::nullopt; + std::optional firstConsumedOperand; for (OpOperand &operand : op->getOpOperands()) { auto range = effectsOn(operand.get()); if (range.empty()) { -- 2.7.4