Commit Graph

522696 Commits

Author SHA1 Message Date
agozillon
5137c209f0 [Flang][OpenMP] Fix allocating arrays with size intrinisic (#119226)
Attempt to address the following example from causing an assert or ICE:

```
   subroutine test(a)
        implicit none
        integer :: i
        real(kind=real64), dimension(:) :: a
        real(kind=real64), dimension(size(a, 1)) :: b

!$omp target map(tofrom: b)
        do i = 1, 10
            b(i) = i
        end do
!$omp end target
end subroutine
```

Where we utilise a Fortran intrinsic (size) to calculate the size of
allocatable arrays and then map it to device.
2025-01-03 16:46:15 +01:00
Matthias Springer
faa30be101 [mlir][Transforms] Fix build after #116524 (#121578)
Fix build errors after #116524.

```
error: call of overloaded ‘TypeRange(ValueVector&)’ is ambiguous
```
2025-01-03 16:35:02 +01:00
Krzysztof Parzyszek
adeff9f63a [flang][OpenMP] Allow utility constructs in specification part (#121509)
Allow utility constructs (error and nothing) to appear in the
specification part as well as the execution part. The exception is
"ERROR AT(EXECUTION)" which should only be in the execution part.
In case of ambiguity (the boundary between the specification and the
execution part), utility constructs will be parsed as belonging to the
specification part. In such cases move them to the execution part in the
OpenMP canonicalization code.
2025-01-03 09:21:36 -06:00
Yingwei Zheng
a4d92400a6 [InstCombine] Fix GEPNoWrapFlags propagation in foldGEPOfPhi (#121572)
Closes https://github.com/llvm/llvm-project/issues/121459.
2025-01-03 23:19:57 +08:00
Fabian Ritter
68d265666e [clang][NFC][docs] Fix typo in LanguageExtensions (#121576) 2025-01-03 16:15:27 +01:00
Matthias Springer
3ace685105 [mlir][Transforms] Support 1:N mappings in ConversionValueMapping (#116524)
This commit updates the internal `ConversionValueMapping` data structure
in the dialect conversion driver to support 1:N replacements. This is
the last major commit for adding 1:N support to the dialect conversion
driver.

Since #116470, the infrastructure already supports 1:N replacements. But
the `ConversionValueMapping` still stored 1:1 value mappings. To that
end, the driver inserted temporary argument materializations (converting
N SSA values into 1 value). This is no longer the case. Argument
materializations are now entirely gone. (They will be deleted from the
type converter after some time, when we delete the old 1:N dialect
conversion driver.)

Note for LLVM integration: Replace all occurrences of
`addArgumentMaterialization` (except for 1:N dialect conversion passes)
with `addSourceMaterialization`.

---------

Co-authored-by: Markus Böck <markus.boeck02@gmail.com>
2025-01-03 16:11:56 +01:00
Acim Maravic
9d6527bc12 [CodeGen] Add MOTargetFlag4 to MachineMemOperand Flags (#120136) 2025-01-03 15:45:52 +01:00
Florian Mayer
62b5cf0410 [Vectorizer] precommit test for miscompilation (#120731)
we generate GEPs that are out of bounds but mark them as "inbound"
2025-01-03 06:37:45 -08:00
Krzysztof Parzyszek
df859f90aa [flang][OpenMP] Frontend support for NOTHING directive (#120606)
Create OpenMPUtilityConstruct and put the two utility directives in it
(error and nothing). Rename OpenMPErrorConstruct to OmpErrorDirective.
2025-01-03 08:36:34 -06:00
Haojian Wu
e576c5bed7 Fix an incorrect -show-graph command-line flag in COFF_comdat_weak_plus_strong.s test
The flag -show-graph has been renamed to -show-graphs in 01bdd8cffc
2025-01-03 15:17:50 +01:00
Nico Weber
6cd171dc33 [lld/COFF] Support thin archives in /reproduce: files (#121512)
This already worked without /wholearchive; now it works with it too.
(Only for thin archives containing relative file names, matching the ELF
and Mach-O ports.)
2025-01-03 08:20:06 -05:00
Haojian Wu
119fc720a1 NFC, explicitly specify the -fopenmp lib in spirv-openmp-toolchain.c test
Don't rely on the default `CLANG_DEFAULT_OPENMP_RUNTIME` env variable
which is `libomp` by default.
2025-01-03 14:16:47 +01:00
Adrian Kuegel
e53494c750 [mlir] Fix 0 values passed to the wrong parameters.
This was found by modernize-use-nullptr ClangTidy check, which suggested
to pass nullptr instead of 0 to DIFileAttr.
However it looks like the intention was to pass the two 0 values for
line and scopeLine, and we should pass {} to DIFileAttr. Do that change.
2025-01-03 13:07:49 +00:00
Nico Weber
d598829375 [gn] make LLVMTableGenCommon a static_library again
Else TableGenTests doesn't link.
2025-01-03 08:05:15 -05:00
Nico Weber
b1c195cbd1 [gn] port 27f3002974 (yet another tblgen reorg) 2025-01-03 08:00:08 -05:00
Adrian Kuegel
cba9c6ac15 [mlir] Fix typo in parameter name annotation comment.
Found by ClangTidyBugProne check.
2025-01-03 12:50:05 +00:00
David Spickett
5cf138cfba [llvm][JITLink][LoongArch] Fix bit extraction on 32 bit platforms
This shifted `1UL` to make the mask. On 32 bit Linux UL is 32 bit,
so if Hi+1 was >= 32 then you'd get the wrong result here.

The other version of this uses 1ULL, but using the uint64_t typename
here saves someone going to check what ULL means on different platforms.

This fixes test failures seen on Linaro's 32 bit bots:
https://lab.llvm.org/buildbot/#/builders/39/builds/3700
https://lab.llvm.org/buildbot/#/builders/122/builds/781

Though I cannot say exactly why this fixes them. Does not seem
like the new code was triggering this problem, but somehow it
must be.
2025-01-03 12:47:14 +00:00
David Green
f87a9db832 [ARM] Expand fp64 bf16 converts similarly to f32
This helps with +fp64 targets where the f64s are legal and not previously
lowered. It can treat fpextends as a shift + cvt and fptrunc can use a libcall.
2025-01-03 11:28:31 +00:00
Hugo Trachino
579ced4f82 [MLIR][Python] Add structured.fuseop to python interpreter (#120601)
Implements a python interface for structured.fuseOp allowing more freedom with inputs.
2025-01-03 11:21:59 +00:00
David CARLIER
85849917f7 [compiler-rt][rtsan] Reland "fopencookie support." (#120864) (#121547) 2025-01-03 11:16:34 +00:00
Younan Zhang
2e41489d7b [Clang] Fix unexpanded packs in NTTP type constraints (#121296)
In the case where a type-constraint on an NTTP contains a pack, we form
a PackExpansionType to model it. However, there are a few places
expecting it to be a non-pack expansion, and luckily only small changes
could make them work.

Fixes https://github.com/llvm/llvm-project/issues/88866
2025-01-03 19:10:43 +08:00
Kaviya Rajendiran
d3eb65f15d [MLIR][OpenMP] Lowering aligned clause to LLVM IR for SIMD directive (#119536)
This patch,
- Added a translation support for aligned clause in SIMD directive by passing the alignment details to "llvm.assume" intrinsic.
- Updated the insertion point for llvm.assume intrinsic call in "OMPIRBuilder.cpp".
- Added a check in aligned clause MLIR lowering, to ensure that the alignment value must be a power of 2.
2025-01-03 16:22:38 +05:30
Simon Pilgrim
e3ec5a7286 [VectorCombine] foldShuffleOfBinops - fold shuffle(binop(shuffle(x),shuffle(z)),binop(shuffle(y),shuffle(w)) -> binop(shuffle(x,z),shuffle(y,w)) (#120984)
Some patterns (in particular horizontal style patterns) can end up with shuffles straddling both sides of a binop/cmp.

Where individually the folds aren't worth it, by merging the (oneuse) shuffles we can notably reduce the net instruction count and cost.

One of the final steps towards finally addressing #34072
2025-01-03 10:29:07 +00:00
Mariya Podchishchaeva
cdad183194 [clang] Fix #embed "fast path" (#121479)
When a single #embed directive is used to initialize a char array, the
case is optimized via swap of EmbedExpr to underlying StringLiteral,
resulting in better performance in AST consumers.
While browsing through the code, I realized that
7122b70cfc
which changed type of EmbedExpr made the "fast path" unreachable. This
patch fixes this unfortunate situation.
2025-01-03 11:17:16 +01:00
Lang Hames
ad192f9f20 [ORC] Restrict check-dwarf-filename test to Darwin for now.
This test is failing on Windows (see e.g.
https://lab.llvm.org/buildbot/#/builders/146/builds/1983), probably due to
incomplete debugger support there (the test registers debug info in-process, so
non-Darwin builds shouldn't be expected to have the right symbols).
2025-01-03 20:46:55 +11:00
ShihPo Hung
366e836051 [RISCV][NFC] precommit test for fcmp with f16 2025-01-03 01:45:27 -08:00
Haojian Wu
e4e47cef55 [bazel] Fix the broken llvm-tblgen build for 27f3002974 2025-01-03 10:35:49 +01:00
Shao-Ce SUN
2fae5bdea7 [RISCV] Add support of Sdext,Sdtrig extentions (#120936)
`Sdext` and `Sdtrig` are RISC-V extensions related to debugging.

The full specification can be found at

https://github.com/riscv/riscv-debug-spec/releases/download/1.0.0-rc4/riscv-debug-specification.pdf
2025-01-03 17:25:42 +08:00
Andrzej Warzyński
2582568217 [mlir] Add missing patterns to linalg.decompose_pack_unpack TD Op (#121400)
This PR is a follow-up to #116373 and #116439, where a Transform Dialect
(TD) operation was introduced to collect patterns for decomposing
tensor.pack. The second patch renamed the patterns and the TD Op.
Originally, adding patterns for `tensor.unpack` was marked as a TODO,
which this PR addresses.

No new tests are introduced in this PR. Instead, existing tests from:

* "decompose-tensor-unpack.mlir"

are reused. To achieve this:

* The test is updated to use the TD operation
  `transform.apply_patterns.linalg.decompose_pack_unpack` instead of the
  flag `--test-linalg-transform-patterns="test-decompose-tensor-unpack"`,
  avoiding artificial tests created solely for the TD Op.
* The TD sequence is saved to a new file, "decompose_unpack.mlir", and
  preloaded using the option.
2025-01-03 09:11:38 +00:00
Andrzej Warzyński
9f6a1ddb43 [mlir][tensor] Introduce FoldTensorCastUnPackOp (#121393)
This patch specializes `FoldTensorCastProducerOp` for `tensor::UnPackOp` by
introducing a dedicated pattern: `FoldTensorCastUnPackOp`. This mirrors a
similar update made for `tensor::PackOp` in #114559. Below is the updated
rationale tailored to `tensor::UnPackOp`.

ISSUE DESCRIPTION

Currently, `FoldTensorCastProducerOp` incorrectly folds the following:

```mlir
%cast = tensor.cast %dest : tensor<1x1x8x1xi32> to tensor<1x1x?x1xi32>
// Note: `%c8` and `?`.
%unpack = tensor.unpack %cast
  inner_dims_pos = [0, 1]
  inner_tiles = [%c8, 1]
  into %res : tensor<1x1x?x1xi32> -> tensor<7x?xi32>
```
as:

```mlir
// Note: `%c8` and `8`.
%unpack = tensor.unpack %cast
  inner_dims_pos = [0, 1]
  inner_tiles = [%c8, 1]
  into %res : tensor<1x1x8x1xi32> -> tensor<7x?xi32>
```
This triggers an Op verification failure because the folder does not
update the inner tile sizes in the unpack Op. This patch addresses the
issue by ensuring proper handling of inner tile sizes.

ADDITIONAL CHANGES

* invalid.mlir: Fixed a typo.
* TensorOps.cpp:
  * Removed unnecessary `(void)tileSize`.
  * Added comments following the discussion in PR #115772.
  * Made minor updates to `FoldTensorCastPackOp` for consistency with the newly
    introduced `FoldTensorCastUnPackOp`.
* Tensor/canonicalize.mlir: Ensured consistent usage of `test_attr` (e.g.,
  replaced mixed use of `test_attr` and `some_attr`).
2025-01-03 09:09:23 +00:00
Brox Chen
8b23ebb498 [AMDGPU][True16[MC] true16 for v_max3/min3_num_f16 (#121510)
V_MAX3/MIN3_NUM_F16 are alias GFX12 instructions with V_MAX3/MIN3_F16 in
GFX11 and they should be updated together.

This fix a bug introduced in
https://github.com/llvm/llvm-project/pull/113603 such that only
V_MAX3/MIN3_F16 are replaced in true16 format. Also added GFX12 runlines
for CodeGen test
2025-01-03 08:55:58 +00:00
ZhaoQi
67ff11ea5b [LoongArch] Avoid scheduling tls-desc code sequence in large code model (#121541) 2025-01-03 16:43:39 +08:00
Michael Kruse
27f3002974 [llvm-(min-)tblgen] Avoid redundant source compilation (#114494)
All the sources of `llvm-min-tblgen` are also used for `llvm-tblgen`,
with identical compilation flags. Reuse the object files of
`llvm-min-tblgen` for `llvm-tblgen` by applying the usual source
structure of an executable: One file per executable which named after
the executable name containing the (in this case trivial) main function,
which just calls the tblgen_main in TableGen.cpp. This should also clear
up any confusion (including mine) of where each executable's main
function is.

While this slightly reduces build time, the main motivation is ccache.
Using the hard_link
option, building the object files for `llvm-tblgen` will result in a
hard link to the same object file already used for `llvm-min-tblgen`. To
signal the build system that the file is new, ccache will update the
file's time stamp. Unfortunately, time stamps are shared between all
hard-linked files s.t. this will indirectly also update the time stamps
for the object files used for `llvm-tblgen`. At the next run, Ninja will
recognize this time stamp discrepancy to the expected stamp recorded in
`.ninja_log` and rebuild those object files for `llvm-min-tblgen`, which
again will also update the stamp for the `llvm-tblgen`... . This is
especially annoying for tablegen because it means Ninja will re-run all
tablegenning in every build.

I am using the hard_link option because it reduces the cost of having
multiple build-trees of the LLVM sources and reduces the wear to the SSD
they are stored on.
2025-01-03 09:41:57 +01:00
Pengcheng Wang
3ef78188d0 [PowerPC] Use RegisterClassInfo::getRegPressureSetLimit (#120383)
`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
2025-01-03 16:41:18 +08:00
Fangrui Song
82fecab85a [gcov] Bump default version to 11.1
The gcov version is set to 11.1 (compatible with gcov 9) even if
`-Xclang -coverage-version=` specified version is less than 11.1.

Therefore, we can drop producer support for version < 11.1.
2025-01-02 23:01:28 -08:00
Lang Hames
30b73ed7bd [ORC][MachO] Avoid another race condition in MachOPlatform bootstrap.
Similar to a9e75b1d4d: During MachOPlatform bootstrap we need to defer actions
until essential platform functionality has been loaded, but the platform itself
may be loaded under a concurrent dispatcher so we have to guard against the
deferred actions vector being accessed concurrently.

This fixes a probablistic failure in the ORC runtime regression tests on
Darwin/x86-64 that was spotted after edca1d9bad (which turned on concurrent
linking by default in llvm-jitlink).
2025-01-03 17:30:19 +11:00
Lang Hames
febe1a9d28 [ORC] Use structured binding to improve readability. NFC. 2025-01-03 17:30:19 +11:00
Lang Hames
93a68a5188 [ORC] Testcase requires asserts as it depends on debugging output. 2025-01-03 17:30:19 +11:00
Pengcheng Wang
72db3f989e [RISCV] Allow tail memcmp expansion (#121460)
This optimization was introduced by #70469.

Like AArch64, we allow tail expansions for 3 on RV32 and 3/5/6
on RV64.

This can simplify the comparison and reduce the number of blocks.
2025-01-03 14:05:02 +08:00
dmasloff
1c997feff1 [clang-format] Add option WrapNamespaceBodyWithNewlines (#106145)
It wraps the body of namespace with additional newlines, turning this code:
```
namespace N {
int function();
}
```
into the following:
```
namespace N {

int function();

}
```

---------

Co-authored-by: Owen Pan <owenpiano@gmail.com>
2025-01-02 21:52:01 -08:00
Lang Hames
b6c06d1a8d [ORC] Fix bug in source file name finding in DebuggerSupportPlugin.
The debug section map was using MachO section names (with the "__" prefix), but
DWARFContext expects section names with the object format prefix stripped off.
This was preventing DWARFContext from accessing the debug_str section,
resulting in bogus source name strings.
2025-01-03 15:45:43 +11:00
Alex MacLean
56e944bede [NFC] add anonymous namespace to a couple classes (#121511)
This ensures these classes are visible only to the appropriate
translation unit and allows for more optimizations.
2025-01-02 20:13:18 -08:00
ZhaoQi
e4372c4454 [LoongArch] Pre-commit tests for tls-desc scheduling. NFC (#121538)
Code sequence for tls-desc in large code model is not expected to be
scheduled according to psABI 2.30.

A later commit will fix it.
2025-01-03 11:23:44 +08:00
YAMAMOTO Takashi
9df375e5ea [lld][WebAssembly] Fix non-pie dynamic-linking executable (#108146)
The commit 22b7b84860
made the symbols provided by shared libraries "defined",
and thus effectively made it impossible to generate non-pie
dynamically linked executables using
--unresolved-symbols=import-dynamic.

This commit, based on https://github.com/llvm/llvm-project/pull/109249,
fixes it by checking sym->isShared() explictly.
(as a bonus, you don't need to rely on
--unresolved-symbols=import-dynamic
anymore.)

Fixes https://github.com/llvm/llvm-project/issues/107387
2025-01-02 18:53:21 -08:00
Fangrui Song
510a5c7fc2 [ELF] Fix .gnu.version crash when .dynsym is discarded
Fix #88650

In addition, delete the unneeded comment.
https://sourceware.org/gnu-gabi/program-loading-and-dynamic-linking.txt
2025-01-02 18:46:44 -08:00
gulfemsavrun
e8cf41311f Revert "[compiler-rt][rtsan] fopencookie support." (#121537)
Reverts llvm/llvm-project#120864 because it broke building compiler-rt
on Mac.

https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-mac-arm64/b8726812736235038609/overview
2025-01-02 18:34:02 -08:00
Alejandro Álvarez Ayllón
c1ecc0d168 [clang] Allow generating module interfaces with parsing errors (#121485)
Fixes a regression introduced in commit
da00c60dae

This functionality was originally added in commit
5834996fef

Co-authored-by: Tomasz Kaminski <tomasz.kaminski@sonarsource.com>
2025-01-03 09:43:53 +08:00
Valentin Clement (バレンタイン クレメン)
7531672712 [flang][cuda][NFC] Remove unused variable (#121533)
Failed buildbot after https://github.com/llvm/llvm-project/pull/121524
2025-01-02 17:37:44 -08:00
Fangrui Song
3792b36234 [lld][WebAssembly] Replace config-> with ctx.arg.
Change the global variable reference to a member access of another
variable `ctx`. In the future, we may pass through `ctx` to functions to
eliminate global variables.

Pull Request: https://github.com/llvm/llvm-project/pull/119835
2025-01-02 17:08:18 -08:00
ZhaoQi
8e404509cc [JITLink][RISCV] Add feature relax for addsub tests. NFC (#121204)
R_RISCV_{ADD*/SUB*} relocations are kept only when feature relax
enabled. So it is better to add relax to the test, so that relocs can be
reserved for processing by the jitlink. That's what this test really
wants to test.
2025-01-03 09:07:44 +08:00