[PATCH] D137707: Move "auto-init" instruction to the dominator of their use

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 05:11:22 PST 2022


serge-sans-paille created this revision.
serge-sans-paille added reviewers: jfb, nickdesaulniers.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya.
Herald added a project: All.
serge-sans-paille requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As a result of `-ftrivial-auto-var-init`,  clang generates instructions to set alloca'd memory to a given pattern, right after the allocation site. In some cases, this (somehow costly) operation could be delayed, leading to conditional execution in some cases.

This is not an uncommon situation: it happens ~600 times on the cPython code base, and much more on the LLVM codebase. The benefit greatly varies on the execution path, but it should not regress on performance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137707

Files:
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Utils.h
  llvm/include/llvm/Transforms/Utils/MoveAutoInit.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Utils/CMakeLists.txt
  llvm/lib/Transforms/Utils/MoveAutoInit.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137707.474231.patch
Type: text/x-patch
Size: 18659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221109/15cf9206/attachment.bin>


More information about the llvm-commits mailing list