diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-11 01:37:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-11 01:37:51 +0000 |
commit | 86cc42355593dd1689f7d58d56695c451215b02b (patch) | |
tree | bc83bae05962525946b96dbb4fd11f3957cedf11 /lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 6934a04a8c15e9971cd1ea4d5c8df2d7afdd5be5 (diff) |
simplify code by using Value::takeName
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | lib/Transforms/Utils/BasicBlockUtils.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 769d1b2d78..f9bcd39e41 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -29,14 +29,12 @@ void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL, // Replaces all of the uses of the instruction with uses of the value I.replaceAllUsesWith(V); - std::string OldName = I.getName(); + // Make sure to propagate a name if there is one already. + if (I.hasName() && !V->hasName()) + V->takeName(&I); // Delete the unnecessary instruction now... BI = BIL.erase(BI); - - // Make sure to propagate a name if there is one already. - if (!OldName.empty() && !V->hasName()) - V->setName(OldName); } |