1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[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.

llvm-svn: 263215
This commit is contained in:
Benjamin Kramer 2016-03-11 10:20:56 +00:00
parent 941b85256d
commit af02270708

View File

@ -523,7 +523,7 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
if (!T->isAggregateType()) if (!T->isAggregateType())
return nullptr; return nullptr;
auto Name = LI.getName(); StringRef Name = LI.getName();
assert(LI.getAlignment() && "Alignment must be set at this point"); assert(LI.getAlignment() && "Alignment must be set at this point");
if (auto *ST = dyn_cast<StructType>(T)) { if (auto *ST = dyn_cast<StructType>(T)) {
@ -547,11 +547,6 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
if (!Align) if (!Align)
Align = DL.getABITypeAlignment(ST); Align = DL.getABITypeAlignment(ST);
SmallString<16> LoadName = Name;
LoadName += ".unpack";
SmallString<16> EltName = Name;
EltName += ".elt";
auto *Addr = LI.getPointerOperand(); auto *Addr = LI.getPointerOperand();
auto *IdxType = Type::getInt32Ty(T->getContext()); auto *IdxType = Type::getInt32Ty(T->getContext());
auto *Zero = ConstantInt::get(IdxType, 0); auto *Zero = ConstantInt::get(IdxType, 0);
@ -563,9 +558,9 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
ConstantInt::get(IdxType, i), ConstantInt::get(IdxType, i),
}; };
auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices), auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices),
EltName); Name + ".elt");
auto EltAlign = MinAlign(Align, SL->getElementOffset(i)); 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); V = IC.Builder->CreateInsertValue(V, L, i);
} }
@ -588,11 +583,6 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
if (!Align) if (!Align)
Align = DL.getABITypeAlignment(T); Align = DL.getABITypeAlignment(T);
SmallString<16> LoadName = Name;
LoadName += ".unpack";
SmallString<16> EltName = Name;
EltName += ".elt";
auto *Addr = LI.getPointerOperand(); auto *Addr = LI.getPointerOperand();
auto *IdxType = Type::getInt64Ty(T->getContext()); auto *IdxType = Type::getInt64Ty(T->getContext());
auto *Zero = ConstantInt::get(IdxType, 0); auto *Zero = ConstantInt::get(IdxType, 0);
@ -605,9 +595,9 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
ConstantInt::get(IdxType, i), ConstantInt::get(IdxType, i),
}; };
auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices), auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices),
EltName); Name + ".elt");
auto *L = IC.Builder->CreateAlignedLoad(Ptr, MinAlign(Align, Offset), auto *L = IC.Builder->CreateAlignedLoad(Ptr, MinAlign(Align, Offset),
LoadName); Name + ".unpack");
V = IC.Builder->CreateInsertValue(V, L, i); V = IC.Builder->CreateInsertValue(V, L, i);
Offset += EltSize; Offset += EltSize;
} }