Skip to content

Commit 9958b47

Browse files
committed
SILOptimizer: Simplify the LSBase::print and dump functions.
No need to pass the Module and TypeExpansionContext to those functions. NFC
1 parent 7859ff8 commit 9958b47

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

include/swift/SILOptimizer/Utils/LoadStoreOptUtils.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,16 @@ class LSBase {
169169
}
170170

171171
/// Print the LSBase.
172-
virtual void print(llvm::raw_ostream &os, SILModule *Mod,
173-
TypeExpansionContext context) {
172+
virtual void print(llvm::raw_ostream &os) {
174173
os << Base;
175-
Path.getValue().print(os, *Mod, context);
174+
SILFunction *F = Base->getFunction();
175+
if (F) {
176+
Path.getValue().print(os, F->getModule(), TypeExpansionContext(*F));
177+
}
176178
}
177179

178-
virtual void dump(SILModule *Mod, TypeExpansionContext context) {
179-
print(llvm::dbgs(), Mod, context);
180+
virtual void dump() {
181+
print(llvm::dbgs());
180182
}
181183
};
182184

@@ -260,13 +262,12 @@ class LSValue : public LSBase {
260262
return Path.getValue().createExtract(Base, Inst, true);
261263
}
262264

263-
void print(llvm::raw_ostream &os, SILModule *Mod,
264-
TypeExpansionContext context) {
265+
void print(llvm::raw_ostream &os) {
265266
if (CoveringValue) {
266267
os << "Covering Value";
267268
return;
268269
}
269-
LSBase::print(os, Mod, context);
270+
LSBase::print(os);
270271
}
271272

272273
/// Expand this SILValue to all individual fields it contains.

lib/SILOptimizer/Transforms/RedundantLoadElimination.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,8 +1585,7 @@ bool RLEContext::run() {
15851585

15861586
LLVM_DEBUG(for (unsigned i = 0; i < LocationVault.size(); ++i) {
15871587
llvm::dbgs() << "LSLocation #" << i;
1588-
getLocation(i).print(llvm::dbgs(), &Fn->getModule(),
1589-
TypeExpansionContext(*Fn));
1588+
getLocation(i).print(llvm::dbgs());
15901589
});
15911590

15921591
if (Optimistic)

lib/SILOptimizer/UtilityPasses/LSLocationPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class LSLocationPrinter : public SILModuleTransform {
171171

172172
llvm::outs() << "#" << Counter++ << II;
173173
for (auto &Loc : Locs) {
174-
Loc.print(llvm::outs(), &Fn.getModule(), TypeExpansionContext(Fn));
174+
Loc.print(llvm::outs());
175175
}
176176
Locs.clear();
177177
}
@@ -227,7 +227,7 @@ class LSLocationPrinter : public SILModuleTransform {
227227
LSLocation::reduce(L, &Fn.getModule(), TypeExpansionContext(Fn), SLocs);
228228
llvm::outs() << "#" << Counter++ << II;
229229
for (auto &Loc : SLocs) {
230-
Loc.print(llvm::outs(), &Fn.getModule(), TypeExpansionContext(Fn));
230+
Loc.print(llvm::outs());
231231
}
232232
L.reset();
233233
Locs.clear();

0 commit comments

Comments
 (0)