[llvm] [X86] Do not ignore AlwaysInline when determining if inlining is worth it (PR #87825)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 12:57:19 PDT 2024


https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/87825

AlwaysInline parameter would be ignored if the outlining exceeded the threshold or simply was not aligned enough.

>From e7420bac932640405aed418b8b20a6bc4ae70fd9 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Fri, 5 Apr 2024 15:56:39 -0400
Subject: [PATCH] [X86] Do not ignore AlwaysInline when determining if inlining
 is worth it

AlwaysInline parameter would be ignored if the outlining exceeded the threshold or simply was not aligned enough.
---
 llvm/lib/Target/X86/X86SelectionDAGInfo.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp b/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
index 7c630a2b0da080..d1e7c9046fdc17 100644
--- a/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
+++ b/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
@@ -66,8 +66,10 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
   // If not DWORD aligned or size is more than the threshold, call the library.
   // The libc version is likely to be faster for these cases. It can use the
   // address value and run time information about the CPU.
-  if (Alignment < Align(4) || !ConstantSize ||
-      ConstantSize->getZExtValue() > Subtarget.getMaxInlineSizeThreshold()) 
+  if (!ConstantSize ||
+      (!AlwaysInline &&
+       (Alignment < Align(4) ||
+        ConstantSize->getZExtValue() > Subtarget.getMaxInlineSizeThreshold())))
     return SDValue();
 
   uint64_t SizeVal = ConstantSize->getZExtValue();



More information about the llvm-commits mailing list