Convert some ObjC msgSends to runtime calls.
authorPete Cooper <peter_cooper@apple.com>
Sat, 8 Dec 2018 05:13:50 +0000 (05:13 +0000)
committerPete Cooper <peter_cooper@apple.com>
Sat, 8 Dec 2018 05:13:50 +0000 (05:13 +0000)
commite388680dfa178e5f433f766b51fea2471c40d7be
tree3231e86f4cca324be840149b2ee599aeca25db64
parentd076608d58d1ec55016eb747a995511e3a3f72aa
Convert some ObjC msgSends to runtime calls.

It is faster to directly call the ObjC runtime for methods such as alloc/allocWithZone instead of sending a message to those functions.

This patch adds support for converting messages to alloc/allocWithZone to their equivalent runtime calls.

Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions.

Reviewed By: rjmccall

https://reviews.llvm.org/D55349

llvm-svn: 348687
clang/include/clang/Basic/ObjCRuntime.h
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/CodeGenOptions.def
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/CodeGenModule.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGenObjC/convert-messages-to-runtime-calls.m [new file with mode: 0644]
clang/test/Driver/objc-convert-messages-to-runtime-calls.m [new file with mode: 0644]