[PATCH] D146637: [InstCombine] Try to recognize bswap pattern when calling funnel shifts
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 04:05:59 PDT 2023
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LGTM
================
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]]
----------------
junaire wrote:
> 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...
We should just add support for folding this trunc+shl+zext pattern. I've filed https://github.com/llvm/llvm-project/issues/61650 to track.
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