[llvm] [InstCombine] smin(smax(X, -1), 1) -> scmp(X, 0) and smax(smin(X, 1), -1) -> scmp(X, 0) (PR #145736)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 07:10:16 PDT 2025


AZero13 wrote:

> > ⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️
> > You can test this locally with the following command:
> > ```shell
> > git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > View the diff from clang-format here.
> > ```diff
> > diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
> > index c836ad7ae..1920ee9e4 100644
> > --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
> > +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
> > @@ -1978,8 +1978,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
> >      // And i1's have been changed to and/ors
> >      // So we only need to check for smin
> >      if (IID == Intrinsic::smin) {
> > -      if (match(I0, m_OneUse(m_SMax(m_Value(X),
> > -                                                          m_AllOnes()))) &&
> > +      if (match(I0, m_OneUse(m_SMax(m_Value(X), m_AllOnes()))) &&
> >            match(I1, m_One())) {
> >          Value *Zero = ConstantInt::get(X->getType(), 0);
> >          return replaceInstUsesWith(
> > ```
> 
> Please fix the format.

Fixed!

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


More information about the llvm-commits mailing list