[clang] [llvm] [PromoteMemToReg] Insert store undef when removing lifetime markers (PR #191909)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 22:47:59 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 -- clang/lib/CodeGen/CGExpr.cpp llvm/lib/Transforms/Utils/PromoteMemoryToRegister.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/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 637cefeba..088c7aa51 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -554,8 +554,8 @@ static void removeIntrinsicUsers(AllocaInst *AI) {
         if (auto *II = dyn_cast<IntrinsicInst>(Inst))
           if (II->isLifetimeStartOrEnd()) {
             auto *Store = new StoreInst(UndefValue::get(AI->getAllocatedType()),
-                                        AI, /*isVolatile=*/false, AI->getAlign(),
-                                        Inst->getIterator());
+                                        AI, /*isVolatile=*/false,
+                                        AI->getAlign(), Inst->getIterator());
             Store->setDebugLoc(II->getDebugLoc());
           }
 

``````````

</details>


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


More information about the cfe-commits mailing list