[llvm] [CodeGen] Construct SmallVector with iterator ranges (NFC) (PR #105622)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 23:47:09 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/105622
None
>From 1f742faedb392084c53c9ba20e9a3ac8a41afe61 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 21 Aug 2024 23:38:32 -0700
Subject: [PATCH] [CodeGen] Construct SmallVector with iterator ranges (NFC)
---
llvm/lib/CodeGen/MachineSink.cpp | 3 +--
llvm/lib/CodeGen/ShrinkWrap.cpp | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index f10b98cebd133f..fe515ef5be541f 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -766,8 +766,7 @@ bool MachineSinking::runOnMachineFunction(MachineFunction &MF) {
}
if (SinkInstsIntoCycle) {
- SmallVector<MachineCycle *, 8> Cycles(CI->toplevel_begin(),
- CI->toplevel_end());
+ SmallVector<MachineCycle *, 8> Cycles(CI->toplevel_cycles());
for (auto *Cycle : Cycles) {
MachineBasicBlock *Preheader = Cycle->getCyclePreheader();
if (!Preheader) {
diff --git a/llvm/lib/CodeGen/ShrinkWrap.cpp b/llvm/lib/CodeGen/ShrinkWrap.cpp
index b9f376a5af794d..600127f17110db 100644
--- a/llvm/lib/CodeGen/ShrinkWrap.cpp
+++ b/llvm/lib/CodeGen/ShrinkWrap.cpp
@@ -411,8 +411,7 @@ hasDirtyPred(const DenseSet<const MachineBasicBlock *> &ReachableByDirty,
/// Derives the list of all the basic blocks reachable from MBB.
static void markAllReachable(DenseSet<const MachineBasicBlock *> &Visited,
const MachineBasicBlock &MBB) {
- SmallVector<MachineBasicBlock *, 4> Worklist(MBB.succ_begin(),
- MBB.succ_end());
+ SmallVector<MachineBasicBlock *, 4> Worklist(MBB.successors());
Visited.insert(&MBB);
while (!Worklist.empty()) {
MachineBasicBlock *SuccMBB = Worklist.pop_back_val();
More information about the llvm-commits
mailing list