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 | 8dd4cae4f8816e3c498bbb2efdf4edf03d229bff (patch) | |
| tree | bbcf2b9eff048590e8a22fc1fbfcf16fb6c6c461 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
| parent | 6e0123b17f519377e277281cf9e7a70c1b1dbb96 (diff) | |
| download | bcm5719-llvm-8dd4cae4f8816e3c498bbb2efdf4edf03d229bff.tar.gz bcm5719-llvm-8dd4cae4f8816e3c498bbb2efdf4edf03d229bff.zip | |
simplify code by using Value::takeName
llvm-svn: 34177
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 769d1b2d78e..f9bcd39e41c 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/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); } |

