Skip to content

Commit 8a0f778

Browse files
committed
[InstCombine] Remove foldSPFofSPF
1 parent cbfd0d6 commit 8a0f778

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

llvm/lib/Transforms/InstCombine/InstCombineInternal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
782782
Instruction *foldSelectEqualityTest(SelectInst &SI);
783783
Instruction *foldSelectOpOp(SelectInst &SI, Instruction *TI, Instruction *FI);
784784
Instruction *foldSelectIntoOp(SelectInst &SI, Value *, Value *);
785-
Instruction *foldSPFofSPF(Instruction *Inner, SelectPatternFlavor SPF1,
786-
Value *A, Value *B, Instruction &Outer,
787-
SelectPatternFlavor SPF2, Value *C);
788785
Instruction *foldSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
789786
Value *foldSelectWithConstOpToBinOp(ICmpInst *Cmp, Value *TrueVal,
790787
Value *FalseVal);

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,27 +2051,6 @@ Instruction *InstCombinerImpl::foldSelectInstWithICmp(SelectInst &SI,
20512051
return Changed ? &SI : nullptr;
20522052
}
20532053

2054-
/// We have an SPF (e.g. a min or max) of an SPF of the form:
2055-
/// SPF2(SPF1(A, B), C)
2056-
Instruction *InstCombinerImpl::foldSPFofSPF(Instruction *Inner,
2057-
SelectPatternFlavor SPF1, Value *A,
2058-
Value *B, Instruction &Outer,
2059-
SelectPatternFlavor SPF2,
2060-
Value *C) {
2061-
if (Outer.getType() != Inner->getType())
2062-
return nullptr;
2063-
2064-
if (C == A || C == B) {
2065-
// MAX(MAX(A, B), B) -> MAX(A, B)
2066-
// MIN(MIN(a, b), a) -> MIN(a, b)
2067-
// TODO: This could be done in instsimplify.
2068-
if (SPF1 == SPF2 && SelectPatternResult::isMinOrMax(SPF1))
2069-
return replaceInstUsesWith(Outer, Inner);
2070-
}
2071-
2072-
return nullptr;
2073-
}
2074-
20752054
/// Turn select C, (X + Y), (X - Y) --> (X + (select C, Y, (-Y))).
20762055
/// This is even legal for FP.
20772056
static Instruction *foldAddSubSelect(SelectInst &SI,
@@ -4157,17 +4136,6 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
41574136
Instruction::CastOps CastOp;
41584137
SelectPatternResult SPR = matchSelectPattern(&SI, LHS, RHS, &CastOp);
41594138
auto SPF = SPR.Flavor;
4160-
if (SPF) {
4161-
Value *LHS2, *RHS2;
4162-
if (SelectPatternFlavor SPF2 = matchSelectPattern(LHS, LHS2, RHS2).Flavor)
4163-
if (Instruction *R = foldSPFofSPF(cast<Instruction>(LHS), SPF2, LHS2,
4164-
RHS2, SI, SPF, RHS))
4165-
return R;
4166-
if (SelectPatternFlavor SPF2 = matchSelectPattern(RHS, LHS2, RHS2).Flavor)
4167-
if (Instruction *R = foldSPFofSPF(cast<Instruction>(RHS), SPF2, LHS2,
4168-
RHS2, SI, SPF, LHS))
4169-
return R;
4170-
}
41714139

41724140
if (SelectPatternResult::isMinOrMax(SPF)) {
41734141
// Canonicalize so that

0 commit comments

Comments
 (0)