Lines Matching refs:ConstantExpr
12 // Also, to supplement the basic IR ConstantExpr simplifications,
46 /// ConstantExpr if unfoldable.
59 return ConstantExpr::getBitCast(C, DestTy);
71 C = ConstantExpr::getBitCast(C, SrcIVTy);
76 return ConstantExpr::getBitCast(C, DestTy);
96 return ConstantExpr::getBitCast(C, DestTy);
107 return ConstantExpr::getBitCast(C, DestTy);
113 return ConstantExpr::getBitCast(C, DestTy);
137 return ConstantExpr::getBitCast(C, DestTy);
147 C = ConstantExpr::getBitCast(C, SrcIVTy);
173 if (!Src) // Reject constantexpr elements.
174 return ConstantExpr::getBitCast(C, DestTy);
177 Src = ConstantExpr::getZExt(Src, Elt->getType());
180 Src = ConstantExpr::getShl(Src,
185 Elt = ConstantExpr::getOr(Elt, Src);
199 if (!Src) // Reject constantexpr elements.
200 return ConstantExpr::getBitCast(C, DestTy);
206 Constant *Elt = ConstantExpr::getLShr(Src,
211 Result.push_back(ConstantExpr::getTrunc(Elt, DstEltTy));
231 ConstantExpr *CE = dyn_cast<ConstantExpr>(C);
367 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
465 ConstantExpr *CE = dyn_cast<ConstantExpr>(C);
506 Res = ConstantExpr::getBitCast(Res, Ty);
613 NewIdxs.push_back(ConstantExpr::getCast(CastInst::getCastOpcode(Ops[i],
624 ConstantExpr::getGetElementPtr(Ops[0], NewIdxs);
625 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
642 Ptr = ConstantExpr::getBitCast(Ptr, NewPtrTy);
668 ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[1]);
673 Constant *Res = ConstantExpr::getPtrToInt(Ptr, CE->getType());
674 Res = ConstantExpr::getSub(Res, CE->getOperand(1));
675 Res = ConstantExpr::getIntToPtr(Res, ResultTy);
676 if (ConstantExpr *ResCE = dyn_cast<ConstantExpr>(Res))
715 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
721 return ConstantExpr::getIntToPtr(C, ResultTy);
790 ConstantExpr::getGetElementPtr(Ptr, NewIdxs);
833 if (ConstantExpr *NewC = dyn_cast<ConstantExpr>(C))
856 if (ConstantExpr *NewCE = dyn_cast<ConstantExpr>(Op))
870 return ConstantExpr::getInsertValue(
876 return ConstantExpr::getExtractValue(
886 Constant *llvm::ConstantFoldConstantExpression(const ConstantExpr *CE,
893 // Recursively fold the ConstantExpr's operands.
894 if (ConstantExpr *NewCE = dyn_cast<ConstantExpr>(NewC))
921 if (isa<ConstantExpr>(Ops[0]) || isa<ConstantExpr>(Ops[1]))
925 return ConstantExpr::get(Opcode, Ops[0], Ops[1]);
939 // the width of a pointer, so it can't be done in ConstantExpr::getCast.
940 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0])) {
948 Input = ConstantExpr::getAnd(Input, Mask);
951 return ConstantExpr::getIntegerCast(Input, DestTy, false);
954 return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
958 // pointer, so it can't be done in ConstantExpr::getCast.
959 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0]))
965 return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
975 return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
979 return ConstantExpr::getBitCast(Ops[0], DestTy);
981 return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2]);
983 return ConstantExpr::getExtractElement(Ops[0], Ops[1]);
985 return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2]);
987 return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]);
994 return ConstantExpr::getGetElementPtr(Ops[0], Ops.slice(1));
1011 // ConstantExpr::getCompare cannot do this, because it doesn't have TD
1013 if (ConstantExpr *CE0 = dyn_cast<ConstantExpr>(Ops0)) {
1019 Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0),
1035 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(Ops1)) {
1042 Constant *C0 = ConstantExpr::getIntegerCast(CE0->getOperand(0),
1044 Constant *C1 = ConstantExpr::getIntegerCast(CE1->getOperand(0),
1076 return ConstantExpr::getCompare(Predicate, Ops0, Ops1);
1081 /// getelementptr constantexpr, return the constant value being addressed by the
1084 ConstantExpr *CE) {