Skip to content

Commit 34c33bb

Browse files
committed
[InstCombine] Remove redundant fold in foldSelectExtConst() (NFCI)
This has been subsumed by the more general simplifyWithOpReplaced() fold.
1 parent d3cf00b commit 34c33bb

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,24 +2100,6 @@ Instruction *InstCombinerImpl::foldSelectExtConst(SelectInst &Sel) {
21002100
return CastInst::Create(Instruction::CastOps(ExtOpcode), NewSel, SelType);
21012101
}
21022102

2103-
// If one arm of the select is the extend of the condition, replace that arm
2104-
// with the extension of the appropriate known bool value.
2105-
if (Cond == X) {
2106-
if (ExtInst == Sel.getTrueValue()) {
2107-
// select X, (sext X), C --> select X, -1, C
2108-
// select X, (zext X), C --> select X, 1, C
2109-
Constant *One = ConstantInt::getTrue(SmallType);
2110-
Value *AllOnesOrOne =
2111-
Builder.CreateCast((Instruction::CastOps)ExtOpcode, One, SelType);
2112-
return SelectInst::Create(Cond, AllOnesOrOne, C, "", nullptr, &Sel);
2113-
} else {
2114-
// select X, C, (sext X) --> select X, C, 0
2115-
// select X, C, (zext X) --> select X, C, 0
2116-
Constant *Zero = ConstantInt::getNullValue(SelType);
2117-
return SelectInst::Create(Cond, C, Zero, "", nullptr, &Sel);
2118-
}
2119-
}
2120-
21212103
return nullptr;
21222104
}
21232105

0 commit comments

Comments
 (0)