Lines Matching refs:C1

872 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,  in ConstantFoldBinaryInstruction()  argument
881 Constant *Identity = ConstantExpr::getBinOpIdentity(Opcode, C1->getType()); in ConstantFoldBinaryInstruction()
883 if (C1 == Identity) in ConstantFoldBinaryInstruction()
886 return C1; in ConstantFoldBinaryInstruction()
890 if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)) in ConstantFoldBinaryInstruction()
891 return PoisonValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
895 bool IsScalableVector = isa<ScalableVectorType>(C1->getType()); in ConstantFoldBinaryInstruction()
897 (!C1->getType()->isVectorTy() || IsScalableVector) && in ConstantFoldBinaryInstruction()
898 (isa<UndefValue>(C1) || isa<UndefValue>(C2)); in ConstantFoldBinaryInstruction()
902 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
905 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
909 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
911 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef & undef -> undef in ConstantFoldBinaryInstruction()
912 return C1; in ConstantFoldBinaryInstruction()
913 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
916 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
917 return C1; in ConstantFoldBinaryInstruction()
920 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV))) in ConstantFoldBinaryInstruction()
922 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
925 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
935 return C1; in ConstantFoldBinaryInstruction()
937 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
945 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
947 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef | undef -> undef in ConstantFoldBinaryInstruction()
948 return C1; in ConstantFoldBinaryInstruction()
949 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
956 return C1; in ConstantFoldBinaryInstruction()
958 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
965 return C1; in ConstantFoldBinaryInstruction()
968 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
975 return C1; in ConstantFoldBinaryInstruction()
977 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
980 if (match(C1, m_NegZeroFP()) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
988 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
989 return C1; in ConstantFoldBinaryInstruction()
997 return ConstantFP::getNaN(C1->getType()); in ConstantFoldBinaryInstruction()
1010 if (CI2->isZero()) return C1; // X + 0 == X in ConstantFoldBinaryInstruction()
1013 if (CI2->isZero()) return C1; // X - 0 == X in ConstantFoldBinaryInstruction()
1018 return C1; // X * 1 == X in ConstantFoldBinaryInstruction()
1023 return C1; // X / 1 == X in ConstantFoldBinaryInstruction()
1037 return C1; // X & -1 == X in ConstantFoldBinaryInstruction()
1039 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1047 return C1; in ConstantFoldBinaryInstruction()
1093 if (CI2->isZero()) return C1; // X | 0 == X in ConstantFoldBinaryInstruction()
1098 if (CI2->isZero()) return C1; // X ^ 0 == X in ConstantFoldBinaryInstruction()
1100 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1116 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) in ConstantFoldBinaryInstruction()
1118 return ConstantExpr::getLShr(C1, C2); in ConstantFoldBinaryInstruction()
1121 } else if (isa<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
1124 return ConstantExpr::get(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1127 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
1165 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
1169 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
1173 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
1185 if (CI1->isZero()) return C1; in ConstantFoldBinaryInstruction()
1190 } else if (ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) { in ConstantFoldBinaryInstruction()
1200 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1203 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1206 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1209 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1212 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1215 } else if (auto *VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldBinaryInstruction()
1220 if (Constant *C1Splat = C1->getSplatValue()) { in ConstantFoldBinaryInstruction()
1237 Constant *LHS = ConstantExpr::getExtractElement(C1, ExtractIdx); in ConstantFoldBinaryInstruction()
1256 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1272 return ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1276 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldBinaryInstruction()
1280 return ConstantExpr::getXor(C1, C2); in ConstantFoldBinaryInstruction()
1282 return ConstantExpr::getAnd(C1, C2); in ConstantFoldBinaryInstruction()
1288 return C1; in ConstantFoldBinaryInstruction()
1293 return C1; in ConstantFoldBinaryInstruction()
1298 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldBinaryInstruction()
1582 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction() argument
1584 if (VectorType *VT = dyn_cast<VectorType>(C1->getType())) in ConstantFoldCompareInstruction()
1585 ResultTy = VectorType::get(Type::getInt1Ty(C1->getContext()), in ConstantFoldCompareInstruction()
1588 ResultTy = Type::getInt1Ty(C1->getContext()); in ConstantFoldCompareInstruction()
1598 if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)) in ConstantFoldCompareInstruction()
1601 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldCompareInstruction()
1606 if (ICmpInst::isEquality(Predicate) || (isIntegerPredicate && C1 == C2)) in ConstantFoldCompareInstruction()
1620 if (C1->isNullValue()) { in ConstantFoldCompareInstruction()
1627 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldCompareInstruction()
1629 return ConstantInt::getTrue(C1->getContext()); in ConstantFoldCompareInstruction()
1633 if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1)) { in ConstantFoldCompareInstruction()
1639 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldCompareInstruction()
1641 return ConstantInt::getTrue(C1->getContext()); in ConstantFoldCompareInstruction()
1656 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldCompareInstruction()
1660 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2)); in ConstantFoldCompareInstruction()
1661 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2); in ConstantFoldCompareInstruction()
1663 return ConstantExpr::getXor(C1, C2); in ConstantFoldCompareInstruction()
1669 if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) { in ConstantFoldCompareInstruction()
1670 const APInt &V1 = cast<ConstantInt>(C1)->getValue(); in ConstantFoldCompareInstruction()
1673 } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) { in ConstantFoldCompareInstruction()
1674 const APFloat &C1V = cast<ConstantFP>(C1)->getValueAPF(); in ConstantFoldCompareInstruction()
1677 } else if (auto *C1VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldCompareInstruction()
1680 if (Constant *C1Splat = C1->getSplatValue()) in ConstantFoldCompareInstruction()
1694 Type *Ty = IntegerType::get(C1->getContext(), 32); in ConstantFoldCompareInstruction()
1699 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, I)); in ConstantFoldCompareInstruction()
1709 if (C1->getType()->isFloatingPointTy() && in ConstantFoldCompareInstruction()
1712 (isa<ConstantExpr>(C1) || isa<ConstantExpr>(C2))) { in ConstantFoldCompareInstruction()
1714 switch (evaluateFCmpRelation(C1, C2)) { in ConstantFoldCompareInstruction()
1785 switch (evaluateICmpRelation(C1, C2, CmpInst::isSigned(Predicate))) { in ConstantFoldCompareInstruction()
1879 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); in ConstantFoldCompareInstruction()
1885 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldCompareInstruction()
1902 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || in ConstantFoldCompareInstruction()
1903 (C1->isNullValue() && !C2->isNullValue())) { in ConstantFoldCompareInstruction()
1908 return ConstantExpr::getICmp(Predicate, C2, C1); in ConstantFoldCompareInstruction()