[llvm] [AggressiveInstCombine] POPCNT generation for bit-count pattern (PR #177109)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 02:50:13 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/AggressiveInstCombine/AggressiveInstCombine.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/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
index 761845abe..21906f238 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -411,7 +411,7 @@ static bool tryToRecognizePopCount(Instruction &I) {
 // }
 static bool tryToRecognizePopCount1(Instruction &I) {
   if (I.getOpcode() != Instruction::Add)
-     return false;
+    return false;
 
   Type *Ty = I.getType();
   if (!Ty->isIntOrIntVectorTy())
@@ -427,7 +427,7 @@ static bool tryToRecognizePopCount1(Instruction &I) {
 
   APInt Mask55 = APInt::getSplat(Len, APInt(8, 0x55));
   APInt Mask33 = APInt::getSplat(Len, APInt(8, 0x33));
-  
+
   Value *ShiftOp;
   Value *Start = &I;
   for (unsigned I = Len; I >= 8; I = I / 2) {

``````````

</details>


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


More information about the llvm-commits mailing list