[llvm] [InstCombine] Simplify (A >= 0) & ((A & INT_MAX) != 0) to A > 0 (PR #207209)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 10:13:19 PDT 2026
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/Transforms/InstCombine/InstCombineAndOrXor.cpp --diff_from_common_commit
``````````
: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/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index ba7bb64df..26b4b9b9a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -3552,11 +3552,11 @@ Value *InstCombinerImpl::foldAndOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
match(RHS0, m_And(m_Specific(LHS0), m_APInt(MaskC))) &&
IsValidMask(LHS0, *MaskC)) {
if (IsAnd && !TrueIfSigned)
- return Builder.CreateICmpSGT(LHS0,
- ConstantInt::getNullValue(LHS0->getType()));
+ return Builder.CreateICmpSGT(
+ LHS0, ConstantInt::getNullValue(LHS0->getType()));
if (!IsAnd && TrueIfSigned)
- return Builder.CreateICmpSLE(LHS0,
- ConstantInt::getNullValue(LHS0->getType()));
+ return Builder.CreateICmpSLE(
+ LHS0, ConstantInt::getNullValue(LHS0->getType()));
}
if (isSignBitCheck(PredR, *RHSC, TrueIfSigned) &&
PredL == (IsAnd ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ) &&
@@ -3564,11 +3564,11 @@ Value *InstCombinerImpl::foldAndOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
match(LHS0, m_And(m_Specific(RHS0), m_APInt(MaskC))) &&
IsValidMask(RHS0, *MaskC)) {
if (IsAnd && !TrueIfSigned)
- return Builder.CreateICmpSGT(RHS0,
- ConstantInt::getNullValue(RHS0->getType()));
+ return Builder.CreateICmpSGT(
+ RHS0, ConstantInt::getNullValue(RHS0->getType()));
if (!IsAnd && TrueIfSigned)
- return Builder.CreateICmpSLE(RHS0,
- ConstantInt::getNullValue(RHS0->getType()));
+ return Builder.CreateICmpSLE(
+ RHS0, ConstantInt::getNullValue(RHS0->getType()));
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/207209
More information about the llvm-commits
mailing list