mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Cleanup the stats counters for the new implementation. These actually
count the right things and have the right names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fbf2a02622
commit
47042bcc26
@ -59,9 +59,9 @@ using namespace llvm;
|
|||||||
|
|
||||||
STATISTIC(NumAllocasAnalyzed, "Number of allocas analyzed for replacement");
|
STATISTIC(NumAllocasAnalyzed, "Number of allocas analyzed for replacement");
|
||||||
STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");
|
STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");
|
||||||
STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions");
|
STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per alloca");
|
||||||
STATISTIC(NumAllocaPartitionUses, "Number of alloca partition uses found");
|
STATISTIC(NumAllocaPartitionUses, "Number of alloca partition uses rewritten");
|
||||||
STATISTIC(MaxPartitionUsesPerAlloca, "Maximum number of partition uses");
|
STATISTIC(MaxUsesPerAllocaPartition, "Maximum number of uses of a partition");
|
||||||
STATISTIC(NumNewAllocas, "Number of new, smaller allocas introduced");
|
STATISTIC(NumNewAllocas, "Number of new, smaller allocas introduced");
|
||||||
STATISTIC(NumPromoted, "Number of allocas promoted to SSA values");
|
STATISTIC(NumPromoted, "Number of allocas promoted to SSA values");
|
||||||
STATISTIC(NumLoadsSpeculated, "Number of loads speculated to allow promotion");
|
STATISTIC(NumLoadsSpeculated, "Number of loads speculated to allow promotion");
|
||||||
@ -682,15 +682,6 @@ AllocaSlices::AllocaSlices(const DataLayout &DL, AllocaInst &AI)
|
|||||||
|
|
||||||
Slices.erase(std::remove_if(Slices.begin(), Slices.end(), IsSliceDead()),
|
Slices.erase(std::remove_if(Slices.begin(), Slices.end(), IsSliceDead()),
|
||||||
Slices.end());
|
Slices.end());
|
||||||
|
|
||||||
// Record how many slices we end up with.
|
|
||||||
NumAllocaPartitions += Slices.size();
|
|
||||||
MaxPartitionsPerAlloca =
|
|
||||||
std::max<unsigned>(Slices.size(), MaxPartitionsPerAlloca);
|
|
||||||
|
|
||||||
NumAllocaPartitionUses += Slices.size();
|
|
||||||
MaxPartitionUsesPerAlloca =
|
|
||||||
std::max<unsigned>(Slices.size(), MaxPartitionUsesPerAlloca);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||||
@ -3045,6 +3036,10 @@ bool SROA::rewritePartition(AllocaInst &AI, AllocaSlices &S,
|
|||||||
unsigned SPOldSize = SpeculatablePHIs.size();
|
unsigned SPOldSize = SpeculatablePHIs.size();
|
||||||
unsigned SSOldSize = SpeculatableSelects.size();
|
unsigned SSOldSize = SpeculatableSelects.size();
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
unsigned NumUses = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
AllocaSliceRewriter Rewriter(*DL, S, *this, AI, *NewAI, BeginOffset,
|
AllocaSliceRewriter Rewriter(*DL, S, *this, AI, *NewAI, BeginOffset,
|
||||||
EndOffset, IsVectorPromotable,
|
EndOffset, IsVectorPromotable,
|
||||||
IsIntegerPromotable);
|
IsIntegerPromotable);
|
||||||
@ -3055,13 +3050,25 @@ bool SROA::rewritePartition(AllocaInst &AI, AllocaSlices &S,
|
|||||||
DEBUG(dbgs() << " rewriting split ");
|
DEBUG(dbgs() << " rewriting split ");
|
||||||
DEBUG(S.printSlice(dbgs(), *SUI, ""));
|
DEBUG(S.printSlice(dbgs(), *SUI, ""));
|
||||||
Promotable &= Rewriter.visit(*SUI);
|
Promotable &= Rewriter.visit(*SUI);
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
++NumUses;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
for (AllocaSlices::iterator I = B; I != E; ++I) {
|
for (AllocaSlices::iterator I = B; I != E; ++I) {
|
||||||
DEBUG(dbgs() << " rewriting ");
|
DEBUG(dbgs() << " rewriting ");
|
||||||
DEBUG(S.printSlice(dbgs(), I, ""));
|
DEBUG(S.printSlice(dbgs(), I, ""));
|
||||||
Promotable &= Rewriter.visit(I);
|
Promotable &= Rewriter.visit(I);
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
++NumUses;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
NumAllocaPartitionUses += NumUses;
|
||||||
|
MaxUsesPerAllocaPartition =
|
||||||
|
std::max<unsigned>(NumUses, MaxUsesPerAllocaPartition);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Promotable && (SpeculatablePHIs.size() > SPOldSize ||
|
if (Promotable && (SpeculatablePHIs.size() > SPOldSize ||
|
||||||
SpeculatableSelects.size() > SSOldSize)) {
|
SpeculatableSelects.size() > SSOldSize)) {
|
||||||
// If we have a promotable alloca except for some unspeculated loads below
|
// If we have a promotable alloca except for some unspeculated loads below
|
||||||
@ -3135,6 +3142,10 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &S) {
|
|||||||
if (S.begin() == S.end())
|
if (S.begin() == S.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
unsigned NumPartitions = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
SmallVector<AllocaSlices::iterator, 4> SplitUses;
|
SmallVector<AllocaSlices::iterator, 4> SplitUses;
|
||||||
uint64_t MaxSplitUseEndOffset = 0;
|
uint64_t MaxSplitUseEndOffset = 0;
|
||||||
@ -3181,6 +3192,9 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &S) {
|
|||||||
// Rewrite a sequence of overlapping slices.
|
// Rewrite a sequence of overlapping slices.
|
||||||
Changed |=
|
Changed |=
|
||||||
rewritePartition(AI, S, SI, SJ, BeginOffset, MaxEndOffset, SplitUses);
|
rewritePartition(AI, S, SI, SJ, BeginOffset, MaxEndOffset, SplitUses);
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
++NumPartitions;
|
||||||
|
#endif
|
||||||
|
|
||||||
removeFinishedSplitUses(SplitUses, MaxSplitUseEndOffset, MaxEndOffset);
|
removeFinishedSplitUses(SplitUses, MaxSplitUseEndOffset, MaxEndOffset);
|
||||||
}
|
}
|
||||||
@ -3220,6 +3234,10 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &S) {
|
|||||||
|
|
||||||
Changed |= rewritePartition(AI, S, SJ, SJ, MaxEndOffset, PostSplitEndOffset,
|
Changed |= rewritePartition(AI, S, SJ, SJ, MaxEndOffset, PostSplitEndOffset,
|
||||||
SplitUses);
|
SplitUses);
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
++NumPartitions;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SJ == SE)
|
if (SJ == SE)
|
||||||
break; // Skip the rest, we don't need to do any cleanup.
|
break; // Skip the rest, we don't need to do any cleanup.
|
||||||
|
|
||||||
@ -3230,6 +3248,12 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &S) {
|
|||||||
BeginOffset = SJ->beginOffset();
|
BeginOffset = SJ->beginOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||||
|
NumAllocaPartitions += NumPartitions;
|
||||||
|
MaxPartitionsPerAlloca =
|
||||||
|
std::max<unsigned>(NumPartitions, MaxPartitionsPerAlloca);
|
||||||
|
#endif
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user