MatchBSwap has most of the functionality to match bit reversals already. If we switch it from looking at bytes to individual bits and remove a few early exits, we can extend the main recursive function to match any sequence of ORs, ANDs and shifts that assemble a value from different parts of another, base value. Once we have this bit->bit mapping, we can very simply detect if it is appropriate for a bswap or bitreverse.
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Do you have data on how this change impacts compile time?
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | ||
---|---|---|
20 | Please sort this include. |
Comment Actions
Hi David,
Include order updated (StringExtras was only needed for debugging).
As I mentioned on the list, but it doesn't appear to have made its way here to phab, there was no measurable compile time difference with this patch on a clang bootstrap.
James
Comment Actions
Hi James,
I had a look over this and the logic seems sound to me. I only have one (superficial) complaint: the old commets in CollectBSwapBitReverseParts refer only about bswap. Maybe we can rename it to something like CollectBitParts (since we're basically only tracking bits now and have the bswap/bitreverse validation somewhere else).
Cheers,
Silviu
Please sort this include.