<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 1, 2017 at 12:39 AM Nikola Prica via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">NikolaPrica added inline comments.<br>
<br>
<br>
================<br>
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:1577<br>
+  for(auto *GV : GVs)<br>
+    NewGV->addDebugInfo(GV);<br>
+<br>
----------------<br>
aprantl wrote:<br>
> I'm not familiar with this transformation: Do we need to add a DIExpression to mask out all but the first bit (i.e. can multiple bools be packed into the same uint32_t such that it could confuse debuggers)?<br>
The debug info which is provided here with addDebugInfo later generates address of the variable (DW_OP_addr: xxxx) in DW_AT_location. If we provide here metadata which is for 1byte variable  the debugger would get confused because the enum type is written as 4-byte and he would try to read 4 bytes. This is just temporary fix until proper way to handle this is found.<br></blockquote><div><br>How does the compiler know the other 3 bytes won't be used when it's performing this optimization? Based on the fact that they've not been observed by the code, so aren't needed? Then they could hold any values?<br><br>Sounds like that's the right thing, then - to describe this as Adrian was suggesting, that we should be using a DIExpression to mask out the high bits (or specifically/said differently, describing this byte as a fragment of the larger variable). Yeah, it means we don't know what the rest of the bytes are, and a debugger might not print the enum value (because it only knows a quarter of the bits), but that's still probably the right thing... <br><br>(I'd be somewhat OK handling that in a follow-up commit, but I'll leave that call up to Adrian either way)<br><br>- Dave<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D35994" rel="noreferrer" target="_blank">https://reviews.llvm.org/D35994</a><br>
<br>
<br>
<br>
</blockquote></div></div>