[llvm] [llvm] Remove extraneous calls to make_range (NFC) (PR #133551)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 28 18:34:28 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/133551
None
>From 2358934f69e05003dd3bc60f462522e417e9b875 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 27 Mar 2025 21:03:31 -0700
Subject: [PATCH] [llvm] Remove extraneous calls to make_range (NFC)
---
llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp | 2 +-
llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp | 2 +-
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 3 +--
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 2 +-
4 files changed, 4 insertions(+), 5 deletions(-)
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).
More information about the llvm-commits
mailing list