[Clang][CodeGen][Coroutines] Make coroutine startup exception-safe (C… (#202279)
…WG2935)
This patch attempts to implement the solution I proposed for [CWG2935
(Github)](https://github.com/cplusplus/CWG/issues/575), aligning Clang's
behavior with GCC and MSVC instead of leaving it undefined. When
`initial_suspend` (as well as `ready` and `suspend`) throws an
exception, Clang fails to destroy the task even though the task has
already been initialized (see https://godbolt.org/z/E4Y4bEn54).
This patch updates CGCoroutine.cpp to clean up the coroutine return
value after an exception is thrown when it is constructed in place,
addressing CWG2935.
I would like to hear more opinions on the solution and seek help to fix
Clang.
[ValueTracking] Handle chain of single-pred blocks in willNotFreeBetween() (#202308)
willNotFreeBetween() currently handles the case where both instructions
are in the same block, or one is in the single predecessor of the other.
This patch extends this to handle a chain of single predecessor blocks.
The budget now applies to all checked instructions, rather than per
block. Also increase the budget by a factor of two (which means that new
budget interpretation should never regress relative to the previous).
[SafeStack] Introduce public interface header and deprecate builtins (#198292)
Introduce `sanitizer/safestack_interface.h` to expose SafeStack utility
functions as a public interface, similar to other sanitizers.
Exposed functions:
* `__safestack_get_unsafe_stack_ptr`
* `__safestack_get_unsafe_stack_bottom`
* `__safestack_get_unsafe_stack_top`
Deprecate the existing `__builtin___get_unsafe_stack_*` builtins and
emit warnings suggesting the new `__safestack_` equivalents.
Runtime compatibility aliases `__get_unsafe_stack_*` are maintained.
[InstCombine] Don't reuse a sibling binop with extra flags via demanded elts (#199782) (#201545)
SimplifyDemandedVectorElts can replace a vector binop with a sibling
binop. But if the sibling carries a flag the original lacked, it could
produce a result the original never would. E.g.
Reusing `sub nuw` could make the result poison on wrap.
Reusing `fmul nsz` could flip the sign of a zero.
Reusing `fdiv arcp` could make the result less accurate.
Fix by only reusing the sibling when its flags are a subset of the
replaced binop's.
https://alive2.llvm.org/ce/z/9yEaG7
Fixes #199782.
[LAA] Don't check for free in evaluatePtrAddRecAtMaxBTCWillNotWrap() (#202341)
The fact that an object of a certain size existed at the the location at
some point is sufficient to prove the desired nowrap fact. Whether the
object still exists there doesn't matter in this context.