Lines Matching refs:Constant
24 // 1. If a binary operator has a constant operand, it is moved to the RHS
25 // 2. Bitwise operators with constant operands are always grouped so that
30 // 6. Multiplies with a power-of-two constant argument are transformed into
72 STATISTIC(NumConstProp, "Number of constant folds");
118 // where both B and C should be ConstantInts, results in a constant that does
300 isa<Constant>(Op0->getOperand(1)) &&
301 isa<Constant>(Op1->getOperand(1)) &&
304 Constant *C1 = cast<Constant>(Op0->getOperand(1));
306 Constant *C2 = cast<Constant>(Op1->getOperand(1));
308 Constant *Folded = ConstantExpr::get(Opcode, C1, C2);
407 if (isa<Constant>(V))
440 if (Constant *CST = dyn_cast<Constant>(Op->getOperand(1))) {
666 /// constant zero (which is the 'negate' form).
683 /// a constant negative zero (which is the 'negate' form).
705 // Figure out if the constant is the left or the right argument.
706 bool ConstIsRHS = isa<Constant>(I.getOperand(1));
707 Constant *ConstOperand = cast<Constant>(I.getOperand(ConstIsRHS));
709 if (Constant *SOC = dyn_cast<Constant>(SO)) {
736 /// Given an instruction with a select as one operand and a constant as the
746 if (isa<Constant>(TV) || isa<Constant>(FV)) {
747 // Bool selects with constant operands can be folded to logical ops.
811 // (constantint/constantfp/undef). If there is one non-constant value,
813 // bail out. We don't do arbitrary constant expressions here because moving
818 if (isa<Constant>(InVal) && !isa<ConstantExpr>(InVal))
832 // If the incoming non-constant value is in I's block, we will remove one
839 // If there is exactly one non-constant value, we can insert a copy of the
872 Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i));
881 Constant *C = cast<Constant>(I.getOperand(1));
884 if (Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i)))
895 Constant *C = cast<Constant>(I.getOperand(1));
898 if (Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i)))
910 if (Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i)))
928 /// Given a pointer type and a constant offset, determine whether or not there
1017 // Look through chains of multiplications, searching for a constant that is
1019 // will find the constant factor 4 and produce X*(Y*Z). Descaling X*(Y*8) by
1053 // If Op is a constant divisible by Scale then descale to the quotient.
1074 // the scale, multiplication by a constant different to the scale, and
1080 // Multiplication by a constant.
1088 // Otherwise drill down into the constant.
1249 // If LHS and RHS are constant, BO won't be a binary operator.
1291 // If one argument is a shuffle within one vector, the other is a constant,
1294 Constant *C1 = nullptr;
1297 if (isa<Constant>(LHS)) C1 = cast<Constant>(LHS);
1298 if (isa<Constant>(RHS)) C1 = cast<Constant>(RHS);
1304 // Find constant C2 that has property:
1306 // If such constant does not exist (example: ShMask=<0,0> and C1=<1,2>)
1308 SmallVector<Constant*, 16> C2M(VWidth,
1322 Constant *C2 = ConstantVector::get(C2M);
1323 Value *NewLHS = isa<Constant>(LHS) ? C2 : Shuffle->getOperand(0);
1324 Value *NewRHS = isa<Constant>(LHS) ? Shuffle->getOperand(0) : C2;
1365 if (!isa<Constant>(*I) || !cast<Constant>(*I)->isNullValue()) {
1366 *I = Constant::getNullValue(NewIndexType);
1518 if (SO1 == Constant::getNullValue(SO1->getType())) {
1520 } else if (GO1 == Constant::getNullValue(GO1->getType())) {
1532 if (!isa<Constant>(GO1) || !isa<Constant>(SO1))
1546 } else if (isa<Constant>(*GEP.idx_begin()) &&
1547 cast<Constant>(*GEP.idx_begin())->isNullValue() &&
1696 Value *Idx[2] = { Constant::getNullValue(IdxType), GEP.getOperand(1) };
1772 Constant::getNullValue(DL.getIntPtrType(GEP.getType())),
1795 // Z = gep Y, <...constant indices...>
1803 /// Y = gep X, <...constant indices...>
2072 // determine the value. If so, constant fold it.
2077 RI.setOperand(0, Constant::getIntegerValue(VTy, KnownOne));
2088 !isa<Constant>(X)) {
2183 Constant *LHS = CaseVal;
2188 Constant* NewCaseVal = ConstantExpr::getSub(LHS, AddRHS);
2190 "Result of expression should be constant");
2281 // If the normal result of the add is dead, and the RHS is a constant,
2348 static bool isCatchAll(EHPersonality Personality, Constant *TypeInfo) {
2388 SmallVector<Constant *, 16> NewClauses; // - Clauses for the new instruction;
2396 Constant *CatchClause = LI.getClause(i);
2397 Constant *TypeInfo = CatchClause->stripPointerCasts();
2426 Constant *FilterClause = LI.getClause(i);
2442 SmallVector<Constant *, 16> NewFilterElts; // New elements.
2446 Constant *TypeInfo =
2447 Constant::getNullValue(FilterType->getElementType());
2470 Constant *Elt = Filter->getOperand(j);
2471 Constant *TypeInfo = Elt->stripPointerCasts();
2498 NewFilterElts.push_back(cast<Constant>(Elt));
2590 SmallVectorImpl<Constant *>::iterator J = NewClauses.begin() + j;
2740 // Instruction isn't dead, see if we can constant propagate it.
2742 (I->getNumOperands() == 0 || isa<Constant>(I->getOperand(0)))) {
2743 if (Constant *C = ConstantFoldInstruction(I, DL, TLI)) {
2763 Constant *C = ConstantInt::get(I->getContext(), KnownOne);
2883 /// particular, we constant fold and DCE instructions as we go, to avoid adding
2885 /// many instructions are dead or constant). Additionally, if we find a branch
2886 /// whose condition is a known constant, we only visit the reachable successors.
2897 DenseMap<ConstantExpr*, Constant*> FoldedConstants;
2917 // ConstantProp instruction if trivially constant.
2919 (Inst->getNumOperands() == 0 || isa<Constant>(Inst->getOperand(0))))
2920 if (Constant *C = ConstantFoldInstruction(Inst, DL, TLI)) {
2929 // See if we can constant fold its operands.
2936 Constant *&FoldRes = FoldedConstants[CE];
2952 // constant, only visit the reachable successor.
2995 /// This also does basic constant propagation and other forward fixing to make