Commit Graph

542675 Commits

Author SHA1 Message Date
AmirHossein PashaeeHir
5ecd21a46a [NFC] Make unwind table internal data structures more accessible (#145804)
All these changes are being used in
[PR#145633](https://github.com/llvm/llvm-project/pull/145633)

`CFIProgram`:
- `addInstruction` methods already exists, but more convenient ones are
private, this PR makes them public

`UnwindLocation`:
- Added a field accessor method for `Dereference` like other field
access methods.
2025-06-27 15:54:47 -07:00
dianqk
c43282ab69 [RelLookupTableConverter] Drop unnamed_addr for GVs in entries to avoid generating GOTPCREL relocations (#146068)
The entry in a relative lookup table is a global variable with a
constant offset, such as `@gv`, `GEP @gv, 1`, and so on.

We cannot only consider the case of a trivial global variable. This PR
handles all cases using the existing `IsConstantOffsetFromGlobal`
function.
2025-06-28 06:42:42 +08:00
Valentin Clement (バレンタイン クレメン)
75175e7230 [flang][cuda] Inline this_thread_block() calls (#146144) 2025-06-27 14:59:29 -07:00
Craig Topper
9a93de58f7 [TableGen] Simplify copying OperandMap entries for tied operands in CompressInstEmitter. NFC
Copy the whole struct instead of copying both fields.
2025-06-27 14:58:53 -07:00
Craig Topper
457c9aec9e [TableGen] Simplify how we calculate NumMIOperands in addDagOperandMapping. NFC
We can use the MIOperandNo and NumMIOperands from the last operand
instead using a loop.
2025-06-27 14:58:39 -07:00
Shafik Yaghmour
8bc61cbfde [Clang][ByteCode][NFC] Avoid copies by using move in Disasm.cpp (#146127)
Static analysis flagged some cases we could avoid copies by using
std::move in Disasm.cpp.
2025-06-27 14:53:20 -07:00
sribee8
f58caed1bc [libc] Changed CharacterConverter returns (#146130)
changed internal CharacterConverter returns to return errno macro when
necessary for consistency.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-27 21:50:09 +00:00
joaosaffran
171aa34e43 [DirectX] Add static sampler support to root signature (#143422)
Implements static samplers parsing from root signature metadata
representation. This is required to support Root Signatures in HLSL.
Closes: #[126641](https://github.com/llvm/llvm-project/issues/126641)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-27 14:30:48 -07:00
Igor Kudrin
442f99d769 [lldb] Fix evaluating expressions without JIT in an object context (#145599)
If a server does not support allocating memory in an inferior process or
when debugging a core file, evaluating an expression in the context of a
value object results in an error:

```
error: <lldb wrapper prefix>:43:1: use of undeclared identifier '$__lldb_class'
   43 | $__lldb_class::$__lldb_expr(void *$__lldb_arg)
      | ^
```

Such expressions require a live address to be stored in the value
object. However, `EntityResultVariable::Dematerialize()` only sets
`ret->m_live_sp` if JIT is available, even if the address points to the
process memory and no custom allocations were made. Similarly,
`EntityPersistentVariable::Dematerialize()` tries to deallocate memory
based on the same check, resulting in an error if the memory was not
previously allocated in `EntityPersistentVariable::Materialize()`.

As an unintended bonus, the patch also fixes a FIXME case in
`TestCxxChar8_t.py`.
2025-06-27 14:30:24 -07:00
Kazu Hirata
9f5061d4f0 [lldb] Fix a typo in documentation (#146115) 2025-06-27 14:26:32 -07:00
Valentin Clement (バレンタイン クレメン)
b2f504ff15 [flang][cuda] Inline this_warp() calls (#146134) 2025-06-27 14:12:17 -07:00
Brad Smith
68239b76f1 [gtest] Fix building on OpenBSD/sparc64 (#145225)
Cherry pick a patch from 1.15.0

Add missing include for raise(3)

7f036c5563
2025-06-27 16:56:17 -04:00
Christopher McGirr
29b1054835 [mlir][linalg] Update pack and unpack documentation (#143903)
* Clarified the `inner_dim_pos` attribute in the case of high
dimensionality tensors.
* Added a 5D examples to show-case the use-cases that triggered this
updated.
* Added a reminder for linalg.unpack that number of elements are not
required to be the same between input/output due to padding being
dropped.

I encountered some odd variations of `linalg.pack` and `linalg.unpack`
while working on some TFLite models and the definition in the
documentation did not match what I saw pass in IR verification.

The following changes reconcile those differences.

---------

Signed-off-by: Christopher McGirr <mcgirr@roofline.ai>
2025-06-27 13:55:26 -07:00
Erich Keane
33d20828d1 [OpenACC][CIR] Implement enter-data + clause lowering (#146146)
'enter data' is a new construct type that requires one of the data
clauses, so we had to wait for all clauses to be ready before we could
commit this. Most of the clauses are simple, but there is a little bit
of work to get 'async' and 'wait' to have similar interfaces in the ACC
dialect, where helpers were added.
2025-06-27 13:47:42 -07:00
Florian Mayer
8d2034cf68 [clang] Add flag fallow-runtime-check-skip-hot-cutoff (#145999)
Co-authored-by: Kazu Hirata <kazu@google.com>
2025-06-27 13:46:54 -07:00
Sarah Spall
23be14b222 [HLSL][SPIRV] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be <N x i32> (#144929)
Instead of converting the type in a RawBuffer to its HLSL type using
'ConvertType', use 'ConvertTypeForMem'.
ConvertTypeForMem handles booleans being i32 and boolean vectors being <
N x i32 >.
Add tests to show booleans and boolean vectors in RawBuffers now have
the correct type of i32, and respectively.
Closes #141089
2025-06-27 13:43:03 -07:00
Amr Hesham
f20ef8520d [CIR][NFC] Fix init llvm::ArrayRef warning (#146147)
Fix init llvm::ArrayRef deprecation warning when initialized with
std::nullopt
2025-06-27 22:39:28 +02:00
Mészáros Gergely
98f7d756e3 [FileCheck] Improve printing variables with escapes (#145865)
Firstly fix FileCheck printing string variables
double-escaped (first regex, then C-style).
    
This is confusing because it is not clear if the printed
value is the literal value or exactly how it is escaped, without
looking at FileCheck's source code.
    
Secondly, only escape when doing so makes it easier to read the value
(when the string contains tabs, newlines or non-printable characters).
When the variable value is escaped, make a note of it in the output too,
in order to avoid confusion.
    
The common case that is motivating this change is variables that contain
windows style paths with backslashes. These were printed as
`"C:\\\\Program Files\\\\MyApp\\\\file.txt"`.
Now prefer to print them as `"C:\Program Files\MyApp\file.txt"`.
Printing the value literally also makes it easier to search for
variables in the output, since the user can just copy-paste it.
2025-06-27 22:39:07 +02:00
Florian Hahn
526701f8dc [LV] Add additional tests for narrowing interleave groups.
Add additional test coverage for narrowing interleave groups with
derived IVs & scalar steps.
2025-06-27 21:18:14 +01:00
Alexey Karyakin
e9c9adcefe [Hexagon] NFC: Reduce the amount of version-specific code (#145812)
There is a lot of redundant code that needs to be modified when new
Hexagon versions are added. Reduce the amount of this redundancy.

- compute ELF flags and attributes based on version feature names;
- simplify EnableHVX option handling by using arch features instead of
arch version enums;
- simplify completeHVXFeatures() by using features;
- delete several unused or redundant functions and constants:
isCPUValid, getCpu, getHexagonCPUSuffix;
- do not set HexagonArchVersion in initializeSubtargetDependencies, it
is set in ParseSubtargetFeatures;

Signed-off-by: Alexey Karyakin <akaryaki@quicinc.com>
2025-06-27 15:05:28 -05:00
Igor Kudrin
21993f0a47 [lldb][NFC] Switch IRMemoryMap::Malloc to return llvm::Expected (#146016)
This will make changes in #145599 a bit nicer.
2025-06-27 13:04:25 -07:00
Sterling-Augustine
254c26d022 Add missing dependency. (#146140)
As in the description.
2025-06-27 12:56:53 -07:00
Amir Ayupov
17328f36f6 [BOLT][test] Fix NFC mismatches in perf2bolt tests (#146148)
zero-density.s causes spurious NFC mismatches, e.g.
https://lab.llvm.org/buildbot/#/builders/92/builds/21380

This is caused by NFC script wrapping llvm-bolt binary only, so that
perf2bolt invocations are replaced by `llvm-bolt --agregate-only` to
achieve perf2bolt behavior. Add `show-density` to the list of flags
wrapping perf2bolt calls to avoid similar issues in the future.

Test Plan:
```
$ bolt/utils/nfc-check-setup.py --switch-back
$ bin/llvm-lit -a tools/bolt/test/X86/zero-density.s
```
2025-06-27 12:52:37 -07:00
Paul Kirth
23daa31341 [llvm] Don't preserve analysis results after EmbedBitcodePass (#146118)
Expensive checks complains when we mark them as preserved. The bitcode
being embedded generally doesn't change anything important in the
module, but some things are modified under ThinLTO, like vtables under
WPD. This became a non-issue when we cloned the module, but after we had
to revert that in #145987, we need to handle this case properly.
2025-06-27 12:49:20 -07:00
Joseph Huber
d34214a85e [libc] Add and use 'cpp::launder' to guard placement new (#146123)
Summary:
In the GPU allocator we reinterpret cast from a void pointer. We know
that an actual object was constructed there according to the C++ object
model, but to make it fully standards compliant we need to 'launder' it
to forward that information to the compiler. Add this function and call
it as appropriate.
2025-06-27 14:34:33 -05:00
vporpo
1eacdddc0c [SandboxVec][SeedCollector][NFC] Replace cl::opt flags with constructor args (#143206)
The `SeedCollector` class gets two new arguments: `CollectStores` and
`CollectLoads`. These replace the `sbvec-collect-seeds` cl::opt flag.
This is done to help with reusing the SeedCollector class in a future
pass. The cl::opt flag is moved to the seed collection pass:
Passes/SeedCollection.cpp
2025-06-27 12:27:25 -07:00
Kazu Hirata
52040b44f6 [ADT] Remove MutableArrayRef(std::array) (NFC) (#146114)
This constructor has been subsumed by another constructor of
MutableArrayRef that takes a parameter whose type has data() and
size() methods.
2025-06-27 11:31:19 -07:00
Kazu Hirata
9d6cbc3c20 [ADT] Deprecate MutableArrayRef(std::nullopt) (#146113)
ArrayRef(std::nullopt) just got deprecated.  This patch does the same
to MutableArrayRef(std::nullopt).  Since there are only a couple of
uses, this patch does migration and deprecation at the same time.
2025-06-27 11:31:11 -07:00
Florian Mayer
71bc606e95 [LowerAllowCheckPass] allow to specify runtime.check hotness (#145998) 2025-06-27 11:28:07 -07:00
Changpeng Fang
6c2e912855 AMDGPU: Add alias tests for load transpose instructions for gfx1250 (#146117) 2025-06-27 11:17:20 -07:00
Farzon Lotfi
5dbd8772fe [DirectX] add support for i64 buffer load/stores (#145047)
fixes #140321

Specifically it fixes ` error: Cannot create BufferLoad operation:
Invalid overload type`
https://hlsl.godbolt.org/z/dTq4q7o58
but no new DML shaders are building. This change now exposes #144747.

The change does two things it adds i64 support for intrinsic expansion
for the `dx_resource_load_typedbuffer`, and
`dx_resource_store_typedbuffer` intrinsics.

It also lets loaded typedbuffers crash more gracefully because of ` auto
*EVI = cast<ExtractValueInst>(U);` is now a `dyn_cast` and
`llvm_unreachable`.
2025-06-27 14:11:56 -04:00
Sterling-Augustine
23f1ba3ee4 Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959) (#146112)
Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#…
(#145959)
    
This reapplies cbf781f0bd, with fixes for
the shared-library build and the unconventional sanitizer-runtime build.

Original Description:

This is the culmination of a series of changes described in [1].
    
Although somewhat large by line count, it is almost entirely mechanical,
creating a new library in DebugInfo/DWARF/LowLevel. This new library has
very minimal dependencies, allowing it to be used from more places than
the normal DebugInfo/DWARF library--in particular from MC.
    
1.
https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-27 11:05:49 -07:00
Shafik Yaghmour
a4be46e0e5 [Clang][ByteCode][NFC] Misc minor performance fixes (#145988)
Static analysis flagged multiple places we could move instead of copy.
In one case I realized we could avoid computing the same thing multiple
times and did that fix instead.
2025-06-27 11:00:16 -07:00
Shubham Sandeep Rastogi
32ef4ceec0 [InstrRef] Skip clobbered EntryValue register recovery (#142478)
This changes the final stage of InstrRef, i.e. the TransferTracker
(which combines the values locations with the variable values), so that
it treats a DEBUG_VALUE of an EntryValue just like a DEBUG_VALUE of a
constant: a location that is never clobbered and can be propagated to
subsequent BBs as long as no other DEBUG_VALUE intrinsics updated the
variable.

We add two tests here:

1. `entry_value_clobbered_stack_copy` that saves a register on the
stack, uses this register as an entry value DBG_VALUE location, and then
clobbers it. Prior to this patch, this test would crash because we would
try to describe a new location for the variable in terms of what was
saved on the stack, and use an invalid expression to do so. This is not
needed as an EntryValue can never be clobbered.

2. `entry_value_gets_propagated`, that tests that an EntryValue
DBG_VALUE is propagated in a diamond-shaped CFG.

This patch is trying to reland
https://github.com/llvm/llvm-project/pull/77938 but also fixes the bug
with InstrRef based LiveDebugValues, where entry values were not being
propagated in a diamond-shaped CFG.
2025-06-27 10:30:29 -07:00
erichkeane
e4d8e06f83 [OpenACC][CIR] Implement present/deviceptr/attach lowering for data
These three are once again are IR clones of what the compute
IR looks like, so this patch is just adding the implementation and
writing sufficient tests.
2025-06-27 10:24:38 -07:00
Farzon Lotfi
778b6a21ec [DirectX] Allow vector Allocas to be transformed into arrays (#145972)
fixes #145782

This change modifies `isArrayOfVectors` into `isVectorOrArrayOfVectors`.
The previous implementation did not support vector to array
transformations. Further it was too simplistic and didn't assume allocas
would create multidimensional arrays.
2025-06-27 13:12:47 -04:00
Hristo Hristov
a19d37044b [libc++] P2944R3: Constrained comparisions - tuple (#145677)
Implements P2944R3 partially, which adds constrained comparisons
`std::tuple`.
The missing overloads introduced in [P2165R4](https://wg21.link/P2165R4)
are not implemented.

Uses
[`__all`](f7af33a9eb/libcxx/include/__type_traits/conjunction.h (L45))
instead of a fold expression, see comment:
https://github.com/llvm/llvm-project/pull/141396#discussion_r2161166077

Relates to #136765

# References

[tuple.rel](https://wg21.link//tuple.rel)
2025-06-27 20:12:18 +03:00
Craig Topper
a3fcfacc35 [TableGen] Simplify verifyDagOpCount in CompressInstEmitter.cpp. NFC
We were counting the number of tied operands in two different loops.
2025-06-27 10:08:03 -07:00
Antonio Frighetto
c11ea449e5 [ValueTracking] Add matchSimpleBinaryIntrinsicRecurrence helper
Similarly to what it is being done to match simple recurrence cycle
relations, attempt to match value-accumulating recurrences of kind:
```
  %umax.acc = phi i8 [ %umax, %backedge ], [ %a, %entry ]
  %umax = call i8 @llvm.umax.i8(i8 %umax.acc, i8 %b)
```
Preliminary work to let InstCombine avoid folding such recurrences,
so that simple loop-invariant computation may get hoisted. Minor
opportunity to refactor out code as well.
2025-06-27 19:04:28 +02:00
sribee8
ac7e391035 [libc] Implemented wcsnlen (#145610)
Implemented wcsnlen and tests for the function.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-27 16:51:37 +00:00
Fangrui Song
af2bf2e544 MC: Remove unneeded MCSymbolRefExpr::VariantKind calls 2025-06-27 09:47:53 -07:00
Andy Kaylor
74cabdb806 [CIR] Add basic support for operator new (#145802)
This adds the code to handle operator new expressions in ClangIR.
2025-06-27 09:43:26 -07:00
Andy Kaylor
3e9fd4966d [CIR] Add support for constructor aliases (#145792)
This change adds support for handling the -mconstructor-aliases option
in CIR. Aliases are not yet correctly lowered to LLVM IR. That will be
implemented in a future change.
2025-06-27 09:43:05 -07:00
erichkeane
2557f99463 [OpenACC][CIR] Implement 'no_create' lowering for data
This lowering ends up being identical to 'create', except it is a
acc.nocreate for the start operation, and it doesn't permit modifier
list. This patch implements this by adding it to the list of permitted
handlers (along with compute), plus adds tests.
2025-06-27 09:27:59 -07:00
Alex MacLean
f03782dd67 [NVPTX] Fixup v2i8 parameter and return lowering (#145585)
This change fixes v2i8 lowering for parameters and returned values. As
part of this work, I move the lowering for return values to use generic
ISD::STORE nodes as these are more flexible and have existing
legalization handling.

Note that calling a function with v2i8 arguments or returns is still not
working but this is left for a subsequent change as this MR is already
fairly large.

Partially addresses #128853
2025-06-27 09:26:10 -07:00
Ramkumar Ramachandra
7613c2412a [LoopInterchange] Use ArrayRef in more places (NFC) (#146077) 2025-06-27 17:22:24 +01:00
Maksim Panchenko
d00c83ef22 [BOLT] Skip creation of new segments (#146023)
When all section contents are updated in-place, we can skip creation of
new segment(s), save disk space, and free up low memory addresses.

Currently, this feature only works with --use-gnu-stack.
2025-06-27 09:12:08 -07:00
Ramkumar Ramachandra
2282d4faa0 [ISel/RISCV] Improve code in lowerFCOPYSIGN (NFC) (#146061) 2025-06-27 17:02:38 +01:00
Craig Topper
9df1c81fee [SelectionDAG] Combine range metadata when loads are CSEd. (#146026)
When CSEing a load with an existing load with different range
metadata, clear the range metadata on the existing
load.

This is conservative, alternatively we could calculate new range
metadata using MDNode::getMostGenericRange. Without a test case I wasn't
sure it was worth it.

MDnode::getMostGenericRange takes a non-const MDNode*, but all of
SelectionDAG
uses const MDNode*. A const_cast will need to be used somewhere or
we need to make the codebase consistent about whether MDNode pointers
should be const or not.

I'm sure this isn't the only place that needs to be updated to handle
the CSE.
    
Fixes #145363.
2025-06-27 08:58:06 -07:00
Craig Topper
375af75efb [RISCV] Simplify the check for when to call EmitLoweredCascadedSelect. NFC (#145930)
Based on the comments and tests, we only want to call
EmitLoweredCascadedSelect on selects of FP registers.

Everytime we add a new branch with immediate opcode, we've been
excluding it here.

This patch switches to checking that the comparison operands are both
registers so branch on immediate is automatically excluded.
2025-06-27 08:56:49 -07:00