llvm.org GIT mirror llvm / 5149932
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 Daniel Dunbar 11 years ago
2 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
320320 }
321321
322322 /// @}
323 /// @name Predicate Operations
324 /// @{
325
326 /// isTriviallyEmpty - Check if this twine is trivially empty; a false
327 /// return value does not necessarily mean the twine is empty.
328 bool isTriviallyEmpty() const {
329 return isNullary();
330 }
331
332 /// @}
323333 /// @name String Operations
324334 /// @{
325335
170170 }
171171
172172 void Value::setName(const Twine &NewName) {
173 // Fast path for common IRBuilder case of setName("") when there is no name.
174 if (NewName.isTriviallyEmpty() && !hasName())
175 return;
176
173177 SmallString<256> NameData;
174178 NewName.toVector(NameData);
175179