[PATCH] D146637: [InstCombine] Try to recognize bswap pattern when calling funnel shifts

Jun Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 01:57:11 PDT 2023

junaire added inline comments.

Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1795
         return CallInst::Create(Bswap, { Op0 });
nikic wrote:
> nikic wrote:
> > This code block can probably be dropped now, if it's already handled by the preceding?
> Or you can move your code after the existing one, which will avoid the regression in fshl_mask_args_same2. It shouldn't be necessary to handle this specially, but clearly we're missing a zext(shl(trunc)) fold.
No that doesn't work since the existing transform is highly depend on the bit-width (only valid if it's 16 but in the test that's i32)

Or maybe we can leave it as is and add a zext(shl(trunc)) fold in the future?

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list