Skip to content

Commit ecbc4d7

Browse files
committed
resolve comment
1 parent da8bb69 commit ecbc4d7

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -382,18 +382,10 @@ typedef DenseMap<BasicBlock *, CloneList> DuplicateBlockMap;
382382
// information is needed when restoring SSA form after cloning blocks.
383383
typedef MapVector<Instruction *, std::vector<Instruction *>> DefMap;
384384

385-
static inline std::string getBlockName(const BasicBlock *BB) {
386-
std::string BBName;
387-
raw_string_ostream Stream(BBName);
388-
if (BB->hasName())
389-
Stream << BB->getName();
390-
else
391-
BB->printAsOperand(Stream, false);
392-
return BBName;
393-
}
394-
395385
inline raw_ostream &operator<<(raw_ostream &OS, const PathType &Path) {
396-
OS << "< " << llvm::join(llvm::map_range(Path, getBlockName), ", ") << " >";
386+
auto BBNames = llvm::map_range(
387+
Path, [](const BasicBlock *BB) { return BB->getNameOrAsOperand(); });
388+
OS << "< " << llvm::join(BBNames, ", ") << " >";
397389
return OS;
398390
}
399391

@@ -425,7 +417,7 @@ struct ThreadingPath {
425417
}
426418

427419
void print(raw_ostream &OS) const {
428-
OS << Path << " [ " << ExitVal << ", " << getBlockName(DBB) << " ]";
420+
OS << Path << " [ " << ExitVal << ", " << DBB->getNameOrAsOperand() << " ]";
429421
}
430422

431423
private:

0 commit comments

Comments
 (0)