Commit Graph

534358 Commits

Author SHA1 Message Date
Arthur Eubanks
f7bdf30cb9 Add empty top level .clang-format-ignore (#136022)
Otherwise if the source tree is embedded in another project with a
.clang-format-ignore, some clang-format tests fail because they use that
.clang-format-ignore.
2025-04-16 15:48:30 -07:00
Craig Topper
b9f1de04f6 [TableGen] Combine the two separate OperandMapping loops in PseudoLoweringEmitter. (#136007)
Previously we had one loop over the DAG for immediates and registers and
another loop over the destination operands for mapping from the source.

Now we have a single loop over the destination operands that handles immediates,
registers, and named operands. A helper method is added so we can handle
operands and sub-operands specified by a sub-dag.

My goal is to allow a named operand to appear in a sub-dag which wasn't
supported before. This will allow the destination instruction to have an
operand with sub-operands when the source does not have sub operands.

For RISC-V, I'm looking into using an operand with sub-operands to
represent an reg+offset memory address. I need to be able to lower a
pseudo instruction that only has a register operand to an instruction
that has a reg+offset operand. The offset will be filled in with 0
during expansion and the register will be copied from the source.

The expansion would look like this:
def PseudoCALLIndirect : Pseudo<(outs), (ins GPRJALR:$rs1),
                                [(riscv_call GPRJALR:$rs1)]>,
PseudoInstExpansion<(JALR X1, (ops GPR:$rs1, 0))>;
2025-04-16 15:47:16 -07:00
Justin Bogner
d35bf17e8a [HLSL] Add a warning for implicit bindings (#135909)
Implicit bindings will cause very confusing crashes in the backend at
present, so this is intended at least partially as a stop gap until we
get them implemented (see #110722).

However, I do think that this is useful in the longer term as well as an
off-by-default warning, as it is quite easy to miss a binding or two
when using explicit bindings and the results of that can be surprisingly
hard to debug. I've filed #135907 to track turning this into an
off-by-default warning or removing it eventually as we see fit.
2025-04-16 15:45:18 -07:00
Rahul Joshi
8ebdd9d8a1 Reapply "[LLVM][TableGen] Parameterize NumToSkip in DecoderEmitter" (#136017) (#136019)
This reverts commit 7fd0c8acd4, and fixes
the assert condition in `patchNumToSkip`.
2025-04-16 15:40:34 -07:00
David Truby
e64305096a [flang] Complete alignment of -x language modes with gfortran (#133775) 2025-04-16 23:26:20 +01:00
Vitaly Buka
91df4cce44 [NFC][Asan] Disabled test dead-locking on Darwin
After #131756.
2025-04-16 15:19:54 -07:00
Vitaly Buka
9c98a9801d [NFC][Asan] CRLF to LF in a test 2025-04-16 15:18:46 -07:00
Maksim Levental
697aa9995c [mlir][SMT] add python bindings (#135674)
This PR adds "rich" python bindings to SMT dialect.
2025-04-16 18:17:09 -04:00
Vitaly Buka
7623501c05 [asan] Fix build on fuchsia (#136042)
Does not link after #131756
2025-04-16 15:04:06 -07:00
Vitaly Buka
6727d58891 [NFC][CFI] Remove unnecessary -rtlib=platform from tests (#136032)
Should allow to reland https://github.com/llvm/llvm-project/pull/135981
2025-04-16 14:59:18 -07:00
Muzammil
c409da2223 [mlir][ROCDL] Add permlanex16 op to allow subgroup reductions on gfx10+ (#135983)
Adding Permlanex16Op to ROCDL dialect to enable subgroup reduce lowering
to DPP ops for gfx 10+ devices.
See [this PR](https://github.com/llvm/llvm-project/pull/133204).

---------

Signed-off-by: Muzammiluddin Syed <muzasyed@amd.com>
2025-04-16 16:53:17 -05:00
Shubham Sandeep Rastogi
9dbe107219 disable test on older compilers (#136037) 2025-04-16 14:41:20 -07:00
Prabhu Rajasekaran
a9827fbc86 [llvm] Handle CPI symbols for UEFI (#135652)
UEFI targets besides MSVC environment must support constant pool
symbols.
2025-04-16 14:14:43 -07:00
Sergei Barannikov
2afef58e40 [ARM] Use helper class for emitting CFI instructions into MIR (#135994)
Similar to #135845.

PR: https://github.com/llvm/llvm-project/pull/135994
2025-04-17 00:03:34 +03:00
Tai Ly
42ad82bb05 [mlir][tosa] Add verifier check for Slice Op (#135853)
Add verifier check for Slice Op to make sure input1 and output have same
ranks.
Added test in verifier.mlir
Also moved existing slice verifier tests in invalid.mlir to verfier.mlir

Signed-off-by: Tai Ly <tai.ly@arm.com>
2025-04-16 13:58:42 -07:00
Florian Hahn
41c1a7be3f [LV] Don't add fixed-order recurrence phis to forced scalars.
Fixed-order recurrence phis cannot be forced to be scalar, they will
always be widened at the moment.

Make sure we don't add them to ForcedScalars, otherwise the legacy cost
model will compute incorrect costs.

This fixes an assertion reported with
https://github.com/llvm/llvm-project/pull/129645.
2025-04-16 22:58:10 +02:00
Vitaly Buka
6b0c8c4acd Revert "[NFC][CFI] Avoid clang error in CFI tests" (#136030)
Reverts llvm/llvm-project#135981

Fails with 'clang: error: --rtlib=libgcc requires --unwindlib=libgcc' on
some bots.
2025-04-16 13:56:38 -07:00
Vitaly Buka
cbbf6b4873 Revert "[NFC][CFI] Dump test output to debug llvm-clang-win-x-aarch64 failure" (#136029)
Reverts llvm/llvm-project#136002

Not needed any more.
2025-04-16 13:55:01 -07:00
James Newling
c7fae59ac5 [mlir][vector] Move extract_strided_slice canonicalization to folding (#135676)
Folders are preferred:
https://mlir.llvm.org/docs/Canonicalization/#when-to-use-the-fold-method-vs-rewriterpatterns-for-canonicalizations

Included here : some missing `-----` between lit test file with mlir-opt
with `-split-input-file` flag
2025-04-16 16:20:05 -04:00
Rahul Joshi
7fd0c8acd4 Revert "[LLVM][TableGen] Parameterize NumToSkip in DecoderEmitter" (#136017)
Reverts llvm/llvm-project#135882

Causing assert failures for AArch64 backend
2025-04-16 13:16:32 -07:00
calebwat
05aa98955c [NFCI] Explicitly delete unused copy constructor and assign copy for VPInterleavedAccessInfo (#134755)
VPInterleavedAccessInfo has a defined destructor freeing memory, but no
explicitly defined copy constructor or copy assignment op. These are not
used, so this patch marks them as deleted to avoid usage of the
implicitly defined implementations.
2025-04-16 22:12:25 +02:00
Lei Wang
80855eb6f1 [SampleFDO] Extend the function base name max size (#135863)
The function base name could be way long which overflows and leads to a
crash. Update to extend the max size.

Also changed to use heap allocation( `std::vector<char>` ) to avoid
stack overflow.
2025-04-16 13:11:55 -07:00
Rahul Joshi
598ec8ce2d [LLVM][TableGen] Parameterize NumToSkip in DecoderEmitter (#135882)
- Add command line option `num-to-skip-size` to parameterize the size of
`NumToSkip` bytes in the decoder table. Default value will be 2, and
targets that need larger size can use 3.
- Keep all existing targets, except AArch64, to use size 2, and change
AArch64 to use size 3 since it run into the "disassembler decoding table
too large" error with size 2.
- Following is a rough reduction in size for the decoder tables by
switching to size 2.

```
Target         Old Size   New Size   % Reduction
================================================
AArch64           153254     153254        0.00
AMDGPU            471566     412805       12.46
ARC                 5724       5061       11.58
ARM                84936      73831       13.07
AVR                 1497       1306       12.76
BPF                 2172       1927       11.28
CSKY               10064       8692       13.63
Hexagon            47967      41965       12.51
Lanai               1108        982       11.37
LoongArch          24446      21621       11.56
MSP430              4200       3716       11.52
Mips               36330      31415       13.53
PPC                31897      28098       11.91
RISCV              37979      32790       13.66
Sparc               8331       7252       12.95
SystemZ            36722      32248       12.18
VE                 48296      42873       11.23
XCore               2590       2316       10.58
Xtensa              3827       3316       13.35
```
2025-04-16 13:07:58 -07:00
Adam Siemieniuk
d338bdc9fe [mlir][linalg][NFC] Update elementwise docs to match op name (#135999)
Updates linalg.elementwise op description to replace older abbreviated
mnemonic with its current form.
2025-04-16 22:02:52 +02:00
Kazu Hirata
4863d1ffbd [Serialization] Use llvm::map_range (NFC) (#135990) 2025-04-16 12:29:58 -07:00
Kazu Hirata
fa46d522fe [llvm-xray] Use llvm::make_second_range (NFC) (#135989) 2025-04-16 12:29:33 -07:00
Kazu Hirata
0f97cd87de [Frontend] Use StringRef::ends_with (NFC) (#135988) 2025-04-16 12:29:04 -07:00
Kazu Hirata
c4e9901b5b [llvm] Use llvm::append_range (NFC) (#135931) 2025-04-16 12:28:47 -07:00
Matheus Izvekov
fe94f11407 [clang] Fix elaborated keyword canonicalization (#135916) 2025-04-16 16:27:24 -03:00
Mircea Trofin
4903a7b77b [ctxprof][nfc] Move profile annotator to Analysis (#135871)
This moves the utility that propagates counter values such that we can reuse it elsewhere. Specifically, in a subsequent patch, it'll be used to guide ICP: we need to prioritize promoting indirect calls that dominate larger portions of the dynamic instruction count. We can compare them based on the dynamic count of IR instructions, and we can get that early with this counter propagation logic.

The patch is mostly a move of the existing logic, with a pimpl - style implementation to hide all the current complexity.
2025-04-16 12:10:08 -07:00
Alexey Bataev
4aca20c8b6 [SLP]Pre-cache the last instruction for all entries before vectorization
Need to pre-cache last instruction to avoid unexpected changes in the
last instruction detection during the vectorization, caused by adding
the new vector instructions, which add new uses and may affect the
analysis.
2025-04-16 11:44:55 -07:00
Vitaly Buka
e77ef7b291 [NFC][CFI] Dump test output to debug llvm-clang-win-x-aarch64 failure (#136002) 2025-04-16 11:29:34 -07:00
Kazu Hirata
8a00efd26d [SystemZ] Fix warnings
This patch fixes:

  llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:6916:7: error:
  unused variable 'RegVT' [-Werror,-Wunused-variable]

  llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp:1265:30: error: unused
  variable 'RC' [-Werror,-Wunused-variable]
2025-04-16 11:25:55 -07:00
Jonas Paulsson
e19fcb72d7 Fix 'unannotated fall-through between switch labels' warning. (#136000) 2025-04-16 20:25:10 +02:00
Justin Bogner
ad12323fbf [HLSL] Don't invoke dxv from clang-dxc for text output (#135876)
Running `clang-dxc` with textual output was emitting various spurious
warnings (if `dxv` wasn't on your path) or errors (if it was). Avoid
these by not attempting to run this tool when it doesn't make sense to
do so.

Fixes #135874.
2025-04-16 11:15:54 -07:00
Jonas Paulsson
6d03f51f0c [SystemZ] Add support for 16-bit floating point. (#109164)
- _Float16 is now accepted by Clang.

- The half IR type is fully handled by the backend.

- These values are passed in FP registers and converted to/from float around
  each operation.

- Compiler-rt conversion functions are now built for s390x including the missing
  extendhfdf2 which was added.

Fixes #50374
2025-04-16 20:02:56 +02:00
cor3ntin
6ccc9280ba Revert "[Clang][RFC] Bypass TAD during overload resolution if a perfect match exists" (#135993)
Reverts llvm/llvm-project#133426

This is failing on some bots
https://lab.llvm.org/buildbot/#/builders/163/builds/17265
2025-04-16 19:40:28 +02:00
Mircea Trofin
1576fa1010 [ctxprof] Extend the notion of "cannot return" (#135651)
At the time of instrumentation (and instrumentation lowering), `noreturn` is not applied uniformously. Rather than running `FunctionAttrs` pass, we just need to use `llvm::canReturn` exposed in PR #135650
2025-04-16 10:39:34 -07:00
Andy Kaylor
80c19b3b1d [CIR] Upstream initial support for complete record types (#135844)
This adds basic support for populating record types. In order to keep
the change small, everything non-essential was deferred to a later
change set. Only non-recursive structures are handled. Structures
padding is not yet implemented. Bitfields are not supported. No attempt
is made to handle ABI requirements for passing structure arguments.
2025-04-16 10:33:09 -07:00
AdityaK
ce7466f66c NFC: Rewrite auto castIter -> const auto *castIter (#133521) 2025-04-16 10:30:53 -07:00
Alexey Bataev
913dcf1aa3 [SLP]Fix type promotion for smax reduction with unsigned reduced operands
Need to add an extra bit for sign info for unsigned reduced values to
generate correct code.
2025-04-16 10:14:29 -07:00
Volodymyr Sapsai
81739c39db [Modules] Fix an identifier hiding a function-like macro definition. (#135471)
We emit a macro definition only in a module defining it. But it means
that if another module has an identifier with the same name as the
macro, the users of such module won't be able to use the macro anymore.

Fix by storing that an identifier has a macro definition that's not in a
current module (`MacroDirectivesOffset == 0`). This way
`IdentifierLookupVisitor` knows not to stop at the first module with an
identifier but to keep checking included modules for the actual macro
definition.

Fixes issue #32040.

rdar://30258278
2025-04-16 10:14:05 -07:00
Chris B
52e0337ea3 [HLSL][OpenCL] Strip addrspace from implicit cast diags (#135830)
The address space of a source value for an implicit cast isn't really
relevant when emitting conversion warnings. Since the lvalue->rvalue
cast effectively removes the address space they don't factor in, but
they do create visual noise in the diagnostics.

This is a small quality-of-life fixup to get in as HLSL adopts more
address space annotations.
2025-04-16 12:13:19 -05:00
James Newling
eea86489dd [mlir][vector] Fold broadcast(poison) -> poison (#135677)
In addition to the new folder, I've also a test for broadcast(splat) ->
splat which I think was missing

Signed-off-by: James Newling <james.newling@gmail.com>
2025-04-16 13:12:38 -04:00
James Newling
73b8750a97 [mlir][vector] fold transpose(poison) -> poison (#135675)
Following on from https://github.com/llvm/llvm-project/pull/133988

---------

Signed-off-by: James Newling <james.newling@gmail.com>
2025-04-16 13:10:23 -04:00
cor3ntin
facc57fc25 [Clang][RFC] Bypass TAD during overload resolution if a perfect match exists (#133426)
This implements the same overload resolution behavior as GCC, 
as described in https://wg21.link/p3606 (sections 1-2, not 3)

If, during overload resolution, a non-template candidate is always
picked because each argument is a perfect match (i.e., the source and
target types are the same), we do not perform deduction for any template
candidate that might exist.

The goal is to be able to merge #122423 without being too disruptive.

This change means that the selection of the best viable candidate and
template argument deduction become interleaved.

To avoid rewriting half of Clang, we store in `OverloadCandidateSet`
enough information to deduce template candidates from
`OverloadCandidateSet::BestViableFunction`. This means the lifetime of
any object used by the template argument must outlive a call to
`Add*Template*Candidate`.

This two-phase resolution is not performed for some initialization as
there are cases where template candidates are a better match per the
standard. It's also bypassed for code completion.

The change has a nice impact on compile times

https://llvm-compile-time-tracker.com/compare.php?from=edc22c64e527171041876f26a491bb1d03d905d5&to=8170b860bd4b70917005796c05a9be013a95abb2&stat=instructions%3Au

Fixes #62096
Fixes #74581
Fixes #53454
2025-04-16 19:09:45 +02:00
James Newling
d88a3a36ad [mlir][vector] Remove redundant shape_cast(shape_cast(x)) pattern (#135447)
This PR removes one OpRewritePattern `shape_cast(shape_cast(x)) -> x`
that is already handled by `ShapeCastOp::fold`.

Note that this might affect downstream users who indirectly call
`populateShapeCastFoldingPatterns(RewritePatternSet &patterns,
PatternBenefit)` and then use `patterns` with a `GreedyRewriteConfig
config` that has `config.fold = false`. (only user I've checked is IREE,
that never uses config.fold = false).
2025-04-16 13:08:57 -04:00
James Newling
0daf20b360 [mlir][vector] transpose(broadcast) -> broadcast canonicalization (#135096)
Example seen in the 'real world':
 
 ```
 %0 = vector.broadcast %arg0 : vector<1xi8> to vector<1x8xi8>
 %1 = vector.transpose %0, [1, 0] : vector<1x8xi8> to vector<8x1xi8>
 ```
 
 This PR adds a canonicalizer that rewrites the above as
 
```
  %1 = vector.broadcast %arg0 : vector<1xi8> to vector<8x1xi8>
```

It works by determining if a transpose is only shuffling contiguous
broadcast dimensions.
2025-04-16 13:08:36 -04:00
Sergei Barannikov
ed9bcb5295 [CodeGen][RISCV] Add helper class for emitting CFI instructions into MIR (#135845)
PR: https://github.com/llvm/llvm-project/pull/135845
2025-04-16 20:05:13 +03:00
Alexey Bataev
51fa6cde7d [SLP][NFC]Add a test with missing unsigned promotion for smax reduction, NFC 2025-04-16 09:55:34 -07:00