mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-17 18:24:34 +00:00
[LAA] Split out a helper from addRuntimeCheck to generate the check, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -384,6 +384,15 @@ public:
|
|||||||
void groupChecks(MemoryDepChecker::DepCandidates &DepCands,
|
void groupChecks(MemoryDepChecker::DepCandidates &DepCands,
|
||||||
bool UseDependencies);
|
bool UseDependencies);
|
||||||
|
|
||||||
|
/// Generate the checks and return them.
|
||||||
|
///
|
||||||
|
/// \p PtrToPartition contains the partition number for pointers. If passed,
|
||||||
|
/// omit checks between pointers belonging to the same partition. Partition
|
||||||
|
/// number -1 means that the pointer is used in multiple partitions. In this
|
||||||
|
/// case we can't safely omit the check.
|
||||||
|
SmallVector<PointerCheck, 4>
|
||||||
|
generateChecks(const SmallVectorImpl<int> *PtrPartition = nullptr) const;
|
||||||
|
|
||||||
/// \brief Decide if we need to add a check between two groups of pointers,
|
/// \brief Decide if we need to add a check between two groups of pointers,
|
||||||
/// according to needsChecking.
|
/// according to needsChecking.
|
||||||
bool needsChecking(const CheckingPtrGroup &M, const CheckingPtrGroup &N,
|
bool needsChecking(const CheckingPtrGroup &M, const CheckingPtrGroup &N,
|
||||||
|
@@ -148,6 +148,23 @@ void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, bool WritePtr,
|
|||||||
Pointers.emplace_back(Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, Sc);
|
Pointers.emplace_back(Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, Sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SmallVector<RuntimePointerChecking::PointerCheck, 4>
|
||||||
|
RuntimePointerChecking::generateChecks(
|
||||||
|
const SmallVectorImpl<int> *PtrPartition) const {
|
||||||
|
SmallVector<PointerCheck, 4> Checks;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < CheckingGroups.size(); ++i) {
|
||||||
|
for (unsigned j = i + 1; j < CheckingGroups.size(); ++j) {
|
||||||
|
const RuntimePointerChecking::CheckingPtrGroup &CGI = CheckingGroups[i];
|
||||||
|
const RuntimePointerChecking::CheckingPtrGroup &CGJ = CheckingGroups[j];
|
||||||
|
|
||||||
|
if (needsChecking(CGI, CGJ, PtrPartition))
|
||||||
|
Checks.push_back(std::make_pair(&CGI, &CGJ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Checks;
|
||||||
|
}
|
||||||
|
|
||||||
bool RuntimePointerChecking::needsChecking(
|
bool RuntimePointerChecking::needsChecking(
|
||||||
const CheckingPtrGroup &M, const CheckingPtrGroup &N,
|
const CheckingPtrGroup &M, const CheckingPtrGroup &N,
|
||||||
const SmallVectorImpl<int> *PtrPartition) const {
|
const SmallVectorImpl<int> *PtrPartition) const {
|
||||||
@@ -1708,20 +1725,7 @@ std::pair<Instruction *, Instruction *> LoopAccessInfo::addRuntimeCheck(
|
|||||||
if (!PtrRtChecking.Need)
|
if (!PtrRtChecking.Need)
|
||||||
return std::make_pair(nullptr, nullptr);
|
return std::make_pair(nullptr, nullptr);
|
||||||
|
|
||||||
SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks;
|
return addRuntimeCheck(Loc, PtrRtChecking.generateChecks(PtrPartition));
|
||||||
for (unsigned i = 0; i < PtrRtChecking.CheckingGroups.size(); ++i) {
|
|
||||||
for (unsigned j = i + 1; j < PtrRtChecking.CheckingGroups.size(); ++j) {
|
|
||||||
const RuntimePointerChecking::CheckingPtrGroup &CGI =
|
|
||||||
PtrRtChecking.CheckingGroups[i];
|
|
||||||
const RuntimePointerChecking::CheckingPtrGroup &CGJ =
|
|
||||||
PtrRtChecking.CheckingGroups[j];
|
|
||||||
|
|
||||||
if (PtrRtChecking.needsChecking(CGI, CGJ, PtrPartition))
|
|
||||||
Checks.push_back(std::make_pair(&CGI, &CGJ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return addRuntimeCheck(Loc, Checks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
|
LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
|
||||||
|
Reference in New Issue
Block a user