Skip to content

Commit ff9c865

Browse files
authored
Merge pull request #13298 from anemet/opt-remark-demangle-with-module-names
2 parents b892929 + 004c7d2 commit ff9c865

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

lib/SIL/OptimizationRemark.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,18 @@ Argument::Argument(StringRef Key, unsigned long long N)
4444
: Key(Key), Val(llvm::utostr(N)) {}
4545

4646
Argument::Argument(StringRef Key, SILFunction *F)
47-
: Key(Key),
48-
Val((Twine("\"") +
49-
Demangle::demangleSymbolAsString(
50-
F->getName(),
51-
Demangle::DemangleOptions::SimplifiedUIDemangleOptions()) +
52-
"\"")
53-
.str()) {
54-
if (F->hasLocation())
55-
Loc = F->getLocation().getSourceLoc();
47+
: Key(Key) {
48+
auto DO = Demangle::DemangleOptions::SimplifiedUIDemangleOptions();
49+
// Enable module names so that we have a way of filtering out
50+
// stdlib-related remarks.
51+
DO.DisplayModuleNames = true;
52+
53+
Val = (Twine("\"") + Demangle::demangleSymbolAsString(F->getName(), DO) +
54+
"\"")
55+
.str();
56+
57+
if (F->hasLocation())
58+
Loc = F->getLocation().getSourceLoc();
5659
}
5760

5861
template <typename DerivedT> std::string Remark<DerivedT>::getMsg() const {

test/Driver/opt-record.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public func bar() {
2222
// YAML-NEXT: Column: 3
2323
// YAML-NEXT: Function: 'bar()'
2424
// YAML-NEXT: Args:
25-
// YAML-NEXT: - Callee: '"foo()"'
25+
// YAML-NEXT: - Callee: '"optrecordmod.foo()"'
2626
// YAML-NEXT: DebugLoc:
2727
// YAML-NEXT: File: {{.*}}opt-record.swift
2828
// YAML-NEXT: Line: 11
2929
// YAML-NEXT: Column: 6
3030
// YAML-NEXT: - String: ' inlined into '
31-
// YAML-NEXT: - Caller: '"bar()"'
31+
// YAML-NEXT: - Caller: '"optrecordmod.bar()"'
3232
// YAML-NEXT: DebugLoc:
3333
// YAML-NEXT: File: {{.*}}opt-record.swift
3434
// YAML-NEXT: Line: 15

test/Driver/opt-remark.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ func small() {
3838

3939
func foo() {
4040
// REMARK_MISSED-NOT: remark: {{.*}} inlined
41-
// REMARK_MISSED: opt-remark.swift:43:2: remark: Not profitable to inline function "big()" (cost = {{.*}}, benefit = {{.*}})
41+
// REMARK_MISSED: opt-remark.swift:43:2: remark: Not profitable to inline function "null.big()" (cost = {{.*}}, benefit = {{.*}})
4242
// REMARK_MISSED-NOT: remark: {{.*}} inlined
4343
big()
4444
// REMARK_PASSED-NOT: remark: Not profitable
45-
// REMARK_PASSED: opt-remark.swift:47:3: remark: "small()" inlined into "foo()" (cost = {{.*}}, benefit = {{.*}})
45+
// REMARK_PASSED: opt-remark.swift:47:3: remark: "null.small()" inlined into "null.foo()" (cost = {{.*}}, benefit = {{.*}})
4646
// REMARK_PASSED-NOT: remark: Not profitable
4747
small()
4848
}

0 commit comments

Comments
 (0)