From 42dc4b7d18dd7b513bead28011cafa9faf9b0cfa Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 20 Jun 2024 13:28:04 -0700 Subject: [PATCH] [llvm] Remove redundant calls to std::unique_ptr::get (NFC) --- llvm/include/llvm/Analysis/BranchProbabilityInfo.h | 2 +- llvm/include/llvm/Analysis/MLInlineAdvisor.h | 2 +- llvm/include/llvm/Analysis/MemorySSA.h | 2 +- llvm/include/llvm/ProfileData/SampleProfReader.h | 2 +- llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp | 2 +- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 2 +- .../DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp | 4 ++-- llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp | 2 +- llvm/lib/IR/DebugProgramInstruction.cpp | 2 +- llvm/lib/ObjectYAML/XCOFFYAML.cpp | 2 +- llvm/lib/Support/TimeProfiler.cpp | 2 +- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | 2 +- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 12 ++++++------ llvm/tools/bugpoint/CrashDebugger.cpp | 2 +- llvm/tools/llvm-as/llvm-as.cpp | 4 ++-- llvm/tools/llvm-objdump/MachODump.cpp | 2 +- llvm/tools/llvm-profgen/ProfiledBinary.cpp | 9 ++++----- llvm/tools/llvm-readobj/llvm-readobj.cpp | 6 +++--- llvm/unittests/CodeGen/GlobalISel/GISelMITest.h | 3 +-- llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp | 4 ++-- .../DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp | 2 +- llvm/unittests/IR/VFABIDemanglerTest.cpp | 2 +- llvm/unittests/Linker/LinkModulesTest.cpp | 5 +++-- llvm/unittests/MC/DwarfLineTableHeaders.cpp | 2 +- llvm/unittests/MIR/MachineMetadata.cpp | 3 +-- llvm/unittests/Target/X86/MachineSizeOptsTest.cpp | 4 ++-- llvm/unittests/Transforms/Utils/SizeOptsTest.cpp | 2 +- 27 files changed, 43 insertions(+), 45 deletions(-) diff --git a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h index 91e1872e9bd6ff..eab7fec6b6e08f 100644 --- a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h +++ b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h @@ -345,7 +345,7 @@ class BranchProbabilityInfo { /// Helper to construct LoopBlock for \p BB. LoopBlock getLoopBlock(const BasicBlock *BB) const { - return LoopBlock(BB, *LI, *SccI.get()); + return LoopBlock(BB, *LI, *SccI); } /// Returns true if destination block belongs to some loop and source block is diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h index 0333f457c1a2d8..7d726a246ca3cb 100644 --- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -45,7 +45,7 @@ class MLInlineAdvisor : public InlineAdvisor { bool isForcedToStop() const { return ForceStop; } int64_t getLocalCalls(Function &F); - const MLModelRunner &getModelRunner() const { return *ModelRunner.get(); } + const MLModelRunner &getModelRunner() const { return *ModelRunner; } FunctionPropertiesInfo &getCachedFPI(Function &) const; protected: diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h index 5a2425257b03fa..ac828021dd2ae1 100644 --- a/llvm/include/llvm/Analysis/MemorySSA.h +++ b/llvm/include/llvm/Analysis/MemorySSA.h @@ -937,7 +937,7 @@ class MemorySSAAnalysis : public AnalysisInfoMixin { struct Result { Result(std::unique_ptr &&MSSA) : MSSA(std::move(MSSA)) {} - MemorySSA &getMSSA() { return *MSSA.get(); } + MemorySSA &getMSSA() { return *MSSA; } std::unique_ptr MSSA; diff --git a/llvm/include/llvm/ProfileData/SampleProfReader.h b/llvm/include/llvm/ProfileData/SampleProfReader.h index d7c70064ca429f..f4bdc6525308d2 100644 --- a/llvm/include/llvm/ProfileData/SampleProfReader.h +++ b/llvm/include/llvm/ProfileData/SampleProfReader.h @@ -449,7 +449,7 @@ class SampleProfileReader { StringRef RemapFilename = ""); /// Return the profile summary. - ProfileSummary &getSummary() const { return *(Summary.get()); } + ProfileSummary &getSummary() const { return *Summary; } MemoryBuffer *getBuffer() const { return Buffer.get(); } diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp index 91fc9d764b3b87..9558247db3c40d 100644 --- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp +++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp @@ -859,5 +859,5 @@ GISelKnownBits &GISelKnownBitsAnalysis::get(MachineFunction &MF) { MF.getTarget().getOptLevel() == CodeGenOptLevel::None ? 2 : 6; Info = std::make_unique(MF, MaxDepth); } - return *Info.get(); + return *Info; } diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 7b96f4589f5c43..d348c2b86916f2 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -3968,7 +3968,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) { #endif // ifndef NDEBUG // Translate any debug-info attached to the instruction. - translateDbgInfo(Inst, *CurBuilder.get()); + translateDbgInfo(Inst, *CurBuilder); if (translate(Inst)) continue; diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp index 0cb9cd5f9ea31d..6f659eb8576b79 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp +++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp @@ -1843,13 +1843,13 @@ bool CompileUnit::resolveDependenciesAndMarkLiveness( bool CompileUnit::updateDependenciesCompleteness() { assert(Dependencies.get()); - return Dependencies.get()->updateDependenciesCompleteness(); + return Dependencies->updateDependenciesCompleteness(); } void CompileUnit::verifyDependencies() { assert(Dependencies.get()); - Dependencies.get()->verifyKeepChain(); + Dependencies->verifyKeepChain(); } ArrayRef dwarf_linker::parallel::getODRAttributes() { diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp index 84fd0806f07050..6d9e3319db7e5e 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp +++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp @@ -142,7 +142,7 @@ Error DWARFLinkerImpl::link() { // twice. And then following handling might be removed. for (const std::unique_ptr &OrigCU : Context->InputDWARFFile.Dwarf->compile_units()) { - DWARFDie UnitDie = OrigCU.get()->getUnitDIE(); + DWARFDie UnitDie = OrigCU->getUnitDIE(); if (!Language) { if (std::optional Val = diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp index 9a4926c81dca27..21a7a55d067609 100644 --- a/llvm/lib/IR/DebugProgramInstruction.cpp +++ b/llvm/lib/IR/DebugProgramInstruction.cpp @@ -399,7 +399,7 @@ DbgVariableIntrinsic * DbgVariableRecord::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const { [[maybe_unused]] DICompileUnit *Unit = - getDebugLoc().get()->getScope()->getSubprogram()->getUnit(); + getDebugLoc()->getScope()->getSubprogram()->getUnit(); assert(M && Unit && "Cannot clone from BasicBlock that is not part of a Module or " "DICompileUnit!"); diff --git a/llvm/lib/ObjectYAML/XCOFFYAML.cpp b/llvm/lib/ObjectYAML/XCOFFYAML.cpp index 575334ee980e83..ca075b8147a724 100644 --- a/llvm/lib/ObjectYAML/XCOFFYAML.cpp +++ b/llvm/lib/ObjectYAML/XCOFFYAML.cpp @@ -327,7 +327,7 @@ void MappingTraits>::mapping( XCOFFYAML::AuxSymbolType AuxType; if (IO.outputting()) - AuxType = AuxSym.get()->Type; + AuxType = AuxSym->Type; IO.mapRequired("Type", AuxType); switch (AuxType) { case XCOFFYAML::AUX_EXCEPT: diff --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp index 092028dd2a5b34..9612db7d30f98b 100644 --- a/llvm/lib/Support/TimeProfiler.cpp +++ b/llvm/lib/Support/TimeProfiler.cpp @@ -115,7 +115,7 @@ struct llvm::TimeTraceProfiler { void end() { assert(!Stack.empty() && "Must call begin() first"); - end(*Stack.back().get()); + end(*Stack.back()); } void end(TimeTraceProfilerEntry &E) { diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 40ee59c014b09f..6f8ce174ea4dae 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -145,7 +145,7 @@ static void doList(opt::InputArgList &Args) { return; Error Err = Error::success(); - object::Archive Archive(B.get()->getMemBufferRef(), Err); + object::Archive Archive(B->getMemBufferRef(), Err); fatalOpenError(std::move(Err), B->getBufferIdentifier()); std::vector Names; diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 64c5fb49ec85ce..f6b51f83ff76f2 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -8001,7 +8001,7 @@ getGEPCosts(const TargetTransformInfo &TTI, ArrayRef Ptrs, void BoUpSLP::transformNodes() { constexpr TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput; for (std::unique_ptr &TE : VectorizableTree) { - TreeEntry &E = *TE.get(); + TreeEntry &E = *TE; switch (E.getOpcode()) { case Instruction::Load: { // No need to reorder masked gather loads, just reorder the scalar @@ -10462,7 +10462,7 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef VectorizedVals) { } // Add reduced value cost, if resized. if (!VectorizedVals.empty()) { - const TreeEntry &Root = *VectorizableTree.front().get(); + const TreeEntry &Root = *VectorizableTree.front(); auto BWIt = MinBWs.find(&Root); if (BWIt != MinBWs.end()) { Type *DstTy = Root.Scalars.front()->getType(); @@ -10570,7 +10570,7 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef VectorizedVals) { // Add the cost for reduced value resize (if required). if (ReductionBitWidth != 0) { assert(UserIgnoreList && "Expected reduction tree."); - const TreeEntry &E = *VectorizableTree.front().get(); + const TreeEntry &E = *VectorizableTree.front(); auto It = MinBWs.find(&E); if (It != MinBWs.end() && It->second.first != ReductionBitWidth) { unsigned SrcSize = It->second.first; @@ -14099,7 +14099,7 @@ Value *BoUpSLP::vectorizeTree( Builder.ClearInsertionPoint(); InstrElementSize.clear(); - const TreeEntry &RootTE = *VectorizableTree.front().get(); + const TreeEntry &RootTE = *VectorizableTree.front(); Value *Vec = RootTE.VectorizedValue; if (auto It = MinBWs.find(&RootTE); ReductionBitWidth != 0 && It != MinBWs.end() && @@ -15486,8 +15486,8 @@ void BoUpSLP::computeMinimumValueSizes() { VectorizableTree.front()->Scalars.front()->getType())) Limit = 3; unsigned MaxBitWidth = ComputeMaxBitWidth( - *VectorizableTree[NodeIdx].get(), IsTopRoot, IsProfitableToDemoteRoot, - Opcode, Limit, IsTruncRoot, IsSignedCmp); + *VectorizableTree[NodeIdx], IsTopRoot, IsProfitableToDemoteRoot, Opcode, + Limit, IsTruncRoot, IsSignedCmp); if (ReductionBitWidth != 0 && (IsTopRoot || !RootDemotes.empty())) { if (MaxBitWidth != 0 && ReductionBitWidth < MaxBitWidth) ReductionBitWidth = bit_ceil(MaxBitWidth); diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index 0ca8fa28c4af03..e1a732f4b01921 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -72,7 +72,7 @@ cl::opt VerboseErrors("verbose-errors", static bool isValidModule(std::unique_ptr &M, bool ExitOnFailure = true) { - if (!llvm::verifyModule(*M.get(), &llvm::errs())) + if (!llvm::verifyModule(*M, &llvm::errs())) return true; if (ExitOnFailure) { diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp index 9b9af762676195..f28ad00184420f 100644 --- a/llvm/tools/llvm-as/llvm-as.cpp +++ b/llvm/tools/llvm-as/llvm-as.cpp @@ -153,7 +153,7 @@ int main(int argc, char **argv) { if (!DisableVerify) { std::string ErrorStr; raw_string_ostream OS(ErrorStr); - if (verifyModule(*M.get(), &OS)) { + if (verifyModule(*M, &OS)) { errs() << argv[0] << ": assembly parsed, but does not verify as correct!\n"; errs() << OS.str(); @@ -163,7 +163,7 @@ int main(int argc, char **argv) { } if (DumpAsm) { - errs() << "Here's the assembly:\n" << *M.get(); + errs() << "Here's the assembly:\n" << *M; if (Index.get() && Index->begin() != Index->end()) Index->print(errs()); } diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index 749f9882017577..0544fc4f406bb0 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -7179,7 +7179,7 @@ objdump::getMachODSymObject(const MachOObjectFile *MachOOF, StringRef Filename, DSYMBuf = std::move(BufOrErr.get()); Expected> BinaryOrErr = - createBinary(DSYMBuf.get()->getMemBufferRef()); + createBinary(DSYMBuf->getMemBufferRef()); if (!BinaryOrErr) { reportError(BinaryOrErr.takeError(), DSYMPath); return nullptr; diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp index a7e506d32ac2ee..632ddc7b50f54a 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -132,7 +132,7 @@ void BinarySizeContextTracker::trackInlineesOptimizedAway( MCPseudoProbeDecoder &ProbeDecoder) { ProbeFrameStack ProbeContext; for (const auto &Child : ProbeDecoder.getDummyInlineRoot().getChildren()) - trackInlineesOptimizedAway(ProbeDecoder, *Child.second.get(), ProbeContext); + trackInlineesOptimizedAway(ProbeDecoder, *Child.second, ProbeContext); } void BinarySizeContextTracker::trackInlineesOptimizedAway( @@ -161,8 +161,7 @@ void BinarySizeContextTracker::trackInlineesOptimizedAway( for (const auto &ChildNode : ProbeNode.getChildren()) { InlineSite Location = ChildNode.first; ProbeContext.back().second = std::get<1>(Location); - trackInlineesOptimizedAway(ProbeDecoder, *ChildNode.second.get(), - ProbeContext); + trackInlineesOptimizedAway(ProbeDecoder, *ChildNode.second, ProbeContext); } ProbeContext.pop_back(); @@ -527,7 +526,7 @@ bool ProfiledBinary::dissassembleSymbol(std::size_t SI, ArrayRef Bytes, outs() << format("%8" PRIx64 ":", Address); size_t Start = outs().tell(); if (Disassembled) - IPrinter->printInst(&Inst, Address + Size, "", *STI.get(), outs()); + IPrinter->printInst(&Inst, Address + Size, "", *STI, outs()); else outs() << "\t"; if (ShowSourceLocations) { @@ -845,7 +844,7 @@ void ProfiledBinary::loadSymbolsFromDWARF(ObjectFile &Obj) { exitWithError("Error creating the debug info context", Path); for (const auto &CompilationUnit : DebugContext->compile_units()) - loadSymbolsFromDWARFUnit(*CompilationUnit.get()); + loadSymbolsFromDWARFUnit(*CompilationUnit); // Handles DWO sections that can either be in .o, .dwo or .dwp files. uint32_t NumOfDWOMissing = 0; diff --git a/llvm/tools/llvm-readobj/llvm-readobj.cpp b/llvm/tools/llvm-readobj/llvm-readobj.cpp index 9ac324cc672f05..15d838617063b2 100644 --- a/llvm/tools/llvm-readobj/llvm-readobj.cpp +++ b/llvm/tools/llvm-readobj/llvm-readobj.cpp @@ -700,14 +700,14 @@ int llvm_readobj_main(int argc, char **argv, const llvm::ToolContext &) { std::unique_ptr Writer = createWriter(); for (const std::string &I : opts::InputFilenames) - dumpInput(I, *Writer.get()); + dumpInput(I, *Writer); if (opts::CodeViewMergedTypes) { if (opts::CodeViewEnableGHash) - dumpCodeViewMergedTypes(*Writer.get(), CVTypes.GlobalIDTable.records(), + dumpCodeViewMergedTypes(*Writer, CVTypes.GlobalIDTable.records(), CVTypes.GlobalTypeTable.records()); else - dumpCodeViewMergedTypes(*Writer.get(), CVTypes.IDTable.records(), + dumpCodeViewMergedTypes(*Writer, CVTypes.IDTable.records(), CVTypes.TypeTable.records()); } diff --git a/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h b/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h index 06786b15252a0e..fd31e95cce13d9 100644 --- a/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h +++ b/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h @@ -184,8 +184,7 @@ static inline bool CheckMachineFunction(const MachineFunction &MF, SmallString<4096> CheckFileBuffer; FileCheckRequest Req; FileCheck FC(Req); - StringRef CheckFileText = - FC.CanonicalizeFile(*CheckBuf.get(), CheckFileBuffer); + StringRef CheckFileText = FC.CanonicalizeFile(*CheckBuf, CheckFileBuffer); SourceMgr SM; SM.AddNewSourceBuffer(MemoryBuffer::getMemBuffer(CheckFileText, "CheckFile"), SMLoc()); diff --git a/llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp b/llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp index 7b4f7939e67830..5b203adfeb284f 100644 --- a/llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp +++ b/llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp @@ -147,7 +147,7 @@ struct MockData1 { Obj = yaml::yaml2ObjectFile(Storage, Buffer, [](const Twine &Err) { errs() << Err; }); - return *Obj.get(); + return *Obj; } }; @@ -521,7 +521,7 @@ class MockData2 { Obj = yaml::yaml2ObjectFile(ObjStorage, YamlBuffer, [](const Twine &Err) { errs() << Err; }); - return *Obj.get(); + return *Obj; } }; diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp index 166a62ad2daa31..43fdf5d3d6f319 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp @@ -101,7 +101,7 @@ DWARFExpressionCopyBytesTest::createStreamer(raw_pwrite_stream &OS) { Res.Ctx = std::make_unique(Triple(TripleName), MAI.get(), MRI.get(), /*MSTI=*/nullptr); - Res.MOFI.reset(TheTarget->createMCObjectFileInfo(*Res.Ctx.get(), + Res.MOFI.reset(TheTarget->createMCObjectFileInfo(*Res.Ctx, /*PIC=*/false)); Res.Ctx->setObjectFileInfo(Res.MOFI.get()); diff --git a/llvm/unittests/IR/VFABIDemanglerTest.cpp b/llvm/unittests/IR/VFABIDemanglerTest.cpp index d7485217951c42..a9dd93a0c2b1b9 100644 --- a/llvm/unittests/IR/VFABIDemanglerTest.cpp +++ b/llvm/unittests/IR/VFABIDemanglerTest.cpp @@ -43,7 +43,7 @@ class VFABIParserTest : public ::testing::Test { M = parseAssemblyString("declare void @dummy()", Err, Ctx); EXPECT_NE(M.get(), nullptr) << "Loading an invalid module.\n " << Err.getMessage() << "\n"; - Type *Ty = parseType(ScalarFTyStr, Err, *(M.get())); + Type *Ty = parseType(ScalarFTyStr, Err, *(M)); ScalarFTy = dyn_cast(Ty); EXPECT_NE(ScalarFTy, nullptr) << "Invalid function type string: " << ScalarFTyStr << "\n" diff --git a/llvm/unittests/Linker/LinkModulesTest.cpp b/llvm/unittests/Linker/LinkModulesTest.cpp index 884e20e89c5c2f..21c3f0ecf4bc15 100644 --- a/llvm/unittests/Linker/LinkModulesTest.cpp +++ b/llvm/unittests/Linker/LinkModulesTest.cpp @@ -40,8 +40,9 @@ class LinkModuleTest : public testing::Test { AT = ArrayType::get(PointerType::getUnqual(Ctx), 3); - GV = new GlobalVariable(*M.get(), AT, false /*=isConstant*/, - GlobalValue::InternalLinkage, nullptr,"switch.bas"); + GV = + new GlobalVariable(*M, AT, false /*=isConstant*/, + GlobalValue::InternalLinkage, nullptr, "switch.bas"); // Global Initializer std::vector Init; diff --git a/llvm/unittests/MC/DwarfLineTableHeaders.cpp b/llvm/unittests/MC/DwarfLineTableHeaders.cpp index 691d319f540989..d8a657ed5048e0 100644 --- a/llvm/unittests/MC/DwarfLineTableHeaders.cpp +++ b/llvm/unittests/MC/DwarfLineTableHeaders.cpp @@ -72,7 +72,7 @@ class DwarfLineTableHeaders : public ::testing::Test { Res.Ctx = std::make_unique(Triple(TripleName), MAI.get(), MRI.get(), /*MSTI=*/nullptr); - Res.MOFI.reset(TheTarget->createMCObjectFileInfo(*Res.Ctx.get(), + Res.MOFI.reset(TheTarget->createMCObjectFileInfo(*Res.Ctx, /*PIC=*/false)); Res.Ctx->setObjectFileInfo(Res.MOFI.get()); diff --git a/llvm/unittests/MIR/MachineMetadata.cpp b/llvm/unittests/MIR/MachineMetadata.cpp index 63fad2d2effec5..364ab187c2858a 100644 --- a/llvm/unittests/MIR/MachineMetadata.cpp +++ b/llvm/unittests/MIR/MachineMetadata.cpp @@ -188,8 +188,7 @@ static bool checkOutput(std::string CheckString, std::string Output) { SmallString<4096> CheckFileBuffer; FileCheckRequest Req; FileCheck FC(Req); - StringRef CheckFileText = - FC.CanonicalizeFile(*CheckBuffer.get(), CheckFileBuffer); + StringRef CheckFileText = FC.CanonicalizeFile(*CheckBuffer, CheckFileBuffer); SourceMgr SM; SM.AddNewSourceBuffer(MemoryBuffer::getMemBuffer(CheckFileText, "CheckFile"), diff --git a/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp b/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp index e072844ca0106f..f4dab399803d14 100644 --- a/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp +++ b/llvm/unittests/Target/X86/MachineSizeOptsTest.cpp @@ -78,7 +78,7 @@ class MachineSizeOptsTest : public testing::Test { M->setTargetTriple(TM->getTargetTriple().getTriple()); M->setDataLayout(TM->createDataLayout()); MMI = std::make_unique(TM.get()); - if (Parser->parseMachineFunctions(*M, *MMI.get())) + if (Parser->parseMachineFunctions(*M, *MMI)) report_fatal_error("parseMachineFunctions failed"); } @@ -98,7 +98,7 @@ TEST_F(MachineSizeOptsTest, Test) { ASSERT_TRUE(G != nullptr); MachineFunction *H = getMachineFunction(M.get(), "h"); ASSERT_TRUE(H != nullptr); - ProfileSummaryInfo PSI = ProfileSummaryInfo(*M.get()); + ProfileSummaryInfo PSI = ProfileSummaryInfo(*M); ASSERT_TRUE(PSI.hasProfileSummary()); BFIData BFID_F(*F); BFIData BFID_G(*G); diff --git a/llvm/unittests/Transforms/Utils/SizeOptsTest.cpp b/llvm/unittests/Transforms/Utils/SizeOptsTest.cpp index 7caa5ed319acba..9c3d1657aa03a0 100644 --- a/llvm/unittests/Transforms/Utils/SizeOptsTest.cpp +++ b/llvm/unittests/Transforms/Utils/SizeOptsTest.cpp @@ -55,7 +55,7 @@ TEST_F(SizeOptsTest, Test) { Function *G = M->getFunction("g"); Function *H = M->getFunction("h"); - ProfileSummaryInfo PSI(*M.get()); + ProfileSummaryInfo PSI(*M); BFIData BFID_F(*F); BFIData BFID_G(*G); BFIData BFID_H(*H);