[llvm] Use sizeWithoutDebugLargerThan when considering outlining (PR #85539)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 16 09:49:20 PDT 2024


https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/85539

>From d686d328301e70207c4945653af5b58d7a885558 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Sat, 16 Mar 2024 12:00:40 -0400
Subject: [PATCH] Use sizeWithoutDebugLargerThan when considering outlining

---
 llvm/lib/CodeGen/MachineOutliner.cpp                        | 2 +-
 llvm/test/CodeGen/AArch64/machine-outliner-mapper-stats.mir | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index dc2f5ef15206e8..22352776fab0ec 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1032,7 +1032,7 @@ void MachineOutliner::populateMapper(InstructionMapper &Mapper, Module &M,
       // contain something worth outlining.
       // FIXME: This should be based off of the maximum size in B of an outlined
       // call versus the size in B of the MBB.
-      if (MBB.size() < MinMBBSize) {
+      if (!MBB.sizeWithoutDebugLargerThan(MinMBBSize - 1)) {
         LLVM_DEBUG(dbgs() << "    SKIP: MBB size less than minimum size of "
                           << MinMBBSize << "\n");
         continue;
diff --git a/llvm/test/CodeGen/AArch64/machine-outliner-mapper-stats.mir b/llvm/test/CodeGen/AArch64/machine-outliner-mapper-stats.mir
index 4cb8e8c10c2414..1ec52565dd461d 100644
--- a/llvm/test/CodeGen/AArch64/machine-outliner-mapper-stats.mir
+++ b/llvm/test/CodeGen/AArch64/machine-outliner-mapper-stats.mir
@@ -2,8 +2,7 @@
 # REQUIRES: asserts
 
 # CHECK: 2 machine-outliner - Unoutlinable instructions mapped + number of sentinel values
-# CHECK: 2 machine-outliner - Invisible instructions skipped during mapping
-# CHECK: 4 machine-outliner - Outlinable instructions mapped
+# CHECK: 3 machine-outliner - Outlinable instructions mapped
 # CHECK: 1 machine-outliner - Sentinel values inserted during mapping
 # CHECK: 5 machine-outliner - Total number of instructions mapped and saved to mapping vector
 



More information about the llvm-commits mailing list