Skip to content

Commit 5075af7

Browse files
committed
[InstCombine] Remove redundant fptrunc of select fold (NFCI)
This was subsumed by FoldOpIntoSelect() in llvm#116073, and has incorrect FMF propagation on top.
1 parent 0cb1cca commit 5075af7

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,24 +1866,6 @@ Instruction *InstCombinerImpl::visitFPTrunc(FPTruncInst &FPT) {
18661866

18671867
return UnaryOperator::CreateFNegFMF(InnerTrunc, Op);
18681868
}
1869-
1870-
// If we are truncating a select that has an extended operand, we can
1871-
// narrow the other operand and do the select as a narrow op.
1872-
Value *Cond, *X, *Y;
1873-
if (match(Op, m_Select(m_Value(Cond), m_FPExt(m_Value(X)), m_Value(Y))) &&
1874-
X->getType() == Ty) {
1875-
// fptrunc (select Cond, (fpext X), Y --> select Cond, X, (fptrunc Y)
1876-
Value *NarrowY = Builder.CreateFPTrunc(Y, Ty);
1877-
Value *Sel = Builder.CreateSelect(Cond, X, NarrowY, "narrow.sel", Op);
1878-
return replaceInstUsesWith(FPT, Sel);
1879-
}
1880-
if (match(Op, m_Select(m_Value(Cond), m_Value(Y), m_FPExt(m_Value(X)))) &&
1881-
X->getType() == Ty) {
1882-
// fptrunc (select Cond, Y, (fpext X) --> select Cond, (fptrunc Y), X
1883-
Value *NarrowY = Builder.CreateFPTrunc(Y, Ty);
1884-
Value *Sel = Builder.CreateSelect(Cond, NarrowY, X, "narrow.sel", Op);
1885-
return replaceInstUsesWith(FPT, Sel);
1886-
}
18871869
}
18881870

18891871
if (auto *II = dyn_cast<IntrinsicInst>(FPT.getOperand(0))) {

0 commit comments

Comments
 (0)