Commit Graph

542664 Commits

Author SHA1 Message Date
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
erichkeane
b76bc185a4 [OpenACC][CIR] Add copy/etc clause lowering for 'data'.
These work exactly the same way they do for compute constructs, so this
implements them identically and adds tests. The list of legal modifiers
is different, but that is all handled in Sema.
2025-06-27 08:51:46 -07:00
Alex MacLean
e933cfcfb2 [NVPTX] Fixup NVPTXPrologEpilogPass for opt-bisect-limit (#144136)
Currently, the NVPTXPrologEpilogPass will crash if LIFETIME_START or
LIFETIME_END instructions are encountered. Usually this isn't a problem
since a couple earlier passes will always remove them. However, when
using opt-bisect-limit crashes can occur. This can hinder debugging and
reveals a potential future problem if these optimization passes change
their behavior. https://cuda.godbolt.org/z/E81xxKGdb

This change updates NVPTXPrologEpilogPass and
NVPTXRegisterInfo::eliminateFrameIndex to gracefully handle these
instructions by simply removing them. While I'm here I also did some
general fixup in NVPTXPrologEpilogPass to make it look more like
PrologEpilogInserter (from which it was copied).
2025-06-27 08:31:08 -07:00
Jonas Devlieghere
37b0b0f7d2 [lldb] Add class property for the version string (#145974)
Add a class property for the version string. This allows you to use
access the version string through `lldb.SBDebugger.version` instead of
having to call `lldb.SBDebugger.GetVersionString()`.
2025-06-27 08:30:02 -07:00
Kazu Hirata
a460aa1071 [Sema] Fix a warning
This patch fixes:

  clang/lib/Sema/AnalysisBasedWarnings.cpp:686:23: error: variable
  'FD' set but not used [-Werror,-Wunused-but-set-variable]
2025-06-27 08:15:06 -07:00
Nikita Popov
ec150a9944 [PhaseOrdering] Add test for memset DSE (NFC)
This checks for the interaction with #145474.
2025-06-27 17:04:04 +02:00
Samarth Narang
794edd187c [clang] Suppress noreturn warning if last statement in a function is a throw (#145166)
Fixes https://github.com/llvm/llvm-project/issues/144952
2025-06-27 10:52:22 -04:00
Henrich Lauko
07f1502b86 [CIR] Implement SizedTypeInterface to make isSized hookable (#146045)
Resolves issues pointed out in https://github.com/llvm/llvm-project/pull/143960/files#r2164047625 of needing to update sized list of types on each new type.

This mirrors incubator changes from https://github.com/llvm/clangir/pull/1714
2025-06-27 16:50:01 +02:00
Henrich Lauko
61c0a94a90 [CIR] Refactor type interfaces (#146044)
- Generalizes CIRFPTypeInterface files to CIRTypeInterfaces for future type interfaces additions.
- Renames CIRFPTypeInterface to FPTypeInterface.
- Fixes FPTypeInterface tablegen prefix.

This mirrors incubator changes from https://github.com/llvm/clangir/pull/1713
2025-06-27 16:47:58 +02:00
Krzysztof Parzyszek
dc6d2b841f Revert "[flang][OpenMP] Move lowering of ATOMIC to separate file, NFC" (#146091)
Reverts llvm/llvm-project#146067

This still causes timeouts, e.g.

https://lab.llvm.org/buildbot/#/builders/207/builds/3023/steps/7/logs/stdio
2025-06-27 09:44:16 -05:00
Florian Hahn
3b7b95f78e [VPlan] Support VPWidenSelectRecipe in narrowToSingleScalar.
VPWidenSelectRecipes are single scalars if all their operands are. Add
support for narrowing them to a single scalar VPReplicateRecipe.

This fixes a crash after
https://github.com/llvm/llvm-project/pull/142433 (aa24029319) when
due to a replicate recipe not being converted to single-scalar being
hoisted to the vector preheader.
2025-06-27 15:42:42 +01:00
Kazu Hirata
1df3e0a275 [lldb] Use llvm::is_contained (NFC) (#146012)
llvm::is_contained is shorter than llvm::find plus a comparison.
2025-06-27 07:39:39 -07:00