484212 Commits

Author SHA1 Message Date
Joseph Huber
8e2cc19e2e
[LinkerWrapper] Forward more arguments to the CPU offloading linker (#75757)
Summary:
The CPU target currently inherits all the libraries from the normal link
job to ensure that it has access to the same envrionment that the host
does. However, this previously was not respecting argument libraries
that are passed by name rather than `-l` as well as the whole archive
flags. This patch fixes this to allow the CPU linker to correctly pick
up the libraries associated with things like address sanitizers.

Fixes: https://github.com/llvm/llvm-project/issues/75651
2023-12-18 11:16:49 -06:00
Mingming Liu
245cddae70
[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (#74008)
Commit fe05193 (phab D156569), IRPGO names uses format
`[<filepath>;]<linkage-name>` while prior format is
`[<filepath>:<mangled-name>`. The format change would break the use case
demonstrated in (updated)
`llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll` and
`compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp`

This patch changes `GlobalValues::getGlobalIdentifer` to use the
semicolon.

To elaborate on the scenario how things break without this PR
1. IRPGO raw profiles stores (compressed) IRPGO names of functions in
one section, and per-function profile data in another section. The
[NameRef](fc715e4cd9/compiler-rt/include/profile/InstrProfData.inc (L72))
field in per-function profile data is the MD5 hash of IRPGO names.
2. When raw profiles are converted to indexed format profiles, the
profiled address is
[mapped](fc715e4cd9/llvm/lib/ProfileData/InstrProf.cpp (L876-L885))
to the MD5 hash of the callee.
3. In `pgo-instr-use` thin-lto prelink pipeline, MD5 hash of IRPGO names
will be
[annotated](fc715e4cd9/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (L1707))
as value profiles, and used to import indirect-call-prom candidates. If
the annotated MD5 hash is computed from the new format while import uses
the prior format, the callee cannot be imported.

*`compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp`
is added to have an end-to-end test.
* `llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll`
is updated to have better test coverage from another aspect (as runtime
tests are more sensitive to the environment and may be skipped by some
contributors)
2023-12-18 09:10:39 -08:00
Nikita Popov
e400c59beb Revert "[InstCombine] Favour m_Poison in SimplifyDemandedVectorElts"
This reverts commit 318d5bff0b65aa7d52fc7004d49587416f0fb564.

Has incomplete test updates.
2023-12-18 18:08:57 +01:00
Joseph Huber
913622d012
[Libomptarget] Remove remaining global constructors in plugins (#75814)
Summary:
This patch fixes the remaining global constructor in the plguins after
addressing the ones in the JIT interface. This struct was mistakenly
using global constructors as not all the members were being initialized
properly. This was almost certainly being optimized out because it's
trivial, but would still be present in debug builds and prevented us
from compiling with `-Werror=global-constructors`. We will want to do
that once offloading is moved to a runtimes only build.
2023-12-18 11:01:02 -06:00
Sam Tebbs
fade67565e
[AArch64][SME2] Enable bfm builtins for sme2 (#71927)
This patch enables the following builtins for SME2
    svbfmlslb_f32
    svbfmlslb_lane_f32
    svbfmlslt_f32
    svbfmlslt_lane_f32

Patch by: Kerry McLaughlin <kerry.mclaughlin@arm.com>

---------

Co-authored-by: Matthew Devereau <matthew.devereau@arm.com>
2023-12-18 16:51:10 +00:00
Momchil Velikov
35a77fc13c
[Clang][SVE2.1] Update names of the svwhileXX builtins with predicate-as-counter (#75200)
The `_s64`/`_u64` part can be omitted now and the name variants do not
include unsigned comparison mnemonics. Both are inferred from
the argument types.
2023-12-18 16:49:59 +00:00
Mark de Wever
3b0705827d
[libc++][modules] Adds CMake 3.28 support. (#75700)
This is a preparation to start using CMake 3.28 in the CI.
2023-12-18 17:49:11 +01:00
Kerry McLaughlin
f888e739d3
[Clang][SME2] Add multi-vector zip & unzip builtins (#74841)
Adds the following SME2 builtins:
 - svzip (x2 & x4)
 - svzipq (x2 & x4)
 - svuzp (x2 & x4)
 - svuzpq (x2 & x4)

See https://github.com/ARM-software/acle/pull/217/files

Patch by David Sherwood <david.sherwood@arm.com>
2023-12-18 16:38:36 +00:00
Antonio Frighetto
318d5bff0b [InstCombine] Favour m_Poison in SimplifyDemandedVectorElts
A miscompilation issue has been addressed with refined checking.
2023-12-18 17:28:39 +01:00
Simon Pilgrim
7b1e4239b3
[DAG] Fold (vt trunc (extload (vt x))) -> (vt load x) (#75229)
We were only folding cases which remained extloads, but DAG.getExtLoad can also handle the cases which don't need to extend at all (we just can't do truncloads).

reduceLoadWidth can handle this for scalar loads, but not for vectors.

Noticed while triaging D152928
2023-12-18 16:21:11 +00:00
Sam Tebbs
a0a3c793d2
[Clang][SME] Warn when a function doesn't have ZA state (#75805)
This patch adds a warning that's emitted when a builtin call uses ZA
state but the calling function doesn't provide any.

Patch by David Sherwood <david.sherwood@arm.com>.
2023-12-18 16:14:25 +00:00
Oleksandr "Alex" Zinenko
4d9d105c70
[mlir] fix filecheck prefixes in a dataflow test (#75794)
-SAME and -LITERAL do not compose in CHECK commands.
2023-12-18 17:11:21 +01:00
Nathan Sidwell
d0285a31c8
aarch64: fix testcase (#75723)
Add missing < %s to RUN line.
2023-12-18 11:02:44 -05:00
Nikita Popov
cd54c47424 [InstCombine] Match poison instead of undef in foldVectorBinop()
Some negative tests turn into positive tests, as the differences
between undef and poison propagation allow additional transforms.
2023-12-18 17:01:59 +01:00
Momchil Velikov
fd527def7e
[Clang][SVE2.1] Add floating-point variants of svrevd_XX (#75117) 2023-12-18 15:52:28 +00:00
Nikita Popov
ddd11537e2 [InstCombine] Match poison instead of undef in binop of same-mask shuffle fold 2023-12-18 16:41:38 +01:00
Abhina Sree
8a233d8cfd
[SystemZ][z/OS] Add guard for dl_info and dladdr (#75637)
This patch fixes the following build error on z/OS `error: unknown type name 'Dl_info'` by adding a guard to check if we have dladdr.
2023-12-18 10:33:23 -05:00
Nikita Popov
9d25b28b9e [InstCombine] Explicitly canonicalize splat shuffles to use poison RHS
This is usually handled by demanded elements simplification. However,
as that is not supported for scalable vectors, also handle it
explicitly here.
2023-12-18 16:30:40 +01:00
Shilei Tian
0f5eef1fb3
[OpenMP][Clang] Force use of num_teams and thread_limit for bare kernel (#68373)
This patch makes `num_teams` and `thread_limit` mandatory for bare
kernels,
similar to a reguar kernel language that when launching a kernel, the
grid size
has to be set explicitly.
2023-12-18 10:29:26 -05:00
Joseph Huber
1580877555
[Libomptarget] Remove bitcode image map used for JIT processing (#75672)
Summary:
Libomptarget supports JIT by treating an LLVM-IR file as a regular input
image. The handling here used a global map to keep track of triples once
it was parsed. This was done to same time, however this created a global
constructor as well as an extra mutex to handle it. This patch removes
the use of this map.

Instead, we simply use the file magic to perform a quick check if the
input image is valid bitcode. If not, we then create a lazy module. This
should roughly equivalent to the old handling that create an IR symbol
table. Here we can prevent the module from materializing everything but
the single triple metadata we read in later.
2023-12-18 09:28:06 -06:00
Mark de Wever
27767959a5
[libc++][CI] Enable modules in no TZDB build. (#75704)
This is one of the few build where we didn't test modules.
2023-12-18 10:27:13 -05:00
Dominik Wójt
e60167927b
[libc++] Add a picolibc test configuration with exceptions enabled (#75462) 2023-12-18 10:25:50 -05:00
Joseph Huber
87b45f1ca6
[llvm-readobj] Print AMDGPU specific values in GNU mode (#75661)
Summary:
Currently, we don't emit any of the AMDGPU specific flags and options
when printing in GNU-mode (the default). This patch adds extra code to
handle outputting these values to match the output from GNU's `readelf`
when used on an AMDGPU image.
2023-12-18 09:22:22 -06:00
Nikita Popov
a5f3415533 [InstCombine] Replace non-demanded undef vector with poison
If an operand (esp to shufflevector or insertelement) is not
demanded, canonicalize it from undef to poison.
2023-12-18 16:12:37 +01:00
Podchishchaeva, Mariya
5cda366221 Revert "[clang] Fix false positive -Wmissing-field-initializer for anonymous unions (#70829)"
This reverts commit a01307a6ee788fc6ac2e09e58f0f52e5666def86 and its
follow-up fix 32d5221ec4810dd723ccebaabbda1df5d3b4cfcf.

It caused unexpected warnings emitted for nested designators in C.
2023-12-18 07:08:27 -08:00
Gheorghe-Teodor Bercea
cd1038a46a
[OpenMP][libomptarget][Fix]Require presence of libomptarget-debug for newly added test (#75807)
Require presence of libomptarget-debug fixes https://github.com/llvm/llvm-project/pull/75642
2023-12-18 10:07:52 -05:00
Louis Dionne
a35629cd8d
[libc++] Remove assumptions that std::array::iterator is a raw pointer (#74624)
This patch removes assumptions that std::array's iterators are raw
pointers in the source code and in our test suite. While this is true
right now, this doesn't have to be true and ion the future we might want
to enable bounded iterators in std::array, which would require this
change.

This is a pre-requisite for landing #74482
2023-12-18 10:00:47 -05:00
Nikita Popov
d0605e21af [InstCombine] Canonicalize splat shuffles to use poison operand
If the splat shuffle is represented using an undef RHS, replace it
with poison.
2023-12-18 15:57:49 +01:00
Gheorghe-Teodor Bercea
4ef6587715
[Clang][OpenMP] Fix mapping of structs to device (#75642)
Fix mapping of structs to device.

The following example fails:

```
#include <stdio.h>
#include <stdlib.h>

struct Descriptor {
  int *datum;
  long int x;
  int xi;
  long int arr[1][30];
};

int main() {
  Descriptor dat = Descriptor();
  dat.datum = (int *)malloc(sizeof(int)*10);
  dat.xi = 3;
  dat.arr[0][0] = 1;

  #pragma omp target enter data map(to: dat.datum[:10]) map(to: dat)

  #pragma omp target
  {
    dat.xi = 4;
    dat.datum[dat.arr[0][0]] = dat.xi;
  }

  #pragma omp target exit data map(from: dat)

 return 0;
}
```

This is a rework of the previous attempt:
https://github.com/llvm/llvm-project/pull/72410
2023-12-18 09:47:59 -05:00
Alexey Bataev
58a2c4e2f2 [SLP][NFC]Check for equal opcode preliminary to meet weak strict order
requirement, NFC.

This change does not affect functionality, just fixes the assertions in
some standard c++ library implementations.
2023-12-18 06:42:03 -08:00
Nikita Popov
6d91905f97 [ValueTracking] Short-circuit on unknown bits in isKnownNonEqual() (NFC)
Don't bother computing known bits for the second operand if we
know nothing about the first.
2023-12-18 15:36:38 +01:00
Nikita Popov
e93d324adb [InstCombine] Preserve poison in evaluateInDifferentElementOrder()
Don't unnecessarily replace poison with undef.
2023-12-18 15:36:22 +01:00
Matt Arsenault
629412938b
Triple: Fix handling of macos with unexpected target arches (#75469)
Some tools with a specified target arch, but no full triple default to
the host triple. On macos hosts, this would then force using macho on
targets that didn't expect it, resulting in assertions.

We should also probably emit explicit errors if the object format is
specified on targets which don't handle it.
2023-12-18 21:28:33 +07:00
Nikita Popov
6c9813aa02 [InstCombine] Check for poison instead of undef in shuffle combine
Otherwise we may replace undef with poison.

Note that a lot of tests regressing here already have variants
that use poison instead of undef (often in a separate
inseltpoison file), which is why I'm not adjusting them to the
new pattern.
2023-12-18 15:19:16 +01:00
Jay Foad
7e5019e82b
[AMDGPU] Simplify WaitcntBrackets::getRegInterval with getPhysRegBaseClass (#74087)
This means that getRegInterval no longer depends on the MCInstrDesc, so
it could be simplified further to take just a MachineOperand or just a
physical register. NFCI.
2023-12-18 14:16:02 +00:00
Nikita Popov
fda3a134bc [InstCombine] Regenerate test checks (NFC) 2023-12-18 15:00:59 +01:00
Oleksandr "Alex" Zinenko
32a4e3fcca
[mlir] support non-interprocedural dataflow analyses (#75583)
The core implementation of the dataflow anlysis framework is
interpocedural by design. While this offers better analysis precision,
it also comes with additional cost as it takes longer for the analysis
to reach the fixpoint state. Add a configuration mechanism to the
dataflow solver to control whether it operates inteprocedurally or not
to offer clients a choice.

As a positive side effect, this change also adds hooks for explicitly
processing external/opaque function calls in the dataflow analyses,
e.g., based off of attributes present in the the function declaration or
call operation such as alias scopes and modref available in the LLVM
dialect.

This change should not affect existing analyses and the default solver
configuration remains interprocedural.

Co-authored-by: Jacob Peng <jacobmpeng@gmail.com>
2023-12-18 14:16:52 +01:00
Ulrich Weigand
82a1bffd34
[SelectionDAG] Do not crash on large integers in CheckInteger (#75787)
The CheckInteger routine called from TableGen-generated selection logic
uses getSExtValue - which will abort if the underlying APInt does not
fit into an int64_t.

This case is now triggered by the SystemZ back-end since i128 is a legal
type on certain machines. While we do not have any regular instructions
that take 128-bit immediates (like most other platforms), there are
patterns in the .td files that recognize an i128 "xor ..., -1" as a
"not".

These patterns cause code to be generated that calls the CheckInteger
routine on some i128-valued integer, which may trigger the assert.

Fix by using trySExtValue instead.

Fixes https://github.com/llvm/llvm-project/issues/75710
2023-12-18 14:03:57 +01:00
arrv-sc
74cf5254d2
[llvm][Support] Add indirection to call correct validate(...) function (#71966)
Previously "yamlize" overload for validatedMappingTraits was unconditionally calling "MappingTraits<T>::validate" even if "MappingContextTraits<T, Context>" was passed to it.

Therefore compilation failed when specifying "MappingContextTraits<T,Context>::validate()"
2023-12-18 13:02:17 +00:00
harishch4
482a37b860
[Flang][OpenMp]Add testcase for threadprivate with blank common block (#74969) 2023-12-18 18:27:34 +05:30
antoine moynault
9727919a2e
Revert "[RISCV] Implement multi-lib reuse rule for RISC-V bare-metal … (#75789)
…toolchain (#73765)"

This reverts commit 111a2290650743b27f70f9b24618411e54493b59,

as it broke several bots
  https://lab.llvm.org/buildbot/#/builders/245/builds/18162
  https://lab.llvm.org/buildbot/#/builders/188/builds/39436
  https://lab.llvm.org/buildbot/#/builders/187/builds/13723
  https://lab.llvm.org/buildbot/#/builders/182/builds/8449
  https://lab.llvm.org/buildbot/#/builders/198/builds/7438
  https://lab.llvm.org/buildbot/#/builders/176/builds/7419
  https://lab.llvm.org/buildbot/#/builders/186/builds/13781
  https://lab.llvm.org/buildbot/#/builders/183/builds/18116
  https://lab.llvm.org/buildbot/#/builders/197/builds/11410
  https://lab.llvm.org/buildbot/#/builders/184/builds/8651

When reapplying, please take care of another commit that have been
merged after this one:
c7cdf3cd5d74 [clang] Use 'starts_with' instead of 'startswith' in
Gnu.cpp (NFC)
2023-12-18 13:52:21 +01:00
Benjamin Kramer
8f5628eaef Reapply "[bazel] Port 2e45326b088b3b2f5c8327f6d5e61bdd2845bbbe"
This reverts commit 0911f237737839dd90e77c93dd865756275aba69. The
corresponding Clang change re-landed in 945c645acb9670b7b866a4abd94bcc9b0ae5d87d
2023-12-18 13:26:38 +01:00
Paul Walker
dea16ebd26
[LLVM][IR] Replace ConstantInt's specialisation of getType() with getIntegerType(). (#75217)
The specialisation will not be valid when ConstantInt gains native
support for vector types.

This is largely a mechanical change but with extra attention paid to constant
folding, InstCombineVectorOps.cpp, LoopFlatten.cpp and Verifier.cpp to
remove the need to call `getIntegerType()`.

Co-authored-by: Nikita Popov <github@npopov.com>
2023-12-18 11:58:42 +00:00
Serge Pavlov
2f81788067
[ARM][FPEnv] Lowering of fpmode intrinsics (#74054)
LLVM intrinsics `get_fpmode`, `set_fpmode` and `reset_fpmode` operate
control modes, the bits of FP environment that affect FP operations. On
ARM these bits are in FPSCR together with the status bits. The
implementation of these intrinsics produces code close to that of
functions `fegetmode` and `fesetmode` from GLIBC.

Pull request: https://github.com/llvm/llvm-project/pull/74054
2023-12-18 18:57:36 +07:00
Simon Pilgrim
df3ddd78f6 CGBuiltin - fix gcc Wunused-variable warning. NFC. 2023-12-18 11:51:24 +00:00
Ulrich Weigand
a00c4220be [SystemZ] Fix complex address matching when i128 is legal
Complex address matching currently handles truncations, under
the assumption that those are no-ops.  This is no longer true
when i128 is legal.  Change the code to only handle actual
no-op truncations.

Fixes https://github.com/llvm/llvm-project/issues/75708
Fixes https://github.com/llvm/llvm-project/issues/75714
2023-12-18 12:47:45 +01:00
Alex Bradbury
3b08b3340d [RISCV][test] Fix lifetime bug with Module in test
As pointed out by @s-barannikov in post-commit review of #72356, the
module is destroyed at the end of the constructor.
2023-12-18 11:45:21 +00:00
Mark de Wever
9c18f03196
[libc++] Adds headers to FTM. (#75699)
These feature-test macros had no headers listed in their associated
papers. This adds the expected headers.

Fixes https://github.com/llvm/llvm-project/issues/75577
2023-12-18 12:43:10 +01:00
Haojian Wu
42239d2e96
[clang] Fix CTAD not respect default template arguments that were added after the definition. (#75569)
Fixes https://github.com/llvm/llvm-project/issues/69987
2023-12-18 12:37:29 +01:00
Nikita Popov
465ecf872e [InstCombine] Rename UndefElts -> PoisonElts (NFC)
In line with updated shufflevector semantics, this represents the
poison elements rather than undef elements now. This commit is a
pure rename, without any logic changes.
2023-12-18 12:36:19 +01:00