[AArch64, ARM] Enable GlobalMerge with -O3 rather than -O1.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Mon, 23 Mar 2015 21:17:36 +0000 (21:17 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Mon, 23 Mar 2015 21:17:36 +0000 (21:17 +0000)
commitc9ad3ab62466cbfb774e40260161015f4fbaecae
tree1c927870bd2ec48fb6a0bdb3bd9ce572ddf54515
parent6a4686f3f14fe83e78348645d1a6f5f7e7f783bd
[AArch64, ARM] Enable GlobalMerge with -O3 rather than -O1.

The pass used to be enabled by default with CodeGenOpt::Less (-O1).
This is too aggressive, considering the pass indiscriminately merges
all globals together.

Currently, performance doesn't always improve, and, on code that uses
few globals (e.g., the odd file- or function- static), more often than
not is degraded by the optimization.  Lengthy discussion can be found
on llvmdev (AArch64-focused;  ARM has similar problems):
  http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-February/082800.html
Also, it makes tooling and debuggers less useful when dealing with
globals and data sections.

GlobalMerge needs to better identify those cases that benefit, and this
will be done separately.  In the meantime, move the pass to run with
-O3 rather than -O1, on both ARM and AArch64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233024 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
lib/Target/AArch64/AArch64TargetMachine.cpp
lib/Target/ARM/ARMTargetMachine.cpp
test/CodeGen/AArch64/global-merge-1.ll
test/CodeGen/AArch64/global-merge-2.ll
test/CodeGen/AArch64/global-merge-3.ll
test/CodeGen/AArch64/global-merge-4.ll
test/CodeGen/ARM/2010-12-15-elf-lcomm.ll
test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll
test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
test/CodeGen/ARM/global-merge-1.ll
test/CodeGen/ARM/global-merge-addrspace.ll
test/CodeGen/ARM/global-merge.ll