[PATCH] D88316: [InstCombine] recognizeBSwapOrBitReverseIdiom - recognise zext(bswap(trunc(x))) patterns (PR39793)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 11:13:15 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:3027-3029
+  if (isPowerOf2_32(BitProvenance.size())) {
+    // Keep halving the demanded width while the upper half is zero.
+    while (BitProvenance.size() > 2) {
----------------
RKSimon wrote:
> lebedev.ri wrote:
> > Why is this restricted to powers of two?
> Good catch - my solution was too focused on the original test cases - I'm looking at refactoring this now.
I think this might suggest that there's second half of the puzzle missing,
i.e. should this also know how to widen/pad the inputs so that it is applicable for `bswap`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88316



More information about the llvm-commits mailing list