529994 Commits

Author SHA1 Message Date
Yaxun (Sam) Liu
5ff43550fa Revert "Fix amdgpu-arch for dll name on Windows (#101350)"
This reverts commit 6fa1bfad65edefe3f4c17740f05297d34e833b47.

Revert it due to breaking buildbot:

Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(104):
 error C2039: 'parse': is not a member of 'llvm::VersionTuple'

https://lab.llvm.org/buildbot/#/builders/46/builds/13184
2025-03-07 15:54:50 -05:00
Tai Ly
dfbadfc5e5
[mlir][tosa] Change MatMul zero-point to inputs (#130332)
* Change zero-point attributes to inputs
* Fix relevant mlir tests
* Enhance ShardingInterface in MatMul

Signed-off-by: Udaya Ranga <udaya.ranga@arm.com>
Co-authored-by: Udaya Ranga <udaya.ranga@arm.com>
2025-03-07 12:37:28 -08:00
Florian Hahn
cb3ce30ca8
[VPlan] Fold NOT into predicate of wide compares. (#129430)
Add simplification to fold negation into a compare, if the negation is
the only user of the compare. This removes a number of redundant
negations.

Alive2 Proofs for FPCMP test changes:  https://alive2.llvm.org/ce/z/WGDz9U

PR: https://github.com/llvm/llvm-project/pull/129430
2025-03-07 20:32:43 +00:00
Alex MacLean
1b01f058f4
[NVPTX] Make GlobalUniqueCallSite a member of NVPTXISelLowering (#130212)
This change moves GlobalUniqueCallSite into NVPTXISelLowering. In
processes where multiple compilations occur, this makes call site
enumeration local to individual compilation, which ensures that call
site numbers are consistently sequential within each compilation and is
independent of other compilations happening in parallel.
2025-03-07 12:32:38 -08:00
Aaron Ballman
8c130b11cb Update the C status page for N3409
This was implemented in b19ed9c0435c5f7c89cba40285df3a1395a782fd but I
forgot to update the website at the same time.
2025-03-07 15:22:28 -05:00
Mircea Trofin
11b1f154be
Optionally print !prof metadata inline (#130303)
Inspired by PR #127944, this patch adds an option to print profile metadata inline with respect to the instruction (or function) it annotates - this saves one time from having to search up and down large textual modules to find this info.
2025-03-07 12:22:13 -08:00
Aaron Ballman
0ea02e7721 [C2y] Claim nonconformance to WG14 N3410
This paper made it a constraint violation for the same identifier
within a TU to have both internal and external linkage. It was
previously UB.

Clang does not correctly diagnose the constraint in some cases,
documented in the added test case.
2025-03-07 15:15:53 -05:00
Vitaly Buka
b0baa1d8bd
[gold] Fix compilation (#130334)
After #115331.
2025-03-07 12:06:03 -08:00
Jacek Caban
868c409d38 Reapply "[LLD][COFF] Support CF guards on ARM64X (#128440)"
Both native and EC views share table chunks. Ensure relevant symbols are
set in both symbol tables.
2025-03-07 21:04:30 +01:00
Joseph Huber
fefb6858da [Clang][Docs] Fix `ext_vector_type` code block documentation 2025-03-07 13:55:39 -06:00
Aaron Ballman
b19ed9c043
[C2y] Implement WG14 N3409 (#130299)
This paper removes UB around use of void expressions. Previously, code
like this had undefined behavior:
```
  void foo(void) {
    (void)(void)1;
    extern void x;
    x;
  }
```
and this is now well-defined in C2y. Functionally, this now means that
it is valid to use `void` as a `_Generic` association.
2025-03-07 14:46:29 -05:00
Michael Jones
3a228a33c4
[libc][bazel] Main f16 test targets, new f16 funcs (#130208)
This patch adds acosf16 and asinf16 which I missed last patch, and also
the primary math tests for the float16 functions.
2025-03-07 11:38:15 -08:00
Daniel Chen
78631ac51b
[Flang] explicitly link the pthread library when building shared flang-rt. (#129956)
This patch is to explicitly link the pthread library when building
shared flang-rt.
On AIX, for example, it needs to link in `libpthread.a` explicitly in
order to resolve the references to those `pthread_*` functions in
`include/flang-rt/runtime/lock.h`
2025-03-07 14:13:38 -05:00
Vitaly Buka
4bc3592bd2
[MachinePipeliner] Fix use-after-free coping values of the same DenseMap (#130311)
After #130165.

In the code: `VRMap[CurStageNum][Def] = VRMap[CurStageNum][LoopVal]`
`VRMap[CurStageNum][LoopVal]` calculates a reference before
`VRMap[CurStageNum][Def]` which may rehash the DenseMap.
Then the reference can be dead.
2025-03-07 11:09:57 -08:00
Craig Topper
6a42dc694c
[TableGen] Simplify emitULEB128 in DecoderEmitter.cpp. NFC (#130214)
Instead of returning the number of bytes emitted, just take the iterator
by reference so the increments in emitULEB128 will update the copy in
the caller.

Also pass the iterator by reference to emitNumToSkip so we don't need a
separate I += 3 in the caller.
2025-03-07 11:09:34 -08:00
Ian Wood
813bbe055d
[mlir][linalg] Allow fusing reshapes with non-parallel operands (#130148)
Removes the condition that checks that operand is not indexed by
reduction iterators which allows for more fine-grained control via the
reshape fusion control function. For example, users could allow fusing
reshapes expand the M/N dims of a matmul but not the K dims (or preserve
the current behavior by not fusing at all).

---------

Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
2025-03-07 11:09:14 -08:00
Jerry-Ge
2619c2ed58
Revert "[mlir][tosa] Change MatMul zero-point to inputs" (#130330)
Reverts llvm/llvm-project#129785. Need rebase.
2025-03-07 11:03:38 -08:00
Corbin Robeck
50cfdf545e
[MLIR][ROCDL] Add Scale Convert Packed (B)FP8 <-> (B)F16 Support for GFX950 (#130300)
Add Rocdl support for the following GFX950 instructions:

CVT_SCALE_PK_FP8_F16
CVT_SCALE_PK_BF8_F16 
CVT_SCALE_PK_FP8_BF16 
CVT_SCALE_PK_BF8_BF16 
CVT_SCALE_SR_FP8_F16 
CVT_SCALE_SR_BF8_F16 
CVT_SCALE_SR_FP8_BF16 
CVT_SCALE_SR_BF8_BF16 
CVT_SCALE_PK_F16_FP8 
CVT_SCALE_PK_F16_BF8 
CVT_SCALE_F16_FP8 
CVT_SCALE_F16_BF8
2025-03-07 14:00:40 -05:00
Bruno Cardoso Lopes
8a43bc2c09
[MLIR][LLVMIR] Import: fix llvm.call attribute inheritance (#130221)
`inst->getFnAttr(Kind)` fallbacks to check if the parent has an
attribute, which breaks roundtriping the LLVM IR. This change actually
checks only in the call attribute list (no fallback to parent queries).

It's possible to argue that this small optimization isn't harmful, but
seems too early if it's breaking roundtrip behavior.
2025-03-07 10:59:03 -08:00
Tai Ly
106c96462f
[mlir][tosa] Change MatMul zero-point to inputs (#129785)
* Change zero-point attributes to inputs
* Fix relevant mlir tests
* Enhance ShardingInterface in MatMul

Signed-off-by: Udaya Ranga <udaya.ranga@arm.com>
Co-authored-by: Udaya Ranga <udaya.ranga@arm.com>
2025-03-07 10:46:25 -08:00
Augie Fackler
df79000896 [clangd] fix warning by adding missing parens 2025-03-07 13:38:49 -05:00
Jerry-Ge
96f369791d
[mlir][tosa] Update the description section for CastOp to align with TOSA v1.0 spec (#129958)
Updated the description section to include all data types and match the
ordering with the spec.

https://www.mlplatform.org/tosa/tosa_spec.html#_cast

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-03-07 10:36:43 -08:00
Jerry-Ge
ca582b1684
[mlir][tosa] Add FP8 lit tests (#127730)
Add FP8 lit tests to the following operators:

ARGMAX
AVGPOOL
CONV2D
CONV3D
DEPTHWISE_CONV2D
MATMUL
MAX_POOL2D
TRANSPOSE_CONV2D
CONST
CAST
CONCAT
PAD
RESHAPE
REVERSE
SLICE
TILE
TRANSPOSE
GATHER
SCATTER

Signed-off-by: Tai Ly <tai.ly@arm.com>
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Co-authored-by: Tai Ly <tai.ly@arm.com>
2025-03-07 10:36:27 -08:00
Tom Eccles
ca1833b91e
[mlir][OpenMP] cast address space of private variables (#130301)
Fixes #130159

The problem is that the alloca created for the private variable uses the
default alloca address space in that module, but the function the
pointer is being passed to expects a different address space, leading to
a type missmatch in the function argument.

I know nothing about how AMDGPU is supposed to work. I based this
solution on code from createDeviceArgumentAccessor(). Please could
somebody from AMD confirm this solution is appropriate.
2025-03-07 18:30:57 +00:00
LLVM GN Syncbot
c59713c2d8 [gn build] Port ce9e1d3c15ed 2025-03-07 18:23:23 +00:00
Andy Kaylor
8eb9b947af
[CIR] Emit init of local variables (#130164)
Local variable initialization was previously being ignored. This change
adds support for initialization of scalar variables with constant values
and introduces the constant emitter framework.
2025-03-07 10:23:06 -08:00
Valentin Clement (バレンタイン クレメン)
5668c7bb90
[flang][cuda] Add more interfaces for __ldca, __ldcs, __ldlu and __ldcv (#130218) 2025-03-07 10:19:20 -08:00
Yaxun (Sam) Liu
6fa1bfad65
Fix amdgpu-arch for dll name on Windows (#101350)
Recently HIP runtime changed dll name to amdhip64_n.dll on Windows,
where n is ROCm major version number.

Fix amdgpu-arch to search for amdhip64_n.dll on Windows.
2025-03-07 13:13:46 -05:00
JaydeepChauhan14
a2b3dafcdf
[X86][NFC] Updated POW/EXP*/LOG* functions testcases (#129677)
- Added GlobalISel runs as precommit testcase for G_POW/G_EXP*/G_LOG*.
- Removed unused tag MISSED.
2025-03-07 19:06:27 +01:00
anjenner
ce9e1d3c15
Modify the localCache API to require an explicit commit on CachedFile… (#115331)
…Stream.

CachedFileStream has previously performed the commit step in its
destructor, but this means its only recourse for error handling is
report_fatal_error. Modify this to add an explicit commit() method, and
call this in the appropriate places with appropriate error handling for
the location.

Currently the destructor of CacheStream gives an assert failure in Debug
builds if commit() was not called. This will help track down any
remaining uses of the API that assume the old destructior behaviour. In
Release builds we fall back to the previous behaviour and call
report_fatal_error if the commit fails.
2025-03-07 17:58:36 +00:00
John Brawn
fb0891387a
[SelectionDAG] Clean up some redundant setting of node flags (NFC) (#130307)
PR #130124 added a use of FlagInserter to the start of
SelectionDAGLegalize::PromoteNode, making some of the places where we
set flags be redundant, so remove them. The places where the setting of
flags remains are in non-floating-point operations.
2025-03-07 17:51:13 +00:00
Renaud Kauffmann
d4754db15d
Test fix: Adding REQUIRES: asserts (#130314) 2025-03-07 09:49:47 -08:00
Simon Pilgrim
445c43d712 [InstCombine] Add test for missing (or (zext x), (shl (ashr x, bw-1))) -> (sext x) case
#129363 handled all the cases where there was a sext for the original source value, but not for cases where the source is already half the size of the destination type

Another regression noticed in #76524
2025-03-07 17:48:47 +00:00
Zibi Sarbinowski
afbbca5c9d
[z/OS] Add call to shmctl() to release shared memory on z/OS (#130163)
This PR will solve the issue with leaking shared memory we have after running llvm lit test on z/OS.
In particular llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp was causing the leak.
2025-03-07 12:41:17 -05:00
Ramkumar Ramachandra
86dfd90193
Revert "[EquivClasses] Introduce members iterator-helper" (#130313)
This reverts commit 259624bf6d, as it causes a build failure.
2025-03-07 17:38:38 +00:00
Jacek Caban
c53e527bf8
[LLD][COFF] Implement ECExportThunkChunk::classof (NFC) (#130106)
Allows using `dyn_cast_or_null` in `maybeAddAddressTakenFunction` in #128440.
2025-03-07 18:34:56 +01:00
Ramkumar Ramachandra
259624bf6d
[EquivClasses] Introduce members iterator-helper (#130139) 2025-03-07 17:24:14 +00:00
Joseph Huber
5c9d0a26d9
[LinkerWrapper] Try to fix testing on Windows (#130285)
Summary:
Thanks to @Meinersbur for finding this. The `:` character used in AMD's
target-id's is invalid on windows. This patch replaces them with `-`.

---------

Co-authored-by: Michael Kruse <github@meinersbur.de>
2025-03-07 11:10:21 -06:00
Daniel Paoliello
99c6342b5e
[win] Fix EH Cont Guard targets when SEH personality is used (#129612)
There were two issues when `/guard:ehcont` is enabled with the SEH
personality on Windows:
1. As @namazso correctly identified, we bail out of
`WinException::endFunction` early for `MSVC_TableSEH` with funclets,
expecting the exception data to be emitted in `endFunclet`, but
`endFunclet` didn't copy the EHCont metadata from the function to the
module.
2. The SEH personality requires that the basic block containing the
`catchpad` is the target, not the `catchret`.

Fixes #64585
2025-03-07 09:07:47 -08:00
Renaud Kauffmann
718c4ed8a0
[flang] [NFCI] Using getSource instead of getOriginalDef (#128984)
As discussed in past MRs, this change removes the use of getOriginalDef
to use getSource instead to gather data from an indirection.
2025-03-07 08:47:42 -08:00
hanbeom
0ee8f69978
[VectorCombine] Fix invalid shuffle cost argument of foldShuffleOfSelects (#130281)
In the previous code (#128032), it specified the destination vector as the
getShuffleCost argument. Because the shuffle mask specifies the indices
of the two vectors specified as elements, the maximum value is twice the
size of the source vector. This causes a problem if the destination
vector is smaller than the source vector and specify an index in the
mask that exceeds the size of the destination vector.

Fix the problem by correcting the previous code, which was using wrong
argument in the Cost calculation.

Fixes #130250
2025-03-07 16:40:26 +00:00
Joseph Huber
3ed4daf9a7 [Clang] Add missing printer for vector type attribute 2025-03-07 10:39:09 -06:00
Matt Arsenault
c6b9d5ce76
clang/HIP: Use regex for final path separator in hip-partial-link.hip (#130291)
Somehow this passed the precheck test on the windows bot, but is
failing in precheck of unrelated PRs
2025-03-07 23:36:34 +07:00
Timm Baeder
d6a4828c8a
[clang][bytecode] Special-case ConstantExpr in if conditions (#130294)
This happens a lot with `if constexpr` with a condition based on a
template param. In those cases, the condition is a ConstantExpr with a
value already set, so we can use that and ignore the other branch.
2025-03-07 17:35:06 +01:00
David Sherwood
db5e4016c0
[CostModel] Add type-based cost model for get.active.lane.mask intrinsic (#130132)
I recently realised that we return an invalid cost when requesting
the type-based cost for the get.active.lane.mask intrinsic. I've
fixed that in this patch by reusing the existing code for the
non-type-based model.
2025-03-07 16:12:35 +00:00
Connector Switch
dd9a2f0677
[libc] first_trailing_one(0) should be 0. (#130155)
Fix this minor bug. See more context at #129892.
2025-03-08 00:11:43 +08:00
Aaron Ballman
494bf26736 Add a link to the paper to a release note; NFC 2025-03-07 11:10:28 -05:00
Joseph Huber
0a41fb71f1
[Clang] Treat ext_vector_type as a regular type attribute (#130177)
Summary:
This attribute is mostly borrowed from OpenCL, but is useful in general
for accessing the LLVM vector types. Previously the only way to use it
was through typedefs. This patch changes that to allow use as a regular
type attribute, similar to address spaces.
2025-03-07 10:09:06 -06:00
erichkeane
67960e5c08 [OpenACC] Ensure decl OpenACC constructs don't crash
I initially implemented codegen to be a 'no-op' for these declarations,
  which I thought was properly implemented.  However, when they are a
  top-level decl, we have a separate switch.  This patch makes sure they
  are properly emitted at top-level as a no-op, and adds a test for both
  top-level and not top-level.
2025-03-07 08:05:19 -08:00
Peng Sun
5685def507
[mlir][tosa] Convert RESCALE op multiplier and shift from attributes to inputs (#129720) 2025-03-07 15:59:29 +00:00