[llvm] [DAGCombiner] Fold bswap of single-byte-known-nonzero value to a shift (PR #193473)

Paweł Bylica via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 13:59:07 PDT 2026


================
@@ -12095,9 +12095,11 @@ SDValue DAGCombiner::visitBSWAP(SDNode *N) {
     return DAG.getNode(ISD::BITREVERSE, DL, VT, BSwap);
   }
 
+  unsigned BW = VT.getScalarSizeInBits();
+  assert(BW % 16 == 0 && "bswap requires a multiple-of-16-bit width");
----------------
chfast wrote:

Nothing, I only assume %8 here but I used the LangRef spec for the assert.

https://github.com/llvm/llvm-project/pull/193473


More information about the llvm-commits mailing list