[PATCH] D155773: [llvm][MemoryBuiltins] Add alloca support to getInitialValueOfAllocation

John McIver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 22:15:40 PDT 2023


jmciver created this revision.
jmciver added reviewers: nikic, efriedma, fhahn.
Herald added subscribers: kmitropoulou, ormris, ChuanqiXu, StephenFan, wenlei, steven_wu, hiraditya.
Herald added a project: All.
jmciver published this revision for review.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This commit is in support of future uninitialized memory handling and adds
alloca instruction support to getInitialValueOfAllocation. This unifies initial
memory state querying (both stack and heap) to a single utility function.

Several optimizations are refactored to take advantage of alloca support in
getInitialValueOfAllocation, see below list. A majority of the optimizations are
effected by the migration of PromoteMemToReg to use getInitialValueOfAllocation,
which requires TLI for allocation function data, but is not used in support of
alloca instructions.

- PromoteMemToReg
- Mem2Reg
- IPO
- CoroSplit
- Coroutines (clang)
- GVN
- NewGVN
- Statepoint

Coroutines have a clang based optimization call to PromoteMemToReg from
FinishFunction, which requires a TLI object outside of the optimization pass
framework. Generation of the TLI is added at the module level to prevent
generation of multiple TLI objects for each coroutine function contained
within. Furthermore generation of the TLI object is lazy.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155773

Files:
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  llvm/include/llvm/Analysis/MemoryBuiltins.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/Coroutines/CoroInternal.h
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/lib/Transforms/Scalar/NewGVN.cpp
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/Mem2Reg.cpp
  llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-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: D155773.542283.patch
Type: text/x-patch
Size: 26834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/202b4079/attachment.bin>


More information about the llvm-commits mailing list