Home | History | Annotate | Download | only in IR

Lines Matching refs:cast

49   // If this cast changes element count then we can't handle it here:
70 /// This function determines which opcode to use to fold two constant cast
73 /// @brief Determine if it is valid to fold a cast of a cast
76 unsigned opc, ///< opcode of the second cast constant expression
77 ConstantExpr *Op, ///< the first cast constant expression
78 Type *DstTy ///< destination type of the first cast
80 assert(Op && Op->isCast() && "Can't fold cast of cast without a cast!");
81 assert(DstTy && DstTy->isFirstClassType() && "Invalid cast destination type");
82 assert(CastInst::isCast(opc) && "Invalid cast opcode");
84 // The types and opcodes for the two Cast constant expressions
103 return V; // no-op cast
138 // and dest type have the same size (otherwise its an illegal cast).
142 "Not cast between same sized vectors!");
161 if (isa<ConstantPointerNull>(V)) // ptr->ptr cast.
162 return ConstantPointerNull::get(cast<PointerType>(DestTy));
215 (cast<IntegerType>(C->getType())->getBitWidth() & 7) == 0 &&
217 unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
313 cast<IntegerType>(CE->getOperand(0)->getType())->getBitWidth();
538 // If the cast operand is a constant expression, there's a few things we can
542 // Try hard to fold cast of cast because they are often eliminable.
550 // adjustment going on. We might as well cast the source pointer.
563 // If the cast operand is a constant vector, perform the cast by
564 // operating on each element. In the cast of bitcasts, the element
570 VectorType *DestVecTy = cast<VectorType>(DestTy);
581 // We actually have to do a cast now. Perform the cast according to the
585 llvm_unreachable("Failed to cast constant expression");
608 uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
622 return ConstantPointerNull::get(cast<PointerType>(DestTy));
634 GEPOperator *GEPO = cast<GEPOperator>(CE);
639 bool isOne = isa<ConstantInt>(Idx) && cast<ConstantInt>(Idx)->isOne();
651 ConstantInt *CI = cast<ConstantInt>(CE->getOperand(2));
686 uint32_t BitWidth = cast<IntegerType>(DestTy)->getBitWidth();
693 uint32_t BitWidth = cast<IntegerType>(DestTy)->getBitWidth();
702 uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
712 (cast<IntegerType>(V->getType())->getBitWidth() & 7) == 0)
1065 GlobalValue *GV = cast<GlobalValue>(CE1->getOperand(0));
1232 if (!isa<ConstantExpr>(T) || cast<ConstantExpr>(T)->getOpcode() != Opcode)
1308 if (cast<ConstantInt>(C1)->getValue().getActiveBits() > 64 ||
1309 cast<ConstantInt>(C2)->getValue().getActiveBits() > 64)
1314 int64_t C1Val = cast<ConstantInt>(C1)->getSExtValue();
1315 int64_t C2Val = cast<ConstantInt>(C2)->getSExtValue();
1378 ConstantExpr *CE1 = cast<ConstantExpr>(V1);
1517 ConstantExpr *CE1 = cast<ConstantExpr>(V1);
1537 // If the cast is not actually changing bits, and the second operand is a
1550 GEPOperator *CE1GEP = cast<GEPOperator>(CE1);
1603 ConstantExpr *CE2 = cast<ConstantExpr>(V2);
1616 GEPOperator *CE2GEP = cast<GEPOperator>(CE2);
1618 return areGlobalsPotentiallyEqual(cast<GlobalValue>(CE1Op0),
1619 cast<GlobalValue>(CE2Op0));
1749 const APInt &V1 = cast<ConstantInt>(C1)->getValue();
1750 const APInt &V2 = cast<ConstantInt>(C2)->getValue();
1765 const APFloat &C1V = cast<ConstantFP>(C1)->getValueAPF();
1766 const APFloat &C2V = cast<ConstantFP>(C2)->getValueAPF();
2006 if (cast<Constant>(Idxs[0])->isNullValue()) return true;
2010 if (!cast<ConstantInt>(Idxs[0])->isOne())
2013 if (!cast<Constant>(Idxs[i])->isNullValue())
2054 Constant *Idx0 = cast<Constant>(Idxs[0]);
2059 PointerType *PtrTy = cast<PointerType>(C->getType()->getScalarType());
2071 if (!cast<Constant>(Idxs[i])->isNullValue()) {
2076 PointerType *PtrTy = cast<PointerType>(C->getType()->getScalarType());
2154 cast<GEPOperator>(CE)->getSourceElementType(), CE->getOperand(0),
2155 NewIndices, inBounds && cast<GEPOperator>(CE)->isInBounds());
2167 // Don't fold if the cast is changing address spaces.
2194 Prev = Ty, Ty = cast<CompositeType>(Ty)->getTypeAtIndex(Idxs[i]), ++i) {
2205 auto *STy = cast<SequentialType>(Ty);
2239 Constant *PrevIdx = cast<Constant>(Idxs[i - 1]);
2262 if (!NewIdxs[i]) NewIdxs[i] = cast<Constant>(Idxs[i]);