<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 16, 2017, at 2:22 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Feb 16, 2017 at 2:10 PM Adrian Prantl via Phabricator <<a href="mailto:reviews@reviews.llvm.org" class="">reviews@reviews.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">aprantl added inline comments.<br class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg">================<br class="gmail_msg">Comment at: lib/Bitcode/Reader/MetadataLoader.cpp:1117<br class="gmail_msg">+    Optional<unsigned> AddressSpace = None;<br class="gmail_msg">+    if (Record.size() > 12 && Record[12] != ~0U)<br class="gmail_msg">+      AddressSpace = Record[12];<br class="gmail_msg">----------------<br class="gmail_msg">kzhuravl wrote:<br class="gmail_msg">> dblaikie wrote:<br class="gmail_msg">> > What's the magical ~0U value about?<br class="gmail_msg">> I used it as a sentinel value to represent "None" optional dwarf address space in the bitcode (we always generate and read address space record, if it is ~0U, then we pass None when creating DIDerivedType).<br class="gmail_msg">><br class="gmail_msg">> Would it be better to not write address space record if it is None?<br class="gmail_msg">><br class="gmail_msg">> We can also use UINT24_MAX + 1 (we would need to define UINT24_MAX). or ADDRESS_SPACE_MAX?<br class="gmail_msg">I'm pretty sure we prefer bitcode records from the same LLVM revision to always have the same number of elements.<br class="gmail_msg">Typically we use 0 as the default value and omit it in the textual IR.<br class="gmail_msg">What would you think about encoding the address space as n+1, with 0 being the default=None value?<br class="gmail_msg"></blockquote><div class=""><br class=""></div><div class="">I was going to say that seems a bit ugly (compared to using max value as the marker) - but then rememered the bitcode format uses variable length encoding, so encoding the max value probably isn't as cheap as zero, I guess?<br class=""></div></div></div></div></blockquote><div><br class=""></div>Thank you for providing a rational explanation for my gut instinct! :-)<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class=""><br class="">- Dave</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><br class="gmail_msg"><br class="gmail_msg"><a href="https://reviews.llvm.org/D29670" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D29670</a></blockquote></div></div></div></blockquote></div><br class=""></body></html>