Don't generate comments in the DebugLocStream unless required. NFC.
authorPete Cooper <peter_cooper@apple.com>
Wed, 20 May 2015 22:51:27 +0000 (22:51 +0000)
committerPete Cooper <peter_cooper@apple.com>
Wed, 20 May 2015 22:51:27 +0000 (22:51 +0000)
commit05b0f7dc93cfbf49be663b6701841bcae75cb576
tree08d5ca41c41ec997c4972fbdb120e3086d5542a1
parentd4483d45127da85d3456b2b790f6d4d7c73b03f9
Don't generate comments in the DebugLocStream unless required.  NFC.

The ByteStreamer here wasn't taking account of whether the asm streamer was text based and verbose.  Only with that combination should we emit comments.

This change makes sure that we only actually convert a Twine to a string using Twine::str() if we need the comment.  This saves about 10000 small allocations on a test case involving the verify-use_list-order bitcode going through llc with debug info.

Note, this is NFC as the comments would ultimately never be emitted unless required.

Reviewed by Duncan Exon Smith and David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237851 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/ByteStreamer.h
lib/CodeGen/AsmPrinter/DebugLocStream.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp