Skip to content

Commit 94b9da1

Browse files
kazutakahirataIanWood1
authored andcommitted
[llvm] Use llvm::interleaved (NFC) (llvm#137496)
1 parent 1a5d198 commit 94b9da1

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
#include "llvm/Support/Compiler.h"
117117
#include "llvm/Support/Debug.h"
118118
#include "llvm/Support/ErrorHandling.h"
119+
#include "llvm/Support/InterleavedRange.h"
119120
#include "llvm/Support/KnownBits.h"
120121
#include "llvm/Support/SaveAndRestore.h"
121122
#include "llvm/Support/raw_ostream.h"
@@ -349,11 +350,9 @@ void SCEV::print(raw_ostream &OS) const {
349350
default:
350351
llvm_unreachable("There are no other nary expression types.");
351352
}
352-
OS << "(";
353-
ListSeparator LS(OpStr);
354-
for (const SCEV *Op : NAry->operands())
355-
OS << LS << *Op;
356-
OS << ")";
353+
OS << "("
354+
<< llvm::interleaved(llvm::make_pointee_range(NAry->operands()), OpStr)
355+
<< ")";
357356
switch (NAry->getSCEVType()) {
358357
case scAddExpr:
359358
case scMulExpr:

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include "llvm/Support/CommandLine.h"
6464
#include "llvm/Support/ErrorHandling.h"
6565
#include "llvm/Support/GraphWriter.h"
66+
#include "llvm/Support/InterleavedRange.h"
6667
#include "llvm/Support/KnownFPClass.h"
6768
#include "llvm/Support/MathExtras.h"
6869
#include "llvm/Support/TypeSize.h"
@@ -1012,12 +1013,7 @@ namespace {
10121013
#ifndef NDEBUG
10131014
static raw_ostream &operator<<(raw_ostream &OS,
10141015
const AAPointerInfo::OffsetInfo &OI) {
1015-
ListSeparator LS;
1016-
OS << "[";
1017-
for (auto Offset : OI) {
1018-
OS << LS << Offset;
1019-
}
1020-
OS << "]";
1016+
OS << llvm::interleaved_array(OI);
10211017
return OS;
10221018
}
10231019
#endif // NDEBUG

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "llvm/Pass.h"
4040
#include "llvm/Support/CommandLine.h"
4141
#include "llvm/Support/GraphWriter.h"
42+
#include "llvm/Support/InterleavedRange.h"
4243
#include "llvm/Support/raw_ostream.h"
4344
#include "llvm/Transforms/IPO.h"
4445
#include "llvm/Transforms/Utils/CallPromotionUtils.h"
@@ -2955,11 +2956,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::ContextNode::print(
29552956
for (auto &Edge : CallerEdges)
29562957
OS << "\t\t" << *Edge << "\n";
29572958
if (!Clones.empty()) {
2958-
OS << "\tClones: ";
2959-
ListSeparator LS;
2960-
for (auto *Clone : Clones)
2961-
OS << LS << Clone;
2962-
OS << "\n";
2959+
OS << "\tClones: " << llvm::interleaved(Clones) << "\n";
29632960
} else if (CloneOf) {
29642961
OS << "\tClone of " << CloneOf << "\n";
29652962
}

0 commit comments

Comments
 (0)