Commit Graph

486862 Commits

Author SHA1 Message Date
Jie Fu
0d51c8704c [X86] Fix -Wsign-compare in X86MCInstLower.cpp (NFC)
llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:1867:20:
 error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
      if (SclWidth == C->getType()->getScalarSizeInBits()) {
          ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
2024-01-19 22:38:47 +08:00
Jay Foad
ed12388082
[AMDGPU] Do not emit V_DOT2C_F32_F16_e32 on GFX12 (#78709)
That instruction is not supported on GFX12.
Added a testcase which previously crashed without this change.

Co-authored-by: pvanhout <pierre.vanhoutryve@amd.com>
2024-01-19 14:36:27 +00:00
Manish Kausik H
a0b9117454
LoopDeletion: Move EH pad check before the isLoopNeverExecuted Check (#78189)
This commit modifies `LoopDeletion::deleteLoopIfDead` to check if the
exit block of a loop is an EH pad before checking if the loop gets
executed. This handles the case where an unreachable loop has a
landingpad as an Exit block, and the loop gets deleted, leaving leaving
the landingpad without an edge from an unwind clause.

Fixes #76852.
2024-01-19 15:30:20 +01:00
Alexey Bataev
4d11f04b20
[InstCombine] Try to fold trunc(shuffle(zext)) to just a shuffle (#78636)
Tries to remove extra trunc/ext instruction for shufflevector
instructions.
2024-01-19 09:29:01 -05:00
Simon Pilgrim
a2a0089ac3
[X86] movsd/movss/movd/movq - add support for constant comments (#78601)
If we're loading a constant value, print the constant (and the zero upper elements) instead of just the shuffle mask.

This did require me to move the shuffle mask handling into addConstantComments as we can't handle this in the MC layer.
2024-01-19 14:21:26 +00:00
Nikita Popov
d54dfdd1b5
[Clang] Fix build with GCC 14 on ARM (#78704)
GCC 14 defines `__arm_streaming` as a macro expanding to
`[[arm::streaming]]`. Due to the nested macro use, this gets expanded
prior to concatenation.

It doesn't look like C++ has a really clean way to prevent macro
expansion. The best I have found is to use `EMPTY ## X` where `EMPTY` is
an empty macro argument, so this is the hack I'm implementing here.

Fixes https://github.com/llvm/llvm-project/issues/78691.
2024-01-19 15:19:58 +01:00
Yi Wu
5a7f9a5a9c
[flang] use setsid to assign the child to prevent zombie as it will be clean up by init process (#77944)
When using `setsid()` in a child process created by `fork()`, a new
session is created, and the child becomes a session leader. If the
parent process terminates before the child, the child becomes an orphan
and is adopted by the `init` process. The `init` process will eventually
clean up the child process once it exits.

However, killing the parent does not automatically kill the child; the
child will continue running until it exits.
Proper cleanup involves waiting for the child process to exit using
`wait()` or `waitpid()` in the parent process to avoid zombie processes,
but this approach is not valid for `EXECUTE_COMMAND_LINE` with async
mode.
Fix: https://github.com/llvm/llvm-project/issues/77803
2024-01-19 14:18:57 +00:00
jeanPerier
eaa8def929
[flang] Expand parent component in procedure pointer component ref (#78593)
For simplicity, lowering relies on semantics expansion of parent
components in designators.

This was not done in `call x%p()` where `p` is a procedure component
pointer of a parent component of `x`.

Do it and turn lowering TODO into a new lowering TODO for `call bar(x%type_bound_procedure)` (passing a tybe bound procedure is allowed as an extension, but lowering does not handle this extension yet. This is a lowering issue, will do in different patch).
2024-01-19 15:09:25 +01:00
Simon Pilgrim
836dcdb84a [llvm-jitlink] Fix MSVC "not all control paths return a value" warning. NFC. 2024-01-19 14:04:10 +00:00
Simon Pilgrim
aac1a41c11 [llvm-exegesis] Fix MSVC "not all control paths return a value" warning. NFC. 2024-01-19 14:04:09 +00:00
Nikita Popov
0f20d5a8b1 [AsmParser] Deduplicate argument list parsing code (NFC)
The handling for parsing the first argument and all later arguments
was duplicated. Consolidate them into a single loop.
2024-01-19 15:03:12 +01:00
trevyn
d1a2f11feb
[builtins] Mark int_lib.h builtins as static (#69305)
Mark the following symbols as `static` to prevent duplicate definitions:

`__builtin_ctz`
`__builtin_clz`
`__builtin_clzll`
`__builtin_sadd_overflow`

>Without these then all of these functions show up in all object files
which include int_lib.h on Windows. This'll help prevent duplicate
symbols by ensuring they're not exported.

See:

https://github.com/rust-lang/compiler-builtins/issues/167
https://reviews.llvm.org/D34599
2024-01-19 06:02:00 -08:00
Alexey Lapshin
9ff4be640f
[DWARFLinker][NFC] Decrease DWARFLinker dependence on DwarfStreamer. (#77932)
This patch is extracted from #74725.

The DwarfStreamer interface looks overcomplicated and has unnecessary
dependencies. This patch avoids creation of DwarfStreamer by DWARFLinker and
simplifies interface.
2024-01-19 16:57:09 +03:00
Nikita Popov
6f371149c1
[AsmParser] Don't require value numbers to be consecutive (#78171)
Currently, the IR parser requires that %n style numbered values are
consecutive. This means that the IR becomes invalid as soon as you
remove an instruction, argument or block. This makes it very annoying to
modify IR without running it through instnamer first.

I don't think there is any good reason to impose this requirement. This
PR relaxes it to allow value IDs to be non-consecutive, but it still
keeps the requirement that they're increasing (i.e. you can't skip a
value number and then assign it later).

This only implements support for skipping numbers for local values. We
should extend this to global values in the future as well.
2024-01-19 14:55:31 +01:00
Jay Foad
ea9d75aa2a [AMDGPU] Misc formatting fixes. NFC. 2024-01-19 13:50:26 +00:00
Jay Foad
7017efa1a1 Fix typo "widended" 2024-01-19 13:50:26 +00:00
Sander de Smalen
340054e561
[AArch64][SME] Remove combination of private-ZA and preserves_za. (#78563)
The new Clang attributes no longer support the combination of having a
private-ZA function that preserves ZA. The use of __arm_preserves("za")
means that ZA is shared and preserved.

There wasn't that much benefit to the special handling of this, because
in practice it only meant that we'd avoid restoring the lazy-save
afterwards, but it still needed setting up a lazy-save (with the
possibility of using a 0-sized buffer).

Perhaps a new attribute will be added in the future to support this
case, at which point we can revert back some of the changes removed in
this patch. But for now removing this code simplifies things.
2024-01-19 13:48:44 +00:00
Florian Hahn
42fb1fac9e
[VPlan] Use DebugLoc from recipe in VPWidenCallRecipe (NFCI).
Instead of using the debug location of the underlying instruction, use
the debug location from the recipe. This removes an unneeded dependency
of the underlying instruction.
2024-01-19 13:33:03 +00:00
Sirraide
061eb62a90
[Clang] [NFC] Remove default argument in ASTUnit.h (#78566)
This removes a default argument that is currently broken in C++23 mode
due to `std::default_delete` now being `constexpr`. This is a known
problem (see #74963, #59966, #69996, and a couple more), fixing which
will probably take some time, so this at least makes it possible to
compile `ASTUnit.h` in C++23 mode.

Note that we can’t simply include the header that provides the
definition of the class causing the problem either, as that would create
a circular dependency.
2024-01-19 08:29:23 -05:00
Danila Malyutin
9ad7d8f0e4
[Statepoint] Optimize Location structure size (#78600)
Reduce its size from 24 to 12 bytes. Improves memory consumption when
dealing with statepoint-heavy code.
2024-01-19 17:15:36 +04:00
Sam McCall
1ab418beb3
[Tooling] Fix FixedCompilationDatabase with header compile flags (#73913)
Summary:
The logic to strip positional args feels very fragile, but it's terribly
useful
when you want to use a tool on a file and have the exact argv.

Today doesn't work with header-parsing actions because these are
"precompile"
rather than "compile", from tooling's perspective it's all the same.

Reviewers:
kadircet

Subscribers:
2024-01-19 14:02:04 +01:00
Graham Hunter
689da340ed [NFC][LV] Test precommit for interleaved linear args 2024-01-19 12:59:09 +00:00
Daniil Dudkin
24e5229230
[clang-apply-replacements] Deduplicate Implementation of collectReplacementsFromDirectory (NFC) (#78630)
* Convert `collectReplacementsFromDirectory` into a function template.
* Employ explicit specialization to maintain implementation in the
source file.
* Utilize the function template in the source file to eliminate code
duplication.
* Update the documentation for the function.
2024-01-19 15:57:02 +03:00
Matthias Springer
b4f24be7ef
[mlir][bufferization] Simplify helper potentiallyAliasesMemref (#78690)
This commit simplifies a helper function in the ownership-based buffer
deallocation pass. Fixes a potential double-free (depending on the
scheduling of patterns).
2024-01-19 13:22:02 +01:00
Jay Foad
80ccc72ec7
[AMDGPU] Remove GFX12 encoding hack (#78702)
This is no longer needed now that we have implemented GFX12 encoding for
all instructions.
2024-01-19 12:19:29 +00:00
David Spickett
955417ade2 Revert "[llvm][AArch64] Copy all operands when expanding BLR_BTI bundle (#78267)"
This reverts commit 228aecbcf1.

Failing expensive checks: https://lab.llvm.org/buildbot/#/builders/16/builds/59798
2024-01-19 12:06:30 +00:00
Jay Foad
879cbe06ed
[AMDGPU] Fix predicates for BUFFER_ATOMIC_CSUB pattern (#78701)
Use OtherPredicates to avoid interfering with other uses of
SubtargetPredicate for GFX12.
2024-01-19 12:01:31 +00:00
Florian Hahn
74f6ae9f24
[LTO] Require asserts for discard-value-names.ll test.
The test requires asserts, as it depends on the default value for
-lto-discard-value-names at the moment.
2024-01-19 12:00:16 +00:00
Stefan Gränitz
01ba627f43
[llvm-jitlink] Refactor GOT and stubs registration (NFC) (#78365)
Add methods `registerGOTEntry()` and `registerStubEntry()` in
`Session::FileInfo` to factor out generic code from the individual
object type implementations.
2024-01-19 12:38:22 +01:00
Benjamin Chetioui
35121add2e [mlir][NFC] Remove unused variable. 2024-01-19 11:32:19 +00:00
David Spickett
228aecbcf1
[llvm][AArch64] Copy all operands when expanding BLR_BTI bundle (#78267)
Fixes #77915

Previously I based the operand copying on expandCALL_RVMARKER but did
not understand it properly at the time. This lead to me dropping the
arguments of the function being branched to.

This fixes that by copying all operands from the BLR_BTI to the BL/BLR
without skipping anything.

I've updated the existing test by adding function arguments.
2024-01-19 11:22:43 +00:00
Han-Chung Wang
12b676de72
[mlir][vector] Drop innermost unit dims on transfer_write. (#78554) 2024-01-19 03:15:13 -08:00
Mariusz Sikora
2c78f3b860
[AMDGPU][GFX12] Add tests for flat_atomic_pk (#78683) 2024-01-19 12:08:17 +01:00
Sofía Rodríguez
3d4128f7ff
[clang][ExtractAPI] Record availability information only for the target platform (#76823)
Currently, ExtractAPI provides availability information for all
platforms within a given domain. With this change, we narrow down the
output to include availability details only for the specified target
platform, so users can generate the symbol graph with only the
availability information they need, omitting information of the other
platforms.

This change reverts the functionality introduced in
[`57c9780`](https://github.com/llvm/llvm-project/commit/57c9780).

rdar://120419037
2024-01-19 10:56:53 +00:00
Kiran Chandramohan
a90347ecc7 Revert "Revert "[Flang][OpenMP] NFC: Minor refactoring of Reduction lowering code" (#73139)"
This reverts commit c2b3f16fb5.
2024-01-19 10:43:53 +00:00
Mirko Brkušanin
0185c76456
[AMDGPU] Fix test for expensive-checks build (#78687) 2024-01-19 11:32:02 +01:00
Florian Hahn
abdb61f5fd
[VPlan] Introduce VPSingleDefRecipe. (#77023)
This patch introduces a new common base class for recipes defining a
single result VPValue. This has been discussed/mentioned at various
previous reviews as potential follow-up and helps to replace various
getVPSingleValue calls.

PR: https://github.com/llvm/llvm-project/pull/77023
2024-01-19 10:27:53 +00:00
Leon Clark
2759cfa0c3
[AMDGPU] Remove unnecessary add instructions in ctlz.i8 (#77615)
Add custom lowering for ctlz.i8 to avoid multiple add/sub operations.

---------

Co-authored-by: Leon Clark <leoclark@amd.com>
Co-authored-by: Matt Arsenault <Matthew.Arsenault@amd.com>
2024-01-19 10:16:46 +00:00
Tobias Gysi
9dd0eb9c9c
[mlir][llvm] Drop unreachable basic block during import (#78467)
This revision updates the LLVM IR import to support unreachable basic
blocks. An unreachable block may dominate itself and a value defined
inside the block may thus be used before its definition. The import does
not support such dependencies. We thus delete the unreachable basic
blocks before the import. This is possible since MLIR does not have
basic block labels that can be reached using an indirect call and
unreachable blocks can indeed be deleted safely.

Additionally, add a small poison constant import test.
2024-01-19 11:10:57 +01:00
Wang Pengcheng
3d90e1fa94
[TableGen] Integrate TableGen-based macro fusion (#73115)
`Fusion` is inherited from `SubtargetFeature` now. Each definition
of `Fusion` will define a `SubtargetFeature` accordingly.

Method `getMacroFusions` is added to `TargetSubtargetInfo`, which
returns a list of `MacroFusionPredTy` that will be evaluated by
MacroFusionMution.

`getMacroFusions` will be auto-generated if the target has `Fusion`
definitions.
2024-01-19 18:08:09 +08:00
Twice
7ded34576f
[libc++] Implement LWG3940: std::expected<void, E>::value() also needs E to be copy constructible (#71819)
This patch includes the fix for
[LWG3940](https://cplusplus.github.io/LWG/issue3940)
(`std::expected<void, E>::value()` also needs `E` to be copy
constructible)
2024-01-19 10:06:11 +00:00
Aiden Grossman
f670112a59
[llvm-exegesis] Add support for validation counters (#76653)
This patch adds support for validation counters. Validation counters can
be used to measure events that occur during snippet execution like cache
misses to ensure that certain assumed invariants about the benchmark
actually hold. Validation counters are setup within a perf event group,
so are turned on and off at exactly the same time as the "group leader"
counter that measures the desired value.
2024-01-19 02:00:33 -08:00
Hans Wennborg
4619147911 Revert "[sanitizer] Skip /include/c++/ from summary (#78534)"
The test fails on Darwin, see comment on the PR.

> std:: usually is not a cause of the bug.
>
> We now display
> ```
> SUMMARY: AddressSanitizer: allocation-size-too-big path/to/allocator_returns_null.cpp:92:7 in main
> ```
> instead of
>
> ```
> SUMMARY: AddressSanitizer: allocation-size-too-big /usr/lib/../include/c++/13/bits/new_allocator.h:147:27 in std::__new_allocator<char>::allocate(unsigned long, void const*)
> ```
>
> `/include/c++/` matches both libc++ and libstdc++ include paths.

This reverts commit ecd47811b7.
2024-01-19 10:59:05 +01:00
Kareem Ergawy
10317da203
[flang][re-apply] Fix seg fault CodeGenAction::executeAction() (#78672)
If `generateLLVMIR()` fails, we still continue using the module we
failed to generate which causes a seg fault if LLVM code-gen failed for
some reason or another. This commit fixes this issue.

Re-applies PR #78269 and adds LLVM and MLIR dependencies that were
missed in the PR. The missing libs were: `LLVMCore` & `MLIRIR`.

This reverts commit 4fc7506274.
2024-01-19 10:40:25 +01:00
Matthias Springer
4fc128f817
[mlir][bufferization][NFC] Clean up code (#78594)
Clean up code and remove dead code.
2024-01-19 10:20:41 +01:00
LLVM GN Syncbot
805035931e [gn build] Port 4e7cf1b1ed 2024-01-19 09:08:30 +00:00
Timm Baeder
4e7cf1b1ed
[clang][Interp] Add an EvaluationResult class (#71315)
Add an `EvaluationResult` class. This contains the result either as a
`Pointer` or as a `APValue`.

This way, we can inspect the result of the evaluation and diagnose
problems with it (e.g. uninitialized fields in global initializers or
pointers pointing to things they shouldn't point to).
2024-01-19 10:08:03 +01:00
Guillaume Chatelet
508c4efe1e
[libc][NFC] Use Sign in NormalFloat (#78579) 2024-01-19 09:56:01 +01:00
Andrzej Warzyński
ee9c9f3b96
[mlir][vector] Add 2 invalid tests for vector.xfer Ops (#78608) 2024-01-19 08:54:12 +00:00
Fangrui Song
c875567af3 [asan,test] Disable alloca_loop_unpoisoning.cpp on s390{{.*}}
The test (from https://reviews.llvm.org/D7098) is about the interaction
of VLA and alloca where the VLA causes alloca to have the same address.
This is mostly about behavior checking and less about instrumentation
correctness, so I think it is fair to disable it for a platform that
does not work after StackSafetyAnalysis is enabled by default (#77210).
2024-01-19 00:39:23 -08:00