Skip to content

Commit d3cf00b

Browse files
committed
[InstCombine] Remove some redundant select folds (NFCI)
simplifyWithOpReplaced() has become more powerful in the meantime, subsuming these folds.
1 parent 2df69ed commit d3cf00b

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,28 +3391,6 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
33913391
ConstantInt::getFalse(CondType), SQ,
33923392
/* AllowRefinement */ true))
33933393
return replaceOperand(SI, 2, S);
3394-
3395-
// Handle patterns involving sext/zext + not explicitly,
3396-
// as simplifyWithOpReplaced() only looks past one instruction.
3397-
Value *NotCond;
3398-
3399-
// select a, sext(!a), b -> select !a, b, 0
3400-
// select a, zext(!a), b -> select !a, b, 0
3401-
if (match(TrueVal, m_ZExtOrSExt(m_CombineAnd(m_Value(NotCond),
3402-
m_Not(m_Specific(CondVal))))))
3403-
return SelectInst::Create(NotCond, FalseVal,
3404-
Constant::getNullValue(SelType));
3405-
3406-
// select a, b, zext(!a) -> select !a, 1, b
3407-
if (match(FalseVal, m_ZExt(m_CombineAnd(m_Value(NotCond),
3408-
m_Not(m_Specific(CondVal))))))
3409-
return SelectInst::Create(NotCond, ConstantInt::get(SelType, 1), TrueVal);
3410-
3411-
// select a, b, sext(!a) -> select !a, -1, b
3412-
if (match(FalseVal, m_SExt(m_CombineAnd(m_Value(NotCond),
3413-
m_Not(m_Specific(CondVal))))))
3414-
return SelectInst::Create(NotCond, Constant::getAllOnesValue(SelType),
3415-
TrueVal);
34163394
}
34173395

34183396
if (Instruction *R = foldSelectOfBools(SI))

0 commit comments

Comments
 (0)