llvm-project/clang/test/CodeGenCoroutines
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
coro-alloc.cpp [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
coro-await-domination.cpp
coro-await-resume-eh.cpp Revert "[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition" 2020-02-03 10:09:39 -08:00
coro-await.cpp IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
coro-builtins-err.c
coro-builtins.c [coroutines] Add __builtin_coro_noop => llvm.coro.noop 2018-04-02 17:35:37 +00:00
coro-cleanup.cpp [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
coro-dest-slot.cpp [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame 2017-11-11 17:00:43 +00:00
coro-eh-cleanup.cpp [MS] Don't escape MS C++ names with \01 2018-03-16 20:36:49 +00:00
coro-gro-nrvo.cpp [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
coro-gro.cpp [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
coro-lambda.cpp Revert "[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition" 2020-02-03 10:09:39 -08:00
coro-newpm-pipeline.cpp [Coroutines][6/6] Clang schedules new passes 2020-02-19 01:03:28 -05:00
coro-params.cpp Revert "[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition" 2020-02-03 10:09:39 -08:00
coro-promise-dtor.cpp [MS] Don't escape MS C++ names with \01 2018-03-16 20:36:49 +00:00
coro-ret-void.cpp Revert "[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition" 2020-02-03 10:09:39 -08:00
coro-retcon-unreachable.ll Remove unreachable blocks before splitting a coroutine. 2019-08-14 03:54:13 +00:00
coro-return.cpp [clang] Annotating C++'s `operator new` with more attributes 2020-02-26 01:37:17 +03:00
coro-unhandled-exception.cpp [Coroutines] Catch exceptions in await_resume 2018-05-04 14:02:37 +00:00
microsoft-abi-operator-coawait.cpp [MS] Don't escape MS C++ names with \01 2018-03-16 20:36:49 +00:00