[LTO] Don't create a new common unless merged has different size
authorTeresa Johnson <tejohnson@google.com>
Sat, 27 Aug 2016 04:41:22 +0000 (04:41 +0000)
committerTeresa Johnson <tejohnson@google.com>
Sat, 27 Aug 2016 04:41:22 +0000 (04:41 +0000)
commite2e621a36c400f907e8a19545feffbcabfd66919
tree02b952a5d38eeac4a1458068a1c73b9744886da6
parenta15ea4e217ddc4929f806eb27f49a61d9d6acc84
[LTO] Don't create a new common unless merged has different size

Summary:
This addresses a regression in common handling from the new LTO
API in r278338. Only create a new common if the size is different.
The type comparison against an array type fails when the size is
different but not an array. GlobalMerge does not handle the
array types as well and we lose some global merging opportunities.

Reviewers: mehdi_amini

Subscribers: junbuml, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D23955

llvm-svn: 279911
llvm/lib/LTO/LTO.cpp
llvm/test/tools/gold/X86/common.ll
llvm/test/tools/gold/X86/start-lib-common.ll