[llvm] [DAGCombiner] Fold bswap of single-byte-known-nonzero value to a shift (PR #193473)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 13:49:57 PDT 2026
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>,
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>,
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>,
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>,
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>,
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>,
=?utf-8?q?Paweł?= Bylica <pawel at hepcolgum.band>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/193473 at github.com>
================
@@ -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");
----------------
topperc wrote:
What breaks if it's a multiple 8 instead of 16? I'm considering removing the restriction. The restriction was removed from APint 6 years ago 366ae9c90fe6d3a590c0a0d4283c019f11799516
https://github.com/llvm/llvm-project/pull/193473
More information about the llvm-commits
mailing list