<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jul 27, 2013, at 3:19 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr">On Tue, Jul 23, 2013 at 9:15 PM, Chandler Carruth<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank" class="cremed">chandlerc@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr"><div class="im">On Tue, Jul 23, 2013 at 4:23 PM, Nick Kledzik<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank" class="cremed">kledzik@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Chandler,<br><br>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.<br></blockquote><div><br></div></div><div>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...</div></div></div></div></blockquote><div><br></div><div>And somehow I forgot to actually commit the fix! =[ Really sorry this stayed broken so long, really do feel free to complain loudly if I ever leave bots broken so badly... =[</div><div><br></div><div>Anyways, fixed in r187297.</div><div><br></div><div>Also, how can I configure my own build to see this? I don't even see the warnings in my builds with a recent bootstrap of Clang.</div></div></div></div></div></blockquote><div>I don’t know.  The built bot logs do not show what command line options are used when building, so I can’t tell why one bot gets the error and others don’t.</div><div><br></div><div>-Nick</div><br><div><br></div><div><br></div><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="h5"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;"><<a href="http://lab.llvm.org:8011/builders/lld-x86_64-darwin11/builds/2384/steps/build_Lld/logs/stdio" target="_blank" class="cremed">http://lab.llvm.org:8011/builders/lld-x86_64-darwin11/builds/2384/steps/build_Lld/logs/stdio</a>><br><br><br><br>[ 27%] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/SROA.cpp.o<br><br>/Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/lib/Transforms/Scalar/SROA.cpp:61:11: error: unused variable 'NumAllocaPartitions' [-Werror,-Wunused-variable]<br><div>STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");<br></div>         <span class="Apple-converted-space"> </span>^<br>/Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/include/llvm/ADT/Statistic.h:165:26: note: expanded from macro 'STATISTIC'<br> <span class="Apple-converted-space"> </span>static llvm::Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 }<br>                         ^<br>/Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/lib/Transforms/Scalar/SROA.cpp:62:11: error: unused variable 'MaxPartitionsPerAlloca' [-Werror,-Wunused-variable]<br><div>STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per alloca");<br></div>         <span class="Apple-converted-space"> </span>^<br>/Volumes/Macintosh_HD2/buildbots/lld-x86_64-darwin11/llvm.src/include/llvm/ADT/Statistic.h:165:26: note: expanded from macro 'STATISTIC'<br> <span class="Apple-converted-space"> </span>static llvm::Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 }<br><div><br><br><br>On Jul 19, 2013, at 3:57 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" target="_blank" class="cremed">chandlerc@gmail.com</a>> wrote:<br>> Author: chandlerc<br>> Date: Fri Jul 19 05:57:36 2013<br>> New Revision: 186667<br>><br>> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=186667&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=186667&view=rev</a><br>> Log:<br>> Cleanup the stats counters for the new implementation. These actually<br>> count the right things and have the right names.<br>><br>> Modified:<br>>    llvm/trunk/lib/Transforms/Scalar/SROA.cpp<br>><br>> Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp<br>> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=186667&r1=186666&r2=186667&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=186667&r1=186666&r2=186667&view=diff</a><br>> ==============================================================================<br>> --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)<br>> +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Fri Jul 19 05:57:36 2013<br>> @@ -59,9 +59,9 @@ using namespace llvm;<br>><br>> STATISTIC(NumAllocasAnalyzed, "Number of allocas analyzed for replacement");<br>> STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");<br>> -STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions");<br>> -STATISTIC(NumAllocaPartitionUses, "Number of alloca partition uses found");<br>> -STATISTIC(MaxPartitionUsesPerAlloca, "Maximum number of partition uses");<br>> +STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per alloca");<br>> +STATISTIC(NumAllocaPartitionUses, "Number of alloca partition uses rewritten");<br>> +STATISTIC(MaxUsesPerAllocaPartition, "Maximum number of uses of a partition");<br>> STATISTIC(NumNewAllocas, "Number of new, smaller allocas introduced");<br>> STATISTIC(NumPromoted, "Number of allocas promoted to SSA values");<br>> STATISTIC(NumLoadsSpeculated, "Number of loads speculated to allow promotion");<br>> @@ -682,15 +682,6 @@ AllocaSlices::AllocaSlices(const DataLay<br>><br>>   Slices.erase(std::remove_if(Slices.begin(), Slices.end(), IsSliceDead()),<br>>                Slices.end());<br>> -<br>> -  // Record how many slices we end up with.<br>> -  NumAllocaPartitions += Slices.size();<br>> -  MaxPartitionsPerAlloca =<br>> -      std::max<unsigned>(Slices.size(), MaxPartitionsPerAlloca);<br>> -<br>> -  NumAllocaPartitionUses += Slices.size();<br>> -  MaxPartitionUsesPerAlloca =<br>> -      std::max<unsigned>(Slices.size(), MaxPartitionUsesPerAlloca);<br>> }<br>><br>> #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)<br>> @@ -3045,6 +3036,10 @@ bool SROA::rewritePartition(AllocaInst &<br>>   unsigned SPOldSize = SpeculatablePHIs.size();<br>>   unsigned SSOldSize = SpeculatableSelects.size();<br>><br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +  unsigned NumUses = 0;<br>> +#endif<br>> +<br>>   AllocaSliceRewriter Rewriter(*DL, S, *this, AI, *NewAI, BeginOffset,<br>>                                EndOffset, IsVectorPromotable,<br>>                                IsIntegerPromotable);<br>> @@ -3055,13 +3050,25 @@ bool SROA::rewritePartition(AllocaInst &<br>>     DEBUG(dbgs() << "  rewriting split ");<br>>     DEBUG(S.printSlice(dbgs(), *SUI, ""));<br>>     Promotable &= Rewriter.visit(*SUI);<br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +    ++NumUses;<br>> +#endif<br>>   }<br>>   for (AllocaSlices::iterator I = B; I != E; ++I) {<br>>     DEBUG(dbgs() << "  rewriting ");<br>>     DEBUG(S.printSlice(dbgs(), I, ""));<br>>     Promotable &= Rewriter.visit(I);<br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +    ++NumUses;<br>> +#endif<br>>   }<br>><br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +  NumAllocaPartitionUses += NumUses;<br>> +  MaxUsesPerAllocaPartition =<br>> +      std::max<unsigned>(NumUses, MaxUsesPerAllocaPartition);<br>> +#endif<br>> +<br>>   if (Promotable && (SpeculatablePHIs.size() > SPOldSize ||<br>>                      SpeculatableSelects.size() > SSOldSize)) {<br>>     // If we have a promotable alloca except for some unspeculated loads below<br>> @@ -3135,6 +3142,10 @@ bool SROA::splitAlloca(AllocaInst &AI, A<br>>   if (S.begin() == S.end())<br>>     return false;<br>><br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +  unsigned NumPartitions = 0;<br>> +#endif<br>> +<br>>   bool Changed = false;<br>>   SmallVector<AllocaSlices::iterator, 4> SplitUses;<br>>   uint64_t MaxSplitUseEndOffset = 0;<br>> @@ -3181,6 +3192,9 @@ bool SROA::splitAlloca(AllocaInst &AI, A<br>>       // Rewrite a sequence of overlapping slices.<br>>       Changed |=<br>>           rewritePartition(AI, S, SI, SJ, BeginOffset, MaxEndOffset, SplitUses);<br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +      ++NumPartitions;<br>> +#endif<br>><br>>       removeFinishedSplitUses(SplitUses, MaxSplitUseEndOffset, MaxEndOffset);<br>>     }<br>> @@ -3220,6 +3234,10 @@ bool SROA::splitAlloca(AllocaInst &AI, A<br>><br>>     Changed |= rewritePartition(AI, S, SJ, SJ, MaxEndOffset, PostSplitEndOffset,<br>>                                 SplitUses);<br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +    ++NumPartitions;<br>> +#endif<br>> +<br>>     if (SJ == SE)<br>>       break; // Skip the rest, we don't need to do any cleanup.<br>><br>> @@ -3230,6 +3248,12 @@ bool SROA::splitAlloca(AllocaInst &AI, A<br>>     BeginOffset = SJ->beginOffset();<br>>   }<br>><br>> +#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)<br>> +  NumAllocaPartitions += NumPartitions;<br>> +  MaxPartitionsPerAlloca =<br>> +      std::max<unsigned>(NumPartitions, MaxPartitionsPerAlloca);<br>> +#endif<br>> +<br>>   return Changed;<br>> }<br>><br>><br>><br>> _______________________________________________<br>> llvm-commits mailing list<br>><span class="Apple-converted-space"> </span><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="cremed">llvm-commits@cs.uiuc.edu</a><br>><span class="Apple-converted-space"> </span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="cremed">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div><br></body></html>