llvm-project/clang/test/CodeGenObjCXX
Roman Lebedev 3dd5a298bf
[clang] Annotating C++'s `operator new` with more attributes
Summary:
Right now we annotate C++'s `operator new` with `noalias` attribute,
which very much is healthy for optimizations.

However as per [[ http://eel.is/c++draft/basic.stc.dynamic.allocation | `[basic.stc.dynamic.allocation]` ]],
there are more promises on global `operator new`, namely:
* non-`std::nothrow_t` `operator new` *never* returns `nullptr`
* If `std::align_val_t align` parameter is taken, the pointer will also be `align`-aligned
* ~~global `operator new`-returned pointer is `__STDCPP_DEFAULT_NEW_ALIGNMENT__`-aligned ~~ It's more caveated than that.

Supplying this information may not cause immediate landslide effects
on any specific benchmarks, but it for sure will be healthy for optimizer
in the sense that the IR will better reflect the guarantees provided in the source code.

The caveat is `-fno-assume-sane-operator-new`, which currently prevents emitting `noalias`
attribute, and is automatically passed by Sanitizers ([[ https://bugs.llvm.org/show_bug.cgi?id=16386 | PR16386 ]]) - should it also cover these attributes?
The problem is that the flag is back-end-specific, as seen in `test/Modules/explicit-build-flags.cpp`.
But while it is okay to add `noalias` metadata in backend, we really should be adding at least
the alignment metadata to the AST, since that allows us to perform sema checks on it.

Reviewers: erichkeane, rjmccall, jdoerfert, eugenis, rsmith

Reviewed By: rsmith

Subscribers: xbolva00, jrtc27, atanasyan, nlopes, cfe-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D73380
2020-02-26 01:37:17 +03:00
..
Inputs
2007-10-03-MetadataPointers.mm
2010-08-04-Template.mm
2010-08-06-X.Y-syntax.mm
address-safety-attr.mm
arc-attrs-abi.mm
arc-attrs.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-blocks.mm Revert "Revert "As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described there."" 2019-11-26 20:28:52 -08:00
arc-constexpr.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-cxx11-init-list.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-cxx11-member-init.mm
arc-exceptions.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-forwarded-lambda-call.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-globals.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-indirect.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
arc-list-init-destruct.mm [Sema] Check that the destructor for each element of class type is 2018-09-07 02:38:01 +00:00
arc-mangle.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
arc-marker-funclet.mm [AST] Revert mangling changes from r339428 2018-10-04 19:50:14 +00:00
arc-move.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-new-delete.mm [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
arc-pseudo-destructors.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-references.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-returns-inner-reference-ptr.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-special-member-functions.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-weak.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
auto-release-result-assert.mm
block-default-arg.mm
block-id.mm
block-in-template-inst.mm
block-nested-in-lambda.mm [CodeGen] Replace '@' characters in block descriptors' symbol names with 2018-12-29 17:28:30 +00:00
block-var-layout.mm
blocks.mm
boxing.mm
catch-id-type.mm
copy.mm [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
copyable-property-object.mm
crash-function-type.mm Pass the function type instead of the return type to FunctionDecl::Create 2018-11-11 00:56:15 +00:00
debug-info-block-capture-this.mm
debug-info-cyclic.mm
debug-info-line.mm [DEBUGINFO] Add support for emission of the debug directives only. 2018-08-31 13:56:14 +00:00
debug-info.mm
designated-initializers.mm [c++20] Implement semantic restrictions for C++20 designated 2019-08-30 22:52:55 +00:00
destroy.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
encode.mm [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs 2019-05-29 21:23:30 +00:00
exception-cxx.mm
exceptions-legacy.mm
exceptions.mm
externally-initialized-selectors.mm Specify target triple to fix the tests I committed in r360359 that are 2019-05-09 18:32:16 +00:00
foreach-statement.mm
gc.mm
implementation-in-extern-c.mm
implicit-copy-assign-operator.mm
implicit-copy-constructor.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
inheriting-constructor-cleanup.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
instantiate-return.mm [Sema][ObjC] Ensure that the return type of an ObjC method is a complete 2018-04-12 06:01:41 +00:00
ivar-objects.mm
lambda-expressions.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
lambda-to-block.mm [CodeGen] Use the mangle context owned by CodeGenModule to correctly 2018-10-20 05:45:01 +00:00
literals.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
lvalue-reference-getter.mm
mangle-blocks.mm Fix off-by-one error in block mangling. 2017-09-07 05:41:24 +00:00
mangle.mm
message-reference.mm
message.mm
method-local-extern-mangle.mm
microsoft-abi-arc-param-order.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
mrc-weak.mm [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
msabi-objc-extensions.mm [AST] Revert mangling changes from r339428 2018-10-04 19:50:14 +00:00
msabi-objc-types.mm [AST] Revert mangling changes from r339428 2018-10-04 19:50:14 +00:00
msabi-stret.mm [Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer' 2019-07-20 22:50:50 +00:00
nested-ehlocation.mm
nrvo.mm Revert "Revert "As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described there."" 2019-11-26 20:28:52 -08:00
objc-container-subscripting-1.mm
objc-container-subscripting.mm
objc-struct-cxx-abi.mm Revert "[CodeGenCXX] Treat 'this' as noalias in constructors" 2018-10-15 15:43:00 +00:00
objc-weak.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
objfw-exceptions.mm
os_log.mm [clang][NewPM] Add -fno-experimental-new-pass-manager to tests 2019-06-21 16:03:06 +00:00
personality-abuse.mm
personality.mm [CodeGen] Always use MSVC personality for windows-msvc targets 2018-06-08 00:41:01 +00:00
pr14474-gline-tables-only.mm [DEBUGINFO] Add support for emission of the debug directives only. 2018-08-31 13:56:14 +00:00
property-derived-to-base-conv.mm
property-dot-copy-elision.mm Revert "[CodeGenCXX] Treat 'this' as noalias in constructors" 2018-10-15 15:43:00 +00:00
property-dot-copy.mm
property-dot-reference.mm Fixed more -Wreturn-type tests 2019-11-09 18:13:51 +01:00
property-lvalue-capture.mm
property-lvalue-lambda.mm [CodeGen] Fix a regression by emitting lambda expressions in EmitLValue 2019-04-02 19:48:07 +00:00
property-object-conditional-exp.mm
property-object-reference-1.mm
property-object-reference-2.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
property-object-reference.mm
property-objects.mm Revert "[CodeGenCXX] Treat 'this' as noalias in constructors" 2018-10-15 15:43:00 +00:00
property-reference.mm
refence-assign-write-barrier.mm
references.mm
return.mm
rtti.mm
selector-expr-lvalue.mm
subst-sel.mm
synthesized-property-cleanup.mm Debug Info: Strengthen the synthesized-property-cleanup.mm test, NFC 2019-12-10 13:39:22 -08:00
ubsan-nullability-return-notypeloc.mm [ubsan] Null-check and adjust TypeLoc before using it 2020-02-10 14:10:06 -08:00
unknown-anytype.mm
write-barrier-global-assign.mm