[llvm] [InstCombine] Optimize and of overflow checks (PR #141962)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 05:32:52 PDT 2025


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/Analysis/InstructionSimplify.cpp
``````````

: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/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 30ed2c14c..3ace9b4a0 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -2178,10 +2178,8 @@ static Value *simplifyAndInst(Value *Op0, Value *Op1, const SimplifyQuery &Q,
 
   // (X <= ~Y) && (Y > ~X) --> 0
   CmpPredicate Pred0, Pred1;
-  if (match(Op0,
-            m_c_ICmp(Pred0, m_Value(X), m_Not(m_Value(Y)))) &&
-      match(Op1, m_c_ICmp(Pred1, m_Specific(Y),
-                          m_Not(m_Specific(X))))) {
+  if (match(Op0, m_c_ICmp(Pred0, m_Value(X), m_Not(m_Value(Y)))) &&
+      match(Op1, m_c_ICmp(Pred1, m_Specific(Y), m_Not(m_Specific(X))))) {
     if (ICmpInst::isSigned(Pred0) == ICmpInst::isSigned(Pred1)) {
       if (ICmpInst::isLE(Pred0) && ICmpInst::isGT(Pred1))
         return ConstantInt::getFalse(Op0->getType());

``````````

</details>


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


More information about the llvm-commits mailing list