[clang] 0387da6 - Use value instead of getValue (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 19 21:18:31 PDT 2022
Author: Kazu Hirata
Date: 2022-07-19T21:18:26-07:00
New Revision: 0387da6f4f68fb00183c76bfd4f4f48533bc10e1
URL: https://github.com/llvm/llvm-project/commit/0387da6f4f68fb00183c76bfd4f4f48533bc10e1
DIFF: https://github.com/llvm/llvm-project/commit/0387da6f4f68fb00183c76bfd4f4f48533bc10e1.diff
LOG: Use value instead of getValue (NFC)
Added:
Modified:
clang/lib/Basic/Sarif.cpp
clang/unittests/Basic/SarifTest.cpp
llvm/lib/CodeGen/ExpandVectorPredication.cpp
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Sarif.cpp b/clang/lib/Basic/Sarif.cpp
index ed43c7eab056..faca9c508c08 100644
--- a/clang/lib/Basic/Sarif.cpp
+++ b/clang/lib/Basic/Sarif.cpp
@@ -217,7 +217,7 @@ SarifDocumentWriter::createPhysicalLocation(const CharSourceRange &R) {
}
assert(I != CurrentArtifacts.end() && "Failed to insert new artifact");
const SarifArtifactLocation &Location = I->second.Location;
- uint32_t Idx = Location.Index.getValue();
+ uint32_t Idx = Location.Index.value();
return json::Object{{{"artifactLocation", json::Object{{{"index", Idx}}}},
{"region", createTextRegion(SourceMgr, R)}}};
}
@@ -271,12 +271,12 @@ void SarifDocumentWriter::endRun() {
const SarifArtifact &A = Pair.getValue();
json::Object Loc{{"uri", A.Location.URI}};
if (A.Location.Index.has_value()) {
- Loc["index"] = static_cast<int64_t>(A.Location.Index.getValue());
+ Loc["index"] = static_cast<int64_t>(A.Location.Index.value());
}
json::Object Artifact;
Artifact["location"] = std::move(Loc);
if (A.Length.has_value())
- Artifact["length"] = static_cast<int64_t>(A.Length.getValue());
+ Artifact["length"] = static_cast<int64_t>(A.Length.value());
if (!A.Roles.empty())
Artifact["roles"] = json::Array(A.Roles);
if (!A.MimeType.empty())
diff --git a/clang/unittests/Basic/SarifTest.cpp b/clang/unittests/Basic/SarifTest.cpp
index 328496ab137d..e647d362fcc6 100644
--- a/clang/unittests/Basic/SarifTest.cpp
+++ b/clang/unittests/Basic/SarifTest.cpp
@@ -121,9 +121,9 @@ TEST_F(SarifDocumentWriterTest, canCreateDocumentWithOneRun) {
ASSERT_TRUE(driver->getString("fullName").has_value());
ASSERT_TRUE(driver->getString("language").has_value());
- EXPECT_EQ(driver->getString("name").getValue(), ShortName);
- EXPECT_EQ(driver->getString("fullName").getValue(), LongName);
- EXPECT_EQ(driver->getString("language").getValue(), "en-US");
+ EXPECT_EQ(driver->getString("name").value(), ShortName);
+ EXPECT_EQ(driver->getString("fullName").value(), LongName);
+ EXPECT_EQ(driver->getString("language").value(), "en-US");
}
TEST_F(SarifDocumentWriterTest, addingResultsWillCrashIfThereIsNoRun) {
@@ -189,8 +189,8 @@ TEST_F(SarifDocumentWriterTest, addingResultWithValidRuleAndRunIsOk) {
ASSERT_TRUE(Driver->getString("name").has_value());
ASSERT_TRUE(Driver->getString("fullName").has_value());
- EXPECT_EQ(Driver->getString("name").getValue(), "sarif test");
- EXPECT_EQ(Driver->getString("fullName").getValue(), "sarif test runner");
+ EXPECT_EQ(Driver->getString("name").value(), "sarif test");
+ EXPECT_EQ(Driver->getString("fullName").value(), "sarif test runner");
// The results are as expected
EXPECT_EQ(Results->size(), 1UL);
diff --git a/llvm/lib/CodeGen/ExpandVectorPredication.cpp b/llvm/lib/CodeGen/ExpandVectorPredication.cpp
index 8840ddde3692..db4d42bf3ca4 100644
--- a/llvm/lib/CodeGen/ExpandVectorPredication.cpp
+++ b/llvm/lib/CodeGen/ExpandVectorPredication.cpp
@@ -420,7 +420,7 @@ CachingVPExpander::expandPredicationInMemoryIntrinsic(IRBuilder<> &Builder,
StoreInst *NewStore =
Builder.CreateStore(DataParam, PtrParam, /*IsVolatile*/ false);
if (AlignOpt.has_value())
- NewStore->setAlignment(AlignOpt.getValue());
+ NewStore->setAlignment(AlignOpt.value());
NewMemoryInst = NewStore;
} else
NewMemoryInst = Builder.CreateMaskedStore(
@@ -432,7 +432,7 @@ CachingVPExpander::expandPredicationInMemoryIntrinsic(IRBuilder<> &Builder,
LoadInst *NewLoad =
Builder.CreateLoad(VPI.getType(), PtrParam, /*IsVolatile*/ false);
if (AlignOpt.has_value())
- NewLoad->setAlignment(AlignOpt.getValue());
+ NewLoad->setAlignment(AlignOpt.value());
NewMemoryInst = NewLoad;
} else
NewMemoryInst = Builder.CreateMaskedLoad(
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
index aa4e0116e404..4550cfdcf883 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
@@ -816,7 +816,7 @@ bool AMDGPUCallLowering::passSpecialInputs(MachineIRBuilder &MIRBuilder,
Optional<uint32_t> Id =
AMDGPUMachineFunction::getLDSKernelIdMetadata(MF.getFunction());
if (Id.has_value()) {
- MIRBuilder.buildConstant(InputReg, Id.getValue());
+ MIRBuilder.buildConstant(InputReg, Id.value());
} else {
MIRBuilder.buildUndef(InputReg);
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
index f1f8f28c41bd..0979debe9777 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -4204,7 +4204,7 @@ bool AMDGPULegalizerInfo::getLDSKernelId(Register DstReg,
Optional<uint32_t> KnownSize =
AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
if (KnownSize.has_value())
- B.buildConstant(DstReg, KnownSize.getValue());
+ B.buildConstant(DstReg, KnownSize.value());
return false;
}
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index cca4345c2a16..438e8b200ecc 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1671,7 +1671,7 @@ SDValue SITargetLowering::getLDSKernelId(SelectionDAG &DAG,
Optional<uint32_t> KnownSize =
AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
if (KnownSize.has_value())
- return DAG.getConstant(KnownSize.getValue(), SL, MVT::i32);
+ return DAG.getConstant(KnownSize.value(), SL, MVT::i32);
return SDValue();
}
@@ -2822,7 +2822,7 @@ void SITargetLowering::passSpecialInputs(
} else if (InputID == AMDGPUFunctionArgInfo::LDS_KERNEL_ID) {
Optional<uint32_t> Id = AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
if (Id.has_value()) {
- InputReg = DAG.getConstant(Id.getValue(), DL, ArgVT);
+ InputReg = DAG.getConstant(Id.value(), DL, ArgVT);
} else {
InputReg = DAG.getUNDEF(ArgVT);
}
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 8ac591dd36cd..aaaadf9cbf42 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1111,7 +1111,7 @@ bool Attributor::getAssumedSimplifiedValues(
Optional<Value *> CBResult = CB(IRP, AA, UsedAssumedInformation);
if (!CBResult.has_value())
continue;
- Value *V = CBResult.getValue();
+ Value *V = CBResult.value();
if (!V)
return false;
if ((S & AA::ValueScope::Interprocedural) ||
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index ee0de04d22c5..9acd307b12db 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -9763,7 +9763,7 @@ askForAssumedConstant(Attributor &A, const AbstractAttribute &QueryingAA,
A.recordDependence(AA, QueryingAA, DepClassTy::OPTIONAL);
return llvm::None;
}
- if (auto *C = COpt.getValue()) {
+ if (auto *C = COpt.value()) {
A.recordDependence(AA, QueryingAA, DepClassTy::OPTIONAL);
return C;
}
@@ -9777,12 +9777,12 @@ Value *AAPotentialValues::getSingleValue(
Optional<Value *> V;
for (auto &It : Values) {
V = AA::combineOptionalValuesInAAValueLatice(V, It.getValue(), &Ty);
- if (V.has_value() && !V.getValue())
+ if (V.has_value() && !V.value())
break;
}
if (!V.has_value())
return UndefValue::get(&Ty);
- return V.getValue();
+ return V.value();
}
namespace {
@@ -9825,7 +9825,7 @@ struct AAPotentialValuesImpl : AAPotentialValues {
Optional<Constant *> C = askForAssumedConstant<AAType>(A, AA, IRP, Ty);
if (!C)
return llvm::None;
- if (C.getValue())
+ if (C.value())
if (auto *CC = AA::getWithType(**C, Ty))
return CC;
return nullptr;
@@ -9850,7 +9850,7 @@ struct AAPotentialValuesImpl : AAPotentialValues {
Type &Ty = *getAssociatedType();
Optional<Value *> SimpleV =
askOtherAA<AAValueConstantRange>(A, *this, ValIRP, Ty);
- if (SimpleV.has_value() && !SimpleV.getValue()) {
+ if (SimpleV.has_value() && !SimpleV.value()) {
auto &PotentialConstantsAA = A.getAAFor<AAPotentialConstantValues>(
*this, ValIRP, DepClassTy::OPTIONAL);
if (PotentialConstantsAA.isValidState()) {
@@ -9865,8 +9865,8 @@ struct AAPotentialValuesImpl : AAPotentialValues {
if (!SimpleV.has_value())
return;
- if (SimpleV.getValue())
- VPtr = SimpleV.getValue();
+ if (SimpleV.value())
+ VPtr = SimpleV.value();
}
if (isa<ConstantInt>(VPtr))
@@ -10005,7 +10005,7 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
UsedAssumedInformation, AA::Intraprocedural);
if (!SimplifiedLHS.has_value())
return true;
- if (!SimplifiedLHS.getValue())
+ if (!SimplifiedLHS.value())
return false;
LHS = *SimplifiedLHS;
@@ -10014,7 +10014,7 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
UsedAssumedInformation, AA::Intraprocedural);
if (!SimplifiedRHS.has_value())
return true;
- if (!SimplifiedRHS.getValue())
+ if (!SimplifiedRHS.value())
return false;
RHS = *SimplifiedRHS;
@@ -10195,8 +10195,8 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
if (!SimplifiedOp.has_value())
return true;
- if (SimplifiedOp.getValue())
- NewOps[Idx] = SimplifiedOp.getValue();
+ if (SimplifiedOp.value())
+ NewOps[Idx] = SimplifiedOp.value();
else
NewOps[Idx] = Op;
@@ -10497,10 +10497,10 @@ struct AAPotentialValuesCallSiteReturned : AAPotentialValuesImpl {
// Nothing to do as long as no value was determined.
continue;
}
- V = CallerV.getValue() ? CallerV.getValue() : V;
+ V = CallerV.value() ? CallerV.value() : V;
if (AA::isDynamicallyUnique(A, *this, *V) &&
AA::isValidInScope(*V, Caller)) {
- if (CallerV.getValue()) {
+ if (CallerV.value()) {
SmallVector<AA::ValueAndContext> ArgValues;
IRPosition IRP = IRPosition::value(*V);
if (auto *Arg = dyn_cast<Argument>(V))
More information about the cfe-commits
mailing list