diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-05-14 11:42:41 +0100 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-05-14 11:42:52 +0100 |
commit | 079bbea2b20dbfd24e4df654bae1c4324dcde754 (patch) | |
tree | d134de964adcdcee6efaae05be4c7b9e66176c4d /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 78c8451cd7b1d789fdd81beac0d3f7172bdce31c (diff) | |
download | llvm-079bbea2b20dbfd24e4df654bae1c4324dcde754.zip llvm-079bbea2b20dbfd24e4df654bae1c4324dcde754.tar.gz llvm-079bbea2b20dbfd24e4df654bae1c4324dcde754.tar.bz2 |
[Local] collectBitParts - for bswap-only matches, limit shift amounts to whole bytes to reduce compile time.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 1f0646d..1c1d46b 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2940,6 +2940,10 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals, if (BitShift.uge(BitWidth)) return Result; + // For bswap-only, limit shift amounts to whole bytes, for an early exit. + if (!MatchBitReversals && (BitShift.getZExtValue() % 8) != 0) + return Result; + const auto &Res = collectBitParts(X, MatchBSwaps, MatchBitReversals, BPS, Depth + 1); if (!Res) @@ -3055,6 +3059,10 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals, if (cast<IntrinsicInst>(I)->getIntrinsicID() == Intrinsic::fshr) ModAmt = BitWidth - ModAmt; + // For bswap-only, limit shift amounts to whole bytes, for an early exit. + if (!MatchBitReversals && (ModAmt % 8) != 0) + return Result; + const auto &LHS = collectBitParts(X, MatchBSwaps, MatchBitReversals, BPS, Depth + 1); const auto &RHS = |