Amaury Séchet [Mon, 25 Jul 2022 01:15:06 +0000 (01:15 +0000)]
[DAG] Use recursivelyDeleteUnusedNodes in PromoteLoad
It simplifies the code overall and removes the need for manual bookkeeping.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D130447
Sebastian Neubauer [Thu, 28 Jul 2022 12:34:59 +0000 (14:34 +0200)]
[CMake][OpenMP] Remove wrong backslash
outdir is defined in the line above, it will not exist in the install
command, so it should not be escaped.
Amaury Séchet [Mon, 25 Jul 2022 00:36:14 +0000 (00:36 +0000)]
[DAG] Use recursivelyDeleteUnusedNodes in ReplaceLoadWithPromotedLoad
It simplifies the code overall and removes the need for manual bookkeeping.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D130444
Alexander Timofeev [Tue, 26 Jul 2022 10:47:09 +0000 (12:47 +0200)]
[AMDGPU] avoid blind converting to VALU REG_SEQUENCE and PHIs
In the
2e29b0138ca243 we introduce a specific solving algorithm
that analyzes the VGPR to SGPR copies use chains and either lowers
the copy to v_readfirstlane_b32 or converts the whole chain to VALU forms.
Same time we still have the code that blindly converts to VALU REG_SEQUENCE and PHIs
in case they produce SGPR but have VGPRs input operands. In case the REG_SEQUENCE and PHIs
are in the VGPR to SGPR copy use chain, and this chain was considered long enough to convert
copy to v_readfistlane_b32, further lowering them to VALU leads to several kinds of issues.
At first, we have v_readfistlane_b32 which is completely useless because most parts of its use chain
were moved to VALU forms. Second, we may encounter subtle bugs related to the EXEC-dependent CF
because of the weird mixing of SALU and VALU instructions.
This change removes the code that moves REG_SEQUENCE and PHIs to VALU. Instead, we use the fact
that both REG_SEQUENCE and PHIs have copy semantics. That is, if they define SGPR but have VGPR inputs,
we insert VGPR to SGPR copies to make them pure SGPR. Then, the new copies are processed by the common
VGPR to SGPR lowering algorithm.
This is Part 2 in the series of commits aiming at the massive refactoring of the SIFixSGPRCopies pass.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D130367
Sunho Kim [Thu, 28 Jul 2022 12:14:58 +0000 (21:14 +0900)]
[clang-repl] Add host exception support check utility flag.
Add host exception support check utility flag. This is needed to not run tests that require exception support in few buildbots that lacks related symbols for some reason.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D129242
Sunho Kim [Thu, 28 Jul 2022 12:12:25 +0000 (21:12 +0900)]
[ORC] Fix weak hidden symbols failure on PPC with runtimedyld
Fix "JIT session error: Symbols not found: [ DW.ref.__gxx_personality_v0 ] error" which happens when trying to use exceptions on ppc linux. To do this, it expands AutoClaimSymbols option in RTDyldObjectLinkingLayer to also claim weak symbols before they are tried to be resovled. In ppc linux, DW.ref symbols is emitted as weak hidden symbols in the later stage of MC pipeline. This means when using IRLayer (i.e. LLJIT), IRLayer will not claim responsibility for such symbols and RuntimeDyld will skip defining this symbol even though it couldn't resolve corresponding external symbol.
Reviewed By: sgraenitz
Differential Revision: https://reviews.llvm.org/D129175
Muhammad Usman Shahid [Thu, 28 Jul 2022 11:45:28 +0000 (07:45 -0400)]
Missing tautological compare warnings due to unary operators
The patch mainly focuses on the lack of warnings for
-Wtautological-compare. It works fine for positive numbers but doesn't
for negative numbers. This is because the warning explicitly checks for
an IntegerLiteral AST node, but -1 is represented by a UnaryOperator
with an IntegerLiteral sub-Expr.
For the below code we have warnings:
if (0 == (5 | x)) {}
but not for
if (0 == (-5 | x)) {}
This patch changes the analysis to not look at the AST node directly to
see if it is an IntegerLiteral, but instead attempts to evaluate the
expression to see if it is an integer constant expression. This handles
unary negation signs, but also handles all the other possible operators
as well.
Fixes #42918
Differential Revision: https://reviews.llvm.org/D130510
Dmitry Preobrazhensky [Thu, 28 Jul 2022 11:36:53 +0000 (14:36 +0300)]
[AMDGPU][GFX1030][DOC][NFC] Update assembler syntax description
Summary of changes:
- Update FLAT LDS syntax (see https://reviews.llvm.org/D125126)
Dmitry Preobrazhensky [Thu, 28 Jul 2022 11:27:13 +0000 (14:27 +0300)]
[AMDGPU][MC][GFX90A] Correct MIMG dst size validation
Correct validator to enable MIMG dst size checks.
Differential Revision: https://reviews.llvm.org/D130512
Adrian Kuegel [Thu, 28 Jul 2022 10:50:40 +0000 (12:50 +0200)]
[mlir] Add getters for DenseArrayAttr.
This change adds convenience getters to builders.
Differential Revision: https://reviews.llvm.org/D130696
Sanjay Patel [Wed, 27 Jul 2022 21:40:35 +0000 (17:40 -0400)]
[InstCombine] try harder to narrow bitwise logic with cast operands
This works with any logic + extend:
https://alive2.llvm.org/ce/z/vzsqQD
The motivating case is from issue #56294, but that's still not optimal
(it should simplify completely).
Sanjay Patel [Wed, 27 Jul 2022 21:26:26 +0000 (17:26 -0400)]
[InstCombine] add tests for bitwise logic with cast operands; NFC
Dmitry Preobrazhensky [Thu, 28 Jul 2022 11:20:05 +0000 (14:20 +0300)]
[AMDGPU][MC][GFX11] Disable SGPRs for src1 of v_fma_mix*_dpp opcodes
Differential Revision: https://reviews.llvm.org/D130634
Nico Weber [Thu, 28 Jul 2022 11:14:43 +0000 (07:14 -0400)]
[gn build] (manually) port
18b4a8bcf35 more
chendewen [Thu, 28 Jul 2022 09:15:25 +0000 (17:15 +0800)]
[Aarch64] Add cost for missing extensions.
This patch adds a cost estimate for some missing sign extensions.
ref: https://reviews.llvm.org/D14730
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D130565
Kirill Okhotnikov [Wed, 6 Jul 2022 16:11:40 +0000 (18:11 +0200)]
[libc][math] Universal exp function for cosh/sinh calculation.
Added a function and test, which can be used later for cosh/sinh
and possibly for expf/expm1f.
Differential Revision: https://reviews.llvm.org/D129215
Konstantin Varlamov [Thu, 28 Jul 2022 09:06:44 +0000 (02:06 -0700)]
[libc++] Make `_IterOps::__iter_move` more similar to `std::ranges::iter_move`.
Avoid relying on `iterator_traits` and instead deduce the return type of
dereferencing the iterator. Additionally, add a static check to reject
iterators with incorrect `iterator_traits` at compile time.
Differential Revision: https://reviews.llvm.org/D130538
Florian Hahn [Thu, 28 Jul 2022 09:02:19 +0000 (10:02 +0100)]
[SCEV] Avoid repeated proveNoUnsignedWrapViaInduction calls.
At the moment, proveNoUnsignedWrapViaInduction may be called for the
same AddRec a large number of times via getZeroExtendExpr. This can have
a severe compile-time impact for very loop-heavy code. One one
particular workload, LSR takes ~51s without this patch, almost
exlusively in proveNoUnsignedWrapViaInduction. With this patch, the time
in LSR drops to ~0.4s.
If proveNoUnsignedWrapViaInduction failed to prove NUW the first time,
it is unlikely to succeed on subsequent tries and the cost doesn't seem
to be justified.
Besides drastically improving compile-time in some excessive cases, this
also has a slightly positive compile-time impact on CTMark:
NewPM-O3: -0.07%
NewPM-ReleaseThinLTO: -0.08%
NewPM-ReleaseLTO-g: -0.06
https://llvm-compile-time-tracker.com/compare.php?from=
b435da027d7774c24cdb8c88d09f6b771e07fb14&to=
f2729e33e8284b502f6c35a43345272252f35d12&stat=instructions
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D130648
Haojian Wu [Tue, 26 Jul 2022 20:27:09 +0000 (22:27 +0200)]
[pseudo] Eliminate the false `::` nested-name-specifier ambiguity
The solution is to favor the longest possible nest-name-specifier, and
drop other alternatives by using the guard, per per C++ [basic.lookup.qual.general].
Motivated cases:
```
Foo::Foo() {};
// the constructor can be parsed as:
// - Foo ::Foo(); // where the first Foo is return-type, and ::Foo is the function declarator
// + Foo::Foo(); // where Foo::Foo is the function declarator
```
```
void test() {
// a very slow parsing case when there are many qualifers!
X::Y::Z;
// The statement can be parsed as:
// - X ::Y::Z; // ::Y::Z is the declarator
// - X::Y ::Z; // ::Z is the declarator
// + X::Y::Z; // a declaration without declarator (X::Y::Z is decl-specifier-seq)
// + X::Y::Z; // a qualifed-id expression
}
```
Differential Revision: https://reviews.llvm.org/D130511
Martin Storsjö [Thu, 14 Jul 2022 19:46:04 +0000 (22:46 +0300)]
[clang-tidy] Add CLANG_TIDY_CONFUSABLE_CHARS_GEN cmake cache variable to avoid building when cross compiling
This is similar to the LLVM_TABLEGEN, CLANG_TABLEGEN and
CLANG_PSEUDO_GEN cmake cache variables.
Differential Revision: https://reviews.llvm.org/D129799
Martin Storsjö [Thu, 14 Jul 2022 19:39:55 +0000 (22:39 +0300)]
[clang-tidy] Rename the make-confusable-table executable
Rename it to clang-tidy-confusable-chars-gen, to make its role
clearer in a wider context.
In cross builds, the caller might want to provide this tool
externally (to avoid needing to rebuild it in the cross build).
In such a case, having the tool properly namespaced makes its role
clearer.
This matches how the clang-pseudo-gen tool was renamed in
a43fef05d4fae32f02365c7b8fef2aa631d23628 / D126725.
Differential Revision: https://reviews.llvm.org/D129798
Alexander Belyaev [Wed, 27 Jul 2022 13:26:01 +0000 (15:26 +0200)]
[mlir] Small stylistic changes to Complex_NumberAttr
Differential Revision: https://reviews.llvm.org/D130632
Kirill Okhotnikov [Fri, 1 Jul 2022 12:42:22 +0000 (14:42 +0200)]
[libc][math] Improved performance of exp2f function.
New exp2 function algorithm:
1) Improved performance: 8.176 vs 15.270 by core-math perf tool.
2) Improved accuracy. Only two special values left.
3) Lookup table size reduced twice.
Differential Revision: https://reviews.llvm.org/D129005
David Spickett [Wed, 20 Jul 2022 09:37:24 +0000 (09:37 +0000)]
[llvm] Fix some test failures with EXPENSIVE_CHECKS and libstdc++
DebugLocEntry assumes that it either contains 1 item that has no fragment
or many items that all have fragments (see the assert in addValues).
When EXPENSIVE_CHECKS is enabled, _GLIBCXX_DEBUG is defined. On a few machines
I've checked, this causes std::sort to call the comparator even
if there is only 1 item to sort. Perhaps to check that it is implemented
properly ordering wise, I didn't find out exactly why.
operator< for a DbgValueLoc will crash if this happens because the
optional Fragment is empty.
Compiler/linker/optimisation level seems to make this happen
or not. So I've seen this happen on x86 Ubuntu but the buildbot
for release EXPENSIVE_CHECKS did not have this issue.
Add an explicit check whether we have 1 item.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D130156
Daniel Bertalan [Mon, 25 Jul 2022 18:05:40 +0000 (20:05 +0200)]
[lld-macho] Add LOH_ARM64_ADRP_ADD_LDR optimization hint support
This hint instructs the linker to optimize an adrp+add+ldr sequence used
for loading from a local symbol's address by loading directly if it's
close enough, or with an adrp(p)+ldr sequence if it's not.
This transformation is the same as what's done for ADRP_LDR_GOT_LDR when
the symbol is local. The logic for acting on this hint is therefore
moved to a new function which will be called from the existing
applyAdrpLdrGotLdr() function.
Differential Revision: https://reviews.llvm.org/D130505
Matthias Springer [Wed, 27 Jul 2022 15:58:24 +0000 (17:58 +0200)]
[mlir][transform] Support results on ForeachOp
Handles can be yielded from the ForeachOp.
Differential Revision: https://reviews.llvm.org/D130640
Nikolas Klauser [Thu, 28 Jul 2022 08:32:02 +0000 (10:32 +0200)]
[libc++] Fix merge-conflict in .clang-format
LLVM GN Syncbot [Thu, 28 Jul 2022 08:23:10 +0000 (08:23 +0000)]
[gn build] Port
e01b4fe956dd
Nikolas Klauser [Wed, 27 Jul 2022 21:52:45 +0000 (23:52 +0200)]
[libc++] Fix unwrapping ranges with different iterators and sentinels
Reviewed By: ldionne, huixie90, #libc
Spies: arichardson, sstefan1, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D129040
Daniel Bertalan [Tue, 26 Jul 2022 10:06:39 +0000 (12:06 +0200)]
[lld-macho] Support creating N_SO stab for DWARF5 compile units
In DWARF5, the `DW_AT_name` and `DW_AT_comp_dir` attributes are encoded
using the `strx*` forms, which specify an index into `__debug_str_offs`.
This commit adds that section to DwarfObject, so the debug info parser
can resolve these references.
The test case was manually adapted from stabs-icf.s.
Fixes #51668
Differential Revision: https://reviews.llvm.org/D130559
LLVM GN Syncbot [Thu, 28 Jul 2022 07:43:55 +0000 (07:43 +0000)]
[gn build] Port
8a61749f767e
Gaurav Shukla [Thu, 28 Jul 2022 07:41:05 +0000 (13:11 +0530)]
[mlir][tensor] Fold `tensor.cast` into `tensor.collapse_shape` op
This commit folds a `tensor.cast` op into a `tensor.collapse_shape` op
when following two conditions meet:
1. the `tensor.collapse_shape` op consumes result of the `tensor.cast` op.
2. `tensor.cast` op casts to a more dynamic version of the source tensor.
This is added as a canonicalization pattern in `tensor.collapse_shape` op.
Signed-Off-By: Gaurav Shukla <gaurav@nod-labs.com>
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D130650
Hui Xie [Wed, 27 Jul 2022 12:20:16 +0000 (13:20 +0100)]
[libc++][ranges] implement `std::ranges::inplace_merge`
Differential Revision: https://reviews.llvm.org/D130627
Fangrui Song [Thu, 28 Jul 2022 07:34:04 +0000 (00:34 -0700)]
[Driver][PowerPC] Support -mtune=
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D130526
Max Kazantsev [Thu, 28 Jul 2022 06:42:14 +0000 (13:42 +0700)]
[Test] Fix block name in test
Max Kazantsev [Thu, 28 Jul 2022 06:27:19 +0000 (13:27 +0700)]
[LAA] Remove block order sensitivity in LAA algorithm. PR56672
As test in PR56672 shows, LAA produces different results which lead to either
positive or negative vectorization decisions depending on the order of blocks
in loop. The exact reason of this is not clear to me, however this makes investigation
of related bugs extremely complex.
Current order of blocks in the loop is arbitrary. It may change, for example, if loop
info analysis is dropped and recomputed. Seems that it interferes with LAA's logic.
This patch chooses fixed traversal order of blocks in loops, making it RPOT.
Note: this is *not* a fix for bug with incorrect analysis result. It just makes
the answer more robust to make the investigation easier.
Differential Revision: https://reviews.llvm.org/D130482
Reviewed By: aeubanks, fhahn
Tom Stellard [Wed, 27 Jul 2022 22:23:24 +0000 (15:23 -0700)]
workflows: Use macos-11 runners
macos-10.15 is deprecated and will be removed.
Christian Sigg [Thu, 28 Jul 2022 06:14:18 +0000 (08:14 +0200)]
Argyrios Kyrtzidis [Thu, 28 Jul 2022 06:00:56 +0000 (23:00 -0700)]
[ASTWriter] Replace `const std::string &OutputFile` with `StringRef OutputFile` in some of `ASTWriter` functions, NFC
This is to make it consistent with LLVM's string parameter passing convention.
Phoebe Wang [Thu, 28 Jul 2022 05:40:32 +0000 (13:40 +0800)]
[X86][MC] Avoid emitting incorrect warning for complex FMUL
We will insert a new operand which is identical to the Dest for complex
FMUL with a mask. https://godbolt.org/z/eTEdnYv3q
Complex FMA and FMUL with maskz don't have this problem.
Reviewed By: LuoYuanke, skan
Differential Revision: https://reviews.llvm.org/D130638
Austin Kerbow [Wed, 20 Jul 2022 05:55:42 +0000 (22:55 -0700)]
[AMDGPU] Aggressively schedule to reduce RP in occupancy limited regions
By not clustering loads and adjusting heuristics to more aggressively reduce
register pressure we may be able to increase occupancy for the function if it
was dropped in a first pass scheduling.
Similarly, try to reduce spilling if register usage exceeds lower bound
occupancy.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D130329
Amara Emerson [Thu, 28 Jul 2022 05:10:42 +0000 (22:10 -0700)]
[AArch64][GlobalISel] Fix custom legalization of rotates using sext for shift vs zext.
Rotates are defined according to DAG documentation as having unsigned shifts,
so we need to zero-extend instead of sign-extend here.
Fixes issue 56664
Amara Emerson [Thu, 28 Jul 2022 05:09:31 +0000 (22:09 -0700)]
GlobalISel: update legalize-rotr-rotl.mir checks before change.
Sridhar Gopinath [Thu, 28 Jul 2022 04:00:37 +0000 (21:00 -0700)]
[clang-format] Fix the return code of git-clang-format
In diff and diffstat modes, the return code is != 0 even when there are no
changes between commits. This issue can be fixed by passing --exit-code to
git-diff command that returns 0 when there are no changes and using that as
the return code for git-clang-format.
Fixes #56736.
Differential Revision: https://reviews.llvm.org/D129311
Utkarsh Saxena [Mon, 18 Jul 2022 14:23:28 +0000 (16:23 +0200)]
Use pseudoparser-based folding ranges in ClangdServer.
Differential Revision: https://reviews.llvm.org/D130011
Chuanqi Xu [Thu, 28 Jul 2022 03:13:00 +0000 (11:13 +0800)]
[NFC] [C++20] [Modules] Add tests for merging redefinitions in modules
Add tests for detecting redefinitions in C++20 modules. Some of these
may be covered by other tests. But more tests should be always good.
Tom Stellard [Thu, 28 Jul 2022 03:13:21 +0000 (20:13 -0700)]
workflows: Use correct access token when pushing to llvm-project-release-prs repo
The checkout action will hard-code the default github actions token in
the git config so that all pushes use it. We need to set
persist-credentials=false so we can use a token that has permission
to push to the llvm-project-release-prs repo.
Carl Ritson [Thu, 28 Jul 2022 02:43:46 +0000 (11:43 +0900)]
[AMDGPU][SIFoldOperands] Clear kills when folding COPY
Clear all kill flags on source register when folding a COPY.
This is necessary because the kills may now be out of order with the uses.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D130622
Chris Bieneman [Thu, 28 Jul 2022 02:36:43 +0000 (21:36 -0500)]
[Docs] Fix column ordering on clang attribute docs
This patch just adjusts the ordering of the headings on the attribute
docs to match the order of the column content.
Stella Laurenzo [Wed, 27 Jul 2022 23:59:56 +0000 (16:59 -0700)]
[mlir] Delete most of the ops from the quant dialect.
* https://discourse.llvm.org/t/rfc-removing-the-quant-dialect/3643/8
* Removes most ops. Leaves casts given final comment (can remove more in a followup).
* There are a few uses in Tosa keeping some of the utilities alive. In a followup, I will probably elect to just move simplified versions of them into Tosa itself vs having this quasi-library dependency.
Differential Revision: https://reviews.llvm.org/D120204
David Blaikie [Thu, 28 Jul 2022 00:44:12 +0000 (00:44 +0000)]
DebugInfo: Test vtable homing overriding ctor homing only on itanium since msvc ABI doesn't home vtables
Craig Topper [Thu, 28 Jul 2022 00:35:26 +0000 (17:35 -0700)]
[RISCV] Reorder (and/or/xor (shl X, C1), C2) if we can form ANDI/ORI/XORI.
InstCombine and DAGCombine prefer to keep shl before binops.
This patch teaches isel to convert to (shl (and/or/xor X, C1 >> C2), C2)
if (C1 >> C2) is a simm12. The idea was taken from X86's isel code.
There's a special case implemented for a sext_inreg between the
shift and the binop.
Differential Revision: https://reviews.llvm.org/D130610
Craig Topper [Thu, 28 Jul 2022 00:35:17 +0000 (17:35 -0700)]
[RISCV] Pre-commit tests for D130610. NFC
Craig Topper [Wed, 27 Jul 2022 23:43:06 +0000 (16:43 -0700)]
[RISCV] Reorder code in lowerFROUND to make the diff in D130659 cleaner. NFC
David Blaikie [Thu, 28 Jul 2022 00:07:35 +0000 (00:07 +0000)]
DebugInfo: Prefer vtable homing over ctor homing.
Vtables will be emitted in fewer places than ctors (every ctor
references the vtable, so at worst it's the same places - but at best
the type has a non-inline key function and the vtable is emitted in one
place)
Pulling this fix out of
517bbc64dbe493644eff8d55fd9566435e930520 which
was reverted in
4821508d4db75a535d02b8938f81fac6de66cc26
Amaury Séchet [Wed, 27 Jul 2022 23:52:00 +0000 (23:52 +0000)]
[NFC] Automatically generate CodeGen/VE/Scalar/atomic.ll
Lei Zhang [Wed, 27 Jul 2022 23:22:38 +0000 (19:22 -0400)]
[mlir][spirv] Unify resources of different vector sizes
This commit extends UnifyAliasedResourcePass to handle the case
where aliased resources have different vector sizes. (It still
requires all scalar types to be of the same bitwidth.) This is
effectively reusing the code for handling different-bitwidth
scalar types.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D130671
Lei Zhang [Wed, 27 Jul 2022 23:16:56 +0000 (19:16 -0400)]
[mlir][spirv] Fix spv.CompositeConstruct assembly and validation
This commit fixes spv.CompositeConstruct to assembly to list
operand types to enable vector construction out of smaller vectors.
Validation is also fixed to properly check the cases for vector
construction.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D130669
Matt Arsenault [Wed, 27 Jul 2022 13:26:41 +0000 (09:26 -0400)]
RegAllocGreedy: Fix nondeterminism in tryLastChanceRecoloring
tryLastChanceRecoloring iterates over the set of LiveInterval pointers
and used that to seed the recoloring stack, which was
nondeterministic. Fixes a future test failing about 20% of the time.
This just takes the order the interfering vreg was encountered. Not
sure if we should try to order this more intelligently.
Shafik Yaghmour [Wed, 27 Jul 2022 22:31:41 +0000 (15:31 -0700)]
Revert "[Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values"
This reverts commit
a3710589f285de0bb22ff92b1fc24df9411e986f.
Jonas Devlieghere [Wed, 27 Jul 2022 21:30:39 +0000 (14:30 -0700)]
[lldb] Read from the Rosetta shared cache with Xcode 14
Xcode 14 no longer puts the Rosetta expanded shared cache in a directory
named "16.0". Instead, it includes the real version number (e.g. 13.0),
the build string and the architecture, similar to the device support
directory names for iOS, tvOS and watchOS.
Currently, when there are multiple directories, we might end up picking
the wrong one in GetSDKDirectoryForCurrentOSVersion. The problem is that
without the build string we have no way to differentiate between
multiple directories with the same version number. This patch fixes the
problem by using GetOSBuildString which, as the name implies, returns
the build string if known.
This also adds a test for Rosetta debugging on Apple Silicon. Depending
on whether the Rosetta expanded shared cache is present, the test
ensures that there is or isn't a diagnostic about reading out of memory.
rdar://
97576121
Differential revision: https://reviews.llvm.org/D130540
Craig Topper [Wed, 27 Jul 2022 21:14:40 +0000 (14:14 -0700)]
[RISCV] Add merge operand to RISCVISD::FCOPYSIGN_VL.
Similar to what was done for VRGATHER*_VL recently.
This will be used in D130659.
Jim Ingham [Wed, 27 Jul 2022 22:09:05 +0000 (15:09 -0700)]
Call WatchpointList::RemoveAll in Target::Destroy.
I noticed that the test TestSetWatchpoint.py was failing every so often
on macOS. The failure was in the last assert, that after destroying the
SBTarget containing it, the SBWatchpoint was still saying it was valid.
IsValid in this case just meant the watchpoint weak pointer could be turned
into a shared pointer. The watchpoint shared pointers have two strong references
in general, one to the "Target::m_last_created_watchpoint", and one in the
Target::m_watchpoint_list. Target::Destroy reset the last created watchpoint
but neglected to call RemoveAll on the watchpoint list (it does the analogous
work for the internal & external breakpoint lists...) This patch does the
equivalent cleanup for the watchpoint list.
Shafik Yaghmour [Wed, 27 Jul 2022 21:59:35 +0000 (14:59 -0700)]
[Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values
DR2338 clarified that it was undefined behavior to set the value outside the
range of the enumerations values for an enum without a fixed underlying type.
We should diagnose this with a constant expression context.
Differential Revision: https://reviews.llvm.org/D130058
LLVM GN Syncbot [Wed, 27 Jul 2022 21:44:47 +0000 (21:44 +0000)]
[gn build] Port
6047deb7c2aa
bixia1 [Wed, 27 Jul 2022 19:32:47 +0000 (12:32 -0700)]
[mlir][sparse] Add arith-expand pass to the sparse-compiler pipeline.
Modify an existing test to test the situation.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D130658
Paul Kirth [Wed, 27 Jul 2022 21:38:11 +0000 (21:38 +0000)]
Revert "[llvm][NFC] Refactor code to use ProfDataUtils"
This reverts commit
300c9a78819b4608b96bb26f9320bea6b8a0c4d0.
We will reland once these issues are ironed out.
Paul Kirth [Wed, 29 Jun 2022 21:31:17 +0000 (21:31 +0000)]
[llvm][NFC] Refactor code to use ProfDataUtils
In this patch we replace common code patterns with the use of utility
functions for dealing with profiling metadata. There should be no change
in functionality, as the existing checks should be preserved in all
cases.
Reviewed By: bogner, davidxl
Differential Revision: https://reviews.llvm.org/D128860
Paul Kirth [Tue, 19 Jul 2022 22:56:45 +0000 (22:56 +0000)]
[llvm] Provide utility function for MD_prof
Currently, there is significant code duplication for dealing with
MD_prof metadata throughout the compiler. These utility functions can
improve code reuse and simplify boilerplate code when dealing with
profiling metadata, such as branch weights. The inent is to provide a
uniform set of APIs that allow common tasks, such as identifying
specific types of MD_prof metadata and extracting branch weights.
Future patches can build on this initial implementation and clean up the
different implementations across the compiler.
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D128858
Adrian Prantl [Wed, 27 Jul 2022 20:39:16 +0000 (13:39 -0700)]
[GlobalISel] Handle IntToPtr constants in dbg.value
Currently, the IR to MIR translator can only handle two kinds of constant
inputs to dbg.values intrinsics: constant integers and constant floats. In
particular, it cannot handle pointers created from IntToPtr ConstantExpression
objects.
This patch addresses the limitation above by replacing the IntToPtr with
its input integer prior to converting the dbg.value input.
Patch by Felipe Piovezan!
Differential Revision: https://reviews.llvm.org/D130642
Arthur Eubanks [Mon, 25 Jul 2022 17:58:18 +0000 (10:58 -0700)]
[lldb][NFC] Pass ParsedDWARFTypeAttributes as const reference into ParseArrayType()
Fixes a FIXME
Reviewed By: zequanwu
Differential Revision: https://reviews.llvm.org/D130504
Tom Stellard [Wed, 27 Jul 2022 19:31:40 +0000 (12:31 -0700)]
workflows: Fix version check for X.0.0 releases
Slava Gurevich [Wed, 27 Jul 2022 17:30:27 +0000 (10:30 -0700)]
[LLDB][NFC] Fix possible resource leak
SymbolVendorPECOFF object is leaked on early return at line 110
Differential Revision: https://reviews.llvm.org/D130655
Tom Stellard [Wed, 27 Jul 2022 20:09:20 +0000 (20:09 +0000)]
workflows: Fix pull request creation for backports
This was broken by
17d4796cc84618e9b15f9484e5576127c431bc60.
Joseph Huber [Wed, 27 Jul 2022 20:05:37 +0000 (16:05 -0400)]
[LinkerWrapper] Do not consume `--verbose` from the linker
Summary:
Linkers use `--verbose` to let users investigate search libraries among
other things. The linker wrapper was incorrectly not forwarding this to
the linker job. This patch simply renames this so users can still see
verbose messages from the linker if it was passed.
Prabhdeep Singh Soni [Wed, 27 Jul 2022 20:09:24 +0000 (16:09 -0400)]
[Flang][Driver] Add support for AsmPrinter -mmlir options
This patch adds support for AsmPrinter `-mmlir` options to the Flang driver.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D130598
Mark de Wever [Wed, 13 Jul 2022 05:59:46 +0000 (07:59 +0200)]
[libc++][chrono] Uses operator<=> in the calendar.
Since the calendar is added in C++20 the existing operators are removed.
Implements part of:
- P1614R2 The Mothership has Landed
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D129887
Arthur Eubanks [Wed, 27 Jul 2022 19:23:20 +0000 (12:23 -0700)]
[cross-project-tests] Add split-file as dependency
simplified_template_names_noncanonical_type_units.cpp uses split-file.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D130656
Philip Reames [Wed, 27 Jul 2022 18:48:38 +0000 (11:48 -0700)]
[RISCV] Enable (scalable) vectorization by default
This change enables vectorization (using scalable vectorization only, fixed vectors are not yet enabled) for RISCV when vector instructions are available for the target configuration.
At this point, the resulting configuration should be both stable (e.g. no crashes), and profitable (i.e. few cases where scalar loops beat vector ones), but is not going to be particularly well tuned (i.e. we emit the best possible vector loop). The goal of this change is to align testing across organizations and ensure the default configuration matches what downstreams are using as closely as possible.
This exposes a large amount of code which hasn't otherwise been on by default, and thus may not have been fully exercised. Given that, having issues fall out is not unexpected. If you find issues, please make sure to include as much information as you can when reverting this change.
Differential Revision: https://reviews.llvm.org/D129013
Denis Fatkulin [Wed, 27 Jul 2022 19:19:08 +0000 (22:19 +0300)]
[clang-format] FIX: Misannotation 'auto' as trailing return type in lambdas
Lambdas with trailing return type 'auto' are annotated incorrectly. It causes a misformatting. The simpliest code to reproduce is:
```
auto list = {[]() -> auto { return 0; }};
```
Fixes https://github.com/llvm/llvm-project/issues/54798
Reviewed By: HazardyKnusperkeks, owenpan, curdeius
Differential Revision: https://reviews.llvm.org/D130299
LLVM GN Syncbot [Wed, 27 Jul 2022 19:04:03 +0000 (19:04 +0000)]
[gn build] Port
0f3f357e26cf
Jacob Lambert [Fri, 15 Jul 2022 00:00:26 +0000 (17:00 -0700)]
[clang-offload-bundler] Library-ize ClangOffloadBundler
Lifting the core functionalities of the clang-offload-bundler into a
user-facing library/API. This will allow online and JIT compilers to
bundle and unbundle files without spawning a new process.
This patch lifts the classes and functions used to implement
the clang-offload-bundler into a separate OffloadBundler.cpp,
and defines three top-level API functions in OfflaodBundler.h.
BundleFiles()
UnbundleFiles()
UnbundleArchives()
This patch also introduces a Config class that locally stores the
previously global cl::opt options and arrays to allow users to call
the APIs in a multi-threaded context, and introduces an
OffloadBundler class to encapsulate the top-level API functions.
We also lift the BundlerExecutable variable, which is specific
to the clang-offload-bundler tool, from the API, and replace
its use with an ObjcopyPath variable. This variable must be set
in order to internally call llvm-objcopy.
Finally, we move the API files from
clang/tools/clang-offload-bundler into clang/lib/Driver and
clang/include/clang/Driver.
Differential Revision: https://reviews.llvm.org/D129873
Stanislav Mekhanoshin [Wed, 27 Jul 2022 18:13:17 +0000 (11:13 -0700)]
[AMDGPU] Consider S_SETPRIO a scheduling boundary
The instruction is used to modify wave priority with the intent
to affect VALU execution and currently we can reschedule VALU
around it since that VALU does not have side effects.
Differential Revision: https://reviews.llvm.org/D130654
Shraiysh Vaishay [Wed, 27 Jul 2022 18:41:21 +0000 (00:11 +0530)]
[mlir][OpenMP] Add omp.atomic.update canonicalization
This patch adds canonicalization conditions for omp.atomic.update thus
eliminating it when it becomes just a write or a no-op due to other
changes during canonicalization.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D126531
Jonas Devlieghere [Wed, 27 Jul 2022 17:44:15 +0000 (10:44 -0700)]
[DebugInfo] Teach LLVM and LLDB about ptrauth in DWARF
Teach libDebugInfo (llvm-dwarfdump) and lldb about DWARF tags and
attributes for pointer authentication. These values have been emitted by
Apple clang for several releases. Although upstream LLVM doesn't emit
these values yet, we hope to upstream that part sometime soon.
Differential revision: https://reviews.llvm.org/D130215
Philip Reames [Wed, 27 Jul 2022 18:29:59 +0000 (11:29 -0700)]
[LV][RISCV] Add a test case for a quality problem mixing vector index and data types
The problem here is target independent, but particularly painful on RISCV. If we chose to vectorize such that vscale x 2 x i32 is our widest type and fits in a register, a naive expansion of i64 comparisons results in comparisons and index types at <scalabe x 2 x i64>. This requires both an LMUL of 2, and a VSETVLI toggle in the loop. Note that we could have used <vscale x 2 x i32> for the compairons legally given the range of the trip count.
Amara Emerson [Wed, 27 Jul 2022 18:11:46 +0000 (11:11 -0700)]
Use hasNItemsOrLess() in MRI::hasAtMostUserInstrs().
Florian Hahn [Wed, 27 Jul 2022 18:29:26 +0000 (19:29 +0100)]
[VPlan] Mark VPPredInstPHIRecipe as not having side-effects.
Now that all uses of VPPredInstPHIRecipes are properly modeled, they can
be treated as not having side-effects, enabling removal.
Nikolas Klauser [Wed, 27 Jul 2022 12:41:40 +0000 (14:41 +0200)]
[libc++] Implement P1004R2 (constexpr std::vector)
Reviewed By: #libc, ldionne
Spies: mgorny, var-const, ormris, philnik, miscco, hiraditya, steven_wu, jkorous, ldionne, christof, libcxx-commits
Differential Revision: https://reviews.llvm.org/D68365
Stanislav Mekhanoshin [Wed, 27 Jul 2022 18:17:54 +0000 (11:17 -0700)]
[AMDGPU] Precommit s_setprio scheduling test. NFC.
Eric Li [Wed, 27 Jul 2022 18:17:14 +0000 (14:17 -0400)]
[clang][dataflow][NFC] Remove last use of deprecated ctor
Use a delegating constructor to remove the last use of the deprecated
ctor of `TypeErasedDataflowAnalysis`, and then delete it.
Differential Revision: https://reviews.llvm.org/D130653
Fangrui Song [Wed, 27 Jul 2022 18:18:19 +0000 (11:18 -0700)]
[ELF][test] Fix compressed-debug-level.test with zlib-ng
The test is brittle but it seems unnecessary to remove size check now.
Close #56222
Mingming Liu [Tue, 26 Jul 2022 05:48:56 +0000 (22:48 -0700)]
[AArch64] Explicitly use v1i64 type for llvm.aarch64.neon.pmull64
Without this, the intrinsic will be expanded to an integer; thereby an
explicit copy (from GPR to SIMD register) will be codegen'd. This matches the
general convention of using "v1" types to represent scalar integer operations in
vector registers.
The similar approach is observed in D56616, and the pattern likely applies on
other intrinsic that accepts integer scalars (e.g.,
int_aarch64_neon_sqdmulls_scalar)
Differential Revision: https://reviews.llvm.org/D130548
Mark de Wever [Wed, 27 Jul 2022 17:59:56 +0000 (19:59 +0200)]
[libc++] Fixes the CI.
The GDB test was disabled for clang-15, updated the filter since main
now is clang-16.
Philip Reames [Wed, 27 Jul 2022 17:48:52 +0000 (10:48 -0700)]
[LV] Refresh an autogened test to pickup naming changes
Amara Emerson [Tue, 26 Jul 2022 08:27:44 +0000 (01:27 -0700)]
[AArch64][GlobalISel] Add heuristics for localizing G_CONSTANT.
This adds similar heuristics to G_GLOBAL_VALUE, querying the cost of
materializing a specific constant in code size. Doing so prevents us from
sinking constants which require multiple instructions to generate into
use blocks.
Code size savings on CTMark -Os:
Program size.__text
before after diff
ClamAV/clamscan 381940.00 382052.00 0.0%
lencod/lencod 428408.00 428428.00 0.0%
SPASS/SPASS 411868.00 411876.00 0.0%
kimwitu++/kc 449944.00 449944.00 0.0%
Bullet/bullet 463588.00 463556.00 -0.0%
sqlite3/sqlite3 284696.00 284668.00 -0.0%
consumer-typeset/consumer-typeset 414492.00 414424.00 -0.0%
7zip/7zip-benchmark 595244.00 594972.00 -0.0%
mafft/pairlocalalign 247512.00 247368.00 -0.1%
tramp3d-v4/tramp3d-v4 372884.00 372044.00 -0.2%
Geomean difference -0.0%
Differential Revision: https://reviews.llvm.org/D130554
Slava Gurevich [Tue, 26 Jul 2022 21:18:41 +0000 (14:18 -0700)]
[LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 3
Improve LLDB reliability by fixing the following "uninitialized variables" static code inspection warnings from
scan.coverity.com/projects/llvm:
1355854, 1347549, 1316348, 1372028, 1431625,
1315634, 1315637, 1355855, 1364803, 1420505,
1420563, 1420685, 1366014, 1203966, 1204029,
1204031, 1204032, 1328411, 1325969, 1325968,
1374921, 1094809
Differential Revision: https://reviews.llvm.org/D130602
Stanislav Mekhanoshin [Thu, 14 Jul 2022 19:19:18 +0000 (12:19 -0700)]
Allow data prefetch into non-default address space
I am playing with the LoopDataPrefetch pass and found out that it
bails to work with a pointer in a non-zero address space. This
patch adds the target callback to check if an address space is to
be considered for prefetching. Default implementation still only
allows address space 0, so this is NFCI.
This does not currently affect any known targets, but seems to be
generally useful for the future.
Differential Revision: https://reviews.llvm.org/D129795
David Green [Wed, 27 Jul 2022 16:55:11 +0000 (17:55 +0100)]
[Lit] Sort previously failed tests early
D98179 added a mechanism to sort tests by test time to run slow tests
early, increasing potential parallelism. It also added a feature where
negative tests would be marked as negative, allowing subsequent test
runs to run them earlier. Unfortunately it never actually stored the
negative time, even if all the other code seemed to be inplace to sort
them early. Luckily the fix seems simple.
Differential Revision: https://reviews.llvm.org/D130570
Eli Friedman [Wed, 27 Jul 2022 16:37:13 +0000 (09:37 -0700)]
Fix misc uses of "long" variables to use "int64_t".
I don't have any evidence these particular uses are actually causing any
issues, but we should avoid accidentally truncating immediate values
depending on the host.