Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:TrueVal

211 Instruction *InstCombiner::FoldSelectIntoOp(SelectInst &SI, Value *TrueVal,
215 if (Instruction *TVI = dyn_cast<Instruction>(TrueVal)) {
252 !isa<Constant>(TrueVal)) {
255 if ((SFO & 1) && TrueVal == FVI->getOperand(0)) {
257 } else if ((SFO & 2) && TrueVal == FVI->getOperand(1)) {
271 TrueVal, NewSel);
366 static Value *foldSelectICmpAndOr(const SelectInst &SI, Value *TrueVal,
386 bool OrOnFalseVal = match(FalseVal, m_Or(m_Specific(TrueVal), m_Power2(C2)));
388 OrOnTrueVal = match(TrueVal, m_Or(m_Specific(FalseVal), m_Power2(C2)));
394 Value *Y = OrOnFalseVal ? TrueVal : FalseVal;
424 Value *TrueVal = SI.getTrueValue();
459 if ((CmpLHS == TrueVal && AdjustedRHS == FalseVal) ||
460 (CmpLHS == FalseVal && AdjustedRHS == TrueVal))
474 if (match(TrueVal, m_SExt(m_Specific(CmpLHS))) &&
476 CmpLHS = TrueVal;
479 sextRHS == TrueVal) {
488 if (match(TrueVal, m_ZExt(m_Specific(CmpLHS))) &&
490 CmpLHS = TrueVal;
493 zextRHS == TrueVal) {
505 std::swap(FalseVal, TrueVal);
509 SI.setOperand(1, TrueVal);
528 if (TrueVal->getType() == Ty) {
532 C1 = dyn_cast<ConstantInt>(TrueVal);
536 C2 = dyn_cast<ConstantInt>(TrueVal);
557 if (SimplifyWithOpReplaced(FalseVal, CmpLHS, CmpRHS, TD, TLI) == TrueVal ||
558 SimplifyWithOpReplaced(FalseVal, CmpRHS, CmpLHS, TD, TLI) == TrueVal)
560 if (SimplifyWithOpReplaced(TrueVal, CmpLHS, CmpRHS, TD, TLI) == FalseVal ||
561 SimplifyWithOpReplaced(TrueVal, CmpRHS, CmpLHS, TD, TLI) == FalseVal)
564 if (SimplifyWithOpReplaced(TrueVal, CmpLHS, CmpRHS, TD, TLI) == FalseVal ||
565 SimplifyWithOpReplaced(TrueVal, CmpRHS, CmpLHS, TD, TLI) == FalseVal)
566 return ReplaceInstUsesWith(SI, TrueVal);
567 if (SimplifyWithOpReplaced(FalseVal, CmpLHS, CmpRHS, TD, TLI) == TrueVal ||
568 SimplifyWithOpReplaced(FalseVal, CmpRHS, CmpLHS, TD, TLI) == TrueVal)
569 return ReplaceInstUsesWith(SI, TrueVal);
575 if (CmpLHS == TrueVal && Pred == ICmpInst::ICMP_EQ) {
586 if (Value *V = foldSelectICmpAndOr(SI, TrueVal, FalseVal, Builder))
661 static Value *foldSelectICmpAnd(const SelectInst &SI, ConstantInt *TrueVal,
680 if (!TrueVal->isZero() && !FalseVal->isZero()) {
681 if ((TrueVal->getValue() - FalseVal->getValue()).isPowerOf2())
683 else if ((FalseVal->getValue() - TrueVal->getValue()).isPowerOf2())
684 Offset = TrueVal;
688 // Adjust TrueVal and FalseVal to the offset.
689 TrueVal = ConstantInt::get(Builder->getContext(),
690 TrueVal->getValue() - Offset->getValue());
697 (!TrueVal->getValue().isPowerOf2() &&
703 ConstantInt *ValC = !TrueVal->isZero() ? TrueVal : FalseVal;
721 bool ShouldNotVal = !TrueVal->isZero();
734 Value *TrueVal = SI.getTrueValue();
737 if (Value *V = SimplifySelectInst(CondVal, TrueVal, FalseVal, TD))
741 if (ConstantInt *C = dyn_cast<ConstantInt>(TrueVal)) {
753 return BinaryOperator::CreateAnd(CondVal, TrueVal);
757 return BinaryOperator::CreateOr(NotCond, TrueVal);
762 if (CondVal == TrueVal)
765 return BinaryOperator::CreateAnd(CondVal, TrueVal);
769 if (match(TrueVal, m_Not(m_Specific(CondVal))))
770 return BinaryOperator::CreateAnd(TrueVal, FalseVal);
772 return BinaryOperator::CreateOr(TrueVal, FalseVal);
776 if (ConstantInt *TrueValC = dyn_cast<ConstantInt>(TrueVal))
804 if (FCI->getOperand(0) == TrueVal && FCI->getOperand(1) == FalseVal) {
811 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&
823 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&
827 return ReplaceInstUsesWith(SI, TrueVal);
831 } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){
838 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&
850 if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&
854 return ReplaceInstUsesWith(SI, TrueVal);
866 if (Instruction *TI = dyn_cast<Instruction>(TrueVal))
926 if (Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal))
953 if (CanSelectOperandBeMappingIntoPredBlock(TrueVal, SI) &&
958 if (SelectInst *TrueSI = dyn_cast<SelectInst>(TrueVal)) {
978 SI.setOperand(2, TrueVal);