Commit Graph

497959 Commits

Author SHA1 Message Date
Matt Arsenault
f548c4d83c AMDGPU: Add mode register use to s_getreg_b32
This should fix reading the wrong mode after setting the mode.
Ideally we would have separate pseudos for the case that we know
does not read mode.
2024-05-07 16:06:51 +02:00
Benjamin Kramer
9eb91f45fb [bazel] Add nobuildkite tags for incompatible targets 2024-05-07 15:58:47 +02:00
Benjamin Kramer
a775455cdc [bazel] Add nobuildkite tags for incompatible target 2024-05-07 15:57:36 +02:00
Alexey Bataev
5d9b549bb0 [SLP][NFC]Add a test showing incorrect signedness detection in sext nodes. 2024-05-07 06:46:30 -07:00
Jonathan Peyton
41ca9104ac [OpenMP] Fix task state and taskteams for serial teams (#86859)
* Serial teams now use a stack (similar to dispatch buffers)
* Serial teams always use `t_task_team[0]` as the task team and the
second pointer is a next pointer for the stack

`t_task_team[1]` is interpreted as a stack of task teams where each
level is a nested level

```
 inner serial team                   outer serial team
[ t_task_team[0] ] -> (task_team)    [ t_task_team[0] ] -> (task_team)
[ next           ] ----------------> [ next           ] -> ...
```

* Remove the task state memo stack from thread structure.
* Instead of a thread-private stack, use team structure to store
th_task_state of the primary thread. When coming out of a parallel,
restore the primary thread's task state. The new field in the team
structure doesn't cause sizeof(team) to change and is in the cache line
which is only read/written by the primary thread.

Fixes: #50602
Fixes: #69368
Fixes: #69733
Fixes: #79416
2024-05-07 08:41:51 -05:00
Benjamin Kramer
1d87465a0a [libc][math] fmod: clear exceptions before the test instead of after
The test has no control over the CPU state before the test runs.

This test checks whether no exception flags are set, which may not be
true at the start of the test. This used to be not a problem because the
check was broken but that was fixed in ecfb5d9951
2024-05-07 15:27:55 +02:00
David Truby
227fe1c199 [flang] Remove C++ runtime dependency from Sleep extension (#84911)
The Sleep extension currently has a potential dependency on the C++
runtime. I run into this dependency using libc++ on Linux. This patch 
uses the POSIX `sleep` function or the Windows `Sleep` function 
instead to avoid this dependency.
2024-05-07 14:27:39 +01:00
Haojian Wu
27becf0c3c [clang] CTAD: fix the aggregate deduction guide for alias templates. (#90894)
For alias templates, our current way of constructing their aggregate
deduction guides deviates from the standard approach. We should align it
with how we handle implicit deduction guides.

This patch has a refactoring change which pulls the construction logic
out from `DeclareImplicitDeductionGuidesForTypeAlia` and reusing it for
building aggregate deduction guides.
2024-05-07 15:20:43 +02:00
Louis Dionne
fff2db2e42 [libc++] Rename _LIBCPP_INTRODUCED_foo_MARKUP to _LIBCPP_INTRODUCED_foo_ATTRIBUTE (#91269)
This was discussed in #87563 and overlooked when I landed the patch.
2024-05-07 09:11:16 -04:00
martinboehme
66364e6540 [clang][dataflow] Add reachedLimit() to the Solver interface. (#91320)
We may want code to call this that doesn't know which specific solver
implementation it is dealing with.
2024-05-07 14:58:57 +02:00
Vincent Belliard
b22a6f1eba [lldb] fix step in AArch64 trampoline (#90783)
Detects AArch64 trampolines in order to be able to step in a function
through a trampoline on AArch64.

---------

Co-authored-by: Vincent Belliard <v-bulle@github.com>
2024-05-07 13:42:16 +01:00
Nikolas Klauser
6f2997cefc [libc++][NFC] Remove unused include from <__type_traits/is_equality_comparable.h> (#90950) 2024-05-07 14:25:10 +02:00
Peter Waller
458d706741 [llvm-mca] Make bad-input.s even more CPU specific
Note: This patch is distinct from the previous one titled
  "[llvm-mca] Move bad-input.s test to be target specific"

This is a followup to #90474 and commit
afc10fc9b7

Context: Builders failing because they're unable to run the failure
test.

This still doesn't work in various circumstances, it seems MCA doesn't
want to run on a wide variety of hosts in various configurations, so
stick to the tried and tested method and pass -mtriple and -mcpu.
2024-05-07 13:10:40 +01:00
Peter Waller
afc10fc9b7 [llvm-mca] Move bad-input.s test to be target specific
... for now.

This is a follow up to #90474 in response to build bot failures.

This test is intended to check a case where invalid assembly is passed
to llvm-mca.

Unfortunately it appears that a cross-toolchain built with
-DTOOLCHAIN_TARGET_TRIPLE does not have an llvm-mca which works out of
the box if the host target is not enabled.

As a quick fix to make the build bots green, move the test into AArch64
and X86 so that there is reasonable coverage for this test; later I hope
mca can be fixed to work out of the box in this configuration.
2024-05-07 12:50:20 +01:00
Donát Nagy
6d64f8e1fe [analyzer] Use explicit call description mode in more checkers (#90974)
This commit explicitly specifies the matching mode (C library function,
any non-method function, or C++ method) for the `CallDescription`s
constructed in various checkers.

Some code was simplified to use `CallDescriptionSet`s instead of
individual `CallDescription`s.

This change won't cause major functional changes, but isn't NFC because
it ensures that e.g. call descriptions for a non-method function won't
accidentally match a method that has the same name.

Separate commits have already performed this change in other checkers:
- easy cases: e2f1cbae45
- MallocChecker: d6d84b5d14
- iterator checkers: 06eedffe0d
- InvalidPtr checker: 024281d4d2

... and follow-up commits will handle the remaining checkers.

My goal is to ensure that the call description mode is always explicitly
specified and eliminate (or strongly restrict) the vague "may be either
a method or a simple function" mode that's the current default.
2024-05-07 13:48:02 +02:00
Emma Pilkington
dcc7ef3ce8 [AMDGPU][MC] Disable sendmsg SYSMSG_OP_HOST_TRAP_ACK on gfx9+ (#90203)
This is no longer supported as of gfx9. Fixes #52903

This commit also includes some refactoring of sendmsg operand parsing:
  - Use CustomOperand for sendmsg operations, this allows them to be
    conditionally available based on a STI check (and automatically in
    sync with SIDefines.h).
  - Move CustomOperand table lookups from AMDGPUBaseInfo to
    AMDGPUAsmUtils. This cleans up an awkward interface where
    AMDGPUAsmUtils defined a table/size as globals that AMDGPUBaseInfo
    had to loop over.
  - Clean up a few of the operand lookup functions while moving them.
2024-05-07 07:38:58 -04:00
Donát Nagy
97dd8e3c4f [analyzer] Clean up apiModeling.llvm.ReturnValue (#91231)
This commit heavily refactors and simplifies the small and trivial
checker `apiModeling.llvm.ReturnValue`, which is responsible for
modeling the peculiar coding convention that in the LLVM/Clang codebase
certain Error() methods always return true.

Changes included in this commit:
- The call description mode is now specified explicitly (this is not the
most significant change, but it was the original reason for touching
this checker).
- Previously the code provided support for modeling functions that
always return `false`; but there was no need for that, so this commit
hardcodes that the return value is `true`.
- The overcomplicated constraint/state handling logic was simplified.
- The separate `checkEndFunction` callback was removed to simplify the
code. Admittedly this means that the note tag for the "<method> returns
false, breaking the convention" case is placed on the method call
instead of the `return` statement; but that case will _never_ appear in
practice, so this difference is mostly academical.
- The text of the note tags was clarified.
- The descriptions in the header comment and Checkers.td were clarified.
- Some minor cleanup was applied in the associated test file.

This change is very close to NFC because it only affects a hidden
`apiModeling.llvm` checker that's only relevant during the analysis of
the LLVM/Clang codebase, and even there it doesn't affect the normal
behavior of the checker.
2024-05-07 13:06:11 +02:00
Chris Copeland
651bdb96b1 [ARM] Armv8-R does not require fp64 or neon. (#88287)
This was [addressed for AArch64
here](https://github.com/llvm/llvm-project/pull/79004), but the same
applies to ARM.

Move the enablement of neon+fp64 to `-mcpu=cortex-r52`, which optionally
supports these features.
2024-05-07 11:48:30 +01:00
Paul Walker
235cea720c [NFC][LLVM] Refactor rounding mode detection of constrained fp intrinsic IDs (#90854)
I've refactored the code to genericise the implementation to better
allow for target specific constrained fp intrinsics.
2024-05-07 11:23:55 +01:00
Kristof Beyls
e232659028 [NFC][BOLT] Call EnsureAllocatorExists instead of copy pasting code 2024-05-07 12:10:31 +02:00
Simon Pilgrim
abd314938d [X86] Use GFNI for vXi8 shifts/rotates (#89115)
As detailed here: https://github.com/InstLatx64/InstLatX64_Demo/blob/master/GFNI_Demo.h

We can use the gf2p8affine instruction to lower byte shifts/rotates as well as the existing bitreverse case.

Based off the original patch here: https://reviews.llvm.org/D137026
2024-05-07 10:28:55 +01:00
Quentin Colombet
6ce04747cf [SDISel] Teach the type legalizer about ADDRSPACECAST (#90969)
Vectorized ADDRSPACECASTs were not supported by the type legalizer.

This patch adds the support for:
- splitting the vector result: <2 x ptr> => 2 x <1 x ptr>
- scalarization: <1 x ptr> => ptr
- widening: <3 x ptr> => <4 x ptr>

This is all exercised by the added NVPTX tests.
2024-05-07 11:08:33 +02:00
Simon Pilgrim
d838e5b3e8 [X86] Add FastImm16 tuning flag to Intel Atom + AMD Bobcat/Ryzen Families (#90635)
This patch limits the icmp_i16(x,c) -> icmp_i32(ext(x),ext(c)) fold to CPUs that aren't known to have fast handling for length-changing prefixes for imm16 operands.

We are always assuming that 66/67h length-changing prefixes cause severe stalls and we should always extend imm16 operands and use a i32 icmp instead, the only exception being Intel Bonnell CPUs.

Agner makes this clear (see microarchitecture.pdf) that there are no stalls for any of the Intel Atom family (at least as far as Tremont - not sure about Gracemont or later). This is also true for AMD Bobcat/Jaguar and Ryzen families.

Recent performance Intel CPUs are trickier - Core2/Nehalem and earlier could have a 6-11cy stall, while SandyBridge onwards this is reduced to 3cy or less. I'm not sure if we should accept this as fast or not, we only use this flag for the icmp_i16 case, so that might be acceptable? If so, we should add this to x86-64-v3/v4 tuning as well.

Part of #90355 + #62952
2024-05-07 10:00:00 +01:00
Anthony Ha
6aed0ab654 [lldb] Have lldb-server assign ports to children in platform mode (#88845)
Fixes #47549

`lldb-server`'s platform mode seems to have an issue with its
`--min-gdbserver-port` `--max-gdbserver-port` flags (and probably the
`--gdbserver-port` flag, but I didn't test it).

How the platform code seems to work is that it listens on a port, and
whenever there's an incoming connection, it forks the process to handle
the connection. To handle the port flags, the main process uses an
instance of the helper class
`GDBRemoteCommunicationServerPlatform::PortMap`, that can be configured
and track usages of ports. The child process handling the platform
connection, can then use the port map to allocate a port for the
gdb-server connection it will make (this is another process it spawns).

However, in the current code, this works only once. After the first
connection is handled by forking a child process, the main platform
listener code loops around, and then 'forgets' about the port map. This
is because this code:
```cpp
GDBRemoteCommunicationServerPlatform platform(
    acceptor_up->GetSocketProtocol(), acceptor_up->GetSocketScheme());
if (!gdbserver_portmap.empty()) {
  platform.SetPortMap(std::move(gdbserver_portmap));
}
```
is within the connection listening loop. This results in the
`gdbserver_portmap` being moved into the platform object at the
beginning of the first iteration of the loop, but on the second
iteration, after the first fork, the next instance of the platform
object will not have its platform port mapped.
The result of this bug is that subsequent connections to the platform,
when spawning the gdb-remote connection, will be supplied a random port
- which isn't bounded by the `--min-gdbserver-port` and
`--max-gdbserver--port` parameters passed in by the user.

This PR fixes this issue by having the port map be maintained by the
parent platform listener process. On connection, the listener allocates
a single available port from the port map, associates the child process
pid with the port, and lets the connection handling child use that
single port number.

Additionally, when cleaning up child processes, the main listener
process tracks the child that exited to deallocate the previously
associated port, so it can be reused for a new connection.
2024-05-07 09:45:07 +01:00
Ben Shi
50da7680d8 [AVR][NFC] Improve format of target description files (#91296) 2024-05-07 16:42:46 +08:00
ostannard
1fd196c8df [AArch64] Diagnose more functions when FP not enabled (#90832)
When using a hard-float ABI for a target without FP registers, it's not
possible to correctly generate code for functions with arguments which
must be passed in floating-point registers. This is diagnosed in CodeGen
instead of Sema, to more closely match GCC's behaviour around inline
functions, which is relied on by the Linux kernel.

Previously, this only checked function signatures as they were
code-generated, but this missed some cases:
* Calls to functions not defined in this translation unit.
* Calls through function pointers.
* Calls to variadic functions, where the variadic arguments have a
floating-point type.

This adds checks to function calls, as well as definitions, so that
these cases are correctly diagnosed.
2024-05-07 09:17:05 +01:00
Orlando Cazalet-Hyams
1530f31931 [RemoveDIs] Update some unittests to the new format (#90476)
This patch updates the unittests that can be changed to the new format
after #89799 (which changes the default format everywhere) to avoid a
loss in coverage for the (new) default debug info format.
2024-05-07 09:15:16 +01:00
Peter Waller
1de0535e84 [llvm-mca] Abort on parse error without -skip-unsupported-instructions (#90474)
[llvm-mca] Abort on parse error without -skip-unsupported-instructions

Prior to this patch, llvm-mca would continue executing after parse
errors. These errors can lead to some confusion since some analysis
results are printed on the standard output, and they're printed after
the errors, which could otherwise be easy to miss.

However it is still useful to be able to continue analysis after errors;
so extend the recently added -skip-unsupported-instructions to support
this.

Two tests which have parse errors for some of the 'RUN' branches are
updated to use -skip-unsupported-instructions so they can remain as-is.

Add a description of -skip-unsupported-instructions to the llvm-mca
command guide, and add it to the llvm-mca --help output:

```
  --skip-unsupported-instructions=<value> - Force analysis to continue in the presence of unsupported instructions
    =none                                 -   Exit with an error when an instruction is unsupported for any reason (default)
    =lack-sched                           -   Skip instructions on input which lack scheduling information
    =parse-failure                        -   Skip lines on the input which fail to parse for any reason
    =any                                  -   Skip instructions or lines on input which are unsupported for any reason
```

Tests within this patch are intended to cover each of the cases.

Reason        | Flag | Comment
--------------|------|-------
none          | none | Usual case, existing test suite
lack-sched    | none | Advises user to use -skip-unsupported-instructions=lack-sched, tested in llvm/test/tools/llvm-mca/X86/BtVer2/unsupported-instruction.s
parse-failure | none | Advises user to use -skip-unsupported-instructions=parse-failure, tested in llvm/test/tools/llvm-mca/bad-input.s
any           | none | (N/A, covered above)
lack-sched    | any  | Continues, prints warnings, tested in llvm/test/tools/llvm-mca/X86/BtVer2/unsupported-instruction.s
parse-failure | any  | Continues, prints errors, tested in llvm/test/tools/llvm-mca/bad-input.s
lack-sched    | parse-failure | Advises user to use -skip-unsupported-instructions=lack-sched, tested in llvm/test/tools/llvm-mca/X86/BtVer2/unsupported-instruction.s
parse-failure | lack-sched    | Advises user to use -skip-unsupported-instructions=parse-failure, tested in llvm/test/tools/llvm-mca/bad-input.s
none          | * | This would be any test case with skip-unsupported-instructions, coverage added in llvm/test/tools/llvm-mca/X86/BtVer2/simple-test.s
any           | * | (Logically covered by the other cases)
2024-05-07 09:13:44 +01:00
martinboehme
f3fbd21fa4 [clang][dataflow] Strengthen pointer comparison. (#75170)
-  Instead of comparing the identity of the `PointerValue`s, compare the
   underlying `StorageLocation`s.

- If the `StorageLocation`s are the same, return a definite "true" as
the
result of the comparison. Before, if the `PointerValue`s were different,
we
would return an atom, even if the storage locations themselves were the
same.

- If the `StorageLocation`s are different, return an atom (as before).
Pointers
that have different storage locations may still alias, so we can't
return a
   definite "false" in this case.

The application-level gains from this are relatively modest. For the
Crubit
nullability check running on an internal codebase, this change reduces
the
number of functions on which the SAT solver times out from 223 to 221;
the
number of "pointer expression not modeled" errors reduces from 3815 to
3778.

Still, it seems that the gain in precision is generally worthwhile.

@Xazax-hun inspired me to think about this with his

[comments](https://github.com/llvm/llvm-project/pull/73860#pullrequestreview-1761484615)
on a different PR.
2024-05-07 10:12:23 +02:00
Luke Lau
d9f2b93918 [RISCV] Change more undef passthrus to $noreg in vector tests. NFC 2024-05-07 16:02:18 +08:00
hev
ad59967336 [LoongArch] Optimize codegen for ISD::{ROTL,ROTR} (#91174) 2024-05-07 15:46:11 +08:00
Luke Lau
ebde770c3e [RISCV] Use IMPLICIT_DEF for undef GPR reg in vsetvli test. NFC
Only VRs should use $noreg, this GPR was accidentally changed in d392520c6
2024-05-07 15:42:16 +08:00
jinchen
a62a702416 [mlir][math] Add expand patterns for acosh, asinh, atanh (#90718) 2024-05-07 13:10:37 +05:30
Kiran Chandramohan
6ad37a41b5 [Flang][OpenMP] NFC: Trivial changes in OmpCycleChecker (#91024)
Cycle is associated with construct-names and not labels. Change name of
a few variables to reflect this. Also add appropriate comment to
describe the else case of error checking.
2024-05-07 08:13:32 +01:00
Haojian Wu
fc866fd2a2 [clang] Don't preserve the typo expr in the recovery expr for invalid VarDecls (#90948)
With the commit d5308949cf, we now
preserve the initializer for invalid decls with the recovery-expr.

However there is a chance that the original init expr is a typo-expr, we
should not preserve it in the final AST, as typo-expr is an internal AST
node. We should use the one after the typo correction.

This is spotted by a clangd hover crash on the testcase.
2024-05-07 09:10:29 +02:00
Abhishek Varma
2b9210d1aa [MLIR][SCF] Add canonicalization pattern to fold away iter args of scf.forall (#90189)
-- This commit adds a canonicalization pattern to fold away iter args of
scf.forall if :-
   a. The corresponding tied result has no use.
   b. It is not being modified within the loop.

Signed-off-by: Abhishek Varma <avarma094@gmail.com>
2024-05-07 12:38:14 +05:30
Timm Bäder
5f2f390013 [clang][Interp][NFC] Allow Pointer assignment if both are zero
... even if the storage types are different.
2024-05-07 08:53:45 +02:00
Timm Bäder
05f4448d40 [clang][Interp][NFC] Add eval-order test
Demonstrate that this isn't yet working right.
2024-05-07 07:58:42 +02:00
Chuanqi Xu
ad9f38d0e3 [NFC] Fix Modules/no-transitive-source-location-change.cppm after dfa7ff97b2
The test fails after dfa7ff97b2. I didn't find this locally due to
cache.
2024-05-07 13:25:42 +08:00
Thorsten Schütt
b42f553af5 [GlobalIsel] Combine extract vector element (#90339)
look through shuffle vectors
2024-05-07 07:12:58 +02:00
Mingming Liu
879245e2b5 [NFC]Extract the heuristic to find vtable for an indirect call into a helper function (#81024)
* This way the helper function could be re-used by
indirect-call-promotion pass to find out the vtable for an indirect call
and extract the value profiles if any.
* The parent patch is https://github.com/llvm/llvm-project/pull/80762
2024-05-06 21:39:13 -07:00
Shilei Tian
02ce8227ac [NFC][OpenMP][OMPX] Move declare variant up 2024-05-06 23:46:18 -04:00
Chuanqi Xu
dfa7ff97b2 [C++20] [Modules] [Reduced BMI] Combine the signature of used modules
into the current module

Following of https://github.com/llvm/llvm-project/pull/86912. After
https://github.com/llvm/llvm-project/pull/86912, with reduced BMI, the
BMI can keep unchange if the dependent modules only changes the
implementation (without introduing new decls). However, this is not
strictly correct.

For example:

```
// a.cppm
export module a;
export inline int a() { ... }

// b.cppm
export module b;
import a;
export inline int b() { return a(); }
```

Since both `a()` and `b()` are inline, we need to make sure the BMI of
`b.pcm` will change after the implementation of `a()` changes.

We can't get that naturally since we won't record the body of `a()`
during the writing process. We can't reuse ODRHash here since ODRHash
won't calculate the called function recursively. So ODRHash will be
problematic if `a()` calls other inline functions.

Probably we can solve this by a new hash mechanism. But the safety and
efficiency may a problem too. Here we just combine the hash value of the
used modules conservatively.
2024-05-07 11:41:08 +08:00
Eli Friedman
4cce9fbb4e [Arm64EC] Fix compilation of arm_acle.h (#91281) 2024-05-06 20:04:55 -07:00
Chuanqi Xu
f9d76197ff [ASTContext] Profile Dependently-sized array types that do not have a specified number
of elements

Close https://github.com/llvm/llvm-project/issues/91105

The root reason for the issue is that we always generate the
dependently-sized array types which don't specify a number of elements.

The original comment says:

> We do no canonicalization here at all, which is okay
> because they can't be used in most locations.

But now we find the locations.
2024-05-07 10:59:34 +08:00
Owen Pan
236b3e1aad [clang-format] Handle Java switch expressions (#91112)
Also adds AllowShortCaseExpressionOnASingleLine option and
AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements.

Fixes #55903.
2024-05-06 19:55:55 -07:00
SahilPatidar
aac83fcf3e [Reassociate] Adds test coverage for reassociation of scalar & vector boolean types (#89899)
First step for #64840.
2024-05-07 11:44:29 +09:00
Jianjian Guan
37fcb323f6 [RISCV] Add codegen support for Zvfbfmin (#87911)
This patch adds basic codegen support for Zvfbfmin extension.
2024-05-07 10:25:06 +08:00
Joseph Huber
3e54768d7a [Offload] Detect target triple from preprocessor instead of CMake (#91283)
Summary:
This patch removes the special-case handling for the target triple
inside of the CMake. I moved it into the implementation so it's easier
to see and modify.
2024-05-06 21:23:04 -05:00
S. Bharadwaj Yadavalli
178ff39500 Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (#91290)
Reverts llvm/llvm-project#90809

Need to investigate ASAN failures.
2024-05-06 22:21:37 -04:00