[llvm] f78d74f - [llvm] Use llvm::fill (NFC) (#147099)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 4 18:38:40 PDT 2025


Author: Kazu Hirata
Date: 2025-07-04T18:38:37-07:00
New Revision: f78d74f9c86f96cbaecb5cbc3b760eec81567706

URL: https://github.com/llvm/llvm-project/commit/f78d74f9c86f96cbaecb5cbc3b760eec81567706
DIFF: https://github.com/llvm/llvm-project/commit/f78d74f9c86f96cbaecb5cbc3b760eec81567706.diff

LOG: [llvm] Use llvm::fill (NFC) (#147099)

We can pass a range to llvm::fill.

Added: 
    

Modified: 
    llvm/include/llvm/IR/LegacyPassManagers.h
    llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
    llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp

Removed: 
    


################################################################################
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