Lines Matching refs:TrueVal
229 Instruction *InstCombiner::FoldSelectIntoOp(SelectInst &SI, Value *TrueVal, in FoldSelectIntoOp() argument
233 if (Instruction *TVI = dyn_cast<Instruction>(TrueVal)) { in FoldSelectIntoOp()
265 !isa<Constant>(TrueVal)) { in FoldSelectIntoOp()
268 if ((SFO & 1) && TrueVal == FVI->getOperand(0)) { in FoldSelectIntoOp()
270 } else if ((SFO & 2) && TrueVal == FVI->getOperand(1)) { in FoldSelectIntoOp()
284 TrueVal, NewSel); in FoldSelectIntoOp()
309 static Value *foldSelectICmpAndOr(const SelectInst &SI, Value *TrueVal, in foldSelectICmpAndOr() argument
329 bool OrOnFalseVal = match(FalseVal, m_Or(m_Specific(TrueVal), m_Power2(C2))); in foldSelectICmpAndOr()
331 OrOnTrueVal = match(TrueVal, m_Or(m_Specific(FalseVal), m_Power2(C2))); in foldSelectICmpAndOr()
337 Value *Y = OrOnFalseVal ? TrueVal : FalseVal; in foldSelectICmpAndOr()
370 static Value *foldSelectCttzCtlz(ICmpInst *ICI, Value *TrueVal, Value *FalseVal, in foldSelectCttzCtlz() argument
381 Value *ValueOnZero = TrueVal; in foldSelectCttzCtlz()
421 Value *TrueVal = SI.getTrueValue(); in visitSelectInstWithICmp() local
448 if ((CmpLHS == TrueVal && AdjustedRHS == FalseVal) || in visitSelectInstWithICmp()
449 (CmpLHS == FalseVal && AdjustedRHS == TrueVal)) in visitSelectInstWithICmp()
463 if (match(TrueVal, m_SExt(m_Specific(CmpLHS))) && in visitSelectInstWithICmp()
465 CmpLHS = TrueVal; in visitSelectInstWithICmp()
468 sextRHS == TrueVal) { in visitSelectInstWithICmp()
477 if (match(TrueVal, m_ZExt(m_Specific(CmpLHS))) && in visitSelectInstWithICmp()
479 CmpLHS = TrueVal; in visitSelectInstWithICmp()
482 zextRHS == TrueVal) { in visitSelectInstWithICmp()
494 std::swap(FalseVal, TrueVal); in visitSelectInstWithICmp()
498 SI.setOperand(1, TrueVal); in visitSelectInstWithICmp()
517 if (TrueVal->getType() == Ty) { in visitSelectInstWithICmp()
521 C1 = dyn_cast<ConstantInt>(TrueVal); in visitSelectInstWithICmp()
525 C2 = dyn_cast<ConstantInt>(TrueVal); in visitSelectInstWithICmp()
545 if (CmpLHS == TrueVal && Pred == ICmpInst::ICMP_EQ) { in visitSelectInstWithICmp()
557 unsigned BitWidth = DL.getTypeSizeInBits(TrueVal->getType()); in visitSelectInstWithICmp()
582 if (TrueWhenUnset && TrueVal == X && in visitSelectInstWithICmp()
587 match(TrueVal, m_Xor(m_Specific(X), m_APInt(C))) && *Y == *C) in visitSelectInstWithICmp()
591 match(TrueVal, m_Xor(m_Specific(X), m_APInt(C))) && *Y == *C) in visitSelectInstWithICmp()
594 else if (!TrueWhenUnset && TrueVal == X && in visitSelectInstWithICmp()
603 if (Value *V = foldSelectICmpAndOr(SI, TrueVal, FalseVal, Builder)) in visitSelectInstWithICmp()
606 if (Value *V = foldSelectCttzCtlz(ICI, TrueVal, FalseVal, Builder)) in visitSelectInstWithICmp()
769 static Value *foldSelectICmpAnd(const SelectInst &SI, ConstantInt *TrueVal, in foldSelectICmpAnd() argument
788 if (!TrueVal->isZero() && !FalseVal->isZero()) { in foldSelectICmpAnd()
789 if ((TrueVal->getValue() - FalseVal->getValue()).isPowerOf2()) in foldSelectICmpAnd()
791 else if ((FalseVal->getValue() - TrueVal->getValue()).isPowerOf2()) in foldSelectICmpAnd()
792 Offset = TrueVal; in foldSelectICmpAnd()
797 TrueVal = ConstantInt::get(Builder->getContext(), in foldSelectICmpAnd()
798 TrueVal->getValue() - Offset->getValue()); in foldSelectICmpAnd()
805 (!TrueVal->getValue().isPowerOf2() && in foldSelectICmpAnd()
811 ConstantInt *ValC = !TrueVal->isZero() ? TrueVal : FalseVal; in foldSelectICmpAnd()
829 bool ShouldNotVal = !TrueVal->isZero(); in foldSelectICmpAnd()
845 Value *TrueVal = SI.getTrueValue(); in foldAddSubSelect() local
847 auto *TI = dyn_cast<Instruction>(TrueVal); in foldAddSubSelect()
914 Value *TrueVal = SI.getTrueValue(); in visitSelectInst() local
919 SimplifySelectInst(CondVal, TrueVal, FalseVal, DL, TLI, DT, AC)) in visitSelectInst()
923 TrueVal->getType() == CondVal->getType()) { in visitSelectInst()
924 if (match(TrueVal, m_One())) { in visitSelectInst()
928 if (match(TrueVal, m_Zero())) { in visitSelectInst()
935 return BinaryOperator::CreateAnd(CondVal, TrueVal); in visitSelectInst()
940 return BinaryOperator::CreateOr(NotCond, TrueVal); in visitSelectInst()
945 if (CondVal == TrueVal) in visitSelectInst()
948 return BinaryOperator::CreateAnd(CondVal, TrueVal); in visitSelectInst()
952 if (match(TrueVal, m_Not(m_Specific(CondVal)))) in visitSelectInst()
953 return BinaryOperator::CreateAnd(TrueVal, FalseVal); in visitSelectInst()
955 return BinaryOperator::CreateOr(TrueVal, FalseVal); in visitSelectInst()
966 if (match(TrueVal, m_One()) && match(FalseVal, m_Zero())) in visitSelectInst()
970 if (match(TrueVal, m_AllOnes()) && match(FalseVal, m_Zero())) in visitSelectInst()
974 if (match(TrueVal, m_Zero()) && match(FalseVal, m_One())) { in visitSelectInst()
980 if (match(TrueVal, m_Zero()) && match(FalseVal, m_AllOnes())) { in visitSelectInst()
986 if (ConstantInt *TrueValC = dyn_cast<ConstantInt>(TrueVal)) in visitSelectInst()
993 if (FCI->getOperand(0) == TrueVal && FCI->getOperand(1) == FalseVal) { in visitSelectInst()
1000 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) && in visitSelectInst()
1012 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) && in visitSelectInst()
1016 return replaceInstUsesWith(SI, TrueVal); in visitSelectInst()
1028 Value *NewCond = Builder->CreateFCmp(InvPred, TrueVal, FalseVal, in visitSelectInst()
1031 return SelectInst::Create(NewCond, FalseVal, TrueVal, in visitSelectInst()
1036 } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){ in visitSelectInst()
1043 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) && in visitSelectInst()
1055 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) && in visitSelectInst()
1059 return replaceInstUsesWith(SI, TrueVal); in visitSelectInst()
1071 Value *NewCond = Builder->CreateFCmp(InvPred, FalseVal, TrueVal, in visitSelectInst()
1074 return SelectInst::Create(NewCond, FalseVal, TrueVal, in visitSelectInst()
1092 auto *TI = dyn_cast<Instruction>(TrueVal); in visitSelectInst()
1100 if (Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal)) in visitSelectInst()
1182 if (CanSelectOperandBeMappingIntoPredBlock(TrueVal, SI) && in visitSelectInst()
1187 if (SelectInst *TrueSI = dyn_cast<SelectInst>(TrueVal)) { in visitSelectInst()
1217 if (FalseSI->getTrueValue() == TrueVal && FalseSI->hasOneUse()) { in visitSelectInst()
1229 SI.setOperand(2, TrueVal); in visitSelectInst()
1260 Value *V = *Implication ? TrueVal : FalseVal; in visitSelectInst()