541823 Commits

Author SHA1 Message Date
Nikita Popov
cbb5e244f7 [PredicateInfo] Remove redundant EdgeOnly member (NFC)
EdgeOnly indicates a phi def, which can already be identified by
LN_Last with non-null PInfo. Most of the code already reasons in
terms of LN_Last instead of EdgeOnly.
2025-06-20 09:35:11 +02:00
Nikita Popov
d196124dd2
[PredicateInfo] Remove unnecessary EdgeUsesOnly set (NFC) (#144912)
As far as I can tell, this set is pointless: It just represents whether
the target block has multiple predecessors, and the way it is
constructed and queried, we're not even reducing the number of
getSinglePredecessor() calls or something like that.
2025-06-20 09:16:39 +02:00
LLVM GN Syncbot
090f409538 [gn build] Port 0f302f38b001 2025-06-20 06:47:44 +00:00
Matt Arsenault
06e08f38e1
AArch64: Use reportFatalUsageError for unsupported calling conv (#144840)
This probably should emit a DiagnosticInfoUnsupported and use the
default calling convention instead, but then we would need to pass
in the context.

Also move where CCAssignFnForCall is called. It was unnecessarily
called for each argument, so the error wouldn't trigger for functions
with 0 arguments.

This only ensures the error occurs for functions defined with the
calling convention. The error is still missed for outgoing calls
with no arguments. The lowering logic here is convoluted, calling
CCAssignFnForCall for each argument and it does not mirror
LowerFormalArguments so I'm not sure what's going on here.
2025-06-20 15:43:39 +09:00
no92
0f302f38b0
[clang] Add managarm support (#144791)
This is a repost of the quickly reverted #139271. The failing buildbot
tests have been fixed and pass on my machine now.
2025-06-20 02:40:20 -04:00
Kazu Hirata
7cbb141155
[clang] Migrate away from ArrayRef(std::nullopt) (NFC) (#144982)
ArrayRef has a constructor that accepts std::nullopt.  This
constructor dates back to the days when we still had llvm::Optional.

Since the use of std::nullopt outside the context of std::optional is
kind of abuse and not intuitive to new comers, I would like to move
away from the constructor and eventually remove it.

This patch takes care of the clang side of the migration.
2025-06-19 23:29:50 -07:00
Maksim Panchenko
b8d3efa189
[BOLT][Linux] Fix linux_banner lookup (#144962)
While detecting the Linux kernel version, look for `linux_banner` symbol
with local visibility if the global one was not found.

Fixes #144847
2025-06-19 23:09:34 -07:00
Stanislav Mekhanoshin
69974658f0
[AMDGPU] Initial support for gfx1250 target. (#144965)
This is just a stub for now.
2025-06-19 22:52:51 -07:00
Kazu Hirata
64fe323647
[llvm] Migrate away from ArrayRef(std::nullopt) (NFC) (#144967)
ArrayRef has a constructor that accepts std::nullopt.  This
constructor dates back to the days when we still had llvm::Optional.

Since the use of std::nullopt outside the context of std::optional is
kind of abuse and not intuitive to new comers, I would like to move
away from the constructor and eventually remove it.

This patch takes care of the llvm side of the migration.
2025-06-19 21:31:26 -07:00
Ming Yan
bb51c5d4b8
[SDPatternMatch] Add m_Poison matcher (#144860)
Add SDPatternMatch matcher and unit test coverage for ISD::POISON opcode

e.g.
```
m_InsertElt(m_Poison(), m_Value(), m_Zero())
```
2025-06-20 10:58:02 +08:00
Chuanqi Xu
50c5ecd354 [NFC] [Serialization] Remove a useless comment
The comments belongs to other WIP patches.
2025-06-20 10:33:35 +08:00
Jonas Devlieghere
4f991cc995
[lldb-dap] Make connection URLs match lldb (#144770)
Use the same scheme as ConnectionFileDescriptor::Connect and use
"listen" and "accept". Addresses feedback from a Pavel in a different PR
[1].

[1] https://github.com/llvm/llvm-project/pull/143628#discussion_r2152225200
2025-06-19 20:48:07 -05:00
Fangrui Song
513bcf6d01
[yaml2obj] Report error when the input filename does not exist
I invoked yaml2obj with a mistyped filename and received no error
message. I nearly thought the program had succeeded, but the shell's
exit code prompt tipped me off.

Pull Request: https://github.com/llvm/llvm-project/pull/144835
2025-06-19 18:38:58 -07:00
Jim Lin
a05393a879
[RISCV] Add symbol parsing support for XAndesPerf branch instructions (#137748)
This patch adds support for parsing symbols in the XAndesPerf branch
immediate instructions. The branch immediate instructions use
`R_RISCV_NDS_BRANCH_10` relocation. It uses a 10-bit PC-relative branch
offset.
2025-06-20 09:06:57 +08:00
Phoebe Wang
5cbed34404
[X86] Remove CLDEMOTE from Arrowlake and later hybrid processors (#144833)
Decouple Arrowlake from Sierraforest because the later has CLDEMOTE
feature.
2025-06-20 08:57:37 +08:00
joaosaffran
fa7646008e
[DirectX] Add Root Signature Version Support and Update Test IR Format (#144957)
Updates the Root Signature metadata parser to extract version
information. This requirement was added after the initial parser
implementation.

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-19 17:39:48 -07:00
Matt Arsenault
efd42b9b1d
WebAssembly: Stop directly using RuntimeLibcalls.def (#143054)
Construct RuntimeLibcallsInfo instead of manually creating a map.
This was repeating the setting of the RETURN_ADDRESS. This removes
an obstacle to generating libcall information with tablegen.

This is also not great, since it's setting a static map which
would be broken if there were ever a triple with a different libcall
configuration.
2025-06-20 09:35:02 +09:00
Matt Arsenault
91439817e8
ARM: Avoid using isTarget wrappers around Triple predicates (#144705)
These are module level properties, and querying them through
a function-level subtarget context is confusing. Plus we don't
need an aliased name. This doesn't avoid all the uses, just the
ones in the TargetLowering constructor.
2025-06-20 09:34:35 +09:00
Tianle Liu
6001a8bb94
[WholeProgramDevirt] Add check for AvailableExternal and give up icall.branch.funnel (#143468)
When a customer class inherits from a libc++ class, and is built with
"-flto  -fwhole-program-vtables -static-libstdc++ \
-Wl,-plugin-opt=-whole-program-visibility", the libc++ class's vtable is
available_externally, meanwhile the customer class vtable is private.
And
both of them are !vcall_visibility == Linkage Unit.
In this case, icall.branch.funnel might be generated.

But the icall.branch.funnel would cause crash in LowerTypeTests because
available_externally Global_Object's GlobalTypeMember would not be
saved and finally leads to a NULL GlobalTypeMember which causes a crash.
Even saving the available_externally GO's GlobalTypeMember so that it is
not NULL to avoid the crash in LowerTypeTests, it still will crash in
SelectionDAGBuilder or Verifier, because operands linkage type
consistency
check of icall.branch.funnel can not pass.

So any one of available externally vtable would stop to generate
icall.branch.funnel.
This patch fixes FullLTO mode and split-LTO-unit ThinLTO mode.
2025-06-20 08:01:32 +08:00
Kazu Hirata
dad64877c8
[llvm] Remove an extraneous cast (NFC) (#144955)
llvm::CallBase::getArgOperand returns Value *, so we do not need
const_cast<Value *>.
2025-06-19 16:24:46 -07:00
Philip Reames
d8e6d74c69
[LV] Consider EVL legality for TTI tail folding preference (#144790) 2025-06-19 16:15:23 -07:00
Philip Reames
b96370131d
[TTI] Plumb CostKind through getPartialReductionCost (#144953)
Purely for the sake of being idiomatic with other TTI costing routines,
no direct motivation beyond that.
2025-06-19 15:29:56 -07:00
Koakuma
dfb5cadf5e
[SPARC][IAS] Properly set implied feature sets for ISA levels/extensions (#143232)
Some SPARC ISA levels and/or extensions are defined in a way such that
the availability of it implies the availability of other, more fundamental
ISA features (for example, targeting 64-bit environment implies that
V9 instructions are available).
Properly set those in the TableGen definitions.

Fixes https://github.com/llvm/llvm-project/issues/142388.
2025-06-20 05:12:51 +07:00
Kazu Hirata
a8edda195c
[llvm] Remove unused includes (NFC) (#144941)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-06-19 14:58:05 -07:00
Kazu Hirata
a9d175f173
[CodeGen] Use range-based for loops (NFC) (#144939) 2025-06-19 14:57:58 -07:00
lntue
d3a2931d8a
[libc] Use raise_except_if_required for log2f. (#144961) 2025-06-19 17:51:01 -04:00
Philip Reames
53ea522d1b
[LV] Introduce and use VPBuilder::createScalarZExtOrTrunc [nfc] (#144946)
Reduce redundant code, make the flow slightly easier to read.
2025-06-19 14:12:14 -07:00
lntue
2f3a8fd0b3
[libc] Skip x87 floating point register and only update mxcsr for x86_64 targets when raising exceptions inside math functions. (#144951)
Updating x87 floating point register significantly affect the
performance of the functions.
All the floating point exception reads will merge the results from both
mxcsr and x87 registers anyway.
2025-06-19 17:06:52 -04:00
Ross Brunton
53336ad488
[Offload] Move (most) global state to an OffloadContext struct (#144494)
Rather than having a number of static local variables, we now use
a single `OffloadContext` struct to store global state. This is
initialised by `olInit`, but is never deleted (de-initialization of
Offload isn't yet implemented).

The error reporting mechanism has not been moved to the struct, since
that's going to cause issues with teardown (error messages must outlive
liboffload).
2025-06-19 16:02:03 -05:00
Peter Klausler
9fd22cb56d
[flang][NFC] Move new code to right place (#144551)
Some new code was added to flang/Semantics that only depends on
facilities in flang/Evaluate. Move it into Evaluate and clean up some
minor stylistic problems.
2025-06-19 13:42:46 -07:00
Kazu Hirata
03692aa404
[memprof] Use a lambda instead of std::bind (NFC) (#144940)
A lambda is a lot shorter than std::bind here.
2025-06-19 13:17:47 -07:00
Kazu Hirata
3b672e1d7b
[llvm] Use "= delete" to delete constructors (NFC) (#144938)
None of the constructors touched in this patch has a corresponding
definition.  This patch explicitly deletes them with "= delete" while
moving them to the public section of respective classes.  Note that "=
delete" itself serves as documentation.

Identified with modernize-use-equals-delete.
2025-06-19 13:17:39 -07:00
Kazu Hirata
7349864d2c
[ADT] Remove an extraneous variable (NFC) (#144937)
Without this patch, Int and IntWord have the same value and type.
This patch removes the extraneous copy.
2025-06-19 13:17:31 -07:00
Kazu Hirata
dc058a3d84
[TableGen] Use ListSeparator (NFC) (#144936)
Note that an instance of ListSeparator evaluates to the empty string
for the first time and then ", " for subsequent references.
2025-06-19 13:17:23 -07:00
Slava Zakharin
28808dda2c [flang] Fixed test added in #144830. 2025-06-19 13:02:30 -07:00
Slava Zakharin
8631b4f1b4
[flang] Set low probability for array repacking code. (#144830)
This allows LLVM to place the most probably cold blocks
that do the repacking out of the line of the potentially hot code.
2025-06-19 12:12:04 -07:00
William Huynh
baf35d7a82
[libc] Fix bug in LIBC_CONF_ERRNO_MODE being undefined (#144896)
A typo, set() instead of list() would cause the build to not define
LIBC_CONF_ERRNO_MODE, which would cause the wrong configuration to be
used.
2025-06-19 14:50:07 -04:00
Shilei Tian
633e740e34
[Clang][AMDGPU][Driver] Add avail-extern-gv-in-addrspace-to-local option when ThinTLO is enabled (#144914)
On AMDGPU, we need an extra argument
`-avail-extern-gv-in-addrspace-to-local=3`
to privatize LDS global variables when ThinLTO is enabled.
2025-06-19 14:32:20 -04:00
Nicolai Hähnle
3bee9ba015
AMDGPU/GFX12: Fix s_barrier_signal_isfirst for single-wave workgroups (#143634)
Barrier instructions are no-ops in single-wave workgroups. This includes
s_barrier_signal_isfirst, which will leave SCC unmodified.

Model this correctly (via an implicit use of SCC) and ensure SCC==1
before the barrier instruction (if the wave is the only one of the
workgroup, then it is the first).

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-06-19 11:22:49 -07:00
Florian Hahn
74ec1c287a
[LV] Add tests interleaving extended and multiply/accumulate reductions.
Add missing test coverage for interleaving with
VPExtendedReduction/VPMulAccumulateReduction recipes.

Adds missing test coverage in preparation for
https://github.com/llvm/llvm-project/pull/144281.
2025-06-19 18:56:25 +01:00
Umang Yadav
836201f117
Allow bf16 operands on new MFMAs (#144925)
New gfx950 MFMA allows bf16 operands. 


c0cc81cdc0/llvm/include/llvm/IR/IntrinsicsAMDGPU.td (L3434)

When running `amdgpu-to-rocdl`, Current logic converts bf16 to i16
always which fails to compile for newer bf16 MFMA e.g.
`v_mfma_f32_16x16x32bf16`.
Backend expects bf16 type for the operands for those newer MFMAs. This
patch fixes it.

CC: @krzysz00  @dhernandez0  @giuseros  @antiagainst  @kuhar
2025-06-19 12:52:31 -05:00
Justin King
f780955e1d
lsan: fix macos build after #144604 (#144818)
Fixes build failures on macOS, including

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/

llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:579:3: error: use of undeclared identifier 'LSAN_MAYBE_INTERCEPT_FREE_SIZED'
13:23:58    579 |   LSAN_MAYBE_INTERCEPT_FREE_SIZED;
13:23:58        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13:23:58  /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:580:3: error: use of undeclared identifier 'LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED'
13:23:58    580 |   LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED;
13:23:58        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13:23:58  2 errors generated.
2025-06-19 18:38:45 +01:00
Abhishek Kaushik
0b8179b2ad
[ValueTracking] Improve Bitcast handling to match SDAG (#125935)
Closes #125228
2025-06-19 18:35:40 +01:00
Slava Zakharin
c0c71463f6
[InstCombine] Optimize sub(sext(add(x,y)),sext(add(x,z))). (#144174)
This pattern can be often met in Flang generated LLVM IR,
for example, for the counts of the loops generated for array
expressions like: `a(x:x+y)` or `a(x+z:x+z)` or their variations.

In order to compute the loop count, Flang needs to subtract
the lower bound of the array slice from the upper bound
of the array slice. To avoid the sign wraps, it sign extends
the original values (that may be of any user data type)
to `i64`.

This peephole is really helpful in CPU2017/548.exchange2,
where we have multiple following statements like this:
```
block(row+1:row+2, 7:9, i7) = block(row+1:row+2, 7:9, i7) - 10
```

While this is just a 2x3 iterations loop nest, LLVM cannot
figure it out, ending up vectorizing the inner loop really
hard (with a vector epilog and scalar remainder). This, in turn,
causes problems for LSR that ends up creating too many loop-carried
values in the loop containing the above statement, which are then
causing too many spills/reloads.

Alive2: https://alive2.llvm.org/ce/z/gLgfYX

Related to #143219.
2025-06-19 10:13:58 -07:00
Slava Zakharin
6ce86538c1
[mlir][cf] Preserve branch weights during cf.cond_br canonicalization. (#144822) 2025-06-19 10:09:10 -07:00
Florian Hahn
0816bb32ac
[Matrix] Fix heap-use-after-free after 0fa373c77ded203eddb.
We need to skip instructions in FusedInsts, as they may have been
deleted. Fixes a heap-use-after-free after #141681.
2025-06-19 17:52:31 +01:00
Andrzej Warzyński
3fe62682ef
[mlir][vector] Use result consistently as the result argument name (#144739)
This patch updates the following ops to use `result` (instead of `res`)
as the name for their result argument:
  * `vector.scalable.insert`
  * `vector.scalable.extract`
  * `vector.insert_strided_slice`

This change ensures naming consistency with other ops in the `vector`
dialect. It addresses part of:
* https://github.com/llvm/llvm-project/issues/131602
2025-06-19 17:34:08 +01:00
Rahul Joshi
c0cc81cdc0
[NFC][Clang] Adopt simplified getTrailingObjects in ASTReader (#144438) 2025-06-19 09:25:32 -07:00
Rahul Joshi
5cf7d871b0
[NFC][Clang][AST] Adopt simplified getTrailingObjects in AST (#144432)
Adopt simplified `getTrailingObjects` API in several places in clag/AST
that were missed by earlier changes.
2025-06-19 09:25:04 -07:00
lntue
b8337349d9
[libc][math] Skip setting errno and floating point exception for math functions when LIBC_MATH flag has LIBC_MATH_NO_ERRNO and LIBC_MATH_NO_EXCEPT. (#144920) 2025-06-19 12:18:39 -04:00