[llvm] r326738 - Re-commit: Make STATISTIC() values available programmatically
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 7 11:37:11 PST 2018
r326936 should fix this.
> On 7 Mar 2018, at 09:00, Daniel Sanders <daniel_l_sanders at apple.com> wrote:
>
>
>
>> On 7 Mar 2018, at 08:50, Daniel Sanders via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>>
>> Thanks for letting me know. I can probably fix this by putting the LLVM_ENABLE_STATS logic in Statistic.h and changing the cmake option to LLVM_FORCE_ENABLE_STATS or similar. I'll look into this.
>>
>> The Xcode build didn't reproduce it for me but I'm not convinced it actually ran the tests. It probably did run them but I can't see that in the IDE. I'm currently trying the command line version so I can see them run.
>
> Yep, the IDE didn't run them. I can repro this on the Xcode build using a terminal.
>
>>> On 7 Mar 2018, at 04:02, Greg Bedwell <gregbedwell at gmail.com <mailto:gregbedwell at gmail.com>> wrote:
>>>
>>> Unfortunately, I think that this now breaks for multi-config generators (sadly, I don't think we have any public buildbots building using these). I've tried it on Windows with cmake -G "Visual Studio 14 2015 Win64", but I'd guess the same thing would happen with cmake -G "Xcode". If I build "Debug" I get a whole bunch of check-all failures along the lines of:
>>>
>>> # command stderr:
>>> C:\work\public-git\upstream-llvm\llvm\tools\clang\test\Analysis\stats.c:7:11: error: expected string not found in input
>>>
>>> // CHECK: ... Statistics Collected ...
>>>
>>> ^
>>>
>>> <stdin>:1:1: note: scanning from here
>>>
>>>
>>> The issue basically comes down to the fact that with a multi-config generator, it's not actually known at CMake time whether LLVM_ENABLE_ASSERTIONS is true or not, as the IDE will let the user decide whether to build Debug or Release from the already generated project at build time. I assume this is why we had all those checks on NDEBUG at the same time as LLVM_ENABLE_STATS previously.
>>
>> That could be the reason, but I don't think many people consider multi-config generators until they accidentally break them :-). I think they were there because the code pre-dates our use of cmake and nobody thought about porting -DLLVM_ENABLE_STATS when we switched from autoconf to cmake.
>>
>>> -Greg
>>>
>>>
>>>
>>> On 5 March 2018 at 19:38, Daniel Sanders via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>>> Author: dsanders
>>> Date: Mon Mar 5 11:38:16 2018
>>> New Revision: 326738
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=326738&view=rev <http://llvm.org/viewvc/llvm-project?rev=326738&view=rev>
>>> Log:
>>> Re-commit: Make STATISTIC() values available programmatically
>>>
>>> Summary:
>>> It can be useful for tools to be able to retrieve the values of variables
>>> declared via STATISTIC() directly without having to emit them and parse
>>> them back. Use cases include:
>>> * Needing to report specific statistics to a test harness
>>> * Wanting to post-process statistics. For example, to produce a percentage of
>>> functions that were fully selected by GlobalISel
>>>
>>> Make this possible by adding llvm::GetStatistics() which returns an
>>> iterator_range that can be used to inspect the statistics that have been
>>> touched during execution. When statistics are disabled (NDEBUG and not
>>> LLVM_ENABLE_STATISTICS) this method will return an empty range.
>>>
>>> This patch doesn't address the effect of multiple compilations within the same
>>> process. In such situations, the statistics will be cumulative for all
>>> compilations up to the GetStatistics() call.
>>>
>>> Reviewers: qcolombet, rtereshin, aditya_nandakumar, bogner
>>>
>>> Reviewed By: rtereshin, bogner
>>>
>>> Subscribers: llvm-commits, mgorny
>>>
>>> Differential Revision: https://reviews.llvm.org/D43901 <https://reviews.llvm.org/D43901>
>>>
>>> This re-commit fixes a missing include of <vector> which it seems clang didn't
>>> mind but G++ and MSVC objected to. It seems that, clang was ok with std::vector
>>> only being forward declared at the point of use since it was fully defined
>>> eventually but G++/MSVC both rejected it at the point of use.
>>>
>>> Added:
>>> llvm/trunk/unittests/ADT/StatisticTest.cpp
>>> - copied unchanged from r326725, llvm/trunk/unittests/ADT/StatisticTest.cpp
>>> Modified:
>>> llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
>>> llvm/trunk/include/llvm/ADT/Statistic.h
>>> llvm/trunk/include/llvm/Config/llvm-config.h.cmake
>>> llvm/trunk/lib/Support/Statistic.cpp
>>> llvm/trunk/unittests/ADT/CMakeLists.txt
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180307/a8758aa7/attachment.html>
More information about the llvm-commits
mailing list