Lines Matching full:c1

609 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,  in ConstantFoldBinaryInstruction()  argument
616 Opcode, C1->getType(), /*AllowRHSIdentity*/ false)) { in ConstantFoldBinaryInstruction()
617 if (C1 == Identity) in ConstantFoldBinaryInstruction()
620 return C1; in ConstantFoldBinaryInstruction()
622 Opcode, C1->getType(), /*AllowRHSIdentity*/ true)) { in ConstantFoldBinaryInstruction()
624 return C1; in ConstantFoldBinaryInstruction()
628 if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)) in ConstantFoldBinaryInstruction()
629 return PoisonValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
633 bool IsScalableVector = isa<ScalableVectorType>(C1->getType()); in ConstantFoldBinaryInstruction()
635 (!C1->getType()->isVectorTy() || IsScalableVector) && in ConstantFoldBinaryInstruction()
636 (isa<UndefValue>(C1) || isa<UndefValue>(C2)); in ConstantFoldBinaryInstruction()
640 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
643 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
647 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
649 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef & undef -> undef in ConstantFoldBinaryInstruction()
650 return C1; in ConstantFoldBinaryInstruction()
651 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
654 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
655 return C1; in ConstantFoldBinaryInstruction()
658 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV))) in ConstantFoldBinaryInstruction()
660 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
663 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
672 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
680 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
682 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef | undef -> undef in ConstantFoldBinaryInstruction()
683 return C1; in ConstantFoldBinaryInstruction()
684 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
690 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
697 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
703 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
706 if (match(C1, m_NegZeroFP()) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
714 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
715 return C1; in ConstantFoldBinaryInstruction()
723 return ConstantFP::getNaN(C1->getType()); in ConstantFoldBinaryInstruction()
755 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
799 } else if (isa<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
800 // If C1 is a ConstantInt and C2 is not, swap the operands. in ConstantFoldBinaryInstruction()
803 ? ConstantExpr::get(Opcode, C2, C1) in ConstantFoldBinaryInstruction()
804 : ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
807 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
845 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
849 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
853 return PoisonValue::get(C1->getType()); // too big shift is poison in ConstantFoldBinaryInstruction()
865 if (CI1->isZero()) return C1; in ConstantFoldBinaryInstruction()
870 } else if (ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) { in ConstantFoldBinaryInstruction()
880 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
883 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
886 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
889 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
892 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
895 } else if (auto *VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldBinaryInstruction()
900 if (Constant *C1Splat = C1->getSplatValue()) { in ConstantFoldBinaryInstruction()
917 Constant *LHS = ConstantExpr::getExtractElement(C1, ExtractIdx); in ConstantFoldBinaryInstruction()
936 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
949 // If C2 is a constant expr and C1 isn't, flop them around and fold the in ConstantFoldBinaryInstruction()
952 return ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
956 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldBinaryInstruction()
960 return ConstantExpr::getXor(C1, C2); in ConstantFoldBinaryInstruction()
966 return C1; in ConstantFoldBinaryInstruction()
971 return C1; in ConstantFoldBinaryInstruction()
976 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldBinaryInstruction()
1126 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction() argument
1128 if (VectorType *VT = dyn_cast<VectorType>(C1->getType())) in ConstantFoldCompareInstruction()
1129 ResultTy = VectorType::get(Type::getInt1Ty(C1->getContext()), in ConstantFoldCompareInstruction()
1132 ResultTy = Type::getInt1Ty(C1->getContext()); in ConstantFoldCompareInstruction()
1142 if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)) in ConstantFoldCompareInstruction()
1145 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldCompareInstruction()
1150 if (ICmpInst::isEquality(Predicate) || (isIntegerPredicate && C1 == C2)) in ConstantFoldCompareInstruction()
1166 // C1 >= 0 --> true in ConstantFoldCompareInstruction()
1169 // C1 < 0 --> false in ConstantFoldCompareInstruction()
1175 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldCompareInstruction()
1179 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2)); in ConstantFoldCompareInstruction()
1180 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2); in ConstantFoldCompareInstruction()
1182 return ConstantExpr::getXor(C1, C2); in ConstantFoldCompareInstruction()
1188 if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) { in ConstantFoldCompareInstruction()
1189 const APInt &V1 = cast<ConstantInt>(C1)->getValue(); in ConstantFoldCompareInstruction()
1192 } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) { in ConstantFoldCompareInstruction()
1193 const APFloat &C1V = cast<ConstantFP>(C1)->getValueAPF(); in ConstantFoldCompareInstruction()
1196 } else if (auto *C1VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldCompareInstruction()
1199 if (Constant *C1Splat = C1->getSplatValue()) in ConstantFoldCompareInstruction()
1213 Type *Ty = IntegerType::get(C1->getContext(), 32); in ConstantFoldCompareInstruction()
1218 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, I)); in ConstantFoldCompareInstruction()
1231 if (C1->getType()->isFPOrFPVectorTy()) { in ConstantFoldCompareInstruction()
1232 if (C1 == C2) { in ConstantFoldCompareInstruction()
1233 // We know that C1 == C2 || isUnordered(C1, C2). in ConstantFoldCompareInstruction()
1242 switch (evaluateICmpRelation(C1, C2)) { in ConstantFoldCompareInstruction()
1327 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || in ConstantFoldCompareInstruction()
1328 (C1->isNullValue() && !C2->isNullValue())) { in ConstantFoldCompareInstruction()
1329 // If C2 is a constant expr and C1 isn't, flip them around and fold the in ConstantFoldCompareInstruction()
1331 // Also, if C1 is null and C2 isn't, flip them around. in ConstantFoldCompareInstruction()
1333 return ConstantFoldCompareInstruction(Predicate, C2, C1); in ConstantFoldCompareInstruction()