[cfe-commits] r151460 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/many-logical-ops.c

Richard Smith richard at metafoo.co.uk
Thu Jun 20 14:40:04 PDT 2013


On Thu, Jun 20, 2013 at 1:24 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Thu, Jun 20, 2013 at 12:13 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com>
> wrote:
>>
>> On Jun 20, 2013, at 12:40 AM, Chandler Carruth <chandlerc at google.com>
>> wrote:
>>
>>
>> On Sat, Feb 25, 2012 at 1:38 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com>
>> wrote:
>>>
>>> Author: akirtzidis
>>> Date: Sat Feb 25 15:38:16 2012
>>> New Revision: 151460
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=151460&view=rev
>>> Log:
>>> When evaluating integer expressions handle logical operators outside
>>> VisitBinaryOperator() to reduce stack pressure for source with huge
>>> number
>>> of logical operators.
>>>
>>> Fixes rdar://10913206.
>>>
>>> Added:
>>>     cfe/trunk/test/Sema/many-logical-ops.c
>>
>>
>> Argiris, this is the 4th slowest test at almost 20 seconds. It makes me
>> wonder if the slow part is parsing these logical op expressions or if there
>> is some other issue.
>>
>>
>> If you do
>>
>> $ clang -cc1 test/Sema/many-logical-ops.c
>>
>> all the time is spent in SequenceChecker. If I uncomment
>> "CheckUnsequencedOperations(E)" from Sema::CheckCompletedExpr() there is no
>> slow down (also why does this run all the time without checking if the
>> warning is enabled or not ?).
>>
>> CC'ing Richard.
>
>
> Thanks for the analysis!

Looks like the problem is that we try to evaluate the LHS of an && to
determine if we want to inspect the RHS, and each evaluation recurses
all the way down the chain of &&s on *its* LHS before hitting a leaf
and finding that it's non-constant, making the complete process
quadratic.



More information about the cfe-commits mailing list