Lines Matching full:constant
34 "Force function specialization for every call site with a constant "
92 "funcspec-for-literal-constant", cl::init(false), cl::Hidden, cl::desc(
93 "Enable specialization of functions that take a literal constant as an "
106 // Estimates the codesize savings due to dead code after constant propagation.
130 // If it's a known constant we have already accounted for it. in estimateBasicBlocks()
151 static Constant *findConstantFor(Value *V, ConstMap &KnownConstants) { in findConstantFor()
152 if (auto *C = dyn_cast<Constant>(V)) in findConstantFor()
168 /// Compute a bonus for replacing argument \p A with constant \p C.
169 Bonus InstCostVisitor::getSpecializationBonus(Argument *A, Constant *C) { in getSpecializationBonus()
170 LLVM_DEBUG(dbgs() << "FnSpecialization: Analysing bonus for constant: " in getSpecializationBonus()
184 Bonus InstCostVisitor::getUserBonus(Instruction *User, Value *Use, Constant *C) { in getUserBonus()
185 // We have already propagated a constant for this user. in getUserBonus()
205 // with a constant, unlike any other instruction type, it prevents estimating in getUserBonus()
273 Constant *Const, PHINode *Root, DenseSet<PHINode *> &TransitivePHIs) { in discoverTransitivelyIncomingValues()
297 if (Constant *C = findConstantFor(V, KnownConstants)) { in discoverTransitivelyIncomingValues()
298 // Not all incoming values are the same constant. Bail immediately. in discoverTransitivelyIncomingValues()
316 Constant *InstCostVisitor::visitPHINode(PHINode &I) { in visitPHINode()
321 Constant *Const = nullptr; in visitPHINode()
332 if (Constant *C = findConstantFor(V, KnownConstants)) { in visitPHINode()
335 // Not all incoming values are the same constant. Bail immediately. in visitPHINode()
343 // all the constant arguments have been propagated. Bail for now. in visitPHINode()
371 Constant *InstCostVisitor::visitFreezeInst(FreezeInst &I) { in visitFreezeInst()
379 Constant *InstCostVisitor::visitCallBase(CallBase &I) { in visitCallBase()
384 SmallVector<Constant *, 8> Operands; in visitCallBase()
389 Constant *C = findConstantFor(V, KnownConstants); in visitCallBase()
399 Constant *InstCostVisitor::visitLoadInst(LoadInst &I) { in visitLoadInst()
407 Constant *InstCostVisitor::visitGetElementPtrInst(GetElementPtrInst &I) { in visitGetElementPtrInst()
408 SmallVector<Constant *, 8> Operands; in visitGetElementPtrInst()
413 Constant *C = findConstantFor(V, KnownConstants); in visitGetElementPtrInst()
423 Constant *InstCostVisitor::visitSelectInst(SelectInst &I) { in visitSelectInst()
431 Constant *C = findConstantFor(V, KnownConstants); in visitSelectInst()
435 Constant *InstCostVisitor::visitCastInst(CastInst &I) { in visitCastInst()
440 Constant *InstCostVisitor::visitCmpInst(CmpInst &I) { in visitCmpInst()
445 Constant *Other = findConstantFor(V, KnownConstants); in visitCmpInst()
449 Constant *Const = LastVisited->second; in visitCmpInst()
455 Constant *InstCostVisitor::visitUnaryOperator(UnaryOperator &I) { in visitUnaryOperator()
461 Constant *InstCostVisitor::visitBinaryOperator(BinaryOperator &I) { in visitBinaryOperator()
466 Constant *Other = findConstantFor(V, KnownConstants); in visitBinaryOperator()
470 Constant *Const = LastVisited->second; in visitBinaryOperator()
471 return dyn_cast_or_null<Constant>(Swap ? in visitBinaryOperator()
476 Constant *FunctionSpecializer::getPromotableAlloca(AllocaInst *Alloca, in getPromotableAlloca()
507 // A constant stack value is an AllocaInst that has a single constant
508 // value stored to it. Return this constant if such an alloca stack value
510 Constant *FunctionSpecializer::getConstantStackValue(CallInst *Call, in getConstantStackValue()
524 // constant arguments because after a first iteration of specialisation, a
534 // Before a next iteration, we need to propagate the constant like so
537 // @funcspec.arg = internal constant i32 2
544 // See if there are any new constant values for the callers of \p F via
623 /// Attempt to specialize functions in the module to enable constant
846 // constant operands of this call site. in findSpecializations()
849 Constant *C = getCandidateConstant(CS.getArgOperand(A->getArgNo())); in findSpecializations()
969 // marking the argument on which we specialized the function constant in createSpecialization()
983 /// Compute the inlining bonus for replacing argument \p A with constant \p C.
987 unsigned FunctionSpecializer::getInliningBonus(Argument *A, Constant *C) { in getInliningBonus()
1038 /// Determine if it is possible to specialise the function for constant values
1061 // is already a constant. in isArgumentInteresting()
1072 << A->getNameOrAsOperand() << " is already constant\n"; in isArgumentInteresting()
1077 /// Check if the value \p V (an actual argument) is a constant or can only
1078 /// have a constant value. Return that constant.
1079 Constant *FunctionSpecializer::getCandidateConstant(Value *V) { in getCandidateConstant()
1084 // are deduced to be constants or constant ranges with a single element. in getCandidateConstant()
1085 Constant *C = dyn_cast<Constant>(V); in getCandidateConstant()
1089 // Don't specialize on (anything derived from) the address of a non-constant in getCandidateConstant()