[llvm] Missing opt with ctlz and shifts of power of 2 constants (#41333) (PR #74175)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 12:05:09 PST 2023


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 097d2f14173a3bfc1cd44f543f63154fed79e962 4fbad80c950090cfd2715d64fd9e505b0c6c8436 -- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 56b51d2487..255ce6973a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -553,7 +553,8 @@ static Instruction *foldCttzCtlz(IntrinsicInst &II, InstCombinerImpl &IC) {
       return IC.replaceOperand(II, 0, X);
 
     // cttz(shl(%const, %val), 1) --> add(cttz(%const, 1), %val)
-    if (match(Op0, m_Shl(m_ImmConstant(C), m_Value(X))) && match(Op1, m_One())) {
+    if (match(Op0, m_Shl(m_ImmConstant(C), m_Value(X))) &&
+        match(Op1, m_One())) {
       Value *ConstCttz =
           IC.Builder.CreateBinaryIntrinsic(Intrinsic::cttz, C, Op1);
       return BinaryOperator::CreateAdd(ConstCttz, X);
@@ -568,7 +569,8 @@ static Instruction *foldCttzCtlz(IntrinsicInst &II, InstCombinerImpl &IC) {
     }
   } else {
     // ctlz(lshr(%const, %val), 1) --> add(ctlz(%const, 1), %val)
-    if (match(Op0, m_LShr(m_ImmConstant(C), m_Value(X))) && match(Op1, m_One())) {
+    if (match(Op0, m_LShr(m_ImmConstant(C), m_Value(X))) &&
+        match(Op1, m_One())) {
       Value *ConstCtlz =
           IC.Builder.CreateBinaryIntrinsic(Intrinsic::ctlz, C, Op1);
       return BinaryOperator::CreateAdd(ConstCtlz, X);

``````````

</details>


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


More information about the llvm-commits mailing list