Update clang/include/clang/ScalableStaticAnalysisFramework/Analyses/UnsafeBufferUsage/UnsafeBufferUsageTest.h
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[NewPM] Adds a port for AArch64O0PreLegalizerCombiner (#189776)
Adds a standard porting for AArch64O0PreLegalizerCombiner.
Note:
- Moves the AArch64GenO0PreLegalizeGICombiner.inc import outside of
anonymous namespace to use it as a member in the NewPM class (which
needs to be declared in AArch64.h)
- Test update needed a requires directive for the libcall-lowering-info
dependency
---------
Co-authored-by: Matt Arsenault <arsenm2 at gmail.com>
[OpenMP] Fix iteration count for nested triangular OpenMP loops (#190153)
This patch restricts the triangular loop iteration count optimization to
only apply to nested triangular loops (`depth >= 2`), not first-level
triangular loops.
The optimization computes iterations as `(Upper - Lower + 1`) for
triangular loops where the inner loop bound depends on an outer loop
counter. However, this formula only works correctly for deeply nested
triangular dependencies: `k` depends on `j`, and `j` itself depends on
`i` For first-level triangular loops: `k` depends directly on `i`, the
standard iteration count formula handles the calculation correctly.
[AMDGPU][SIInsertWaitcnt][NFC] Replace LastFlat array with distinct variables (#185993)
We only seem to be using LastFlat[LOAD_CNT] and LastFlat[DS_CNT] so it
doesn't look like there is a good reason for using an array. Also, we
seem to be operating on all elements of the array while merging, which
is not great.
[TargetLowering] Remove INT_MIN special case from prepareSREMEqFold. (#188653)
If the divisor is INT_MIN, we can still treat it like any other power of
2. We'll fold i32 (seteq (srem X, INT_MIN)) to
(setule (rotr (add (mul X, 1), INT_MIN), 31), 1). Alive2 says this is
correct https://alive2.llvm.org/ce/z/vjzqKk.
The multiply is a NOP, the add toggles the sign bits. The rotate puts
the lowest 31 bits of into the upper 31 bits. The sign bit is now in the
LSB. The compare checks if the upper 31 bits are 0.
srem X, INT_MIN has a remainder of 0 if X is 0 or INT_MIN which is
equivalent to checking if the uppper 31 bits are 0 after the rotate.
I don't think we need to add any constant for power of 2 but toggling
the sign bit like we do now doesn't hurt.
[Clang] Fixed the behavior of C23 auto when an array type was specified for a `char *` (#189722)
At the time of the implementation of
[N3007](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3007.htm) in
Clang, when an array type was specified, an error was emitted unless the
deduced type was a `char *`.
After further inspection in the C standard, it turns out that the
inferred type of an `char[]` should be deduced to a `char *`, which
should emit an error if an array type is specified with `auto`.
This now invalidates the following cases:
```c
auto s1[] = "test";
auto s2[4] = "test";
auto s3[5] = "test";
```
Fixes #162694
[LV] Adjust exit recipe detection to run on early vplan (#183318)
Splitting out some work from #178454; this covers the enums for
early exit loop type (none, readonly, readwrite) and the style
used (readonly with multiple exit blocks, or masking with the
last iteration done in scalar code), along with changing the early
exit recipe detection to suit moving the transform for handling
early exit readwrite loops earlier in the vplan pipeline.
[clang][bytecode] Add an assertion in initScope() op (#189972)
I've run into a problem in a branch lately that would've benefitted from
this assertion.
[SCEVExpander] Add SCEVUseVisitor and use it in SCEVExpander (NFC) (#188863)
Add SCEVUseVisitor, a new visitor class where all visit methods receive
a SCEVUse instead of a const SCEV*. Use it for SCEVExpander, so it can
use use-specific flags in the future.
PR: https://github.com/llvm/llvm-project/pull/188863
[AArch64][llvm] Tighten SYSP; don't disassemble invalid encodings
Tighten SYSP aliases, so that invalid encodings are disassembled
to `<unknown>`. This is because:
```
Cn is a 4-bit unsigned immediate, in the range 8 to 9
Cm is a 4-bit unsigned immediate, in the range 0 to 7
op1 is a 3-bit unsigned immediate, in the range 0 to 6
op2 is a 3-bit unsigned immediate, in the range 0 to 7
```
Ensure we check this when disassembling, and also constrain
tablegen for compile-time errors of invalid encodings.
Also adjust the testcases in `armv9-sysp-diagnostics.s` and
`llvm/test/MC/AArch64/armv9a-sysp.s` as they were invalid,
and added a few invalid (outside of range) SYSP-alikes to
test that `<unknown>` is printed
[Clang] [Sema] Diagnose returning an initializer list from a lambda with a return type of void (#188904)
We previously didn’t diagnose attempts to return an initializer list from
a lambda with an explicit return type of `void`. This patch fixes that. It also
cleans up the error message so it actually says "lambda" instead of "block".
Fixes #188661
Signed off by: Kartik