<div dir="ltr">I'm pretty sure the null pointer for address space zero is necessarily zero - but off-hand don't know if/where that's specified, hopefully someone else can cchime in with that info.<br><br>If that's the only guarantee (& there's no guarantee on non-zero address space's null pointer representation) is that sufficient to address some cases you're dealing with, or is the address space not known at the point where you're trying to make this decision? (ie: you could only use zero if you know all address spaces have zero null pointers)<br><br><div> - Dave</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 4, 2018 at 6:48 AM Jeremy Morse via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi llvm-dev@,</div><div><br></div><div>It recently transpired that LLVM doesn't correctly preserve debugging information when null pointer constants are assigned to variables [0], with the debug records getting dropped by SelectionDAG. Fixing that [1] raises a few questions about the bit-value of null in different address spaces, so I'd like to ask:</div><div> * Can we just assume that null is zero-valued for all address spaces?<br></div><div> * If not, are there APIs available for determining an address spaces' null-value?</div><div><br></div><div>What's permissible / disallowed for address spaces is unclear to me. Various comments around the code base suggest that nullptr is always zero for address space zero; I'm not aware of rules for other address spaces. Without further information, the current solution is to have non-zero address space nulls marked as "optimized out".</div><div><br></div><div>[0] <a href="https://bugs.llvm.org/show_bug.cgi?id=39787" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=39787</a></div><div>[1] <a href="https://reviews.llvm.org/D55227" target="_blank">https://reviews.llvm.org/D55227</a></div><div><br></div><div>--</div><div>Thanks,</div><div>Jeremy</div><div><br></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>