Skip to content

Commit

Permalink
Bump SmallString size a bit to avoid malloc trashing.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100010 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Mar 31, 2010
1 parent 6163336 commit 4ef6822
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/VMCore/ValueSymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ void ValueSymbolTable::reinsertValue(Value* V) {
raw_svector_ostream(UniqueName) << ++LastUnique;

// Try insert the vmap entry with this suffix.
ValueName &NewName =
vmap.GetOrCreateValue(StringRef(UniqueName.data(),
UniqueName.size()));
ValueName &NewName = vmap.GetOrCreateValue(UniqueName);
if (NewName.getValue() == 0) {
// Newly inserted name. Success!
NewName.setValue(V);
Expand Down Expand Up @@ -88,17 +86,15 @@ ValueName *ValueSymbolTable::createValueName(StringRef Name, Value *V) {
}

// Otherwise, there is a naming conflict. Rename this value.
SmallString<128> UniqueName(Name.begin(), Name.end());
SmallString<256> UniqueName(Name.begin(), Name.end());

while (1) {
// Trim any suffix off and append the next number.
UniqueName.resize(Name.size());
raw_svector_ostream(UniqueName) << ++LastUnique;

// Try insert the vmap entry with this suffix.
ValueName &NewName =
vmap.GetOrCreateValue(StringRef(UniqueName.data(),
UniqueName.size()));
ValueName &NewName = vmap.GetOrCreateValue(UniqueName);
if (NewName.getValue() == 0) {
// Newly inserted name. Success!
NewName.setValue(V);
Expand Down

0 comments on commit 4ef6822

Please sign in to comment.