<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 6/21/16 1:06 PM, vivek pandya wrote:<br>
    </div>
    <blockquote
cite="mid:CAHYgpoK9YTAm=59SQqHA2RSr2fVBtX63gUyttttBxd7iUnPzkA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Jun 21, 2016 at 9:57 PM,
            vivek pandya <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:vivekvpandya@gmail.com" target="_blank">vivekvpandya@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote">
              <div dir="ltr"><br>
                <div class="gmail_extra"><br>
                  <div class="gmail_quote"><span class="">On Tue, Jun
                      21, 2016 at 8:58 PM, John Criswell <span
                        dir="ltr"><<a moz-do-not-send="true"
                          href="mailto:jtcriswel@gmail.com"
                          target="_blank">jtcriswel@gmail.com</a>></span>
                      wrote:<br>
                      <blockquote class="gmail_quote">
                        <div><span>
                            <div>On 6/20/16 11:29 PM, Mehdi Amini wrote:<br>
                            </div>
                            <blockquote type="cite"> <br>
                              <div>
                                <blockquote type="cite">
                                  <div>On Jun 20, 2016, at 11:12 AM,
                                    John Criswell via llvm-dev <<a
                                      moz-do-not-send="true"
                                      href="mailto:llvm-dev@lists.llvm.org"
                                      target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></a>>
                                    wrote:</div>
                                  <br>
                                  <div>
                                    <div>On 6/20/16 9:39 AM, vivek
                                      pandya via llvm-dev wrote:<br>
                                    </div>
                                    <blockquote type="cite">
                                      <div dir="ltr">Dear Community,
                                        <div><br>
                                        </div>
                                        <div>To improve current
                                          interprocedural register
                                          allocation (IPRA) , we have
                                          planned to set callee saved
                                          registers to none for local
                                          functions, currently I am
                                          doing it in following way:</div>
                                        <div><br>
                                        </div>
                                        <div>if
                                          (F->hasLocalLinkage() <span> </span><span>&&
                                            !F->hasAddressTaken()</span>)
                                          {</div>
                                      </div>
                                    </blockquote>
                                    <br>
                                    <span>As an aside, you might want to
                                      analyze how many functions have
                                      both local linkage and are not
                                      address taken.  I recall that many
                                      functions returned false for</span></div>
                                </blockquote>
                              </div>
                            </blockquote>
                          </span></div>
                      </blockquote>
                    </span></div>
                </div>
              </div>
            </blockquote>
            <div>I think here you mean "returned true" but it should not
              return true for such case. Or I am making any mistake in
              understanding this? <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    You're correct; I said it backwards: hasAddressTaken() returns true
    when it could return false because the function pointer is casted to
    another function pointer type in one or more direct calls.<br>
    <br>
    To be clear, my experience is a bit dated; I'm recalling details
    from LLVM 3.2.  You should therefore test it for yourself to see if
    the issue still exists and if it is pessimizing your results.  I
    mentioned it because the problem existed for a long time during
    SAFECode's development, and so I got into the habit of never using
    hasAddressTaken().<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote
cite="mid:CAHYgpoK9YTAm=59SQqHA2RSr2fVBtX63gUyttttBxd7iUnPzkA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>- Vivek</div>
            <blockquote class="gmail_quote">
              <div dir="ltr">
                <div class="gmail_extra">
                  <div class="gmail_quote"><span class="">
                      <blockquote class="gmail_quote">
                        <div><span>
                            <blockquote type="cite">
                              <div>
                                <blockquote type="cite">
                                  <div><span> hasAddressTaken() because
                                      some direct calls casted the
                                      function to a different function
                                      type before calling it.  Such
                                      functions are still not address
                                      taken, but the simple
                                      hasAddressTaken() method can't
                                      determine it.</span><br>
                                  </div>
                                </blockquote>
                                <div><br>
                                </div>
                                <div>Looks like hasAddressTaken could be
                                  updated to handle these simple case
                                  maybe?</div>
                              </div>
                            </blockquote>
                            <br>
                          </span> That might make sense if it has not
                          been fixed already.  Another approach (if
                          in-tree LLVM passes are frequently checking
                          for indirect calls) would be to write a simple
                          analysis pass that lazily computes the
                          information on demand.  That way, if multiple
                          passes are checking the same function
                          repeatedly, it gets cached in the analysis
                          pass instead of being recomputed (so long as
                          the analysis pass is not invalidated by a
                          transform). <br>
                          <br>
                        </div>
                      </blockquote>
                    </span>
                    <div>Addition of new pass will require other passes
                      to be modified. So it will be good have strong
                      reason for adding new pass. Other wise I am in
                      favor to modify hasAddressTaken().</div>
                    <span class="HOEnZb">
                      <div><br>
                      </div>
                      <div>-Vivek</div>
                    </span><span class="">
                      <div> </div>
                      <blockquote class="gmail_quote">
                        <div> Regards,<br>
                          <br>
                          John Criswell<span><br>
                            <p><br>
                            </p>
                            <pre cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a moz-do-not-send="true" href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
                          </span></div>
                      </blockquote>
                    </span></div>
                  <br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
  </body>
</html>