Lines Matching refs:ConstantExpr
12 // ConstantExpr::get* methods to automatically fold constants when possible.
62 ConstantExpr::getExtractElement(CV, ConstantInt::get(Ty, i));
63 C = ConstantExpr::getBitCast(C, DstEltTy);
77 ConstantExpr *Op, ///< the first cast constant expression
132 return ConstantExpr::getInBoundsGetElementPtr(V, IdxList);
154 return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy);
217 ConstantExpr *CE = dyn_cast<ConstantExpr>(C);
235 return ConstantExpr::getOr(LHS, RHS);
249 return ConstantExpr::getAnd(LHS, RHS);
319 Res = ConstantExpr::getLShr(Res,
321 return ConstantExpr::getTrunc(Res, IntegerType::get(C->getContext(),
331 /// getFoldedSizeOf - Return a ConstantExpr with type DestTy for sizeof
341 return ConstantExpr::getNUWMul(E, N);
349 return ConstantExpr::getNullValue(DestTy);
362 return ConstantExpr::getNUWMul(MemberSize, N);
381 Constant *C = ConstantExpr::getSizeOf(Ty);
382 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
388 /// getFoldedAlignOf - Return a ConstantExpr with type DestTy for alignof
398 Constant *C = ConstantExpr::getAlignOf(ATy->getElementType());
399 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
447 Constant *C = ConstantExpr::getAlignOf(Ty);
448 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
454 /// getFoldedOffsetOf - Return a ConstantExpr with type DestTy for offsetof
463 Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, false,
467 return ConstantExpr::getNUWMul(E, N);
487 Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo,
492 return ConstantExpr::getNUWMul(MemberSize, N);
502 Constant *C = ConstantExpr::getOffsetOf(Ty, FieldNo);
503 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
526 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
530 return ConstantExpr::getCast(newOpc, CE->getOperand(0), DestTy);
542 return ConstantExpr::getPointerCast(CE->getOperand(0), DestTy);
558 ConstantExpr::getExtractElement(V, ConstantInt::get(Ty, i));
559 res.push_back(ConstantExpr::getCast(opc, C, DstEltTy));
609 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
619 Idx = ConstantExpr::getCast(CastInst::getCastOpcode(Idx, true,
622 return ConstantExpr::getMul(C, Idx);
679 // The input must be a constantexpr. See if we can simplify this based on
709 Constant *Res = ConstantExpr::getExtractElement(V, ConstantInt::get(Ty, i));
726 if (ConstantExpr *TrueVal = dyn_cast<ConstantExpr>(V1)) {
729 return ConstantExpr::getSelect(Cond, TrueVal->getOperand(1), V2);
731 if (ConstantExpr *FalseVal = dyn_cast<ConstantExpr>(V2)) {
734 return ConstantExpr::getSelect(Cond, V1, FalseVal->getOperand(2));
776 ConstantExpr::getExtractElement(Val, ConstantInt::get(Ty, i));
794 if (isa<ConstantExpr>(Mask)) return 0;
812 ConstantExpr::getExtractElement(V2,
816 InElt = ConstantExpr::getExtractElement(V1, ConstantInt::get(Ty, Elt));
969 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1010 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1019 return ConstantExpr::getCompare(pred, CE1->getOperand(0),
1026 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1))
1028 return ConstantExpr::getLShr(C1, C2);
1034 return ConstantExpr::get(Opcode, C2, C1);
1141 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i));
1143 ConstantExpr::getExtractElement(C2, ConstantInt::get(Ty, i));
1145 Result.push_back(ConstantExpr::get(Opcode, LHS, RHS));
1151 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1159 Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2);
1160 if (!isa<ConstantExpr>(T) || cast<ConstantExpr>(T)->getOpcode() != Opcode)
1161 return ConstantExpr::get(Opcode, CE1->getOperand(0), T);
1163 } else if (isa<ConstantExpr>(C2)) {
1175 return ConstantExpr::getXor(C1, C2);
1177 return ConstantExpr::getAnd(C1, C2);
1238 C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(C1->getContext()));
1241 C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(C1->getContext()));
1277 if (!isa<ConstantExpr>(V1)) {
1278 if (!isa<ConstantExpr>(V2)) {
1282 ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, V1, V2));
1286 ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, V1, V2));
1290 ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, V1, V2));
1298 // If the first operand is simple and second is ConstantExpr, swap operands.
1303 // Ok, the LHS is known to be a constantexpr. The RHS can be any of a
1304 // constantexpr or a simple constant.
1305 ConstantExpr *CE1 = cast<ConstantExpr>(V1);
1332 /// GlobalValues, followed by ConstantExpr's (the most complex).
1340 if (!isa<ConstantExpr>(V1) && !isa<GlobalValue>(V1) &&
1342 if (!isa<GlobalValue>(V2) && !isa<ConstantExpr>(V2) &&
1348 R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2));
1352 R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2));
1356 R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2));
1371 if (isa<ConstantExpr>(V2)) { // Swap as necessary.
1397 if (isa<ConstantExpr>(V2)) { // Swap as necessary.
1421 // Ok, the LHS is known to be a constantexpr. The RHS can be any of a
1422 // constantexpr, a global, block address, or a simple constant.
1423 ConstantExpr *CE1 = cast<ConstantExpr>(V1);
1503 ConstantExpr *CE2 = cast<ConstantExpr>(V2);
1625 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2));
1626 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2);
1628 return ConstantExpr::getXor(C1, C2);
1701 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i));
1703 ConstantExpr::getExtractElement(C2, ConstantInt::get(Ty, i));
1705 ResElts.push_back(ConstantExpr::getCompare(pred, C1E, C2E));
1842 if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(C2)) {
1846 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType());
1847 return ConstantExpr::getICmp(pred, Inverse, CE2Op0);
1852 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1856 Constant *CE1Inverse = ConstantExpr::getTrunc(CE1, CE1Op0->getType());
1859 Constant *C2Inverse = ConstantExpr::getTrunc(C2, CE1Op0->getType());
1860 if (ConstantExpr::getZExt(C2Inverse, C2->getType()) == C2) {
1861 return ConstantExpr::getICmp(pred, CE1Inverse, C2Inverse);
1867 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) ||
1873 return ConstantExpr::getICmp(pred, C2, C1);
1931 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
1956 Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Int64Ty);
1957 Constant *C2 = ConstantExpr::getSExtOrBitCast(Combined, Int64Ty);
1958 Combined = ConstantExpr::get(Instruction::Add, C1, C2);
1961 ConstantExpr::get(Instruction::Add, Idx0, Combined);
1968 ConstantExpr::getGetElementPtr(CE->getOperand(0), NewIndices,
1995 return ConstantExpr::getGetElementPtr((Constant*)CE->getOperand(0),
2021 NewIdxs[i] = ConstantExpr::getSRem(CI, Factor);
2024 Constant *Div = ConstantExpr::getSDiv(CI, Factor);
2029 PrevIdx = ConstantExpr::getSExt(PrevIdx,
2032 Div = ConstantExpr::getSExt(Div,
2035 NewIdxs[i-1] = ConstantExpr::getAdd(PrevIdx, Div);
2052 return ConstantExpr::getGetElementPtr(C, NewIdxs, inBounds);
2059 return ConstantExpr::getInBoundsGetElementPtr(C, Idxs);