diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-03-11 10:20:56 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-03-11 10:20:56 +0000 |
| commit | c1263534738a5bf464f01942c6f34c21ea6293e1 (patch) | |
| tree | 8bbb58fb19d2221b1d93b8c3f9e78ff89939408f | |
| parent | 56e0d53e922ac1bae2354ec037edbbfbbf7419f5 (diff) | |
| download | bcm5719-llvm-c1263534738a5bf464f01942c6f34c21ea6293e1.tar.gz bcm5719-llvm-c1263534738a5bf464f01942c6f34c21ea6293e1.zip | |
[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
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index e0a3f36355d..48f258c86e7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -523,7 +523,7 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { 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 *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { 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 *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { 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 *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { 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 *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) { 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; } |

