<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Shuxin,<div><br></div><div><div><div>On Aug 23, 2013, at 1:13 PM, Shuxin Yang <<a href="mailto:shuxin.llvm@gmail.com">shuxin.llvm@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi, Quentin:<br>
    <br>
       Shouldn't copy-propagation is supposed to already xform the code
    in the way you want?<br></div></blockquote><div>No, not at the MI level.</div><div>Basically, the problem appears after instruction selection because of a combination of bit cast, vector extract and such.</div><div>Generally the MI IR is in good shape but in some (rare) cases, we end up with such things.</div><div><br></div><div>Thanks for the feedback.</div><div><br></div><div>-Quentin </div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Shuxin <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 8/23/13 1:04 PM, Quentin Colombet
      wrote:<br>
    </div>
    <blockquote cite="mid:DFC13BBD-60AB-46E8-B3AC-DFE34ADB4369@apple.com" type="cite">
      <pre wrap="">Hi,

Here is a patch to rewrite copies to avoid cross register banks copies when possible.
Thanks for your reviews.

** Context **

By definition copies across register bank are not coalescable. Still, it may be possible to get rid of such a copy when the value is available in another register of the same register file.
Consider the following example, where capital and lower letters denote different register file:
b = copy A <-- cross-bank copy

C = copy b <-- cross-bank copy

This could have been optimized this way:
b = copy A  <-- cross-bank copy

C = copy A <-- same-bank copy

Note: b and C's definitions may be in different basic blocks.


** Proposed Solution **

Add a peephole optimization that looks through a chain of copies leading to a cross-bank copy and reuses a source that is on the same register file if available.

This solution could also be used to get rid of some copies (e.g., A could have been used instead of C). However, we do not do so because:
- It may over constrain the coloring of the source register for coalescing.
- The register allocator may not be able to find a nice split point for the longer live-range, leading to more spill.


** Testcase?! **

This patch does not include a test case, because it is very difficult to reproduce this behavior with a reasonably small input.

Cheers,
-Quentin
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div></body></html>