mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
[LAA] Split out a helper to check the pointer partitions, NFC
This is made a static public member function to allow the transition of this logic from LAA to LoopDistribution. (Technically, it could be an implementation-local static function but then it would not be accessible from LoopDistribution.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242376 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3cd5b05b14
commit
45646075c3
@ -405,6 +405,14 @@ public:
|
||||
/// Holds a partitioning of pointers into "check groups".
|
||||
SmallVector<CheckingPtrGroup, 2> CheckingGroups;
|
||||
|
||||
/// \brief Check if pointers are in the same partition
|
||||
///
|
||||
/// \p PtrToPartition contains the partition number for pointers (-1 if the
|
||||
/// pointer belongs to multiple partitions).
|
||||
static bool
|
||||
arePointersInSamePartition(const SmallVectorImpl<int> &PtrToPartition,
|
||||
unsigned PtrIdx1, unsigned PtrIdx2);
|
||||
|
||||
private:
|
||||
/// \brief Decide whether we need to issue a run-time check for pointer at
|
||||
/// index \p I and \p J to prove their independence.
|
||||
|
@ -280,6 +280,13 @@ void RuntimePointerChecking::groupChecks(
|
||||
}
|
||||
}
|
||||
|
||||
bool RuntimePointerChecking::arePointersInSamePartition(
|
||||
const SmallVectorImpl<int> &PtrToPartition, unsigned PtrIdx1,
|
||||
unsigned PtrIdx2) {
|
||||
return (PtrToPartition[PtrIdx1] != -1 &&
|
||||
PtrToPartition[PtrIdx1] == PtrToPartition[PtrIdx2]);
|
||||
}
|
||||
|
||||
bool RuntimePointerChecking::needsChecking(
|
||||
unsigned I, unsigned J, const SmallVectorImpl<int> *PtrPartition) const {
|
||||
const PointerInfo &PointerI = Pointers[I];
|
||||
@ -298,10 +305,7 @@ bool RuntimePointerChecking::needsChecking(
|
||||
return false;
|
||||
|
||||
// If PtrPartition is set omit checks between pointers of the same partition.
|
||||
// Partition number -1 means that the pointer is used in multiple partitions.
|
||||
// In this case we can't omit the check.
|
||||
if (PtrPartition && (*PtrPartition)[I] != -1 &&
|
||||
(*PtrPartition)[I] == (*PtrPartition)[J])
|
||||
if (PtrPartition && arePointersInSamePartition(*PtrPartition, I, J))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user