[llvm] [X86] For minsize, use size for alignment, rather than actual alignment (PR #87003)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 11:27:45 PDT 2024


================
@@ -67,10 +67,27 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
   // 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()) 
+      ConstantSize->getZExtValue() > Subtarget.getMaxInlineSizeThreshold())
     return SDValue();
 
+  // If we have minsize, then don't care about the alignment.
+  // On x86, the CPU doesn't care and neither should you.
+  // As long as the count is aligned, we can use the minimum number of
+  // instructions without always having to resort to strosb.
----------------
topperc wrote:

strosb -> stosb

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


More information about the llvm-commits mailing list