From cc8d6466d0c3fe59bbdbe11fc87850f27ce646f0 Mon Sep 17 00:00:00 2001 From: Kazu Hirata 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);