[llvm] r283656 - [OptRemarks] Remove non-printable chars from function name

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 21:47:20 PDT 2016


Author: anemet
Date: Fri Oct  7 23:47:20 2016
New Revision: 283656

URL: http://llvm.org/viewvc/llvm-project?rev=283656&view=rev
Log:
[OptRemarks] Remove non-printable chars from function name

Value names may be prefixed with a binary '1' to indicate that the
backend should not modify the symbols due to any platform naming
convention.

This should not show up in the YAML opt record file because it breaks
the YAML parser.

Modified:
    llvm/trunk/include/llvm/IR/DiagnosticInfo.h
    llvm/trunk/lib/IR/DiagnosticInfo.cpp
    llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll

Modified: llvm/trunk/include/llvm/IR/DiagnosticInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DiagnosticInfo.h?rev=283656&r1=283655&r2=283656&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DiagnosticInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DiagnosticInfo.h Fri Oct  7 23:47:20 2016
@@ -387,7 +387,7 @@ public:
     std::string Val;
 
     explicit Argument(StringRef Str = "") : Key("String"), Val(Str) {}
-    Argument(StringRef Key, Value *V) : Key(Key), Val(V->getName()) {}
+    Argument(StringRef Key, Value *V);
     Argument(StringRef Key, int N);
     Argument(StringRef Key, unsigned N);
     Argument(StringRef Key, bool B) : Key(Key), Val(B ? "true" : "false") {}

Modified: llvm/trunk/lib/IR/DiagnosticInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DiagnosticInfo.cpp?rev=283656&r1=283655&r2=283656&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DiagnosticInfo.cpp (original)
+++ llvm/trunk/lib/IR/DiagnosticInfo.cpp Fri Oct  7 23:47:20 2016
@@ -170,6 +170,8 @@ const std::string DiagnosticInfoWithDebu
     getLocation(&Filename, &Line, &Column);
   return (Filename + ":" + Twine(Line) + ":" + Twine(Column)).str();
 }
+DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, Value *V)
+    : Key(Key), Val(GlobalValue::getRealLinkageName(V->getName())) {}
 
 DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, int N)
     : Key(Key), Val(itostr(N)) {}

Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll?rev=283656&r1=283655&r2=283656&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll Fri Oct  7 23:47:20 2016
@@ -50,14 +50,14 @@ target triple = "x86_64-apple-macosx10.1
 define i32 @baz() !dbg !7 !prof !14 {
 entry:
   %call = call i32 (...) @foo(), !dbg !9
-  %call1 = call i32 (...) @bar(), !dbg !10
+  %call1 = call i32 (...) @"\01bar"(), !dbg !10
   %add = add nsw i32 %call, %call1, !dbg !12
   ret i32 %add, !dbg !13
 }
 
 declare i32 @foo(...)
 
-declare i32 @bar(...)
+declare i32 @"\01bar"(...)
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3, !4, !5}




More information about the llvm-commits mailing list