[PATCH] Pass -mglobal-merge as a module flag metadata.

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri Feb 27 18:52:33 PST 2015


Hi dexonsmith,

Per title, we used to pass -mno-global-merge when specified, and enable GlobalMerge always (leaving it to LLVM to decide whether to actually enable it: it does, on ARM and AArch64, for -O1 and above).

This addresses two problems (I'm fine with splitting the patch if desired):
- with LTO, passing -mno-global-merge didn't do anything, since LTO implies -O3 from the backend's standpoint.
- GlobalMerge was enabled by -O1.  Instead, on AArch64, enable it at -O3, or when -mglobal-merge is specified. (the goal is to have it predicated by -O3 on ARM as well, but I still need to measure before doing that.)

Now, -mglobal-merge and -mno-global-merge are both explicitly passed by the driver.
They are then passed to the backend using module flag metadata (bikeshedding time: name is prose, and value is string.  We can change both, and AFAICT there's no similar backend flag to be consistent with, yet.)

Thanks!
-Ahmed

http://reviews.llvm.org/D7968

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/global-merge.c
  test/Driver/mglobal-merge.c
  test/Driver/mno-global-merge.c

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7968.20925.patch
Type: text/x-patch
Size: 8022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150228/560e139f/attachment.bin>


More information about the cfe-commits mailing list