SuccessChanges

Changes from Git (git http://labmaster3.local/git/llvm-project.git)

Summary

  1. CMake: Make most target symbols hidden by default (details)
  2. Relax the rules around objc_alloc and objc_alloc_init optimizations. (details)
Commit 0dbcb3639451a7c20e2d5133b459552281e64455 by tstellar
CMake: Make most target symbols hidden by default
Summary: For builds with LLVM_BUILD_LLVM_DYLIB=ON and
BUILD_SHARED_LIBS=OFF this change makes all symbols in the target
specific libraries hidden by default.
A new macro called LLVM_EXTERNAL_VISIBILITY has been added to mark
symbols in these libraries public, which is mainly needed for the
definitions of the LLVMInitialize* functions.
This patch reduces the number of public symbols in libLLVM.so by about
25%.  This should improve load times for the dynamic library and also
make abi checker tools, like abidiff require less memory when analyzing
libLLVM.so
One side-effect of this change is that for builds with
LLVM_BUILD_LLVM_DYLIB=ON and LLVM_LINK_LLVM_DYLIB=ON some unittests that
access symbols that are no longer public will need to be statically
linked.
Before and after public symbol counts (using gcc 8.2.1, ld.bfd 2.31.1):
nm before/libLLVM-9svn.so | grep ' [A-Zuvw] ' | wc -l 36221 nm
after/libLLVM-9svn.so | grep ' [A-Zuvw] ' | wc -l 26278
Reviewers: chandlerc, beanz, mgorny, rnk, hans
Reviewed By: rnk, hans
Subscribers: merge_guards_bot, luismarques, smeenai, ldionne, lenary,
s.egerton, pzheng, sameer.abuasal, MaskRay, wuzish, echristo, Jim,
hiraditya, michaelplatings, chapuni, jholewinski, arsenm, dschuff,
jyknight, dylanmckay, sdardis, nemanjai, jvesely, javed.absar, sbc100,
jgravelle-google, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso,
simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones,
mgrang, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX,
jocewei, kristina, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D54439
The file was modifiedllvm/unittests/CMakeLists.txt
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
The file was modifiedllvm/lib/Target/Lanai/MCTargetDesc/LanaiMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/AVR/AVRTargetMachine.cpp
The file was modifiedllvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
The file was modifiedllvm/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp
The file was modifiedllvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
The file was modifiedllvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
The file was modifiedllvm/lib/Target/WebAssembly/TargetInfo/WebAssemblyTargetInfo.cpp
The file was modifiedllvm/lib/Target/Lanai/Disassembler/LanaiDisassembler.cpp
The file was modifiedllvm/lib/Target/X86/X86AsmPrinter.cpp
The file was modifiedllvm/lib/Target/BPF/BPFAsmPrinter.cpp
The file was modifiedllvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
The file was modifiedllvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
The file was modifiedllvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
The file was modifiedllvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
The file was modifiedllvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
The file was modifiedllvm/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp
The file was modifiedllvm/lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp
The file was modifiedllvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
The file was modifiedllvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
The file was modifiedllvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
The file was modifiedllvm/lib/Target/Sparc/SparcAsmPrinter.cpp
The file was modifiedllvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
The file was modifiedllvm/lib/Target/Lanai/LanaiAsmPrinter.cpp
The file was modifiedllvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
The file was modifiedllvm/include/llvm/Support/Compiler.h
The file was modifiedllvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
The file was modifiedllvm/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/ARM/CMakeLists.txt
The file was modifiedllvm/lib/Target/ARC/Disassembler/ARCDisassembler.cpp
The file was modifiedllvm/lib/Target/NVPTX/TargetInfo/NVPTXTargetInfo.cpp
The file was modifiedllvm/lib/Target/ARC/TargetInfo/ARCTargetInfo.cpp
The file was modifiedllvm/lib/Target/ARM/ARMTargetMachine.cpp
The file was modifiedllvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
The file was modifiedllvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
The file was modifiedllvm/lib/Target/XCore/XCoreTargetMachine.cpp
The file was modifiedllvm/unittests/Target/AArch64/CMakeLists.txt
The file was modifiedllvm/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
The file was modifiedllvm/utils/unittest/CMakeLists.txt
The file was modifiedllvm/lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/Mips/CMakeLists.txt
The file was modifiedllvm/lib/Target/AMDGPU/TargetInfo/AMDGPUTargetInfo.cpp
The file was modifiedllvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
The file was modifiedllvm/lib/Target/BPF/BPFTargetMachine.cpp
The file was modifiedllvm/lib/Target/XCore/XCoreAsmPrinter.cpp
The file was modifiedllvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
The file was modifiedllvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
The file was modifiedllvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
The file was modifiedllvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
The file was modifiedllvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt
The file was modifiedllvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
The file was modifiedllvm/lib/Target/ARC/MCTargetDesc/ARCMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.cpp
The file was modifiedllvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
The file was modifiedllvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
The file was modifiedllvm/lib/Target/MSP430/Disassembler/MSP430Disassembler.cpp
The file was modifiedllvm/lib/Target/Sparc/SparcTargetMachine.cpp
The file was modifiedllvm/lib/Target/ARC/ARCAsmPrinter.cpp
The file was modifiedllvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/AArch64/CMakeLists.txt
The file was modifiedllvm/lib/Target/MSP430/MSP430TargetMachine.cpp
The file was modifiedllvm/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp
The file was modifiedllvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
The file was modifiedllvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
The file was modifiedllvm/lib/Target/AVR/AVRAsmPrinter.cpp
The file was modifiedllvm/lib/Target/X86/X86TargetMachine.cpp
The file was modifiedllvm/unittests/Target/ARM/CMakeLists.txt
The file was modifiedllvm/lib/Target/Mips/MipsAsmPrinter.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetMachine.cpp
The file was modifiedllvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
The file was modifiedllvm/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
The file was modifiedllvm/lib/Target/ARC/ARCTargetMachine.cpp
The file was modifiedllvm/unittests/Target/WebAssembly/CMakeLists.txt
The file was modifiedllvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp
The file was modifiedllvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/PowerPC/PPCTargetMachine.cpp
The file was modifiedllvm/lib/Target/ARM/ARMAsmPrinter.cpp
The file was modifiedllvm/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp
The file was modifiedllvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp
The file was modifiedllvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
The file was modifiedllvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
The file was modifiedllvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp
The file was modifiedllvm/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp
The file was modifiedllvm/lib/Target/Lanai/LanaiTargetMachine.cpp
The file was modifiedllvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/Mips/MipsTargetMachine.cpp
The file was modifiedllvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp
The file was modifiedllvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
The file was modifiedllvm/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
The file was modifiedllvm/lib/Target/RISCV/RISCVTargetMachine.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
The file was modifiedllvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
The file was modifiedllvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp
The file was modifiedllvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/PowerPC/CMakeLists.txt
The file was modifiedllvm/lib/Target/Hexagon/TargetInfo/HexagonTargetInfo.cpp
The file was modifiedllvm/lib/Target/CMakeLists.txt
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
The file was modifiedllvm/lib/Target/Lanai/TargetInfo/LanaiTargetInfo.cpp
The file was modifiedllvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
The file was modifiedllvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp
The file was modifiedllvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
The file was modifiedllvm/lib/Target/X86/TargetInfo/X86TargetInfo.cpp
Commit d18fbfc09720009c0dc6a1ddf315402ee0a7751d by phabouzit
Relax the rules around objc_alloc and objc_alloc_init optimizations.
Today the optimization is limited to:
- `[ClassName alloc]`
- `[self alloc]` when within a class method
However it means that when code is written this way:
```
   @interface MyObject
   - (id)copyWithZone:(NSZone *)zone
   {
       return [[self.class alloc] _initWith...];
   }
    @end
```
... then the optimization doesn't kick in and `+[NSObject alloc]` ends
up in IMP caches where it could have been avoided. It turns out that
`+alloc` -> `+[NSObject alloc]` is the most cached SEL/IMP pair in the
entire platform which is rather silly).
There's two theoretical risks allowing this optimization:
1. if the receiver is nil (which it can't be today), but it turns out
  that `objc_alloc()`/`objc_alloc_init()` cope with a nil receiver,
2. if the `Clas` type for the receiver is a lie. However, for such a
  code to work today (and not fail witn an unrecognized selector
  anyway) you'd have to have implemented the `-alloc` **instance
  method**.
   Fortunately, `objc_alloc()` doesn't assume that the receiver is a
  Class, it basically starts with a test that is similar to
       `if (receiver->isa->bits & hasDefaultAWZ) { /* fastpath */ }`.
   This bit is only set on metaclasses by the runtime, so if an instance
  is passed to this function by accident, its isa will fail this test,
  and `objc_alloc()` will gracefully fallback to `objc_msgSend()`.
   The one thing `objc_alloc()` doesn't support is tagged pointer
  instances. None of the tagged pointer classes implement an instance
  method called `'alloc'` (actually there's a single class in the
  entire Apple codebase that has such a method).
Differential Revision: https://reviews.llvm.org/D71682 Radar-Id:
rdar://problem/58058316 Reviewed-By: Akira Hatanaka Signed-off-by:
Pierre Habouzit <phabouzit@apple.com>
The file was modifiedclang/lib/CodeGen/CGObjC.cpp
The file was modifiedclang/test/CodeGenObjC/objc-alloc-init.m