549016 Commits

Author SHA1 Message Date
Daniel Thornburgh
bb4a9036cf LIBC_INLINE for modular fn definitions 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
c1f1797f44 Use LIBC_INLINE_ASM macro 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
aa874c9928 Add missing file header 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
fd1ee30e8c Fix missed SPLIT->MODULAR rename 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
4cb90bf6f1 [libc] Modular printf option (float only)
This adds LIBC_CONF_PRINTF_MODULAR, which causes floating point support
(later, others) to be weakly linked into the implementation.
__printf_modular becomes the main entry point of the implementaiton, an
printf itself wraps __printf_modular. printf it also contains a
BFD_RELOC_NONE relocation to bring in the float aspect.

See issue #146159 for context.
2025-08-21 15:09:04 -07:00
Daniel Thornburgh
ce0760f8f7 Correct typos 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
cfd33c8c0a Emit the new type arg from format attr 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
f272839e84 Add an example to clang attr doc 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
46a0008948 Update docs to account for clang inferring format attribute 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
4c53b27ac2 [clang] "modular_format" attribute for functions using format strings
This provides a C language version of the new IR modular-format
attribute. This, in concert with the format attribute, allows a library
function to declare that a modular version of its implementation is
available.

See issue #146159 for context.
2025-08-21 15:09:04 -07:00
Daniel Thornburgh
9265309f0c llvm.reloc.none takes a GlobalValue again
This avoids avoid modifying Module in ISel
2025-08-21 15:09:04 -07:00
Daniel Thornburgh
b7f8a9c8b4 Add a type arg 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
68761d9bf3 Describe the semantics of the arguments copied from C format attr 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
d11cfe5d18 Correct modular_format to modular-format in docs 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
435ba3597b Emit reloc.none instinsic with metdata string arg 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
dff521f73d issing -> issuing 2025-08-21 15:09:04 -07:00
Daniel Thornburgh
40bafe2ceb [IR] "modular-format" attribute for functions using format strings
A new InstCombine transform uses this attribute to rewrite calls to a
modular version of the implementation along with llvm.reloc.none
relocations against aspects of the implementation needed by the call.

This change only adds support for the 'float' aspect, but it also builds
the structure needed for others.

See issue #146159
2025-08-21 15:09:04 -07:00
Daniel Thornburgh
341dd6a3ca Update big-filter.td 2025-08-21 15:08:55 -07:00
Daniel Thornburgh
75c4d315dc Take symbol name by GlobalValue again to avoid modifying Module 2025-08-21 14:28:08 -07:00
Daniel Thornburgh
904c996355 Update tests 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
a6220fef9b Remove arg from emitRelocDirective call 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
20f2ad062c Lower reloc.none in Global ISel 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
6fc858761e Rename reloc_none.ll to reloc-none.ll 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
57ba236e87 Use llvm-as for test 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
07ccb63a1b Remove unneeded assertion from AsmPrinter 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
dd58f21c9e IR verifier check and test 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
bd4dd9ca02 Add a generic reloc_none test 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
5a056672cb Take symbol name by metadata arg rather than ptr to GlobalValue 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
0e830ad120 fake.use -> reloc.none 2025-08-18 11:37:40 -07:00
Daniel Thornburgh
f3fdeff3e3 [IR] llvm.reloc.none intrinsic for no-op symbol references
This intrinsic emits a BFD_RELOC_NONE relocation at the point of call,
which allows optimizations and languages to explicitly pull in symbols
from static libraries without there being any code or data that has an
effectual relocation against such a symbol.

See issue #146159 for context.
2025-08-18 11:37:40 -07:00
Krzysztof Parzyszek
8429f7faaa
[flang][OpenMP] Parsing support for DYN_GROUPPRIVATE (#153615)
This does not perform semantic checks or lowering.
2025-08-18 13:35:02 -05:00
Steven Perron
0fb1057e40
[SPIRV] Filter disallowed extensions for env (#150051)
Not all SPIR-V extensions are allows in every environment. When we use
the `-spirv-ext=all` option, the backend currently believes that all
extensions can be used.

This commit filters out the extensions on the command line to remove
those that are not known to be allowed for the current environment.

Alternatives considered: I considered modifying the
SPIRVExtensionsParser::parse to use a different list of extensions for
"all" depending on the target triple. However that does not work because
the target triple is not available, and cannot be made available in a
reasonable way.

Fixes #147717

---------

Co-authored-by: Victor Lomuller <victor@codeplay.com>
2025-08-18 18:33:58 +00:00
Thurston Dang
ade755d62b
[msan] Add Instrumentation for Avx512 Instructions: pmaddw, pmaddubs (#153919)
This applies the pmadd handler (recently improved in https://github.com/llvm/llvm-project/pull/153353) to the Avx512
equivalent of the pmaddw and pmaddubs intrinsics:
  <16 x i32> @llvm.x86.avx512.pmaddw.d.512(<32 x i16>, <32 x i16>)
  <32 x i16> @llvm.x86.avx512.pmaddubs.w.512(<64 x i8>, <64 x i8>)
2025-08-18 11:31:15 -07:00
Kyle Wang
064f02dac0
[VectorCombine] Preserve scoped alias metadata (#153714)
Right now if a load op is scalarized, the `!alias.scope` and `!noalias`
metadata are dropped. This PR is to keep them if exist.
2025-08-18 18:16:32 +00:00
Jordan Rupprecht
8d256733a0
[bazel] Port #151175: VectorFromElementsLowering (#154169) 2025-08-18 13:07:05 -05:00
Brox Chen
d49aab10bd
Revert "[AMDGPU][True16][CodeGen] use vgpr16 for zext patterns (#1538… (#154163)
This reverts commit 7c53c6162bd43d952546a3ef7d019babd5244c29.

This patch hit an issue in hip test. revert and will reopen later
2025-08-18 14:01:19 -04:00
Shaoce SUN
7e8ff2afa9
[RISCV][GISel] Optimize +0.0 to use fcvt.d.w for s64 on rv32 (#153978)
Resolve the TODO: on RV32, when constructing the double-precision
constant `+0.0` for `s64`, `BuildPairF64Pseudo` can be optimized to use
the `fcvt.d.w` instruction to generate the result directly.
2025-08-18 17:52:24 +00:00
Justin Fargnoli
58de8f2c25
[Inliner] Add option (default off) to inline all calls regardless of the cost (#152365)
Add a default off option to the inline cost calculation to always inline
all viable calls regardless of the cost/benefit and cost/threshold
calculations.

For performance reasons, some users require that all calls be inlined.
Rather than forcing them to adjust the inlining threshold to an
arbitrarily high value, offer an option to inline all calls.
2025-08-18 17:48:49 +00:00
LauraElanorJones
350f4a3e3b
Decent to Descent (#154040)
[lldb] Rename RecursiveDecentFormatter to RecursiveDescentFormatter (NFC)
2025-08-18 12:47:14 -05:00
Krzysztof Drewniak
7f27482a32
[AMDGPU][LowerBufferFatPointers] Fix lack of rewrite when loading/storing null (#154128)
Fixes #154056.

The fat buffer lowering pass was erroniously detecting that it did not
need to run on functions that only load/store to the null constant (or
other such constants). We thought this would be covered by specializing
constants out to instructions, but that doesn't account foc trivial
constants like null. Therefore, we check the operands of instructions
for buffer fat pointers in order to find such constants and ensure the
pass runs.

---------

Co-authored-by: Nikita Popov <github@npopov.com>
2025-08-18 12:32:54 -05:00
Shafik Yaghmour
99829573cc
[Clang][Webassembly] Remove unrachable code in ParseTypeQualifierListOpt (#153729)
Static analysis flagged this goto as unreachable and indeed it is, so
removing it.
2025-08-18 10:27:37 -07:00
Aiden Grossman
6960bf556c
[Github] Drop llvm-project-tests
All users of this have been claned up so we can now drop it fully.

Reviewers: cmtice, tstellar

Reviewed By: cmtice

Pull Request: https://github.com/llvm/llvm-project/pull/153877
2025-08-18 10:20:31 -07:00
Panagiotis Karouzakis
c2e7fad446
[DemandedBits] Support non-constant shift amounts (#148880)
This patch adds support for the shift operators to handle non-constant
shift operands.

ashr proof -->https://alive2.llvm.org/ce/z/EN-siK
lshr proof --> https://alive2.llvm.org/ce/z/eeGzyB
shl proof --> https://alive2.llvm.org/ce/z/dpvbkq
2025-08-19 01:11:16 +08:00
Yang Bai
4eb1a07d7d
[mlir][vector] Support multi-dimensional vectors in VectorFromElementsLowering (#151175)
This patch introduces a new unrolling-based approach for lowering
multi-dimensional `vector.from_elements` operations.

**Implementation Details:**
1. **New Transform Pattern**: Added `UnrollFromElements` that unrolls a
N-D(N>=2) from_elements op to a (N-1)-D from_elements op align the
outermost dimension.
2. **Utility Functions**: Added `unrollVectorOp` to reuse the unroll
algo of vector.gather for vector.from_elements.
3. **Integration**: Added the unrolling pattern to the
convert-vector-to-llvm pass as a temporal transformation.
4. Use direct LLVM dialect operations instead of intermediate
vector.insert operations for efficiency in `VectorFromElementsLowering`.

**Example:**
```mlir
// unroll
%v = vector.from_elements  %e0, %e1, %e2, %e3 : vector<2x2xf32>
=>
%poison_2d = ub.poison : vector<2x2xf32>
%vec_1d_0 = vector.from_elements %e0, %e1 : vector<2xf32>
%vec_2d_0 = vector.insert %vec_1d_0, %poison_2d [0] : vector<2xf32> into vector<2x2xf32>
%vec_1d_1 = vector.from_elements %e2, %e3 : vector<2xf32>
%result = vector.insert %vec_1d_1, %vec_2d_0 [1] : vector<2xf32> into vector<2x2xf32>

// convert-vector-to-llvm
%v = vector.from_elements %e0, %e1, %e2, %e3 : vector<2x2xf32>
=>
%poison_2d = ub.poison : vector<2x2xf32>
%poison_2d_cast = builtin.unrealized_conversion_cast %poison_2d : vector<2x2xf32> to !llvm.array<2 x vector<2xf32>>
%poison_1d_0 = llvm.mlir.poison : vector<2xf32>
%c0_0 = llvm.mlir.constant(0 : i64) : i64
%vec_1d_0_0 = llvm.insertelement %e0, %poison_1d_0[%c0_0 : i64] : vector<2xf32>
%c1_0 = llvm.mlir.constant(1 : i64) : i64
%vec_1d_0_1 = llvm.insertelement %e1, %vec_1d_0_0[%c1_0 : i64] : vector<2xf32>
%vec_2d_0 = llvm.insertvalue %vec_1d_0_1, %poison_2d_cast[0] : !llvm.array<2 x vector<2xf32>>
%poison_1d_1 = llvm.mlir.poison : vector<2xf32>
%c0_1 = llvm.mlir.constant(0 : i64) : i64
%vec_1d_1_0 = llvm.insertelement %e2, %poison_1d_1[%c0_1 : i64] : vector<2xf32>
%c1_1 = llvm.mlir.constant(1 : i64) : i64
%vec_1d_1_1 = llvm.insertelement %e3, %vec_1d_1_0[%c1_1 : i64] : vector<2xf32>
%vec_2d_1 = llvm.insertvalue %vec_1d_1_1, %vec_2d_0[1] : !llvm.array<2 x vector<2xf32>>
%result = builtin.unrealized_conversion_cast %vec_2d_1 : !llvm.array<2 x vector<2xf32>> to vector<2x2xf32>
```

---------

Co-authored-by: Nicolas Vasilache <Nico.Vasilache@amd.com>
Co-authored-by: Yang Bai <yangb@nvidia.com>
Co-authored-by: James Newling <james.newling@gmail.com>
Co-authored-by: Diego Caballero <dieg0ca6aller0@gmail.com>
2025-08-18 10:09:12 -07:00
Tobias Stadler
8135b7c1ab
[LV] Emit all remarks for unvectorizable instructions (#153833)
If ExtraAnalysis is requested, emit all remarks caused by unvectorizable instructions - instead of only the first.
This is in line with how other places handle DoExtraAnalysis and it can be quite helpful to get info about all instructions in a loop that prevent vectorization.
2025-08-18 18:04:53 +01:00
Ramkumar Ramachandra
97f554249c
[VPlan] Preserve nusw in createInBoundsPtrAdd (#151549)
Rename createInBoundsPtrAdd to createNoWrapPtrAdd, and preserve nusw as
well as inbounds at the callsite.
2025-08-18 17:48:42 +01:00
Andreas Jonson
1b60236200
[SimplifyCFG] Avoid redundant calls in gather. (NFC) (#154133)
Split out from https://github.com/llvm/llvm-project/pull/154007 as it
showed compile time improvements

NFC as there needs to be at least two icmps that is part of the chain.
2025-08-18 18:45:52 +02:00
Nishant Patel
4a9d038acd
[MLIR][XeGPU] Distribute load_nd/store_nd/prefetch_nd with offsets from Wg to Sg (#153432)
This PR adds pattern to distribute the load/store/prefetch nd ops with
offsets from workgroup to subgroup IR. This PR is part of the transition
to move offsets from create_nd to load/store/prefetch nd ops.

Create_nd PR : #152351
2025-08-18 09:45:29 -07:00
LLVM GN Syncbot
d6e0922a5e [gn build] Port 3ecfc0330d93 2025-08-18 16:02:02 +00:00
Damyan Pepper
cc49f3b3e1
[NFC][HLSL] Remove confusing enum aliases / duplicates (#153909)
Remove:

* DescriptorType enum - this almost exactly shadowed the ResourceClass
enum
* ClauseType aliased ResourceClass

Although these were introduced to make the HLSL root signature handling
code a bit cleaner, they were ultimately causing confusion as they
appeared to be unique enums that needed to be converted between each
other.

Closes #153890
2025-08-18 08:58:33 -07:00