<div dir="ltr"><div>Ping...</div><div><br></div><div><br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-09 11:01 GMT+08:00 Jiangning Liu <span dir="ltr"><<a href="mailto:liujiangning1@gmail.com" target="_blank">liujiangning1@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi t.p.northover,<br>
<br>
This is the updated patch for reverted patch "r216066 - Optimize ZERO_EXTEND and SIGN_EXTEND in both SelectionDAG Builder and type".<br>
<br>
The solution of r216066 slowed down a huge case reported by Rafael, so it was reverted. The root cause is CopyValueToVirtualRegisters in SelectionDAGBuilder is called too many times in back-end, and my original algorithm was to check all users for a value, so the time complexity could increase from O(n) to O(n^2) specifically for this feature.<br>
<br>
The new solution tries to do early decision making before real ISEL stage, and get the sext/zext preferences stored into FuncInfo. We can do this because deciding preferred sext/zext doesn't depend on SDNode but LLVM IR. This way, we will be able to calculate the info once and use it many times in real ISEL stage.<br>
<br>
With this patch, we won't see any slowdown for the test case at <a href="https://drive.google.com/file/d/0B7iRtublysV6RVpFUGNxaUcwc1E/edit?usp=sharing" target="_blank">https://drive.google.com/file/d/0B7iRtublysV6RVpFUGNxaUcwc1E/edit?usp=sharing</a>, which is a huge one.<br>
<br>
Thanks,<br>
-Jiangning<br>
<br>
<a href="http://reviews.llvm.org/D5257" target="_blank">http://reviews.llvm.org/D5257</a><br>
<br>
Files:<br>
  include/llvm/CodeGen/FunctionLoweringInfo.h<br>
  lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp<br>
  lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp<br>
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
  test/CodeGen/AArch64/atomic-ops.ll<br>
  test/CodeGen/AArch64/rm_redundant_cmp.ll<br>
</blockquote></div><br></div>