[clang] 1f91494 - Don't use Optional::getPointer (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 21 19:03:46 PST 2022
Author: Kazu Hirata
Date: 2022-11-21T19:03:40-08:00
New Revision: 1f914944b6c9a5e4229ceb9f06140fdf178c5ea0
URL: https://github.com/llvm/llvm-project/commit/1f914944b6c9a5e4229ceb9f06140fdf178c5ea0
DIFF: https://github.com/llvm/llvm-project/commit/1f914944b6c9a5e4229ceb9f06140fdf178c5ea0.diff
LOG: Don't use Optional::getPointer (NFC)
Since std::optional does not offer getPointer(), this patch replaces
X.getPointer() with &*X to make the migration from llvm::Optional to
std::optional easier.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138466
Added:
Modified:
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/ParsedAST.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/index/Serialization.h
clang-tools-extra/clangd/tool/ClangdMain.cpp
clang-tools-extra/pseudo/tool/ClangPseudo.cpp
clang/include/clang/Basic/DarwinSDKInfo.h
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Sema/CodeCompleteConsumer.h
clang/lib/Frontend/ASTUnit.cpp
clang/lib/Sema/SemaCUDA.cpp
llvm/include/llvm/MC/MCObjectFileInfo.h
llvm/lib/CodeGen/ExpandMemCmp.cpp
llvm/lib/CodeGen/SafeStack.cpp
llvm/lib/CodeGen/ShadowStackGCLowering.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
llvm/lib/Support/ToolOutputFile.cpp
llvm/lib/Transforms/Scalar/LoopFlatten.cpp
llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
llvm/lib/Transforms/Scalar/LoopRotation.cpp
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/tools/llvm-dwp/llvm-dwp.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 57c2093bd695..5576d60f0f1b 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -191,7 +191,7 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
WorkScheduler.emplace(CDB, TUScheduler::Options(Opts),
std::make_unique<UpdateIndexCallbacks>(
DynamicIdx.get(), Callbacks, TFS,
- IndexTasks ? IndexTasks.getPointer() : nullptr));
+ IndexTasks ? &*IndexTasks : nullptr));
// Adds an index to the stack, at higher priority than existing indexes.
auto AddIndex = [&](SymbolIndex *Idx) {
if (this->Index != nullptr) {
@@ -408,7 +408,7 @@ void ClangdServer::codeComplete(PathRef File, Position Pos,
// both the old and the new version in case only one of them matches.
CodeCompleteResult Result = clangd::codeComplete(
File, Pos, IP->Preamble, ParseInput, CodeCompleteOpts,
- SpecFuzzyFind ? SpecFuzzyFind.getPointer() : nullptr);
+ SpecFuzzyFind ? &*SpecFuzzyFind : nullptr);
{
clang::clangd::trace::Span Tracer("Completion results callback");
CB(std::move(Result));
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index 7bdfdec64d1d..fba4eb1a9ec3 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -1768,8 +1768,8 @@ class CodeCompleteFlow {
assert(IdentifierResult);
C.Name = IdentifierResult->Name;
}
- if (auto OverloadSet = C.overloadSet(
- Opts, FileName, Inserter ? Inserter.getPointer() : nullptr)) {
+ if (auto OverloadSet =
+ C.overloadSet(Opts, FileName, Inserter ? &*Inserter : nullptr)) {
auto Ret = BundleLookup.try_emplace(OverloadSet, Bundles.size());
if (Ret.second)
Bundles.emplace_back();
@@ -1863,9 +1863,9 @@ class CodeCompleteFlow {
Relevance.Name = Bundle.front().Name;
Relevance.FilterLength = HeuristicPrefix.Name.size();
Relevance.Query = SymbolRelevanceSignals::CodeComplete;
- Relevance.FileProximityMatch = FileProximity.getPointer();
+ Relevance.FileProximityMatch = &*FileProximity;
if (ScopeProximity)
- Relevance.ScopeProximityMatch = ScopeProximity.getPointer();
+ Relevance.ScopeProximityMatch = &*ScopeProximity;
if (PreferredType)
Relevance.HadContextType = true;
Relevance.ContextWords = &ContextWords;
diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp
index 870a22cd7b1e..d42973dacf44 100644
--- a/clang-tools-extra/clangd/ParsedAST.cpp
+++ b/clang-tools-extra/clangd/ParsedAST.cpp
@@ -482,7 +482,7 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
CTContext->setASTContext(&Clang->getASTContext());
CTContext->setCurrentFile(Filename);
CTContext->setSelfContainedDiags(true);
- CTChecks = CTFactories.createChecksForLanguage(CTContext.getPointer());
+ CTChecks = CTFactories.createChecksForLanguage(&*CTContext);
Preprocessor *PP = &Clang->getPreprocessor();
for (const auto &Check : CTChecks) {
Check->registerPPCallbacks(Clang->getSourceManager(), PP, PP);
@@ -663,7 +663,7 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
Preamble->Diags.end());
// Finally, add diagnostics coming from the AST.
{
- std::vector<Diag> D = ASTDiags.take(CTContext.getPointer());
+ std::vector<Diag> D = ASTDiags.take(&*CTContext);
Diags->insert(Diags->end(), D.begin(), D.end());
}
}
diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp
index b0a83f4e843c..567e4fd9bca6 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -1653,10 +1653,9 @@ bool TUScheduler::update(PathRef File, ParseInputs Inputs,
bool ContentChanged = false;
if (!FD) {
// Create a new worker to process the AST-related tasks.
- ASTWorkerHandle Worker =
- ASTWorker::create(File, CDB, *IdleASTs, *HeaderIncluders,
- WorkerThreads ? WorkerThreads.getPointer() : nullptr,
- Barrier, Opts, *Callbacks);
+ ASTWorkerHandle Worker = ASTWorker::create(
+ File, CDB, *IdleASTs, *HeaderIncluders,
+ WorkerThreads ? &*WorkerThreads : nullptr, Barrier, Opts, *Callbacks);
FD = std::unique_ptr<FileData>(
new FileData{Inputs.Contents, std::move(Worker)});
ContentChanged = true;
diff --git a/clang-tools-extra/clangd/index/Serialization.h b/clang-tools-extra/clangd/index/Serialization.h
index f5492f357f4e..16b80961a981 100644
--- a/clang-tools-extra/clangd/index/Serialization.h
+++ b/clang-tools-extra/clangd/index/Serialization.h
@@ -64,11 +64,11 @@ struct IndexFileOut {
IndexFileOut() = default;
IndexFileOut(const IndexFileIn &I)
- : Symbols(I.Symbols ? I.Symbols.getPointer() : nullptr),
- Refs(I.Refs ? I.Refs.getPointer() : nullptr),
- Relations(I.Relations ? I.Relations.getPointer() : nullptr),
- Sources(I.Sources ? I.Sources.getPointer() : nullptr),
- Cmd(I.Cmd ? I.Cmd.getPointer() : nullptr) {}
+ : Symbols(I.Symbols ? &*I.Symbols : nullptr),
+ Refs(I.Refs ? &*I.Refs : nullptr),
+ Relations(I.Relations ? &*I.Relations : nullptr),
+ Sources(I.Sources ? &*I.Sources : nullptr),
+ Cmd(I.Cmd ? &*I.Cmd : nullptr) {}
};
// Serializes an index file.
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const IndexFileOut &O);
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 22d407be5033..84c8781bae9a 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -993,8 +993,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
} else {
log("Starting LSP over stdin/stdout");
TransportLayer = newJSONTransport(
- stdin, llvm::outs(),
- InputMirrorStream ? InputMirrorStream.getPointer() : nullptr,
+ stdin, llvm::outs(), InputMirrorStream ? &*InputMirrorStream : nullptr,
PrettyPrint, InputStyle);
}
if (!PathMappingsArg.empty()) {
diff --git a/clang-tools-extra/pseudo/tool/ClangPseudo.cpp b/clang-tools-extra/pseudo/tool/ClangPseudo.cpp
index 23af115e5fc3..c6d06739e7b0 100644
--- a/clang-tools-extra/pseudo/tool/ClangPseudo.cpp
+++ b/clang-tools-extra/pseudo/tool/ClangPseudo.cpp
@@ -113,7 +113,7 @@ int main(int argc, char *argv[]) {
if (Source.getNumOccurrences()) {
SourceText = readOrDie(Source);
RawStream = clang::pseudo::lex(SourceText, LangOpts);
- TokenStream *Stream = RawStream.getPointer();
+ TokenStream *Stream = &*RawStream;
auto DirectiveStructure = clang::pseudo::DirectiveTree::parse(*RawStream);
clang::pseudo::chooseConditionalBranches(DirectiveStructure, *RawStream);
@@ -121,7 +121,7 @@ int main(int argc, char *argv[]) {
llvm::Optional<TokenStream> Preprocessed;
if (StripDirectives) {
Preprocessed = DirectiveStructure.stripDirectives(*Stream);
- Stream = Preprocessed.getPointer();
+ Stream = &*Preprocessed;
}
if (PrintSource)
diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h b/clang/include/clang/Basic/DarwinSDKInfo.h
index 728bbc17c3ac..cac9d22b32a3 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -142,7 +142,7 @@ class DarwinSDKInfo {
auto Mapping = VersionMappings.find(Kind.Value);
if (Mapping == VersionMappings.end())
return nullptr;
- return Mapping->getSecond() ? Mapping->getSecond().getPointer() : nullptr;
+ return Mapping->getSecond() ? &*Mapping->getSecond() : nullptr;
}
static Optional<DarwinSDKInfo>
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 2c50b1976366..15eb2fcbd7d3 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1671,8 +1671,7 @@ class TargetInfo : public virtual TransferrableTargetInfo,
/// Returns the darwin target variant triple, the variant of the deployment
/// target for which the code is being compiled.
const llvm::Triple *getDarwinTargetVariantTriple() const {
- return DarwinTargetVariantTriple ? DarwinTargetVariantTriple.getPointer()
- : nullptr;
+ return DarwinTargetVariantTriple ? &*DarwinTargetVariantTriple : nullptr;
}
/// Returns the version of the darwin target variant SDK which was used during
diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h
index d8266c1b781d..db1f3850984c 100644
--- a/clang/include/clang/Sema/CodeCompleteConsumer.h
+++ b/clang/include/clang/Sema/CodeCompleteConsumer.h
@@ -424,7 +424,7 @@ class CodeCompletionContext {
llvm::Optional<const CXXScopeSpec *> getCXXScopeSpecifier() {
if (ScopeSpecifier)
- return ScopeSpecifier.getPointer();
+ return &*ScopeSpecifier;
return llvm::None;
}
};
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 1f5815c1dab6..382789196add 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -708,7 +708,7 @@ void FilterAndStoreDiagnosticConsumer::HandleDiagnostic(
llvm::Optional<StoredDiagnostic> StoredDiag;
if (!ResultDiag) {
StoredDiag.emplace(Level, Info);
- ResultDiag = StoredDiag.getPointer();
+ ResultDiag = &*StoredDiag;
}
StandaloneDiags->push_back(
makeStandaloneDiagnostic(*LangOpts, *ResultDiag));
diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp
index 0a49d72ba963..e8dd4c98fe99 100644
--- a/clang/lib/Sema/SemaCUDA.cpp
+++ b/clang/lib/Sema/SemaCUDA.cpp
@@ -381,8 +381,7 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
InferredTarget = BaseMethodTarget;
} else {
bool ResolutionError = resolveCalleeCUDATargetConflict(
- InferredTarget.value(), BaseMethodTarget,
- InferredTarget.getPointer());
+ InferredTarget.value(), BaseMethodTarget, &*InferredTarget);
if (ResolutionError) {
if (Diagnose) {
Diag(ClassDecl->getLocation(),
@@ -425,8 +424,7 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
InferredTarget = FieldMethodTarget;
} else {
bool ResolutionError = resolveCalleeCUDATargetConflict(
- InferredTarget.value(), FieldMethodTarget,
- InferredTarget.getPointer());
+ InferredTarget.value(), FieldMethodTarget, &*InferredTarget);
if (ResolutionError) {
if (Diagnose) {
Diag(ClassDecl->getLocation(),
diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h
index d743bc5371b5..30276f70e5fd 100644
--- a/llvm/include/llvm/MC/MCObjectFileInfo.h
+++ b/llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -484,8 +484,7 @@ class MCObjectFileInfo {
}
const Triple *getDarwinTargetVariantTriple() const {
- return DarwinTargetVariantTriple ? DarwinTargetVariantTriple.getPointer()
- : nullptr;
+ return DarwinTargetVariantTriple ? &*DarwinTargetVariantTriple : nullptr;
}
void setDarwinTargetVariantSDKVersion(const VersionTuple &TheSDKVersion) {
diff --git a/llvm/lib/CodeGen/ExpandMemCmp.cpp b/llvm/lib/CodeGen/ExpandMemCmp.cpp
index b2639636dda7..7fd029663099 100644
--- a/llvm/lib/CodeGen/ExpandMemCmp.cpp
+++ b/llvm/lib/CodeGen/ExpandMemCmp.cpp
@@ -884,8 +884,7 @@ ExpandMemCmpPass::runImpl(Function &F, const TargetLibraryInfo *TLI,
const DataLayout& DL = F.getParent()->getDataLayout();
bool MadeChanges = false;
for (auto BBIt = F.begin(); BBIt != F.end();) {
- if (runOnBlock(*BBIt, TLI, TTI, TL, DL, PSI, BFI,
- DTU ? DTU.getPointer() : nullptr)) {
+ if (runOnBlock(*BBIt, TLI, TTI, TL, DL, PSI, BFI, DTU ? &*DTU : nullptr)) {
MadeChanges = true;
// If changes were made, restart the function from the beginning, since
// the structure of the function was changed.
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 00a551ade213..0e65a0bd52da 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -907,7 +907,7 @@ class SafeStackLegacyPass : public FunctionPass {
} else {
// Otherwise, we need to compute it.
LazilyComputedDomTree.emplace(F);
- DT = LazilyComputedDomTree.getPointer();
+ DT = &*LazilyComputedDomTree;
ShouldPreserveDominatorTree = false;
}
diff --git a/llvm/lib/CodeGen/ShadowStackGCLowering.cpp b/llvm/lib/CodeGen/ShadowStackGCLowering.cpp
index 711a2ac8f1b0..7401b825abb8 100644
--- a/llvm/lib/CodeGen/ShadowStackGCLowering.cpp
+++ b/llvm/lib/CodeGen/ShadowStackGCLowering.cpp
@@ -360,7 +360,7 @@ bool ShadowStackGCLowering::runOnFunction(Function &F) {
// For each instruction that escapes...
EscapeEnumerator EE(F, "gc_cleanup", /*HandleExceptions=*/true,
- DTU ? DTU.getPointer() : nullptr);
+ DTU ? &*DTU : nullptr);
while (IRBuilder<> *AtExit = EE.Next()) {
// Pop the entry from the shadow stack. Don't reuse CurrentHead from
// AtEntry, since that would make the value live for the entire function.
diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
index b708fb644e7a..18811a880691 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeTypeUDT.cpp
@@ -20,12 +20,12 @@ using namespace llvm::pdb;
NativeTypeUDT::NativeTypeUDT(NativeSession &Session, SymIndexId Id,
codeview::TypeIndex TI, codeview::ClassRecord CR)
: NativeRawSymbol(Session, PDB_SymType::UDT, Id), Index(TI),
- Class(std::move(CR)), Tag(Class.getPointer()) {}
+ Class(std::move(CR)), Tag(&*Class) {}
NativeTypeUDT::NativeTypeUDT(NativeSession &Session, SymIndexId Id,
codeview::TypeIndex TI, codeview::UnionRecord UR)
: NativeRawSymbol(Session, PDB_SymType::UDT, Id), Index(TI),
- Union(std::move(UR)), Tag(Union.getPointer()) {}
+ Union(std::move(UR)), Tag(&*Union) {}
NativeTypeUDT::NativeTypeUDT(NativeSession &Session, SymIndexId Id,
NativeTypeUDT &UnmodifiedType,
diff --git a/llvm/lib/Support/ToolOutputFile.cpp b/llvm/lib/Support/ToolOutputFile.cpp
index c2ca97a59c62..01f7095f3499 100644
--- a/llvm/lib/Support/ToolOutputFile.cpp
+++ b/llvm/lib/Support/ToolOutputFile.cpp
@@ -46,7 +46,7 @@ ToolOutputFile::ToolOutputFile(StringRef Filename, std::error_code &EC,
return;
}
OSHolder.emplace(Filename, EC, Flags);
- OS = OSHolder.getPointer();
+ OS = &*OSHolder;
// If open fails, no cleanup is needed.
if (EC)
Installer.Keep = true;
@@ -55,5 +55,5 @@ ToolOutputFile::ToolOutputFile(StringRef Filename, std::error_code &EC,
ToolOutputFile::ToolOutputFile(StringRef Filename, int FD)
: Installer(Filename) {
OSHolder.emplace(FD, true);
- OS = OSHolder.getPointer();
+ OS = &*OSHolder;
}
diff --git a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
index 7388c3a90227..9881b571c0df 100644
--- a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
@@ -924,7 +924,7 @@ PreservedAnalyses LoopFlattenPass::run(LoopNest &LN, LoopAnalysisManager &LAM,
// this pass will simplify all loops that contain inner loops,
// regardless of whether anything ends up being flattened.
Changed |= Flatten(LN, &AR.DT, &AR.LI, &AR.SE, &AR.AC, &AR.TTI, &U,
- MSSAU ? MSSAU.getPointer() : nullptr);
+ MSSAU ? &*MSSAU : nullptr);
if (!Changed)
return PreservedAnalyses::all();
@@ -989,8 +989,8 @@ bool LoopFlattenLegacyPass::runOnFunction(Function &F) {
bool Changed = false;
for (Loop *L : *LI) {
auto LN = LoopNest::getLoopNest(*L, *SE);
- Changed |= Flatten(*LN, DT, LI, SE, AC, TTI, nullptr,
- MSSAU ? MSSAU.getPointer() : nullptr);
+ Changed |=
+ Flatten(*LN, DT, LI, SE, AC, TTI, nullptr, MSSAU ? &*MSSAU : nullptr);
}
return Changed;
}
diff --git a/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
index 4249512ea0f8..38c06535203c 100644
--- a/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
@@ -221,7 +221,7 @@ PreservedAnalyses LoopInstSimplifyPass::run(Loop &L, LoopAnalysisManager &AM,
AR.MSSA->verifyMemorySSA();
}
if (!simplifyLoopInst(L, AR.DT, AR.LI, AR.AC, AR.TLI,
- MSSAU ? MSSAU.getPointer() : nullptr))
+ MSSAU ? &*MSSAU : nullptr))
return PreservedAnalyses::all();
auto PA = getLoopPassPreservedAnalyses();
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
index d9c33b5f335a..c9c938be0fff 100644
--- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
@@ -58,10 +58,9 @@ PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM,
Optional<MemorySSAUpdater> MSSAU;
if (AR.MSSA)
MSSAU = MemorySSAUpdater(AR.MSSA);
- bool Changed =
- LoopRotation(&L, &AR.LI, &AR.TTI, &AR.AC, &AR.DT, &AR.SE,
- MSSAU ? MSSAU.getPointer() : nullptr, SQ, false, Threshold,
- false, PrepareForLTO || PrepareForLTOOption);
+ bool Changed = LoopRotation(&L, &AR.LI, &AR.TTI, &AR.AC, &AR.DT, &AR.SE,
+ MSSAU ? &*MSSAU : nullptr, SQ, false, Threshold,
+ false, PrepareForLTO || PrepareForLTOOption);
if (!Changed)
return PreservedAnalyses::all();
@@ -130,9 +129,9 @@ class LoopRotateLegacyPass : public LoopPass {
? DefaultRotationThreshold
: MaxHeaderSize;
- return LoopRotation(L, LI, TTI, AC, &DT, &SE,
- MSSAU ? MSSAU.getPointer() : nullptr, SQ, false,
- Threshold, false, PrepareForLTO || PrepareForLTOOption);
+ return LoopRotation(L, LI, TTI, AC, &DT, &SE, MSSAU ? &*MSSAU : nullptr, SQ,
+ false, Threshold, false,
+ PrepareForLTO || PrepareForLTOOption);
}
};
} // end namespace
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
index 4b637226e8a7..0ad7ee3463fb 100644
--- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -721,8 +721,8 @@ PreservedAnalyses LoopSimplifyCFGPass::run(Loop &L, LoopAnalysisManager &AM,
if (AR.MSSA)
MSSAU = MemorySSAUpdater(AR.MSSA);
bool DeleteCurrentLoop = false;
- if (!simplifyLoopCFG(L, AR.DT, AR.LI, AR.SE,
- MSSAU ? MSSAU.getPointer() : nullptr, DeleteCurrentLoop))
+ if (!simplifyLoopCFG(L, AR.DT, AR.LI, AR.SE, MSSAU ? &*MSSAU : nullptr,
+ DeleteCurrentLoop))
return PreservedAnalyses::all();
if (DeleteCurrentLoop)
@@ -756,9 +756,8 @@ class LoopSimplifyCFGLegacyPass : public LoopPass {
if (MSSAA && VerifyMemorySSA)
MSSAU->getMemorySSA()->verifyMemorySSA();
bool DeleteCurrentLoop = false;
- bool Changed =
- simplifyLoopCFG(*L, DT, LI, SE, MSSAU ? MSSAU.getPointer() : nullptr,
- DeleteCurrentLoop);
+ bool Changed = simplifyLoopCFG(*L, DT, LI, SE, MSSAU ? &*MSSAU : nullptr,
+ DeleteCurrentLoop);
if (DeleteCurrentLoop)
LPM.markLoopAsDeleted(*L);
return Changed;
diff --git a/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
index 47493b54a527..955ac2706f65 100644
--- a/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
@@ -143,10 +143,10 @@ static bool lowerConstantIntrinsics(Function &F, const TargetLibraryInfo &TLI,
break;
}
HasDeadBlocks |= replaceConditionalBranchesOnConstant(
- II, NewValue, DTU ? DTU.getPointer() : nullptr);
+ II, NewValue, DTU ? &*DTU : nullptr);
}
if (HasDeadBlocks)
- removeUnreachableBlocks(F, DTU ? DTU.getPointer() : nullptr);
+ removeUnreachableBlocks(F, DTU ? &*DTU : nullptr);
return !Worklist.empty();
}
diff --git a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
index 6ad3bc9a6915..226c9ee0d5dc 100644
--- a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
+++ b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
@@ -139,7 +139,7 @@ static bool runPartiallyInlineLibCalls(Function &F, TargetLibraryInfo *TLI,
case LibFunc_sqrt:
if (TTI->haveFastSqrt(Call->getType()) &&
optimizeSQRT(Call, CalledFunc, *CurrBB, BB, TTI,
- DTU ? DTU.getPointer() : nullptr))
+ DTU ? &*DTU : nullptr))
break;
continue;
default:
diff --git a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp
index b257e54ed0cf..cda9be6daecc 100644
--- a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp
+++ b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp
@@ -873,7 +873,7 @@ static bool runImpl(Function &F, const TargetTransformInfo &TTI,
for (BasicBlock &BB : llvm::make_early_inc_range(F)) {
bool ModifiedDTOnIteration = false;
MadeChange |= optimizeBlock(BB, ModifiedDTOnIteration, TTI, DL,
- DTU ? DTU.getPointer() : nullptr);
+ DTU ? &*DTU : nullptr);
// Restart BB iteration if the dominator tree of the Function was changed
if (ModifiedDTOnIteration)
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index f6f3c8fffb8b..74e6adf7de82 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -3217,8 +3217,8 @@ PreservedAnalyses SimpleLoopUnswitchPass::run(Loop &L, LoopAnalysisManager &AM,
AR.MSSA->verifyMemorySSA();
}
if (!unswitchLoop(L, AR.DT, AR.LI, AR.AC, AR.AA, AR.TTI, Trivial, NonTrivial,
- UnswitchCB, &AR.SE, MSSAU ? MSSAU.getPointer() : nullptr,
- PSI, AR.BFI, DestroyLoopCB))
+ UnswitchCB, &AR.SE, MSSAU ? &*MSSAU : nullptr, PSI, AR.BFI,
+ DestroyLoopCB))
return PreservedAnalyses::all();
if (AR.MSSA && VerifyMemorySSA)
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index f9d1dc4b2749..7378e824e3b0 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -195,7 +195,7 @@ int main(int argc, char **argv) {
OS = &OutFile.os();
} else {
BOS.emplace(OutFile.os());
- OS = BOS.getPointer();
+ OS = &*BOS;
}
std::unique_ptr<MCStreamer> MS(TheTarget->createMCObjectStreamer(
More information about the cfe-commits
mailing list