[PATCH] Implement ADRP CSE for global symbols

Jiangning Liu liujiangning1 at gmail.com
Mon May 12 00:06:38 PDT 2014


Hi Quentin,

Sorry for those failures introduced, and yes they are all my fault, and now the new patch should have all issues fixed.

There was a logic error around the original assertion and it was only to check the 1st global for each different global variable merges. And actually this is was newly introduced by the 1st refactoring patch.

Anyway this new patch fixed the followings,

1) The compilation failures you mentioned. A new test case global-merge-3.ll is added to detect this regression. This test intends to mix the "internal global" and "global", and test multiple merged globals.

If "internal globals" and "globals" are mixed in the same merged globals, we will use the 1st "global" name as the suffix as this newly created merged global variable.

2) Ask "internal global" to also use alignment target hook. Yes, you are right, we can also apply this special hook to internal globals. I didn't do this previously, because I didn't want to mix the globals exposing names to other symbols with the internal globals, for which we don't need to expose names to other modules at all. And also I think applying this alignment hook to "internal globals" should be orthogonal with -global-merge-on-external, so now I introduced another command line switch -global-merge-aligned. i.e.

-global-merge-on-external: control if globals excluding "internal globals" will be merged. 
-global-merge-aligned: control if the special alignment will be applied to merged globals.

3) This patch is also formatted with git-clang-format.

Thanks,
-Jiangning

http://reviews.llvm.org/D3432

Files:
  include/llvm/IR/GlobalAlias.h
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/IR/Globals.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AArch64/AArch64ISelLowering.h
  lib/Target/ARM64/ARM64ISelLowering.cpp
  lib/Target/ARM64/ARM64ISelLowering.h
  lib/Transforms/Scalar/GlobalMerge.cpp
  lib/Transforms/Scalar/Scalar.cpp
  test/CodeGen/AArch64/global-merge.ll
  test/CodeGen/AArch64/global_merge_1.ll
  test/CodeGen/ARM/global-merge-1.ll
  test/CodeGen/ARM64/global-merge.ll
  test/Transforms/GlobalMerge/AArch64/global-merge-1.ll
  test/Transforms/GlobalMerge/AArch64/global-merge-2.ll
  test/Transforms/GlobalMerge/AArch64/global-merge-3.ll
  test/Transforms/GlobalMerge/AArch64/lit.local.cfg
  test/Transforms/GlobalMerge/ARM/arm.ll
  test/Transforms/GlobalMerge/ARM64/arm64.ll
  tools/opt/opt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3432.9301.patch
Type: text/x-patch
Size: 34418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140512/5410b2bd/attachment.bin>


More information about the llvm-commits mailing list