[llvm] [GlobalISel] Allow Legalizer to lower volatile memcpy family. (PR #145997)

Pete Chou via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 21:58:07 PDT 2025


================
@@ -10099,8 +10100,8 @@ LegalizerHelper::lowerMemCpyFamily(MachineInstr &MI, unsigned MaxLen) {
   }
 
   bool IsVolatile = MemOp->isVolatile();
-  // Don't try to optimize volatile.
-  if (IsVolatile)
+  // Don't try to optimize volatile when not allowed.
+  if (SkipVolatile && IsVolatile)
----------------
petechou wrote:

BTW, in 36527cb the `MaxLen` argument of the added LegalizerHelper lowerMemCpyFamily function could be a defualt argument.

`  LegalizeResult lowerMemCpyFamily(MachineInstr &MI, unsigned MaxLen = 0);`

It's probably for the same reason to support both legalizer and combiner users, I guess.

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


More information about the llvm-commits mailing list