From: Simon Pilgrim Date: Wed, 30 Sep 2020 10:13:54 +0000 (+0100) Subject: [InstCombine] recognizeBSwapOrBitReverseIdiom - assert for correct bit providence... X-Git-Tag: llvmorg-13-init~10532 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec3f24d4538d1c262377331c7b35ea66e023cf98;p=platform%2Fupstream%2Fllvm.git [InstCombine] recognizeBSwapOrBitReverseIdiom - assert for correct bit providence indices. NFCI. As suggested by @spatel on D88316 --- diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 61f4dff..8ff11ba 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -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.