[PATCH] D88578: [InstCombine] recognizeBSwapOrBitReverseIdiom - support for 'partial' bswap patterns (PR47191)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 08:01:30 PDT 2020
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2052-2056
// (A >> B) | (C << D) and (A << B) | (B >> C) -> bswap if possible.
- bool OrOfShifts = match(Op0, m_LogicalShift(m_Value(), m_Value())) &&
- match(Op1, m_LogicalShift(m_Value(), m_Value()));
+ bool OrWithShifts = match(Op0, m_LogicalShift(m_Value(), m_Value())) ||
+ match(Op1, m_LogicalShift(m_Value(), m_Value()));
// (A & B) | (C & D) -> bswap if possible.
----------------
The comments are now more specific than the logic now. Adjust to be more like the OrWithOrs?
// (A >> B) | C or A | (B >> C)
// (A & B) | C or A | (B & C)
Presumably, recognizeBSwapOrBitReverseIdiom() can deal with the more general patterns.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88578/new/
https://reviews.llvm.org/D88578
More information about the llvm-commits
mailing list