Vitaly Buka [Fri, 9 Jun 2023 22:27:19 +0000 (15:27 -0700)]
[test][Msan] Move x86 specific tests into subdir
ziqingluo-90 [Fri, 9 Jun 2023 22:37:21 +0000 (15:37 -0700)]
[-Wunsafe-buffer-usage] Add fix-its for function parameters using the `span` strategy
Generate fix-its for function parameters that are raw pointers used
unsafely. Currently, the analyzer fixes one parameter at a time.
Fix-its for a function parameter includes:
- Fix the parameter declaration of the definition, result in a new
overload of the function. We call the function with the original
signature the old overload.
- For any other existing declaration of the old overload, mark it with
the [[unsafe_buffer_usage]] attribute and generate a new overload
declaration next to it.
- Creates a new definition for the old overload, which is simply
defined by a call to the new overload.
Reviewed by: NoQ (Artem Dergachev), t-rasmud (Rashmi Mudduluru), and
jkorous (Jan Korous)
Differential revision: https://reviews.llvm.org/D143048
Alex Langford [Fri, 9 Jun 2023 22:37:09 +0000 (15:37 -0700)]
[lldb][NFCI] Replace some static ConstStrings with StringLiterals in Disassembler
These should have been replaced in
e53e1de57ecc but I missed them
because ConstStrings can be implicitly converted to llvm::StringRefs.
Krzysztof Parzyszek [Fri, 9 Jun 2023 22:33:38 +0000 (15:33 -0700)]
[RDF] Do not use trailing return type after all, NFC
This sort of reverts commit
d3b34b7f3a7cbfc96aea897419f167b5ee19e61a,
the issue with `Use` will be addressed by using fully-qualified name.
Krzysztof Parzyszek [Tue, 6 Jun 2023 19:14:49 +0000 (12:14 -0700)]
[RDF] Stop looking when reached code node in getNextRef with NextOnly
NextOnly tells getNextRef to only check the next node in the chain, and
stop iterating. The loop didn't stop though when the next link pointed
back to the beginning of the circular list.
John McIver [Fri, 9 Jun 2023 21:26:30 +0000 (15:26 -0600)]
[InstCombine] Optimize and of icmps with power-of-2 and contiguous masks
Add an instance combine optimization for expressions of the form:
(%arg u< C1) & ((%arg & C2) != C2) -> %arg u< C2
Where C1 is a power-of-2 and C2 is a contiguous mask starting 1 bit below
C1. This commit resolves GitHub missed-optimization issue #54856.
Validation of scalar tests:
- https://alive2.llvm.org/ce/z/JfKjiU
- https://alive2.llvm.org/ce/z/AruHY_
- https://alive2.llvm.org/ce/z/JAiR6t
- https://alive2.llvm.org/ce/z/S2X2e5
- https://alive2.llvm.org/ce/z/4cycdE
- https://alive2.llvm.org/ce/z/NcDiLP
Validation of vector tests:
- https://alive2.llvm.org/ce/z/ABY6tE
- https://alive2.llvm.org/ce/z/BTJi3s
- https://alive2.llvm.org/ce/z/3BKWpu
- https://alive2.llvm.org/ce/z/RrAbkj
- https://alive2.llvm.org/ce/z/nM6fsN
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D125717
John McIver [Fri, 9 Jun 2023 21:22:25 +0000 (15:22 -0600)]
[InstCombine][NFC] Add tests pre-implementation of issue #54856
Provide both positive and negative testing using scalar and vector values for
issue #54856.
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D143044
Amara Emerson [Fri, 9 Jun 2023 21:37:54 +0000 (14:37 -0700)]
[GlobalISel] Fix D144336 in a different way, by choosing operands from the first of the div/rem insts.
Differential Revision: https://reviews.llvm.org/D144336
Joseph Huber [Fri, 9 Jun 2023 21:08:52 +0000 (16:08 -0500)]
[libc] Fix some tests on NVPTX due to insufficient stack size
A few of these tests were disabled due to failing on NVPTX. After
looking into it the vast majority of these cases were due to
insufficient stack memory. This can be worked around by increasing the
stack size in the loader or by reducing the memory usage in the case of
large string constants.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D152583
Akira Hatanaka [Thu, 8 Jun 2023 23:18:16 +0000 (16:18 -0700)]
Fix regex in test case so that it doesn't match "coverage" in directory
names
The test case was failing because "-f{{[^"]*coverage.*}}" was matching
the following string:
"-fdebug-compilation-dir=/Users/buildslave/jenkins/workspace/coverage/"
Differential Revision: https://reviews.llvm.org/D152485
Yitzhak Mandelbaum [Fri, 9 Jun 2023 20:42:09 +0000 (20:42 +0000)]
[clang-tidy] Fix error in documentation of bugprone-unchecked-optional-access.
The documentation claims that the check recognizes `ASSERT_THAT`, but it doesn't
recognize any googletest macros at the moment. This patch removes the reference.
Arthur Eubanks [Fri, 9 Jun 2023 20:24:06 +0000 (13:24 -0700)]
[test] Use update_test_checks for dse.ll
Matthew Voss [Fri, 9 Jun 2023 19:58:26 +0000 (12:58 -0700)]
[test] Explain the purpose of LLVM :: LTO/Resolution/X86/local-def-dllimport.ll
Requested in https://reviews.llvm.org/D148950#4315575
Paul Kirth [Thu, 8 Jun 2023 21:58:42 +0000 (21:58 +0000)]
[clang-format] Add test case for issue 63170
After https://reviews.llvm.org/D151954 we've noticed some issues w/
clang-format behavior, as outlined in
https://github.com/llvm/llvm-project/issues/63170.
Valid C/C++ files, that were previously accepted, are now rejected by
clang-format, emitting the message:
"The new replacement overlaps with an existing replacement."
This reverts commit
4b9764959dc4b8783e18747c1742ab164e4bc4ee and
d2627cf88d2553a4c2e850430bdb908a4b7d2e52, which depends on it.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D152473
Jay Foad [Fri, 9 Jun 2023 12:44:06 +0000 (13:44 +0100)]
[NewGVN] Fold equivalent freeze instructions
Differential Revision: https://reviews.llvm.org/D152529
Jay Foad [Fri, 9 Jun 2023 12:42:42 +0000 (13:42 +0100)]
[NewGVN] Precommit test for folding freeze
Differential Revision: https://reviews.llvm.org/D152528
Bjorn Pettersson [Fri, 9 Jun 2023 19:36:23 +0000 (21:36 +0200)]
[LoadStoreVectorizer] Optimize check for IsAllocaAccess. NFC
Swap order for checking address space and the strip pointer cast
when analyzing if a load/store is accessing an alloca. This to
make sure we do the cheaper check first.
This is done as a follow up to D152386.
Amir Ayupov [Fri, 9 Jun 2023 19:40:37 +0000 (12:40 -0700)]
[profi][NFC] Refactor SampleProfileInference::initFunction
Initialize and return `FlowFunction` from initFunction->createFlowFunction.
Aligns the interface to `createFlowFunction` in D144500, intent to reuse
in a follow-up.
Reviewed By: spupyrev
Differential Revision: https://reviews.llvm.org/D152216
Johannes Doerfert [Fri, 9 Jun 2023 19:35:02 +0000 (12:35 -0700)]
Update CODE_OWNERS.TXT
Fix my email and add OpenMP-Opt and Attributor to the list.
Fangrui Song [Fri, 9 Jun 2023 19:26:19 +0000 (12:26 -0700)]
[AMDGPU,BPF,SystemZ,WebAssembly] Migrate to new encodeInstruction that uses SmallVectorImpl<char>. NFC
Artem Belevich [Thu, 8 Jun 2023 22:34:43 +0000 (15:34 -0700)]
[NVPTX] Remove few more unneeded fp16 instruction variants
Differential Revision: https://reviews.llvm.org/D152478
Florian Hahn [Fri, 9 Jun 2023 19:05:50 +0000 (20:05 +0100)]
[SCEV] Try smaller ZExts when using loop guard info.
If we didn't find the extact ZExt expr in the rewrite map, check if
there's an entry for a smaller ZExt we can use instead.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149786
Alex Langford [Fri, 9 Jun 2023 18:53:17 +0000 (11:53 -0700)]
[lldb][NFCI] Delete unused member from SymbolFileSymtab
Krzysztof Parzyszek [Fri, 2 Jun 2023 17:47:36 +0000 (10:47 -0700)]
[RDF] Use trailing return type syntax, NFC
The name rdf::Use conflicts with llvm::Use when both namespaces are
used via `using namespace`. Specifically this happened in the declaration
of DataFlowGraph::newUse (in RDFGraph.cpp):
```
using namespace rdf;
Use newUse(...); <-- Lookup conflict for "Use"
```
Since the TRT lookup starts in a different namespace than that of the
leading type, this serves as a workaround. In general the rdf namespace
will not likely be introduced via `using namespace`, so this shouldn't
be a problem elsewhere.
Krzysztof Parzyszek [Fri, 2 Jun 2023 16:07:49 +0000 (09:07 -0700)]
[RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFC
Amara Emerson [Thu, 1 Jun 2023 22:11:24 +0000 (15:11 -0700)]
[GlobalISel] Introduce G_CONSTANT_FOLD_BARRIER and use it to prevent constant folding
hoisted constants.
The constant hoisting pass tries to hoist large constants into predecessors and also
generates remat instructions in terms of the hoisted constants. These aim to prevent
codegen from rematerializing expensive constants multiple times. So we can re-use
this optimization, we can preserve the no-op bitcasts that are used to anchor
constants to the predecessor blocks.
SelectionDAG achieves this by having the OpaqueConstant node, which is just a
normal constant with an opaque flag set. I've opted to avoid introducing a new
constant generic instruction here. Instead, we have a new G_CONSTANT_FOLD_BARRIER
operation that constitutes a folding barrier.
These are somewhat like the optimization hints, G_ASSERT_ZEXT in that they're
eliminated by the generic instruction selection code.
This change by itself has very minor improvements in -Os CTMark overall. What this
does allow is better optimizations when future combines are added that rely on having
expensive constants remain unfolded.
Differential Revision: https://reviews.llvm.org/D144336
River Riddle [Tue, 22 Feb 2022 22:51:37 +0000 (14:51 -0800)]
[mlir] Add support for "promised" interfaces
Promised interfaces allow for a dialect to "promise" the implementation of an interface, i.e.
declare that it supports an interface, but have the interface defined in an extension in a library
separate from the dialect itself. A promised interface is powerful in that it alerts the user when
the interface is attempted to be used (e.g. via cast/dyn_cast/etc.) and the implementation has
not yet been provided. This makes the system much more robust against misconfiguration,
and ensures that we do not lose the benefit we currently have of defining the interface in
the dialect library.
Differential Revision: https://reviews.llvm.org/D120368
Martin Storsjö [Wed, 7 Jun 2023 11:11:30 +0000 (14:11 +0300)]
[llvm-dlltool] Implement the --no-leading-underscore option
This requires being able to opt out from adding the leading underscores
in COFFModuleDefinition. Normally it is added automatically for I386
type targets. We could either move the decision entirely to all
callers, letting the caller check the machine type and decide whether
underscores should be added, or keep the logic mostly as is, but allowing
opting out from the behaviour on I386.
I went with keeping the interface as is for now.
Differential Revision: https://reviews.llvm.org/D152363
Wang [Fri, 9 Jun 2023 18:05:51 +0000 (11:05 -0700)]
[clang/test/CodeGen] Add test coverage for VarBypassDetector handling init statements and condition variables in switch clauses
[VarBypassDetector.cpp](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/VarBypassDetector.cpp) lacks test coverage for handling init statements and condition variables in switch clauses, as is shown in:
https://lab.llvm.org/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/CodeGen/VarBypassDetector.cpp.html#L70
This patch adds test coverage for uncovered lines.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D152412
Kazu Hirata [Fri, 9 Jun 2023 18:00:14 +0000 (11:00 -0700)]
[CodeGen] Fix a warning in release builds
This patch fixes:
llvm/lib/CodeGen/MachineScheduler.cpp:4223:9: error: unused type
alias 'IntervalTy' [-Werror,-Wunused-local-typedef]
Peiming Liu [Fri, 9 Jun 2023 17:22:56 +0000 (17:22 +0000)]
Brings back "[mlir][sparse] moving inbound check for slice driven loop into before block of the WhileOp"
This reverts commit
07b927902d410fefd2ebdec727957767dcd4fd2e.
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D152566
Peiming Liu [Fri, 9 Jun 2023 17:19:21 +0000 (17:19 +0000)]
Revert "[mlir][sparse] moving inbound check for slice driven loop into before block of the WhileOp"
This reverts commit
853d704fd0c4744731870df67ade7249d5440438.
Differential Revision: https://reviews.llvm.org/D152562
Kun Wu [Fri, 9 Jun 2023 16:58:44 +0000 (16:58 +0000)]
[mlir][sparse][gpu] unify dnmat and dnvec handle and ops
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D152465
Peiming Liu [Wed, 7 Jun 2023 23:34:44 +0000 (23:34 +0000)]
[mlir][sparse] moving inbound check for slice driven loop into before block of the WhileOp
This patch changes the while loop generated for iterating over a fully reduced sparse level with affine index expression.
Before:
```
cont = true
while (cont) {
if (inBound()) {
....
cont = true;
} else {
cont = false;
}
}
```
After:
```
while(inBound()) {
....
}
```
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D152463
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