[llvm] Reland "[LICM] Sink unused l-invariant loads in preheader #157559" (PR #170204)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 09:53:45 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 -- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/lib/Transforms/Scalar/LICM.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/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index b513aeda5..3b7c09c5a 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1573,9 +1573,9 @@ static void moveInstructionBefore(Instruction &I, BasicBlock::iterator Dest,
 
 // An in-loop user keeps I live in the loop. An unsunk preheader user would no
 // longer be dominated by I after it is sunk.
-static bool hasBlockingUser(
-    Instruction &I, Loop &L, BasicBlock &Preheader,
-    const SmallPtrSetImpl<Instruction *> &SinkCandidates) {
+static bool
+hasBlockingUser(Instruction &I, Loop &L, BasicBlock &Preheader,
+                const SmallPtrSetImpl<Instruction *> &SinkCandidates) {
   return llvm::any_of(I.uses(), [&](const Use &U) {
     auto *UserI = cast<Instruction>(U.getUser());
     auto *PN = dyn_cast<PHINode>(UserI);

``````````

</details>


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


More information about the llvm-commits mailing list