[llvm] [llvm] Use llvm::fill (NFC) (PR #147099)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 4 12:31:06 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/147099
We can pass a range to llvm::fill.
>From cc8d6466d0c3fe59bbdbe11fc87850f27ce646f0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 3 Jul 2025 22:15:25 -0700
Subject: [PATCH] [llvm] Use llvm::fill (NFC)
We can pass a range to llvm::fill.
---
llvm/include/llvm/IR/LegacyPassManagers.h | 3 +--
llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp | 6 ++----
llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp | 3 +--
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/llvm/include/llvm/IR/LegacyPassManagers.h b/llvm/include/llvm/IR/LegacyPassManagers.h
index 1e5b92636d0aa..d25bcafc9cc05 100644
--- a/llvm/include/llvm/IR/LegacyPassManagers.h
+++ b/llvm/include/llvm/IR/LegacyPassManagers.h
@@ -333,8 +333,7 @@ class LLVM_ABI PMDataManager {
/// Initialize available analysis information.
void initializeAnalysisInfo() {
AvailableAnalysis.clear();
- for (auto &IA : InheritedAnalysis)
- IA = nullptr;
+ llvm::fill(InheritedAnalysis, nullptr);
}
// Return true if P preserves high level analysis used by other
diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
index d291be6c64397..8d065bf793f35 100644
--- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
@@ -101,10 +101,8 @@ void CompileUnit::maybeResetToLoadedStage() {
OutUnitDIE = nullptr;
DebugAddrIndexMap.clear();
- for (uint64_t &Offset : OutDieOffsetArray)
- Offset = 0;
- for (TypeEntry *&Name : TypeEntries)
- Name = nullptr;
+ llvm::fill(OutDieOffsetArray, 0);
+ llvm::fill(TypeEntries, nullptr);
eraseSections();
setStage(Stage::CreatedNotLoaded);
diff --git a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
index 740479174c814..bb7814c5226fd 100644
--- a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
@@ -105,8 +105,7 @@ namespace {
};
LatticeCell() : Kind(Top), Size(0), IsSpecial(false) {
- for (const Constant *&Value : Values)
- Value = nullptr;
+ llvm::fill(Values, nullptr);
}
bool meet(const LatticeCell &L);
More information about the llvm-commits
mailing list