aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-11 01:04:09 +0000
committerChris Lattner <sabre@nondot.org>2007-02-11 01:04:09 +0000
commitf41916e75dc9c622fa81b91eb6a5e0a36fa13754 (patch)
tree2f3c8d1271e97637ece6dd4de6b514a0cac7b8df
parent3e051647c079fe29db049646b39611fc0135327d (diff)
add an optimization for the case where the src has no name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34174 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Value.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index af753236c1..30ca5c35b5 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -141,6 +141,12 @@ void Value::setName(const std::string &name) {
/// takeName - transfer the name from V to this value, setting V's name to
/// empty. It is an error to call V->takeName(V).
void Value::takeName(Value *V) {
+ if (!V->hasName()) {
+ if (hasName())
+ setName("");
+ return;
+ }
+
std::string Name = V->getName();
V->setName("");
setName(Name);