Summary:
`Status` is unfortunately heavily overloaded in practice. Things like
X11 define it as a macro. Best to just remove that possibility entirely.
Change `NVVM_SyncWarpOp` base class from `NVVM_Op` to
`NVVM_IntrOp<"bar.warp.sync">`, which auto-generates `llvmEnumName =
nvvm_bar_warp_sync` and registers it with
`-gen-intr-from-llvmir-conversions` and
`-gen-convertible-llvmir-intrinsics`. This enables LLVM IR to MLIR
import. The hand-written `llvmBuilder` is removed as the default
`LLVM_IntrOpBase` builder is equivalent.
Rename several arguments to intrinsic related functions from `ArgsTys`
to `OverloadTys` to better reflect their meaning. The only variables
left with name `ArgTys` now actually mean function argument types.
Also reamove an incorrect comment in Intrinsics.td. Dependent types do
allow forward references starting with
7957fc6547
The evaluation order of function arguments is unspecified by the C++
standard. We had two getNode calls as function arguments which causes
the nodes to be created in a different order depending on the compiler
used. This patch moves them to their own variables to ensure they are
called in the same order on all compilers.
Possible fix for #190148.
The `-mno-incremental-linker-compatible` switch translates to Brepro
linker flag and must be passed on to the underlying linker to match the
behavior of the Windows triples that produce PE COFF.
Make sure that the module has a target triple set before trying to parse
machine functions. This can be required for (downstream) targets if MIR
parsing relies on features guarded by the target triple.
Use CMake's native MACHO_COMPATIBILITY_VERSION and MACHO_CURRENT_VERSION
properties rather than manually pass linker flags. These properties are
available since CMake 3.17.0, released in 2020.
This commit add the GetDimensions methods to Texture2D. For DXIL, it
requires intrinsics that are not yet available. They are added, but not
implemented.
Assisted-by: Gemini
Co-authored-by: Helena Kotas <hekotas@microsoft.com>
This test technically does not require libc++. The test binary mimics
libc++'s namespace layout to trigger some frame hiding logic in lldb,
but it does not require libc++ to function.
This is explicitly marked as a libc++ test and functionally tests the
formatter for a vector of enums. I put it in the generic directory
because there's no reason this couldn't work for other c++ stdlibs.
Additionally, this should be using the custom libc++ like the other
tests.
Currently NVPTXAsmPrinter uses intermediate strings to generate ASM and
emit directly to output streamer as raw text. This PR demonstrates how
the printer can be updated to use NVPTXTargetAsmStreamer instead,
thereby getting rid of the intermediate strings. This is shown only for
the PTX header and module level directives.
Add a missing OBTrapInvolved check before EmitIntegerSignChangeCheck().
This is considered "missing" as a previous attempt (https://github.com/llvm/llvm-project/pull/185772) to properly add an `__ob_trap` backdoor missed this particular instance.
This backdoor is needed because we want `__ob_trap` types to be picky about implicit conversions (including implicit sign change):
```c
unsigned int __ob_trap big = 4294967295;
(signed int)big; // should trap!
```
Move the `OBTrapInvolved` setup to the top of the function so it can be used in all the places we need it.
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@gmail.com>
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.
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.
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.
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
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.
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
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
Add support for `[[msvc::forceinline]]` and
`[[msvc::forceinline_calls]]`.
`[[msvc::forceinline]]` is equivalent to Microsoft's `__forceinline`
when placed before a function declaration.
Unlike `__forceinline`, `[[msvc::forceinline]]` works with lambdas.
`[[msvc::forceinline_calls]]` is simliar to `[[clang::always_inline]]`
but only works on statements.
Both are implemented as aliases of `[[clang::always_inline]]` with
special checks.
Fixes#186539.
Related: #183340
Upstream from swiftlang/llvm-project@721e6a3 with some modifications.
Since __counted_by and related attributes aren't supported upstream yet
in function signatures, this only upstreams the format part — YAML
parsing, binary serialization, and deserialization. Semantic application
is a follow-up.
Modifications from downstream:
- Renamed local YAML struct from `BoundsSafety` to `BoundsSafetyNotes`
to avoid name collision with `Param::BoundsSafety` field (downstream
fixed this in a subsequent commit)
- `Level` in `BoundsSafetyNotes` is now `std::optional<unsigned>` so we
can actually tell apart "user didn't write Level:" from "Level: 0"
- `asdf_sized` and `asdf_sized_n` use `void *buf` — makes more sense for
sized_by
- Added `asdf_counted_indirect` with `int **` and `Level: 1` to test the
indirection level path
- Removed a vacuous assert (`CountedBy == 0`, always true for unsigned)
- Added `operator!=` for `BoundsSafetyInfo` to match other types in
`Types.h`
- Added doc comments for `LevelAudited` and `Level`
In some environments like swiftlang, the `''` causes the command used to
drain the init sequence of the ConPTY to fail. Replacing with a `cls`
invocation removes the need for quotation marks and works just as well.
Add a FileCheck test covering the 'expected at least one input' error in
ReduceOp::verify(). The companion 'expected at least one output' check
was dead code: SameVariadicOperandSize fires first whenever
inputs.size() \!= inits.size(), and when both are empty the input check
fires first; remove the unreachable branch.
Assisted-by: Claude Code
This reverts commit 1418f80.
The change can cause an infinite rewrite loop when
ForwardConcatInsertSliceDest interacts with
FoldEmptyTensorWithExtractSliceOp.
The isTreeTinyAndNotFullyVectorizable check for 2-node trees
(insertelement root + gather child) was too aggressive: it rejected
trees even when LoadEntriesToVectorize was non-empty, preventing
gathered loads from being vectorized into masked loads/strided loads, etc.
Reviewers: hiraditya, RKSimon
Pull Request: https://github.com/llvm/llvm-project/pull/190181