[llvm] [MachineOutlineer][NFC] Remove unnecessary RepeatedSequenceLocs.clear() (PR #106171)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 19:09:54 PDT 2024


https://github.com/kyulee-com created https://github.com/llvm/llvm-project/pull/106171

When `getOutliningCandidateInfo()` returns `std::nullopt` (meaning no `OutlinedFunction` is created), there is no need to clear the input argument, `RepeatedSequenceLocs`, as it's already beaing cleared in the main loop of `findCandidates()`.

>From d7c9e325ea49e093add92b1478bd4617f6121f49 Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
Date: Mon, 26 Aug 2024 19:03:56 -0700
Subject: [PATCH] [MachineOutlineer][NFC] Remove unnecessary
 RepeatedSequenceLocs.clear()

When `getOutliningCandidateInfo()` returns `std::nullopt` (meaning
no `OutlinedFunction` is created), there is no need to clear the input
argument, `RepeatedSequenceLocs`, as it's already beaing cleared in the
main loop of `findCandidates()`.
---
 llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 2d41aff605a54e..cf889d757270f9 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -9048,10 +9048,8 @@ AArch64InstrInfo::getOutliningCandidateInfo(
     }
 
     // If we dropped all of the candidates, bail out here.
-    if (RepeatedSequenceLocs.size() < 2) {
-      RepeatedSequenceLocs.clear();
+    if (RepeatedSequenceLocs.size() < 2)
       return std::nullopt;
-    }
   }
 
   // Does every candidate's MBB contain a call? If so, then we might have a call
@@ -9076,10 +9074,8 @@ AArch64InstrInfo::getOutliningCandidateInfo(
 
     if (ModStackToSaveLR) {
       // We can't fix up the stack. Bail out.
-      if (!AllStackInstrsSafe) {
-        RepeatedSequenceLocs.clear();
+      if (!AllStackInstrsSafe)
         return std::nullopt;
-      }
 
       // Save + restore LR.
       NumBytesToCreateFrame += 8;



More information about the llvm-commits mailing list