diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-25 11:55:57 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-25 11:55:57 -0700 |
commit | aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d (patch) | |
tree | d207b35cfb445636f41204bcfe51f6ca3a94a3ba /polly | |
parent | b8df4093e4d82c67a419911a46b63482043643e5 (diff) | |
download | llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.zip llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.tar.gz llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.tar.bz2 |
Don't use Optional::hasValue (NFC)
Diffstat (limited to 'polly')
-rw-r--r-- | polly/lib/Exchange/JSONExporter.cpp | 23 | ||||
-rw-r--r-- | polly/lib/Transform/ManualOptimizer.cpp | 4 | ||||
-rw-r--r-- | polly/lib/Transform/MatmulOptimizer.cpp | 16 |
3 files changed, 21 insertions, 22 deletions
diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index e92055b..d882ea6 100644 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -218,8 +218,8 @@ static bool importContext(Scop &S, const json::Object &JScop) { return false; } - isl::set NewContext = isl::set{S.getIslCtx().get(), - JScop.getString("context").getValue().str()}; + isl::set NewContext = + isl::set{S.getIslCtx().get(), JScop.getString("context")->str()}; // Check whether the context was parsed successfully. if (NewContext.is_null()) { @@ -290,10 +290,10 @@ static bool importSchedule(Scop &S, const json::Object &JScop, } Optional<StringRef> Schedule = statements[Index].getAsObject()->getString("schedule"); - assert(Schedule.hasValue() && + assert(Schedule && "Schedules that contain extension nodes require special handling."); - isl_map *Map = isl_map_read_from_str(S.getIslCtx().get(), - Schedule.getValue().str().c_str()); + isl_map *Map = + isl_map_read_from_str(S.getIslCtx().get(), Schedule->str().c_str()); // Check whether the schedule was parsed successfully if (!Map) { @@ -575,14 +575,14 @@ static bool areArraysEqual(ScopArrayInfo *SAI, const json::Object &Array) { for (unsigned i = 1; i < Array.getArray("sizes")->size(); i++) { SAI->getDimensionSize(i)->print(RawStringOstream); const json::Array &SizesArray = *Array.getArray("sizes"); - if (RawStringOstream.str() != SizesArray[i].getAsString().getValue()) + if (RawStringOstream.str() != SizesArray[i].getAsString().value()) return false; Buffer.clear(); } // Check if key 'type' differs from the current one or is not valid. SAI->getElementType()->print(RawStringOstream); - if (RawStringOstream.str() != Array.getString("type").getValue()) { + if (RawStringOstream.str() != Array.getString("type").value()) { errs() << "Array has not a valid type.\n"; return false; } @@ -652,9 +652,8 @@ static bool importArrays(Scop &S, const json::Object &JScop) { for (; ArrayIdx < Arrays.size(); ArrayIdx++) { const json::Object &Array = *Arrays[ArrayIdx].getAsObject(); - auto *ElementType = - parseTextType(Array.get("type")->getAsString().getValue().str(), - S.getSE()->getContext()); + auto *ElementType = parseTextType(Array.get("type")->getAsString()->str(), + S.getSE()->getContext()); if (!ElementType) { errs() << "Error while parsing element type for new array.\n"; return false; @@ -674,10 +673,10 @@ static bool importArrays(Scop &S, const json::Object &JScop) { } auto NewSAI = S.createScopArrayInfo( - ElementType, Array.getString("name").getValue().str(), DimSizes); + ElementType, Array.getString("name")->str(), DimSizes); if (Array.get("allocation")) { - NewSAI->setIsOnHeap(Array.getString("allocation").getValue() == "heap"); + NewSAI->setIsOnHeap(Array.getString("allocation").value() == "heap"); } } diff --git a/polly/lib/Transform/ManualOptimizer.cpp b/polly/lib/Transform/ManualOptimizer.cpp index ef705ec..21d83d9 100644 --- a/polly/lib/Transform/ManualOptimizer.cpp +++ b/polly/lib/Transform/ManualOptimizer.cpp @@ -42,8 +42,8 @@ static TransformationMode hasUnrollTransformation(MDNode *LoopID) { Optional<int> Count = getOptionalIntLoopAttribute(LoopID, "llvm.loop.unroll.count"); - if (Count.hasValue()) - return Count.getValue() == 1 ? TM_SuppressedByUser : TM_ForcedByUser; + if (Count) + return *Count == 1 ? TM_SuppressedByUser : TM_ForcedByUser; if (getBooleanLoopAttribute(LoopID, "llvm.loop.unroll.enable")) return TM_ForcedByUser; diff --git a/polly/lib/Transform/MatmulOptimizer.cpp b/polly/lib/Transform/MatmulOptimizer.cpp index 4a40fac..d7418d3 100644 --- a/polly/lib/Transform/MatmulOptimizer.cpp +++ b/polly/lib/Transform/MatmulOptimizer.cpp @@ -570,29 +570,29 @@ static void getTargetCacheParameters(const llvm::TargetTransformInfo *TTI) { auto L1DCache = llvm::TargetTransformInfo::CacheLevel::L1D; auto L2DCache = llvm::TargetTransformInfo::CacheLevel::L2D; if (FirstCacheLevelSize == -1) { - if (TTI->getCacheSize(L1DCache).hasValue()) - FirstCacheLevelSize = TTI->getCacheSize(L1DCache).getValue(); + if (TTI->getCacheSize(L1DCache).has_value()) + FirstCacheLevelSize = TTI->getCacheSize(L1DCache).value(); else FirstCacheLevelSize = static_cast<int>(FirstCacheLevelDefaultSize); } if (SecondCacheLevelSize == -1) { - if (TTI->getCacheSize(L2DCache).hasValue()) - SecondCacheLevelSize = TTI->getCacheSize(L2DCache).getValue(); + if (TTI->getCacheSize(L2DCache).has_value()) + SecondCacheLevelSize = TTI->getCacheSize(L2DCache).value(); else SecondCacheLevelSize = static_cast<int>(SecondCacheLevelDefaultSize); } if (FirstCacheLevelAssociativity == -1) { - if (TTI->getCacheAssociativity(L1DCache).hasValue()) + if (TTI->getCacheAssociativity(L1DCache).has_value()) FirstCacheLevelAssociativity = - TTI->getCacheAssociativity(L1DCache).getValue(); + TTI->getCacheAssociativity(L1DCache).value(); else FirstCacheLevelAssociativity = static_cast<int>(FirstCacheLevelDefaultAssociativity); } if (SecondCacheLevelAssociativity == -1) { - if (TTI->getCacheAssociativity(L2DCache).hasValue()) + if (TTI->getCacheAssociativity(L2DCache).has_value()) SecondCacheLevelAssociativity = - TTI->getCacheAssociativity(L2DCache).getValue(); + TTI->getCacheAssociativity(L2DCache).value(); else SecondCacheLevelAssociativity = static_cast<int>(SecondCacheLevelDefaultAssociativity); |