From c8e6ebd74e548bd79662166906de53554773265e Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 6 Aug 2022 11:21:39 -0700 Subject: [PATCH] Use value instead of getValue (NFC) --- bolt/unittests/Core/MCPlusBuilder.cpp | 2 +- clang/utils/TableGen/RISCVVEmitter.cpp | 6 +++--- llvm/lib/Analysis/InstructionSimplify.cpp | 4 ++-- mlir/include/mlir/IR/OpImplementation.h | 2 +- mlir/lib/Dialect/DLTI/DLTI.cpp | 4 ++-- mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | 4 ++-- mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp | 2 +- mlir/lib/Dialect/SCF/IR/SCF.cpp | 2 +- mlir/lib/IR/FunctionImplementation.cpp | 2 +- mlir/lib/Interfaces/ViewLikeInterface.cpp | 2 +- mlir/test/lib/Dialect/Test/TestTypes.cpp | 2 +- .../lib/Dialect/Transform/TestTransformDialectExtension.cpp | 4 ++-- mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/bolt/unittests/Core/MCPlusBuilder.cpp b/bolt/unittests/Core/MCPlusBuilder.cpp index 17bb686d5622..9391d6f04f81 100644 --- a/bolt/unittests/Core/MCPlusBuilder.cpp +++ b/bolt/unittests/Core/MCPlusBuilder.cpp @@ -142,7 +142,7 @@ TEST_P(MCPlusBuilderTester, Annotation) { // Round-trip encoding-decoding check for negative values Optional EHInfo = BC->MIB->getEHInfo(Inst); ASSERT_TRUE(EHInfo.has_value()); - MCPlus::MCLandingPad LP = EHInfo.getValue(); + MCPlus::MCLandingPad LP = EHInfo.value(); uint64_t DecodedValue = LP.second; ASSERT_EQ(Value, DecodedValue); diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp index 5975c0d86890..84f0420d7c33 100644 --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -581,7 +581,7 @@ void RVVEmitter::createRVVIntrinsics( Name, SuffixStr, OverloadedName, OverloadedSuffixStr, IRName, /*IsMask=*/false, /*HasMaskedOffOperand=*/false, HasVL, UnMaskedPolicyScheme, SupportOverloading, HasBuiltinAlias, - ManualCodegen, PolicyTypes.getValue(), IntrinsicTypes, + ManualCodegen, PolicyTypes.value(), IntrinsicTypes, RequiredFeatures, NF, P, IsPrototypeDefaultTU)); } if (!HasMasked) @@ -593,7 +593,7 @@ void RVVEmitter::createRVVIntrinsics( Name, SuffixStr, OverloadedName, OverloadedSuffixStr, MaskedIRName, /*IsMasked=*/true, HasMaskedOffOperand, HasVL, MaskedPolicyScheme, SupportOverloading, HasBuiltinAlias, MaskedManualCodegen, - MaskTypes.getValue(), IntrinsicTypes, RequiredFeatures, NF, + MaskTypes.value(), IntrinsicTypes, RequiredFeatures, NF, Policy::PolicyNone, IsPrototypeDefaultTU)); if (MaskedPolicyScheme == PolicyScheme::SchemeNone) continue; @@ -608,7 +608,7 @@ void RVVEmitter::createRVVIntrinsics( Name, SuffixStr, OverloadedName, OverloadedSuffixStr, MaskedIRName, /*IsMasked=*/true, HasMaskedOffOperand, HasVL, MaskedPolicyScheme, SupportOverloading, HasBuiltinAlias, - MaskedManualCodegen, PolicyTypes.getValue(), IntrinsicTypes, + MaskedManualCodegen, PolicyTypes.value(), IntrinsicTypes, RequiredFeatures, NF, P, IsPrototypeDefaultTU)); } } // End for Log2LMULList diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 30b9c6e4ef9d..f511d629df95 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -2181,10 +2181,10 @@ static Value *simplifyAndInst(Value *Op0, Value *Op1, const SimplifyQuery &Q, } if (Optional Implied = isImpliedCondition(Op1, Op0, Q.DL)) { // If Op1 is true implies Op0 is true, then Op1 is a subset of Op0. - if (Implied.getValue()) + if (Implied.value()) return Op1; // If Op1 is true implies Op0 is false, then they are not true together. - if (!Implied.getValue()) + if (!Implied.value()) return ConstantInt::getFalse(Op1->getType()); } } diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h index f479bbce4db6..62242301711f 100644 --- a/mlir/include/mlir/IR/OpImplementation.h +++ b/mlir/include/mlir/IR/OpImplementation.h @@ -1504,7 +1504,7 @@ public: OptionalParseResult result = parseOptionalAssignmentList(lhs, rhs); if (!result.has_value()) return emitError(getCurrentLocation(), "expected '('"); - return result.getValue(); + return result.value(); } virtual OptionalParseResult diff --git a/mlir/lib/Dialect/DLTI/DLTI.cpp b/mlir/lib/Dialect/DLTI/DLTI.cpp index a5f5d4b13e1c..eaf6f1e619a0 100644 --- a/mlir/lib/Dialect/DLTI/DLTI.cpp +++ b/mlir/lib/Dialect/DLTI/DLTI.cpp @@ -73,11 +73,11 @@ DataLayoutEntryAttr DataLayoutEntryAttr::parse(AsmParser &parser) { std::string identifier; SMLoc idLoc = parser.getCurrentLocation(); OptionalParseResult parsedType = parser.parseOptionalType(type); - if (parsedType.has_value() && failed(parsedType.getValue())) + if (parsedType.has_value() && failed(parsedType.value())) return {}; if (!parsedType.has_value()) { OptionalParseResult parsedString = parser.parseOptionalString(&identifier); - if (!parsedString.has_value() || failed(parsedString.getValue())) { + if (!parsedString.has_value() || failed(parsedString.value())) { parser.emitError(idLoc) << "expected a type or a quoted string"; return {}; } diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp index 7f3ba764c68a..825d6eac56c5 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -344,7 +344,7 @@ static ParseResult parseSwitchOpCases( if (values.empty() && !integerParseResult.has_value()) return success(); - if (!integerParseResult.has_value() || integerParseResult.getValue()) + if (!integerParseResult.has_value() || integerParseResult.value()) return failure(); values.push_back(APInt(bitWidth, value)); @@ -542,7 +542,7 @@ parseGEPIndices(OpAsmParser &parser, OptionalParseResult parsedInteger = parser.parseOptionalInteger(constantIndex); if (parsedInteger.has_value()) { - if (failed(parsedInteger.getValue())) + if (failed(parsedInteger.value())) return failure(); constantIndices.push_back(constantIndex); return success(); diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp index e9121804a7d3..1702cd636d23 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp @@ -442,7 +442,7 @@ static Type dispatchParse(AsmParser &parser, bool allowAny = true) { Type type; OptionalParseResult result = parser.parseOptionalType(type); if (result.has_value()) { - if (failed(result.getValue())) + if (failed(result.value())) return nullptr; if (!allowAny) { parser.emitError(keyLoc) << "unexpected type, expected keyword"; diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp index 1f59b2be39bf..62804980cd0d 100644 --- a/mlir/lib/Dialect/SCF/IR/SCF.cpp +++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp @@ -2613,7 +2613,7 @@ ParseResult scf::WhileOp::parse(OpAsmParser &parser, OperationState &result) { OptionalParseResult listResult = parser.parseOptionalAssignmentList(regionArgs, operands); - if (listResult.has_value() && failed(listResult.getValue())) + if (listResult.has_value() && failed(listResult.value())) return failure(); FunctionType functionType; diff --git a/mlir/lib/IR/FunctionImplementation.cpp b/mlir/lib/IR/FunctionImplementation.cpp index 7a04a7d5cc78..9481e4ae8175 100644 --- a/mlir/lib/IR/FunctionImplementation.cpp +++ b/mlir/lib/IR/FunctionImplementation.cpp @@ -42,7 +42,7 @@ parseFunctionArgumentList(OpAsmParser &parser, bool allowVariadic, auto argPresent = parser.parseOptionalArgument( argument, /*allowType=*/true, /*allowAttrs=*/true); if (argPresent.has_value()) { - if (failed(argPresent.getValue())) + if (failed(argPresent.value())) return failure(); // Present but malformed. // Reject this if the preceding argument was missing a name. diff --git a/mlir/lib/Interfaces/ViewLikeInterface.cpp b/mlir/lib/Interfaces/ViewLikeInterface.cpp index eb542a921e12..a593ec6a2a24 100644 --- a/mlir/lib/Interfaces/ViewLikeInterface.cpp +++ b/mlir/lib/Interfaces/ViewLikeInterface.cpp @@ -121,7 +121,7 @@ static ParseResult parseOperandsOrIntegersImpl( while (true) { OpAsmParser::UnresolvedOperand operand; auto res = parser.parseOptionalOperand(operand); - if (res.has_value() && succeeded(res.getValue())) { + if (res.has_value() && succeeded(res.value())) { values.push_back(operand); attrVals.push_back(dynVal); } else { diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp index f54591d62708..ffa83c749c3e 100644 --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -419,7 +419,7 @@ Type TestDialect::parseTestType(AsmParser &parser, Type dynType; auto parseResult = parseOptionalDynamicType(typeTag, parser, dynType); if (parseResult.has_value()) { - if (succeeded(parseResult.getValue())) + if (succeeded(parseResult.value())) return dynType; return Type(); } diff --git a/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp b/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp index 64ae2a114205..965216317819 100644 --- a/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp +++ b/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp @@ -55,9 +55,9 @@ public: if (!result.has_value()) return success(); - if (result.getValue().succeeded()) + if (result.value().succeeded()) state.addAttribute("message", message); - return result.getValue(); + return result.value(); } void print(OpAsmPrinter &printer) { diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp index 19c35cbebbbb..8eebc8627277 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp @@ -683,7 +683,7 @@ static const char *const dialectDynamicAttrParserDispatch = R"( ::mlir::Attribute genAttr; auto parseResult = parseOptionalDynamicAttr(attrTag, parser, genAttr); if (parseResult.has_value()) { - if (::mlir::succeeded(parseResult.getValue())) + if (::mlir::succeeded(parseResult.value())) return genAttr; return Attribute(); }