Lines Matching refs:C1

900                                               Constant *C1, Constant *C2) {  in ConstantFoldBinaryInstruction()  argument
902 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldBinaryInstruction()
905 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
908 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
912 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
914 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef & undef -> undef in ConstantFoldBinaryInstruction()
915 return C1; in ConstantFoldBinaryInstruction()
916 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
919 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
920 return C1; in ConstantFoldBinaryInstruction()
923 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV))) in ConstantFoldBinaryInstruction()
925 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
928 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
933 if (match(C1, m_Zero())) in ConstantFoldBinaryInstruction()
938 return C1; in ConstantFoldBinaryInstruction()
940 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
948 return C1; in ConstantFoldBinaryInstruction()
950 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
952 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef | undef -> undef in ConstantFoldBinaryInstruction()
953 return C1; in ConstantFoldBinaryInstruction()
954 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
961 return C1; in ConstantFoldBinaryInstruction()
963 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
970 return C1; in ConstantFoldBinaryInstruction()
973 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
980 return C1; in ConstantFoldBinaryInstruction()
982 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
990 if (CI2->equalsInt(0)) return C1; // X + 0 == X in ConstantFoldBinaryInstruction()
993 if (CI2->equalsInt(0)) return C1; // X - 0 == X in ConstantFoldBinaryInstruction()
998 return C1; // X * 1 == X in ConstantFoldBinaryInstruction()
1003 return C1; // X / 1 == X in ConstantFoldBinaryInstruction()
1017 return C1; // X & -1 == X in ConstantFoldBinaryInstruction()
1019 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1027 return C1; in ConstantFoldBinaryInstruction()
1053 if (CI2->equalsInt(0)) return C1; // X | 0 == X in ConstantFoldBinaryInstruction()
1058 if (CI2->equalsInt(0)) return C1; // X ^ 0 == X in ConstantFoldBinaryInstruction()
1060 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1076 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) in ConstantFoldBinaryInstruction()
1078 return ConstantExpr::getLShr(C1, C2); in ConstantFoldBinaryInstruction()
1081 } else if (isa<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
1084 return ConstantExpr::get(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1088 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
1126 return UndefValue::get(C1->getType()); // too big shift is undef in ConstantFoldBinaryInstruction()
1130 return UndefValue::get(C1->getType()); // too big shift is undef in ConstantFoldBinaryInstruction()
1134 return UndefValue::get(C1->getType()); // too big shift is undef in ConstantFoldBinaryInstruction()
1146 if (CI1->equalsInt(0)) return C1; in ConstantFoldBinaryInstruction()
1151 } else if (ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) { in ConstantFoldBinaryInstruction()
1161 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1164 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1167 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1170 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1173 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1176 } else if (VectorType *VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldBinaryInstruction()
1182 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i)); in ConstantFoldBinaryInstruction()
1192 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1208 return ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1212 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldBinaryInstruction()
1216 return ConstantExpr::getXor(C1, C2); in ConstantFoldBinaryInstruction()
1218 return ConstantExpr::getAnd(C1, C2); in ConstantFoldBinaryInstruction()
1224 return C1; in ConstantFoldBinaryInstruction()
1229 return C1; in ConstantFoldBinaryInstruction()
1234 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldBinaryInstruction()
1268 static int IdxCompare(Constant *C1, Constant *C2, Type *ElTy) { in IdxCompare() argument
1269 if (C1 == C2) return 0; in IdxCompare()
1273 if (!isa<ConstantInt>(C1) || !isa<ConstantInt>(C2)) in IdxCompare()
1278 if (!C1->getType()->isIntegerTy(64)) in IdxCompare()
1279 C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(C1->getContext())); in IdxCompare()
1282 C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(C1->getContext())); in IdxCompare()
1284 if (C1 == C2) return 0; // They are equal in IdxCompare()
1293 if (cast<ConstantInt>(C1)->getSExtValue() < in IdxCompare()
1641 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction() argument
1643 if (VectorType *VT = dyn_cast<VectorType>(C1->getType())) in ConstantFoldCompareInstruction()
1644 ResultTy = VectorType::get(Type::getInt1Ty(C1->getContext()), in ConstantFoldCompareInstruction()
1647 ResultTy = Type::getInt1Ty(C1->getContext()); in ConstantFoldCompareInstruction()
1657 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldCompareInstruction()
1662 (isa<UndefValue>(C1) && isa<UndefValue>(C2))) in ConstantFoldCompareInstruction()
1670 if (C1->isNullValue()) { in ConstantFoldCompareInstruction()
1675 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldCompareInstruction()
1677 return ConstantInt::getTrue(C1->getContext()); in ConstantFoldCompareInstruction()
1681 if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1)) in ConstantFoldCompareInstruction()
1685 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldCompareInstruction()
1687 return ConstantInt::getTrue(C1->getContext()); in ConstantFoldCompareInstruction()
1692 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldCompareInstruction()
1696 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2)); in ConstantFoldCompareInstruction()
1697 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2); in ConstantFoldCompareInstruction()
1699 return ConstantExpr::getXor(C1, C2); in ConstantFoldCompareInstruction()
1705 if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) { in ConstantFoldCompareInstruction()
1706 APInt V1 = cast<ConstantInt>(C1)->getValue(); in ConstantFoldCompareInstruction()
1721 } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) { in ConstantFoldCompareInstruction()
1722 APFloat C1V = cast<ConstantFP>(C1)->getValueAPF(); in ConstantFoldCompareInstruction()
1764 } else if (C1->getType()->isVectorTy()) { in ConstantFoldCompareInstruction()
1768 Type *Ty = IntegerType::get(C1->getContext(), 32); in ConstantFoldCompareInstruction()
1770 for (unsigned i = 0, e = C1->getType()->getVectorNumElements(); i != e;++i){ in ConstantFoldCompareInstruction()
1772 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i)); in ConstantFoldCompareInstruction()
1782 if (C1->getType()->isFloatingPointTy()) { in ConstantFoldCompareInstruction()
1784 switch (evaluateFCmpRelation(C1, C2)) { in ConstantFoldCompareInstruction()
1843 switch (evaluateICmpRelation(C1, C2, CmpInst::isSigned(pred))) { in ConstantFoldCompareInstruction()
1917 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); in ConstantFoldCompareInstruction()
1923 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldCompareInstruction()
1938 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || in ConstantFoldCompareInstruction()
1939 (C1->isNullValue() && !C2->isNullValue())) { in ConstantFoldCompareInstruction()
1944 return ConstantExpr::getICmp(pred, C2, C1); in ConstantFoldCompareInstruction()
2083 Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Int64Ty); in ConstantFoldGetElementPtrImpl() local
2085 Combined = ConstantExpr::get(Instruction::Add, C1, C2); in ConstantFoldGetElementPtrImpl()