[all-commits] [llvm/llvm-project] bdb435: [SelectionDAG] Optimize copyExtraInfo deep copy
Marco Elver via All-commits
all-commits at lists.llvm.org
Mon Mar 6 08:31:01 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bdb4353ae00ab860ef8302f09e6f99f9d0450d19
https://github.com/llvm/llvm-project/commit/bdb4353ae00ab860ef8302f09e6f99f9d0450d19
Author: Marco Elver <elver at google.com>
Date: 2023-03-06 (Mon, 06 Mar 2023)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
A llvm/test/CodeGen/X86/pcsections-memops.ll
Log Message:
-----------
[SelectionDAG] Optimize copyExtraInfo deep copy
It turns out that there are relatively trivial, albeit rare, cases that
require a MaxDepth of more than 16 (see added test). However, we want to
avoid having to rely on a large fixed MaxDepth.
Since these cases are relatively rare, apply the following strategy:
1. Start with a low MaxDepth of 16 - if the entry node was not
reached, we can return (the common case).
2. If the entry node was reached, exponentially increase MaxDepth up
to some large limit that should cover all cases and guard against
stack exhaustion.
This retains the better performance with a low MaxDepth in the common
case, and in complex cases backs off and retries. On a whole, this is
preferable vs. starting with a large MaxDepth which would unnecessarily
penalize the common case where a low MaxDepth is sufficient.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D145386
More information about the All-commits
mailing list