[Transform] Apply clang-tidy fixes for readability-redundant-smartptr-get (NFC)

This commit is contained in:
Kazu Hirata 2022-03-20 10:41:22 -07:00
parent 3b2e605e33
commit bce1bf0ee2
6 changed files with 12 additions and 12 deletions

View File

@ -740,7 +740,7 @@ bool HotColdSplittingLegacyPass::runOnModule(Module &M) {
std::function<OptimizationRemarkEmitter &(Function &)> GetORE =
[&ORE](Function &F) -> OptimizationRemarkEmitter & {
ORE.reset(new OptimizationRemarkEmitter(&F));
return *ORE.get();
return *ORE;
};
auto LookupAC = [this](Function &F) -> AssumptionCache * {
if (auto *ACT = getAnalysisIfAvailable<AssumptionCacheTracker>())
@ -772,7 +772,7 @@ HotColdSplittingPass::run(Module &M, ModuleAnalysisManager &AM) {
std::function<OptimizationRemarkEmitter &(Function &)> GetORE =
[&ORE](Function &F) -> OptimizationRemarkEmitter & {
ORE.reset(new OptimizationRemarkEmitter(&F));
return *ORE.get();
return *ORE;
};
ProfileSummaryInfo *PSI = &AM.getResult<ProfileSummaryAnalysis>(M);

View File

@ -2958,7 +2958,7 @@ bool IROutlinerLegacyPass::runOnModule(Module &M) {
std::unique_ptr<OptimizationRemarkEmitter> ORE;
auto GORE = [&ORE](Function &F) -> OptimizationRemarkEmitter & {
ORE.reset(new OptimizationRemarkEmitter(&F));
return *ORE.get();
return *ORE;
};
auto GTTI = [this](Function &F) -> TargetTransformInfo & {
@ -2989,7 +2989,7 @@ PreservedAnalyses IROutlinerPass::run(Module &M, ModuleAnalysisManager &AM) {
std::function<OptimizationRemarkEmitter &(Function &)> GORE =
[&ORE](Function &F) -> OptimizationRemarkEmitter & {
ORE.reset(new OptimizationRemarkEmitter(&F));
return *ORE.get();
return *ORE;
};
if (IROutliner(GTTI, GIRSI, GORE).run(M))

View File

@ -742,7 +742,7 @@ BranchProbability PartialInlinerImpl::getOutliningCallBBRelativeFreq(
auto OutlineRegionRelFreq = BranchProbability::getBranchProbability(
OutliningCallFreq.getFrequency(), EntryFreq.getFrequency());
if (hasProfileData(*Cloner.OrigFunc, *Cloner.ClonedOI.get()))
if (hasProfileData(*Cloner.OrigFunc, *Cloner.ClonedOI))
return OutlineRegionRelFreq;
// When profile data is not available, we need to be conservative in

View File

@ -2080,7 +2080,7 @@ bool ControlHeightReductionLegacyPass::runOnFunction(Function &F) {
RegionInfo &RI = getAnalysis<RegionInfoPass>().getRegionInfo();
std::unique_ptr<OptimizationRemarkEmitter> OwnedORE =
std::make_unique<OptimizationRemarkEmitter>(&F);
return CHR(F, BFI, DT, PSI, RI, *OwnedORE.get()).run();
return CHR(F, BFI, DT, PSI, RI, *OwnedORE).run();
}
namespace llvm {

View File

@ -381,7 +381,7 @@ PreservedAnalyses LoopSinkPass::run(Function &F, FunctionAnalysisManager &FAM) {
std::unique_ptr<AliasSetTracker> CurAST;
if (!EnableMSSAInLoopSink) {
CurAST = std::make_unique<AliasSetTracker>(AA);
computeAliasSet(L, *Preheader, *CurAST.get());
computeAliasSet(L, *Preheader, *CurAST);
}
// Note that we don't pass SCEV here because it is only used to invalidate
@ -436,7 +436,7 @@ struct LegacyLoopSinkPass : public LoopPass {
MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA();
else {
CurAST = std::make_unique<AliasSetTracker>(AA);
computeAliasSet(*L, *Preheader, *CurAST.get());
computeAliasSet(*L, *Preheader, *CurAST);
}
bool Changed = sinkLoopInvariantInstructions(

View File

@ -3371,7 +3371,7 @@ void BoUpSLP::reorderTopToBottom() {
for_each(VectorizableTree, [this, &VFToOrderedEntries, &GathersToOrders](
const std::unique_ptr<TreeEntry> &TE) {
if (Optional<OrdersType> CurrentOrder =
getReorderingData(*TE.get(), /*TopToBottom=*/true)) {
getReorderingData(*TE, /*TopToBottom=*/true)) {
// Do not include ordering for nodes used in the alt opcode vectorization,
// better to reorder them during bottom-to-top stage. If follow the order
// here, it causes reordering of the whole graph though actually it is
@ -3568,7 +3568,7 @@ void BoUpSLP::reorderBottomToTop(bool IgnoreReorder) {
if (TE->State != TreeEntry::Vectorize)
NonVectorized.push_back(TE.get());
if (Optional<OrdersType> CurrentOrder =
getReorderingData(*TE.get(), /*TopToBottom=*/false)) {
getReorderingData(*TE, /*TopToBottom=*/false)) {
OrderedEntries.insert(TE.get());
if (TE->State != TreeEntry::Vectorize)
GathersToOrders.try_emplace(TE.get(), *CurrentOrder);
@ -4131,7 +4131,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
if (!BSRef)
BSRef = std::make_unique<BlockScheduling>(BB);
BlockScheduling &BS = *BSRef.get();
BlockScheduling &BS = *BSRef;
Optional<ScheduleData *> Bundle = BS.tryScheduleBundle(VL, this, S);
#ifdef EXPENSIVE_CHECKS
@ -6095,7 +6095,7 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
unsigned BundleWidth = VectorizableTree[0]->Scalars.size();
for (unsigned I = 0, E = VectorizableTree.size(); I < E; ++I) {
TreeEntry &TE = *VectorizableTree[I].get();
TreeEntry &TE = *VectorizableTree[I];
InstructionCost C = getEntryCost(&TE, VectorizedVals);
Cost += C;