[PATCH] D57898: CodeGen: Fix PR40605: split constant structures generated by -ftrivial-auto-var-init when emitting initializators

Alexander Potapenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 12 07:48:18 PST 2019


glider updated this revision to Diff 186469.
glider marked an inline comment as done.
glider added a subscriber: pcc.
glider added a comment.

Added a helper function to decide whether we want to break the structure or not.
Right now it only checks for optimization level and structure size.

The constant 64 is picked to match the cacheline size. Other interesting numbers I've considered  were:

- 160 - a size of a kernel structure for which the initialization was inlined without any noticeable profit (no stores to that uninit structure in the same function)
- 256 - the maximum size for an inlined memset/memcpy with -mno-sse
- 512 - the maximum size for an inlined memset/memcpy with SSE enabled/

I don't think we have enough data to back any of the choices though.

I've also fixed the code to skip zero-size memset() calls.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57898/new/

https://reviews.llvm.org/D57898

Files:
  tools/clang/lib/CodeGen/CGDecl.cpp
  tools/clang/test/CodeGenCXX/auto-var-init.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57898.186469.patch
Type: text/x-patch
Size: 45948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190212/1ac62f77/attachment-0001.bin>


More information about the cfe-commits mailing list