Lines Matching refs:C1

676 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,  in ConstantFoldBinaryInstruction()  argument
683 Opcode, C1->getType(), /*AllowRHSIdentity*/ false)) { in ConstantFoldBinaryInstruction()
684 if (C1 == Identity) in ConstantFoldBinaryInstruction()
687 return C1; in ConstantFoldBinaryInstruction()
689 Opcode, C1->getType(), /*AllowRHSIdentity*/ true)) { in ConstantFoldBinaryInstruction()
691 return C1; in ConstantFoldBinaryInstruction()
695 if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)) in ConstantFoldBinaryInstruction()
696 return PoisonValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
700 bool IsScalableVector = isa<ScalableVectorType>(C1->getType()); in ConstantFoldBinaryInstruction()
702 (!C1->getType()->isVectorTy() || IsScalableVector) && in ConstantFoldBinaryInstruction()
703 (isa<UndefValue>(C1) || isa<UndefValue>(C2)); in ConstantFoldBinaryInstruction()
707 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
710 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
714 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
716 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef & undef -> undef in ConstantFoldBinaryInstruction()
717 return C1; in ConstantFoldBinaryInstruction()
718 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
721 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
722 return C1; in ConstantFoldBinaryInstruction()
725 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV))) in ConstantFoldBinaryInstruction()
727 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
730 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
739 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
747 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
749 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef | undef -> undef in ConstantFoldBinaryInstruction()
750 return C1; in ConstantFoldBinaryInstruction()
751 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
757 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
764 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
770 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
773 if (match(C1, m_NegZeroFP()) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
781 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
782 return C1; in ConstantFoldBinaryInstruction()
790 return ConstantFP::getNaN(C1->getType()); in ConstantFoldBinaryInstruction()
822 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
866 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
882 } else if (isa<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
886 ? ConstantExpr::get(Opcode, C2, C1) in ConstantFoldBinaryInstruction()
887 : ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
890 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
928 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
932 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
936 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
948 if (CI1->isZero()) return C1; in ConstantFoldBinaryInstruction()
953 } else if (ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) { in ConstantFoldBinaryInstruction()
963 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
966 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
969 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
972 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
975 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
978 } else if (auto *VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldBinaryInstruction()
983 if (Constant *C1Splat = C1->getSplatValue()) { in ConstantFoldBinaryInstruction()
1000 Constant *LHS = ConstantExpr::getExtractElement(C1, ExtractIdx); in ConstantFoldBinaryInstruction()
1019 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1035 return ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1039 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldBinaryInstruction()
1043 return ConstantExpr::getXor(C1, C2); in ConstantFoldBinaryInstruction()
1049 return C1; in ConstantFoldBinaryInstruction()
1054 return C1; in ConstantFoldBinaryInstruction()
1059 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldBinaryInstruction()
1210 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction() argument
1212 if (VectorType *VT = dyn_cast<VectorType>(C1->getType())) in ConstantFoldCompareInstruction()
1213 ResultTy = VectorType::get(Type::getInt1Ty(C1->getContext()), in ConstantFoldCompareInstruction()
1216 ResultTy = Type::getInt1Ty(C1->getContext()); in ConstantFoldCompareInstruction()
1226 if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)) in ConstantFoldCompareInstruction()
1229 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldCompareInstruction()
1234 if (ICmpInst::isEquality(Predicate) || (isIntegerPredicate && C1 == C2)) in ConstantFoldCompareInstruction()
1259 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldCompareInstruction()
1263 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2)); in ConstantFoldCompareInstruction()
1264 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2); in ConstantFoldCompareInstruction()
1266 return ConstantExpr::getXor(C1, C2); in ConstantFoldCompareInstruction()
1272 if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) { in ConstantFoldCompareInstruction()
1273 const APInt &V1 = cast<ConstantInt>(C1)->getValue(); in ConstantFoldCompareInstruction()
1276 } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) { in ConstantFoldCompareInstruction()
1277 const APFloat &C1V = cast<ConstantFP>(C1)->getValueAPF(); in ConstantFoldCompareInstruction()
1280 } else if (auto *C1VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldCompareInstruction()
1283 if (Constant *C1Splat = C1->getSplatValue()) in ConstantFoldCompareInstruction()
1297 Type *Ty = IntegerType::get(C1->getContext(), 32); in ConstantFoldCompareInstruction()
1302 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, I)); in ConstantFoldCompareInstruction()
1312 if (C1->getType()->isFPOrFPVectorTy()) { in ConstantFoldCompareInstruction()
1313 if (C1 == C2) { in ConstantFoldCompareInstruction()
1323 switch (evaluateICmpRelation(C1, C2)) { in ConstantFoldCompareInstruction()
1408 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || in ConstantFoldCompareInstruction()
1409 (C1->isNullValue() && !C2->isNullValue())) { in ConstantFoldCompareInstruction()
1414 return ConstantExpr::getICmp(Predicate, C2, C1); in ConstantFoldCompareInstruction()