Merge pull request #12797 from anemet/opt-remark-demangle
diff --git a/lib/SIL/OptimizationRemark.cpp b/lib/SIL/OptimizationRemark.cpp
index 87f8b26..6268ee3 100644
--- a/lib/SIL/OptimizationRemark.cpp
+++ b/lib/SIL/OptimizationRemark.cpp
@@ -19,6 +19,7 @@
#include "swift/SIL/OptimizationRemark.h"
#include "swift/AST/DiagnosticEngine.h"
#include "swift/AST/DiagnosticsSIL.h"
+#include "swift/Demangling/Demangler.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
@@ -43,7 +44,13 @@
: Key(Key), Val(llvm::utostr(N)) {}
Argument::Argument(StringRef Key, SILFunction *F)
- : Key(Key), Val(F->getName()) {
+ : Key(Key),
+ Val((Twine("\"") +
+ Demangle::demangleSymbolAsString(
+ F->getName(),
+ Demangle::DemangleOptions::SimplifiedUIDemangleOptions()) +
+ "\"")
+ .str()) {
if (F->hasLocation())
Loc = F->getLocation().getSourceLoc();
}
@@ -110,7 +117,9 @@
if (!io.outputting() || Loc.isValid())
io.mapOptional("DebugLoc", Loc);
- StringRef FN = R.getFunction()->getName();
+ std::string FN = Demangle::demangleSymbolAsString(
+ R.getFunction()->getName(),
+ Demangle::DemangleOptions::SimplifiedUIDemangleOptions());
io.mapRequired("Function", FN);
io.mapOptional("Args", R.getArgs());
}
diff --git a/test/Driver/opt-record.swift b/test/Driver/opt-record.swift
index 823f519..15fcd93 100644
--- a/test/Driver/opt-record.swift
+++ b/test/Driver/opt-record.swift
@@ -20,15 +20,15 @@
// YAML-NEXT: File: {{.*}}opt-record.swift
// YAML-NEXT: Line: 42
// YAML-NEXT: Column: 3
- // YAML-NEXT: Function: _T012optrecordmod3baryyF
+ // YAML-NEXT: Function: 'bar()'
// YAML-NEXT: Args:
- // YAML-NEXT: - Callee: _T012optrecordmod3fooyyF
+ // YAML-NEXT: - Callee: '"foo()"'
// YAML-NEXT: DebugLoc:
// YAML-NEXT: File: {{.*}}opt-record.swift
// YAML-NEXT: Line: 11
// YAML-NEXT: Column: 6
// YAML-NEXT: - String: ' inlined into '
- // YAML-NEXT: - Caller: _T012optrecordmod3baryyF
+ // YAML-NEXT: - Caller: '"bar()"'
// YAML-NEXT: DebugLoc:
// YAML-NEXT: File: {{.*}}opt-record.swift
// YAML-NEXT: Line: 15
diff --git a/test/Driver/opt-remark.swift b/test/Driver/opt-remark.swift
index 0e54d56..433a607 100644
--- a/test/Driver/opt-remark.swift
+++ b/test/Driver/opt-remark.swift
@@ -42,7 +42,7 @@
// REMARK_MISSED-NOT: remark: {{.*}} inlined
big()
// REMARK_PASSED-NOT: remark: Not profitable
- // REMARK_PASSED: opt-remark.swift:47:3: remark: _T04null5smallyyF inlined into _T04null3fooyyF (cost = {{.*}}, benefit = {{.*}})
+ // REMARK_PASSED: opt-remark.swift:47:3: remark: "small()" inlined into "foo()" (cost = {{.*}}, benefit = {{.*}})
// REMARK_PASSED-NOT: remark: Not profitable
small()
}
diff --git a/test/SILOptimizer/inliner_coldblocks.sil b/test/SILOptimizer/inliner_coldblocks.sil
index 18ec8a5..6b378df 100644
--- a/test/SILOptimizer/inliner_coldblocks.sil
+++ b/test/SILOptimizer/inliner_coldblocks.sil
@@ -193,7 +193,7 @@
%c30 = builtin "assert_configuration"() : $Builtin.Int32
%f = function_ref @update_global: $@convention(thin) () -> ()
- // REMARKS_PASSED: inliner_coldblocks.sil:223:3: remark: update_global inlined into regular_large_callee (cost = {{.*}}, benefit = {{.*}})
+ // REMARKS_PASSED: inliner_coldblocks.sil:223:3: remark: "update_global" inlined into "regular_large_callee" (cost = {{.*}}, benefit = {{.*}})
// YAML: --- !Passed
// YAML-NEXT: Pass: sil-inliner
// YAML-NEXT: Name: Inlined
@@ -203,13 +203,13 @@
// YAML-NEXT: Column: 3
// YAML-NEXT: Function: regular_large_callee
// YAML-NEXT: Args:
- // YAML-NEXT: - Callee: update_global
+ // YAML-NEXT: - Callee: '"update_global"'
// YAML-NEXT: DebugLoc:
// YAML-NEXT: File: {{.*}}inliner_coldblocks.sil
// YAML-NEXT: Line: 20
// YAML-NEXT: Column: 6
// YAML-NEXT: - String: ' inlined into '
- // YAML-NEXT: - Caller: regular_large_callee
+ // YAML-NEXT: - Caller: '"regular_large_callee"'
// YAML-NEXT: DebugLoc:
// YAML-NEXT: File: {{.*}}inliner_coldblocks.sil
// YAML-NEXT: Line: 162