Commit Graph

555547 Commits

Author SHA1 Message Date
Md Abdullah Shahneous Bari
83d3a2efe4 [uArch][XeGPU] Add XeGPU uArch definition. (#153706)
The uArch infrastructure provides:
- A set data structures to represent, uArch and it's necessary
components (e.g., instructions, register-files, caches).
- A set of utility interfaces that are common to a family of ops (e.g.,
mma ops, 2DBlockIO ops). The implementation of these interfaces are
provided by the specific instructions. Each family of ops provides these
5 common APIs. However, some family of ops may have more utility APIs.
The common 5 APIs are:
	- getSupportedShapes
	- getSupportedTypes
	- checkSupportedShapesAndTypes
	- checkSupportedTypes
	- validate

Add support for PVC and BMG architectures.
Add support for DPAS instruction.
2025-10-10 09:21:27 -05:00
Tom Tromey
311d1138e7 Do not emit right shift by 0 in DWARF expressions (#162738)
DW_OP_LLVM_extract_bits_zext and DW_OP_LLVM_extract_bits_sext can end up
emitting "DW_OP_constu 0; DW_OP_shr" when given certain arguments.
However, a shift by zero is not useful, and so it can be omitted.
2025-10-10 15:15:17 +01:00
Matt Arsenault
9922d8dd79 AMDGPU: Stop using aligned VGPR classes for addRegisterClass (#158278)
This is unnecessary. At use emission time, InstrEmitter will
use the common subclass of the value type's register class and
the use instruction register classes. This removes one of the
obstacles to treating special case instructions that do not have
the alignment requirement overly conservatively.
2025-10-10 22:59:35 +09:00
Michael Buch
e18461a14e [lldb][test] Skip TestCppFloatingTypesSpecialization.py on older compilers
Fails with:
```
08:19:28  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/clang_1501_build/bin/clang++  -std=c++11 -g -O0 -isysroot "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk" -arch arm64  -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/lldb-build/tools/lldb/include -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/floating-types-specialization -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h  -fno-limit-debug-info    -nostdlib++ -nostdinc++ -cxx-isystem /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/clang_1501_build/include/c++/v1/  --driver-mode=g++ -MT main.o -MD -MP -MF main.d -c -o main.o /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/floating-types-specialization/main.cpp
08:19:28  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/floating-types-specialization/main.cpp:3:24: error: __bf16 is not supported on this target
08:19:28  template <> struct Foo<__bf16> {};
08:19:28                         ^
08:19:28  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/floating-types-specialization/main.cpp:5:40: error: __bf16 is not supported on this target
08:19:28  template <> struct Foo<_Float16> : Foo<__bf16> {};
08:19:28                                         ^
08:19:28  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/floating-types-specialization/main.cpp:8:7: error: __bf16 is not supported on this target
08:19:28    Foo<__bf16> f0;
08:19:28        ^
08:19:28  3 errors generated.
08:19:28  make: *** [main.o] Error 1
```

On our Clang-15.0 CI.
2025-10-10 14:54:24 +01:00
aokblast
394e7ded8b [LLDB, x86, FreeBSD] Fix Architecture parsing by reading the ELF header. (#162811)
Currently, LLDB in FreeBSD host sets the Process Architecture used by
lldbserver as Default one. Which cause problem when trying to debug a
32bit binary on amd64 platform since the lldb itself will found mismatch
architecture with lldbserver's return.

Notice that this patch is only a partial fix for the debugging problem.
We are still unable to debug x86 on x86_64 so that we don't provide
testcase in this patch.

See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289945
2025-10-10 14:51:20 +01:00
Ryotaro Kasuga
1e84cb5127 [DA] Address followup comments on #128782 (#162645)
This is a follow-up PR for post-commit comments in #128782 .

- Fix variable name to camel case.
- Change the output format to make it easier to handle with FileCheck.
- Regenerate assertions of regression tests.
2025-10-10 22:19:19 +09:00
Simon Pilgrim
027b647896 [X86] Add additional test coverage for #160111 (#162838) 2025-10-10 13:15:47 +00:00
flovent
1d3ad74667 [clang-tidy] Fix insertion location for certain function pointers in cppcoreguidelines-init-variables (#162218)
This patch starts to find terminator from `VarDecl`'s end location
rather than it's `getLocation()` to ignore terminator(`,`) in function
paramaters list.

Kind of follow up to #112091 

Closes #161978 .
2025-10-10 21:13:49 +08:00
Nico Weber
a833d902ae [gn build] Port 2eb8c47b88 2025-10-10 09:10:46 -04:00
Nikita Popov
f04ae1f4b1 [InstCombine] Perform common cast transforms for ptrtoaddr 2025-10-10 15:08:21 +02:00
Arseniy Zaostrovnykh
e297184ba1 [clang][analyzer] Remove boolean per-entry-point metrics (#162817)
The complexity of maintaining an extra kind of metrics have not
justified itself, as it is not used upstream, and we have only a single
use of boolean stats per entrypoint downstream.

As I will do downstream, you can use an unsigned statistic type with
values 0 and 1 to model a boolean flag.

--

CPP-7097
2025-10-10 14:53:16 +02:00
Syadus Sefat
167c00e4a4 [AMDGPU][GlobalISel] Add register bank legalization for G_SMIN/G_SMAX/G_UMIN/G_UMAX (#159821)
[AMDGPU][GlobalISel] Add register bank legalization for
G_SMIN/G_SMAX/G_UMIN/G_UMAX

This patch adds register bank legalization support for min/max
operations in the AMDGPU GlobalISel pipeline.

- Add support S16, S32, and V2S16 types
- For V2S16 uniform operations implements UnpackMinMax lowering
2025-10-10 14:34:15 +02:00
Rahul Joshi
97031a6e09 [NFC][LLVM] Code cleanup in MisExpect.cpp (#162695)
- Make instruction arguments to the `misexpect` functions const and drop
const for `ArrayRef` arguments.
- Remove namespace llvm/misexpect surrounding all the code in .cpp file
and instead use `using namespace`.
- Change static helper functions to also use const references or
pointers when possible.
2025-10-10 05:24:42 -07:00
Rahul Joshi
ea5648b1a8 [NFC][LLVM] Code cleanup in LowerInvoke.cpp (#162691)
Fix indentation for `LowerInvokeLegacyPass` and use namespace qualifiers
for defining variables and functions in `llvm` namespace.
2025-10-10 05:24:11 -07:00
Rahul Joshi
bea786d128 [NFC][LLVM] Use namespace qualifier to define DenseMapInfo specializations (#162683)
Use `llvm::DenseMapInfo` to define `DenseMapInfo` specializations
instead of surrounding it with `namespace llvm {}`.
2025-10-10 05:23:44 -07:00
Aaron Ballman
0a21b06e0b Remove WG14 N3544
This paper had only non-normative changes about the classification list
of storage class specifiers. There is nothing here to test for
conformance.
2025-10-10 08:18:54 -04:00
Ryan Cowan
b298421e0c [AArch64][GlobalISel] Add G_FPEXT(G_FCONSTANT) folding (#162829) 2025-10-10 12:17:06 +00:00
Aaron Ballman
3fdef23873 Remove WG14 N3563
This paper had only non-normative changes and was already covered by
existing nullptr_t test coverage.
2025-10-10 08:16:00 -04:00
Valery Pykhtin
5eef98ba31 [AMDGPU] Use correct SlotIndex to calculate live-out register set. (#161720)
Using SlotIndexes::getMBBEndIdx() isn't the correct choice here because
it returns the starting index of the next basic block, causing live-ins
of the next block to be calculated instead of the intended live-outs of
the current block.

Add SlotIndexes::getMBBLastIdx() method to return the last valid
SlotIndex within a basic block, enabling correct live-out calculations.
2025-10-10 14:03:27 +02:00
Utkarsh Saxena
2eb8c47b88 [LifetimeSafety] Reorganize code into modular components (#162474)
Restructure the C++ Lifetime Safety Analysis into modular components
with clear separation of concerns.

This PR reorganizes the C++ Lifetime Safety Analysis code by:

1. Breaking up the monolithic `LifetimeSafety.cpp` (1500+ lines) into
multiple smaller, focused files
2. Creating a dedicated `LifetimeSafety` directory with a clean
component structure
3. Introducing header files for each component with proper documentation
4. Moving existing code into the appropriate component files:
    - `Checker.h/cpp`: Core lifetime checking logic
    - `Dataflow.h`: Generic dataflow analysis framework
    - `Facts.h`: Lifetime-relevant events and fact management
    - `FactsGenerator.h/cpp`: AST traversal for fact generation
- `LiveOrigins.h/cpp`: Backward dataflow analysis for origin liveness
- `LoanPropagation.h/cpp`: Forward dataflow analysis for loan tracking
    - `Loans.h`: Loan and access path definitions
    - `Origins.h`: Origin management
    - `Reporter.h`: Interface for reporting lifetime violations
    - `Utils.h`: Common utilities for the analysis

The code functionality remains the same, but is now better organized
with clearer interfaces between components.
2025-10-10 13:43:39 +02:00
Paul Walker
1c5bba1e47 [LLVM][CodeGen][SVE] ASRD cannot represent sdiv-by-one. (#162708)
We lower signed divides by a power-of-two to ASRD. However, ASRD's
immediate is log2(shift_amount) in the range 1 to elt-bitwidth, which
means it cannot represent sdiv-by-one.

Fixes https://github.com/llvm/llvm-project/issues/162616
2025-10-10 12:37:43 +01:00
Aaron Ballman
80f48b8493 [C2y] Claim support for WG14 N3532; NFC (#162718)
This paper was ensuring that the left operand of . and -> must be a
complete object type. This has always been required in every version of
Clang.
2025-10-10 07:34:16 -04:00
Pierre van Houtryve
e26058cefc [AMDGPU] Use reverse iteration in CodeGenPrepare (#145484)
In order to make this easier, I also removed all "removeFromParent"
calls from the visitors, instead adding instructions
to a set of instructions to delete once the function has been visited.
This avoids crashes due to functions deleting their operands. In theory
we could allow functions to delete the
instruction they visited (and only that one) but I think having one
idiom for everything is less error-prone.

Fixes #140219
2025-10-10 13:00:40 +02:00
Vladimir Radosavljevic
be7f85168d [CGP] Fix missing sign extension for base offset in optimizeMemoryInst (#161377)
If we have integers larger than 64-bit we need to explicitly sign extend
them, otherwise we will get wrong zero extended values.
2025-10-10 10:52:52 +00:00
Paul Walker
50cda17e32 [Clang][AArch64] Relax SVE2 requirement for builtins available via +sme. (#162457)
Having both SVE and SME environments essentially means the majority of
SVE2 instructions are always available. This PR reflects this at the
builtins level whereby +sve+sme is enough to enable this subset.

It's a similar story for +sve2p1 whereby the feature means a subset of
SME2 instructions are always available.
2025-10-10 11:28:04 +01:00
JaydeepChauhan14
86ab51935b [X86][NFC] Moved/Updated FNEG testcases (#162269)
- Moved existing testcases from
```llvm/test/CodeGen/X86/fast-isel-fneg.ll``` to
```llvm/test/CodeGen/X86/isel-fneg.ll```.
- Added **x86_fp80** testcase and **GISEL** RUN lines as precommit
testcases for GISEL.
- Two i686 testcases are disabled because it is crashing in later passes
only for GISEL. It will resolve after adding **FNEG GISEL
implementation**, I will add that in next PR.
2025-10-10 10:14:10 +00:00
Paul Walker
b52efa5f05 [LLVM][CodeGen][SVE] Add lowering for 3-way VECTOR_(DE)INTERLEAVE operations. (#162502)
SVE has no in-register instructions to do this, but we can perform the
operation through memory by using ld3/st3.
2025-10-10 11:12:50 +01:00
David Spickett
6f1ce2b25b [llvm][ADT] Fix uint64_t array BitSet construction on 32-bit systems (#162814)
When the underlying storage element is 32-bit, we may only need half of
the last value in the uint64_t array. I've adjusted the constructor to
account for that.

For example, if you construct a 65 bit bitset you will need both 32-bit
halves of the first array value but only the bottom half of the second
value. The storage will only have 3 elements, so attempting to assign
the top 32-bits into the storage will fail.

This happened on our buildbot:
https://lab.llvm.org/buildbot/#/builders/154/builds/22555
(though the traceback is not useful)

Then added tests for < 32 bit sizes, and assertions for the number of
elements we decide to use. Given that the only member of BitSet is a
std::array, I think the size will be consistent across systems.

Tested on 32 and 64-bit Arm machines.

Follow up to #162703.
2025-10-10 10:08:50 +00:00
Nikolas Klauser
8ad5a21790 [libc++] Fix %{temp} replacements when running benchmarks 2025-10-10 12:08:26 +02:00
Rana Pratap Reddy
f2ffb4d20b [AMDGPU] Support for type inferring image load/store builtins for AMDGPU (#140210)
Introduces the builtins for amdgcn_image_load/store/sample.
2025-10-10 15:26:08 +05:30
Ryan Cowan
fab7bd48fc Revert "[AArch64][GlobalISel] Add G_FPEXT(G_FCONSTANT) folding" (#162805)
Reverts llvm/llvm-project#160902 as the tests need updating to prevent
breaking the build. More specifically, the `AMDGPU` tests.
2025-10-10 10:46:30 +01:00
Pragyansh Chaturvedi
97cf55b2ce [GlobalISel] add KnownBits tracking for G_UMULH and G_SMULH (#158445)
The code is taken from `SelectionDAG::computeKnownBits`.
This ticks off `MULHU` and `MULHS` from
https://github.com/llvm/llvm-project/issues/150515
2025-10-10 18:42:14 +09:00
Victor Chernyakin
9aaec5550d [clang-tidy][NFC] Remove regex hacks to match full lines in tests (#162293)
This is part of the migration started by #133756. The next step would be
moving many tests away from `--match-partial-fixes`.
2025-10-10 02:41:25 -07:00
jeanPerier
de55329b6e [flang][NFC] update createTempFromMold interface to return a bool (#162680)
Some createTempFromMold users are looking for a compile time constant
for the `mustFree`. Instead of having them retrieving it, update the
interface to return a bool. The only users that needs a value was
`packageBufferizedExpr` and it has an overload that accept bool too.

Tests are updated to reflect that this changes the place where the
boolean is created in BufferizeHLFIR, and just removes its creation in
contexts it is not needed.
2025-10-10 11:19:54 +02:00
Hongyu Chen
881a57b995 [DFAJumpThreading] Use a single lazy DTU (#162802)
Resolves
https://github.com/llvm/llvm-project/pull/162240#pullrequestreview-3309102803
2025-10-10 09:16:12 +00:00
Nikita Popov
6c2781e187 [GVN] Share equality propagation for assume and condition (#161639)
GVN currently has two different implementation of equality propagation.
One of them is used for branch conditions (dominating an edge), which
performs replacements across multiple blocks. This is also used for
assumes to handle uses outside the current block.

However, uses inside the block are handled using a completely separate
implementation, which involves populating a replacement map and then
checking it for individual instructions during normal GVN. While this
approach generally makes sense, it is kind of pointless if we already do
a use walk to handle the cross-block case anyway.

This PR generalizes propagateEquality() to accept either a
BasicBlockEdge or an Instruction* and replace dominated users. This
removes the need for special handling of uses in the same block for
assumes, as they're covered by instruction dominance, and ensures that
both implementations do not go out of sync.
2025-10-10 10:58:58 +02:00
Michael Buch
c32753a77a [llvm][DebugInfo] Add 'sourceLanguageName' field support to DICompileUnit (#162445)
Depends on:
* https://github.com/llvm/llvm-project/pull/162255
* https://github.com/llvm/llvm-project/pull/162434

Part of a patch series to support the DWARFv6
`DW_AT_language_name`/`DW_AT_language_version` attributes.
2025-10-10 09:54:04 +01:00
yingopq
51eee2010d [Mips] Fix clang crashes when assembling invalid MIPS beql instructions with --arch=mips (#156413)
From clang version 4, mips append new instruction BeqImm and
BEQLImm, the second operand format of instruction is imm64:$imm.

1.When Mips process `beql $t0, ($t0), 1`, it think the second operand
was an imm, so match success. Then mips backend process expandBranchImm,
check the second operand `$t0` was not imm, reported asserts.
We can strengthen the second operand matching restrictions.

2.Similarly, when Mips process `beql $t0, (1), 1`, it think the second
was an imm. so match success. Then mips backend process expandBranchImm,
check the third operand `1` was not expression, reported asserts. Permit
the third operand of `beql`  to be imm.

Fixes #151453.
2025-10-10 16:40:22 +08:00
Lang Hames
ef4598fbc6 [orc-rt] Enable span<const char> use in SPSWrapperFunctions. (#162792)
SPS deserialization for span<const char> produces a value that points
directly into the argument buffer for efficiency. This was broken by an
unnecessary std::move of the buffer inside WrapperFunction, which this
commit removes.
2025-10-10 19:38:10 +11:00
Matt Arsenault
aa406aaa67 RuntimeLibcalls: Add bitset for available libcalls (#150869)
This is a step towards separating the set of available libcalls
from the lowering decision of which call to use. Libcall recognition
now directly checks availability instead of indirectly checking through
the lowering table.
2025-10-10 08:27:30 +00:00
quic_hchandel
eace84dd5d [RISCV] Prioritize Qualcomm uC Xqcics over Xqcicli (#162416)
In cases where both Xqcics and Xqcicli patterns can be used, Xqcics
should be used because some instructions in this extension are
commutable.
2025-10-10 13:46:19 +05:30
Nikita Popov
261580cacd [InstSimplify] Support non-inbounds GEP in ptrdiff fold (#162676)
We can fold ptrdiff(ptradd(p, x), p) to x regardless of whether the
ptradd is inbounds.

Proof: https://alive2.llvm.org/ce/z/Xuvc7N
2025-10-10 08:03:25 +00:00
Brad Smith
31e85cc572 [Android] Drop workarounds for older Android API levels pre 9, 17 and 21 (#161911)
Drop workarounds for Android API levels pre 9, 17, 21.

The minimum Android API currently supported by the LTS NDK is 21.
2025-10-10 03:59:44 -04:00
paperchalice
2aeefcf40f [clang][CodeGen] Remove "unsafe-fp-math" attribute support (#162779)
These global flags block furthur improvements for clang, users should
always use fast-math flags
see also
https://discourse.llvm.org/t/rfc-honor-pragmas-with-ffp-contract-fast/80797
Remove them incrementally, this is the clang part.
2025-10-10 15:56:29 +08:00
Nikita Popov
187a8e3e08 [InstSimplify] Support ptrtoaddr in pointer subtraction fold (#162672)
Add a new m_PtrToIntOrAddr() matcher which matches both ptrtoint and
ptrtoaddr. Pointer arithmetic only works on the address bits, so
supporting ptrtoaddr is always fine here.
2025-10-10 09:30:30 +02:00
Michael Buch
0dff52ba90 [llvm-dwarfdump] Support for DW_AT_language_name and DW_AT_language_version (#162449)
Depends on:
* https://github.com/llvm/llvm-project/pull/162434
* https://github.com/llvm/llvm-project/pull/162446

Makes sure we dump the attributes in a user-friendly way.

More info on the attributes here: https://dwarfstd.org/languages-v6.html
2025-10-10 07:54:13 +01:00
Ryan Cowan
66da680330 [AArch64][GlobalISel] Add G_FPEXT(G_FCONSTANT) folding (#160902)
This change adds a new folding pattern, folding a G_FPEXT(G_FCONSTANT)
to a G_FCONSTANT.

To make this work on AArch64, the `G_FCONSTANT` should not be widened
due to the `G_FCONSTANT` being converted to a `G_CONSTANT`. This should
fix some other floating point combines when the `G_FCONSTANT` is widened
due to being an fp16.
2025-10-10 15:32:32 +09:00
Brad Smith
cadddaf255 [clang] Remove support for really old Ubuntu releases (#162778)
After 07ca4db1e1 remove support
for really old and older Ubunutu (Hardy and Intrepid) releases.
2025-10-10 02:29:54 -04:00
Henrik G. Olsson
0df4e63798 [OpenCL] update address-spaces.cl (#162785)
This test was broken by
https://github.com/llvm/llvm-project/pull/162714. Previously the
`[[clang::opencl_private]]` attribute was applied first, resulting in
the clashing `__global` attribute being ignored. Now that `__global` is
applied first, it results in an error, and then
`[[clang::opencl_private]]` is applied, resulting in another error.
2025-10-10 05:56:37 +00:00
tcottin
8a505a11ee [clangd] Doxygen Parsing: Add proper handling of \note, \warning and \retval command + change render kind of command arguments + add preprocessing for markdown code blocks/spans (#156365)
Fixes some followup issues from clangd/clangd#529.

`\note` and `\warning`:
In the hover card, they are now displayed with heading and enclosing
rulers.

`\retval` commands:
Each `\retval` command is now a bullet point under the return section of
the hover card.

Added a Markdown preprocessing step before parsing the documentation
with the doxygen parser.
This mainly replaces markdown code blocks with `@code...@endcode`
commands.
2025-10-10 05:48:29 +00:00