Commit Graph

518870 Commits

Author SHA1 Message Date
Kazu Hirata
d44ea7186b [Support] Remove unused includes (NFC) (#116752)
Identified with misc-include-cleaner.
2024-11-20 06:51:43 -08:00
Haojian Wu
12cfa414a3 [bazel] Port for 08e7609692 2024-11-20 15:36:52 +01:00
Krzysztof Parzyszek
cfd67c2149 [flang][OpenMP] Normalize clause modifiers that exist on their own (#116655)
This is the first part of the effort to make parsing of clause modifiers
more uniform and robust. Currently, when multiple modifiers are allowed,
the parser will expect them to appear in a hard-coded order.
Additionally, modifier properties (such as "ultimate") are checked
separately for each case.

The overall plan is
1. Extract all modifiers into their own top-level classes, and then
equip them with sets of common properties that will allow performing the
property checks generically, without refering to the specific kind of
the modifier.
2. Define a parser (as a separate class) for each modifier.
3. For each clause define a union (std::variant) of all allowable
modifiers, and parse the modifiers as a list of these unions.

The intent is also to isolate parts of the code that could eventually be
auto-generated.

OpenMP modifier overhaul: #1/3
2024-11-20 08:33:17 -06:00
Simon Pilgrim
b49c4af186 Fix GCC signed/unsigned comparison warning. 2024-11-20 14:17:21 +00:00
Utkarsh Saxena
c22bb6f5b1 [clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
This PR uses the existing lifetime analysis for the `capture_by`
attribute.

The analysis is behind `-Wdangling-capture` warning and is disabled by
default for now. Once it is found to be stable, it will be default
enabled.

Planned followup:
- add implicit inference of this attribute on STL container methods like
`std::vector::push_back`.
- (consider) warning if capturing `X` cannot capture anything. It should
be a reference, pointer or a view type.
- refactoring temporary visitors and other related handlers.
- start discussing `__global` vs `global` in the annotation in a
separate PR.

---------

Co-authored-by: Boaz Brickner <brickner@google.com>
2024-11-20 15:17:00 +01:00
Nuno Lopes
3e15bce9e1 [FuzzMutate] replace undef placeholders with poison 2024-11-20 14:09:39 +00:00
Paul Walker
71b87d1267 [LLVM][SVE] Ensure all fixed length mask bits are defined. (#116819)
convertFixedMaskToScalableVector expects the mask input to honour the
BoolContents scheme employed by the target. For AArch64 this means a
mask should be zero or all ones, and thus when promoting a mask we must
use a sign extend.
2024-11-20 13:54:50 +00:00
Alexey Bataev
b17f607703 [SLP][NFC]Remove unnecessary std::optional around Factor value 2024-11-20 05:54:15 -08:00
Md Asghar Ahmad Shahid
d0d726e56d Fix GCC build problem with 288f05f related to SmallVector. (#116958)
Below is the error message for reference.

/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp: In static member
function 'static llvm::SmallVector<mlir::AffineMap>
mlir::linalg::MatmulOp::getDefaultIndexingMaps(mlir::MLIRContext*)':
/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:3468:10: error:
could not convert 'indexingMaps' from 'SmallVector<[...],3>' to
'SmallVector<[...],6>'
 3468 |   return indexingMaps;
      |          ^~~~~~~~~~~~
      |          |
      |          SmallVector<[...],3>

Here is the link to the failure.
https://lab.llvm.org/buildbot/#/builders/117/builds/3919
...
2024-11-20 07:40:42 -06:00
Congcong Cai
c0fdedfedf [clang-tidy][NFC]remove deps of clang in clang tidy test (#116588)
It is introduced in https://reviews.llvm.org/D59528, but I don't find
any usage of clang in clang tidy test.
2024-11-20 21:38:28 +08:00
Simon Pilgrim
ddc2e364aa [X86] getSHUFPDImm - allow general shuffle mask size
#116419 assumed that getSHUFPDImm incorrectly hardcoded the mask size to 4 (cut+pasta typo from getV4X86ShuffleImm).

Waiting on reduced test case from @metaflow
2024-11-20 13:33:38 +00:00
Aaron Ballman
f710e4c021 Clarify use of contractions in diagnostic messages (#116803)
This dissuades contributors from using contractions when writing
diagnostic wording for Clang. Contractions should be avoided because of
the potential for visual confusion with single quoting syntactic
constructs and because they can be harder to understand for non-native
English speakers.
2024-11-20 08:33:05 -05:00
Oleksandr T.
fe697efe0c [Clang] avoid adding consteval condition as the last statement to preserve valid CFG (#116513)
Fixes #116485
2024-11-20 08:26:55 -05:00
Yingwei Zheng
2c094ac761 [InstCombine] Drop range attributes in foldBitCeil (#116641)
Closes https://github.com/llvm/llvm-project/issues/112076
2024-11-20 21:15:26 +08:00
Sergei Barannikov
8c56dd3040 [ARM] Stop gluing FP comparisons to FMSTAT (#116676)
Following #116547, this changes the result of `ARMISD::CMPFP*` and the
operand of `ARMISD::FMSTAT` from a special `Glue` type to a normal type.

This change allows comparisons to be CSEd and scheduled around as can be
seen in the test changes.

Note that `ARMISD::FMSTAT` is still glued to its consumer nodes; this is
going to be changed in a separate patch.

This patch also sets `CopyCost` of `cl_FPSCR_NZCV` register class to a
negative value. The reason is the same as for CCR register class: it
makes DAG scheduler and InstrEmitter try to avoid copies of `FPCSR_NZCV`
register to / from virtual registers. Previously, this was not
necessary, since no attempt was made to create copies in the first
place.

There might be a case when a copy can't be avoided (although not found
in existing tests). If a copy is necessary, the virtual register will be
created with `cl_FPSCR_NZCV` register class. If this register class is
inappropriate, `TRI::getCrossCopyRegClass` should be modified to return
the correct class.

Pull Request: https://github.com/llvm/llvm-project/pull/116676
2024-11-20 16:07:05 +03:00
Feng Zou
1ca853b2ee [X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
Rename R_X86_64_REX2_GOTPCRELX to R_X86_64_CODE_4_GOTPCRELX, to align
with GCC/binutils and ABI.

GCC/binutils:
3d5a60de52
and
4a54cb0658
ABI:
357de358ba
2024-11-20 21:02:44 +08:00
Sergei Barannikov
a160e51500 [AArch64] Fix SDNode type mismatches between *.td files and ISel (#116523)
* `MRS`, `PTEST` and FP comparisons were missing "flags" result, and
were sometimes created with invalid types (f32, Glue, Other).
* `REV16`, `REV32`, `REV64`, and `CMGEz` were sometimes created with an
extra operand.
* `TLSDESC_CALLSEQ` had `SDNPInGlue` property, but the node was never
created with a glue operand.
2024-11-20 15:55:28 +03:00
Christian Oliveros
05bcf83c5c [OpenMP][Build][Wasm][116552] Fixed build problem when compiling with Emscripten on Windows (#116874) 2024-11-20 07:40:21 -05:00
Zichen Lu
08e7609692 [mlir][fix] Add callback functions for ModuleToObject (#116916)
Here is the [merged
MR](https://github.com/llvm/llvm-project/pull/116007) which caused a
failure and [was
reverted](https://github.com/llvm/llvm-project/pull/116811).

Thanks to @joker-eph for the help, I fix it (miss constructing
`ModuleObject` with callback functions in
`mlir/lib/Target/LLVM/NVVM/Target.cpp`) and split unit tests from origin
test which don't need `ptxas` to make the test runs more widely.
2024-11-20 13:22:08 +01:00
Paul Walker
33fcd6acc7 [NFC][LLVM] Migrate tests to use update_test_checks.py.
Transforms/InstCombine/AArch64/sve-intrinsic-fmul-idempotency.ll
  Transforms/InstCombine/AArch64/sve-intrinsic-fmul_u-idempotency.ll
  Transforms/InstCombine/AArch64/sve-intrinsic-mul-idempotency.ll
  Transforms/InstCombine/AArch64/sve-intrinsic-mul_u-idempotency.ll
  Transforms/InstCombine/scalable-const-fp-splat.ll
  Transforms/InstSimplify/ConstProp/extractelement-vscale.ll
  Transforms/InstSimplify/ConstProp/vscale-shufflevector-inseltpoison.ll
  Transforms/InstSimplify/ConstProp/vscale-shufflevector.ll
2024-11-20 12:18:47 +00:00
Simon Pilgrim
d0522f4a9a [X86] Fix PSHUFB port usage on Skylake/Icelake
MMX PSHUFB has an additional Port0 dependency (as do most MMX instructions) - confirmed with uops.info
2024-11-20 12:00:36 +00:00
c8ef
af0e0ded7b [clang] constexpr built-in reduce and function. (#116822)
Part of #51787.
Follow up of #116626.

This patch adds constexpr support for the built-in reduce and function.
2024-11-20 19:57:41 +08:00
DianQK
18b02bbf44 [LICM] allow MemoryAccess creation failure (#116813)
Fixes #116809.

After running some passes (SimpleLoopUnswitch, LoopInstSimplify, etc.),
MemorySSA might be outdated, and the instruction `I` may have become a
non-memory touching instruction.

LICM has already handled this, but it does not pass
`CreationMustSucceed=false` to `createDefinedAccess`.
2024-11-20 19:52:51 +08:00
Benjamin Maxwell
0a1795f781 [SDAG] Generalize FSINCOS type legalization (NFC) (#116848)
There's nothing that specific to FSINCOS about these; they could be used
for similar nodes in the future.
2024-11-20 10:56:39 +00:00
Simon Pilgrim
5f1a7f2749 [X86] Fix scheduler class for EVEX VMOVNTDQA variants and cleanup Skylake/Icelake resource usage (#116946)
Ensure we use the SchedWriteVecMoveLSNT class for all (V)MOVNTDQA instructions, remove unnecessary scheduler overrides and adjust resource pipe usage to match uops.info/Agner numbers
2024-11-20 10:43:28 +00:00
Jay Foad
1b792252e3 [AMDGPU] Remove hasPostISelHook for atomics. NFC. (#116791)
This is not required since 2147b6c89d changed that way that no-ret
atomic ops are selected.
2024-11-20 10:38:35 +00:00
Sam Elliott
408659c5b5 [RISCV] Merge GPRPair and GPRF64Pair (#116094)
As suggested by Craig, this tries to merge the two sets of register
classes created in #112983, GPRPair* and GPRF64Pair*.

- I added some explicit annotations to `RISCVInstrInfoD.td` which fixed
the type inference issues I was seeing from tablegen for select
patterns.
- I've had to make the behaviour of `splitValueIntoRegisterParts` and
`joinRegisterPartsIntoValue` cover more cases, because you cannot
bitcast to/from untyped (the bitcast would otherwise have been inserted
automatically by TargetLowering code).
- I apparently didn't need to change `getNumRegisters` again, which
continues to tell me there's a bug in the code for tied inputs. I added
some more test coverage of this case but it didn't seem to help find the
asserts I was finding before - I think the difference is between the
default behaviour for integers which doesn't apply to floats.
- There's still a difference between BuildGPRPair and BuildPairF64 (and
the same for SplitGPRPair and SplitF64). I'm not happy with this, I
think it's quite confusing, as they're very similar, just differing in
whether they give a `untyped` or a `f64`. I haven't really worked out
how the DAGCombiner copes if one meets the other, I know we have some of
this for the f64 variants already, but they're a lot more complex than
the GPRPair variants anyway.
2024-11-20 10:08:55 +00:00
Daniel Kiss
77bf34c315 [AArch64][compiler-rt] Add LSE support for Windows. (#116706) 2024-11-20 11:05:31 +01:00
Xi Ruoyao
62bf5840a6 [LoongArch][Clang] Make the parameters and return value of {x,}vorn.v builti ns unsigned char vectors (#114514)
All other bitwise vector builtins use `unsigned char` vector operands,
so it does not make too much sense to use `signed char` for the orn
operation alone.
    
The same change has been also proposed for GCC:
https://gcc.gnu.org/pipermail/gcc-patches/2024-October/667065.html.

Depends on #114513.
2024-11-20 17:58:21 +08:00
Ramkumar Ramachandra
9568f88b7f InstCombine: support floating-point equivalences (#114975)
Since cd16b07 (IR: introduce CmpInst::isEquivalence), there is now an
isEquivalence routine in CmpInst that we can use to determine
equivalence in foldSelectValueEquivalence. Implement this, extending it
to include floating-point equivalences as well.
2024-11-20 09:44:14 +00:00
Diana Picus
09c41246ed [AMDGPU] Fix restores in chain functions (#116193)
When spilling a VGPR in `emitPrologue`, chain functions prefer to use
offsets to access the stack instead of the SP.

This patch fixes `emitEpilogue` to do the same. It also brings back some
test coverage that was lost in #93526, when WWM registers started being
shifted to the lowest available range (which meant that tests that were
originally spilling v8 would shift to spill v0, which is a scratch
register for chain functions and didn't get spilled).

Change-Id: Icb07fccd859b563cd45f74c25ae578ecb38bdeeb
2024-11-20 10:43:59 +01:00
Sjoerd Meijer
9bccf61f5f [AArch64][LV] Set MaxInterleaving to 4 for Neoverse V2 and V3 (#100385)
Set the maximum interleaving factor to 4, aligning with the number of available
SIMD pipelines. This increases the number of vector instructions in the vectorised
loop body, enhancing performance during its execution. However, for very low
iteration counts, the vectorised body might not execute at all, leaving only the
epilogue loop to run. This issue affects e.g. cam4_r from SPEC FP, which
experienced a performance regression. To address this, the patch reduces the
minimum epilogue vectorisation factor from 16 to 8, enabling the epilogue to be
vectorised and largely mitigating the regression.
2024-11-20 09:33:39 +00:00
Ramkumar Ramachandra
2b5214b9e1 IR: de-duplicate two CmpInst routines (NFC) (#116866)
De-duplicate the functions getSignedPredicate and getUnsignedPredicate,
nearly identical versions of which were present in CmpInst and ICmpInst,
creating less confusion.
2024-11-20 09:30:35 +00:00
Md Asghar Ahmad Shahid
288f05f63e [NFC][MLIR][Linalg] Refactor linalg.matmul tablegen ODS and related C++ code. (#116377)
This commit refactors part of the code in preparation for the migration
of other *matmul* variants from OpDSL to ODS.
Moves getDefaultIndexingmaps() helper into the MatmulOp class.
2024-11-20 09:26:06 +00:00
Mats Petersson
b7ddb97ac2 [flang][OpenMP]Add TODO checking for scope allocate and firstprivate (#116801)
For the situation where scope is implemented to 5.1 standard, check that
the 5.2 are still "not yet implemented" (or some other partial
implementation).
2024-11-20 09:24:00 +00:00
Mats Petersson
92604d7c80 [flang][OpenMP]Add parsing support for MAP(MAPPER(name) ...) (#116274)
This prepares for using the DECLARE MAPPER construct.

A check in lowering will say "Not implemented" when trying to use a
mapper as some code is required to tie the mapper to the declared one.

Senantics check for the symbol generated.
2024-11-20 09:23:41 +00:00
David Spickett
9111d531d8 [flang] Rename Code Owners to Maintainers (#116009)
https://llvm.org/docs/DeveloperPolicy.html#maintainers
2024-11-20 09:21:07 +00:00
Christian Kandeler
5310855316 [clangd] Fix erroneous qualification of template type parameters (#116821)
...in DefineOutline tweak.
E.g. moving the following definition:
  `template<typename T> struct S { T f^oo() const { return T(); } };`
would result in:
 `template<typename T> S<T>::T S::foo() const { return T(); }`
instead of:
  `template<typename T> T S::foo() const { return T(); }`
2024-11-20 10:15:29 +01:00
JaydeepChauhan14
34881138ed [NFC] Fixed indentation issue (#116942) 2024-11-20 17:14:03 +08:00
David Green
bca846d462 [AArch64] Improve mull generation (#114997)
This attempts to clean up and improve where we generate smull/umull
using known-bits. For v2i64 types (where no mul is present), we try to
create mull more aggressively to avoid scalarization.
2024-11-20 09:12:22 +00:00
David Sherwood
aeb88f6778 Fix test failures introduced by PR #113697 (#116941)
Don't match the entire floating point debug output since it's prone to
rounding errors depending upon the target.
2024-11-20 09:10:51 +00:00
Raul Tambre
ddc0c5c7a3 [CMake] Do all availability checks with -D_GNU_SOURCE (#116640)
When compiling LLVM with -std=c++ instead of -std=gnu we'd fail to detect many newer POSIX functions.
We define it for the whole of LLVM anyway so moving the definition to the top fixes detection of a bunch of these on such setups.
Keeping it at the top also avoids accidentally introducing new dependent checks before it being defined.
2024-11-20 11:08:35 +02:00
Fangrui Song
ac38ab594f [lsan] Use VReport if not REGISTERS_AVAILABLE (#116555)
Certain tests (many are from lld/test) run `... '2>&1 | count 0` to
ensure that there is no stderr message.

GetRegistersAndSP may rarely fail, leading to
a spurious failure like (with a local hack to make `count` dump the
input):

```
+ /home/ray/llvm/out/asan/bin/ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -o /dev/null -z gcs-report=warning -z gcs=never
+ /home/ray/llvm/out/asan/bin/count 0
Expected 0 lines, got 1.
==2403039==Unable to get registers from thread 2403018.
```

The failure can reliably be reproduced by running `ninja check-lld` a
few times under asan+lsan (see the bot
sanitizer-x86_64-linux-bootstrap-asan).
2024-11-20 01:07:28 -08:00
Nikita Popov
d49ee7d54f [LLVM] Update SelectionDAG maintainers (#116408)
bogner is listed as the current SDAG maintainer, but mostly works on
DirectX nowadays and isn't directly involved with SDAG work anymore.

Add RKSimon and topperc as new SelectionDAG maintainers.
2024-11-20 10:02:05 +01:00
Dragan Mladjenovic
596bfb804b [MLIR][AMDGPU] Support gpu::ShuffleMode::DOWN lowering in ROCDL (#106237) 2024-11-20 03:00:05 -06:00
Nikita Popov
1e32a7d42c [AA] Rename CaptureInfo -> CaptureAnalysis (NFC) (#116842)
I'd like to use the name CaptureInfo to represent the new attribute
proposed at
https://discourse.llvm.org/t/rfc-improvements-to-capture-tracking/81420,
but it's already taken by AA, and I can't think of great alternatives
(CaptureEffects would be something of a stretch).

As such, I'd like to rename CaptureInfo -> CaptureAnalysis in AA, which
also seems like the more accurate terminology.
2024-11-20 09:42:28 +01:00
Matthias Springer
67a1fdb014 [mlir][IR] Treat tf32 as 19-bit float (#116738)
TF32 is a variant of F32 that is truncated to 19 bits. There used to be
special handling in `FloatType::getWidth()` so that TF32 was treated as
a 32-bit float in some places. (Some places use `FloatType::getWidth`,
others directly query the `APFloat` semantics.) This caused problems
because `FloatType::getWidth` did not agree with the underlying
`APFloat` semantics.

In particular, creating an elements attr / array attr with `tf32`
element type crashed. E.g.:
```
"foo"() {attr = dense<4.0> : tensor<tf32>} : () -> ()

mlir-opt: llvm-project/llvm/lib/Support/APFloat.cpp:4108: void llvm::detail::IEEEFloat::initFromAPInt(const fltSemantics *, const APInt &): Assertion `api.getBitWidth() == Sem->sizeInBits' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```

```
"foo"() {f32attr = array<tf32: 1024.>} : () -> ()

mlir-opt: llvm-project/mlir/lib/AsmParser/AttributeParser.cpp:847: void (anonymous namespace)::DenseArrayElementParser::append(const APInt &): Assertion `data.getBitWidth() % 8 == 0' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```

It is unclear why the special handling for TF32 is needed. For
reference: #107372
2024-11-20 17:33:06 +09:00
Simon Pilgrim
3a5cf6d99b [X86] Rename AVX512 VEXTRACT/INSERT??x? to VEXTRACT/INSERT??X? (#116826)
Use uppercase in the subvector description ("32x2" -> "32X4" etc.) - matches what we already do in VBROADCAST??X?, and we try to use uppercase for all x86 instruction mnemonics anyway (and lowercase just for the arg description suffix).
2024-11-20 08:25:01 +00:00
Pavel Labath
0394e08bfb [lldb] Reword the "line 0" warning (#116827)
We got a bug report that this message is confusing. In this particular
case, the line zero was due to compiler tail merging (in optimized
code). The main issue was the "no source code" part: in this case it's
kind of incorrect because -- even though we can't really know that --
the address is arguably associated with *multiple* lines of source code.

I've tried to make the new wording more neutral, and added a wink
towards compiler optimizations. I left out the "compiler generated" part
of the message because I couldn't find a way to squeeze that in nicely.
I'm also not entirely sure what it was referring to -- if this was
(just) function prologue/epilogue, then maybe leaving it out is fine, as
we're not likely to stop there anyway (?)

I also left out the function name, because:
- for template functions it gets rather long
- it's already present in the message, potentially twice (once in the
"frame summary" line and once in the snippet of code we show for the
function declaration)

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2024-11-20 09:09:00 +01:00
Andrzej Warzyński
d33673ab05 [mlir][vector][nfc] Update test for mask elimination (#112130)
Updates one example so that:
  * it uses `vector.mask`,
  * upper loop bound is a multiple of the loop step,
  * use `vector.outerproduct` instead of "test.some_computation".

This makes this example a bit closer to realistic cases, which has
always been the goal for this test.
2024-11-20 08:04:16 +00:00