[llvm] [X86] For inline memset and memcpy with minsize, use size for alignment, rather than actual alignment (PR #87003)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 10:04:53 PDT 2024


================
@@ -62,18 +62,31 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
   const X86Subtarget &Subtarget =
       DAG.getMachineFunction().getSubtarget<X86Subtarget>();
 
+  // 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 stosb.
+  //
+  // Because this is a feature specific to x86, we must handle it here.
----------------
AtariDreams wrote:

are these instructions different sizes when encoded? if not, then I don't see why not promote rep stosb

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


More information about the llvm-commits mailing list