@@ -2696,8 +2696,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
2696
2696
// paths for the values (this helps GetUnderlyingObjects() for example).
2697
2697
if (TrueSI->getFalseValue () == FalseVal && TrueSI->hasOneUse ()) {
2698
2698
Value *And = Builder.CreateAnd (CondVal, TrueSI->getCondition ());
2699
- SI. setOperand ( 0 , And);
2700
- SI. setOperand ( 1 , TrueSI->getTrueValue ());
2699
+ replaceOperand (SI, 0 , And);
2700
+ replaceOperand (SI, 1 , TrueSI->getTrueValue ());
2701
2701
return &SI;
2702
2702
}
2703
2703
}
@@ -2713,8 +2713,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
2713
2713
// select(C0, a, select(C1, a, b)) -> select(C0|C1, a, b)
2714
2714
if (FalseSI->getTrueValue () == TrueVal && FalseSI->hasOneUse ()) {
2715
2715
Value *Or = Builder.CreateOr (CondVal, FalseSI->getCondition ());
2716
- SI. setOperand ( 0 , Or);
2717
- SI. setOperand ( 2 , FalseSI->getFalseValue ());
2716
+ replaceOperand (SI, 0 , Or);
2717
+ replaceOperand (SI, 2 , FalseSI->getFalseValue ());
2718
2718
return &SI;
2719
2719
}
2720
2720
}
@@ -2741,14 +2741,14 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
2741
2741
canMergeSelectThroughBinop (TrueBO)) {
2742
2742
if (auto *TrueBOSI = dyn_cast<SelectInst>(TrueBO->getOperand (0 ))) {
2743
2743
if (TrueBOSI->getCondition () == CondVal) {
2744
- TrueBO-> setOperand ( 0 , TrueBOSI->getTrueValue ());
2744
+ replaceOperand (*TrueBO, 0 , TrueBOSI->getTrueValue ());
2745
2745
Worklist.push (TrueBO);
2746
2746
return &SI;
2747
2747
}
2748
2748
}
2749
2749
if (auto *TrueBOSI = dyn_cast<SelectInst>(TrueBO->getOperand (1 ))) {
2750
2750
if (TrueBOSI->getCondition () == CondVal) {
2751
- TrueBO-> setOperand ( 1 , TrueBOSI->getTrueValue ());
2751
+ replaceOperand (*TrueBO, 1 , TrueBOSI->getTrueValue ());
2752
2752
Worklist.push (TrueBO);
2753
2753
return &SI;
2754
2754
}
@@ -2761,14 +2761,14 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
2761
2761
canMergeSelectThroughBinop (FalseBO)) {
2762
2762
if (auto *FalseBOSI = dyn_cast<SelectInst>(FalseBO->getOperand (0 ))) {
2763
2763
if (FalseBOSI->getCondition () == CondVal) {
2764
- FalseBO-> setOperand ( 0 , FalseBOSI->getFalseValue ());
2764
+ replaceOperand (*FalseBO, 0 , FalseBOSI->getFalseValue ());
2765
2765
Worklist.push (FalseBO);
2766
2766
return &SI;
2767
2767
}
2768
2768
}
2769
2769
if (auto *FalseBOSI = dyn_cast<SelectInst>(FalseBO->getOperand (1 ))) {
2770
2770
if (FalseBOSI->getCondition () == CondVal) {
2771
- FalseBO-> setOperand ( 1 , FalseBOSI->getFalseValue ());
2771
+ replaceOperand (*FalseBO, 1 , FalseBOSI->getFalseValue ());
2772
2772
Worklist.push (FalseBO);
2773
2773
return &SI;
2774
2774
}
0 commit comments