<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Oct 26, 2016, at 10:10 AM, Chandler Carruth <<a href="mailto:chandlerc@google.com" class="">chandlerc@google.com</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">To what Reid said, I'm not really worried about impact on the middle end of any of this. We can handle the code changes, etc.<div class=""><br class=""></div><div class="">I agree with Chris about what we're trading off here:<br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Oct 25, 2016 at 10:48 PM Chris Lattner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">I’d argue the other side of it.  The quality of the code is higher if we have invariants (like all globals are pointers) because that simplifies assumptions by eliminating cases where “is a pointer” appears to be true, but isn’t actually true in all cases.  I’m not an expert on CFI or how widely it will ultimately impact the compiler hacker consciousness, but I’m pretty sure that the current model for globals and functions will remain more prominent.  If you choose to break this invariant, you’ll be continually swimming upstream against assumptions made throughout the compiler, both in code written today but also in code written in the future.<br class="gmail_msg"></div></div></blockquote><div class=""><br class=""></div><div class="">I agree that mental assumptions the developers on the middle end hold are the primary challenge here. But I think we are going to run into challenges either way.</div><div class=""><br class=""></div><div class="">If the type of these entities is an integer, we will have a non-pointer global, yes. But as Peter points out, this is caught effectively by asserts in the cast infrastructure and other programming aids. Essentially, the checking of LLVM's type system helps protect the random middle end developer from getting this wrong.</div><div class=""><br class=""></div><div class="">On the other hand, if the type of these entities remains consistently pointers, we will still break assumptions that middle end developers routinely make about pointers to globals:</div><div class="">- They aren't dereferencable</div><div class="">- They aren't aligned</div><div class="">- They may be null</div><div class="">- The difference between them might not be representable in a pointer-sized-integer</div></div></div></div></div></blockquote><div><br class=""></div><div>Aren’t all these true of “inttoptr’d” integer constants already?  This is already part of the model for things that are PointerType’s, so I don’t see how either resolution would change that.</div><div><br class=""></div><div>-Chris</div></div><br class=""></body></html>