[llvm] [llvm] Remove extraneous calls to make_range (NFC) (PR #133551)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 18:35:01 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/133551.diff


4 Files Affected:

- (modified) llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (+1-2) 
- (modified) llvm/lib/Transforms/Utils/SimplifyCFG.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp b/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
index 0e908fa407fe8..b507c42228465 100644
--- a/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
@@ -929,7 +929,7 @@ bool LoadStoreOpt::mergeFunctionStores(MachineFunction &MF) {
   // Erase all dead instructions left over by the merging.
   if (Changed) {
     for (auto &BB : MF) {
-      for (auto &I : make_early_inc_range(make_range(BB.rbegin(), BB.rend()))) {
+      for (auto &I : make_early_inc_range(reverse(BB))) {
         if (isTriviallyDead(I, *MRI))
           I.eraseFromParent();
       }
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp b/llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp
index e9aed60595e68..7d07fe147208b 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp
@@ -105,7 +105,7 @@ unsigned getNonFlagSettingVariant(unsigned Opc) {
 
 bool AArch64PostSelectOptimize::doPeepholeOpts(MachineBasicBlock &MBB) {
   bool Changed = false;
-  for (auto &MI : make_early_inc_range(make_range(MBB.begin(), MBB.end()))) {
+  for (auto &MI : make_early_inc_range(MBB)) {
     bool CurrentIterChanged = foldSimpleCrossClassCopies(MI);
     if (!CurrentIterChanged)
       CurrentIterChanged |= foldCopyDup(MI);
diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 38b7984d13606..2f5cf45a1d3d8 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -1377,8 +1377,7 @@ static Instruction *rematerializeChain(ArrayRef<Instruction *> ChainToBase,
   Instruction *LastClonedValue = nullptr;
   Instruction *LastValue = nullptr;
   // Walk backwards to visit top-most instructions first.
-  for (Instruction *Instr :
-       make_range(ChainToBase.rbegin(), ChainToBase.rend())) {
+  for (Instruction *Instr : reverse(ChainToBase)) {
     // Only GEP's and casts are supported as we need to be careful to not
     // introduce any new uses of pointers not in the liveset.
     // Note that it's fine to introduce new uses of pointers which were
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index fd83ec1a7f4fe..998677af3411e 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3391,7 +3391,7 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
   // In "RemoveDIs" non-instr debug-info mode, drop DbgVariableRecords attached
   // to these instructions, in the same way that dbg.value intrinsics are
   // dropped at the end of this block.
-  for (auto &It : make_range(ThenBB->begin(), ThenBB->end()))
+  for (auto &It : *ThenBB)
     for (DbgRecord &DR : make_early_inc_range(It.getDbgRecordRange()))
       // Drop all records except assign-kind DbgVariableRecords (dbg.assign
       // equivalent).

``````````

</details>


https://github.com/llvm/llvm-project/pull/133551


More information about the llvm-commits mailing list