Skip to content

Commit c970cae

Browse files
committed
SIL: Optimization remarks can take SILType by value
No need to pass a pointer to SILType; it is a pointer-sized value itself.
1 parent 2ce6867 commit c970cae

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

include/swift/SIL/OptimizationRemark.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct Argument {
5050
Argument(StringRef Key, unsigned long long N);
5151

5252
Argument(StringRef Key, SILFunction *F);
53-
Argument(StringRef Key, SILType *Ty);
53+
Argument(StringRef Key, SILType Ty);
54+
Argument(StringRef Key, CanType Ty);
5455
};
5556

5657
/// Shorthand to insert named-value pairs.

lib/SIL/OptimizationRemark.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ Argument::Argument(StringRef Key, SILFunction *F)
5858
Loc = F->getLocation().getSourceLoc();
5959
}
6060

61-
Argument::Argument(StringRef Key, SILType *Ty) : Key(Key) {
61+
Argument::Argument(StringRef Key, SILType Ty) : Key(Key) {
6262
llvm::raw_string_ostream OS(Val);
63-
Ty->print(OS);
63+
Ty.print(OS);
64+
}
65+
66+
Argument::Argument(StringRef Key, CanType Ty) : Key(Key) {
67+
llvm::raw_string_ostream OS(Val);
68+
Ty.print(OS);
6469
}
6570

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

lib/SILOptimizer/Transforms/SpeculativeDevirtualizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ static bool tryToSpeculateTarget(FullApplySite AI, ClassHierarchyAnalysis *CHA,
535535
RemarkPassed R("PartialSpecDevirt", *AI.getInstruction());
536536
R << "Partially devirtualized call with run-time checks for "
537537
<< NV("NumSubTypesChecked", Subs.size()) << " subclasses of "
538-
<< NV("ClassType", &ClassType);
538+
<< NV("ClassType", ClassType);
539539
if (NotHandledSubsNum)
540540
R << ", number of subclasses not devirtualized: "
541541
<< NV("NotHandledSubsNum", NotHandledSubsNum);
@@ -549,7 +549,7 @@ static bool tryToSpeculateTarget(FullApplySite AI, ClassHierarchyAnalysis *CHA,
549549
auto RB = [&]() {
550550
return RemarkPassed("SpecDevirt", *AI.getInstruction())
551551
<< "Devirtualized call with run-time checks for the derived classes "
552-
"of " << NV("ClassType", &ClassType);
552+
"of " << NV("ClassType", ClassType);
553553
};
554554

555555
// At this point it is known that there is only one remaining method

0 commit comments

Comments
 (0)