Remove redundant initialization of std::optional (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 16 Apr 2023 07:40:05 +0000 (00:40 -0700)
committerKazu Hirata <kazu@google.com>
Sun, 16 Apr 2023 07:40:05 +0000 (00:40 -0700)
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
llvm/include/llvm/Transforms/Scalar/JumpThreading.h
llvm/lib/Transforms/Scalar/SROA.cpp
mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp

index d685e4d..c0f0cb6 100644 (file)
@@ -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<uint64_t> m_file_index = std::nullopt;
+  std::optional<uint64_t> m_file_index;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
index e1ff43a..3364d7e 100644 (file)
@@ -83,8 +83,8 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
   LazyValueInfo *LVI = nullptr;
   AAResults *AA = nullptr;
   std::unique_ptr<DomTreeUpdater> DTU;
-  std::optional<BlockFrequencyInfo *> BFI = std::nullopt;
-  std::optional<BranchProbabilityInfo *> BPI = std::nullopt;
+  std::optional<BlockFrequencyInfo *> BFI;
+  std::optional<BranchProbabilityInfo *> BPI;
   bool ChangedSinceLastAnalysisUpdate = false;
   bool HasGuards = false;
 #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
index a58dcff..d533f8f 100644 (file)
@@ -241,7 +241,7 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
     bool SetKillLocation = false;
 
     if (IsSplit) {
-      std::optional<DIExpression::FragmentInfo> BaseFragment = std::nullopt;
+      std::optional<DIExpression::FragmentInfo> BaseFragment;
       {
         auto R = BaseFragments.find(getAggregateVariable(DbgAssign));
         if (R == BaseFragments.end())
index 0c55abc..b4d070a 100644 (file)
@@ -77,7 +77,7 @@ protected:
 
     ValueBoundsConstraintSet &cstr;
     Value value;
-    std::optional<int64_t> dim = std::nullopt;
+    std::optional<int64_t> dim;
   };
 
 public:
index c593f84..9595c18 100644 (file)
@@ -732,7 +732,7 @@ static bool isTypeCompatibleWithAtomicOp(Type type, bool isPointerTypeAllowed) {
   if (type.isa<LLVMPointerType>())
     return isPointerTypeAllowed;
 
-  std::optional<unsigned> bitWidth = std::nullopt;
+  std::optional<unsigned> bitWidth;
   if (auto floatType = type.dyn_cast<FloatType>()) {
     if (!isCompatibleFloatingPointType(type))
       return false;
index 668629a..cc6541e 100644 (file)
@@ -77,7 +77,7 @@ struct ForOpInterface
 
     // Check if computed bound equals the corresponding iter_arg.
     Value singleValue = nullptr;
-    std::optional<int64_t> singleDim = std::nullopt;
+    std::optional<int64_t> singleDim;
     if (auto dimExpr = bound.getResult(0).dyn_cast<AffineDimExpr>()) {
       int64_t idx = dimExpr.getPosition();
       singleValue = boundOperands[idx].first;
index 0fe1801..9c2baa3 100644 (file)
@@ -495,7 +495,7 @@ void transform::TransformState::recordValueHandleInvalidationByOpHandleOne(
 
   for (Operation *ancestor : potentialAncestors) {
     Operation *definingOp;
-    std::optional<unsigned> resultNo = std::nullopt;
+    std::optional<unsigned> resultNo;
     unsigned argumentNo, blockNo, regionNo;
     if (auto opResult = payloadValue.dyn_cast<OpResult>()) {
       definingOp = opResult.getOwner();
@@ -1495,7 +1495,7 @@ LogicalResult transform::detail::verifyTransformOpInterface(Operation *op) {
         });
   };
 
-  std::optional<unsigned> firstConsumedOperand = std::nullopt;
+  std::optional<unsigned> firstConsumedOperand;
   for (OpOperand &operand : op->getOpOperands()) {
     auto range = effectsOn(operand.get());
     if (range.empty()) {