<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 19/11/2013 5:57 PM, Peter Newman
      wrote:<br>
    </div>
    <blockquote cite="mid:528B0BE8.1050009@uformia.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 16/11/2013 7:58 AM, Nadav Rotem
        wrote:<br>
      </div>
      <blockquote
        cite="mid:CD3371A2-FC02-415F-82A7-6E3CA558CEC7@apple.com"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=ISO-8859-1">
        <br>
        <div>
          <div>On Nov 15, 2013, at 12:36 PM, Renato Golin <<a
              moz-do-not-send="true"
              href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>>

            wrote:</div>
          <br class="Apple-interchange-newline">
          <blockquote type="cite">
            <div dir="ltr">
              <div class="gmail_extra">
                <div class="gmail_quote">On 15 November 2013 20:24,
                  Joshua Klontz <span dir="ltr"><<a
                      moz-do-not-send="true"
                      href="mailto:josh.klontz@gmail.com"
                      target="_blank">josh.klontz@gmail.com</a>></span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    <div dir="ltr">Agreed, is there a pass that will
                      insert a runtime alignment check? Also, what's the
                      easiest way to get at
                      TargetTransformInfo::getRegisterBitWidth() so I
                      don't have to hard code 32? Thanks!</div>
                  </blockquote>
                </div>
                <br>
              </div>
              <div class="gmail_extra">I think that's a fair question,
                and it's about safety. If you're getting this on the
                JIT, means we may be generating unsafe transformations
                on the vectorizer.</div>
              <div class="gmail_extra"><br>
              </div>
              <div class="gmail_extra">Arnold, Nadav, I don't remember
                seeing code to generate any run-time alignment checks on
                the incoming pointer, is there such a thing? If not,
                shouldn't we add one?</div>
            </div>
          </blockquote>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        If the the vectorizer generates aligned memory accesses to
        unaligned addresses then this is a serious bug.  But I don’t
        think that Josh said that the vectorizer generated aligned
        accesses to unaligned pointers. <br>
      </blockquote>
      I've hit this (or a similar) bug, where generating SSE
      instructions for vector access was assuming stack memory would be
      aligned, if it was an aligned offset from the start of the
      allocation. But if the stack wasn't appropriately aligned when the
      function was called, the stack memory would be unaligned and cause
      an exception.<br>
    </blockquote>
    Actually, after reading the rest of the thread and the discussion of
    what was occurring, it seems I was generating a function without
    alignment specified, which via the "no alignment specified means
    align 0 which means ABI alignment" meant the generated code thought
    it was aligned appropriately. Specifying an alignment fixed this
    (and causes the generated code to manually ensure its alignment).<br>
    <br>
    <blockquote cite="mid:528B0BE8.1050009@uformia.com" type="cite">
      <blockquote
        cite="mid:CD3371A2-FC02-415F-82A7-6E3CA558CEC7@apple.com"
        type="cite">
        <div><br>
          <div>
            <div>
              <div>There is no point in LLVM checking for alignment
                because if the memory is unaligned then the program will
                crash.  Users who want to crash with a readable error
                message can simply write code that checks the pointer
                (by masking the high bits and comparing to zero).  <br>
                <br>
              </div>
            </div>
          </div>
        </div>
        <br>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>