[llvm] 140381d - [MachineOutliner][NFC] Remove unnecessary RepeatedSequenceLocs.clear() (#106171)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 07:09:58 PDT 2024


Author: Kyungwoo Lee
Date: 2024-08-28T07:09:54-07:00
New Revision: 140381d4bf25c1fda03028728f135fe9d886ab13

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

LOG: [MachineOutliner][NFC] Remove unnecessary RepeatedSequenceLocs.clear() (#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 being cleared in the
main loop of `findCandidates()`.
- Replaced `2` by `MinRepeats`, which I missed from
https://github.com/llvm/llvm-project/pull/105398

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index e6900190f59dbf..70f69f34a4a7d4 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -9003,7 +9003,7 @@ AArch64InstrInfo::getOutliningCandidateInfo(
         NumBytesNoStackCalls <= RepeatedSequenceLocs.size() * 12) {
       RepeatedSequenceLocs = CandidatesWithoutStackFixups;
       FrameID = MachineOutlinerNoLRSave;
-      if (RepeatedSequenceLocs.size() < 2)
+      if (RepeatedSequenceLocs.size() < MinRepeats)
         return std::nullopt;
     } else {
       SetCandidateCallInfo(MachineOutlinerDefault, 12);
@@ -9064,10 +9064,8 @@ AArch64InstrInfo::getOutliningCandidateInfo(
     }
 
     // If we dropped all of the candidates, bail out here.
-    if (RepeatedSequenceLocs.size() < MinRepeats) {
-      RepeatedSequenceLocs.clear();
+    if (RepeatedSequenceLocs.size() < MinRepeats)
       return std::nullopt;
-    }
   }
 
   // Does every candidate's MBB contain a call? If so, then we might have a call
@@ -9092,10 +9090,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