Commit Graph

543579 Commits

Author SHA1 Message Date
Simon Pilgrim
4e30f8101e [DAG] visitFREEZE - remove isGuaranteedNotToBeUndefOrPoison assertion (#146490)
Although nice to have to prove the freeze can be moved, this can fail
immediately after freeze(op(...)) -> op(freeze(),freeze(),...) creation
if any of the new freeze nodes now prevents value tracking from seeing
through to the source values (e.g. shift amounts/element indices are in
bounds etc.).

This will allow us to remove the isGuaranteedNotToBeUndefOrPoison checks
inside canCreateUndefOrPoison that were discussed on #146361
2025-07-01 11:17:41 +01:00
Haojian Wu
2ee884a9db [clang-doc] Remove the unused clangd header.
This header seems to be included unintentionally.
2025-07-01 12:07:35 +02:00
Nikita Popov
8fe25f3071 [PowerPC] Remove chenzheng1030 from active maintainers (#145519)
chenzheng1030 has left IBM and no longer works on the PowerPC
backend. Move them from active to former maintainers.
2025-07-01 12:04:49 +02:00
David Spickett
cd60247a0f [llvm][docs] Document how to ask for things other than commit access (#146340)
This is the implicit process but useful to spell it out I think. To give
folks more confidence in asking.

Inspired by
https://discourse.llvm.org/t/request-github-issue-triage-permission-for-labeling-clang-issues/87126/1
2025-07-01 10:59:59 +01:00
Haojian Wu
5c08aeac85 [clang] Don't use raw source location in DeclarationName, NFC (#146412)
Converting back and forth for the source location raw encoding is
unnecessary.
2025-07-01 11:51:04 +02:00
Luke Hutton
698ec8c7ba [mlir][tosa] Require signless types in validation and add corresponding conversion pass (#144367)
Firstly, this commit requires that all types are signless in the strict
mode of the validation pass. This is because signless types on
operations are required by the TOSA specification. The "strict" mode in
the validation pass is the final check for TOSA conformance to the
specification, which can often be used for conversion to other formats.

In addition, a conversion pass `--tosa-convert-integer-type-to-signless`
is provided to allow a user to convert all integer types to signless.
The intention is that this pass can be run before the validation pass.
Following use of this pass, input/output information should be carried
independently by the user.
2025-07-01 10:29:53 +01:00
Sander de Smalen
cd10ded697 [Clang] Remove AArch64TargetInfo::setArchFeatures (#146107)
When compiling with `-march=armv9-a+nosve` we found that Clang still
defines the `__ARM_FEATURE_SVE2` macro, which is explicitly set in
`setArchFeatures` when compiling for armv9-a.

After some experimenting, I found out that the list of features passed
into `AArch64TargetInfo::handleTargetFeatures` has already been expanded
and takes into account `+no[feature]` and has already expanded features
like `armv9-a`.

From that I conclude that `setArchFeatures` is no longer required.
2025-07-01 10:20:40 +01:00
Jim Lin
a6bb895efe [RISCV] Fix typo in header of llvm/test/CodeGen/RISCV/rvv/select-fp.ll. NFC.
I believe that the second and third llc tests in the header tend to use
zvfhmin extension rather than zvfh; otherwise, they would be duplicates.
2025-07-01 17:09:37 +08:00
Ricardo Jesus
84c849e85b [InstCombine] Combine interleaved recurrences. (#143878)
Combine sequences such as:
```llvm
  %pn1 = phi [init1, %BB1], [%op1, %BB2]
  %pn2 = phi [init2, %BB1], [%op2, %BB2]
  %op1 = binop %pn1, constant1
  %op2 = binop %pn2, constant2
  %rdx = binop %op1, %op2
```
Into:
```llvm
  %phi_combined = phi [init_combined, %BB1], [%op_combined, %BB2]
  %rdx_combined = binop %phi_combined, constant_combined
```

This allows us to simplify interleaved reductions, for example as
introduced by the loop vectorizer.

The anecdotal example for this is the loop below:
```c
float foo() {
  float q = 1.f;
  for (int i = 0; i < 1000; ++i)
    q *= .99f;
  return q;
}
```
Which currently gets lowered explicitly such as (on AArch64,
interleaved by four):
```gas
.LBB0_1:
  fmul    v0.4s, v0.4s, v1.4s
  fmul    v2.4s, v2.4s, v1.4s
  fmul    v3.4s, v3.4s, v1.4s
  fmul    v4.4s, v4.4s, v1.4s
  subs    w8, w8, #32
  b.ne    .LBB0_1
```
But with this patch lowers trivially:
```gas
foo:
  mov     w8, #5028
  movk    w8, #14389, lsl #16
  fmov    s0, w8
  ret
```
2025-07-01 09:54:38 +01:00
Nikita Popov
102c22cb2c [FatLTO] Disable analysis verification in pipeline test (NFC)
To fix test failure with expensive checks reports at:
https://github.com/llvm/llvm-project/pull/146048#issuecomment-3022421122
2025-07-01 10:47:23 +02:00
Nikita Popov
5fa4eb1dfd [Clang] Verify data layout consistency (#144720)
Verify that the alignments specified by clang TargetInfo match the
alignments specified by LLVM data layout, which will hopefully prevent
accidental mismatches in the future.

This currently contains opt-outs for a number of of existing mismatches.

I'm also skipping the verification if options like `-malign-double` are
used, or a language that mandates sizes/alignments that differ from C.

The verification happens in CodeGen, as we can't have an IR dependency
in Basic.
2025-07-01 10:43:40 +02:00
Jim Lin
cb80651091 [RISCV] Merge AllBFloatVectors into AllFloatVectors. NFC. 2025-07-01 16:21:41 +08:00
Jim Lin
b5f4fd03c2 [RISCV] Remove unused variable AllFloatVectorsExceptFP16. NFC. 2025-07-01 16:21:41 +08:00
Simon Pilgrim
67be4fe3d5 Fix MSVC implicit double -> float truncation warning. NFC. 2025-07-01 08:48:16 +01:00
Zakk Chen
3cc200f46b DynamicAPInt: Support APInt constructor. (#146301)
This PR introduces a constructor for `DynamicAPInt` that takes an
`APInt` object as input to simplifies the creation of a large numbers.
2025-07-01 15:44:12 +08:00
Jack Styles
65cb0eae58 [Flang][OpenMP] Add Semantics support for Nested OpenMPLoopConstructs (#145917)
In OpenMP Version 5.1, the tile and unroll directives were added. When
using these directives, it is possible to nest them within other OpenMP
Loop Constructs. This patch enables the semantics to allow for this
behaviour on these specific directives. Any nested loops will be stored
within the initial Loop Construct until reaching the DoConstruct itself.

Relevant tests have been added, and previous behaviour has been retained
with no changes.

See also, #110008
2025-07-01 08:39:15 +01:00
Simon Pilgrim
372e332a57 [X86] freeze-unary.ll - remove unnecessary freeze from CTLZ/CTTZ_ZERO_UNDEF tests 2025-07-01 08:32:28 +01:00
Nikita Popov
ab6316e219 [Coroutines] Work on intrinsic IDs instead of names (NFCI) (#145518)
For the checks whether certain intrinsics are used, work with intrinsic
IDs instead of intrinsic names.

This also exposes that some of the checks were incorrect, because the
intrinsics were overloaded. There is no efficient way to determine
whether these are used. This change explicitly documents which
intrinsics are not checked for this reason.
2025-07-01 09:22:23 +02:00
Fangrui Song
9beb467d92 MC: Store fragment content and fixups out-of-line
Moved `Contents` and `Fixups` SmallVector storage to MCSection, enabling
trivial destructors for most fragment subclasses and eliminating the need
for MCFragment::destroy in ~MCSection.

For appending content to the current section, use
getContentsForAppending. During assembler relaxation, prefer
setContents/setFixups, which may involve copying and reduce the benefits
of https://reviews.llvm.org/D145791.

Moving only Contents out-of-line caused a slight performance regression
(Alexis Engelke's 2024 prototype). By also moving Fragments out-of-line,
fragment destructors become trivial, resulting in
neglgible instructions:u increase for "stage2-O0-g" and [large max-rss decrease](https://llvm-compile-time-tracker.com/compare.php?from=84e82746c3ff63ec23a8b85e9efd4f7fccf92590&to=555a28c0b2f8250a9cf86fd267a04b0460283e15&stat=max-rss&linkStats=on)
for the "stage1-ReleaseLTO-g (link only)" benchmark.
(
An older version using fewer inline functions: https://llvm-compile-time-tracker.com/compare.php?from=bb982e733cfcda7e4cfb0583544f68af65211ed1&to=f12d55f97c47717d438951ecddecf8ebd28c296b&linkStats=on
)

Now using plain SmallVector in MCSection for storage, with potential for
future allocator optimizations, such as allocating `Contents` as the
trailing object of MCDataFragment. (GNU Assembler uses gnulib's obstack
for fragment management.)

Co-authored-by: Alexis Engelke <engelke@in.tum.de>

Pull Request: https://github.com/llvm/llvm-project/pull/146307
2025-07-01 00:21:12 -07:00
Nikita Popov
7e830f7671 [Clang] Partially fix m68k alignments (#144740)
As the data layout a few lines further up specifies, the int, long and
pointer alignment should be 16 instead of the default of 32.

The long long alignment is also incorrect, but that would require a
change to the data layout as well.

Comparison with GCC, which consistently uses 2 byte alignment:
https://gcc.godbolt.org/z/K3x6a7dEf At least based on some spot checks,
the changes to bit field layout also make use match GCC now.

This was found by https://github.com/llvm/llvm-project/pull/144720.
2025-07-01 09:06:41 +02:00
Nikita Popov
c5e4546a01 [DwarfDebug] Slightly optimize computeKeyInstructions() (NFC) (#146357)
Fetch the DILocation once, instead of many times. This is pretty
trivial, but goes through out-of-line code.
2025-07-01 09:06:17 +02:00
Pavel Labath
72b40f7c64 [lldb] Delete unused DWARFDataExtractor methods (#146356)
They are left over from our previous attempt at DWARF64. The new attempt
is not using them, and they also don't have equivalents in the llvm
DWARFDataExtractor class.
2025-07-01 08:47:45 +02:00
Mahesh-Attarde
84e82746c3 [X86][llvm-exegesis] fix LNLP performance counter binding issue (#146348)
We added LNLP sched model recently, PFM counter bounding names needs to
match cpu string.
llvm-exegesis wont produce results without correct naming.

Co-authored-by: mattarde <mattarde@intel.com>
2025-07-01 10:29:23 +05:30
Fangrui Song
393aebf5c2 CodeView: Move MCCVDefRangeFragment storage to MCContext/MCFragment. NFC (#146462)
so that ~MCCVInlineLineTableFragment will become trivial when we
make ~MCEncodedFragment trivial (#146307).
2025-06-30 21:49:54 -07:00
Phoebe Wang
67b740bd73 [X86] Add diagnostic for fp128 inline assemble for 32-bit (#146458)
Suggested by Craig from #146259
2025-07-01 12:39:43 +08:00
Jason Molenda
e94c6091c9 [lldb][Mach-O] Fix several bugs in x86_64 Mach-O corefile (#146460)
reading, and one bug in the new RegisterContextUnifiedCore class.

The PR I landed a few days ago to allow Mach-O corefiles to augment
their registers with additional per-thread registers in metadata exposed
a few bugs in the x86_64 corefile reader when running under different CI
environments. It also showed a bug in my RegisterContextUnifiedCore
class where I wasn't properly handling lookups of unknown registers
(e.g. the LLDB_GENERIC_RA when debugging an intel target).

The Mach-O x86_64 corefile support would say that it had fpu & exc
registers available in every corefile, regardless of whether they were
actually present. It would only read the bytes for the first register
flavor in the LC_THREAD, the GPRs, but it read them incorrectly, so
sometimes you got more register context than you'd expect. The LC_THREAD
register context specifies a flavor and the number of uint32_t words;
the ObjectFileMachO method would read that number of uint64_t's,
exceeding the GPR register space, but it was followed by FPU and then
EXC register space so it didn't crash. If you had a corefile with GPR
and EXC register bytes, it would be written into the GPR and then FPU
register areas, with zeroes filling out the rest of the context.
2025-06-30 21:27:53 -07:00
Jim Lin
ce159d20e5 [RISCV] Put REQUIRES: riscv-registered-target in the first line of the file. NFC.
To be more consistent with other files.
2025-07-01 12:18:16 +08:00
Yang Bai
393a75ebb7 [mlir][Vector] Add constant folding for vector.from_elements operation (#145849)
### Summary

This PR adds a new folding pattern for **vector.from_elements** that
canonicalizes it to **arith.constant** when all input operands are
constants.

### Implementation Details

**Leverages FoldAdaptor capabilities**: Uses adaptor.getElements() to
access **pre-computed** constant attributes, avoiding redundant pattern
matching on operands.

### Example Transformation
```
Before:
%c0_i32 = arith.constant 0 : i32
%c1_i32 = arith.constant 1 : i32
%c2_i32 = arith.constant 2 : i32
%c3_i32 = arith.constant 3 : i32
%v = vector.from_elements %c0_i32, %c1_i32, %c2_i32, %c3_i32 : vector<2x2xi32>

After:
%v = arith.constant dense<[[0, 1], [2, 3]]> : vector<2x2xi32>
```

---------

Co-authored-by: Yang Bai <yangb@nvidia.com>
2025-06-30 20:39:53 -07:00
S. VenkataKeerthy
0a69c83421 [NFC][IR2Vec] Remove unreachable code and simplify invalid mode test (#146459)
The code following `llvm_unreachable`  is optimized out in Release builds. In this case, `Embedder::create` do not seem to return `nullptr` causing `CreateInvalidMode` test to break. Hence removing `llvm_unreachable`.
2025-06-30 20:31:47 -07:00
Qi Zhao
66cc167dfa [LoongArch] Add tests for inserting extracted integer elements. NFC 2025-07-01 10:21:33 +08:00
Kazu Hirata
8cf3b989a9 [Analysis] Fix a warning
This patch fixes:

  llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp:132:12:
  error: moving a local object in a return statement prevents copy
  elision [-Werror,-Wpessimizing-move]
2025-06-30 18:44:45 -07:00
S. VenkataKeerthy
a2dc64cd03 [NFC][MLGO] Convert notes to proper RST note directives in MLGO.rst (#146450) 2025-06-30 18:25:12 -07:00
S. VenkataKeerthy
9438048816 [IR2Vec] Simplifying creation of Embedder (#143999)
This change simplifies the API by removing the error handling complexity. 

- Changed `Embedder::create()` to return `std::unique_ptr<Embedder>` directly instead of `Expected<std::unique_ptr<Embedder>>`
- Updated documentation and tests to reflect the new API
- Added death test for invalid IR2Vec kind in debug mode
- In release mode, simply returns nullptr for invalid kinds instead of creating an error

(Tracking issue - #141817)
2025-06-30 18:24:08 -07:00
NAKAMURA Takumi
24c4bba076 [bazel] Quick fix for #145584 (Core deps ProfileData/InstrProf.h) 2025-07-01 10:03:03 +09:00
Mingjie Xu
6323541a2a [LLD][ELF] Skip non-SHF_ALLOC sections when checking max VA and max VA difference in relaxOnce() (#145863)
For non-SHF_ALLOC sections, sh_addr is set to 0.
Skip sections without SHF_ALLOC flag, so `minVA` will not be set to 0
with non-SHF_ALLOC sections, and the size of non-SHF_ALLOC sections will
not contribute to `maxVA`.
2025-07-01 09:02:06 +08:00
S. VenkataKeerthy
6620db50fe [NFC][MLGO] Fix indentation in MLGO.rst (#146444) 2025-06-30 18:00:09 -07:00
Jim Lin
70db191efa [RISCV] Add LLVM IR intrinsicis vrgatherei16/vslideup/vslidedown support for Zvfbfmin (#146312)
This patch add LLVM IR intrinsicis vrgatherei16/vslideup/vslidedown
support for Zvfbfmin.
2025-07-01 08:48:13 +08:00
S. VenkataKeerthy
a4f637d988 [MLGO] Fix feature iteration using FeatureMap.size() instead of NumberOfFeatures (#146436)
Due to the changes made in #143479, size of `FeatureMap` reflects the number of features used. Hence replacing `NumberOfFeatures` with `FeatureMap.size()` in the `DevelopmentModeInlineAdvisor`.
2025-06-30 17:44:23 -07:00
Ami-zhang
8d9cdb65f0 [Clang][LoongArch] Fixed incorrect _BitInt(N>64) alignment (#145297)
This patch makes determining alignment and width of BitInt to be target
ABI specific and makes it consistent with [Procedure Call Standard for
the LoongArch™ Architecture] for LoongArch target
(https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc).
2025-07-01 08:42:16 +08:00
Maksim Panchenko
ad7d675991 [BOLT] Refactor mapCodeSections(). NFC (#146434)
Factor out non-relocation specific code into a separate function.
2025-06-30 17:09:41 -07:00
Razvan Lupusoru
a3c8165421 [flang][acc] Fix dialect dependencies (#146431)
The TestOpenACCInterfaces test loads dialects including HLFIR and DLTI
(for data layout). The appropriate dependencies were missing leading to
link failures:

TestOpenACCInterfaces.cpp:(.text._ZNK12_GLOBAL__N_124TestFIROpenACCInterfaces20getDependentDialectsERN4mlir15DialectRegistryE+0x66):
undefined reference to
`mlir::detail::TypeIDResolver<hlfir::hlfirDialect, void>::id'
TestOpenACCInterfaces.cpp:(.text._ZNK12_GLOBAL__N_124TestFIROpenACCInterfaces20getDependentDialectsERN4mlir15DialectRegistryE+0x141):
undefined reference to `mlir::detail::TypeIDResolver<mlir::DLTIDialect,
void>::id'
2025-06-30 17:04:48 -07:00
Mircea Trofin
d2500e639b [pgo] add means to specify "unknown" MD_prof (#145578)
This PR is part of https://discourse.llvm.org/t/rfc-profile-information-propagation-unittesting/73595

In a slight departure from the RFC, instead of a brand-new `MD_prof_unknown` kind, this adds a first operand to `MD_prof` metadata. This makes it easy to replace with valid metadata (only one `MD_prof`), otherwise sites inserting valid `MD_prof` would also have to check to remove the `unknown` one.

The patch just introduces the notion and fixes the verifier accordingly. Existing APIs working (esp. reading) `MD_prof` will be updated subsequently.
2025-06-30 16:57:11 -07:00
Deric C.
12409a18f6 [DirectX] Implement memcpy in DXIL CBuffer Access pass (#144436)
Fixes #141840

This PR implements support for the `memcpy` intrinsic in the DXIL
CBuffer Access pass with the following restrictions:

- The CBuffer Access must be the `src` operand of `memcpy` and must be
direct (i.e., not a GEP)
- The type of the CBuffer Access must be of an Array Type

These restrictions greatly simplify the implementation of `memcpy` yet
still covers the known uses in DML shaders.

Furthermore, to prevent errors like #141840 from occurring silently
again, this PR adds error reporting for unsupported users of globals in
the DXIL CBuffer Access pass.
2025-06-30 16:32:43 -07:00
Rahul Joshi
92b50959da [NFC][TableGen] Capitalize to in UseFnTableInDecodetoMCInst. (#146419) 2025-06-30 16:12:15 -07:00
Jakub Kuderski
ff4faaa660 [mlir][examples] Fix deprecation warnings for ArrayRef(std::nullopt) (#146420)
This used to print:
```
llvm-project/mlir/include/mlir/IR/ValueRange.h:401:20: warning: 'ArrayRef' is deprecated: Use {} or ArrayRef<T>() instead [-Wdeprecated-declarations]
  401 |       : ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}
      |                    ^~~~~~~~
      |                    {}
build/tools/mlir/examples/toy/Ch7/include/toy/Ops.cpp.inc:2221:30: note: in instantiation of function template specialization 'mlir::ValueRange::ValueRange<const std::nullopt_t &, void>' requested here
 2221 |  build(odsBuilder, odsState, std::nullopt); 
      |                              ^
llvm-project/llvm/include/llvm/ADT/ArrayRef.h:70:18: note: 'ArrayRef' has been explicitly marked deprecated here
   70 |     /*implicit*/ LLVM_DEPRECATED("Use {} or ArrayRef<T>() instead", "{}")
      |                  ^
llvm-project/llvm/include/llvm/Support/Compiler.h:249:50: note: expanded from macro 'LLVM_DEPRECATED'
  249 | #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
```
2025-06-30 18:14:33 -04:00
Razvan Lupusoru
f16983f7d0 [flang][acc] Ensure fir.class is handled in type categorization (#146174)
fir.class is treated similarly as fir.box - but it has one key
distinction which is that it doesn't hold an element type. Thus the
categorization logic was mishandling this case for this reason (and also
the fact that it assumed that a base object is always a fir.ref).

This PR improves this handling and adds appropriate test exercising both
a class and a class field to ensure categorization works.
2025-06-30 15:04:14 -07:00
realqhc
6896d8a05d [RISCV][MC] Support Base P non-GPR pair instructions (#137927) 2025-07-01 08:01:06 +10:00
Florian Hahn
59a7185dd9 [VPlan] Truncate/Extend ComputeReductionResult at construction (NFC). (#141860)
Instead of looking up the narrower reduction type via getRecurrenceType
we can generate the needed extend directly at constructiond re-use the
truncated value from the loop.

PR: https://github.com/llvm/llvm-project/pull/141860
2025-06-30 22:39:17 +01:00
Jeffrey Byrnes
d599bdeaa4 [AMDGPU] Autogen checks for test (#146421)
Needed for upcoming PR for RA priorities
2025-06-30 14:36:23 -07:00
Jonas Devlieghere
1eb795413d [lldb] Correctly restore the cursor column after resizing the statusline (#146132)
This PR ensures we correctly restore the cursor column after resizing
the statusline. To ensure we have space for the statusline, we have to
emit a newline to move up everything on screen. The newline causes the
cursor to move to the start of the next line, which needs to be undone.

Normally, we would use escape codes to save & restore the cursor
position, but that doesn't work here, as the cursor position may have
(purposely) changed. Instead, we move the cursor up one line using an
escape code, but we weren't restoring the column.

Interestingly, Editline was able to recover from this issue through the
LineInfo struct which contains the buffer and the cursor location, which
allows us to compute the column. This PR addresses the bug by having
Editline "refresh" the cursor position.

Fixes #134064
2025-06-30 14:34:35 -07:00