[llvm] r288655 - TableGen/AsmMatcherEmitter: Trust that stable_sort works
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 5 11:55:20 PST 2016
> On Dec 5, 2016, at 7:06 AM, Davide Italiano <davide at freebsd.org> wrote:
>
> On Mon, Dec 5, 2016 at 12:15 AM, Matthias Braun via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: matze
>> Date: Mon Dec 5 02:15:57 2016
>> New Revision: 288655
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=288655&view=rev
>> Log:
>> TableGen/AsmMatcherEmitter: Trust that stable_sort works
>>
>> A debug build of AsmMatcherEmitter would use a quadratic algorithm to
>> check whether std::stable_sort() actually sorted. Let's hope the authors
>> of our C++ standard library did that testing for us. Removing the check
>> gives a 3x speedup in the X86 case.
>>
>> Modified:
>> llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
>>
>> Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=288655&r1=288654&r2=288655&view=diff
>> ==============================================================================
>> --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
>> +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Dec 5 02:15:57 2016
>> @@ -2719,16 +2719,6 @@ void AsmMatcherEmitter::run(raw_ostream
>> const std::unique_ptr<MatchableInfo> &b){
>> return *a < *b;});
>>
>> -#ifndef NDEBUG
>> - // Verify that the table is now sorted
>> - for (auto I = Info.Matchables.begin(), E = Info.Matchables.end(); I != E;
>> - ++I) {
>> - for (auto J = I; J != E; ++J) {
>> - assert(!(**J < **I));
>> - }
>> - }
>> -#endif // NDEBUG
>> -
>> DEBUG_WITH_TYPE("instruction_info", {
>> for (const auto &MI : Info.Matchables)
>> MI->dump();
>>
>
> Thanks for your performance work, it's really appreciated.
> That said, maybe instead of removing the check altogether you can just
> move it under `LLVM_ENABLE_EXPENSIVE_CHECKS`?
Did that in r288693.
- Matthias
More information about the llvm-commits
mailing list