[llvm] r255637 - InstCombineLoadStoreAlloca.cpp: Avoid instantiating Twine.

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 01:37:31 PST 2015


Author: chapuni
Date: Tue Dec 15 03:37:31 2015
New Revision: 255637

URL: http://llvm.org/viewvc/llvm-project?rev=255637&view=rev
Log:
InstCombineLoadStoreAlloca.cpp: Avoid instantiating Twine.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=255637&r1=255636&r2=255637&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Tue Dec 15 03:37:31 2015
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "InstCombineInternal.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/Loads.h"
 #include "llvm/IR/DataLayout.h"
@@ -540,8 +541,10 @@ static Instruction *unpackLoadToAggregat
       return nullptr;
 
     auto Name = LI.getName();
-    auto LoadName = LI.getName() + ".unpack";
-    auto EltName = Name + ".elt";
+    SmallString<16> LoadName = Name;
+    LoadName += ".unpack";
+    SmallString<16> EltName = Name;
+    EltName += ".elt";
     auto *Addr = LI.getPointerOperand();
     Value *V = UndefValue::get(T);
     auto *IdxType = Type::getInt32Ty(ST->getContext());
@@ -944,9 +947,11 @@ static bool unpackStoreToAggregate(InstC
     if (SL->hasPadding())
       return false;
 
-    auto EltName = V->getName() + ".elt";
+    SmallString<16> EltName = V->getName();
+    EltName += ".elt";
     auto *Addr = SI.getPointerOperand();
-    auto AddrName = Addr->getName() + ".repack";
+    SmallString<16> AddrName = Addr->getName();
+    AddrName += ".repack";
     auto *IdxType = Type::getInt32Ty(ST->getContext());
     auto *Zero = ConstantInt::get(IdxType, 0);
     for (unsigned i = 0; i < Count; i++) {




More information about the llvm-commits mailing list