Lines Matching refs:LU
838 const LSRUse &LU, const Formula &F);
841 const LSRUse &LU, const Formula &F);
888 const LSRUse &LU,
980 const LSRUse &LU, in RateFormula() argument
1009 NumBaseParts - (1 + (F.Scale && isAMCompletelyFolded(TTI, LU, F))); in RateFormula()
1013 ScaleCost += getScalingFactorCost(TTI, LU, F); in RateFormula()
1468 const LSRUse &LU, const Formula &F) { in isAMCompletelyFolded() argument
1469 return isAMCompletelyFolded(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, in isAMCompletelyFolded()
1470 LU.AccessTy, F.BaseGV, F.BaseOffset, F.HasBaseReg, in isAMCompletelyFolded()
1475 const LSRUse &LU, const Formula &F) { in getScalingFactorCost() argument
1481 if (!isAMCompletelyFolded(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, in getScalingFactorCost()
1482 LU.AccessTy, F)) in getScalingFactorCost()
1485 switch (LU.Kind) { in getScalingFactorCost()
1489 LU.AccessTy.MemTy, F.BaseGV, F.BaseOffset + LU.MinOffset, F.HasBaseReg, in getScalingFactorCost()
1490 F.Scale, LU.AccessTy.AddrSpace); in getScalingFactorCost()
1492 LU.AccessTy.MemTy, F.BaseGV, F.BaseOffset + LU.MaxOffset, F.HasBaseReg, in getScalingFactorCost()
1493 F.Scale, LU.AccessTy.AddrSpace); in getScalingFactorCost()
1690 bool reconcileNewOffset(LSRUse &LU, int64_t NewOffset, bool HasBaseReg,
1696 void DeleteUse(LSRUse &LU, size_t LUIdx);
1700 void InsertInitialFormula(const SCEV *S, LSRUse &LU, size_t LUIdx);
1701 void InsertSupplementalFormula(const SCEV *S, LSRUse &LU, size_t LUIdx);
1703 bool InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F);
1707 void GenerateReassociations(LSRUse &LU, unsigned LUIdx, Formula Base,
1710 void GenerateReassociationsImpl(LSRUse &LU, unsigned LUIdx,
1713 void GenerateCombinations(LSRUse &LU, unsigned LUIdx, Formula Base);
1714 void GenerateSymbolicOffsetsImpl(LSRUse &LU, unsigned LUIdx,
1717 void GenerateSymbolicOffsets(LSRUse &LU, unsigned LUIdx, Formula Base);
1718 void GenerateConstantOffsetsImpl(LSRUse &LU, unsigned LUIdx,
1722 void GenerateConstantOffsets(LSRUse &LU, unsigned LUIdx, Formula Base);
1723 void GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx, Formula Base);
1724 void GenerateScales(LSRUse &LU, unsigned LUIdx, Formula Base);
1725 void GenerateTruncates(LSRUse &LU, unsigned LUIdx, Formula Base);
1752 const LSRUse &LU,
2206 bool LSRInstance::reconcileNewOffset(LSRUse &LU, int64_t NewOffset, in reconcileNewOffset() argument
2209 int64_t NewMinOffset = LU.MinOffset; in reconcileNewOffset()
2210 int64_t NewMaxOffset = LU.MaxOffset; in reconcileNewOffset()
2216 if (LU.Kind != Kind) in reconcileNewOffset()
2223 if (AccessTy != LU.AccessTy) in reconcileNewOffset()
2228 if (NewOffset < LU.MinOffset) { in reconcileNewOffset()
2230 LU.MaxOffset - NewOffset, HasBaseReg)) in reconcileNewOffset()
2233 } else if (NewOffset > LU.MaxOffset) { in reconcileNewOffset()
2235 NewOffset - LU.MinOffset, HasBaseReg)) in reconcileNewOffset()
2241 LU.MinOffset = NewMinOffset; in reconcileNewOffset()
2242 LU.MaxOffset = NewMaxOffset; in reconcileNewOffset()
2243 LU.AccessTy = NewAccessTy; in reconcileNewOffset()
2244 if (NewOffset != LU.Offsets.back()) in reconcileNewOffset()
2245 LU.Offsets.push_back(NewOffset); in reconcileNewOffset()
2270 LSRUse &LU = Uses[LUIdx]; in getUse() local
2271 if (reconcileNewOffset(LU, Offset, /*HasBaseReg=*/true, Kind, AccessTy)) in getUse()
2280 LSRUse &LU = Uses[LUIdx]; in getUse() local
2284 if (LU.Offsets.empty() || Offset != LU.Offsets.back()) in getUse()
2285 LU.Offsets.push_back(Offset); in getUse()
2287 LU.MinOffset = Offset; in getUse()
2288 LU.MaxOffset = Offset; in getUse()
2293 void LSRInstance::DeleteUse(LSRUse &LU, size_t LUIdx) { in DeleteUse() argument
2294 if (&LU != &Uses.back()) in DeleteUse()
2295 std::swap(LU, Uses.back()); in DeleteUse()
2309 LSRUse &LU = Uses[LUIdx]; in FindUseWithSimilarFormula() local
2315 if (&LU != &OrigLU && in FindUseWithSimilarFormula()
2316 LU.Kind != LSRUse::ICmpZero && in FindUseWithSimilarFormula()
2317 LU.Kind == OrigLU.Kind && OrigLU.AccessTy == LU.AccessTy && in FindUseWithSimilarFormula()
2318 LU.WidestFixupType == OrigLU.WidestFixupType && in FindUseWithSimilarFormula()
2319 LU.HasFormulaWithSameRegs(OrigF)) { in FindUseWithSimilarFormula()
2321 for (const Formula &F : LU.Formulae) { in FindUseWithSimilarFormula()
2330 return &LU; in FindUseWithSimilarFormula()
2997 LSRUse &LU = Uses[LF.LUIdx]; in CollectFixupsAndInitialFormulae() local
2998 LU.AllFixupsOutsideLoop &= LF.isUseFullyOutsideLoop(L); in CollectFixupsAndInitialFormulae()
2999 if (!LU.WidestFixupType || in CollectFixupsAndInitialFormulae()
3000 SE.getTypeSizeInBits(LU.WidestFixupType) < in CollectFixupsAndInitialFormulae()
3002 LU.WidestFixupType = LF.OperandValToReplace->getType(); in CollectFixupsAndInitialFormulae()
3005 if (LU.Formulae.empty()) { in CollectFixupsAndInitialFormulae()
3006 InsertInitialFormula(S, LU, LF.LUIdx); in CollectFixupsAndInitialFormulae()
3007 CountRegisters(LU.Formulae.back(), LF.LUIdx); in CollectFixupsAndInitialFormulae()
3017 LSRInstance::InsertInitialFormula(const SCEV *S, LSRUse &LU, size_t LUIdx) { in InsertInitialFormula() argument
3020 LU.RigidFormula = true; in InsertInitialFormula()
3024 bool Inserted = InsertFormula(LU, LUIdx, F); in InsertInitialFormula()
3032 LSRUse &LU, size_t LUIdx) { in InsertSupplementalFormula() argument
3036 bool Inserted = InsertFormula(LU, LUIdx, F); in InsertSupplementalFormula()
3050 bool LSRInstance::InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F) { in InsertFormula() argument
3052 assert(isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, LU.AccessTy, F) && in InsertFormula()
3054 if (!LU.InsertFormula(F)) in InsertFormula()
3140 LSRUse &LU = Uses[LF.LUIdx]; in CollectLoopInvariantFixupsAndFormulae() local
3141 LU.AllFixupsOutsideLoop &= LF.isUseFullyOutsideLoop(L); in CollectLoopInvariantFixupsAndFormulae()
3142 if (!LU.WidestFixupType || in CollectLoopInvariantFixupsAndFormulae()
3143 SE.getTypeSizeInBits(LU.WidestFixupType) < in CollectLoopInvariantFixupsAndFormulae()
3145 LU.WidestFixupType = LF.OperandValToReplace->getType(); in CollectLoopInvariantFixupsAndFormulae()
3146 InsertSupplementalFormula(US, LU, LF.LUIdx); in CollectLoopInvariantFixupsAndFormulae()
3147 CountRegisters(LU.Formulae.back(), Uses.size() - 1); in CollectLoopInvariantFixupsAndFormulae()
3216 void LSRInstance::GenerateReassociationsImpl(LSRUse &LU, unsigned LUIdx, in GenerateReassociationsImpl() argument
3240 if (isAlwaysFoldable(TTI, SE, LU.MinOffset, LU.MaxOffset, LU.Kind, in GenerateReassociationsImpl()
3241 LU.AccessTy, *J, Base.getNumRegs() > 1)) in GenerateReassociationsImpl()
3253 isAlwaysFoldable(TTI, SE, LU.MinOffset, LU.MaxOffset, LU.Kind, in GenerateReassociationsImpl()
3254 LU.AccessTy, InnerAddOps[0], Base.getNumRegs() > 1)) in GenerateReassociationsImpl()
3291 if (InsertFormula(LU, LUIdx, F)) in GenerateReassociationsImpl()
3294 GenerateReassociations(LU, LUIdx, LU.Formulae.back(), Depth + 1); in GenerateReassociationsImpl()
3299 void LSRInstance::GenerateReassociations(LSRUse &LU, unsigned LUIdx, in GenerateReassociations() argument
3307 GenerateReassociationsImpl(LU, LUIdx, Base, Depth, i); in GenerateReassociations()
3310 GenerateReassociationsImpl(LU, LUIdx, Base, Depth, in GenerateReassociations()
3316 void LSRInstance::GenerateCombinations(LSRUse &LU, unsigned LUIdx, in GenerateCombinations() argument
3343 (void)InsertFormula(LU, LUIdx, F); in GenerateCombinations()
3349 void LSRInstance::GenerateSymbolicOffsetsImpl(LSRUse &LU, unsigned LUIdx, in GenerateSymbolicOffsetsImpl() argument
3358 if (!isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, LU.AccessTy, F)) in GenerateSymbolicOffsetsImpl()
3364 (void)InsertFormula(LU, LUIdx, F); in GenerateSymbolicOffsetsImpl()
3368 void LSRInstance::GenerateSymbolicOffsets(LSRUse &LU, unsigned LUIdx, in GenerateSymbolicOffsets() argument
3374 GenerateSymbolicOffsetsImpl(LU, LUIdx, Base, i); in GenerateSymbolicOffsets()
3376 GenerateSymbolicOffsetsImpl(LU, LUIdx, Base, /* Idx */ -1, in GenerateSymbolicOffsets()
3382 LSRUse &LU, unsigned LUIdx, const Formula &Base, in GenerateConstantOffsetsImpl() argument
3388 if (isLegalUse(TTI, LU.MinOffset - Offset, LU.MaxOffset - Offset, LU.Kind, in GenerateConstantOffsetsImpl()
3389 LU.AccessTy, F)) { in GenerateConstantOffsetsImpl()
3405 (void)InsertFormula(LU, LUIdx, F); in GenerateConstantOffsetsImpl()
3414 if (!isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, LU.AccessTy, F)) in GenerateConstantOffsetsImpl()
3420 (void)InsertFormula(LU, LUIdx, F); in GenerateConstantOffsetsImpl()
3424 void LSRInstance::GenerateConstantOffsets(LSRUse &LU, unsigned LUIdx, in GenerateConstantOffsets() argument
3429 Worklist.push_back(LU.MinOffset); in GenerateConstantOffsets()
3430 if (LU.MaxOffset != LU.MinOffset) in GenerateConstantOffsets()
3431 Worklist.push_back(LU.MaxOffset); in GenerateConstantOffsets()
3434 GenerateConstantOffsetsImpl(LU, LUIdx, Base, Worklist, i); in GenerateConstantOffsets()
3436 GenerateConstantOffsetsImpl(LU, LUIdx, Base, Worklist, /* Idx */ -1, in GenerateConstantOffsets()
3442 void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx, in GenerateICmpZeroScales() argument
3444 if (LU.Kind != LSRUse::ICmpZero) return; in GenerateICmpZeroScales()
3452 if (LU.MinOffset != LU.MaxOffset) return; in GenerateICmpZeroScales()
3470 int64_t Offset = LU.MinOffset; in GenerateICmpZeroScales()
3474 if (Offset / Factor != LU.MinOffset) in GenerateICmpZeroScales()
3485 if (!isLegalUse(TTI, Offset, Offset, LU.Kind, LU.AccessTy, F)) in GenerateICmpZeroScales()
3489 F.BaseOffset = (uint64_t)F.BaseOffset + Offset - LU.MinOffset; in GenerateICmpZeroScales()
3521 (void)InsertFormula(LU, LUIdx, F); in GenerateICmpZeroScales()
3528 void LSRInstance::GenerateScales(LSRUse &LU, unsigned LUIdx, Formula Base) { in GenerateScales() argument
3545 if (!isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, LU.AccessTy, in GenerateScales()
3549 if (LU.Kind == LSRUse::Basic && in GenerateScales()
3550 isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LSRUse::Special, in GenerateScales()
3551 LU.AccessTy, Base) && in GenerateScales()
3552 LU.AllFixupsOutsideLoop) in GenerateScales()
3553 LU.Kind = LSRUse::Special; in GenerateScales()
3559 if (LU.Kind == LSRUse::ICmpZero && in GenerateScales()
3581 (void)InsertFormula(LU, LUIdx, F); in GenerateScales()
3588 void LSRInstance::GenerateTruncates(LSRUse &LU, unsigned LUIdx, Formula Base) { in GenerateTruncates() argument
3610 (void)InsertFormula(LU, LUIdx, F); in GenerateTruncates()
3723 LSRUse &LU = Uses[LUIdx]; in GenerateCrossUseConstantOffsets() local
3732 for (size_t L = 0, LE = LU.Formulae.size(); L != LE; ++L) { in GenerateCrossUseConstantOffsets()
3733 Formula F = LU.Formulae[L]; in GenerateCrossUseConstantOffsets()
3748 if (!isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, LU.AccessTy, in GenerateCrossUseConstantOffsets()
3764 (void)InsertFormula(LU, LUIdx, NewF); in GenerateCrossUseConstantOffsets()
3773 if (!isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, in GenerateCrossUseConstantOffsets()
3774 LU.Kind, LU.AccessTy, NewF)) { in GenerateCrossUseConstantOffsets()
3796 (void)InsertFormula(LU, LUIdx, NewF); in GenerateCrossUseConstantOffsets()
3811 LSRUse &LU = Uses[LUIdx]; in GenerateAllReuseFormulae() local
3812 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3813 GenerateReassociations(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3814 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3815 GenerateCombinations(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3818 LSRUse &LU = Uses[LUIdx]; in GenerateAllReuseFormulae() local
3819 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3820 GenerateSymbolicOffsets(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3821 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3822 GenerateConstantOffsets(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3823 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3824 GenerateICmpZeroScales(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3825 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3826 GenerateScales(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3829 LSRUse &LU = Uses[LUIdx]; in GenerateAllReuseFormulae() local
3830 for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i) in GenerateAllReuseFormulae()
3831 GenerateTruncates(LU, LUIdx, LU.Formulae[i]); in GenerateAllReuseFormulae()
3858 LSRUse &LU = Uses[LUIdx]; in FilterOutUndesirableDedicatedRegisters() local
3859 DEBUG(dbgs() << "Filtering for use "; LU.print(dbgs()); dbgs() << '\n'); in FilterOutUndesirableDedicatedRegisters()
3862 for (size_t FIdx = 0, NumForms = LU.Formulae.size(); in FilterOutUndesirableDedicatedRegisters()
3864 Formula &F = LU.Formulae[FIdx]; in FilterOutUndesirableDedicatedRegisters()
3875 CostF.RateFormula(TTI, F, Regs, VisitedRegs, L, LU.Offsets, SE, DT, LU, in FilterOutUndesirableDedicatedRegisters()
3905 Formula &Best = LU.Formulae[P.first->second]; in FilterOutUndesirableDedicatedRegisters()
3909 CostBest.RateFormula(TTI, Best, Regs, VisitedRegs, L, LU.Offsets, SE, in FilterOutUndesirableDedicatedRegisters()
3910 DT, LU); in FilterOutUndesirableDedicatedRegisters()
3921 LU.DeleteFormula(F); in FilterOutUndesirableDedicatedRegisters()
3929 LU.RecomputeRegs(LUIdx, RegUses); in FilterOutUndesirableDedicatedRegisters()
3950 for (const LSRUse &LU : Uses) { in EstimateSearchSpaceComplexity() local
3951 size_t FSize = LU.Formulae.size(); in EstimateSearchSpaceComplexity()
3975 LSRUse &LU = Uses[LUIdx]; in NarrowSearchSpaceByDetectingSupersets() local
3977 for (size_t i = 0, e = LU.Formulae.size(); i != e; ++i) { in NarrowSearchSpaceByDetectingSupersets()
3978 Formula &F = LU.Formulae[i]; in NarrowSearchSpaceByDetectingSupersets()
3989 if (LU.HasFormulaWithSameRegs(NewF)) { in NarrowSearchSpaceByDetectingSupersets()
3991 LU.DeleteFormula(F); in NarrowSearchSpaceByDetectingSupersets()
4004 if (LU.HasFormulaWithSameRegs(NewF)) { in NarrowSearchSpaceByDetectingSupersets()
4007 LU.DeleteFormula(F); in NarrowSearchSpaceByDetectingSupersets()
4018 LU.RecomputeRegs(LUIdx, RegUses); in NarrowSearchSpaceByDetectingSupersets()
4039 LSRUse &LU = Uses[LUIdx]; in NarrowSearchSpaceByCollapsingUnrolledCode() local
4040 for (const Formula &F : LU.Formulae) { in NarrowSearchSpaceByCollapsingUnrolledCode()
4044 LSRUse *LUThatHas = FindUseWithSimilarFormula(F, LU); in NarrowSearchSpaceByCollapsingUnrolledCode()
4049 LU.Kind, LU.AccessTy)) in NarrowSearchSpaceByCollapsingUnrolledCode()
4052 DEBUG(dbgs() << " Deleting use "; LU.print(dbgs()); dbgs() << '\n'); in NarrowSearchSpaceByCollapsingUnrolledCode()
4054 LUThatHas->AllFixupsOutsideLoop &= LU.AllFixupsOutsideLoop; in NarrowSearchSpaceByCollapsingUnrolledCode()
4094 DeleteUse(LU, LUIdx); in NarrowSearchSpaceByCollapsingUnrolledCode()
4158 LSRUse &LU = Uses[LUIdx]; in NarrowSearchSpaceByPickingWinnerRegs() local
4159 if (!LU.Regs.count(Best)) continue; in NarrowSearchSpaceByPickingWinnerRegs()
4162 for (size_t i = 0, e = LU.Formulae.size(); i != e; ++i) { in NarrowSearchSpaceByPickingWinnerRegs()
4163 Formula &F = LU.Formulae[i]; in NarrowSearchSpaceByPickingWinnerRegs()
4166 LU.DeleteFormula(F); in NarrowSearchSpaceByPickingWinnerRegs()
4176 LU.RecomputeRegs(LUIdx, RegUses); in NarrowSearchSpaceByPickingWinnerRegs()
4212 const LSRUse &LU = Uses[Workspace.size()]; in SolveRecurse() local
4220 if (LU.Regs.count(S)) in SolveRecurse()
4225 for (const Formula &F : LU.Formulae) { in SolveRecurse()
4249 NewCost.RateFormula(TTI, F, NewRegs, VisitedRegs, L, LU.Offsets, SE, DT, in SolveRecurse()
4250 LU); in SolveRecurse()
4371 const LSRUse &LU, in AdjustInsertPositionForExpand() argument
4379 if (LU.Kind == LSRUse::ICmpZero) in AdjustInsertPositionForExpand()
4438 const LSRUse &LU = Uses[LF.LUIdx]; in Expand() local
4439 if (LU.RigidFormula) in Expand()
4444 IP = AdjustInsertPositionForExpand(IP, LF, LU, Rewriter); in Expand()
4490 if (LU.Kind == LSRUse::ICmpZero) { in Expand()
4509 if (!Ops.empty() && LU.Kind == LSRUse::Address && in Expand()
4510 isAMCompletelyFolded(TTI, LU, F)) { in Expand()
4545 if (LU.Kind == LSRUse::ICmpZero) { in Expand()
4581 if (LU.Kind == LSRUse::ICmpZero) { in Expand()
4867 for (const LSRUse &LU : Uses) { in LSRInstance() local
4868 for (const Formula &F : LU.Formulae) in LSRInstance()
4869 assert(isLegalUse(TTI, LU.MinOffset, LU.MaxOffset, LU.Kind, LU.AccessTy, in LSRInstance()
4909 for (const LSRUse &LU : Uses) { in print_uses() local
4911 LU.print(OS); in print_uses()
4913 for (const Formula &F : LU.Formulae) { in print_uses()