[cfe-commits] [patch] Qualifiers refactor

Daniel Dunbar daniel at zuster.org
Fri Sep 25 23:33:09 PDT 2009


On Fri, Sep 25, 2009 at 8:57 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Sep 25, 2009, at 6:50 PM, Chris Lattner wrote:
>
>> On Sep 24, 2009, at 8:58 AM, Douglas Gregor wrote:
>> On Sep 23, 2009, at 2:04 AM, John McCall wrote:
>>>> The attached patch refactors how qualifiers are represented in
>>>> clang.
>>>>
>>>> Currently, QualType uses the bottom three bits of a type pointer to
>>>> represent the const, volatile, and restrict qualifiers.  Extended
>>>> qualifiers are represented using an ExtQualType object, which is an
>>>> ordinary node in the type hierarchy --- except that it isn't.  Most
>>>> common operations on types have to explicitly check for these
>>>> special qualifier nodes and handle them differently.
>>>
>>> ... except that most common operations end up forgetting that
>>> ExtQualType exists. One of the big benefits of this change is that
>>> all
>>> of the qualifiers are kept together, so it's easier to reason about
>>> them as a whole. Plus, ExtQualType didn't fit well into the type
>>> system; this does.
>>
>> I also really like this change.  However, 4% is a really big
>> slowdown.  Where is the time going?
>
> It looks like it's spread out; nothing specific floated upward in the
> Shark trace. My (bleak) hypothesis is that we''re getting death-by-a-
> thousand-cuts from QualType::getTypePtr(), which is ubiquitous and now
> has a branch.

Can you verify this theory with non-trivial branch in the non-patched version?

 - Daniel




More information about the cfe-commits mailing list