diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-05-04 13:46:45 +0100 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-05-04 13:46:45 +0100 |
commit | 2bb41851a10c1473bda9a87b4bfabf99527b3929 (patch) | |
tree | bc0da0f3639828bd2c8b4bedcc64f74f582e3b3f /llvm/lib/Transforms/Utils/Local.cpp | |
parent | e0dd708f4050798fa3bac603ada5f4499f6a38a0 (diff) | |
download | llvm-2bb41851a10c1473bda9a87b4bfabf99527b3929.zip llvm-2bb41851a10c1473bda9a87b4bfabf99527b3929.tar.gz llvm-2bb41851a10c1473bda9a87b4bfabf99527b3929.tar.bz2 |
[Utils] recognizeBSwapOrBitReverseIdiom - support matching from funnel shift roots (PR40058)
We were missing bitreverse matches in cases where InstCombine had seen a byte-level rotation at the end of a bitreverse sequence (replacing or() with fshl()), hindering the exhaustive bitreverse matching in CodeGenPrepare later on.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 3cb6705..ed75337 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -3101,7 +3101,9 @@ static bool bitTransformIsCorrectForBitReverse(unsigned From, unsigned To, bool llvm::recognizeBSwapOrBitReverseIdiom( Instruction *I, bool MatchBSwaps, bool MatchBitReversals, SmallVectorImpl<Instruction *> &InsertedInsts) { - if (Operator::getOpcode(I) != Instruction::Or) + if (!match(I, m_Or(m_Value(), m_Value())) && + !match(I, m_FShl(m_Value(), m_Value(), m_Value())) && + !match(I, m_FShr(m_Value(), m_Value(), m_Value()))) return false; if (!MatchBSwaps && !MatchBitReversals) return false; |