[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:23:49 PDT 2023


junaire added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/fsh.ll:677
+; CHECK-NEXT:    [[REV:%.*]] = shl i16 [[TRUNC]], 8
+; CHECK-NEXT:    [[T2:%.*]] = zext i16 [[REV]] to i32
 ; CHECK-NEXT:    ret i32 [[T2]]
----------------
Looks like this transform somehow breaks the existing optimization? Any thoughts about how to fix it? My idea is to add another default parameter called `bool ForceTrunc = true` and ask `matchBSwapOrBitReverse` not to truncate in this case. However, I don't know if this is appropriate and please let me know if you have better solutions...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146637



More information about the llvm-commits mailing list