[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:54 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: AtariDreams (AtariDreams)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/87825.diff


1 Files Affected:

- (modified) llvm/lib/Target/X86/X86SelectionDAGInfo.cpp (+4-2) 


``````````diff
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();

``````````

</details>


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


More information about the llvm-commits mailing list