[llvm] [DSE] Fold small malloc + zero-store into calloc (PR #106069)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 06:16:06 PDT 2024


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 5afd39d6e4df7e1f4f8c6f7bb6e2cda775beed6a 92ad678c01e2e4900aed0a10fcfd4575440dbba2 --extensions cpp -- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 4d27103076..634be9f0a4 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1885,8 +1885,7 @@ struct DSEState {
     auto shouldCreateCalloc = [](CallInst *Malloc, Instruction *MI) {
       // Check for br(icmp ptr, null), truebb, falsebb) pattern at the end
       // of malloc block
-      auto *MallocBB = Malloc->getParent(),
-        *MemsetBB = MI->getParent();
+      auto *MallocBB = Malloc->getParent(), *MemsetBB = MI->getParent();
       if (MallocBB == MemsetBB)
         return true;
       auto *Ptr = dyn_cast<CallInst>(MI)

``````````

</details>


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


More information about the llvm-commits mailing list