Commit Graph

535609 Commits

Author SHA1 Message Date
Oliver Hunt
ac40bc7d5f Revert "[clang] Remove FEM_Indeterminable" (#137654)
Reverts llvm/llvm-project#137247
2025-04-28 08:50:48 -07:00
Timm Baeder
f8724bd873 [clang][bytecode] Check live-ness when calling dtors (#137645)
We can't call a destructor on a dead pointer.
2025-04-28 17:47:30 +02:00
Jonas Devlieghere
41ab76bf0a Revert "[debugserver] Migrate DNBTimer away from PThreadMutex (NFC) (#137540)"
This reverts commit ae71055e66.
2025-04-28 08:44:30 -07:00
Timm Baeder
c52fdbe697 [clang][bytecode] Fix ia32_addcarry/subborrow (#137642)
RHS is followed by another Pointer.
2025-04-28 17:44:19 +02:00
Jan Górski
d7e631c7cd [RISCV] Remove AND mask generated by ( zext ( atomic_load ) ) by replacing the load with zextload for orderings not stronger then monotonic. (#136502)
Extends changes from
[ff687af](ff687af04f).
Fixes https://github.com/llvm/llvm-project/issues/131476.

This patch adds a DAG combine to replace an `AND` of an `ATOMIC_LOAD`
with a full-bit mask (e.g. `0xFF`, `0xFFFF`, etc.) which is generated as
a result of `(zext (atomic_load))`, by a zero-extended load, provided
the atomic operation is monotonic or weaker.
2025-04-28 08:35:51 -07:00
Shafik Yaghmour
a6f4a54891 [Clang][NFC] Const correctness fix for range based for loop (#137431)
Static analysis flagged that we did not make const a item declaration
b/c we did not modify it all during the loop.
2025-04-28 08:27:19 -07:00
Matthias Springer
5953f191b9 [mlir][sparse_tensor] Fix memory leak in sparse_index_dense.mlir (#137454) 2025-04-28 17:24:27 +02:00
Kiran Chandramohan
1b5cd1dfb3 [Flang][OpenMP] Permit loop construct in simd regions (#137020)
Simdizable constructs are permitted in a simd region. The loop construct
is a simdizable construct.

Also fixes the TODO corresponding to this.
2025-04-28 16:19:59 +01:00
Matthias Springer
d1a84b9969 [mlir][linalg] Fix memory leak in pack-dynamic-inner-tile.mlir (#137589)
This fixes the test when running with ASAN.
2025-04-28 17:17:41 +02:00
Oliver Hunt
6b973f2baf [clang] Remove FEM_Indeterminable (#137247)
Remove FEM_Indeterminable as it is unused and cannot be stored safely in
an unsigned bitfield
2025-04-28 08:17:12 -07:00
Brox Chen
343c784f18 [AMDGPU][True16][MC] add fake16 error and promote test (#135984)
This is a NFC patch.

Added error and promote test for fake16 flow. This includes two part:
1. "*vop1_t16_err-fake16.s" is renamed to "*vop1_fake16_err.s"
2. added missing "fake16-promote.s" and other "*fake16_err.s" files

These tests are about promoting the instruction encoding to 64 bits if
the used registers are not encodable in the 32-bit form.
2025-04-28 11:16:32 -04:00
Sam Elliott
3f46af98ca [RISCV] Support Push/Pop with Xqci (#134191)
The `qc.c.mienter` and `qc.c.mienter.nest` instructions, broadly only
save the argument and temporary registers. The exceptions are that they
also save `fp` (`s0`) to construct a frame chain from the signal handler
to the frame below, and they also save `ra`. They are designed this way
so that (if needed) push and pop instructions can be used to save the
callee-saved registers.

This patch implements this optimisation, constructing the following
rather than a long sequence of `sw` and `lw` instructions for saving the
callee-saved registers:

```asm
  qc.c.mienter
  qc.cm.push {ra, s0-sN}, -M
  ...
  qc.cm.pop {ra, s0-sN}, M
  qc.c.mileaveret
```

There are some carefully-worked-out details here, especially around CFI
information. For any register saved by both `qc.c.mienter(.nest)` and
the push (which is `ra` and `s0` at most), we point the CFI information
at the version saved by `qc.c.mienter(.nest)`. This ensures the CFI
points at the same `fp` copy as a frame pointer unwinder would find.
2025-04-28 08:12:45 -07:00
erichkeane
258e1438c2 [OpenACC][CIR][NFC] Refactor to move 'loop' emit into its own file
The 'loop' emit for OpenACC is particularly complicated/involved, so it
makes sense to be in its own file. This patch splits it out into its own
file, as well as the clause emitter code (as loop is going to require
    that).
2025-04-28 07:59:12 -07:00
Jan Svoboda
985410f87f [clang] Hide the TargetOptions pointer from CompilerInvocation (#106271)
This PR hides the reference-counted pointer that holds `TargetOptions`
from the public API of `CompilerInvocation`. This gives
`CompilerInvocation` an exclusive control over the lifetime of this
member, which will eventually be leveraged to implement a copy-on-write
behavior.

There are two clients that currently share ownership of that pointer:

* `TargetInfo` - This was refactored to hold a non-owning reference to
`TargetOptions`. The options object is typically owned by the
`CompilerInvocation` or by the new `CompilerInstance::AuxTargetOpts` for
the auxiliary target. This needed a bit of care in `ASTUnit::Parse()` to
keep the `CompilerInvocation` alive.
* `clangd::PreambleData` - This was refactored to exclusively own the
`TargetOptions` that get moved out of the `CompilerInvocation`.
2025-04-28 07:43:26 -07:00
Jonathan Thackray
ba420d8122 [llvm] Add support for llvm IR atomicrmw fminimum/fmaximum instructions (#136759)
This patch adds support for LLVM IR atomicrmw `fmaximum` and `fminimum`
instructions.

These mirror the `llvm.maximum.*` and `llvm.minimum.*` instructions, but
are atomic and use IEEE754 2019 handling for NaNs, which is different to
`fmax` and `fmin`. See:
     https://llvm.org/docs/LangRef.html#llvm-minimum-intrinsic
for more details.

Future changes will allow this LLVM IR to be lowered to specialised
assembler instructions on suitable targets, such as AArch64.
2025-04-28 15:31:44 +01:00
jyli0116
064f9d03f2 [AArch64] Add FEAT_FPAC to supported CPUs (#137330)
Added FEAT_FPAC onto supported AArch64 CPUs which don't have it under
the processor description.
2025-04-28 14:49:06 +01:00
Shilei Tian
3570908519 [NFC][AMDGPU] Auto generate check lines for some codegen tests (#137534)
Make preparation for #137488.
2025-04-28 09:25:05 -04:00
Krzysztof Parzyszek
642453c6ba [flang][OpenMP] Mark atomic clauses as unique (#137460)
The current implementation of the ATOMIC construct handles these clauses
individually, and this change does not have an observable effect. At the
same time these clauses are unique as per the OpenMP spec, and this
patch reflects that in the OMP.td file.
2025-04-28 08:12:19 -05:00
Erich Keane
abfb2ce2f5 [OpenACC][NFCI] Implement 'helpers' for all of the clauses I've used so far (#137396)
As a follow up to 3c4dff3ac6 I audited all
uses of 'process clause and use additive methods', and added explicit
functions to the construct to make it easier for the next project to
attempt to use this mechanism (vs construct all operands/etc in advance,
then add all at once).

I've only done ones that I have attempted to use so far(as a catch-up,
so no var-list clauses, and no constructs that can't be used without a
var-list, and no loop, and no compound constructs). I intend to do those
"as I go" with the lowering of each of those things instead.

---------

Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
2025-04-28 06:06:42 -07:00
Jonas Paulsson
98b895da30 [SystemZ] Fix compile time regression in adjustInliningThreshold(). (#137527)
Instead of always iterating over all GlobalVariable:s in the Module to
find the case where both Caller and Callee is using the same GV heavily,
first scan Callee (only if less than 200 instructions) for all GVs used
more than 10 times, and then do the counting for the Caller for just
those relevant GVs.

The limit of 200 instructions makes sense as this aims to inline a
relatively small function using a GV +10 times. 

This resolves the compile time problem with zig where it is on main
(compared to removing the heuristic) a 380% increase, but with this
change <0.5% increase (total user compile time with opt).

Fixes #134714.
2025-04-28 15:04:07 +02:00
David Stuttard
1a32613dac [AMDGPU] Update pal metadata for v3.6 and fix v3.0 (#135196)
Update entry_point for all pal versions below 3.6.
3.6 and above removes entry_point.
2025-04-28 13:31:14 +01:00
Matthias Springer
b8b35b924f [mlir][linalg] Fix memory leak in runtime-verification.mlir (#137591)
This fixes the test when running with ASAN.
2025-04-28 14:21:01 +02:00
Timm Baeder
959905a5ad [clang][bytecode] Don't create Function instances for builtins (#137618)
Now that we don't use them anymore in InterpBuiltin.cpp and we don't
create frames for them anymore anyway, just don't create Function
instances.
2025-04-28 14:08:42 +02:00
Timm Baeder
e086d7b146 [clang][bytecode] Don't create function frames for builtin calls (#137607)
They don't have local variables etc. so don't create frames for them.
2025-04-28 13:11:15 +02:00
Alexey Bataev
73d90ec825 [SLP][NFC]Consider non-profitable trees with only phis, gathers, splits and small nodes with reuses
Improves compile time for non-profitable cases.
Fixes #135965
2025-04-28 03:56:08 -07:00
Vlad Serebrennikov
12a4ec6b1a [clang][NFC] Convert Sema::FormatStringType to scoped enum 2025-04-28 13:54:26 +03:00
Paul Walker
be82be281d [LLVM][GlobalISel] Ensure G_{F}CONSTANT only store references to scalar Constant{Int,FP}. (#137319) 2025-04-28 11:40:39 +01:00
John Brawn
dd87127f4e [DAGCombiner] Eliminate fp casts if we have the right fast math flags (#131345)
When floating-point operations are legalized to operations of a higher
precision (e.g. f16 fadd being legalized to f32 fadd) then we get
narrowing then widening operations between each operation. With the
appropriate fast math flags (nnan ninf contract) we can eliminate these
casts.
2025-04-28 11:21:51 +01:00
Florian Hahn
ec1016f7ef [IVDescriptors] Support reductions with minimumnum/maximumnum. (#137335)
Add a new reduction recurrence kind for reductions with
minimumnum/maximumnum. Such reductions can be vectorized without
nsz/nnans, same as reductions with maximum/minimum intrinsics.

Note that a new reduction kind is needed to make sure partial reductions
are also combined with minimumnum/maximumnum.

Note that the final reduction to a scalar value is performed with
vector.reduce.fmin/fmax. This should be fine, as the results of the
partial reductions with maximumnum/minimumnum silences any sNaNs.

In-loop and reductions in SLP are not supported yet, as there's no
reduction version of maximumnum/minimumnum yet and fmax may be
incorrect.

PR: https://github.com/llvm/llvm-project/pull/137335
2025-04-28 11:16:36 +01:00
Alexander Kornienko
cf17ee1d3a [CodeGen] Fix handling of nullptr in initializers (#137364)
Fixes https://github.com/llvm/llvm-project/issues/137276.
2025-04-28 12:14:05 +02:00
Lakshay Kumar
475531b884 [llvm-exegesis][AArch64] Disable pauth and ldgm as unsupported instructions fixed (#136868)
[llvm-exegesis][AArch64] Recommit: Disable pauth and ldgm as unsupported instructions.

Skipping AUT and LDGM opcode variants which currently throws "illegal
instruction".

Last pull request
[#132346](https://github.com/llvm/llvm-project/pull/132346) got reviewed
and merged but builder bot got failed. This was due to undefined
`PR_PAC_SET_ENABLED_KEYS` utilized were not defined in x86 arch,
resulting in build failure.

This is followup to merge the changes with following changes to fixup
the build failure.

Changes: 
- Fixed up the problem with arch specific check for `prctl` library
import
- Defining `PR_PAC_SET_ENABLED_KEYS` if undefined.
2025-04-28 11:00:14 +01:00
Vlad Serebrennikov
0b6d71fe10 [clang][NFC] Convert Sema::TUFragmentKind to scoped enum 2025-04-28 12:50:26 +03:00
Tom Eccles
5147b83ee6 [flang][Lower][nfc] vector subscript lhs first element to helper (#137456)
This encapsulates implementation details of hlfir.elemental_addr inside
of ConvertExprToHLFIR instead of leaking to OpenMP code.

Requested here:
https://github.com/llvm/llvm-project/pull/133892#issuecomment-2821559394
2025-04-28 10:47:21 +01:00
Michael Buch
cebf86eb1d [lldb][Format] Make function name frame-format variables work without debug-info (#137408)
This patch makes the frame-format variables introduced in
https://github.com/llvm/llvm-project/pull/131836 also work when no
debug-info is available. Previously, we assumed `sc.function` was
available, but without debug-info we might only have `sc.symbol`. We
don't really need the `sc.function` apart from when formatting
arguments.

For the function arguments case I added a fallback that will just print
the arguments we get from the demangler (which is what LLDB does for
stacktraces with no debug-info anyway). Ideally we'd have a separate
`FormatEntity::Entry::Type::FunctionArguments` that will just print the
arguments from the demangler and have something like the following in
the `plugin.cplusplus.display.function-name-format`:
```
{ ${function.formatted-arguments} || ${function.arguments} }
```
I.e., when we can't format the arguments, print the ones from the
demangler. But we currently don't have the `||` operator in the
frame-format language yet.
2025-04-28 10:46:00 +01:00
Timm Baeder
32059ce121 [clang][bytecode][NFC] Stop using Function in InterpBuiltin (#137597)
Prepare for the ultimate removal of Function instances for builtin
functions.
2025-04-28 11:41:49 +02:00
Tom Eccles
2085119887 [mlir][OpenMP] Convert omp.cancel parallel to LLVMIR (#137192)
Support for other constructs will follow in subsequent PRs.
2025-04-28 10:33:55 +01:00
Antonio Frighetto
6ae4030d4c Revert "[Analysis] Ensure use of strict fp exceptions in ConstantFolding (#136139)"
This reverts commit 8506980d30, multiple buildbot failures reported.
2025-04-28 11:26:12 +02:00
Yingwei Zheng
a0c4876eed [InstCombine] Fix ninf propagation for fcmp+sel -> minmax (#136433)
Proof: https://alive2.llvm.org/ce/z/nCrvfr
Closes https://github.com/llvm/llvm-project/issues/136430
2025-04-28 17:24:46 +08:00
Jim Lin
6ba1a62a6c [RISCV] Add Andes XAndesperf (Andes Performance) extension. (#135110)
The spec can be found at:
https://github.com/andestech/andes-v5-isa/releases/tag/ast-v5_4_0-release.

This patch only supports assembler.

Relocation and fixup for the branch and gp-implied instructions will be
added in a later patch.
2025-04-28 17:23:51 +08:00
David Spickett
5afe9c72e4 [lldb][lldb-dap] Disable launch tests that rely on get_stdout()
This appears not to work on Windows.

See https://github.com/llvm/llvm-project/issues/137599.
2025-04-28 09:10:12 +00:00
Lucas Duarte Prates
8506980d30 [Analysis] Ensure use of strict fp exceptions in ConstantFolding (#136139)
To perform constant folding in math operations, the implementation of
the ConstantFolding Analysis relies on the use of the math functions
from the host's libm. In particular, it relies on checking the value of
errno and IEEE exceptions to determine when an operation is safe to be
constant-folded.

On some platforms, such as BSD or Darwin, math library functions don't
set errno, so the ConstantFolding check depends only on the value of
IEEE exceptions. As the FP exception behaviour is set to `ignore` by
default, the compiler can perform optimisations that would get in the
way of such checks being performed correctly.

This patch sets the FP exception behaviour to `strict` when compiling
the `ConstantFolding.cpp` source file, ensuring the value of IEEE
exceptions can be reliably used by its implementation.
2025-04-28 10:01:54 +01:00
Yingwei Zheng
1f69d6354a [InstCombine] Preserve the sign bit of NaN in SimplifyDemandedUseFPClass (#137287)
Alive2: https://alive2.llvm.org/ce/z/uiUzEf

Closes https://github.com/llvm/llvm-project/issues/137196.

Note: To avoid regression in
`ret_nofpclass_nopositives_copysign_nnan_flag`, the second commit takes
FMF into account.
2025-04-28 17:01:43 +08:00
Virginia Cangelosi
be7cf63b4a [AArch64] Add FPCR register usages to mop4 instructions (#135641)
Ensure all floating mop4 instructions implicitly use FPCR
2025-04-28 10:00:07 +01:00
Florian Hahn
92bfbbc4e5 [VPlan] Invert condition if needed when creating inner regions. (#132292)
As pointed out by @iamlouk in
https://github.com/llvm/llvm-project/pull/129402, the current code
doesn't handle latches with different successor orders correctly.
Introduce a `NOT`, if needed.

Depends on  https://github.com/llvm/llvm-project/pull/129402

PR: https://github.com/llvm/llvm-project/pull/132292
2025-04-28 09:40:43 +01:00
Michael Buch
ec6b619430 [lldb][DNB] Add missing include
On the buildbots:
```
user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/tools/debugserver/source/DNBLog.cpp
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/tools/debugserver/source/DNBLog.cpp:66:15: error: no type named 'recursive_mutex' in namespace 'std'
  static std::recursive_mutex g_LogThreadedMutex;
         ~~~~~^
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/tools/debugserver/source/DNBLog.cpp:67:8: error: no member named 'lock_guard' in namespace 'std'
  std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
  ~~~~~^
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/tools/debugserver/source/DNBLog.cpp:67:24: error: no member named 'recursive_mutex' in namespace 'std'
  std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
                  ~~~~~^
```
2025-04-28 09:39:45 +01:00
Karthika Devi C
5f704f929d [RemoveDI][Polly] Migrate to adapt to the new DebugRecord format in more areas (#135935)
Some of the changes in the patch include:

1. Using iterators instead of instruction pointers when applicable.
2. Modifying Polly functions to accept iterators instead of inst
pointers.
3. Updating API usages such as use begin instead of front.
2025-04-28 13:51:10 +05:30
Piotr Fusik
2319a1eb81 [RISCV] Select (add x, C) -> (sub x, -C) if -C cheaper to materialize (#137309)
RV64 only. For 32-bit constants, a negated constant is never cheaper.

This change is similar to how #120221 selects inverted bitwise instructions.
2025-04-28 10:14:12 +02:00
Peng Sun
af329725d4 [mlir][tosa] Enhance verify checks for PAD Op (#137177)
* add padding shape verification
 * add and update LIT test

Signed-off-by: Peng Sun <peng.sun@arm.com>
2025-04-28 08:38:47 +01:00
lorenzo chelini
b55fa20d83 [MLIR][NFC] Retire let constructor for Async (#137461)
let constructor is legacy (do not use in tree!) since the tableGen
backend emits most of the glue logic to build a pass.

Note: The following constructor has been retired:

```cpp
std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,
                                                 int32_t numWorkerThreads,
                                                 int32_t minTaskSize);
```

To update your codebase, replace it with the new options-based API:

```cpp
AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/};
createAsyncParallelForPass(options);
```
2025-04-28 09:31:31 +02:00
Michael Buch
e665d95426 [lldb] Highlight basenames in backtraces (#137301)
Also changes the PC value color so it doesn't visually clash with the
function names

Before:
<img width="1510" alt="Screenshot 2025-04-25 at 10 38 58 AM"
src="https://github.com/user-attachments/assets/1ec35ba3-a3d9-4e5b-bac9-fc738bfe6d25"
/>

After:
![Screenshot 2025-04-25 at 4 34
27 PM](https://github.com/user-attachments/assets/3de6e778-ff97-4f47-b361-360e4bbfaede)
2025-04-28 08:29:31 +01:00