521820 Commits

Author SHA1 Message Date
David Truby
44aa476aa1
[flang] AArch64 ABI for BIND(C) VALUE parameters (#118305)
This patch adds handling for derived type VALUE parameters in BIND(C)
functions for AArch64.
2024-12-18 07:43:22 +00:00
Matt Arsenault
3666de9c8e
LLVMContext: Cleanup registration of known bundle IDs (#120359) 2024-12-18 14:41:55 +07:00
Craig Topper
d9f3fae2fb [RISCV] Add NoStdExtZfa predicates to BuildPairF64Pseudo and SplitF64Pseudo.
The makes the priority of the Zfa patterns of the pseudos explicit.
Previously the priority only worked because instructions with
usesCustomInserter=1 have lower priority.
2024-12-17 23:27:12 -08:00
Pengcheng Wang
1235a93fae
[MachinePipeliner] Use RegisterClassInfo::getRegPressureSetLimit (#119827)
`RegisterClassInfo::getRegPressureSetLimit` is a wrapper of
`TargetRegisterInfo::getRegPressureSetLimit` with some logics to
adjust the limit by removing reserved registers.

It seems that we shouldn't use
`TargetRegisterInfo::getRegPressureSetLimit`
directly, just like the comment "This limit must be adjusted
dynamically for reserved registers" said.

Thus we should use `RegisterClassInfo::getRegPressureSetLimit` and
remove replicated code.

Separate from https://github.com/llvm/llvm-project/pull/118787
2024-12-18 15:13:03 +08:00
Aaditya
d6e8ab1fa6
Revert "[NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas" (#120369)
Reverts llvm/llvm-project#120063 due to build-bot failures
2024-12-18 14:06:49 +07:00
Pengcheng Wang
b6ad231666
[MachineSink] Use RegisterClassInfo::getRegPressureSetLimit (#119830)
`RegisterClassInfo::getRegPressureSetLimit` is a wrapper of
`TargetRegisterInfo::getRegPressureSetLimit` with some logics to
adjust the limit by removing reserved registers.

It seems that we shouldn't use
`TargetRegisterInfo::getRegPressureSetLimit`
directly, just like the comment "This limit must be adjusted
dynamically for reserved registers" said.

Separate from https://github.com/llvm/llvm-project/pull/118787
2024-12-18 14:51:01 +08:00
Aaditya
99c2e3b782
[NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas (#120063)
For #119822
2024-12-18 12:14:37 +05:30
Daniil Kovalev
1ef5b987a4
[PAC][lld][AArch64][ELF] Support signed GOT with tiny code model (#113816)
Depends on #114525

Support `R_AARCH64_AUTH_GOT_ADR_PREL_LO21` and `R_AARCH64_AUTH_GOT_LD_PREL19`
GOT-generating relocations. A corresponding `RE_AARCH64_AUTH_GOT_PC` member
of `RelExpr` is added, which is an AUTH-specific variant of `R_GOT_PC`.
2024-12-18 09:41:54 +03:00
Ruiling, Song
67c55b1ffc
[AMDGPU] Make max dwords of memory cluster configurable (#119342)
We find it helpful to increase the value for graphics workload. Make it
configurable so we can experiment with a different value.
2024-12-18 14:17:27 +08:00
David Truby
4c6e13f644
[flang] Add cmake error if building with clang-cl and MSVC 17.12 (#120114) 2024-12-18 06:15:29 +00:00
Vitaly Buka
55e87a79b9
[BoundsChecking] Add parameters to pass (#119894)
This check is a part of UBSAN, but does not support
verbose output like other UBSAN checks.

This is a step to fix that.
2024-12-17 22:07:14 -08:00
Kareem Ergawy
dc936f3c19
Revert "[flang][OpenMP] Implicitly map allocatable record fields (#117867)" (#120360) 2024-12-18 06:52:24 +01:00
Craig Topper
efc3671500
[X86] Correct the cdisp8 encoding for VGF2P8AFFINEINVQB and VGF2P8AFFINEQB. (#120340)
These instructions use a 64-bit broadcast size so the element size for
CD8 should be 64.
2024-12-17 21:36:36 -08:00
Craig Topper
9fa517208f
[RISCV] Use inheritance to simplify usage of the UnsupportedSched* multiclasses. NFC (#120329)
Split UnsupportedSchedZfhmin from UnsupportedSchedZfh.
UnsupportedSchedZfhmin inherits from UnsupportedSchedZfh and should be
used when no F16 is supported. UnsupportedSchedZfh can be used direclty
for CPUs that support Zfhmin but not Zfh.

Make UnsupportedSchedF inherit from both UnsupportedSchedD and
UnsupportedSchedZfhmin so that CPUs with no FP only need to include
UnsupportedSchedF. This required some minor refactorings to
RISCVSchedSyntacoreSCR345.td. I've also switched to inheritance instead of
using defm.
2024-12-17 21:32:50 -08:00
Craig Topper
6fbfbd7c88
[RISCV] Add some additional notes about mask pseudo instructions to RISCVVectorExtension.rst. NFC (#120337) 2024-12-17 21:32:06 -08:00
Michael Maitland
a61eeaa748
[RISCV][VLOPT] Add vector indexed loads and stores to getOperandInfo (#119748)
Use `MO.getOperandNo() == 0` instead of `IsMODef` so naming is clear for the store, since the store should treat its operand 0 like that even though it is not a def.The load should treat its operand 0 def in the same way.
2024-12-17 23:51:45 -05:00
weiwei chen
644643a4ee
[mlir] Add Operation::dumpPrettyPrinted (#120117)
- [x] Add `Operation::dumpPrettyPrinted` to get more readable print
during debugging when the IR may not be able to pass verify yet.
2024-12-17 23:44:36 -05:00
Kareem Ergawy
db09014a07
[flang][OpenMP] Implicitly map allocatable record fields (#117867)
This is a starting PR to implicitly map allocatable record fields.

This PR contains the following changes:
1. Re-purposes some of the utils used in `Lower/OpenMP.cpp` so that
   these utils work on the `mlir::Value` level rather than the
   `semantics::Symbol` level. This takes one step towards to enabling
   MLIR passes to more easily do some lowering themselves (e.g. creating
   `omp.map.bounds` ops for implicitely caputured data like this PR
   does).
2. Adds support for implicitely capturing and mapping allocatable fields
   in record types.

There is quite some distant to still cover to have full support for
this. I added a number of todos to guide further development.

Co-authored-by: Andrew Gozillon <andrew.gozillon@amd.com>

Co-authored-by: Andrew Gozillon <andrew.gozillon@amd.com>
2024-12-18 05:37:58 +01:00
Christopher Bate
1a70420ff3
[mlir] Attempt to resolve edge cases in PassPipeline textual format (#118877)
This commit makes the following changes:

1. Previously certain pipeline options could cause the options parser to
   get stuck in an an infinite loop. An example is:

   ```
mlir-opt %s -verify-each=false
-pass-pipeline='builtin.module(func.func(test-options-super-pass{list={list=1,2},{list=3,4}}))''
   ```

   In this example, the 'list' option of the `test-options-super-pass`
   is itself a pass options specification (this capability was added in
   https://github.com/llvm/llvm-project/issues/101118).

However, while the textual format allows `ListOption<int>` to be given
   as `list=1,2,3`, it did not allow the same format for
   `ListOption<T>` when T is a subclass of `PassOptions` without extra
enclosing `{....}`. Lack of enclosing `{...}` would cause the infinite
   looping in the parser.

   This change resolves the parser bug and also allows omitting the
   outer `{...}` for `ListOption`-of-options.

2. Previously, if you specified a default list value for your
`ListOption`, e.g. `ListOption<int> opt{*this, "list",
llvm:🆑:list_init({1,2,3})}`,
it would be impossible to override that default value of `{1,2,3}` with
an *empty* list on the command line, since `my-pass{list=}` was not
allowed.

This was not allowed because of ambiguous handling of lists-of-strings
   (no literal marker is currently required).

   This change makes it explicit in the ListOption construction that we
would like to treat all ListOption as having a default value of "empty"
   unless otherwise specified (e.g. using `llvm::list_init`).

It removes the requirement that lists are not printed if empty. Instead,
   lists are not printed if they do not have their default value.

   It is now clarified that the textual format
   `my-pass{string-list=""}` or `my-pass{string-list={}}`
   is interpreted as "empty list". This makes it imposssible to specify
   that ListOption `string-list` should be a size-1 list containing the
   empty string. However, `my-pass{string-list={"",""}}` *does* specify
a size-2 list containing the empty string. This behavior seems
preferable
   to allow for overriding non-empty defaults as described above.
2024-12-17 21:13:29 -07:00
Jinsong Ji
c189b2a1ec
[DiagnosticInfo] Fix the default DiagnosticSeverity (#120342)
After
https://github.com/llvm/llvm-project/commit/ea632e1b34e1

the API call to LLVMContext->emitError(I, Errorstr) default to warning
instead of error.

This cause problems as the API mentioned it is "prefixed with error:".
2024-12-17 23:00:11 -05:00
Luke Lau
b1f4a0201a [LV] Update failing test with middle block. NFC 2024-12-18 11:51:48 +08:00
Kazu Hirata
f8b497ef61
[compiler-rt] Work around a warning from -Wgnu-anonymous-struct (#120314)
This patch works around:


compiler-rt/lib/tysan/../sanitizer_common/sanitizer_platform_limits_posix.h:604:3:
  error: anonymous structs are a GNU extension
  [-Werror,-Wgnu-anonymous-struct]
2024-12-17 19:51:20 -08:00
Nikita Popov
6d34cfac53
[Sema] Diagnose tautological bounds checks (#120222)
This diagnoses comparisons like `ptr + unsigned_index < ptr` and `ptr +
unsigned_index >= ptr`, which are always false/true because addition of
a pointer and an unsigned index cannot wrap (or the behavior is
undefined).

This warning is intended to help find broken bounds checks (which must
be implemented in terms of uintptr_t instead).

Fixes https://github.com/llvm/llvm-project/issues/120214.
2024-12-18 11:39:12 +08:00
Luke Lau
c2a879ecaa
[VPlan] Fix VPTypeAnalysis cache clobbering in EVL transform (#120252)
When building SPEC CPU 2017 with RISC-V and EVL tail folding, this
assertion in VPTypeAnalysis would trigger during the transformation to
EVL recipes:


d8a0709b10/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp (L135-L142)

It was caused by this recipe:

```
WIDEN ir<%shr> = vp.or ir<%add33>, ir<0>, vp<%6>
```

Having its type inferred as i16, when ir<%add33> and ir<0> had inferred
types of i32 somehow.

The cause of this turned out to be because the VPTypeAnalysis cache was
getting clobbered: In this transform we were erasing recipes but keeping
around the same mapping from VPValue* to Type*. In the meantime, new
recipes would be created which would have the same address as the old
value. They would then incorrectly get the old erased VPValue*'s cached
type:

```
  --- before ---
  0x600001ec5030: WIDEN ir<%mul21.neg> = vp.mul vp<%11>, ir<0>, vp<%6>
  0x600001ec5450: <badref> <- some value that was erased
  --- after ---
  0x600001ec5030: WIDEN ir<%mul21.neg> = vp.mul vp<%11>, ir<0>, vp<%6>
  0x600001ec5450: WIDEN ir<%shr> = vp.or ir<%add33>, ir<0>, vp<%6>  <- a new value that happens to have the same address
```

This fixes this by deferring the erasing of recipes till after the
transformation.

The test case might be a bit flakey since it just happens to have the
right conditions to recreate this. I tried to add an assert in
inferScalarType that every VPValue in the cache was valid, but couldn't
find a way of telling if a VPValue had been erased.

---------

Co-authored-by: Florian Hahn <flo@fhahn.com>
2024-12-18 11:28:28 +08:00
Luke Lau
4a7f60d328
[VPlan] Handle VPWidenCastRecipe without underlying value in EVL transform (#120194)
This fixes a crash that shows up when building SPEC CPU 2017 with EVL
tail folding on RISC-V.

A VPWidenCastRecipe doesn't always have an underlying value, and in the
case of this crash this happens whenever a widened cast is created via
truncateToMinimalBitwidths.

Fix this by just using the opcode stored in the recipe itself.

I think a similar issue exists with VPWidenIntrinsicRecipe and how it's
widened, but I haven't run into any crashes with it just yet.
2024-12-18 11:28:07 +08:00
Krzysztof Drewniak
b24caf3d2b
[llvm][TableGen] Add a !initialized predicate to allow testing for ? (#117964)
There are cases (like in an upcoming patch to MLIR's `Property` class)
where the ? value is a useful null value. However, existing predicates
make ti difficult to test if the value in a record one is operating is ?
or not.

This commit adds the !initialized predicate, which is 1 on concrete,
non-? values and 0 on ?.

---------

Co-authored-by: Akshat Oke <Akshat.Oke@amd.com>
2024-12-17 20:34:35 -06:00
Michael Maitland
fb33268d2f
[RISCV][VLOPT] Add support for VID and VIOTA (#120331)
We already cover vid in `llvm/test/CodeGen/RISCV/rvv/vl-opt-op-info.mir`
so no need to add tests for that instruction.
2024-12-17 21:15:23 -05:00
Brox Chen
5c5a769cc0
[AMDGPU][True16][MC] update VOP1 dasm test with latest script (#120281)
This is a NFC. Update VOP1 dasm test with latest update script
2024-12-17 20:24:06 -05:00
Valentin Clement (バレンタイン クレメン)
81333cfc52
[flang][cuda] Relax host array check for cuda constant (#120333)
Array with CONSTANT attribute declared in module spec part are device
arrays and should not trigger the host array check.
2024-12-17 17:04:32 -08:00
tianleliu
d7fe2cf8a2
[InstCombine] Widen Sel width after Cmp to generate Max/Min intrinsics. (#118932)
When Sel(Cmp) are in different integer type,

From: (K and N mean width, K < N; a and b are src operands.)
bN = Ext(bK)
cond = Cmp(aN, bN)
aK = Trunc aN
retK = Sel(cond, aK, bK)
To:
bN = Ext(bK)
cond = Cmp(aN, bN)
retN = Sel(cond, aN, bN)
retK = Trunc retN

Though Sel's operands width becomes larger, the benefit
of making type width in Sel the same as Cmp, is for combing
to max/min intrinsics, and also better performance for SIMD
instructions.
References of correctness: https://alive2.llvm.org/ce/z/Y4Kegm
                           https://alive2.llvm.org/ce/z/qFtjtR
Reference of generated code comparision:
                           https://gcc.godbolt.org/z/o97svGvYM
                           https://gcc.godbolt.org/z/59Ynj91ov
2024-12-18 09:02:11 +08:00
Thurston Dang
c48d45e6a3
[sanitizer] Refactor -f(no-)?sanitize-recover parsing (#119819)
This moves the -f(no-)?sanitize-recover parsing into a generic
parseSanitizerArgs function, and then applies it to parse
-f(no-)?sanitize-recover and -f(no-)?sanitize-trap.

N.B. parseSanitizeTrapArgs does *not* remove non-TrappingSupported
arguments. This maintains the legacy behavior of '-fsanitize=undefined
-fsanitize-trap=undefined' (clang/test/Driver/fsanitize.c), which is
that vptr is not enabled at all (not even in recover mode) in order to
avoid the need for a ubsan runtime.
2024-12-17 16:35:11 -08:00
Drew Kersnar
9d11aa175b
[NVPTX] Remove extra semicolon (#120336)
Fix bug in this change:
https://github.com/llvm/llvm-project/pull/119622#issuecomment-2549896245
2024-12-17 16:03:40 -08:00
Jon Roelofs
01d7a187a4
[llvm] Add missing dependency of libLLVMCodeGen on vt_gen
```
llvm-project/llvm/include/llvm/CodeGenTypes/MachineValueType.h:43:10: fatal error: 'llvm/CodeGen/GenVT.inc' file not found
   43 | #include "llvm/CodeGen/GenVT.inc"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
```

rdar://141643651
2024-12-17 17:02:55 -07:00
Paul Kirth
f8d9f8ed95
[clang-doc] Add test for functions with builtin return types (#120318)
This is a precommit test for #120308, since we lack non-template
functions that use builtin types.
2024-12-17 15:55:05 -08:00
Teresa Johnson
a15e7b11da
[MemProf] Add option to hint allocations at a given cold byte percentage (#120301)
Optionally unconditionally hint allocations as cold or not cold during
the matching step if the percentage of bytes allocated is at least that
of the given threshold.
2024-12-17 15:53:56 -08:00
Jie Fu
f3a8f87979 [NVPTX] Remove extra ';' outside of a function (NFC)
/llvm-project/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp:224:2:
error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
};
 ^
1 error generated.
2024-12-18 07:42:32 +08:00
Drew Kersnar
932d9c13fa
[NVPTX] Generalize and extend upsizing when lowering 8/16-bit-element vector loads/stores (#119622)
This addresses the following issue I opened:
https://github.com/llvm/llvm-project/issues/118851.

This change generalizes the Type Legalization mechanism that currently
handles `v8[i/f/bf]16` upsizing to include loads _and_ stores of `v8i8`
+ `v16i8`, allowing all of the mentioned vectors to be lowered to ptx as
vectors of `b32`. This extension also allows us to remove the DagCombine
that only handled exactly `load v16i8`, thus centralizing all the
upsizing logic into one place.

Test changes include adding v8i8, v16i8, and v8i16 cases to
load-store.ll, and updating the CHECKs for other tests to match the
improved codegen.
2024-12-17 15:23:22 -08:00
Aiden Grossman
8a62104f64
[Github] Use hashed dependencies in docs job (#120319)
This patch forces the docs test build job to use the hashed dpendencies
file rather than the normal requirements.txt. This ensures that we get
the exact transitive closure specified rather than whatever the
dependency solver feels like it should use in the CI job.
2024-12-17 14:46:13 -08:00
alx32
bb4007e562
[DWARFVerifier] Disable failing test llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h (#120322)
Disabling and forward fixing later.
2024-12-17 14:42:33 -08:00
Craig Topper
09f449263e
[RISCV] Check for register where immediate should be in RISCVInstrInfo::verifyInstruction. (#120286)
The generic verifier will do this if the operand type is
OPERAND_IMMEDIATE, but we use our own custom operand types. Immediate
operands are still allowed to be globals, constant pools, blockaddress,
etc. so we can't check !isImm().
2024-12-17 14:39:00 -08:00
Farzon Lotfi
c03fc929ff
[DirectX] Add support for vector_reduce_add (#117646)
Use of `vector_reduce_add` will make it easier to write more intrinsics
in `hlsl_intrinsics.h`.
2024-12-17 17:32:50 -05:00
Justin Bogner
65d2177ae1
[DXIL] Simplify MDBuilder in resource unit tests. NFC (#120275) 2024-12-17 15:16:58 -07:00
Nick Desaulniers
7153a21916
[libc][docs] update sphinx requirement hashes (#120315)
Link: #120274
2024-12-17 14:14:03 -08:00
Alex MacLean
9f231a8500
[NVPTX] Prefer ValueType when defining DAG patterns (NFC) (#120161)
Replace uses of register class in dag patterns with value types. These
types are much more concise and in cases where a single register class
maps to multiple types, they avoid the need for both.
2024-12-17 13:49:31 -08:00
Valentin Clement (バレンタイン クレメン)
15c61a208f
[flang][cuda] Do not consider SHARED array as host array (#120306)
Update the current `FindHostArray` to not return shared array as host
array.
2024-12-17 13:42:14 -08:00
Valentin Clement (バレンタイン クレメン)
97b7bace67
[flang][cuda] Allow host array with PARAMETER attribute in device context (#120298)
Host arrays are normally not allowed in device context unless they have
a `PARAMETER` attribute. This patch update the check so no error is
emitted.
2024-12-17 13:41:24 -08:00
Florian Hahn
eb59fe8d04
[VPlan] Remove redundant assignment in VPReductionPHIRecipe (NFC)
Suggested post-commit for 0e528ac404e13ed2d952a2d83aaf8383293c851e.
2024-12-17 21:32:40 +00:00
Joseph Huber
958de20b30
[libc] Enable 'timespec_get' for the GPU build (#120304)
Summary:
Currently fails to build libc++ because this is missing.
2024-12-17 15:31:07 -06:00
Nick Desaulniers
1d06157b9e
[libc] fix -Wgcc-compat (#120303)
I don't quite recall why I added those in the first place. These tests build
without diagnostics for both clang and GCC with this fix.

Fixes: #114653
2024-12-17 13:30:20 -08:00
Nico Weber
cde996c31d [lld/COFF] Remove needless indirection
`symtab.ctx.symtab` is just `symtab`. Looks like #119296 added
this using a global find-and-replace.

This was the only instance of `symtab.ctx.symtab` in lld/.

No behavior change.
2024-12-17 16:27:16 -05:00