<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 7, 2015, at 2:10 PM, Philip Reames <<a href="mailto:listmail@philipreames.com" class="">listmail@philipreames.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class="">
    <br class="">
    <div class="moz-cite-prefix">On 01/07/2015 12:17 PM, Pete Cooper
      wrote:<br class="">
    </div>
    <blockquote cite="mid:E7CA0A70-EE29-4C04-91FF-45D1B07EAD19@apple.com" type="cite" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
      <br class="">
      <div class="">
        <blockquote type="cite" class="">
          <div class="">On Jan 7, 2015, at 12:05 PM, Matt Arsenault <<a moz-do-not-send="true" href="mailto:arsenm2@gmail.com" class="">arsenm2@gmail.com</a>> wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=utf-8" class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              -webkit-line-break: after-white-space;" class=""><br class="">
              <div class="">
                <blockquote type="cite" class="">
                  <div class="">On Jan 7, 2015, at 2:55 PM, Philip
                    Reames <<a moz-do-not-send="true" href="mailto:listmail@philipreames.com" class="">listmail@philipreames.com</a>>
                    wrote:</div>
                  <br class="Apple-interchange-newline">
                  <div class="">
                    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" class="">
                    <div bgcolor="#FFFFFF" text="#000000" class=""> <br class="">
                      <div class="moz-cite-prefix">On 01/07/2015 11:52
                        AM, Matt Arsenault wrote:<br class="">
                      </div>
                      <blockquote cite="mid:AB31CCB0-C2EB-47DB-8C12-E657F97527ED@gmail.com" type="cite" class="">
                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
                        <br class="">
                        <div class="">
                          <blockquote type="cite" class="">
                            <div class="">On Jan 7, 2015, at 2:25 PM,
                              Owen Anderson <<a moz-do-not-send="true" href="mailto:resistor@mac.com" class="">resistor@mac.com</a>>
                              wrote:</div>
                            <br class="Apple-interchange-newline">
                            <div class="">
                              <meta http-equiv="content-type" content="text/html; charset=utf-8" class="">
                              <div dir="auto" class="">
                                <div class="">I'm not aware of any such
                                  restriction, and I know of several
                                  LLVM based systems that use address
                                  space 1 for something other than that.<br class="">
                                  <br class="">
                                  -Owen</div>
                              </div>
                            </div>
                          </blockquote>
                          <div class=""><br class="">
                          </div>
                          <div class="">Yes, this would be a problem for
                            us. We use 1 for a normal address space
                            where 0 is invalid. However, we also have a
                            problem where some other address spaces do
                            want 0 to be a valid address, which just
                            sort of don’t work correctly now.</div>
                        </div>
                      </blockquote>
                      If you have an example with a null in a non-0
                      address space being mishandled, please file a
                      bug.  We'll fix them as we find them.  <br class="">
                    </div>
                  </div>
                </blockquote>
                <div class=""><br class="">
                </div>
                <div class="">I think the problems aren’t so much that
                  accessing 0 doesn’t work (although I imagine there are
                  problems with that), but expectations of comparison
                  with null. The main problem I’m aware of is
                  comparisons with null pointers. The first global
                  object in addrspace(3) will have the address of 0, so
                  if a user does if (x != NULL), it will not behave as
                  expected. For C I think this is supposed to be fixed
                  by changing the value of NULL to -1, but I don’t think
                  that is currently supported. That is also complicated
                  because the null value is different for different
                  address spaces, and I think the actual null pointer
                  value must be 0 for C++. It doesn’t really turn up
                  often in real code so I don’t think anybody has really
                  spent time thinking about how to properly solve this.</div>
              </div>
            </div>
          </div>
        </blockquote>
        Actually, we had a similar discussion a while ago about this: <a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/064624.html" class="">http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/064624.html</a></div>
      <div class=""><br class="">
      </div>
      <div class="">In the link I gave, I proposed using global metadata to
        describe address spaces.  Its useful, for example, to know that
        an address space is always to constant memory, i.e., the CL
        model.</div>
      <div class=""><br class="">
      </div>
      <div class="">I think later in the conversation we also thought about
        defining the relationships between address spaces in a similar
        method to tbaa on types.  Then you could do address space AA.</div>
    </blockquote>
    I'm a bit hesitant* to do this with metadata.  At least to start
    with, these seem like backend specific properties.  Why not
    introduce some hooks into Target or Subtarget with the appropriate
    queries?<br class="">
    <br class="">
    * Reasons for hesitancy:<br class="">
    - Not sure these are purely optimizations - is dropping always
    legal?<br class=""></div></div></blockquote>It would be global metadata so can’t be dropped (or just isn’t right now so its ok anyway)<br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    - How do we merge such things in LTO?  <br class=""></div></div></blockquote>Thats a good point.<br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    - Forward serialization?  It might be better to define the
    properties better than design a reasonable scheme.<br class=""></div></div></blockquote>As is that.</div><div><br class=""></div><div>I think at the time I proposed metadata we didn’t have TTI or anything else similar.  I would be happy to say that things like null ptr deref are defined only for address space 0, and all other address spaces can only be optimised if TTI supports it.  This means no TTI would default to not optimizing anything other than address space 0 which I think is good.  </div><div><br class=""></div><div>You could also move all of the checks to TTI and define that NoTTI gives an answer for address space 0 and ignores all others.  Then you can just query TTI everywhere instead of special casing address space 0 everywhere.</div><div><br class=""></div><div>Pete<br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    <blockquote cite="mid:E7CA0A70-EE29-4C04-91FF-45D1B07EAD19@apple.com" type="cite" class="">
      <div class=""><br class="">
      </div>
      <div class="">Pete</div>
      <div class="">
        <blockquote type="cite" class="">
          <div class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              -webkit-line-break: after-white-space;" class="">
              <div class="">
                <div class=""><br class="">
                </div>
                <div class="">-Matt</div>
                <div class=""><br class="">
                </div>
                <br class="">
                <blockquote type="cite" class="">
                  <div class="">
                    <div bgcolor="#FFFFFF" text="#000000" class="">
                      <blockquote cite="mid:AB31CCB0-C2EB-47DB-8C12-E657F97527ED@gmail.com" type="cite" class="">
                        <div class="">
                          <div class=""><br class="">
                          </div>
                          <div class="">-Matt</div>
                          <div class=""><br class="">
                          </div>
                          <div class=""><br class="">
                          </div>
                          <br class="">
                          <blockquote type="cite" class="">
                            <div class="">
                              <div dir="auto" class="">
                                <div class=""><br class="">
                                  On Jan 7, 2015, at 1:18 PM, Philip
                                  Reames <<a moz-do-not-send="true" href="mailto:listmail@philipreames.com" class="">listmail@philipreames.com</a>>

                                  wrote:<br class="">
                                  <br class="">
                                </div>
                                <blockquote type="cite" class="">
                                  <div class="">
                                    <meta http-equiv="content-type" content="text/html; charset=utf-8" class="">
                                    On the review for <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://reviews.llvm.org/D6808">http://reviews.llvm.org/D6808</a>,
                                    <a moz-do-not-send="true" href="http://reviews.llvm.org/p/majnemer/" class=" phui-handle
 phui-link-person">majnemer</a>
                                    commented that:<br class="">
                                    <span class="transaction-comment" data-sigil="transaction-comment" data-meta="14_7">"Address space 1
                                      has a special meaning in LLVM,
                                      it's identical to address space 0
                                      except for the fact that "null"
                                      may be dereferenced. You might
                                      want to consider a different
                                      address space."<br class="">
                                      <br class="">
                                      This is the first I've heard of
                                      this and I can't find any
                                      documentation about it being
                                      reserved, either in general, or
                                      specifically for x86.  Can anyone
                                      clarify?<br class="">
                                      <br class="">
                                      The only address spaces with
                                      special meanings I know of are:<br class="">
                                      - 0 (the normal address space,
                                      null is not dereferencable)<br class="">
                                      - 256 - TLS, GS relative
                                      addressing<br class="">
                                      - 257 - FS relative addressing<br class="">
                                      <br class="">
                                      Philip<br class="">
                                    </span> </div>
                                </blockquote>
                                <blockquote type="cite" class="">
                                  <div class=""><span class="">_______________________________________________</span><br class="">
                                    <span class="">LLVM Developers
                                      mailing list</span><br class="">
                                    <span class=""><a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>
                                              <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a></span><br class="">
                                    <span class=""><a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span><br class="">
                                  </div>
                                </blockquote>
                              </div>
_______________________________________________<br class="">
                              LLVM Developers mailing list<br class="">
                              <a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>
                                      <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br class="">
                              <a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class="">
                            </div>
                          </blockquote>
                        </div>
                        <br class="">
                      </blockquote>
                      <br class="">
                    </div>
                  </div>
                </blockquote>
              </div>
              <br class="">
            </div>
            _______________________________________________<br class="">
            LLVM Developers mailing list<br class="">
            <a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br class="">
            <a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class="">
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
    <br class="">
  </div>

</div></blockquote></div><br class=""></body></html>