Craig Topper [Fri, 9 Jun 2023 16:59:27 +0000 (09:59 -0700)]
[RISCV] Cleanup vmv.v.x isel patterns to look more like other patterns. NFC
Add register classes to output registers. Use simm5 instead of XLenVT
for output immediate.
Arthur Eubanks [Fri, 9 Jun 2023 16:58:08 +0000 (09:58 -0700)]
[gn build] Fix per target runtime directory path
Felipe de Azevedo Piovezan [Sun, 4 Jun 2023 13:30:00 +0000 (09:30 -0400)]
[AppleAccelTable][NFC] Refactor iterator class
The current implementation of the AppleAcceleratorTable::Entry is problematic
for a few reasons:
1. It is heavyweight. Iterators should be cheap, but the current implementation
tracks 3 different integer values, one "Entry" object, and one pointer to the
actual accelerator table. Most of this information is redundant and can be
removed.
2. It performs "memory reads" outside of the dereference operation. This
violates the usual expectations of iterators, whereby we don't access anything
so long as we don't dereference the iterator.
3. It doesn't commit to tracking _one_ thing only. It tries to track both an
"index" into a list of HashData entries and a pointer in a blob of data. For
this reason, it allows for multiple "invalid" states, keeps redundant
information around and is difficult to understand.
4. It couples the interpretation of the data with the iterator increment. As
such, if the *interpretation* fails, the iterator will keep on producing garbage
values without ever indicating so to consumers.
The problem this iterator is trying to solve is simple: we have a blob of data
containing many "HashData" entries and we want to iterate over them. As such,
this commit makes the iterator only track a pointer over that data, and it
decouples the iterator increments from the interpretation of this blob of data.
We maintain the already existing assumption that failures never happen, but now
make it explicit with an assert.
Depends on
D152158
Differential Revision: https://reviews.llvm.org/
D152159
Fangrui Song [Fri, 9 Jun 2023 16:26:37 +0000 (09:26 -0700)]
[Driver] Mark many target-specific driver-only options as TargetSpecific
so that they get an error on other targets. This change uses let statements to
apply `Flags = [TargetSpecific]` to options (mostly -m*) without specifying `Flags`.
Follow-up to
D151590.
For some options, e.g. -mdefault-build-attributes (D31813), -mbranch-likely
(D38168), -mfpu=/-mabi= (
6890b9b71e525020ab58d436336664beede71575), a warning
seems desired in at least certain cases. This is not the best practice, but this
change works around them by not applying `Flags = [TargetSpecific]`.
(
For Intel CPU errata -malign-branch= family options, we also drop the unneeded
NotXarchOption flag. This flag reports an error if the option is used with
-Xarch_*. This error reporting does not seem very useful.
)
LLVM GN Syncbot [Fri, 9 Jun 2023 15:44:13 +0000 (15:44 +0000)]
[gn build] Port
6adb1ca555ec
Caleb Zulawski [Fri, 9 Jun 2023 15:42:26 +0000 (08:42 -0700)]
[WebAssembly] Re-land
8392bf6000ad
Correctly handle single-element vectors to fix an assertion failure. Add tests
that were missing from the original commit.
Differential Revision:
D151782
Nikolas Klauser [Fri, 9 Jun 2023 15:38:07 +0000 (08:38 -0700)]
[libc++] Add concepts that ensure a given iterator meets the syntactic requirements
These concepts are used to ensure valid iterators are passed to PSTL algorithms, but can also be used for other interfaces.
Reviewed By: ldionne, #libc
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/
D150493
Jay Foad [Fri, 9 Jun 2023 14:36:48 +0000 (15:36 +0100)]
[GVN] Fix typo in freeze test case
Differential Revision: https://reviews.llvm.org/
D152539
Matthias Springer [Fri, 9 Jun 2023 14:22:41 +0000 (16:22 +0200)]
[mlir][vector][transform] Expose tensor slice -> transfer folding patterns
Add a new transform op to populate patterns: ApplyFoldTensorSliceIntoTransferPatternsOp.
Differential Revision: https://reviews.llvm.org/
D152531
MineGame159 [Fri, 9 Jun 2023 14:01:43 +0000 (10:01 -0400)]
[libclang] Add CXBinaryOperatorKind and CXUnaryOperatorKind
Adds 2 new functions to the C libclang api for retrieving operator
kinds for binary and unary operators from cursors. Also adds 2
functions for retrieving the spelling of the new enums.
Fixes https://github.com/llvm/llvm-project/issues/29138
Differential Revision: https://reviews.llvm.org/
D150910
Krzysztof Parzyszek [Fri, 9 Jun 2023 13:52:39 +0000 (06:52 -0700)]
[RDF] Remove `constexpr` from `hash
Akira Hatanaka [Fri, 9 Jun 2023 13:41:22 +0000 (06:41 -0700)]
Remove unnecessary metadata check in test
Bjorn Pettersson [Fri, 9 Jun 2023 12:52:43 +0000 (14:52 +0200)]
[SLP] Update X86/schedule_budget.ll test case to show budget impact
The comments and the checks in
test/Transforms/SLPVectorizer/X86/schedule_budget.ll
did not match. After commit
352c46e70716061e99 the vectorization
has happened also with the reduced budget.
This patch is supposed to restore the original intention with the
test case (the one described in the comments). We want to see
that a restricted budget may reduce the amount of vectorization (i.e.
verifying that the -slp-schedule-budget option makes a difference),
while a higher budget still result in vectorization.
Differential Revision: https://reviews.llvm.org/
D152530
Bjorn Pettersson [Wed, 7 Jun 2023 15:44:37 +0000 (17:44 +0200)]
[LoadStoreVectorizer] Only upgrade align for alloca
In commit
2be0abb7fe72ed453 (
D149893) the load store vectorized was
reimplemented. One thing that can happen with the new LSV is that
it can increase the align of alloca and global objects. However,
the code comments indicate that the intention only was to increase
alignment of alloca.
Now we will use stripPointerCasts to analyse if the load/store really
is accessing an alloca (same as getOrEnforceKnownAlignment is using).
And then we only try to change the align if we find an alloca
instruction. This way the code will match better with code comments,
and we won't change alignment of non-stack variables to use the
"StackAdjustedAlignment".
Differential Revision: https://reviews.llvm.org/
D152386
Amir Ayupov [Fri, 9 Jun 2023 13:23:46 +0000 (06:23 -0700)]
[BOLT][NFCI] Use StringRef.split in launchPerfProcess
Use StringRef method instead of reimplementing the splitting.
Incidentally, it also fixes the duplicate printing of the command arguments:
```
PERF2BOLT: spawning perf job to read branch events
Launching perf: /usr/bin/perf script^@-F^@pid,ip,brstack -F^@pid,ip,brstack pid,ip,brstack -f -i
PERF2BOLT: spawning perf job to read mem events
Launching perf: /usr/bin/perf script^@-F^@pid,event,addr,ip -F^@pid,event,addr,ip pid,event,addr,ip -f -i
PERF2BOLT: spawning perf job to read process events
Launching perf: /usr/bin/perf script^@--show-mmap-events --show-mmap-events -f -i
PERF2BOLT: spawning perf job to read task events
Launching perf: /usr/bin/perf script^@--show-task-events --show-task-events -f -i
```
Fixes it to:
```
PERF2BOLT: spawning perf job to read branch events
Launching perf: /usr/bin/perf script -F pid,ip,brstack -f -i
PERF2BOLT: spawning perf job to read mem events
Launching perf: /usr/bin/perf script -F pid,event,addr,ip -f -i
PERF2BOLT: spawning perf job to read process events
Launching perf: /usr/bin/perf script --show-mmap-events -f -i
PERF2BOLT: spawning perf job to read task events
Launching perf: /usr/bin/perf script --show-task-events -f -i
```
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/
D152483
Zain Jaffal [Fri, 9 Jun 2023 13:20:17 +0000 (14:20 +0100)]
[Metadata] Fix `addAnnotationMetadata` when appending a string tuple to an existing MDTuple.
Currently if the MD_Annotation node containd a string node when we add a
string tuple node the string will not be preserved. This change fixes
that issue.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/
D152448
Krzysztof Parzyszek [Thu, 1 Jun 2023 19:00:47 +0000 (12:00 -0700)]
[RDF] Allow RegisterRef to contain register unit
LLVM GN Syncbot [Fri, 9 Jun 2023 13:02:57 +0000 (13:02 +0000)]
[gn build] Port
aee34000f9fb
Francesco Petrogalli [Fri, 9 Jun 2023 11:24:21 +0000 (13:24 +0200)]
[MISched][rework] Introduce and use ResourceSegments.
Re-landing the code that was reverted because of the buildbot failure
in https://lab.llvm.org/buildbot#builders/9/builds/27319.
Original commit message
======================
The class `ResourceSegments` is used to keep track of the intervals
that represent resource usage of a list of instructions that are
being scheduled by the machine scheduler.
The collection is made of intervals that are closed on the left and
open on the right (represented by the standard notation `[a, b)`).
These collections of intervals can be extended by `add`ing new
intervals accordingly while scheduling a basic block.
Unit tests are added to verify the possible configurations of
intervals, and the relative possibility of scheduling a new
instruction in these configurations. Specifically, the methods
`getFirstAvailableAtFromBottom` and `getFirstAvailableAtFromTop` are
tested to make sure that both bottom-up and top-down scheduling work
when tracking resource usage across the basic block with
`ResourceSegments`.
Note that the scheduler tracks resource usage with two methods:
1. counters (via `std::vector<unsigned> ReservedCycles;`);
2. intervals (via `std::map<unsigned, ResourceSegments> ReservedResourceSegments;`).
This patch can be considered a NFC test for existing scheduling models
because the tracking system that uses intervals is turned off by
default (field `bit EnableIntervals = false;` in the tablegen class
`SchedMachineModel`).
Reviewed By: andreadb
Differential Revision: https://reviews.llvm.org/
D150312
Jay Foad [Fri, 9 Jun 2023 11:10:02 +0000 (12:10 +0100)]
[Scalarizer] Scalarize freeze instruction
Differential Revision: https://reviews.llvm.org/
D152518
Jay Foad [Fri, 9 Jun 2023 11:08:47 +0000 (12:08 +0100)]
[Scalarizer] Precommit tests for freeze instruction
Differential Revision: https://reviews.llvm.org/
D152517
Siu Chi Chan [Tue, 6 Jun 2023 19:48:26 +0000 (15:48 -0400)]
[HIP] Instruct lld to go through all archives
Add the --whole-archive flag when linking HIP programs to instruct lld
to go through every archive library to link in all the kernel functions
(entry pointers to the GPU program); otherwise, lld may skip some
library files if there are no more symbols that need to be resolved.
Differential Revision: https://reviews.llvm.org/
D152207
Change-Id: I084d3d606f9cee646f9adc65f4b648c9bcb252e6
Marco Elver [Fri, 9 Jun 2023 12:30:02 +0000 (14:30 +0200)]
Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
Build bots have been failing with:
/usr/bin/ld: read-only segment has dynamic relocations
Remove support for interceptor trampoline on s390, and revert new
implementation of __tls_get_offset.
Simon Pilgrim [Fri, 9 Jun 2023 12:14:04 +0000 (13:14 +0100)]
[GlobalIsel][X86] Update legalization of G_PTR_ADD
Replace the legacy legalizer versions
Add test coverage for 32-bit targets and non-constant ptr offsets
pvanhout [Fri, 9 Jun 2023 07:28:17 +0000 (09:28 +0200)]
[MCP] Do not remove redundant copy for COPY from undef
I don't think we can safely remove the second COPY as redundant in such cases.
The first COPY (which has undef src) may be lowered to a KILL instruction instead, resulting in no COPY being emitted at all.
Testcase is X86 so it's in the same place as other testcases for this function, but this was initially spotted on AMDGPU with the following:
```
renamable $vgpr24 = PRED_COPY undef renamable $vgpr25, implicit $exec
renamable $vgpr24 = PRED_COPY killed renamable $vgpr25, implicit $exec
```
The second COPY waas removed as redundant, and the first one was lowered to a KILL (= removed too), causing $vgpr24 to not have $vgpr25's value.
Fixes SWDEV-401507
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/
D152502
David Stuttard [Thu, 11 May 2023 13:09:38 +0000 (14:09 +0100)]
Reland [AMDGPU] New PAL metadata updates to ps_extra_lds_size and float_mode
New metadata format contains full calculation of field contents for
ps_extra_lds_size (vs old format where the value in RSRC register is used by PAL
to calculate the value required).
Also stop updating float_mode and rely on front end settings for this field.
Differential Revision: https://reviews.llvm.org/
D152247
LLVM GN Syncbot [Fri, 9 Jun 2023 11:24:06 +0000 (11:24 +0000)]
[gn build] Port
f1d1ca3d7434
Francesco Petrogalli [Fri, 9 Jun 2023 11:21:52 +0000 (13:21 +0200)]
Revert "[MISched] Introduce and use ResourceSegments."
Reverted because it produces the following builbot failure at https://lab.llvm.org/buildbot#builders/9/builds/27319:
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/CodeGen/SchedBoundary.cpp: In member function ‘virtual void ResourceSegments_getFirstAvailableAtFromBottom_empty_Test::TestBody()’:
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/CodeGen/SchedBoundary.cpp:395:31: error: call of overloaded ‘ResourceSegments(<brace-enclosed initializer list>)’ is ambiguous
395 | auto X = ResourceSegments({});
| ^
This reverts commit
dc312f0331309692e8d6e06e93b3492b6a40989f.
LLVM GN Syncbot [Fri, 9 Jun 2023 11:17:35 +0000 (11:17 +0000)]
[gn build] Port
dc312f033130
Marco Elver [Fri, 9 Jun 2023 11:07:41 +0000 (13:07 +0200)]
Fix "[compiler-rt] Introduce asm macros for interceptor trampolines"
Add missing ASM_INTERCEPTOR_TRAMPOLINE(setjmp).
Francesco Petrogalli [Fri, 9 Jun 2023 07:06:48 +0000 (09:06 +0200)]
[MISched] Introduce and use ResourceSegments.
The class `ResourceSegments` is used to keep track of the intervals
that represent resource usage of a list of instructions that are
being scheduled by the machine scheduler.
The collection is made of intervals that are closed on the left and
open on the right (represented by the standard notation `[a, b)`).
These collections of intervals can be extended by `add`ing new
intervals accordingly while scheduling a basic block.
Unit tests are added to verify the possible configurations of
intervals, and the relative possibility of scheduling a new
instruction in these configurations. Specifically, the methods
`getFirstAvailableAtFromBottom` and `getFirstAvailableAtFromTop` are
tested to make sure that both bottom-up and top-down scheduling work
when tracking resource usage across the basic block with
`ResourceSegments`.
Note that the scheduler tracks resource usage with two methods:
1. counters (via `std::vector<unsigned> ReservedCycles;`);
2. intervals (via `std::map<unsigned, ResourceSegments> ReservedResourceSegments;`).
This patch can be considered a NFC test for existing scheduling models
because the tracking system that uses intervals is turned off by
default (field `bit EnableIntervals = false;` in the tablegen class
`SchedMachineModel`).
Reviewed By: andreadb
Differential Revision: https://reviews.llvm.org/
D150312
Johannes Reifferscheid [Fri, 9 Jun 2023 10:55:08 +0000 (12:55 +0200)]
Inherit SliceOptions constructor in BackwardSliceOptions.
Reviewed By: csigg
Differential Revision: https://reviews.llvm.org/
D152515
Matthias Springer [Fri, 9 Jun 2023 10:37:46 +0000 (12:37 +0200)]
[mlir][tensor] Add pattern to rewrite tensor.generate as a constant
Only ops with a static tensor type and a constant yield value are rewritten.
Differential Revision: https://reviews.llvm.org/
D152511
Simon Pilgrim [Fri, 9 Jun 2023 10:28:08 +0000 (11:28 +0100)]
[GlobalIsel][X86] Move intrinsics getActionDefinitionsBuilder defs above remaining legacy handling
Johannes Reifferscheid [Fri, 9 Jun 2023 10:21:24 +0000 (12:21 +0200)]
Add a conversion from TransitiveFilter to SliceOptions.
The previous attempt at backwards compatibility was insufficient.
Reviewed By: akuegel
Differential Revision: https://reviews.llvm.org/
D152514
Alex Zinenko [Fri, 9 Jun 2023 09:49:35 +0000 (09:49 +0000)]
[mlir][transform] add a check for nested consumption in ApplyEachOpTrait
ApplyEachOpTrait applies to payload ops associated with its operand
handle one-by-one in order. If a handle is consumed, this usually
indicates that the associated payload ops are erased or rewritten. Add a
check that we don't consume an ancestor payload operation before
consuming its descendant, as the latter is likely to be a dangling
pointer. Transform operations for which this is a legitimate behavior
(i.e., they consume the handle but don't actually erase or rewrite the
payload operation) should implement the interface directly and allow for
repeated handles.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/
D152510
Graham Hunter [Tue, 21 Mar 2023 11:48:49 +0000 (11:48 +0000)]
[LV][AArch64] Allow (limited) interleaving for scalable vectors
This patch uses the (de)interleaving intrinsics introduced in
D141924 to handle vectorization of interleaving groups with a
factor of 2 for scalable vectors.
Reviewed By: fhahn, reames
Differential Revision: https://reviews.llvm.org/
D145163
Matthias Springer [Fri, 9 Jun 2023 10:30:02 +0000 (12:30 +0200)]
[mlir][tensor] Add option to fold only tensor.empty with a single use
This is useful for transformations such as bufferization, which is looking for tensor.extract_slice/insert_slice pairs.
Also fix the documentation of the corresponding tranform op.
Differential Revision: https://reviews.llvm.org/
D152455
Nikita Popov [Thu, 1 Jun 2023 14:14:27 +0000 (16:14 +0200)]
[InstCombine] Replace phi operands in successors of unreachable block
Set these operands to poison, which might allow folding the phi node,
or reduce the use count of an instruction.
Marco Elver [Fri, 9 Jun 2023 10:12:30 +0000 (12:12 +0200)]
Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
Fix inline asm trampoline type. Some architectures will complain:
<inline asm>:8:41: error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>' or "<type>"
8 | .type __interceptor_trampoline_malloc, @function
Just use %function instead, which is what is also used in
sanitizer_asm.h
Mikhail Goncharov [Fri, 9 Jun 2023 10:12:43 +0000 (12:12 +0200)]
[bazel] format bazel files NFC
Matthias Springer [Fri, 9 Jun 2023 09:57:47 +0000 (11:57 +0200)]
[mlir][transform] Simplify TrackingListener test case
Use the default TrackingListener. No need to set up a derived listener just for the test case. This revision is in preparation of a future change that adds a TrackingRewriter infrastructure.
Differential Revision: https://reviews.llvm.org/
D152446
Job Noorman [Fri, 9 Jun 2023 09:57:49 +0000 (11:57 +0200)]
[JITLink][AArch64] Implement R_AARCH64_ADR_PREL_LO21
This relocation is used for the 21-bit immediate in ADR instructions.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/
D151305
Matthias Springer [Fri, 9 Jun 2023 09:41:55 +0000 (11:41 +0200)]
[mlir][transform][NFC] Move TrackingListener to TransformInterfaces.h
A TransformRewriter (with attached TrackingListener) will be added to an interface method in a subsequent revision.
Differential Revision: https://reviews.llvm.org/
D152426
Nikita Popov [Fri, 9 Jun 2023 09:49:09 +0000 (11:49 +0200)]
[SCEV] Remove -verify-scev-maps flag
This is now checked as part of the usual SCEV verification. There
is little value in checking this on each lookup.
These two maps are strictly synchronized nowadays, which was not
the case historically.
Johannes Reifferscheid [Fri, 9 Jun 2023 09:43:04 +0000 (11:43 +0200)]
Add a temporary alias for TransitiveFilter.
This type was removed in
D151520, but downstream dependencies use it. By
introducing a temporary allias, we can give these dependencies a chance to
update their uses of the type and give them a chance to migrate without
breakages.
Reviewed By: csigg
Differential Revision: https://reviews.llvm.org/
D152509
Matthias Springer [Fri, 9 Jun 2023 09:34:32 +0000 (11:34 +0200)]
[mlir][transform] TrackingListener: Distinguish between failure and "should be dropped"
When looking for replacement ops (`findReplacementOp`) distinguish between "no replacement could be found" and "this op should be dropped from the mapping". The latter case will be utilized in a subsequent revision when a payload op is mapped to a consumed handle.
Differential Revision: https://reviews.llvm.org/
D152375
Simon Pilgrim [Fri, 9 Jun 2023 09:36:22 +0000 (10:36 +0100)]
[GlobalIsel][X86] Add 32-bit test coverage to zero count tests
This shows a current problem with G_CTTZ_ZERO_UNDEF result legalizations
Simon Pilgrim [Fri, 9 Jun 2023 09:30:09 +0000 (10:30 +0100)]
[GlobalIsel][X86] legalize-select.mir - add x86-64 test coverage
Simon Pilgrim [Thu, 8 Jun 2023 13:01:12 +0000 (14:01 +0100)]
[GlobalIsel][X86] Update legalization of G_FPEXT/G_FPTRUNC
Replace the legacy legalizer versions
Guillaume Chatelet [Fri, 9 Jun 2023 09:27:36 +0000 (09:27 +0000)]
[libc][NFC] Simplify LibcTest and trim down string allocations
This is a bit of cleanup before working on logging via stream operator (i.e., `EXPECT_XXX() << ...`).
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/
D152503
Nikita Popov [Fri, 9 Jun 2023 09:34:11 +0000 (11:34 +0200)]
[InstCombine] Add tests for phi nodes with dead edges (NFC)
Matthias Springer [Fri, 9 Jun 2023 09:25:44 +0000 (11:25 +0200)]
[mlir][transform] Extract getConsumedHandleOpOperands helper function
This function is extracted from `TransformState::applyTransform`.
Differential Revision: https://reviews.llvm.org/
D152374
Marco Elver [Tue, 30 May 2023 17:27:59 +0000 (19:27 +0200)]
[compiler-rt] Allow 3 simultaneous interceptors on Linux
Rework Linux (and *BSD) interceptors to allow for up to 3 (2 for *BSD)
simultaneous interceptors. See code comments for details.
The main motivation is to support new sampling sanitizers (in the spirit
of GWP-ASan), that have to intercept few functions. Unfortunately, the
reality is that there are user interceptors that exist in the wild.
To support foreign user interceptors, foreign dynamic analysis
interceptors, and compiler-rt interceptors all at the same time,
including any combination of them, this change enables up to 3
interceptors on Linux (2 on *BSD).
v2:
* Revert to to the simpler "weak wrapper -(alias)-> __interceptor"
scheme on architectures that cannot implement a trampoline efficiently
due to complexities of resolving a preemptible symbol (PowerPC64
ELFv2 global entry, and i386 PIC).
* Avoid duplicate intercepted functions in gen_dynamic_list.py, due to
matching __interceptor_X and ___interceptor_X.
* Fix s390 __tls_get_offset.
Reviewed By: dvyukov, MaskRay, vitalybuka
Differential Revision: https://reviews.llvm.org/
D151085
Alexander Shaposhnikov [Fri, 9 Jun 2023 09:26:33 +0000 (09:26 +0000)]
[Clang][CUDA] Disable diagnostics for neon attrs for GPU-side CUDA compilation
Disable diagnostics for neon attributes for GPU-side CUDA compilation.
Test plan: ninja check-all
Differential revision: https://reviews.llvm.org/
D152403
Chuanqi Xu [Fri, 9 Jun 2023 09:18:35 +0000 (17:18 +0800)]
[NFC] remove duplciated unittests for modules
There was an overlook to duplicate the unittests for modules. This patch
removes one of this duplication.
Marco Elver [Fri, 9 Jun 2023 08:41:53 +0000 (10:41 +0200)]
[compiler-rt] Reformat interception macros
Reformat interception macros to be more readable.
NFC.
Petr Hosek [Fri, 9 Jun 2023 07:51:40 +0000 (07:51 +0000)]
[clang] set python3 as required build dependency
The required HTMLLogger include file needs python3 to run
resource_bundle.py to bundle all the html/css/js resources. However, if
user sets -DLLVM_INCLUDE_TESTS=OFF, CMake will not find python3 and the
resource bundler will never be executed. This patch set the python3 as a
required build dependency to fix this problem.
Patch By: Avimitin
Differential Revision: https://reviews.llvm.org/
D152418
Nikita Popov [Fri, 9 Jun 2023 07:32:27 +0000 (09:32 +0200)]
[Clang] Remove typed pointer consistency assertions (NFC)
These are no-ops with opaque pointers.
David Green [Fri, 9 Jun 2023 07:32:26 +0000 (08:32 +0100)]
[TypePromotion] Don't treat bitcast as a Source
This removes BitCasts from isSource in Type Promotion, as I don't believe they
need to be treated as Sources. They will usually be from floats or hoisted
constants, where constants will be handled already.
This fixes #62513, but didn't otherwise cause any differences in the tests I
ran.
Differential Revision: https://reviews.llvm.org/
D152112
pvanhout [Thu, 8 Jun 2023 10:35:21 +0000 (12:35 +0200)]
[AMDGPU] Port no-hsa-graphic-shaders.ll to code object V4
Split from
D146023
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/
D152432
Phoebe Wang [Fri, 9 Jun 2023 06:33:30 +0000 (14:33 +0800)]
[SelectionDAG] Do not salvage with vector node
rG2eb7cbf987f21 added this code, which results in crash for vector
nodes. This patch solves it by skipping for the vector nodes.
Thanks Steve for helping reducing the test case.
Co-authored-by: Steve Merritt <steve.merritt@intel.com>
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/
D152492
Dmitry Makogon [Fri, 9 Jun 2023 06:26:24 +0000 (13:26 +0700)]
[SimpleLoopUnswitch] Verify LoopInfo in turnGuardIntoBranch under a flag
A follow-up for
64397d8. Only do verification if VerifyLoopInfo is
set.
Alex Zinenko [Fri, 9 Jun 2023 06:29:39 +0000 (06:29 +0000)]
[mlir] mark test requiring asserts as such
Pravin Jagtap [Fri, 9 Jun 2023 05:08:44 +0000 (01:08 -0400)]
[AMDGPU] Iterative scan implementation for atomic optimizer.
This patch provides an alternative implementation to DPP for Scan Computations.
An alternative implementation iterates over all active lanes of Wavefront
using llvm.cttz and performs the following steps:
1. Read the value that needs to be atomically incremented using
llvm.amdgcn.readlane intrinsic
2. Accumulate the result.
3. Update the scan result using llvm.amdgcn.writelane intrinsic
if intermediate scan results are needed later in the kernel.
Reviewed By: arsenm, cdevadas
Differential Revision: https://reviews.llvm.org/
D147408
Craig Topper [Fri, 9 Jun 2023 05:05:20 +0000 (22:05 -0700)]
[RISCV] Use computeVLMax and getVScale to simplify code. NFC
Amara Emerson [Sat, 3 Jun 2023 23:12:48 +0000 (16:12 -0700)]
[GlobalISel] Implement some binary reassociations, G_ADD for now
- (op (op X, C1), C2) -> (op X, (op C1, C2))
- (op (op X, C1), Y) -> (op (op X, Y), C1)
Some code duplication with the G_PTR_ADD reassociations unfortunately but no
easy way to avoid it that I can see.
Differential Revision: https://reviews.llvm.org/
D150230
LLVM GN Syncbot [Fri, 9 Jun 2023 03:44:33 +0000 (03:44 +0000)]
[gn build] Port
60eb1da31555
Chuanqi Xu [Fri, 9 Jun 2023 03:21:29 +0000 (11:21 +0800)]
[Modules] [Sema] Don't try to getAcceptableDecls during the iteration of noload_lookups
I found this during the support of modules for clangd. The reason for
the issue is that the iterator returned by noload_lookups is fast-fail
after the lookup table changes by the design of llvm::DenseMap. And
originally the lookup will try to use getAcceptableDecl to filter the
invisible decls. The key point here is that the function
"getAcceptableDecl" wouldn't stop after it find the specific decl is
invisble. It will continue to visit its redecls to find a visible one.
However, such process involves loading decls from external sources,
which results the invalidation.
Note that the use of "noload_lookups" is rare. It is only used in tools
like FixTypos and CodeCompletions. So it is completely fine for the
tranditional compiler. This is the reason why I can't reproduce it by a
lit test.
wangpc [Fri, 9 Jun 2023 03:01:39 +0000 (11:01 +0800)]
[RISCV][NFC] Remove classes/multiclasses for SEW-aware instructions
Instead, we add an argument `isSEWAware` to indicate that the
instruction is SEW-aware. Actually, the only difference is the
name of pseudo instructions.
And we remove postfix `_E` for all classes/multiclasses and remove
argument `sew` since it can be calculated from `log2sew`.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/
D152428
wangpc [Fri, 9 Jun 2023 02:55:59 +0000 (10:55 +0800)]
[RISCV][NFC] Replace log2 with !logtwo
`!logtwo` was added in
D134068.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/
D152422
Haohai Wen [Fri, 9 Jun 2023 01:36:25 +0000 (09:36 +0800)]
[NFC][COFF] Split WinCOFFObjectWriter to WinCOFFWriter
We'd like to support -gsplit-dwarf for Windows COFF. It requires to
write Dwo and NonDwo sections to different output streams.The original
implementation is not designed to do that and there can be only one
MCObjectWriter. This patch split WinCOFFObjectWriter to WinCOFFWriter so
that:
1. WinCOFFObjectWriter can create multiple WinCOFFWriter.
2. Each WinCOFFWriter can separately collect sections it is interested.
3. Each WinCOFFWriter can write to it's own output stream.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/
D152340
Phoebe Wang [Fri, 9 Jun 2023 01:03:58 +0000 (09:03 +0800)]
[X86][BF16] Split vNbf16 vectors according to vNf16
Fixes #63017
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/
D151778
Phoebe Wang [Fri, 9 Jun 2023 01:03:54 +0000 (09:03 +0800)]
[X86][BF16] Share FP16 vector ABI with BF16
The ABI of BF16 is identical to FP16 rather than i16.
Fixes #62997
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/
D151710
Ellis Hoag [Thu, 8 Jun 2023 22:31:07 +0000 (15:31 -0700)]
[InstrProf][compiler-rt] Fix counter section alignment issue
I recently discovered that `.profraw` headers are expected to be 8 byte
aligned.
https://github.com/llvm/llvm-project/blob/
643ba926c1f618401c86dc37e659df795db2e1a0/llvm/lib/ProfileData/InstrProfReader.cpp#L503-L506
When function entry coverage mode is used, function counters are single
bytes, so it is likely that the size of the counters section is not 8
byte aligned. We can add padding after the counters section to guarantee
this.
Reviewed By: kyulee, gulfem
Differential Revision: https://reviews.llvm.org/
D152479
Heejin Ahn [Sat, 3 Jun 2023 09:28:25 +0000 (02:28 -0700)]
[WebAssembly] Error out on invalid personality functions
Without explicitly checking and erroring out, an invalid personality
function, which is not `__gxx_wasm_personality_v0`, caused
a segmentation fault down the line because `WasmEHFuncInfo` was not
created. This explicitly checks the validity of personality functions in
functions with EH pads and errors out explicitly with a helpful error
message. This also adds some more assertions to ensure `WasmEHFuncInfo`
is correctly created and non-null.
Invalid personality functions wouldn't be generated by our Clang, but
can be present in handwritten ll files, and more often, in files
transformed by passes like `metarenamer`, which is often used with
`bugpoint` to simplify names in `bugpoint`-reduced files.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/
D152203
Heejin Ahn [Sat, 20 May 2023 00:55:57 +0000 (17:55 -0700)]
[WebAssembly] Undef invalid DBG_VALUEs after RegColoring
After register coalescing, some `DBG_VALUE`s can have incorrect info.
For example, if a `DBG_VALUE` has a register operand `%0`, but it
resides in a live range of `%1`, it has incorrect info after `%0` and
`%1` are coalesced. See the comments for more details.
This does not have meaningful changes on our variable debug info
coverage or compilation time, which is good news.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/
D151125
Michael Jones [Thu, 8 Jun 2023 23:36:12 +0000 (16:36 -0700)]
[libc][NFC] fix constants not marked constexpr
The constants in the ryu constant tables were not marked constexpr,
only static const. This caused problems when compiling with GCC.
Differential Revision: https://reviews.llvm.org/
D152487
Michael Jones [Thu, 8 Jun 2023 21:25:22 +0000 (14:25 -0700)]
[libc][NFC] land long double table for printf
The Mega Table that printf uses for long doubles with some flags is too
large for the linters, and so has been split out from the main patch.
The main patch: https://reviews.llvm.org/
D150399
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/
D152470
Justin Bogner [Thu, 8 Jun 2023 22:59:38 +0000 (15:59 -0700)]
[C API] Add getters and setters for NUW, NSW, and Exact
This partially addresses Bug 42692; see discussion there.
Adds C API getters and setters for the NUW, NSW, and Exact flags on various
instructions.
Patch by Craig Disselkoen. Thanks!
Differential Revision: https://reviews.llvm.org/D89252
usama hameed [Thu, 8 Jun 2023 23:02:54 +0000 (16:02 -0700)]
Revert "[Sanitizers][Darwin] In DlAddrSymbolizer, return only the module file name instead of the comlpete module path during symbolication."
The commit broke asan_symbolize.py script on Darwin which depended on
using the complete module path to symolize crash traces offline.
This reverts commit
f6ea869f7c043c70722b8db6be94d9ad4cc9eb92.
rdar://
110487521
Joseph Huber [Thu, 8 Jun 2023 22:53:11 +0000 (17:53 -0500)]
[libc] Disable uint test on NVPTX GPUs
This test started failing on Nvidia, we need to disable it to keep the
bot green until we can investigate the root cause.
Differential Revision: https://reviews.llvm.org/
D152481
Alex Langford [Mon, 5 Jun 2023 23:50:24 +0000 (16:50 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValueProperties
In the interest of keeping the ConstString StringPool small, this patch
aims to remove the use of ConstString from OptionValueProperties.
We can maintain quick lookups by using an llvm::StringMap to find the
correct index by name.
Differential Revision: https://reviews.llvm.org/
D152210
Alex Langford [Tue, 6 Jun 2023 22:38:52 +0000 (15:38 -0700)]
[lldb][NFCI] Refactor TypeSystemClang::GetBasicTypeEnumeration
`TypeSystemClang::GetBasicTypeEnumeration(ConstString)` builds up a
giant `UniqueCStringMap<lldb::BasicType>` which is effectively a vector whose elements
are (ConstString, lldb::BasicType). Once sorted, we get to have fairly
quick lookups (O(log n) on average). This is fine, but we can do better
on average with an llvm::StringMap.
This also allows us to simplify the initialization code for the lookup,
no more `once_flag`!
Additionally, I removed unused declarations of related functions from
CompilerType and TypeSystemClang
Differential Revision: https://reviews.llvm.org/
D152315
Alex Langford [Tue, 6 Jun 2023 21:38:08 +0000 (14:38 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValueLanguage
ConstString is simply not needed here.
Differential Revision: https://reviews.llvm.org/
D152310
spupyrev [Wed, 22 Mar 2023 21:18:03 +0000 (14:18 -0700)]
[BOLT] stale profile matching [part 2 out of 2]
This is a first "serious" version of stale profile matching in BOLT. This diff
extends the hash computation for basic blocks so that we can apply a fuzzy
hash-based matching. The idea is to compute several "versions" of a hash value
for a basic block. A loose version of a hash (computed by ignoring instruction
operands) allows to match blocks in functions whose content has been changed,
while stricter hash values (considering instruction opcodes with operands and
even based on hashes of block's successors/predecessors) allow to resolve
collisions. In order to save space and build time, individual hash components
are blended into a single uint64_t.
There are likely numerous ways of improving hash computation but already this
simple variant provides significant perf benefits.
**Perf testing** on the clang binary: collecting data on clang-10 and using it
to optimize clang-11 (with ~1 year of commits in between). Next, we compare
- //stale_clang// (clang-11 optimized with profile collected on clang-10 with **infer-stale-profile=0**)
- //opt_clang// (clang-11 optimized with profile collected on clang-11)
- //infer_clang// (clang-11 optimized with profile collected on clang-10 with **infer-stale-profile=1**)
`LTO-only` mode:
//stale_clang// vs //opt_clang//: task-clock [delta(%): 9.4252 ± 1.6582, p-value: 0.000002]
(That is, there is a ~9.5% perf regression)
//infer_clang// vs //opt_clang//: task-clock [delta(%): 2.1834 ± 1.8158, p-value: 0.040702]
(That is, the regression is reduced to ~2%)
Related BOLT logs:
```
BOLT-INFO: identified 2114 (18.61%) stale functions responsible for 30.96% samples
BOLT-INFO: inferred profile for 2101 (18.52% of all profiled) functions responsible for 30.95% samples
```
`LTO+AutoFDO` mode:
//stale_clang// vs //opt_clang//: task-clock [delta(%): 19.1293 ± 1.4131, p-value: 0.000002]
//infer_clang// vs //opt_clang//: task-clock [delta(%): 7.4364 ± 1.3343, p-value: 0.000002]
Related BOLT logs:
```
BOLT-INFO: identified 5452 (50.27%) stale functions responsible for 85.34% samples
BOLT-INFO: inferred profile for 5442 (50.23% of all profiled) functions responsible for 85.33% samples
```
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/
D146661
Thomas Lively [Thu, 8 Jun 2023 21:36:29 +0000 (14:36 -0700)]
Revert "Improve WebAssembly vector bitmask, mask reduction, and extending"
This reverts commit
8392bf6000ad039bd0e55383d40a05ddf7b4af13.
The commit missed some edge cases that led to crashes. Reverting to resolve
downstream breakage while a fix is pending.
Michael Jones [Thu, 8 Jun 2023 21:33:57 +0000 (14:33 -0700)]
[libc] disable printf Lf tests for float128 plats
The results for the %Lf tests were calculated on 80 bit long double
systems, meaning the results are not necessarily accurate for float128
systems. In future these will be fixed, but for the moment I'm just
turning them off.
Differential Revision: https://reviews.llvm.org/
D152471
Michael Jones [Tue, 28 Mar 2023 18:18:08 +0000 (11:18 -0700)]
[libc] add options to printf decimal floats
This patch adds three options for printf decimal long doubles, and these
can also apply to doubles.
1. Use a giant table which is fast and accurate, but takes up ~5MB).
2. Use dyadic floats for approximations, which only gives ~50 digits of
accuracy but is very fast.
3. Use large integers for approximations, which is accurate but very
slow.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/
D150399
Shafik Yaghmour [Thu, 8 Jun 2023 20:50:42 +0000 (13:50 -0700)]
[Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range
If we provide too large a value for the alignment attribute
APInt::getZExtValue() will assert. This PR adjusts existing check to catch
this case and provide a diagnostic.
This fixes: https://github.com/llvm/llvm-project/issues/50534
Differential Revision: https://reviews.llvm.org/
D152335
Matt Arsenault [Mon, 5 Jun 2023 13:25:25 +0000 (09:25 -0400)]
AMDGPU: Fix regressions in integer mad matching
Undo the canonicalize done in
0cfc6510323fbb5a56a5de23cbc65f7cc30fd34c. Restores some regressed
matching of integer mad. The selection patterns fo the actual mads
don't seem to be properly commuting, so some of the commuted cases are
still missed.
Fixes: SWDEV-363009
Felipe de Azevedo Piovezan [Mon, 5 Jun 2023 11:26:20 +0000 (07:26 -0400)]
[AppleAccelTable][NFC] Improve code readability
This commit does a few minor NFC cleanups:
* A variable was called "Atom", probably trying to claim it was an AtomType.
This was incorrect, it is actually a FormValue.
* LLVM provides a `zip_equal` to express the intent of asserting ranges with the
same size. We change the lookup method to use that.
* The use of tuples made the code slightly difficult to follow, as such we
unpack the tuple with structure binding to improve readability.
Depends on
D152157
Differential Revision: https://reviews.llvm.org/
D152158
Augusto Noronha [Thu, 1 Jun 2023 23:56:56 +0000 (16:56 -0700)]
[lldb] Unconditionally increment depth when printing children
The `target.max-children-depth` setting and `--depth` flag would be
ignored if treating pointer as arrays, fix that by always incrementing
the current depth when printing a new child.
rdar://
109855463
Differential Revision: https://reviews.llvm.org/
D151950
Artem Belevich [Tue, 6 Jun 2023 23:05:08 +0000 (16:05 -0700)]
[NVPTX] Allow using v4i32 for memcpy lowering.
Differential Revision: https://reviews.llvm.org/
D152317
Martin Storsjö [Wed, 7 Jun 2023 10:53:17 +0000 (13:53 +0300)]
[llvm-lib] Pass the right value of MingwDef to parseCOFFModuleDefinition
In llvm-lib cases, the MinGW specific behaviours shouldn't be
enabled.
Not adding any tests to check the corner case behaviours, as this
simply was a mistake when this codepath was added in
395ec4458fb7fc700551f7017c0a395d68c55873 /
D144765.
Differential Revision: https://reviews.llvm.org/
D152362
Martin Storsjö [Wed, 7 Jun 2023 10:41:15 +0000 (13:41 +0300)]
[llvm-dlltool] Ignore the --temp-prefix option
llvm-dlltool tolerates unknown options as long as they are plain
flags, but if given the parameter value as a separate argument,
e.g. "--temp-prefix foo", it fails to ignore it.
Differential Revision: https://reviews.llvm.org/
D152361
Martin Storsjö [Wed, 7 Jun 2023 11:13:55 +0000 (14:13 +0300)]
[llvm-dlltool] Clarify parameters, simplify ArgList usage. NFC.
Add comments about unclear bool arguments to functions, switch to
hasArg instead of getLastArg for cases where we don't need to check
the argument's value.
Differential Revision: https://reviews.llvm.org/
D152360
Martin Storsjö [Wed, 7 Jun 2023 10:55:21 +0000 (13:55 +0300)]
[COFF] Remove misleading and unclear comments. NFC.
It is not planned that GNU binutils would change this aspect of
its behaviour wrt how symbol decoration is done.
Differential Revision: https://reviews.llvm.org/
D152359
Nick Desaulniers [Thu, 8 Jun 2023 18:30:00 +0000 (11:30 -0700)]
[ExprConstant] fix ICE from Evaluate on _Atomic structs
Fixes two crashes reported by @efriedma and @ahatanak, as per
@ahatanak's analysis.
Link: https://reviews.llvm.org/D151587#4397446
Link: https://reviews.llvm.org/D151587#4399684
Reviewed By: ahatanak, aaron.ballman
Differential Revision: https://reviews.llvm.org/
D152303
Matt Arsenault [Sun, 20 Nov 2022 22:31:04 +0000 (14:31 -0800)]
HIP: Directly call copysign builtins