[llvm] 2e230f5 - [llvm] Use llvm::interleaved (NFC) (#137496)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 26 23:28:51 PDT 2025
Author: Kazu Hirata
Date: 2025-04-26T23:28:46-07:00
New Revision: 2e230f5685391bd07bd2ef41dfdc832df86d4181
URL: https://github.com/llvm/llvm-project/commit/2e230f5685391bd07bd2ef41dfdc832df86d4181
DIFF: https://github.com/llvm/llvm-project/commit/2e230f5685391bd07bd2ef41dfdc832df86d4181.diff
LOG: [llvm] Use llvm::interleaved (NFC) (#137496)
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 471c71f75eb23..6055c3d791cb2 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -116,6 +116,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/InterleavedRange.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/raw_ostream.h"
@@ -349,11 +350,9 @@ void SCEV::print(raw_ostream &OS) const {
default:
llvm_unreachable("There are no other nary expression types.");
}
- OS << "(";
- ListSeparator LS(OpStr);
- for (const SCEV *Op : NAry->operands())
- OS << LS << *Op;
- OS << ")";
+ OS << "("
+ << llvm::interleaved(llvm::make_pointee_range(NAry->operands()), OpStr)
+ << ")";
switch (NAry->getSCEVType()) {
case scAddExpr:
case scMulExpr:
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 1032dede7cb36..a72c1d329e199 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -63,6 +63,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GraphWriter.h"
+#include "llvm/Support/InterleavedRange.h"
#include "llvm/Support/KnownFPClass.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TypeSize.h"
@@ -1012,12 +1013,7 @@ namespace {
#ifndef NDEBUG
static raw_ostream &operator<<(raw_ostream &OS,
const AAPointerInfo::OffsetInfo &OI) {
- ListSeparator LS;
- OS << "[";
- for (auto Offset : OI) {
- OS << LS << Offset;
- }
- OS << "]";
+ OS << llvm::interleaved_array(OI);
return OS;
}
#endif // NDEBUG
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index 207e86b22db1d..0d299b8402cdf 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -39,6 +39,7 @@
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/GraphWriter.h"
+#include "llvm/Support/InterleavedRange.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/CallPromotionUtils.h"
@@ -2955,11 +2956,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::ContextNode::print(
for (auto &Edge : CallerEdges)
OS << "\t\t" << *Edge << "\n";
if (!Clones.empty()) {
- OS << "\tClones: ";
- ListSeparator LS;
- for (auto *Clone : Clones)
- OS << LS << Clone;
- OS << "\n";
+ OS << "\tClones: " << llvm::interleaved(Clones) << "\n";
} else if (CloneOf) {
OS << "\tClone of " << CloneOf << "\n";
}
More information about the llvm-commits
mailing list