From e590bd6b921a247e0fb98259d57bc4c8e61d1890 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 11 Apr 2020 14:48:53 +0200 Subject: [PATCH] [argpromote] Use formatv to simplify code. NFCI. --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 500a928..b8caf14 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -36,7 +36,6 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Twine.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumptionCache.h" @@ -74,6 +73,7 @@ #include "llvm/Pass.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/IPO.h" #include @@ -453,12 +453,8 @@ doPromotion(Function *F, SmallPtrSetImpl &ArgsToPromote, assert(It != ArgIndices.end() && "GEP not handled??"); } - std::string NewName = std::string(I->getName()); - for (unsigned i = 0, e = Operands.size(); i != e; ++i) { - NewName += "." + utostr(Operands[i]); - } - NewName += ".val"; - TheArg->setName(NewName); + TheArg->setName(formatv("{0}.{1:$[.]}.val", I->getName(), + make_range(Operands.begin(), Operands.end()))); LLVM_DEBUG(dbgs() << "*** Promoted agg argument '" << TheArg->getName() << "' of function '" << NF->getName() << "'\n"); -- 2.7.4