[PATCH] Optimize sext/zext insertion algorithm in back-end

Jiangning Liu liujiangning1 at gmail.com
Sun Sep 14 18:34:19 PDT 2014


Ping...




2014-09-09 11:01 GMT+08:00 Jiangning Liu <liujiangning1 at gmail.com>:

> Hi t.p.northover,
>
> This is the updated patch for reverted patch "r216066 - Optimize
> ZERO_EXTEND and SIGN_EXTEND in both SelectionDAG Builder and type".
>
> 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.
>
> 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.
>
> With this patch, we won't see any slowdown for the test case at
> https://drive.google.com/file/d/0B7iRtublysV6RVpFUGNxaUcwc1E/edit?usp=sharing,
> which is a huge one.
>
> Thanks,
> -Jiangning
>
> http://reviews.llvm.org/D5257
>
> Files:
>   include/llvm/CodeGen/FunctionLoweringInfo.h
>   lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
>   lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
>   lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>   test/CodeGen/AArch64/atomic-ops.ll
>   test/CodeGen/AArch64/rm_redundant_cmp.ll
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140915/f4b795b4/attachment.html>


More information about the llvm-commits mailing list