[llvm] [InstCombine] Add folds for `(fp_binop ({s|u}itofp x), ({s|u}itofp y))` (PR #82555)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 16:19:52 PST 2024


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 9eff001d3dbe84851caa7de4e1093af62c009e06 50df5412c47849b2562ca878d05c3bb9813802b0 -- llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp llvm/lib/Transforms/InstCombine/InstCombineInternal.h llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index e5bbf59151..e2ca971688 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1422,14 +1422,12 @@ Instruction *InstCombinerImpl::foldFBinOpOfIntCasts(BinaryOperator &BO) {
       !match(BO.getOperand(1), m_UIToFP(m_Value(IntOps[1]))))
     return nullptr;
 
-
   Type *FPTy = BO.getType();
   Type *IntTy = IntOps[0]->getType();
 
   // Do we have signed casts?
   bool OpsFromSigned = isa<SIToFPInst>(BO.getOperand(0));
 
-
   unsigned IntSz = IntTy->getScalarSizeInBits();
   // This is the maximum number of inuse bits by the integer where the int -> fp
   // casts are exact.
@@ -1482,7 +1480,6 @@ Instruction *InstCombinerImpl::foldFBinOpOfIntCasts(BinaryOperator &BO) {
     return (OpsFromSigned && BO.getOpcode() == Instruction::FMul)
                ? IsNonZero(OpNo)
                : true;
-
   };
 
   // If we have a constant rhs, see if we can losslessly convert it to an int.
@@ -1505,7 +1502,6 @@ Instruction *InstCombinerImpl::foldFBinOpOfIntCasts(BinaryOperator &BO) {
   if (IntTy != IntOps[1]->getType())
     return nullptr;
 
-
   if (Op1FpC == nullptr) {
     if (OpsFromSigned != isa<SIToFPInst>(BO.getOperand(1))) {
       // If we have a signed + unsigned, see if we can treat both as signed

``````````

</details>


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


More information about the llvm-commits mailing list