Lines Matching refs:C1
918 Constant *C1, Constant *C2) { in ConstantFoldBinaryInstruction() argument
920 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldBinaryInstruction()
923 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
926 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
930 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
932 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef & undef -> undef in ConstantFoldBinaryInstruction()
933 return C1; in ConstantFoldBinaryInstruction()
934 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
937 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) in ConstantFoldBinaryInstruction()
938 return C1; in ConstantFoldBinaryInstruction()
941 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV))) in ConstantFoldBinaryInstruction()
943 return UndefValue::get(C1->getType()); in ConstantFoldBinaryInstruction()
946 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
951 if (match(C1, m_Zero())) in ConstantFoldBinaryInstruction()
956 return C1; in ConstantFoldBinaryInstruction()
958 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
966 return C1; in ConstantFoldBinaryInstruction()
968 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
970 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef | undef -> undef in ConstantFoldBinaryInstruction()
971 return C1; in ConstantFoldBinaryInstruction()
972 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
979 return C1; in ConstantFoldBinaryInstruction()
981 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
988 return C1; in ConstantFoldBinaryInstruction()
991 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
998 return C1; in ConstantFoldBinaryInstruction()
1000 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
1008 if (CI2->equalsInt(0)) return C1; // X + 0 == X in ConstantFoldBinaryInstruction()
1011 if (CI2->equalsInt(0)) return C1; // X - 0 == X in ConstantFoldBinaryInstruction()
1016 return C1; // X * 1 == X in ConstantFoldBinaryInstruction()
1021 return C1; // X / 1 == X in ConstantFoldBinaryInstruction()
1035 return C1; // X & -1 == X in ConstantFoldBinaryInstruction()
1037 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1045 return C1; in ConstantFoldBinaryInstruction()
1071 if (CI2->equalsInt(0)) return C1; // X | 0 == X in ConstantFoldBinaryInstruction()
1076 if (CI2->equalsInt(0)) return C1; // X ^ 0 == X in ConstantFoldBinaryInstruction()
1078 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1094 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) in ConstantFoldBinaryInstruction()
1096 return ConstantExpr::getLShr(C1, C2); in ConstantFoldBinaryInstruction()
1099 } else if (isa<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
1102 return ConstantExpr::get(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1106 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) { in ConstantFoldBinaryInstruction()
1144 return UndefValue::get(C1->getType()); // too big shift is undef in ConstantFoldBinaryInstruction()
1148 return UndefValue::get(C1->getType()); // too big shift is undef in ConstantFoldBinaryInstruction()
1152 return UndefValue::get(C1->getType()); // too big shift is undef in ConstantFoldBinaryInstruction()
1164 if (CI1->equalsInt(0)) return C1; in ConstantFoldBinaryInstruction()
1169 } else if (ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) { in ConstantFoldBinaryInstruction()
1179 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1182 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1185 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1188 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1191 return ConstantFP::get(C1->getContext(), C3V); in ConstantFoldBinaryInstruction()
1194 } else if (VectorType *VTy = dyn_cast<VectorType>(C1->getType())) { in ConstantFoldBinaryInstruction()
1200 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i)); in ConstantFoldBinaryInstruction()
1210 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1226 return ConstantFoldBinaryInstruction(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1230 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldBinaryInstruction()
1234 return ConstantExpr::getXor(C1, C2); in ConstantFoldBinaryInstruction()
1236 return ConstantExpr::getAnd(C1, C2); in ConstantFoldBinaryInstruction()
1242 return C1; in ConstantFoldBinaryInstruction()
1247 return C1; in ConstantFoldBinaryInstruction()
1252 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldBinaryInstruction()
1286 static int IdxCompare(Constant *C1, Constant *C2, Type *ElTy) { in IdxCompare() argument
1287 if (C1 == C2) return 0; in IdxCompare()
1291 if (!isa<ConstantInt>(C1) || !isa<ConstantInt>(C2)) in IdxCompare()
1295 if (cast<ConstantInt>(C1)->getValue().getActiveBits() > 64 || in IdxCompare()
1301 int64_t C1Val = cast<ConstantInt>(C1)->getSExtValue(); in IdxCompare()
1660 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction() argument
1662 if (VectorType *VT = dyn_cast<VectorType>(C1->getType())) in ConstantFoldCompareInstruction()
1663 ResultTy = VectorType::get(Type::getInt1Ty(C1->getContext()), in ConstantFoldCompareInstruction()
1666 ResultTy = Type::getInt1Ty(C1->getContext()); in ConstantFoldCompareInstruction()
1676 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) { in ConstantFoldCompareInstruction()
1682 if (ICmpInst::isEquality(Predicate) || (isIntegerPredicate && C1 == C2)) in ConstantFoldCompareInstruction()
1696 if (C1->isNullValue()) { in ConstantFoldCompareInstruction()
1701 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldCompareInstruction()
1703 return ConstantInt::getTrue(C1->getContext()); in ConstantFoldCompareInstruction()
1707 if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1)) in ConstantFoldCompareInstruction()
1711 return ConstantInt::getFalse(C1->getContext()); in ConstantFoldCompareInstruction()
1713 return ConstantInt::getTrue(C1->getContext()); in ConstantFoldCompareInstruction()
1718 if (C1->getType()->isIntegerTy(1)) { in ConstantFoldCompareInstruction()
1722 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2)); in ConstantFoldCompareInstruction()
1723 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2); in ConstantFoldCompareInstruction()
1725 return ConstantExpr::getXor(C1, C2); in ConstantFoldCompareInstruction()
1731 if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) { in ConstantFoldCompareInstruction()
1732 APInt V1 = cast<ConstantInt>(C1)->getValue(); in ConstantFoldCompareInstruction()
1747 } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) { in ConstantFoldCompareInstruction()
1748 APFloat C1V = cast<ConstantFP>(C1)->getValueAPF(); in ConstantFoldCompareInstruction()
1790 } else if (C1->getType()->isVectorTy()) { in ConstantFoldCompareInstruction()
1794 Type *Ty = IntegerType::get(C1->getContext(), 32); in ConstantFoldCompareInstruction()
1796 for (unsigned i = 0, e = C1->getType()->getVectorNumElements(); i != e;++i){ in ConstantFoldCompareInstruction()
1798 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i)); in ConstantFoldCompareInstruction()
1808 if (C1->getType()->isFloatingPointTy() && in ConstantFoldCompareInstruction()
1811 (isa<ConstantExpr>(C1) || isa<ConstantExpr>(C2))) { in ConstantFoldCompareInstruction()
1813 switch (evaluateFCmpRelation(C1, C2)) { in ConstantFoldCompareInstruction()
1872 switch (evaluateICmpRelation(C1, C2, in ConstantFoldCompareInstruction()
1947 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); in ConstantFoldCompareInstruction()
1953 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldCompareInstruction()
1970 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || in ConstantFoldCompareInstruction()
1971 (C1->isNullValue() && !C2->isNullValue())) { in ConstantFoldCompareInstruction()
1976 return ConstantExpr::getICmp(pred, C2, C1); in ConstantFoldCompareInstruction()
2122 Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, CommonTy); in ConstantFoldGetElementPtrImpl() local
2124 Combined = ConstantExpr::get(Instruction::Add, C1, C2); in ConstantFoldGetElementPtrImpl()