[PATCH] D50593: ConstantMerge: merge common initial sequences

JF Bastien via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 10 17:22:51 PDT 2018


jfb created this revision.
Herald added subscribers: llvm-commits, dexonsmith, JDevlieghere, aprantl.

Global constants are currently merged only if they're idential, with appropriate update of their alignment and debug info, and only if semantically correct. We can do better by merging global constants which are 'smaller' into equivalent 'bigger' global constants, under the same update / semantic restrictions as before. This patch implements such merging for global constants with common initial sequences of the exact same type.

As noted in the patch there are other common global constant merging opportunities which this patch chooses not to pursue. They might pay off, but might be more computationally expensive.

Because the merged globals are constants this is a gain in final executable size, and can help reduce the dynamic amount of data cache usage because there might be some temporal redundancy in global constant access.

rdar://problem/43163738


Repository:
  rL LLVM

https://reviews.llvm.org/D50593

Files:
  lib/Transforms/IPO/ConstantMerge.cpp
  test/Transforms/ConstantMerge/initial-match.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50593.160215.patch
Type: text/x-patch
Size: 21394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180811/61aba4bf/attachment.bin>


More information about the llvm-commits mailing list