[cfe-commits] r110660 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenFunction.h test/CodeGen/2010-08-10-DbgConstant.c

Devang Patel dpatel at apple.com
Tue Aug 10 14:01:50 PDT 2010


On Aug 10, 2010, at 1:43 PM, Chris Lattner wrote:

> 
> On Aug 10, 2010, at 10:57 AM, Devang Patel wrote:
> 
>>>> 
>>>> +  if (C)
>>>> +    Dbg->EmitGlobalVariable(C, E->getDecl(), Builder);
>>> 
>>> This is calling EmitGlobalVariable *every* time a constant is codegen'd in the code.  In your example, ro+ro+ro+ro will cause the global to get emitted 4 times.  I realize that MDNodes do autouniquing, but doesn't this sound inefficient?
>> 
>> I am not anticipating any measurable compile time penalty in real world scenarios here. However, we could add a SmallPtrSet to keep track of emitted constants at CGDebugInfo level. This means overhead for EmitGlobalVariable() call will remain. What do you think ?
> 
> I'm not sure.  How do other global variables get uniqued?

They are only codegen'ed once. clang code generator maintains cache for types, namespace. subprogram.
-
Devang



More information about the cfe-commits mailing list