Lines Matching refs:ConstantExpr
68 Result.push_back(ConstantExpr::getBitCast(CV->getOperand(i), in BitCastConstantVector()
80 ConstantExpr *Op, ///< the first cast constant expression in foldConstantCastPair()
130 return ConstantExpr::getInBoundsGetElementPtr(V, &IdxList[0], in FoldBitCast()
153 return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy); in FoldBitCast()
216 ConstantExpr *CE = dyn_cast<ConstantExpr>(C); in ExtractConstantBytes()
234 return ConstantExpr::getOr(LHS, RHS); in ExtractConstantBytes()
248 return ConstantExpr::getAnd(LHS, RHS); in ExtractConstantBytes()
318 Res = ConstantExpr::getLShr(Res, in ExtractConstantBytes()
320 return ConstantExpr::getTrunc(Res, IntegerType::get(C->getContext(), in ExtractConstantBytes()
340 return ConstantExpr::getNUWMul(E, N); in getFoldedSizeOf()
348 return ConstantExpr::getNullValue(DestTy); in getFoldedSizeOf()
361 return ConstantExpr::getNUWMul(MemberSize, N); in getFoldedSizeOf()
380 Constant *C = ConstantExpr::getSizeOf(Ty); in getFoldedSizeOf()
381 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false, in getFoldedSizeOf()
397 Constant *C = ConstantExpr::getAlignOf(ATy->getElementType()); in getFoldedAlignOf()
398 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false, in getFoldedAlignOf()
446 Constant *C = ConstantExpr::getAlignOf(Ty); in getFoldedAlignOf()
447 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false, in getFoldedAlignOf()
462 Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, false, in getFoldedOffsetOf()
466 return ConstantExpr::getNUWMul(E, N); in getFoldedOffsetOf()
486 Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, in getFoldedOffsetOf()
491 return ConstantExpr::getNUWMul(MemberSize, N); in getFoldedOffsetOf()
501 Constant *C = ConstantExpr::getOffsetOf(Ty, FieldNo); in getFoldedOffsetOf()
502 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false, in getFoldedOffsetOf()
529 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) { in ConstantFoldCastInstruction()
533 return ConstantExpr::getCast(newOpc, CE->getOperand(0), DestTy); in ConstantFoldCastInstruction()
545 return ConstantExpr::getPointerCast(CE->getOperand(0), DestTy); in ConstantFoldCastInstruction()
560 res.push_back(ConstantExpr::getCast(opc, in ConstantFoldCastInstruction()
608 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) in ConstantFoldCastInstruction()
618 Idx = ConstantExpr::getCast(CastInst::getCastOpcode(Idx, true, in ConstantFoldCastInstruction()
621 return ConstantExpr::getMul(C, Idx); in ConstantFoldCastInstruction()
741 if (ConstantExpr *TrueVal = dyn_cast<ConstantExpr>(V1)) { in ConstantFoldSelectInstruction()
744 return ConstantExpr::getSelect(Cond, TrueVal->getOperand(1), V2); in ConstantFoldSelectInstruction()
746 if (ConstantExpr *FalseVal = dyn_cast<ConstantExpr>(V2)) { in ConstantFoldSelectInstruction()
749 return ConstantExpr::getSelect(Cond, V1, FalseVal->getOperand(2)); in ConstantFoldSelectInstruction()
1101 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1142 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1151 return ConstantExpr::getCompare(pred, CE1->getOperand(0), in ConstantFoldBinaryInstruction()
1158 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) in ConstantFoldBinaryInstruction()
1160 return ConstantExpr::getLShr(C1, C2); in ConstantFoldBinaryInstruction()
1166 return ConstantExpr::get(Opcode, C2, C1); in ConstantFoldBinaryInstruction()
1284 Res.push_back(ConstantExpr::getAdd(C1, C2)); in ConstantFoldBinaryInstruction()
1291 Res.push_back(ConstantExpr::getFAdd(C1, C2)); in ConstantFoldBinaryInstruction()
1298 Res.push_back(ConstantExpr::getSub(C1, C2)); in ConstantFoldBinaryInstruction()
1305 Res.push_back(ConstantExpr::getFSub(C1, C2)); in ConstantFoldBinaryInstruction()
1312 Res.push_back(ConstantExpr::getMul(C1, C2)); in ConstantFoldBinaryInstruction()
1319 Res.push_back(ConstantExpr::getFMul(C1, C2)); in ConstantFoldBinaryInstruction()
1326 Res.push_back(ConstantExpr::getUDiv(C1, C2)); in ConstantFoldBinaryInstruction()
1333 Res.push_back(ConstantExpr::getSDiv(C1, C2)); in ConstantFoldBinaryInstruction()
1340 Res.push_back(ConstantExpr::getFDiv(C1, C2)); in ConstantFoldBinaryInstruction()
1347 Res.push_back(ConstantExpr::getURem(C1, C2)); in ConstantFoldBinaryInstruction()
1354 Res.push_back(ConstantExpr::getSRem(C1, C2)); in ConstantFoldBinaryInstruction()
1361 Res.push_back(ConstantExpr::getFRem(C1, C2)); in ConstantFoldBinaryInstruction()
1368 Res.push_back(ConstantExpr::getAnd(C1, C2)); in ConstantFoldBinaryInstruction()
1375 Res.push_back(ConstantExpr::getOr(C1, C2)); in ConstantFoldBinaryInstruction()
1382 Res.push_back(ConstantExpr::getXor(C1, C2)); in ConstantFoldBinaryInstruction()
1389 Res.push_back(ConstantExpr::getLShr(C1, C2)); in ConstantFoldBinaryInstruction()
1396 Res.push_back(ConstantExpr::getAShr(C1, C2)); in ConstantFoldBinaryInstruction()
1403 Res.push_back(ConstantExpr::getShl(C1, C2)); in ConstantFoldBinaryInstruction()
1410 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldBinaryInstruction()
1418 Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2); in ConstantFoldBinaryInstruction()
1419 if (!isa<ConstantExpr>(T) || cast<ConstantExpr>(T)->getOpcode() != Opcode) in ConstantFoldBinaryInstruction()
1420 return ConstantExpr::get(Opcode, CE1->getOperand(0), T); in ConstantFoldBinaryInstruction()
1422 } else if (isa<ConstantExpr>(C2)) { in ConstantFoldBinaryInstruction()
1434 return ConstantExpr::getXor(C1, C2); in ConstantFoldBinaryInstruction()
1436 return ConstantExpr::getAnd(C1, C2); in ConstantFoldBinaryInstruction()
1497 C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(C1->getContext())); in IdxCompare()
1500 C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(C1->getContext())); in IdxCompare()
1540 if (!isa<ConstantExpr>(V1)) { in evaluateFCmpRelation()
1541 if (!isa<ConstantExpr>(V2)) { in evaluateFCmpRelation()
1545 ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, V1, V2)); in evaluateFCmpRelation()
1549 ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, V1, V2)); in evaluateFCmpRelation()
1553 ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, V1, V2)); in evaluateFCmpRelation()
1568 ConstantExpr *CE1 = cast<ConstantExpr>(V1); in evaluateFCmpRelation()
1603 if (!isa<ConstantExpr>(V1) && !isa<GlobalValue>(V1) && in evaluateICmpRelation()
1605 if (!isa<GlobalValue>(V2) && !isa<ConstantExpr>(V2) && in evaluateICmpRelation()
1611 R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2)); in evaluateICmpRelation()
1615 R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2)); in evaluateICmpRelation()
1619 R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2)); in evaluateICmpRelation()
1634 if (isa<ConstantExpr>(V2)) { // Swap as necessary. in evaluateICmpRelation()
1660 if (isa<ConstantExpr>(V2)) { // Swap as necessary. in evaluateICmpRelation()
1686 ConstantExpr *CE1 = cast<ConstantExpr>(V1); in evaluateICmpRelation()
1767 ConstantExpr *CE2 = cast<ConstantExpr>(V2); in evaluateICmpRelation()
1893 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2)); in ConstantFoldCompareInstruction()
1894 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2); in ConstantFoldCompareInstruction()
1896 return ConstantExpr::getXor(C1, C2); in ConstantFoldCompareInstruction()
1973 ResElts.push_back(ConstantExpr::getCompare(pred, C1Elts[i], C2Elts[i])); in ConstantFoldCompareInstruction()
2109 if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(C2)) { in ConstantFoldCompareInstruction()
2113 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); in ConstantFoldCompareInstruction()
2114 return ConstantExpr::getICmp(pred, Inverse, CE2Op0); in ConstantFoldCompareInstruction()
2119 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) { in ConstantFoldCompareInstruction()
2123 Constant *CE1Inverse = ConstantExpr::getTrunc(CE1, CE1Op0->getType()); in ConstantFoldCompareInstruction()
2126 Constant *C2Inverse = ConstantExpr::getTrunc(C2, CE1Op0->getType()); in ConstantFoldCompareInstruction()
2127 if (ConstantExpr::getZExt(C2Inverse, C2->getType()) == C2) { in ConstantFoldCompareInstruction()
2128 return ConstantExpr::getICmp(pred, CE1Inverse, C2Inverse); in ConstantFoldCompareInstruction()
2134 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || in ConstantFoldCompareInstruction()
2140 return ConstantExpr::getICmp(pred, C2, C1); in ConstantFoldCompareInstruction()
2199 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { in ConstantFoldGetElementPtrImpl()
2224 Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Int64Ty); in ConstantFoldGetElementPtrImpl()
2225 Constant *C2 = ConstantExpr::getSExtOrBitCast(Combined, Int64Ty); in ConstantFoldGetElementPtrImpl()
2226 Combined = ConstantExpr::get(Instruction::Add, C1, C2); in ConstantFoldGetElementPtrImpl()
2229 ConstantExpr::get(Instruction::Add, Idx0, Combined); in ConstantFoldGetElementPtrImpl()
2236 ConstantExpr::getInBoundsGetElementPtr(CE->getOperand(0), in ConstantFoldGetElementPtrImpl()
2239 ConstantExpr::getGetElementPtr(CE->getOperand(0), in ConstantFoldGetElementPtrImpl()
2258 ConstantExpr::getInBoundsGetElementPtr( in ConstantFoldGetElementPtrImpl()
2260 ConstantExpr::getGetElementPtr( in ConstantFoldGetElementPtrImpl()
2285 NewIdxs[i] = ConstantExpr::getSRem(CI, Factor); in ConstantFoldGetElementPtrImpl()
2288 Constant *Div = ConstantExpr::getSDiv(CI, Factor); in ConstantFoldGetElementPtrImpl()
2293 PrevIdx = ConstantExpr::getSExt(PrevIdx, in ConstantFoldGetElementPtrImpl()
2296 Div = ConstantExpr::getSExt(Div, in ConstantFoldGetElementPtrImpl()
2299 NewIdxs[i-1] = ConstantExpr::getAdd(PrevIdx, Div); in ConstantFoldGetElementPtrImpl()
2317 ConstantExpr::getInBoundsGetElementPtr(C, NewIdxs.data(), in ConstantFoldGetElementPtrImpl()
2319 ConstantExpr::getGetElementPtr(C, NewIdxs.data(), NewIdxs.size()); in ConstantFoldGetElementPtrImpl()
2326 return ConstantExpr::getInBoundsGetElementPtr(C, Idxs.data(), Idxs.size()); in ConstantFoldGetElementPtrImpl()