[llvm] [SimplfiyLibCalls] Constant fold `remquo` (PR #99647)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 06:18:39 PDT 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 e8fbefe15b101d7d30366cbe2ac068449923f5e2 3ca034696564b5bcc33fd3f7c4e26dd141da5a11 --extensions cpp,h -- llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index f62c53c208..cdb5f17fdb 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -3021,7 +3021,8 @@ void LibCallSimplifier::classifyArgUse(
 /// Constant folds remquo
 Value *LibCallSimplifier::optimizeRemquo(CallInst *CI, IRBuilderBase &B) {
   const APFloat *X, *Y;
-  if (!match(CI->getArgOperand(0), m_APFloat(X)) || !match(CI->getArgOperand(1), m_APFloat(Y)))
+  if (!match(CI->getArgOperand(0), m_APFloat(X)) ||
+      !match(CI->getArgOperand(1), m_APFloat(Y)))
     return nullptr;
 
   if (X->isNaN() || Y->isNaN() || X->isInfinity() || Y->isZero())
@@ -3039,11 +3040,13 @@ Value *LibCallSimplifier::optimizeRemquo(CallInst *CI, IRBuilderBase &B) {
   // TODO: We can only keep at least the three of the last bits of x/y
   APSInt QuotInt(32, /*isUnsigned=*/false);
   bool IsExact;
-  Status = Quot.convertToInteger(QuotInt, APFloat::rmNearestTiesToEven, &IsExact);
+  Status =
+      Quot.convertToInteger(QuotInt, APFloat::rmNearestTiesToEven, &IsExact);
   if (Status != APFloat::opOK || Status != APFloat::opInexact)
     return nullptr;
 
-  B.CreateAlignedStore(ConstantInt::get(B.getInt32Ty(), QuotInt.getExtValue()), CI->getArgOperand(2), CI->getParamAlign(2));
+  B.CreateAlignedStore(ConstantInt::get(B.getInt32Ty(), QuotInt.getExtValue()),
+                       CI->getArgOperand(2), CI->getParamAlign(2));
   return ConstantFP::get(CI->getType(), Rem);
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list