[llvm] r186667 - Cleanup the stats counters for the new implementation. These actually

Chandler Carruth chandlerc at gmail.com
Tue Jul 23 21:15:03 PDT 2013


On Tue, Jul 23, 2013 at 4:23 PM, Nick Kledzik <kledzik at apple.com> wrote:

> Chandler,
>
> This change broke one of the lld build bots.  I’m not sure why more build
> bots are not failing.   Some of the statistics variables are only used
> inside #if conditionals.  So when you build with those conditions false,
> the compiler warns the variable is never used.
>

Sorry. I should have seen it in my own builds but missed it in the noise
from a bad warning in Clang that interacts poorly with LLD and
libstdc++v4.8... I'll fix...


>
> -Nick
>
> <
> http://lab.llvm.org:8011/builders/lld-x86_64-darwin11/builds/2384/steps/build_Lld/logs/stdio
> >
>
>
>
> [ 27%] Building CXX object
> lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/SROA.cpp.o
>
> /Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/lib/Transforms/Scalar/SROA.cpp:61:11:
> error: unused variable 'NumAllocaPartitions' [-Werror,-Wunused-variable]
> STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");
>           ^
> /Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/include/llvm/ADT/Statistic.h:165:26:
> note: expanded from macro 'STATISTIC'
>   static llvm::Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 }
>                          ^
> /Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/lib/Transforms/Scalar/SROA.cpp:62:11:
> error: unused variable 'MaxPartitionsPerAlloca' [-Werror,-Wunused-variable]
> STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per
> alloca");
>           ^
> /Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/include/llvm/ADT/Statistic.h:165:26:
> note: expanded from macro 'STATISTIC'
>   static llvm::Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 }
>
>
>
> On Jul 19, 2013, at 3:57 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
> > Author: chandlerc
> > Date: Fri Jul 19 05:57:36 2013
> > New Revision: 186667
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=186667&view=rev
> > Log:
> > Cleanup the stats counters for the new implementation. These actually
> > count the right things and have the right names.
> >
> > Modified:
> >    llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=186667&r1=186666&r2=186667&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
> > +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Fri Jul 19 05:57:36 2013
> > @@ -59,9 +59,9 @@ using namespace llvm;
> >
> > STATISTIC(NumAllocasAnalyzed, "Number of allocas analyzed for
> replacement");
> > STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");
> > -STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions");
> > -STATISTIC(NumAllocaPartitionUses, "Number of alloca partition uses
> found");
> > -STATISTIC(MaxPartitionUsesPerAlloca, "Maximum number of partition
> uses");
> > +STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per
> alloca");
> > +STATISTIC(NumAllocaPartitionUses, "Number of alloca partition uses
> rewritten");
> > +STATISTIC(MaxUsesPerAllocaPartition, "Maximum number of uses of a
> partition");
> > STATISTIC(NumNewAllocas, "Number of new, smaller allocas introduced");
> > STATISTIC(NumPromoted, "Number of allocas promoted to SSA values");
> > STATISTIC(NumLoadsSpeculated, "Number of loads speculated to allow
> promotion");
> > @@ -682,15 +682,6 @@ AllocaSlices::AllocaSlices(const DataLay
> >
> >   Slices.erase(std::remove_if(Slices.begin(), Slices.end(),
> IsSliceDead()),
> >                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)
> > @@ -3045,6 +3036,10 @@ bool SROA::rewritePartition(AllocaInst &
> >   unsigned SPOldSize = SpeculatablePHIs.size();
> >   unsigned SSOldSize = SpeculatableSelects.size();
> >
> > +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
> > +  unsigned NumUses = 0;
> > +#endif
> > +
> >   AllocaSliceRewriter Rewriter(*DL, S, *this, AI, *NewAI, BeginOffset,
> >                                EndOffset, IsVectorPromotable,
> >                                IsIntegerPromotable);
> > @@ -3055,13 +3050,25 @@ bool SROA::rewritePartition(AllocaInst &
> >     DEBUG(dbgs() << "  rewriting split ");
> >     DEBUG(S.printSlice(dbgs(), *SUI, ""));
> >     Promotable &= Rewriter.visit(*SUI);
> > +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
> > +    ++NumUses;
> > +#endif
> >   }
> >   for (AllocaSlices::iterator I = B; I != E; ++I) {
> >     DEBUG(dbgs() << "  rewriting ");
> >     DEBUG(S.printSlice(dbgs(), 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 ||
> >                      SpeculatableSelects.size() > SSOldSize)) {
> >     // If we have a promotable alloca except for some unspeculated loads
> below
> > @@ -3135,6 +3142,10 @@ bool SROA::splitAlloca(AllocaInst &AI, A
> >   if (S.begin() == S.end())
> >     return false;
> >
> > +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
> > +  unsigned NumPartitions = 0;
> > +#endif
> > +
> >   bool Changed = false;
> >   SmallVector<AllocaSlices::iterator, 4> SplitUses;
> >   uint64_t MaxSplitUseEndOffset = 0;
> > @@ -3181,6 +3192,9 @@ bool SROA::splitAlloca(AllocaInst &AI, A
> >       // Rewrite a sequence of overlapping slices.
> >       Changed |=
> >           rewritePartition(AI, S, SI, SJ, BeginOffset, MaxEndOffset,
> SplitUses);
> > +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
> > +      ++NumPartitions;
> > +#endif
> >
> >       removeFinishedSplitUses(SplitUses, MaxSplitUseEndOffset,
> MaxEndOffset);
> >     }
> > @@ -3220,6 +3234,10 @@ bool SROA::splitAlloca(AllocaInst &AI, A
> >
> >     Changed |= rewritePartition(AI, S, SJ, SJ, MaxEndOffset,
> PostSplitEndOffset,
> >                                 SplitUses);
> > +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
> > +    ++NumPartitions;
> > +#endif
> > +
> >     if (SJ == SE)
> >       break; // Skip the rest, we don't need to do any cleanup.
> >
> > @@ -3230,6 +3248,12 @@ bool SROA::splitAlloca(AllocaInst &AI, A
> >     BeginOffset = SJ->beginOffset();
> >   }
> >
> > +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
> > +  NumAllocaPartitions += NumPartitions;
> > +  MaxPartitionsPerAlloca =
> > +      std::max<unsigned>(NumPartitions, MaxPartitionsPerAlloca);
> > +#endif
> > +
> >   return Changed;
> > }
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130723/d9752d0a/attachment.html>


More information about the llvm-commits mailing list