On Jun 4, 2010, at 6:19 PM, Anders Carlsson wrote:

> 
> 4 jun 2010 kl. 18.14 skrev Devang Patel:
> 
>> Author: dpatel
>> Date: Fri Jun  4 20:14:40 2010
>> New Revision: 105516
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=105516&view=rev
>> Log:
>> Preserve type info for local variables in optimized builds. 
>> llvm-gcc enabled this couple of weeks ago.
>> 
>> Modified:
>>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=105516&r1=105515&r2=105516&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jun  4 20:14:40 2010
>> @@ -1477,7 +1477,7 @@
>>  llvm::DIVariable D =
>>    DebugFactory.CreateVariable(Tag, llvm::DIDescriptor(RegionStack.back()),
>>                                VD->getName(),
>> -                                Unit, Line, Ty);
>> +                                Unit, Line, Ty, 
>> CGM.getLangOptions().Optimize);
> 
> What about non-optimized builds?
> 

In unoptimized builds, the variable's name, type, location and value is 
preserved by the code generator based on the info provided by front end. 

In optimized build, the optimizer can remove a local variable entirely. We did 
some work in llvm optimizer and code generator recently to at least preserve 
variable name and type info in such cases. This is done by creating special 
purpose named metadata. This patch enables that support. The test case is in 
2010-05-14-Optimized-VarType.c in llvm module.

-
Devang
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to