[PATCH] D151807: [InstCombine] Revisit user of newly one-use instructions

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 11:03:14 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/or-shifted-masks.ll:80
 define i32 @multiuse2(i32 %x) {
 ; CHECK-LABEL: @multiuse2(
 ; CHECK-NEXT:    [[I:%.*]] = shl i32 [[X:%.*]], 1
----------------
nikic wrote:
> RKSimon wrote:
> > goldstein.w.n wrote:
> > > This one seems to keep the worse codegen (full -O3 pipeline):
> > > Before:
> > > ```
> > > define i32 @multiuse2(i32 %x) {
> > >   %i = shl i32 %x, 1
> > >   %i6 = shl i32 %x, 8
> > >   %i10 = and i32 %i6, 32256
> > >   %i12 = and i32 %i, 252
> > >   %i13 = or i32 %i10, %i12
> > >   ret i32 %i13
> > > }
> > > ```
> > > After:
> > > ```
> > > define i32 @multiuse2(i32 %x) {
> > >   %i = shl i32 %x, 1
> > >   %i6 = and i32 %x, 96
> > >   %i7 = shl nuw nsw i32 %i6, 8
> > >   %i8 = shl nuw nsw i32 %i6, 1
> > >   %i14 = shl i32 %x, 8
> > >   %i9 = and i32 %i14, 7680
> > >   %i10 = or i32 %i7, %i9
> > >   %1 = and i32 %i, 60
> > >   %i12 = or i32 %i8, %1
> > >   %i13 = or i32 %i10, %i12
> > >   ret i32 %i13
> > > }
> > > ```
> > > Its not a dealbreaker imo, but maybe leave a TODO on the fold the implements it indicating the combine is missing a case.
> > @nikic Are you intending to look at this regression in a followup?
> We're missing this fold: https://alive2.llvm.org/ce/z/ZXvVh-
See: D152568 to fix that.


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

https://reviews.llvm.org/D151807



More information about the llvm-commits mailing list