Louis Dionne [Mon, 19 Jun 2023 17:43:17 +0000 (13:43 -0400)]
[libc++] Add missing 'return 0' from main functions in tests
Ellis Hoag [Mon, 19 Jun 2023 17:39:13 +0000 (10:39 -0700)]
[SpecialCaseList] Remove TrigramIndex
`TrigramIndex` was added back in https://reviews.llvm.org/D27188 as an optimization to make `SpecialCaseList::match()` faster. I've found that `TrigramIndex` actually makes the function slower and it has no functional use, so we can remove it.
I grabbed the list of queries passed to `SpecialCaseList::match()` on a random very large file (`AArch64ISelLowering.cpp`) and measured the runtime to call `match()` on all of them with [this line](https://github.com/llvm/llvm-project/blob/
8e1f820bb4eadf5c0704818f6063e0db1006e32d/llvm/lib/Support/SpecialCaseList.cpp#L64) disabled and then enabled.
```
$ hyperfine --warmup 3 'GTEST_FILTER="SpecialCaseListTest.Large" USE_TRIGRAMS=1 build/unittests/Support/SupportTests' 'GTEST_FILTER="SpecialCaseListTest.Large" USE_TRIGRAMS=0 build/unittests/Support/SupportTests'
Benchmark 1: GTEST_FILTER="SpecialCaseListTest.Large" USE_TRIGRAMS=1 build/unittests/Support/SupportTests
Time (mean ± σ): 575.9 ms ± 20.3 ms [User: 573.1 ms, System: 2.7 ms]
Range (min … max): 555.5 ms … 620.0 ms 10 runs
Benchmark 2: GTEST_FILTER="SpecialCaseListTest.Large" USE_TRIGRAMS=0 build/unittests/Support/SupportTests
Time (mean ± σ): 283.4 ms ± 6.7 ms [User: 280.3 ms, System: 3.0 ms]
Range (min … max): 277.0 ms … 294.9 ms 10 runs
Summary
'GTEST_FILTER="SpecialCaseListTest.Large" USE_TRIGRAMS=0 build/unittests/Support/SupportTests' ran
2.03 ± 0.09 times faster than 'GTEST_FILTER="SpecialCaseListTest.Large" USE_TRIGRAMS=1 build/unittests/Support/SupportTests'
```
Using `perf` I found that most of the runtime in `TrigramIndex::isDefinitelyOut()` comes from a division operation that seems to come from `std::unordered_map`: https://github.com/llvm/llvm-project/blob/
8e1f820bb4eadf5c0704818f6063e0db1006e32d/llvm/include/llvm/Support/TrigramIndex.h#L62
Removing `TrigramIndex` will make it easier to potentially switch to using `GlobPattern` instead of a full regex for `SpecialCaseList`. See discussion in https://reviews.llvm.org/D152762 for details.
Reviewed By: MaskRay, #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D153171
Amy Kwan [Sat, 17 Jun 2023 05:33:38 +0000 (00:33 -0500)]
[AIX][TLS] Generate 64-bit local-exec access code sequence
This patch adds support for the TLS local-exec access model on AIX to allow
for the ability to generate the 64-bit (specifically, non-optimized) code sequence.
For this patch in particular, the sequence that is generated involves a load of the
variable offset, followed by an add of the loaded variable offset to r13 (which is
thread pointer, respectively). This code sequence looks like the following:
```
ld reg1,var[TC](2)
add reg2, reg1, r13 // r13 contains the thread pointer
```
The TOC (.tc pseudo-op) entries generated in the assembly files are also
changed where we add the @le relocation for the variable offset.
Differential Revision: https://reviews.llvm.org/D149722
Amy Kwan [Sat, 17 Jun 2023 05:31:35 +0000 (00:31 -0500)]
[AIX][TLS] Relax front end diagnostics to accept the local-exec TLS model
This patch relaxes the front end AIX diagnostics added in D102070 to accept the
local-exec TLS model, as we plan to support this model in a series of future patches.
The diagnostics are relaxed when local-exec is used as a compiler option to
`-ftls-model=*` and in the `__attribute__((tls_model("local-exec")))` attribute.
Differential Revision: https://reviews.llvm.org/D149596
Vladislav Dzhidzhoev [Mon, 19 Jun 2023 17:16:13 +0000 (19:16 +0200)]
Revert "[DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)"
This reverts commit
66511b401042f28c74d2ded3aac76d19a53bd7c4.
llvm/test/DebugInfo/Generic/local-type-as-template-parameter.ll is
broken.
Florian Hahn [Mon, 19 Jun 2023 16:57:05 +0000 (17:57 +0100)]
Recommit "[LSR] Consider post-inc form when creating extends/truncates."
This reverts the revert commit
1797ab36efc9c90c921cd725831f8c3f6a7125a2.
The recommitted version now checks the PostIncLoopSets for all fixups
and returns nullptr if the result doesn't match for all fixups.
Jeffrey Byrnes [Mon, 8 May 2023 18:58:14 +0000 (11:58 -0700)]
[AMDGPU] Add basic support for extended i8 perm matching
Differential Revision: https://reviews.llvm.org/D142782
Change-Id: Ibb95224f7885839e8b77a705f487f10b47a258a6
Benjamin Kramer [Mon, 19 Jun 2023 16:18:07 +0000 (18:18 +0200)]
[mlir] Fix a rare use-after free in dialect loading
applyExtensions can load further dialects, invalidating the reference to
the dialect pointer in the dialects DenseMap. Capture the pointer to
prevent that from happening.
LLVM GN Syncbot [Mon, 19 Jun 2023 16:13:28 +0000 (16:13 +0000)]
[gn build] Port
eb7491769a51
Jay Foad [Mon, 19 Jun 2023 14:39:45 +0000 (15:39 +0100)]
[AMDGPU] Reimplement the GFX11 early release VGPRs optimization
Implement this optimization in SIInsertWaitcnts, where we already have
information about whether there might be outstanding VMEM store
instructions. This has the following advantages:
- Correctly handles atomics-with-return.
- Correctly handles call instructions.
- Should be faster because it does not require running a separate pass.
Differential Revision: https://reviews.llvm.org/D153279
Kun Wu [Mon, 19 Jun 2023 15:57:39 +0000 (15:57 +0000)]
[mlir][sparse][gpu] remove tuple as one of the spmm_buffer_size output type
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D153188
Jeffrey Byrnes [Mon, 8 May 2023 18:43:15 +0000 (11:43 -0700)]
[DAGCombiner][NFC] Factor out ByteProvider
Differential Revision: https://reviews.llvm.org/D143018
Change-Id: I3dc03787a3382c0c3fe6b869f869c2946f450874
Louis Dionne [Mon, 19 Jun 2023 15:53:53 +0000 (11:53 -0400)]
[libc++][NFC] Sort header list in header_information.py
Matt Arsenault [Fri, 10 Dec 2021 23:48:16 +0000 (18:48 -0500)]
AMDGPU: Remove amdgpu-waves-per-eu support in old attribute pass
AMDGPUAttributor now handles this attribute with value merging, so
delete the old approach which could only apply this to functions which
did not set it, or cloned the function.
Matt Arsenault [Thu, 5 Jan 2023 19:50:11 +0000 (14:50 -0500)]
clang: Add __builtin_elementwise_round
Matt Arsenault [Wed, 24 May 2023 11:47:57 +0000 (12:47 +0100)]
ValueTracking: Handle compare to nan and -inf constants in fcmpToClassTest
This will help enable a cleanup of simplifyFCmpInst
Krzysztof Parzyszek [Mon, 19 Jun 2023 15:18:05 +0000 (08:18 -0700)]
[Hexagon] Fix range checks for immediate operands
The output assembly (textual) contains the instruction
r29 = add(r29,#
4294967136)
The value
4294967136 is -160 when interpreted as a signed 32-bit
integer, so it fits in the range of the immediate operand without
a constant extender. The range check in HexagonInstrInfo was putting
the operand value into an int variable, reporting no need for an
extender. This resulted in a packet with 4 instructions, including
the "add". The corresponding check in HexagonMCInstrInfo was using
an int64_t variable, causing the range check to fail, and an extender
to be emitted when lowering to MCInst, resulting in a packet with
too many instructions.
Louis Dionne [Mon, 19 Jun 2023 15:21:15 +0000 (11:21 -0400)]
[NFC] Add libc++ formatting commit to the git-blame ignore file
Louis Dionne [Fri, 16 Jun 2023 13:49:04 +0000 (09:49 -0400)]
[libc++][NFC] Apply clang-format on large parts of the code base
This commit does a pass of clang-format over files in libc++ that
don't require major changes to conform to our style guide, or for
which we're not overly concerned about conflicting with in-flight
patches or hindering the git blame.
This roughly covers:
- benchmarks
- range algorithms
- concepts
- type traits
I did a manual verification of all the changes, and in particular I
applied clang-format on/off annotations in a few places where the
result was less readable after than before. This was not necessary
in a lot of places, however I did find that clang-format had pretty
bad taste when it comes to formatting concepts.
Differential Revision: https://reviews.llvm.org/D153140
Andrea Di Biagio [Mon, 19 Jun 2023 13:37:22 +0000 (14:37 +0100)]
[llvm-mca][TimelineView] Skip invalid entries when printing the json output.
Nikita Popov [Mon, 19 Jun 2023 15:14:37 +0000 (17:14 +0200)]
[CVP] Use simpler urem expansion when LHS >= RHS (PR63330)
In this case we don't need to emit the comparison and select.
This is papering over a weakness in CVP in that newly added
instructions don't get revisited. If they were revisited, the
icmp would be folded at that point.
However, even without that it makes sense to handle this explicitly,
because it avoids the need to insert freeze, which may prevent
further analysis of the operation by LVI.
Proofs: https://alive2.llvm.org/ce/z/quyBxp
Fixes https://github.com/llvm/llvm-project/issues/63330.
Nikita Popov [Mon, 19 Jun 2023 15:04:49 +0000 (17:04 +0200)]
[CVP] Add additional tests for PR63330 (NFC)
Job Noorman [Mon, 19 Jun 2023 14:51:43 +0000 (16:51 +0200)]
[BOLT] Implement composed relocations
BOLT currently assumes (and asserts) that no two relocations can share
the same offset. Although this is true in most cases, ELF has a feature
called (not sure if this is an official term) composed relocations [1]
where multiple relocations at the same offset are combined to produce a
single value.
For example, to support label subtraction (a - b) on RISC-V, two
relocations are emitted at the same offset:
- R_RISCV_ADD32 a + 0
- R_RISCV_SUB32 b + 0
which, when combined, will produce the value of (a - b).
To support this in BOLT, first, RelocationSetType in BinarySection is
changed to be a multiset in order to allow it to store multiple
relocations at the same offset.
Next, Relocation::emit() is changed to receive an iterator pair of
relocations. In most cases, these will point to a single relocation in
which case its behavior is unaltered by this patch. For composed
relocations, they should point to all relocations at the same offset and
the following happens:
- A new method Relocation::createExpr() is called for every relocation.
This method is essentially the same as the original emit() except that
it returns the MCExpr without emitting it.
- The MCExprs of relocations i and i+1 are combined using the opcode
returned by the new method Relocation::getComposeOpcodeFor().
- After combining all MCExprs, the last one is emitted.
Note that in the current patch, getComposeOpcodeFor() simply calls
llvm_unreachable() since none of the current targets use composed
relocations. This will change once the RISC-V target lands.
Finally, BinarySection::emitAsData() is updated to group relocations by
offset and emit them all at once.
Note that this means composed relocations are only supported in data
sections. Since this is the only place they seem to be used in RISC-V, I
believe it's reasonable to only support them there for now to avoid
further code complexity.
[1]: https://www.sco.com/developers/gabi/latest/ch4.reloc.html
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D146546
Mark de Wever [Sat, 17 Jun 2023 13:50:50 +0000 (15:50 +0200)]
[libc++] "Implements" new SI prefixis.
Like yocto, zepto, zetta, and yotta. The new prefixes quecto, ronto,
ronna, and quetta can't be implemented in a intmax_t. So their
implementation does nothing.
Implements
- P2734R0 Adding the new SI prefixes
Depends on D153192
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D153200
Mark de Wever [Tue, 16 Aug 2022 06:15:51 +0000 (08:15 +0200)]
[libc++][regex] Removes operator!=.
Implements part of:
- P1614R2 The Mothership has Landed
Reviewed By: #libc, H-G-Hristov, philnik
Differential Revision: https://reviews.llvm.org/D153222
Mark de Wever [Sun, 18 Jun 2023 10:35:44 +0000 (12:35 +0200)]
[libc++] Marks __cpp_lib_bitops as implemented.
This FTM was introduced in
P0553R4 Bit operations
Which has been implemented since libc++ 9.
This was noticed while working on D153192.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D153225
Nico Weber [Mon, 19 Jun 2023 14:58:08 +0000 (10:58 -0400)]
[gn] port
6f2e92c10cebca5 better (lld/unittests)
lld/test/Unit/lit.site.cfg.py.in got cleaned up in the reland.
Mark de Wever [Sat, 17 Jun 2023 10:00:23 +0000 (12:00 +0200)]
[libc++] Update status after Varna meeting.
This updates:
- The status tables
- Feature test macros
- New headers for modules
The latter avoids forgetting about modules when implementing the feature
in a new header.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D153192
Nicolas Vasilache [Mon, 19 Jun 2023 14:54:14 +0000 (14:54 +0000)]
[mlir][Vector] Let VectorToLLVM operate on non-ModuleOp
Nicolas Vasilache [Mon, 19 Jun 2023 14:51:12 +0000 (14:51 +0000)]
Revert "[mlir][Vector] Let VectorToLLVM operate on non-ModuleOp"
This reverts commit
aabea3d320c87561fe98b56c9f53cca1c6d18869.
That commit had mistakenly squashed spurious changes in.
Nico Weber [Mon, 19 Jun 2023 14:49:44 +0000 (10:49 -0400)]
Nico Weber [Mon, 19 Jun 2023 14:48:35 +0000 (10:48 -0400)]
Nico Weber [Mon, 19 Jun 2023 14:47:20 +0000 (10:47 -0400)]
Reland "[gn build] Port
2700da5fe28d (lld/unittests etc)"
The lld CL relanded in
6f2e92c10cebca5.
This reverts commit
d76b37e6954ad0cf66f1f3c6a9c70328c45859f3.
David Green [Mon, 19 Jun 2023 14:47:21 +0000 (15:47 +0100)]
[AArch64] Add and expand the testing of fmin/fmax reduction. NFC
For both CodeGen and CostModelling, this adds extran testing for the new
lvm.vector.reduce.fmaximum and lvm.vector.reduce.fminimum intrinsics, as well
as making sure there is test coverage for all the various cases.
Joe Nash [Mon, 12 Jun 2023 21:21:29 +0000 (17:21 -0400)]
[AMDGPU] Fix operand class of v_ldexp_f16 src1
Patch
eece6ba283bd changed the src1 type of v_ldexp_f16 from i32 to
i16. Though semantically src1 is an i16, the hardware reads this operand as an
f16 type, which primarily enables floating point inline constants.
Therefore this patch changes the operand type to f16. It maintains the
current behavior where floating point source modifiers are not allowed
on src1. SDWA sext modifier continues to be allowed.
The test asm and disasm test changes in
eece6ba283bd are reverted,
because the floating point inline constants are allowed.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D153169
Vladislav Dzhidzhoev [Mon, 19 Jun 2023 14:42:05 +0000 (16:42 +0200)]
[DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)
RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544
Similar to imported declarations, the patch tracks function-local types in
DISubprogram's 'retainedNodes' field. DwarfDebug is adjusted in accordance with
the aforementioned metadata change and provided a support of function-local
types scoped within a lexical block.
The patch assumes that DICompileUnit's 'enums field' no longer tracks local
types and DwarfDebug would assert if any locally-scoped types get placed there.
Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>
Differential Revision: https://reviews.llvm.org/D144006
Depends on D144005
Roger Ferrer Ibanez [Mon, 19 Jun 2023 14:37:46 +0000 (14:37 +0000)]
[clang][Serialization][RISCV] Increase the number of reserved predefined type IDs
In D152070 we added many new intrinsic types required for the RISC-V
Vector Extension.
This was crashing when loading the AST as those types are intrinsically
added to the AST (they don't come from the disk).
The total number required now by clang exceeds 400 so increasing the
value to 500 solves the problem. This value was already increased in
D92715 but I assume this has some impact on the on-disk format.
Also add a static assert to avoid this happening again in the future.
Differential Revision: https://reviews.llvm.org/D153111
Florian Hahn [Mon, 19 Jun 2023 14:35:48 +0000 (15:35 +0100)]
[LSR] Add test for for issue leading to revert of
abfeda5af329b5.
Add unit test triggering an assertion with
abfeda5af329b5.
Nicolas Vasilache [Mon, 19 Jun 2023 13:33:30 +0000 (13:33 +0000)]
[mlir][NVGPU] NFC - Add a more convenient C++ builder for nvgpu::MmaSyncOp
Nicolas Vasilache [Mon, 19 Jun 2023 13:26:00 +0000 (13:26 +0000)]
[mlir][Vector] Let VectorToLLVM operate on non-ModuleOp
Restriction to ModuleOp is ancient and unnecessarily restrictive.
Louis Dionne [Wed, 14 Jun 2023 22:36:37 +0000 (15:36 -0700)]
[libc++] Move non operator new definitions outside of new.cpp
This makes it such that new.cpp contains only the definitions of
operator new and operator delete, like its libc++abi counterpart.
Differential Revision: https://reviews.llvm.org/D153136
Nikita Popov [Mon, 19 Jun 2023 13:41:39 +0000 (15:41 +0200)]
[CVP] Don't freeze value if guaranteed non-undef
Avoid inserting the freeze if not necessary, as this allows LVI
to continue reasoning about the expression.
Nikita Popov [Mon, 19 Jun 2023 13:38:35 +0000 (15:38 +0200)]
[CVP] Add test for PR63330 (NFC)
Alexandros Lamprineas [Mon, 19 Jun 2023 10:08:03 +0000 (11:08 +0100)]
[FuncSpec] Promote stack values before specialization.
After each iteration of the function specializer, constant stack values
are promoted to constant globals in order to enable recursive function
specialization. This should also be done once before running the
specializer. Enables specialization of _QMbrute_forcePdigits_2 from
SPEC2017:548.exchange2_r.
Differential Revision: https://reviews.llvm.org/D152799
Adrian Munera [Thu, 15 Jun 2023 19:27:01 +0000 (14:27 -0500)]
[OpenMP] Implement printing TDGs to dot files
This patch implements the "__kmp_print_tdg_dot" function, that prints a task dependency graph into a dot file containing the tasks and their dependencies.
It is activated through a new environment variable "KMP_TDG_DOT"
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D150962
Dmitry Makogon [Thu, 8 Jun 2023 11:56:18 +0000 (18:56 +0700)]
[BBUtils] Don't add 'then' block to a loop if it's terminated with unreachable
SplitBlockAndInsertIfThen utility creates two new blocks,
they're called ThenBlock and Tail (true and false destinations of a conditional
branch correspondingly). The function has a bool parameter Unreachable,
and if it's set, then ThenBlock is terminated with an unreachable.
At the end of the function the new blocks are added to the loop of the split
block. However, in case ThenBlock is terminated with an unreachable,
it cannot belong to any loop.
Differential Revision: https://reviews.llvm.org/D152434
David Truby [Fri, 16 Jun 2023 11:45:54 +0000 (12:45 +0100)]
[mlir] Add support for LLVMIR comdat operation
The LLVM comdat operation specifies how to deduplicate globals with the
same key in two different object files. This is necessary on Windows
where e.g. two object files with linkonce globals will not link unless
a comdat for those globals is specified. It is also supported in the ELF
format.
Differential Revision: https://reviews.llvm.org/D150796
melonedo [Wed, 14 Jun 2023 13:42:57 +0000 (21:42 +0800)]
[RISCV] Add support for XCVbitmanip extension in CV32E40P
Implement XCVbitmanip intrinsics for CV32E40P according to the specification.
This commit is part of a patch-set to upstream the 7 vendor specific extensions of CV32E40P.
Contributors: @CharKeaney, @jeremybennett, @lewis-revill, @liaolucy, @simoncook, @xmj.
Spec: https://github.com/openhwgroup/cv32e40p/blob/
62bec66b36182215e18c9cf10f723567e23878e9/docs/source/instruction_set_extensions.rst
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152915
Louis Dionne [Mon, 12 Jun 2023 17:43:55 +0000 (10:43 -0700)]
[libc++] Split sources for <filesystem>
The operations.cpp file contained the implementation of a ton of
functionality unrelated to just the filesystem operations, and
filesystem_common.h contained a lot of unrelated functionality as well.
Splitting this up into more files will make it possible in the future
to support parts of <filesystem> (e.g. path) on systems where there is
no notion of a filesystem.
Differential Revision: https://reviews.llvm.org/D152377
Louis Dionne [Fri, 16 Jun 2023 15:11:56 +0000 (11:11 -0400)]
[libc++][NFC] Move several .fail.cpp tests to .verify.cpp
A few tests were also straightforward to translate to SFINAE tests
instead, so in a few cases I did that and removed the .fail.cpp test
entirely.
Differential Revision: https://reviews.llvm.org/D153149
Louis Dionne [Fri, 16 Jun 2023 13:52:23 +0000 (09:52 -0400)]
[libc++][NFC] Rename __lower_bound_impl to __lower_bound
For consistency with other algorithms.
Differential Revision: https://reviews.llvm.org/D153141
Matt Arsenault [Tue, 22 Nov 2022 16:24:09 +0000 (11:24 -0500)]
clang/HIP: Remove __llvm_amdgcn_* wrapper hacks
These are leftover hacks from using asm declaratios to access
intrinsics.
Matt Arsenault [Sun, 20 Nov 2022 16:49:35 +0000 (08:49 -0800)]
HIP: Directly call isfinite builtins
Nikita Popov [Mon, 19 Jun 2023 12:40:33 +0000 (14:40 +0200)]
[BasicAA] Add test for PR63266 (NFC)
Akash Banerjee [Mon, 19 Jun 2023 11:46:15 +0000 (12:46 +0100)]
[MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder
Key changes:
- Refactor the createTargetData function to make use of the emitOffloadingArrays and emitOffloadingArraysArgument functions to generate code.
- Added a new emitIfClause helper function to allow handling if clauses in a similar fashion to Clang.
- Updated the MLIR side of code to account for changes to createTargetData.
Depends on D149872
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D146557
David Spickett [Mon, 19 Jun 2023 10:52:06 +0000 (11:52 +0100)]
[lldb][AArch64] Add thread local storage tpidr register
This register is used as the pointer to the current thread
local storage block and is read from NT_ARM_TLS on Linux.
Though tpidr will be present on all AArch64 Linux, I am soon
going to add a second register tpidr2 to this set.
tpidr is only present when SME is implemented, therefore the
NT_ARM_TLS set will change size. This is why I've added this
as a dynamic register set to save changes later.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D152516
Alexandre Ganea [Mon, 19 Jun 2023 11:32:34 +0000 (07:32 -0400)]
Re-land [LLD] Allow usage of LLD as a library
This reverts commit
aa495214b39d475bab24b468de7a7c676ce9e366.
As discussed in https://github.com/llvm/llvm-project/issues/53475 this patch
allows for using LLD-as-a-lib. It also lets clients link only the drivers that
they want (see unit tests).
This also adds the unit test infra as in the other LLVM projects. Among the
test coverage, I've added the original issue from @krzysz00, see:
https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction
Important note: this doesn't allow (yet) linking in parallel. This will come a
bit later hopefully, in subsequent patches, for COFF at least.
Differential revision: https://reviews.llvm.org/D119049
Mehdi Amini [Mon, 19 Jun 2023 09:58:49 +0000 (11:58 +0200)]
Emit MLIR trampoline wrapper function with LLVM private linkage
The wrapper, as most of compiler-generated functions, are intended to serve the
IR for the current module. The safest linkage is to keep these private to avoid
any possible collision with other modules.
Differential Revision: https://reviews.llvm.org/D153255
Mehdi Amini [Mon, 19 Jun 2023 09:23:50 +0000 (11:23 +0200)]
Remove extra closing `)` from MLIR --view-op-graph GraphViz emission
This was a spurious closing parenthese.
Nikita Popov [Mon, 19 Jun 2023 10:27:46 +0000 (12:27 +0200)]
[SCCP] Fix conversion of range to constant for vectors (PR63380)
The ConstantRange specifies the range of the scalar elements in the
vector. When converting into a Constant, we need to create a vector
splat with the correct type. For that purpose, pass in the expected
type for the constant.
Fixes https://github.com/llvm/llvm-project/issues/63380.
Russell Greene [Mon, 19 Jun 2023 09:59:20 +0000 (09:59 +0000)]
lldb: do more than 1 kilobyte at a time to vastly increase binary sync speed
https://github.com/llvm/llvm-project/issues/62750
I setup a simple test with a large .so (~100MiB) that was only present on the target machine
but not present on the local machine, and ran a lldb server on the target and connectd to it.
LLDB properly downloads the file from the remote, but it does so at a very slow speed, even over a hardwired 1Gbps connection!
Increasing the buffer size for downloading these helps quite a bit.
Test setup:
```
$ cat gen.py
print('const char* hugeglobal = ')
for _ in range(1000*500):
print(' "' + '1234'*50 + '"')
print(';')
print('const char* mystring() { return hugeglobal; }')
$ gen.py > huge.c
$ mkdir libdir
$ gcc -fPIC huge.c -Wl,-soname,libhuge.so -o libdir/libhuge.so -shared
$ cat test.c
#include <string.h>
#include <stdio.h>
extern const char* mystring();
int main() {
printf("%d\n", strlen(mystring()));
}
$ gcc test.c -L libdir -l huge -Wl,-rpath='$ORIGIN' -o test
$ rsync -a libdir remote:~/
$ ssh remote bash -c "cd ~/libdir && /llvm/buildr/bin/lldb-server platform --server --listen '*:1234'"
```
in another terminal
```
$ rm -rf ~/.lldb # clear cache
$ cat connect.lldb
platform select remote-linux
platform connect connect://10.0.0.14:1234
file test
b main
r
image list
c
q
$ time /llvm/buildr/bin/lldb --source connect.lldb
```
Times with various buffer sizes:
1kiB (current): ~22s
8kiB: ~8s
16kiB: ~4s
32kiB: ~3.5s
64kiB: ~2.8s
128kiB: ~2.6s
256kiB: ~2.1s
512kiB: ~2.1s
1MiB: ~2.1s
2MiB: ~2.1s
I choose 512kiB from this list as it seems to be the place where the returns start diminishing and still isn't that much memory
My understanding of how this makes such a difference is ReadFile issues a request for each call, and larger buffer means less round trip times. The "ideal" situation is ReadFile() being async and being able to issue multiple of these, but that is much more work for probably little gains.
NOTE: this is my first contribution, so wasn't sure who to choose as a reviewer. Greg Clayton seems to be the most appropriate of those in CODE_OWNERS.txt
Reviewed By: clayborg, jasonmolenda
Differential Revision: https://reviews.llvm.org/D153060
Alexandros Lamprineas [Mon, 19 Jun 2023 09:45:42 +0000 (10:45 +0100)]
[FuncSpec] Add Freeze and CallBase to the InstCostVisitor.
Allows constant folding of such instructions when estimating user bonus.
Differential Revision: https://reviews.llvm.org/D153036
Nikita Popov [Mon, 19 Jun 2023 09:42:21 +0000 (11:42 +0200)]
[InstSimplify] Fold icmp of uadd.sat/usub.sat (PR63381)
Fold uadd.sat(X, Y) uge X and usub.sat(X, Y) ule X to true.
Proof: https://alive2.llvm.org/ce/z/596m9X
Fixes https://github.com/llvm/llvm-project/issues/63381.
Nikita Popov [Mon, 19 Jun 2023 09:29:46 +0000 (11:29 +0200)]
[InstSimplify] Add test for icmp of uadd.sat/usub.sat (NFC)
Jacob Crawley [Mon, 12 Jun 2023 12:52:47 +0000 (12:52 +0000)]
[flang][hlfir] Add hlfir.count intrinsic
Adds a new HLFIR operation for the COUNT intrinsic according to
the design set out in flang/docs/HighLevel.md. This patch includes all
the necessary changes to create a new HLFIR operation and lower it into
the fir runtime call.
Author was @jacob-crawley. Minor adjustments by @tblah
Differential Revision: https://reviews.llvm.org/D152521
Tom Eccles [Wed, 14 Jun 2023 16:23:40 +0000 (16:23 +0000)]
[flang] don't allow conversions between logical and floating point
Codegen only supports conversions between logicals and integers. The
verifier should reflect this.
Differential Revision: https://reviews.llvm.org/D152935
Tom Eccles [Wed, 14 Jun 2023 13:23:00 +0000 (13:23 +0000)]
[flang][hlfir] Fix multiple return declaration type
When the ENTRY statement is used, the same source can return different
types depending on the entry point. These different return values are
storage associated (share the same storage). Previously, this led to the
declaration of the results to all have the largest type. This patch adds
a convert between the stack allocation and the declaration so that the
hlfir.decl gets the right type.
I haven't managed to generate code where this convert converted a
reference to an allocation for a smaller type into an allocation for a
larger one, but I have added an assert just in case.
This is a different solution to https://reviews.llvm.org/D152725, see
discussion there.
Differential Revision: https://reviews.llvm.org/D152931
Dmitry Makogon [Mon, 19 Jun 2023 08:49:47 +0000 (15:49 +0700)]
[Test] Add test for PR62430 showing bug in SCEV mul expression creation (NFC)
Hristo Hristov [Mon, 19 Jun 2023 08:45:58 +0000 (11:45 +0300)]
[libc++][ranges] Mark `views::stride` in progress
Alexandros Lamprineas [Sun, 18 Jun 2023 17:51:45 +0000 (18:51 +0100)]
[FuncSpec][NFC] Improve the unittest coverage.
The specialization bonus is zero in some unittests because the basic blocks
containing the users of the constant arguments are executed less frequently
than the entry block. Sinking them into loops solves that.
Differential Revision: https://reviews.llvm.org/D153230
Momchil Velikov [Mon, 19 Jun 2023 08:11:20 +0000 (09:11 +0100)]
[CodeGenPrepare] Fix for using outdated/corrupt LoopInfo
Some transformation in CodeGenPrepare pass may create and/or delete
basic block, but they don't update the LoopInfo, so the LoopInfo may
end up containing dangling pointers and sometimes reused basic blocks,
which leads to "interesting" non-deterministic behaviour.
These transformations do not seem to alter the loop structure of the
function, and updating the loop info is quite straighforward.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D150384
Change-Id: If8ab3905749ea6be94fbbacd54c5cfab5bc1fba1
Martin Braenne [Thu, 15 Jun 2023 19:07:05 +0000 (19:07 +0000)]
[clang][dataflow] Create `Value`s for integer literals.
This patch includes a test that fails without the fix.
I discovered that we weren't creating `Value`s for integer literals when, in a
different patch, I tried to overwrite the value of a struct field with a literal
for the purposes of a test and was surprised to find that the struct compared
the same before and after the assignment.
This functionality therefore seems useful at least for tests, but is probably
also useful for actual analysis of code.
Reviewed By: ymandel, xazax.hun, gribozavr2
Differential Revision: https://reviews.llvm.org/D152813
Joseph Huber [Mon, 19 Jun 2023 08:25:37 +0000 (03:25 -0500)]
[libc] Disable atomic optimizations for `libc` AMDGPU builds
Recently the AMDGPU backend automatically enables a pass to optimize
atomics. This results in the LTO build taking about 10x longer in all
cases. For now we disable this by default as was the case before the
patch in D152649.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D153232
Ingo Müller [Mon, 19 Jun 2023 07:15:01 +0000 (07:15 +0000)]
[mlir][ExecutionEngine] Only load JITDyLibs without init/destroy funcs.
In https://reviews.llvm.org/D153029, I moved the loading/unloading
mechanisms of shared libraries from the JIT runner to the execution
engine in order to make that mechanism available in the latter
(including its Python bindings). However, I realized that I introduced a
small change in semantic: previously, the JIT runner checked for the
presence of init/destroy functions and only loaded the library as
JITDyLib if they were not present. After I moved the code, all libraries
were loaded as JITDyLib, even if they registered their symbols
explicitly in their init function. I am not sure if this is really a
problem but (1) the previous behavior was different and (2) I guess it
could cause a problem if some symbols are exported through the init
function *and* have public visibility. This patch reestablishes the
original behaviour in the new place of the code.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D153249
Christian Sigg [Mon, 19 Jun 2023 07:26:17 +0000 (09:26 +0200)]
Felix [Mon, 19 Jun 2023 05:54:08 +0000 (05:54 +0000)]
[clang-tidy] Reserved-identifier: Improved AllowedIdentifiers option to support regular expressions
Fixes: https://github.com/llvm/llvm-project/issues/59119
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D152764
Bing1 Yu [Mon, 19 Jun 2023 07:07:36 +0000 (15:07 +0800)]
[X86][AMX] Let Store not be removed if combineCastStore failed
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D152819
Matthias Springer [Mon, 19 Jun 2023 07:04:53 +0000 (09:04 +0200)]
[mlir][transform] SequenceOp: Top-level operations can be used as matchers
As a convenience to the user, top-level sequence ops can optionally be used as matchers: the op type is specified by the type of the block argument.
This is similar to how pass pipeline targets can be specified on the command line (`-pass-pipeline='builtin.module(func.func(...))`).
Differential Revision: https://reviews.llvm.org/D153121
Matthias Springer [Mon, 19 Jun 2023 06:56:49 +0000 (08:56 +0200)]
[mlir][transform] ApplyPatternsOp: Add check to prevent modifying the transform IR
Add an extra check to make sure that transform IR is not getting modified by this op while it is being interpreted. This generally dangerous and we may want to enforce this for all transform ops that modify the payload in the future.
Users should generally try to apply patterns only to the piece of IR where it is needed (e.g., a matched function) and not the entire module (which may contain the transform IR).
This revision is in response to a crash in a downstream compiler that was caused by a dead `transform.structured.match` op that was removed by the GreedyPatternRewriteDriver's DCE while the enclosing sequence was being interpreted.
Differential Revision: https://reviews.llvm.org/D153113
David Green [Mon, 19 Jun 2023 06:52:46 +0000 (07:52 +0100)]
[AArch64] More tablegen patterns for addp of two extracts
Similar to D152245, this adds integer addp patterns, using the larger
v4i32 addp from addp extractlow, extracthi.
David Green [Mon, 19 Jun 2023 06:48:31 +0000 (07:48 +0100)]
[AArch64] Add tablegen patterns for faddp of two extracts
This adds some simple tablegen patterns for converting
`faddp v2f32 extractlow(Rn), v2f32 extracthigh(Rn)` to
`faddp v4f32 Rn, v4f32 Rn` using the q variants of the
instructions, avoiding the extra ext needed to extract
the high lanes. Only the bottom lanes of the new faddp
are used, the second Rn operand is used as a placeholder.
It uses Rn to prevent any false dependencies, but could
equally by undef.
Differential Revision: https://reviews.llvm.org/D152245
luxufan [Mon, 19 Jun 2023 06:15:01 +0000 (14:15 +0800)]
[SCCP][NFC] Regenerate test case
luxufan [Mon, 19 Jun 2023 06:07:42 +0000 (14:07 +0800)]
[SCCP][NFC] Regenerate test case
Yevgeny Rouban [Thu, 8 Jun 2023 09:32:12 +0000 (16:32 +0700)]
[LoopUnrollRuntime] Allow indirect transition to deopt non-latch exit blocks
Relax condition on runtime trip count unrolling loops with 1 non-latch exit
that leads to a deop block.
There are cases when the deopt blocks are common exits for different loops.
LoopSimplify pass splits such edges to the common deopting blocks to make
sure that all exit nodes of the loop only have predecessors that are inside
of the loop (See simplifyOneLoop()). This breaks the current condition for
unrolling. This patch allows the split transitive blocks that still lead to
the deopting blocks.
Differential Revision: https://reviews.llvm.org/D152639
Chuanqi Xu [Mon, 19 Jun 2023 02:35:16 +0000 (10:35 +0800)]
Recommit [ABI] [C++20] [Modules] Don't generate vtable if the class is defined in other module unit
Close https://github.com/llvm/llvm-project/issues/61940.
The root cause is that clang will generate vtable as strong symbol now
even if the corresponding class is defined in other module units. After
I check the wording in Itanium ABI, I find this is not inconsistent.
Itanium ABI 5.2.3
(https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable) says:
> The virtual table for a class is emitted in the same object containing
> the definition of its key function, i.e. the first non-pure virtual
> function that is not inline at the point of class definition.
So the current behavior is incorrect. This patch tries to address this.
Also I think we need to do a similar change for MSVC ABI. But I don't
find the formal wording. So I don't address this in this patch.
Reviewed By: rjmccall, iains, dblaikie
Differential Revision: https://reviews.llvm.org/D150023
Fangrui Song [Mon, 19 Jun 2023 02:30:16 +0000 (19:30 -0700)]
[XRay] Mark Mach-O xray_instr_map and xray_fn_idx as S_ATTR_LIVE_SUPPORT
Add the `S_ATTR_LIVE_SUPPORT` attribute to the sections so that `ld -dead_strip`
will retain subsections that reference live functions, once we we add linker
private "l" symbols as atoms.
Jianjian GUAN [Fri, 16 Jun 2023 08:58:24 +0000 (16:58 +0800)]
[RISCV] Match shl (ext v, splat 1) to vector widening add.
Since we use match shl (v, splat 1) to vadd, we could also expand to widening add.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D153112
Fangrui Song [Mon, 19 Jun 2023 00:49:53 +0000 (17:49 -0700)]
[MC] flushPendingLabels: set Atom for new fragment after D71368
Fixes:
c26c5e47ab9ca60835f191c90fa751e9a7dd0f3d (essentially a no-op)
The newly created MCDataFragment should inherit Atom (see
MCMachOStreamer::finishImpl). To the best of my knowledge, this change cannot be
tested at present, but this is important to ensure
MCExpr.cpp:AttemptToFoldSymbolOffsetDifference gives the same result in case we
evaluate the expression again with a MCAsmLayout.
In the following case,
```
.section __DATA,xray_instr_map
lxray_sleds_start1:
.space 16
Lxray_sleds_end1:
.section __DATA,xray_fn_idx
.quad (Lxray_sleds_end1-lxray_sleds_start1)>>4 // can be folded without a MCAsmLayout
```
When we have a MCAsmLayout, without this change, evaluating
(Lxray_sleds_end1-lxray_sleds_start1)>>4 again will fail due to
`FA->getAtom() == nullptr && FB.getAtom() != nullptr` in
MachObjectWriter::isSymbolRefDifferenceFullyResolvedImpl, called by
AttemptToFoldSymbolOffsetDifference.
Fangrui Song [Mon, 19 Jun 2023 00:18:38 +0000 (17:18 -0700)]
[MC] Fold A-B when A is a pending label or A/B are separated by a MCFillFragment
When the MCAssembler is non-null and the MCAsmLayout is null, we can fold A-B
in these additional cases:
* when A is a pending label (will be reassigned to a real fragment in flushPendingLabels())
* A and B are separated by a MCFillFragment with a constant size
Fangrui Song [Sun, 18 Jun 2023 23:00:18 +0000 (16:00 -0700)]
[MC] Remove unneeded MCDataFragment check from AttemptToFoldSymbolOffsetDifference
If FA == FB, we can use SA.getOffset() - SB.getOffset() even if FA is
not a MCDataFragment, as the only case this can be problematic
(different offsets for a variable-size fragment) is invalid/unreachable.
If FA != FB, the `if (FI->getKind() != MCFragment::FT_Data)` check below
can bail out correctly.
This change will help Mach-O fold more expressions. For ELF this is NFC,
unless evaluateFixup has a bug that would evaluate an expression
differently.
Fangrui Song [Sun, 18 Jun 2023 22:14:21 +0000 (15:14 -0700)]
[MC] flushPendingLabels: set Atom for new fragment after D71368
The newly created MCDataFragment should inherit Atom (see
MCMachOStreamer::finishImpl). I cannot think of a case to test the
behavior, but this is one step towards folding the Mach-O label
difference below and making Mach-O more similar to ELF.
```
.section __DATA,xray_instr_map
lxray_sleds_start1:
.space 16
Lxray_sleds_end1:
.section __DATA,xray_fn_idx
.quad (Lxray_sleds_end1-lxray_sleds_start1)>>4 // error: expected relocatable expression // Mach-O
```
Alfred Persson Forsberg [Sun, 18 Jun 2023 22:08:18 +0000 (23:08 +0100)]
[libc] [NFC] malloc.h: fix include guard typo
Differential Revision: https://reviews.llvm.org/D153231
Fangrui Song [Sun, 18 Jun 2023 20:32:40 +0000 (13:32 -0700)]
[XRay][test] Make tests less sensitive to .Ltmp/Ltmp label changes
Kazu Hirata [Sun, 18 Jun 2023 19:44:00 +0000 (12:44 -0700)]
[Target] Use llvm::is_contained (NFC)
Kazu Hirata [Sun, 18 Jun 2023 18:53:01 +0000 (11:53 -0700)]
[BOLT] Use llvm::is_contained (NFC)
Kazu Hirata [Sun, 18 Jun 2023 18:52:59 +0000 (11:52 -0700)]
[AST] Use DenseMapBase::lookup (NFC)
Hristo Hristov [Mon, 12 Jun 2023 16:10:38 +0000 (19:10 +0300)]
[libc++][spaceship][NFC] P1612R2: Mark remove `operator!=` from "Ranges Library" items as "Complete"
Marked already implemented parts of P1612R2 as "Complete":
- `ranges::iota_view::iterator` https://reviews.llvm.org/D110774
- `iota_view::sentinel` https://reviews.llvm.org/D107396
- `filter_view::iterator` https://reviews.llvm.org/D109086
- `filter_view::sentinel` https://reviews.llvm.org/D109086
- `ranges::transform_view::iterator` https://reviews.llvm.org/D110774
- `transform_view::sentinel` https://reviews.llvm.org/D103056
- `take_view::sentinel` https://reviews.llvm.org/D123600
- `join_view::iterator` https://reviews.llvm.org/D107671
- `join_view::sentinel ` https://reviews.llvm.org/D107671
- `split_view::outer_iterator` https://reviews.llvm.org/D142063
- `split_view::inner_iterator` https://reviews.llvm.org/D142063
Note these operators were added and removed in C++20.
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D152721
Pranav Kant [Sun, 18 Jun 2023 17:51:56 +0000 (17:51 +0000)]
Uday Bondhugula [Sat, 17 Jun 2023 17:57:59 +0000 (23:27 +0530)]
[MLIR] Provide bare pointer memref lowering option on gpu-to-nvvm pass
Provide the bare pointer memref lowering option on gpu-to-nvvm pass.
This is needed whenever we lower memrefs on the host function side and
the kernel calls on the host-side (gpu-to-llvm) with the bare ptr
convention. The GPU module side of the lowering should also "align" and
use the bare pointer convention.
Reviewed By: krzysz00
Differential Revision: https://reviews.llvm.org/D152480
Matt Arsenault [Tue, 22 Nov 2022 17:51:21 +0000 (12:51 -0500)]
clang/HIP: Use __builtin_fmaf16
Missed these in
43fd46fda3c90b014e8a73c62f67af9543ea4d59