Avoid creating expensive comment string if it's not going to be printed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52992 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index 1320663..35c3671 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -21,7 +21,6 @@
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
-#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Streams.h"
@@ -29,14 +28,12 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include <cerrno>
 using namespace llvm;
 
-static cl::opt<bool>
-AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives."));
-
 char AsmPrinter::ID = 0;
 AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm,
                        const TargetAsmInfo *T)
@@ -553,7 +550,7 @@
 }
 
 void AsmPrinter::EOL(const std::string &Comment) const {
-  if (AsmVerbose && !Comment.empty()) {
+  if (VerboseAsm && !Comment.empty()) {
     O << '\t'
       << TAI->getCommentString()
       << ' '
@@ -563,7 +560,7 @@
 }
 
 void AsmPrinter::EOL(const char* Comment) const {
-  if (AsmVerbose && *Comment) {
+  if (VerboseAsm && *Comment) {
     O << '\t'
       << TAI->getCommentString()
       << ' '