<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 4, 2010, at 6:19 PM, Anders Carlsson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>4 jun 2010 kl. 18.14 skrev Devang Patel:<br><br><blockquote type="cite">Author: dpatel<br></blockquote><blockquote type="cite">Date: Fri Jun  4 20:14:40 2010<br></blockquote><blockquote type="cite">New Revision: 105516<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=105516&view=rev">http://llvm.org/viewvc/llvm-project?rev=105516&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">Preserve type info for local variables in optimized builds. <br></blockquote><blockquote type="cite">llvm-gcc enabled this couple of weeks ago.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified:<br></blockquote><blockquote type="cite">   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=105516&r1=105515&r2=105516&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=105516&r1=105515&r2=105516&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br></blockquote><blockquote type="cite">+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jun  4 20:14:40 2010<br></blockquote><blockquote type="cite">@@ -1477,7 +1477,7 @@<br></blockquote><blockquote type="cite">  llvm::DIVariable D =<br></blockquote><blockquote type="cite">    DebugFactory.CreateVariable(Tag, llvm::DIDescriptor(RegionStack.back()),<br></blockquote><blockquote type="cite">                                VD->getName(),<br></blockquote><blockquote type="cite">-                                Unit, Line, Ty);<br></blockquote><blockquote type="cite">+                                Unit, Line, Ty, CGM.getLangOptions().Optimize);<br></blockquote><br>What about non-optimized builds?<br><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>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. </div><div><br></div><div>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.</div><div><br></div><div>-</div><div>Devang</div></body></html>