[llvm] [memcpyopt] forward stores into byval through memcpy to dest (PR #196256)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 01:05:30 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 367892d98..612c918bc 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -1850,8 +1850,7 @@ bool MemCpyOptPass::performByValSrcMoveOptzn(MemCpyInst *M,
           return false;
         if (SI->getParent() != M->getParent() || !SI->comesBefore(M))
           return false;
-        TypeSize SSize =
-            DL.getTypeStoreSize(SI->getValueOperand()->getType());
+        TypeSize SSize = DL.getTypeStoreSize(SI->getValueOperand()->getType());
         if (SSize.isScalable())
           return false;
         uint64_t Sz = SSize.getFixedValue();
@@ -1900,7 +1899,6 @@ bool MemCpyOptPass::performByValSrcMoveOptzn(MemCpyInst *M,
                       MSSA->getMemoryAccess(M)))
     return false;
 
-
   Arg->replaceAllUsesWith(DestPtr);
 
   LLVM_DEBUG(dbgs() << "MemCpyOpt: Forwarded stores into byval through"

``````````

</details>


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


More information about the llvm-commits mailing list