aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-04-25 16:14:54 +0900
committerGitHub <noreply@github.com>2024-04-25 16:14:54 +0900
commit8bfdbb9570c87fc98c9d6b41409e4c59ba285f51 (patch)
tree7bc3f0e596621b658ba5bc0ecf147e21ffe7e77b
parent565bdb55453f0bdd59d9325b8a748cb42e6df95b (diff)
downloadllvm-8bfdbb9570c87fc98c9d6b41409e4c59ba285f51.zip
llvm-8bfdbb9570c87fc98c9d6b41409e4c59ba285f51.tar.gz
llvm-8bfdbb9570c87fc98c9d6b41409e4c59ba285f51.tar.bz2
[InstCombine] Remove redundant shift folds (NFCI) (#90016)
These are already handled by canEvaluateShifted/getShiftedValue (one-use only), and also in reassociateShiftAmtsOfTwoSameDirectionShifts (also multi-use), so let's at least get rid of the *third* implementation...
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 244f03a..1cb21a1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -1120,14 +1120,6 @@ Instruction *InstCombinerImpl::visitShl(BinaryOperator &I) {
return BinaryOperator::CreateAnd(Trunc, ConstantInt::get(Ty, Mask));
}
- if (match(Op0, m_Shl(m_Value(X), m_APInt(C1))) && C1->ult(BitWidth)) {
- unsigned AmtSum = ShAmtC + C1->getZExtValue();
- // Oversized shifts are simplified to zero in InstSimplify.
- if (AmtSum < BitWidth)
- // (X << C1) << C2 --> X << (C1 + C2)
- return BinaryOperator::CreateShl(X, ConstantInt::get(Ty, AmtSum));
- }
-
// If we have an opposite shift by the same amount, we may be able to
// reorder binops and shifts to eliminate math/logic.
auto isSuitableBinOpcode = [](Instruction::BinaryOps BinOpcode) {
@@ -1394,14 +1386,6 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
}
}
- // (X >>u C1) >>u C --> X >>u (C1 + C)
- if (match(Op0, m_LShr(m_Value(X), m_APInt(C1)))) {
- // Oversized shifts are simplified to zero in InstSimplify.
- unsigned AmtSum = ShAmtC + C1->getZExtValue();
- if (AmtSum < BitWidth)
- return BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, AmtSum));
- }
-
Instruction *TruncSrc;
if (match(Op0, m_OneUse(m_Trunc(m_Instruction(TruncSrc)))) &&
match(TruncSrc, m_LShr(m_Value(X), m_APInt(C1)))) {