[InstCombine] recognizeBSwapOrBitReverseIdiom - assert for correct bit providence indices. NFCI.

As suggested by @spatel on D88316
This commit is contained in:
Simon Pilgrim 2020-09-30 11:13:54 +01:00
parent e39d7884a1
commit ec3f24d453
1 changed files with 3 additions and 0 deletions

View File

@ -3027,6 +3027,9 @@ bool llvm::recognizeBSwapOrBitReverseIdiom(
if (!Res)
return false;
auto &BitProvenance = Res->Provenance;
assert(all_of(BitProvenance,
[](int8_t I) { return I == BitPart::Unset || 0 <= I; }) &&
"Illegal bit provenance index");
// Now, is the bit permutation correct for a bswap or a bitreverse? We can
// only byteswap values with an even number of bytes.