Skip to content

Commit b929669

Browse files
authored
Merge pull request #11941 from dcci/globclean
[GlobalPropertyOpt] Simplify the code a little bit. NFCI.
2 parents 10f3274 + 76f21ea commit b929669

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/SILOptimizer/IPO/GlobalPropertyOpt.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,15 @@ class GlobalPropertyOpt {
6868

6969
#ifndef NDEBUG
7070
friend raw_ostream &operator<<(raw_ostream &os, const Entry &entry) {
71-
if (entry.Field) {
72-
os << "field " << entry.Field->getName() << '\n';
73-
} else if (!entry.Value) {
74-
os << "unknown-address\n";
75-
} else if (auto *Inst = dyn_cast<SILInstruction>(entry.Value)) {
76-
os << Inst->getParent()->getParent()->getName() << ": " << entry.Value;
77-
} else if (auto *Arg = dyn_cast<SILArgument>(entry.Value)) {
78-
os << Arg->getParent()->getParent()->getName() << ": " << entry.Value;
79-
} else {
80-
os << entry.Value;
81-
}
82-
return os;
71+
if (entry.Field)
72+
return os << "field " << entry.Field->getName() << '\n';
73+
if (!entry.Value)
74+
return os << "unknown-address\n";
75+
if (auto *Inst = dyn_cast<SILInstruction>(entry.Value))
76+
os << Inst->getFunction()->getName() << ": " << entry.Value;
77+
if (auto *Arg = dyn_cast<SILArgument>(entry.Value))
78+
return os << Arg->getFunction()->getName() << ": " << entry.Value;
79+
return os << entry.Value;
8380
}
8481
#endif
8582
};

0 commit comments

Comments
 (0)