[PATCH] D49822: [GlobalMerge] Allow merging globals with explicit section markings.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 14:25:36 PDT 2018


efriedma created this revision.
efriedma added a reviewer: greened.

At least on ELF, it's impossible to tell without disassembling the code whether two globals with the same section marking were merged: the merged global uses "private" linkage to hide its symbol, and the aliases look like regular symbols.  I can't think of any other reason to disallow it. (Of course, we can only merge globals in the same section.)

The weird alignment handling matches AsmPrinter; our alignment handling for global variables should probably be refactored.

This transform is very profitable for one proprietary codebase I've been looking at, which uses a lot of globals with section markings.


Repository:
  rL LLVM

https://reviews.llvm.org/D49822

Files:
  lib/CodeGen/GlobalMerge.cpp
  test/Transforms/GlobalMerge/basic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49822.157356.patch
Type: text/x-patch
Size: 5489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180725/48bf0167/attachment-0001.bin>


More information about the llvm-commits mailing list