[PATCH] D98152: [InstCombine] Canonicalize SPF to min/max intrinsics

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 11:19:40 PST 2022


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/minmax-fold.ll:283
+; CHECK-NEXT:    [[TMP2:%.*]] = call i32 @llvm.smin.i32(i32 [[TMP1]], i32 11)
+; CHECK-NEXT:    ret i32 [[TMP2]]
 ;
----------------
RKSimon wrote:
> spatel wrote:
> > spatel wrote:
> > > nikic wrote:
> > > > nikic wrote:
> > > > > Regression
> > > > This looks like a valuable fold.
> > > Agree - I'll work on that one.
> > > There should be some family of patterns like this:
> > > https://alive2.llvm.org/ce/z/8nsAMp
> > On 2nd thought, this is just a reassociation/simplify fold when we have 2 constant operands and matching min/max:
> > https://alive2.llvm.org/ce/z/wW5HVM
> Is a check for constants enough here or do we need full value tracking analysis?
A general check/fold for constants would already be an improvement over the corresponding fold for select patterns, so I'd start with that alone. I'm not seeing any regression test evidence that we need to try harder so far.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98152/new/

https://reviews.llvm.org/D98152



More information about the llvm-commits mailing list