[llvm] InstCombine: fix transformation of bitwiseAnd to fabs (PR #71257)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 5 21:38:38 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 73e974c00aa71fc51c59f4f045cb774ef1424031 f8e2cf05bb82fb7119535c1b0d62bd38f7009dca -- llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 9b88f17aea1c..4059b378c083 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2559,17 +2559,17 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) {
     Value *L, *R;
     Value *Cast;
     if (match(Src, m_And(m_BitCast(m_Value(Cast)), m_MaxSignedValue()))) {
-        Type *EltTy = Cast->getType()->getScalarType();
-        if (EltTy->isFloatingPointTy() && EltTy->isIEEE() &&
-            EltTy->getPrimitiveSizeInBits() ==
-                Src->getType()->getScalarType()->getPrimitiveSizeInBits()) {
-          return CallInst::Create(Intrinsic::getDeclaration(
-                                      CI.getModule(), Intrinsic::fabs, DestTy),
-                                  {Cast});
-        }
+      Type *EltTy = Cast->getType()->getScalarType();
+      if (EltTy->isFloatingPointTy() && EltTy->isIEEE() &&
+          EltTy->getPrimitiveSizeInBits() ==
+              Src->getType()->getScalarType()->getPrimitiveSizeInBits()) {
+        return CallInst::Create(
+            Intrinsic::getDeclaration(CI.getModule(), Intrinsic::fabs, DestTy),
+            {Cast});
       }
     }
   }
+}
 
   if (FixedVectorType *DestVTy = dyn_cast<FixedVectorType>(DestTy)) {
     // Beware: messing with this target-specific oddity may cause trouble.

``````````

</details>


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


More information about the llvm-commits mailing list