Lines Matching refs:Basis
93 Stride(nullptr), Ins(nullptr), Basis(nullptr) {} in Candidate()
97 Basis(nullptr) {} in Candidate()
122 Candidate *Basis; member
150 bool isBasisFor(const Candidate &Basis, const Candidate &C);
185 void rewriteCandidateWithBasis(const Candidate &C, const Candidate &Basis);
195 static Value *emitBump(const Candidate &Basis, const Candidate &C,
224 bool StraightLineStrengthReduce::isBasisFor(const Candidate &Basis, in isBasisFor() argument
226 return (Basis.Ins != C.Ins && // skip the same instruction in isBasisFor()
229 Basis.Ins->getType() == C.Ins->getType() && in isBasisFor()
231 DT->dominates(Basis.Ins->getParent(), C.Ins->getParent()) && in isBasisFor()
233 Basis.Base == C.Base && Basis.Stride == C.Stride && in isBasisFor()
234 Basis.CandidateKind == C.CandidateKind); in isBasisFor()
351 for (auto Basis = Candidates.rbegin(); in allocateCandidatesAndFindBasis() local
352 Basis != Candidates.rend() && NumIterations < MaxNumIterations; in allocateCandidatesAndFindBasis()
353 ++Basis, ++NumIterations) { in allocateCandidatesAndFindBasis()
354 if (isBasisFor(*Basis, C)) { in allocateCandidatesAndFindBasis()
355 C.Basis = &(*Basis); in allocateCandidatesAndFindBasis()
556 Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis, in emitBump() argument
561 APInt Idx = C.Index->getValue(), BasisIdx = Basis.Index->getValue(); in emitBump()
566 if (Basis.CandidateKind == Candidate::GEP) { in emitBump()
570 cast<GetElementPtrInst>(Basis.Ins)->getType()->getElementType())); in emitBump()
590 IntegerType::get(Basis.Ins->getContext(), IndexOffset.getBitWidth()); in emitBump()
608 const Candidate &C, const Candidate &Basis) { in rewriteCandidateWithBasis() argument
609 assert(C.CandidateKind == Basis.CandidateKind && C.Base == Basis.Base && in rewriteCandidateWithBasis()
610 C.Stride == Basis.Stride); in rewriteCandidateWithBasis()
613 assert(Basis.Ins->getParent() != nullptr && "the basis is unlinked"); in rewriteCandidateWithBasis()
624 Value *Bump = emitBump(Basis, C, Builder, DL, BumpWithUglyGEP); in rewriteCandidateWithBasis()
633 Builder.CreateSub(Basis.Ins, BinaryOperator::getNegArgument(Bump)); in rewriteCandidateWithBasis()
647 Reduced = Builder.CreateAdd(Basis.Ins, Bump); in rewriteCandidateWithBasis()
656 unsigned AS = Basis.Ins->getType()->getPointerAddressSpace(); in rewriteCandidateWithBasis()
657 Type *CharTy = Type::getInt8PtrTy(Basis.Ins->getContext(), AS); in rewriteCandidateWithBasis()
658 Reduced = Builder.CreateBitCast(Basis.Ins, CharTy); in rewriteCandidateWithBasis()
670 Reduced = Builder.CreateInBoundsGEP(nullptr, Basis.Ins, Bump); in rewriteCandidateWithBasis()
672 Reduced = Builder.CreateGEP(nullptr, Basis.Ins, Bump); in rewriteCandidateWithBasis()
706 if (C.Basis != nullptr) { in runOnFunction()
707 rewriteCandidateWithBasis(C, *C.Basis); in runOnFunction()