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 | 5149932068f535e1ff13b91c9669f55718c60a07 (patch) | |
tree | 502627278cfd8c0fef0e70a0bf771c7af58e9489 /lib/VMCore | |
parent | 7a7be366a7434623cbd1b44d41e07da5f2b8bf27 (diff) | |
download | llvm-5149932068f535e1ff13b91c9669f55718c60a07.tar.gz llvm-5149932068f535e1ff13b91c9669f55718c60a07.tar.bz2 llvm-5149932068f535e1ff13b91c9669f55718c60a07.tar.xz |
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')
-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 157245d9ea..34291b9d72 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); |