532325 Commits

Author SHA1 Message Date
Fraser Cormack
b52977b868
[libclc] Move pow, powr & pown to the CLC library (#133294)
These functions were already nominally in the CLC library.

Similar to others, these builtins are now vectorized and are not broken
down into scalar types.
2025-03-28 08:23:24 +00:00
Fraser Cormack
0a74cbfac4
[libclc] Pass -fapprox-func when compiling 'native' builtins (#133119)
The libclc build system isn't well set up to pass arbitrary options to
arbitrary source files in a non-intrusive way. There isn't currently any
other motivating example to warrant rewriting the build system just to
satisfy this requirement. So this commit uses a filename-based approach
to inserting this option into the list of compile flags.
2025-03-28 08:22:19 +00:00
Pengcheng Wang
f5f4da6db6
[RISCV] Don't vectorize for loops with small trip count (#132176)
Inspired by https://reviews.llvm.org/D130755.

I don't know the logic behind the value 5, it is copied from AArch64.

For some tests, I have to change the trip count so that we don't
break what they are testing.
2025-03-28 15:51:29 +08:00
Letu Ren
29cb00331f
[mlir][llvmir] add llvm.experimental.constrained.uitofp intrinsics (#133300)
https://llvm.org/docs/LangRef.html#llvm-experimental-constrained-uitofp-intrinsic

Signed-off-by: Letu Ren <fantasquex@gmail.com>
2025-03-28 08:47:36 +01:00
Letu Ren
68f71aae3b
[mlir][llvmir] add llvm.sincos intrinsics (#133311)
https://llvm.org/docs/LangRef.html#llvm-frexp-intrinsic

Signed-off-by: Letu Ren <fantasquex@gmail.com>
2025-03-28 08:45:46 +01:00
Daniil Kovalev
e3f1c464f7
[PAC][lld] Support -z nopac-plt flag (#132973)
Support `-z nopac-plt` so it's possible to cancel previous `-z pac-plt`.
2025-03-28 10:32:56 +03:00
Jean-Didier PAILLEUX
5b36835df0
[flang] Expose -m64 option (#132409)
Exposes `-m64` option for Flang. 
These options can be used to build libraries or tools (e.g. OpenBlas).
2025-03-28 08:15:01 +01:00
Sudharsan Veeravalli
a6e61ce239
[RISCV] Remove duplicate check in SelectAddrRegImmLsb00000. NFC (#133372) 2025-03-28 12:39:59 +05:30
YunQiang Su
7eccafc3c8
MIPS: Implement isAsCheapAsAMove for addiu (#133273)
Set `addiu` as `isAsCheapAsAMove` only when the src register or imm is
zero only.

If other cases are set `isAsCheapAsAMove`, MachineLICM will reject to
hoist it.
2025-03-28 13:34:07 +08:00
Matt Arsenault
0ed8b27890
llvm-reduce: Avoid removing convergent with convergence tokens (#132946)
Check if the intrinsics are declared in the module as an overly
conservative fix.

Fixes #132695
2025-03-28 12:30:35 +07:00
Qinkun Bao
bed2bdf17b
[NFCI] Change compiler_rt_Test_runtime to lowercase (#133362) 2025-03-27 22:20:14 -07:00
Mircea Trofin
68571f9151 Revert "[compiler-rt][nfc] DenseMap needs placement new (#133329)"
This reverts commit 4485e25dd2a57be1ee504b4dd863a1e140f5084c.
Buildbot failures, e.g. https://lab.llvm.org/buildbot/#/builders/66/builds/11827
2025-03-27 22:15:13 -07:00
Mircea Trofin
4485e25dd2
[compiler-rt][nfc] DenseMap needs placement new (#133329) 2025-03-27 21:39:12 -07:00
Maksim Panchenko
96e5ee23a7
[BOLT][AArch64] Add partial support for lite mode (#133014)
In lite mode, we only emit code for a subset of functions while
preserving the original code in .bolt.org.text. This requires updating
code references in non-emitted functions to ensure that:

* Non-optimized versions of the optimized code never execute.
* Function pointer comparison semantics is preserved.

On x86-64, we can update code references in-place using "pending
relocations" added in scanExternalRefs(). However, on AArch64, this is
not always possible due to address range limitations and linker address
"relaxation".

There are two types of code-to-code references: control transfer (e.g.,
calls and branches) and function pointer materialization.
AArch64-specific control transfer instructions are covered by #116964.

For function pointer materialization, simply changing the immediate
field of an instruction is not always sufficient. In some cases, we need
to modify a pair of instructions, such as undoing linker relaxation and
converting NOP+ADR into ADRP+ADD sequence.

To achieve this, we use the instruction patch mechanism instead of
pending relocations. Instruction patches are emitted via the regular MC
layer, just like regular functions. However, they have a fixed address
and do not have an associated symbol table entry. This allows us to make
more complex changes to the code, ensuring that function pointers are
correctly updated. Such mechanism should also be portable to RISC-V and
other architectures.

To summarize, for AArch64, we extend the scanExternalRefs() process to
undo linker relaxation and use instruction patches to partially
overwrite unoptimized code.
2025-03-27 21:33:25 -07:00
Fangrui Song
0ed4bdfe70 PPCAsmParser: Detect multiple specifiers
In addition, simplify extractSpecifier and switch to the `Specifier`
naming convention.
2025-03-27 20:57:13 -07:00
Stanislav Mekhanoshin
81c6ce3b33
[AMDGPU] Simplify VOP3_CVT_PK_F8_F32_Profile. NFC. (#133328) 2025-03-27 20:50:15 -07:00
Kazu Hirata
673f4705a8
[llvm] Use *Set::insert_range (NFC) (#133353)
We can use *Set::insert_range to collapse:

  for (auto Elem : Range)
    Set.insert(E.first);

down to:

  Set.insert_range(llvm::make_first_range(Range));

In some cases, we can further fold that into the set declaration.
2025-03-27 20:44:20 -07:00
Kazu Hirata
c9197b27b4
[AMDGPU] Use MapVector instead of DenseMap (NFC) (#133356)
This patch combines:

  DenseMap<MachineBasicBlock *, bool> ReachableMap;
  SmallVector<MachineBasicBlock *, 4> ReachableOrdered;

into:

  MapVector<MachineBasicBlock *, bool> ReachableMap;

because we add elements to the two data structures in lockstep, and we
care about preserving the insertion order.

As a side benefit, we get to avoid hash lookups at:

  ReachableMap[MBB] = true;
2025-03-27 20:34:23 -07:00
wanglei
d055e58334
[LoongArch][MC] Add relocation support for fld fst [x]vld [x]vst
This also fixes errors when using Clang with step-by-step compilation.
Because the optimization will pass relocation information to memory
access instructions. For example:
t.c:
```
float f = 0.1;
float foo() { return f;}
```
```
clang --target=loongarch64 -O2 -c t.c --save-temps
```

Reviewed By: tangaac, SixWeining

Pull Request: https://github.com/llvm/llvm-project/pull/133225
2025-03-28 11:20:17 +08:00
Kazu Hirata
cb80b26e37
[clang] Use *Set::insert_range (NFC) (#133357)
We can use *Set::insert_range to collapse:

  for (auto Elem : Range)
    Set.insert(E);

down to:

  Set.insert_range(Range);

In some cases, we can further fold that into the set declaration.
2025-03-27 20:14:25 -07:00
Kazu Hirata
a1bb750745
[mlir] Use a range constructor of DenseSet (NFC) (#133355) 2025-03-27 20:13:30 -07:00
Jinjie Huang
c8b69c9076
[NFC][SampleFDO] Clean the unneeded field and the related loop (#132376)
Clean the unneeded field 'TotalCollectedSamples' and the unnecessary
loop.
The field seems introduced in:https://reviews.llvm.org/D31952, and its
uses were removed in: https://reviews.llvm.org/D19287, but this field
and unnecessary calculation were not cleaned up.
This patch will remove these unneeded codes.
2025-03-28 11:06:00 +08:00
Florian Mayer
52d7f14a89
Revert "[sanitizer] intercept getservent_r, getservbyname_r, getservbyport_r" (#133358)
Reverts llvm/llvm-project#133339
2025-03-27 22:51:04 -04:00
Jakub Kuderski
f359c0bde5
[mlir][arith] Trim trailing spaces in wide int emulation tests. NFC. (#133349)
Followup cleanup after https://github.com/llvm/llvm-project/pull/132375
and https://github.com/llvm/llvm-project/pull/133248
2025-03-27 22:36:05 -04:00
Lang Hames
14c36db16f [ORC] Generalize GetDylibInterface to support MachO Universal Binaries.
Also adds a testcase for dylib handling in llvm-jitlink`s -weak-lx and
-weak_library options.
2025-03-28 13:28:04 +11:00
wanglei
725a7b664b
[LoongArch] Pre-commit test for #133225
Reviewed By: SixWeining

Pull Request: https://github.com/llvm/llvm-project/pull/133224
2025-03-28 10:21:23 +08:00
Craig Topper
d131b78e06
[RISCV] Disable i1 fixed vectors with more than 1024 elements. (#133267)
v2048i1 is an MVT, but v2048i8 is not so we don't support i8 vectors
with more than 1024 elements. Lowering a v2048i1 shufflevector would
requires promoting to v2048i8. Since v2048i8 isn't legal and isn't an
MVT this leads to a crash.

To fix the crash, this patch makes v2048i1 an illegal type.
2025-03-27 19:12:21 -07:00
Longsheng Mou
a6cb5cc0f0
[mlir] Add nullptr checks in SparseElementsAttr parser (#133222)
This PR adds nullptr checks in the SparseElementsAttr parser to improve
robustness and prevent crashes. Fixes #132891.
2025-03-28 10:11:14 +08:00
Craig Topper
ebe1ece4bb
[TableGen][RISCV] Support sub-operands in CompressInstEmitter.cpp. (#133039)
I'm looking into using sub-operands for memory operands. This would use
MIOperandInfo to create a single operand that contains a register and
immediate as sub-operands. We can treat this as a single operand for
parsing and matching in the assembler. I believe this will provide some
simplifications like removing the InstAliases we need to support "(rs1)"
without an immediate.

Doing this requires making CompressInstEmitter aware of sub-operands.

I've chosen to use a flat list of operands in the CompressPats so each
sub-operand is represented individually.
2025-03-27 19:10:40 -07:00
Matheus Izvekov
89cfeeb062
[clang] fix structural comparison for dependent class member pointer (#133343)
Fixes a regression introduced in
https://github.com/llvm/llvm-project/pull/130537 and reported here
https://github.com/llvm/llvm-project/issues/133144

This fixes a crash in ASTStructuralEquivalence where the non-null
precondition for IsStructurallyEquivalent would be violated, when
comparing member pointers with a dependent class.

This also drive-by fixes the ast node traverser for member pointers so
it doesn't traverse into the qualifier in case it's not a type, or the
class declaration in case it would be equivalent to what the qualifier
refers.

This avoids printing of `<<<NULL>>>` on the text node dumper, which is
redundant.

No release notes since the regression was never released.

Fixes https://github.com/llvm/llvm-project/issues/133144
2025-03-27 22:09:36 -03:00
Hank Chang
d443cd62d2
[ASan] Move early exit checks outside "instrumentFunction()" to avoid… (#133285)
… unnecessary FunctionSanitizer construction (NFC)

This patch moves several early-exit checks (e.g., empty function, etc.)
out of `AddressSanitizer::instrumentFunction` and into the caller. This
change avoids unnecessary construction of FunctionSanitizer when
instrumentation is not needed.
2025-03-28 09:00:30 +08:00
egebeysel
3a3732c252
[mlir][arith] wide integer emulation support for fpto*i ops (#132375)
Adding wide integer emulation support for `arith.fpto*i` operations. As
the other emulated operations, the upper and lower `N` bits of the `i2N`
integer result are emitted separately.

For the unsigned case we use the following emulation

```c
// example is 64 -> 32 bit emulation, but the implementation is generalized to any 2N -> N case
const double TWO_POW_N = (uint_64_t(1) << N); // 2^N, N is the bitwidth of the widest int supported

// f is a floating-point value representing the input of the fptoui op.
uint32_t hi = (uint32_t)(f / TWO_POW_N);         // Truncates the division result
uint32_t lo = (uint32_t)(f - hi * TWO_POW_N);       // Subtracts to get the lower bits.
```

For the signed case, we defer the emulation of the absolute value to
`fptoui` and handle the sign:

```
fptosi(fp) = sign(fp) * fptoui(abs(fp))
```

The edge cases of `NaNs, +-inf` and overflows/underflows are undefined
behaviour and the resulting numbers are the combination of the lower
bitwidth UB values. These operations also propagate poison values.

Signed-off-by: Ege Beysel <beysel@roofline.ai>
2025-03-27 20:58:56 -04:00
Eli Friedman
cd6e959102
Revert "[MC] Explicitly mark MCSymbol for MO_ExternalSymbol" (#133291)
Reverts llvm/llvm-project#108880 .

The patch has no regression test, no description of why the fix is
necessary, and the code is modifying MC datastructures in a way that's
forbidden in the AsmPrinter.

Fixes #132055.
2025-03-27 17:46:42 -07:00
Sam Elliott
75ca080dab
[RISCV][Xqccmp] Correctly Parse/Disassemble pushfp (#133188)
In the `qc.cm.pushfp` instruction, it is like `cm.pushfp` except in one
important way - `qc.cm.pushfp {ra}, -N*16` is not a valid encoding,
because this would update `s0`/`fp`/`x8` without saving it.

This change now correctly rejects this variant of the instruction, both
during parsing and during disassembly. I also implemented validation for
immediates that represent register lists (both kinds), which may help to
catch bugs in the future.
2025-03-27 17:43:26 -07:00
Krzysztof Drewniak
d7c53a91c2
[mlir] Decouple enum generation from attributes, adding EnumInfo and EnumCase (#132148)
This commit pulls apart the inherent attribute dependence of classes
like EnumAttrInfo and EnumAttrCase, factoring them out into simpler
EnumCase and EnumInfo variants. This allows specifying the cases of an
enum without needing to make the cases, or the EnumInfo itself, a
subclass of SignlessIntegerAttrBase.

The existing classes are retained as subclasses of the new ones, both
for backwards compatibility and to allow attribute-specific information.

In addition, the new BitEnum class changes its default printer/parser
behavior: cases when multiple keywords appear, like having both nuw and
nsw in overflow flags, will no longer be quoted by the operator<<, and
the FieldParser instance will now expect multiple keywords. All
instances of BitEnumAttr retain the old behavior.
2025-03-27 19:40:06 -05:00
Craig Topper
f4e14e7cf3 [RISCV] Const correct reference argument to isElementRotate. NFC 2025-03-27 17:23:00 -07:00
Florian Mayer
aa3149d204
[sanitizer] intercept getservent_r, getservbyname_r, getservbyport_r (#133339) 2025-03-27 17:05:37 -07:00
AdityaK
d18faf6460
[MLIR] NFC: Remove unused includes (#133327) 2025-03-27 16:50:47 -07:00
Craig Topper
9cd88847b5 [RISCV] Remove unused MCOperandPredicate from simm12_lsb00000. NFC
I don't think the use of isBareSymbolRef() was correct since we
don't have any relocations associated with this instruction type.
2025-03-27 16:45:58 -07:00
Ryosuke Niwa
2e3c317790
Fix the assertion failure in Analysis/Checkers/WebKit/forward-decl-checker.mm after https://github.com/llvm/llvm-project/pull/132784. (#133341) 2025-03-27 16:45:47 -07:00
Michael Buch
fc33aa9684
[llvm][cmake] Quote CMAKE_CXX_COMPILER_ID in string comparison (#133332)
We're seeing following configuration error when building the `runtimes`
target on our buildbots:
```
CMake Error at /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if):
  if given arguments:

    "STREQUAL" "MSVC"

  Unknown arguments specified
Call Stack (most recent call first):
  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)
  CMakeLists.txt:175 (include)
```

If I understand correctly this happens because ${CMAKE_CXX_COMPILER_ID}
is empty. Quoting it should make the comparison work for those cases.
2025-03-27 16:44:51 -07:00
Walter Lee
5e1fba4243
Revert "[X86] combineINSERT_SUBVECTOR - fold insert_subvector(base,extract_subvector(broadcast)) -> blend shuffle(base,broadcast)" (#133340)
Reverts llvm/llvm-project#133083

This causes BuildBot failures, and causes time outs in some of our internal tests (3 min => over 5 min).
2025-03-27 19:17:02 -04:00
Walter Lee
e9dc0518c9
Revert "Fix gcc signed/unsigned comparison warning. NFC." (#133334)
This reverts commit 6c2171672f03356835c534a0ec18250233ea66db. It touches
a common file as #133083, which is causing failures
2025-03-27 19:12:52 -04:00
Stanislav Mekhanoshin
864d4f940b
[AMDGPU] Trim traling blank in VOP3Instructions.td. NFC. (#133330) 2025-03-27 16:08:14 -07:00
Tom Stellard
a10a913402
workflows: Add missing apt-get update to abi tests (#133264) 2025-03-27 16:01:35 -07:00
LLVM GN Syncbot
a42342265f [gn build] Port d8e44a9ab290 2025-03-27 22:51:31 +00:00
Ryosuke Niwa
a285be320a
[WebKit Checkers] Recognize Objective-C and CF pointer conversion functions. (#132784)
Recognize dynamic_objc_cast, checked_objc_cast, dynamic_cf_cast, and
checked_cf_cast.
2025-03-27 15:47:38 -07:00
Alex Bradbury
c676eb770a [PreISelIntrinsicLowering][test] Add coverage for @llvm.experimental.memset.pattern with ptr pattern argument
These tests all show the desired output because after #132026, the
intrinsic can take any sized type as an argument. The tests were adapted
from those I proposed adding in #129220.
2025-03-27 22:39:11 +00:00
Jonas Devlieghere
c10e26ba2e
[lldb] Improve default statusline colors to work with more color schemes (#133315)
Use the reverse video [1] font effect (`${ansi.negative}`) as the
default for the statusline. Inverting the foreground and background
color has a better change as looking reasonably good, compared to
picking an arbitrary color.

[1] https://en.wikipedia.org/wiki/Reverse_video
2025-03-27 15:38:32 -07:00
Walter Lee
5b7fd708fe
Revert "[DAG] visitEXTRACT_SUBVECTOR - accumulate SimplifyDemandedVectorElts demanded elts across all EXTRACT_SUBVECTOR uses" (#133331)
Reverts llvm/llvm-project#133130

This touches a common file as #133083, which is causing failures
2025-03-27 18:36:38 -04:00