Lines Matching refs:LVI

135 static bool processSelect(SelectInst *S, LazyValueInfo *LVI) {  in processSelect()  argument
139 Constant *C = LVI->getConstant(S->getCondition(), S); in processSelect()
165 static bool simplifyCommonValuePhi(PHINode *P, LazyValueInfo *LVI, in simplifyCommonValuePhi() argument
198 if (C != LVI->getConstantOnEdge(CommonValue, IncomingBB, ToBB, P)) in simplifyCommonValuePhi()
216 static Value *getValueOnEdge(LazyValueInfo *LVI, Value *Incoming, in getValueOnEdge() argument
219 if (Constant *C = LVI->getConstantOnEdge(Incoming, From, To, CxtI)) in getValueOnEdge()
234 if (Constant *C = LVI->getConstantOnEdge(Condition, From, To, CxtI)) { in getValueOnEdge()
249 if (LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C, From, To, CxtI) == in getValueOnEdge()
256 if (LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C, From, To, CxtI) == in getValueOnEdge()
263 static bool processPHI(PHINode *P, LazyValueInfo *LVI, DominatorTree *DT, in processPHI() argument
272 Value *V = getValueOnEdge(LVI, Incoming, P->getIncomingBlock(i), BB, P); in processPHI()
286 Changed = simplifyCommonValuePhi(P, LVI, DT); in processPHI()
294 static bool processMemAccess(Instruction *I, LazyValueInfo *LVI) { in processMemAccess() argument
303 Constant *C = LVI->getConstant(Pointer, I); in processMemAccess()
311 static bool processICmp(ICmpInst *Cmp, LazyValueInfo *LVI) { in processICmp() argument
325 Cmp->getPredicate(), LVI->getConstantRange(Cmp->getOperand(0), Cmp), in processICmp()
326 LVI->getConstantRange(Cmp->getOperand(1), Cmp)); in processICmp()
341 static bool constantFoldCmp(CmpInst *Cmp, LazyValueInfo *LVI) { in constantFoldCmp() argument
348 LVI->getPredicateAt(Cmp->getPredicate(), Op0, C, Cmp, in constantFoldCmp()
360 static bool processCmp(CmpInst *Cmp, LazyValueInfo *LVI) { in processCmp() argument
361 if (constantFoldCmp(Cmp, LVI)) in processCmp()
365 if (processICmp(ICmp, LVI)) in processCmp()
378 static bool processSwitch(SwitchInst *I, LazyValueInfo *LVI, in processSwitch() argument
397 LVI->getPredicateAt(CmpInst::ICMP_EQ, Cond, Case, I, in processSwitch()
441 static bool willNotOverflow(BinaryOpIntrinsic *BO, LazyValueInfo *LVI) { in willNotOverflow() argument
442 ConstantRange LRange = LVI->getConstantRange(BO->getLHS(), BO); in willNotOverflow()
443 ConstantRange RRange = LVI->getConstantRange(BO->getRHS(), BO); in willNotOverflow()
496 static bool processBinOp(BinaryOperator *BinOp, LazyValueInfo *LVI);
501 static bool processAbsIntrinsic(IntrinsicInst *II, LazyValueInfo *LVI) { in processAbsIntrinsic() argument
511 Result = LVI->getPredicateAt(CmpInst::Predicate::ICMP_ULE, X, IntMin, II, in processAbsIntrinsic()
522 Result = LVI->getPredicateAt(CmpInst::Predicate::ICMP_SLE, X, Zero, II, in processAbsIntrinsic()
531 Result = LVI->getPredicateAt(CmpInst::Predicate::ICMP_NE, X, IntMin, II, in processAbsIntrinsic()
552 processBinOp(BO, LVI); in processAbsIntrinsic()
558 static bool processMinMaxIntrinsic(MinMaxIntrinsic *MM, LazyValueInfo *LVI) { in processMinMaxIntrinsic() argument
560 LazyValueInfo::Tristate Result = LVI->getPredicateAt( in processMinMaxIntrinsic()
572 static bool processOverflowIntrinsic(WithOverflowInst *WO, LazyValueInfo *LVI) { in processOverflowIntrinsic() argument
593 processBinOp(BO, LVI); in processOverflowIntrinsic()
598 static bool processSaturatingInst(SaturatingInst *SI, LazyValueInfo *LVI) { in processSaturatingInst() argument
613 processBinOp(BO, LVI); in processSaturatingInst()
619 static bool processCallSite(CallBase &CB, LazyValueInfo *LVI) { in processCallSite() argument
622 return processAbsIntrinsic(&cast<IntrinsicInst>(CB), LVI); in processCallSite()
626 return processMinMaxIntrinsic(MM, LVI); in processCallSite()
630 if (WO->getLHS()->getType()->isIntegerTy() && willNotOverflow(WO, LVI)) { in processCallSite()
631 return processOverflowIntrinsic(WO, LVI); in processCallSite()
636 if (SI->getType()->isIntegerTy() && willNotOverflow(SI, LVI)) { in processCallSite()
637 return processSaturatingInst(SI, LVI); in processCallSite()
657 Constant *C = LVI->getConstant(V, &CB); in processCallSite()
674 LVI->getPredicateAt(ICmpInst::ICMP_EQ, V, in processCallSite()
696 static bool isNonNegative(Value *V, LazyValueInfo *LVI, Instruction *CxtI) { in isNonNegative() argument
698 auto Result = LVI->getPredicateAt(ICmpInst::ICMP_SGE, V, Zero, CxtI, in isNonNegative()
703 static bool isNonPositive(Value *V, LazyValueInfo *LVI, Instruction *CxtI) { in isNonPositive() argument
705 auto Result = LVI->getPredicateAt(ICmpInst::ICMP_SLE, V, Zero, CxtI, in isNonPositive()
712 Domain getDomain(Value *V, LazyValueInfo *LVI, Instruction *CxtI) { in getDomain() argument
713 if (isNonNegative(V, LVI, CxtI)) in getDomain()
715 if (isNonPositive(V, LVI, CxtI)) in getDomain()
722 static bool narrowSDivOrSRem(BinaryOperator *Instr, LazyValueInfo *LVI) { in narrowSDivOrSRem() argument
737 std::get<1>(I) = LVI->getConstantRange(std::get<0>(I), Instr); in narrowSDivOrSRem()
775 static bool processUDivOrURem(BinaryOperator *Instr, LazyValueInfo *LVI) { in processUDivOrURem() argument
788 ConstantRange CR = LVI->getConstantRange(Operand, Instr); in processUDivOrURem()
817 static bool processSRem(BinaryOperator *SDI, LazyValueInfo *LVI) { in processSRem() argument
831 Op.D = getDomain(Op.V, LVI, SDI); in processSRem()
863 processUDivOrURem(URem, LVI); in processSRem()
873 static bool processSDiv(BinaryOperator *SDI, LazyValueInfo *LVI) { in processSDiv() argument
887 Op.D = getDomain(Op.V, LVI, SDI); in processSDiv()
920 processUDivOrURem(UDiv, LVI); in processSDiv()
925 static bool processSDivOrSRem(BinaryOperator *Instr, LazyValueInfo *LVI) { in processSDivOrSRem() argument
932 if (processSDiv(Instr, LVI)) in processSDivOrSRem()
936 if (processSRem(Instr, LVI)) in processSDivOrSRem()
939 return narrowSDivOrSRem(Instr, LVI); in processSDivOrSRem()
942 static bool processAShr(BinaryOperator *SDI, LazyValueInfo *LVI) { in processAShr() argument
946 ConstantRange LRange = LVI->getConstantRange(SDI->getOperand(0), SDI); in processAShr()
958 if (!isNonNegative(SDI->getOperand(0), LVI, SDI)) in processAShr()
973 static bool processSExt(SExtInst *SDI, LazyValueInfo *LVI) { in processSExt() argument
979 if (!isNonNegative(Base, LVI, SDI)) in processSExt()
992 static bool processBinOp(BinaryOperator *BinOp, LazyValueInfo *LVI) { in processBinOp() argument
1007 ConstantRange LRange = LVI->getConstantRange(LHS, BinOp); in processBinOp()
1008 ConstantRange RRange = LVI->getConstantRange(RHS, BinOp); in processBinOp()
1030 static bool processAnd(BinaryOperator *BinOp, LazyValueInfo *LVI) { in processAnd() argument
1044 LVI->getConstantRange(LHS, BinOp, /*UndefAllowed=*/false); in processAnd()
1055 static Constant *getConstantAt(Value *V, Instruction *At, LazyValueInfo *LVI) { in getConstantAt() argument
1056 if (Constant *C = LVI->getConstant(V, At)) in getConstantAt()
1068 LazyValueInfo::Tristate Result = LVI->getPredicateAt( in getConstantAt()
1078 static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT, in runImpl() argument
1091 BBChanged |= processSelect(cast<SelectInst>(&II), LVI); in runImpl()
1094 BBChanged |= processPHI(cast<PHINode>(&II), LVI, DT, SQ); in runImpl()
1098 BBChanged |= processCmp(cast<CmpInst>(&II), LVI); in runImpl()
1102 BBChanged |= processMemAccess(&II, LVI); in runImpl()
1106 BBChanged |= processCallSite(cast<CallBase>(II), LVI); in runImpl()
1110 BBChanged |= processSDivOrSRem(cast<BinaryOperator>(&II), LVI); in runImpl()
1114 BBChanged |= processUDivOrURem(cast<BinaryOperator>(&II), LVI); in runImpl()
1117 BBChanged |= processAShr(cast<BinaryOperator>(&II), LVI); in runImpl()
1120 BBChanged |= processSExt(cast<SExtInst>(&II), LVI); in runImpl()
1126 BBChanged |= processBinOp(cast<BinaryOperator>(&II), LVI); in runImpl()
1129 BBChanged |= processAnd(cast<BinaryOperator>(&II), LVI); in runImpl()
1137 BBChanged |= processSwitch(cast<SwitchInst>(Term), LVI, DT); in runImpl()
1147 if (auto *C = getConstantAt(RetVal, RI, LVI)) { in runImpl()
1165 LazyValueInfo *LVI = &getAnalysis<LazyValueInfoWrapperPass>().getLVI(); in runOnFunction() local
1168 return runImpl(F, LVI, DT, getBestSimplifyQuery(*this, F)); in runOnFunction()
1173 LazyValueInfo *LVI = &AM.getResult<LazyValueAnalysis>(F); in run() local
1176 bool Changed = runImpl(F, LVI, DT, getBestSimplifyQuery(AM, F)); in run()