diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-19 23:37:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-19 23:37:23 +0000 |
commit | a70ed4f7f6e87aa3a9c8d0e21b5bd92eeab3b521 (patch) | |
tree | 502627278cfd8c0fef0e70a0bf771c7af58e9489 /lib/VMCore/Value.cpp | |
parent | 2a19e973cf0c15c4744b0d54bb5f4f2ced979570 (diff) | |
download | external_llvm-a70ed4f7f6e87aa3a9c8d0e21b5bd92eeab3b521.zip external_llvm-a70ed4f7f6e87aa3a9c8d0e21b5bd92eeab3b521.tar.gz external_llvm-a70ed4f7f6e87aa3a9c8d0e21b5bd92eeab3b521.tar.bz2 |
Add a fast path for setName("") on an unnamed value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79492 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r-- | lib/VMCore/Value.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 157245d..34291b9 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -171,6 +171,10 @@ std::string Value::getNameStr() const { } void Value::setName(const Twine &NewName) { + // Fast path for common IRBuilder case of setName("") when there is no name. + if (NewName.isTriviallyEmpty() && !hasName()) + return; + SmallString<256> NameData; NewName.toVector(NameData); |