SuccessChanges

Summary

  1. [SLP][NFC] Fix condition that was supposed to save a bit of compile time. (details)
  2. [lldb] Enable TestRuntimeTypes on Apple Silicon (details)
  3. [lldb] Support new objective-c hash table layout (details)
  4. Introduce alloca_scope op (details)
  5. [Sema] Address-space sensitive check for unbounded arrays (v2) (details)
  6. CodeGen: Fix missing const (details)
  7. GlobalISel: Reduce indentation and remove dead path (details)
  8. AMDGPU/GlobalISel: Fix indentation (details)
  9. AMDGPU/GlobalISel: Remove leftover hack for argument memory sizes (details)
  10. [libcxx][ranges] Add class ref_view. (details)
  11. [gn build] Port 7eba4856c702 (details)
  12. [compiler-rt] Add platform detection support for x32 (details)
  13. [NFC][OpaquePtr] Explicitly pass GEP source type in optimizeGatherScatterInst() (details)
  14. [clang-cl][sanitizer] Add -fsanitize-address-use-after-return to clang. (details)
  15. [flang] Handle multiple USE statements for the same module (details)
Commit 94a07c79cf108b8b9566acfa64d11aca27d60a84 by valery.n.dmitriev
[SLP][NFC] Fix condition that was supposed to save a bit of compile time.

It was found by chance revealing discrepancy between comment (few lines above),
the condition and how re-ordering of instruction is done inside the if statement
it guards. The condition was always evaluated to true.

Differential Revision: https://reviews.llvm.org/D104064
The file was modifiedllvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Commit c7dee6aefd5b5f1d92d279ddd40b81217b496d50 by Jonas Devlieghere
[lldb] Enable TestRuntimeTypes on Apple Silicon
The file was modifiedlldb/test/API/lang/objc/foundation/TestRuntimeTypes.py
Commit fc71a5c6e8e8bd28e43cf58faabad6e7e2fcc652 by Jonas Devlieghere
[lldb] Support new objective-c hash table layout

Update LLDB for thew new Objective-C hash table layout in the dyld
shared cache found in macOS Monterey.

rdar://72863911
The file was modifiedlldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
The file was modifiedlldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
The file was modifiedlldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h
The file was modifiedlldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
Commit fdc0d4360b4e072bd91cdf9133fdf570d8fb16a2 by zinenko
Introduce alloca_scope op

## Introduction

This proposal describes the new op to be added to the `std` (and later moved `memref`)
dialect called `alloca_scope`.

## Motivation

Alloca operations are easy to misuse, especially if one relies on it while doing
rewriting/conversion passes. For example let's consider a simple example of two
independent dialects, one defines an op that wants to allocate on-stack and
another defines a construct that corresponds to some form of looping:

```
dialect1.looping_op {
  %x = dialect2.stack_allocating_op
}
```

Since the dialects might not know about each other they are going to define a
lowering to std/scf/etc independently:

```
scf.for … {
   %x_temp = std.alloca …
   … // do some domain-specific work using %x_temp buffer
   … // and store the result into %result
   %x = %result
}
```

Later on the scf and `std.alloca` is going to be lowered to llvm using a
combination of `llvm.alloca` and unstructured control flow.

At this point the use of `%x_temp` is bound to either be either optimized by
llvm (for example using mem2reg) or in the worst case: perform an independent
stack allocation on each iteration of the loop. While the llvm optimizations are
likely to succeed they are not guaranteed to do so, and they provide
opportunities for surprising issues with unexpected use of stack size.

## Proposal

We propose a new operation that defines a finer-grain allocation scope for the
alloca-allocated memory called `alloca_scope`:

```
alloca_scope {
   %x_temp = alloca …
   ...
}
```

Here the lifetime of `%x_temp` is going to be bound to the narrow annotated
region within `alloca_scope`. Moreover, one can also return values out of the
alloca_scope with an accompanying `alloca_scope.return` op (that behaves
similarly to `scf.yield`):

```
%result = alloca_scope {
   %x_temp = alloca …
   …
   alloca_scope.return %myvalue
}
```

Under the hood the `alloca_scope` is going to lowered to a combination of
`llvm.intr.stacksave` and `llvm.intr.strackrestore` that are going to be invoked
automatically as control-flow enters and leaves the body of the `alloca_scope`.

The key value of the new op is to allow deterministic guaranteed stack use
through an explicit annotation in the code which is finer-grain than the
function-level scope of `AutomaticAllocationScope` interface. `alloca_scope`
can be inserted at arbitrary locations and doesn’t require non-trivial
transformations such as outlining.

## Which dialect

Before memref dialect is split, `alloca_scope` can temporarily reside in `std`
dialect, and later on be moved to `memref` together with the rest of
memory-related operations.

## Implementation

An implementation of the op is available [here](https://reviews.llvm.org/D97768).

Original commits:

* Add initial scaffolding for alloca_scope op
* Add alloca_scope.return op
* Add no region arguments and variadic results
* Add op descriptions
* Add failing test case
* Add another failing test
* Initial implementation of lowering for std.alloca_scope
* Fix backticks
* Fix getSuccessorRegions implementation

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D97768
The file was modifiedmlir/include/mlir/Dialect/MemRef/IR/MemRef.h
The file was modifiedmlir/test/Dialect/MemRef/ops.mlir
The file was modifiedmlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
The file was addedmlir/test/Conversion/StandardToLLVM/convert-alloca-scope.mlir
The file was modifiedmlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
The file was modifiedmlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
Commit ce44fe199bbfd4b5a44764b678c431fdc117116a by Chris.Hamilton
[Sema] Address-space sensitive check for unbounded arrays (v2)

Check applied to unbounded (incomplete) arrays and pointers to spot
cases where the computed address is beyond the largest possible
addressable extent of the array, based on the address space in which the
array is delcared, or which the pointer refers to.

Check helps to avoid cases of nonsense pointer math and array indexing
which could lead to linker failures or runtime exceptions.  Of
particular interest when building for embedded systems with small
address spaces.

This is version 2 of this patch -- version 1 had some testing issues
due to a sign error in existing code.  That error is corrected and
lit test for this chagne is extended to verify the fix.

Originally reviewed/accepted by: aaron.ballman
Original revision: https://reviews.llvm.org/D86796

Reviewed By: aaron.ballman, ebevhan

Differential Revision: https://reviews.llvm.org/D88174
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/test/SemaCXX/constant-expression-cxx14.cpp
The file was modifiedclang/test/Sema/const-eval.c
The file was modifiedclang/lib/Sema/SemaChecking.cpp
The file was addedclang/test/Sema/unbounded-array-bounds.c
Commit 93f3c7cc3efc4911af2a7848fbae339ebbc5c3a0 by Matthew.Arsenault
CodeGen: Fix missing const
The file was modifiedllvm/lib/CodeGen/MachineFunction.cpp
The file was modifiedllvm/include/llvm/CodeGen/MachineFunction.h
Commit 9d7299b6f0ab1ff1df244151ca788904a043f5af by Matthew.Arsenault
GlobalISel: Reduce indentation and remove dead path
The file was modifiedllvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Commit 6dd54dada3b1f60340078fe4e82e8a62258d8d6b by Matthew.Arsenault
AMDGPU/GlobalISel: Fix indentation
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
Commit a845dc1e562c20db54018a121eb01970e76602db by Matthew.Arsenault
AMDGPU/GlobalISel: Remove leftover hack for argument memory sizes

Since the call lowering code now tries to respect the tablegen
reported argument types, this is no longer necessary.
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
Commit 7eba4856c702b1d9d0bd1d3ef58661ba6c0e58de by zoecarver
[libcxx][ranges] Add class ref_view.

Differential Revision: https://reviews.llvm.org/D102020
The file was addedlibcxx/include/__ranges/ref_view.h
The file was addedlibcxx/test/std/ranges/range.adaptors/range.ref.view.pass.cpp
The file was modifiedlibcxx/include/ranges
The file was modifiedlibcxx/include/CMakeLists.txt
Commit a67780f7db26f0b3588e9366cd6b66ec1434ab1c by llvmgnsyncbot
[gn build] Port 7eba4856c702
The file was modifiedllvm/utils/gn/secondary/libcxx/include/BUILD.gn
Commit 27ef43d279b2f6d0c7bac7718f3904bb204ed646 by harald
[compiler-rt] Add platform detection support for x32

Currently, the compiler-rt build system checks only whether __X86_64
is defined to determine whether the default compiler-rt target arch
is x86_64. Since x32 defines __X86_64 as well, we must also check that
the default pointer size is eight bytes and not four bytes to properly
detect a 64-bit x86_64 compiler-rt default target arch.

Reviewed By: hvdijk, vitalybuka

Differential Revision: https://reviews.llvm.org/D99988
The file was modifiedcompiler-rt/cmake/Modules/CompilerRTUtils.cmake
Commit c0c5a98b2c47bfb93a99b408cee2416005c16274 by aeubanks
[NFC][OpaquePtr] Explicitly pass GEP source type in optimizeGatherScatterInst()

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D103480
The file was modifiedllvm/lib/CodeGen/CodeGenPrepare.cpp
Commit e0b469ffa142353fc90bfc6eadb638a805ebed75 by kda
[clang-cl][sanitizer] Add -fsanitize-address-use-after-return to clang.

Also:
  - add driver test (fsanitize-use-after-return.c)
  - add basic IR test (asan-use-after-return.cpp)
  - (NFC) cleaned up logic for generating table of __asan_stack_malloc
    depending on flag.

for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D104076
The file was modifiedllvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/include/clang/Driver/SanitizerArgs.h
The file was addedclang/test/CodeGen/asan-use-after-return.cpp
The file was modifiedclang/lib/Basic/Sanitizers.cpp
The file was modifiedclang/include/clang/Basic/Sanitizers.h
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedclang/test/Driver/cl-options.c
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
The file was addedclang/test/Driver/fsanitize-use-after-return.c
The file was modifiedclang/lib/Driver/SanitizerArgs.cpp
The file was modifiedllvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
Commit 1b241b9b400bdfc5b8e0d157f0f46436677927b8 by psteinfeld
[flang] Handle multiple USE statements for the same module

It's possible to have several USE statements for the same module that
have different mixes of rename clauses and ONLY clauses.  The presence
of a rename cause has the effect of hiding a previously associated name,
and the presence of an ONLY clause forces the name to be visible even in
the presence of a rename.

I fixed this by keeping track of the names that appear on rename and ONLY
clauses.  Then, when processing the USE association of a name, I check to see
if it previously appeared in a rename clause and not in a USE clause.  If so, I
remove its USE associated symbol.  Also, when USE associating all of the names
in a module, I do not USE associate names that have appeared in rename clauses.

I also added a test.

Differential Revision: https://reviews.llvm.org/D104130
The file was modifiedflang/lib/Semantics/resolve-names.cpp
The file was addedflang/test/Semantics/modfile41.f90