From: Alexandros Lamprineas Date: Tue, 9 May 2023 10:46:53 +0000 (+0100) Subject: [FuncSpec][NFC] Rename cryptic variable to better describe it. X-Git-Tag: upstream/17.0.6~9024 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=929a8c9f72dc405779a8aaf82304efdb7f1ab5e4;p=platform%2Fupstream%2Fllvm.git [FuncSpec][NFC] Rename cryptic variable to better describe it. UM -> UniqueSpecs Brought up on the review of D145379. Committing it seperately for now since the Cost model improvements need rethink. --- diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp index 7d08298..51f1319 100644 --- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp +++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp @@ -440,7 +440,7 @@ bool FunctionSpecializer::findSpecializations(Function *F, Cost SpecCost, // A mapping from a specialisation signature to the index of the respective // entry in the all specialisation array. Used to ensure uniqueness of // specialisations. - DenseMap UM; + DenseMap UniqueSpecs; // Get a list of interesting arguments. SmallVector Args; @@ -451,7 +451,6 @@ bool FunctionSpecializer::findSpecializations(Function *F, Cost SpecCost, if (Args.empty()) return false; - bool Found = false; for (User *U : F->users()) { if (!isa(U) && !isa(U)) continue; @@ -488,7 +487,7 @@ bool FunctionSpecializer::findSpecializations(Function *F, Cost SpecCost, continue; // Check if we have encountered the same specialisation already. - if (auto It = UM.find(S); It != UM.end()) { + if (auto It = UniqueSpecs.find(S); It != UniqueSpecs.end()) { // Existing specialisation. Add the call to the list to rewrite, unless // it's a recursive call. A specialisation, generated because of a // recursive call may end up as not the best specialisation for all @@ -515,14 +514,13 @@ bool FunctionSpecializer::findSpecializations(Function *F, Cost SpecCost, if (CS.getFunction() != F) Spec.CallSites.push_back(&CS); const unsigned Index = AllSpecs.size() - 1; - UM[S] = Index; + UniqueSpecs[S] = Index; if (auto [It, Inserted] = SM.try_emplace(F, Index, Index + 1); !Inserted) It->second.second = Index + 1; - Found = true; } } - return Found; + return !UniqueSpecs.empty(); } bool FunctionSpecializer::isCandidateFunction(Function *F) {