@@ -2934,32 +2934,6 @@ static Instruction *foldSelectWithSRem(SelectInst &SI, InstCombinerImpl &IC,
2934
2934
return nullptr ;
2935
2935
}
2936
2936
2937
- static Value *foldSelectWithFrozenICmp (SelectInst &Sel, InstCombiner::BuilderTy &Builder) {
2938
- FreezeInst *FI = dyn_cast<FreezeInst>(Sel.getCondition ());
2939
- if (!FI)
2940
- return nullptr ;
2941
-
2942
- Value *Cond = FI->getOperand (0 );
2943
- Value *TrueVal = Sel.getTrueValue (), *FalseVal = Sel.getFalseValue ();
2944
-
2945
- // select (freeze(x == y)), x, y --> y
2946
- // select (freeze(x != y)), x, y --> x
2947
- // The freeze should be only used by this select. Otherwise, remaining uses of
2948
- // the freeze can observe a contradictory value.
2949
- // c = freeze(x == y) ; Let's assume that y = poison & x = 42; c is 0 or 1
2950
- // a = select c, x, y ;
2951
- // f(a, c) ; f(poison, 1) cannot happen, but if a is folded
2952
- // ; to y, this can happen.
2953
- CmpPredicate Pred;
2954
- if (FI->hasOneUse () &&
2955
- match (Cond, m_c_ICmp (Pred, m_Specific (TrueVal), m_Specific (FalseVal))) &&
2956
- (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE)) {
2957
- return Pred == ICmpInst::ICMP_EQ ? FalseVal : TrueVal;
2958
- }
2959
-
2960
- return nullptr ;
2961
- }
2962
-
2963
2937
// / Given that \p CondVal is known to be \p CondIsTrue, try to simplify \p SI.
2964
2938
static Value *simplifyNestedSelectsUsingImpliedCond (SelectInst &SI,
2965
2939
Value *CondVal,
@@ -4446,9 +4420,6 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
4446
4420
if (Instruction *PN = foldSelectToPhi (SI, DT, Builder))
4447
4421
return replaceInstUsesWith (SI, PN);
4448
4422
4449
- if (Value *Fr = foldSelectWithFrozenICmp (SI, Builder))
4450
- return replaceInstUsesWith (SI, Fr);
4451
-
4452
4423
if (Value *V = foldRoundUpIntegerWithPow2Alignment (SI, Builder))
4453
4424
return replaceInstUsesWith (SI, V);
4454
4425
0 commit comments