[PATCH] D145386: [SelectionDAG] Optimize copyExtraInfo deep copy

Marco Elver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 07:49:54 PST 2023


melver created this revision.
melver added a reviewer: dvyukov.
Herald added subscribers: ecnelises, pengfei, hiraditya.
Herald added a project: All.
melver requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145386

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/X86/pcsections-memops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145386.502651.patch
Type: text/x-patch
Size: 15528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230306/1ff1b840/attachment.bin>


More information about the llvm-commits mailing list