[llvm] r263215 - [InstCombine] Use Twines to generate names.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 02:20:56 PST 2016
Author: d0k
Date: Fri Mar 11 04:20:56 2016
New Revision: 263215
URL: http://llvm.org/viewvc/llvm-project?rev=263215&view=rev
Log:
[InstCombine] Use Twines to generate names.
Since the names are used in a loop this does more work in debug builds. In
release builds value names are generally discarded so we don't have to do
the concatenation at all. It's also simpler code, no functional change
intended.
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=263215&r1=263214&r2=263215&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Fri Mar 11 04:20:56 2016
@@ -523,7 +523,7 @@ static Instruction *unpackLoadToAggregat
if (!T->isAggregateType())
return nullptr;
- auto Name = LI.getName();
+ StringRef Name = LI.getName();
assert(LI.getAlignment() && "Alignment must be set at this point");
if (auto *ST = dyn_cast<StructType>(T)) {
@@ -547,11 +547,6 @@ static Instruction *unpackLoadToAggregat
if (!Align)
Align = DL.getABITypeAlignment(ST);
- SmallString<16> LoadName = Name;
- LoadName += ".unpack";
- SmallString<16> EltName = Name;
- EltName += ".elt";
-
auto *Addr = LI.getPointerOperand();
auto *IdxType = Type::getInt32Ty(T->getContext());
auto *Zero = ConstantInt::get(IdxType, 0);
@@ -563,9 +558,9 @@ static Instruction *unpackLoadToAggregat
ConstantInt::get(IdxType, i),
};
auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices),
- EltName);
+ Name + ".elt");
auto EltAlign = MinAlign(Align, SL->getElementOffset(i));
- auto *L = IC.Builder->CreateAlignedLoad(Ptr, EltAlign, LoadName);
+ auto *L = IC.Builder->CreateAlignedLoad(Ptr, EltAlign, Name + ".unpack");
V = IC.Builder->CreateInsertValue(V, L, i);
}
@@ -588,11 +583,6 @@ static Instruction *unpackLoadToAggregat
if (!Align)
Align = DL.getABITypeAlignment(T);
- SmallString<16> LoadName = Name;
- LoadName += ".unpack";
- SmallString<16> EltName = Name;
- EltName += ".elt";
-
auto *Addr = LI.getPointerOperand();
auto *IdxType = Type::getInt64Ty(T->getContext());
auto *Zero = ConstantInt::get(IdxType, 0);
@@ -605,9 +595,9 @@ static Instruction *unpackLoadToAggregat
ConstantInt::get(IdxType, i),
};
auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices),
- EltName);
+ Name + ".elt");
auto *L = IC.Builder->CreateAlignedLoad(Ptr, MinAlign(Align, Offset),
- LoadName);
+ Name + ".unpack");
V = IC.Builder->CreateInsertValue(V, L, i);
Offset += EltSize;
}
More information about the llvm-commits
mailing list