[PATCH] D110613: [Taildup] Don't tail-duplicate loop header with multiple successors as its latches
JunMa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 8 23:39:45 PDT 2021
junparser added a comment.
In D110613#3029273 <https://reviews.llvm.org/D110613#3029273>, @junparser wrote:
> In D110613#3027076 <https://reviews.llvm.org/D110613#3027076>, @lkail wrote:
>
>> IIUC, switching this pattern off might lose some optimization commonly seen in interpreter, e.g., https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables. Do you have any benchmark numbers?
>
> Hi, thanks for the reminder!
> I tested the change with spec cpu2017, and there was no performance change. I also tested the case in https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables, and I add it int tesetcase as well. This patch has no effect on most of the interpreter switch loop.
>
> However, i test the case offered by @alexfh based on D106056 <https://reviews.llvm.org/D106056> and w/o this change, it show 1x performance gains without the change. The reduced case is large_loop_switch in testcase.
>
> The root reason is that llvm optimizer usually does not change unused default case into unreachable before D106056 <https://reviews.llvm.org/D106056>. The interpreter switch loop also keeps this branch when transform to jumptable, The loop form become to :
>
> //
> // / <---------/ / /
> // 0-> 1-> 2 -> 3 / /
> // \ \ -> 4 /
> // \ \ -> 5
> // \---> default
>
> the default bb can not tail duplicate into loop header. With D106056 <https://reviews.llvm.org/D106056>, the unreachable default bb is removed, then taildup can help to transform switch loop into dispatch table.
@lkail @MatzeB any suggestion with the parameter value 128?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110613/new/
https://reviews.llvm.org/D110613
More information about the llvm-commits
mailing list