[llvm] d3cf00b - [InstCombine] Remove some redundant select folds (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 07:17:56 PDT 2023
Author: Nikita Popov
Date: 2023-10-24T16:17:47+02:00
New Revision: d3cf00bb4de8ed9fda35e79044ddd9c3c384830c
URL: https://github.com/llvm/llvm-project/commit/d3cf00bb4de8ed9fda35e79044ddd9c3c384830c
DIFF: https://github.com/llvm/llvm-project/commit/d3cf00bb4de8ed9fda35e79044ddd9c3c384830c.diff
LOG: [InstCombine] Remove some redundant select folds (NFCI)
simplifyWithOpReplaced() has become more powerful in the
meantime, subsuming these folds.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 7a15c0dee492b5a..cbc2f8355a6cc55 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -3391,28 +3391,6 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
ConstantInt::getFalse(CondType), SQ,
/* AllowRefinement */ true))
return replaceOperand(SI, 2, S);
-
- // Handle patterns involving sext/zext + not explicitly,
- // as simplifyWithOpReplaced() only looks past one instruction.
- Value *NotCond;
-
- // select a, sext(!a), b -> select !a, b, 0
- // select a, zext(!a), b -> select !a, b, 0
- if (match(TrueVal, m_ZExtOrSExt(m_CombineAnd(m_Value(NotCond),
- m_Not(m_Specific(CondVal))))))
- return SelectInst::Create(NotCond, FalseVal,
- Constant::getNullValue(SelType));
-
- // select a, b, zext(!a) -> select !a, 1, b
- if (match(FalseVal, m_ZExt(m_CombineAnd(m_Value(NotCond),
- m_Not(m_Specific(CondVal))))))
- return SelectInst::Create(NotCond, ConstantInt::get(SelType, 1), TrueVal);
-
- // select a, b, sext(!a) -> select !a, -1, b
- if (match(FalseVal, m_SExt(m_CombineAnd(m_Value(NotCond),
- m_Not(m_Specific(CondVal))))))
- return SelectInst::Create(NotCond, Constant::getAllOnesValue(SelType),
- TrueVal);
}
if (Instruction *R = foldSelectOfBools(SI))
More information about the llvm-commits
mailing list