Nikita Popov [Mon, 15 May 2023 15:56:02 +0000 (17:56 +0200)]
[KnownBits] Return zero instead of unknown for always poison shifts
For always poison shifts, any KnownBits return value is valid.
Currently we return unknown, but returning zero is generally more
profitable. We had some code in ValueTracking that tried to do this,
but was actually dead code.
Differential Revision: https://reviews.llvm.org/D150648
Kadir Cetinkaya [Tue, 23 May 2023 07:47:57 +0000 (09:47 +0200)]
[clangd] Store paths as requested in PreambleStatCache
Underlying FS can store different file names inside the stat response
(e.g. symlinks resolved, absolute paths, dots removed). But we store path names
as requested inside the preamble,
https://github.com/llvm/llvm-project/blob/main/clang/lib/Serialization/ASTWriter.cpp#L1635.
This improves cache hit rates from ~30% to 90% in a build system that uses
symlinks.
Differential Revision: https://reviews.llvm.org/D151185
Vlad Serebrennikov [Tue, 23 May 2023 12:29:14 +0000 (15:29 +0300)]
Revert "[clang] Add tests for CWG issues 977, 1482, 2516"
This reverts commit
85452b5f9b5aba5bdf0259b7f0d7400362f95535.
Nikita Popov [Tue, 23 May 2023 12:17:50 +0000 (14:17 +0200)]
[PostOrderIterator] Use SmallVector for RPOT blocks (NFC)
Leandro Lupori [Tue, 16 May 2023 13:06:13 +0000 (13:06 +0000)]
Reland "[flang] Handle array constants of any rank"
Fixes gfortran test-suite regression.
Differential Revision: https://reviews.llvm.org/D150686
Nikita Popov [Mon, 22 May 2023 13:04:18 +0000 (15:04 +0200)]
Reapply [PostOrderIterator] Store end iterator (NFC)
Replace structured bindings with std::get, as they apparently
break the modules build.
-----
Store the end iterator on the VisitStack, instead of recomputing
it every time, as doing so is not free.
Tim Northover [Tue, 23 May 2023 12:14:21 +0000 (13:14 +0100)]
AArch64: emit synchronous unwind for Darwin arm64_32 platforms too.
Since we're checking the triple directly, arm64_32 shows up differently and was
still getting an attempt at asynchronous unwind that added lots more
`__eh_frame` entries instead of the compact format.
Martin Braenne [Wed, 17 May 2023 13:27:35 +0000 (13:27 +0000)]
[clang][dataflow] Use `Strict` accessors in comma operator and no-op cast.
This patch is part of the ongoing migration to strict handling of value
categories (see https://discourse.llvm.org/t/70086 for details).
Depends On D150775
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D150776
Nikita Popov [Tue, 23 May 2023 09:45:24 +0000 (11:45 +0200)]
[Driver] Fix test for use of ld from devtoolset (NFC)
The test added in
c5fe10f365247c3dd9416b7ec8bad73a60b5946e contains
some typos in the check lines, due to which it never actually
verified what was intended.
Fix the test by adding the required input tree and adjusting the
check lines appropriately.
Differential Revision: https://reviews.llvm.org/D151195
LLVM GN Syncbot [Tue, 23 May 2023 11:39:12 +0000 (11:39 +0000)]
[gn build] Port
5111286f06e1
Martin Storsjö [Sat, 13 May 2023 23:04:22 +0000 (23:04 +0000)]
[lli] Export the MinGW chkstk function from the lli executable
This allows all ExecutionEngine tests pass in MinGW build configurations.
Differential Revision: https://reviews.llvm.org/D150555
Jun Zhang [Tue, 23 May 2023 10:09:04 +0000 (18:09 +0800)]
Reland "Reland [clang-repl] Introduce Value to capture expression results"
This reverts commit
094ab4781262b6cb49d57b0ecdf84b047c879295.
Reland with changing `ParseAndExecute` to `Parse` in
`Interpreter::create`. This avoid creating JIT instance everytime even
if we don't really need them.
This should fixes failures like https://lab.llvm.org/buildbot/#/builders/38/builds/11955
The original reverted patch also causes GN bot fails on M1. (https://lab.llvm.org/buildbot/#/builders/38/builds/11955)
However, we can't reproduce it so let's reland it and see what happens.
See discussions here: https://reviews.llvm.org/rGd71a4e02277a64a9dece591cdf2b34f15c3b19a0
Luo, Yuanke [Tue, 23 May 2023 11:16:47 +0000 (19:16 +0800)]
[Coverity] Constant variable guards dead code.
Tom Weaver [Tue, 23 May 2023 10:44:51 +0000 (11:44 +0100)]
Revert "[Sema] `setInvalidDecl` for error deduction declaration"
This reverts commit
eb5902ffc97163338bab95d2fd84a953ee76e96f.
Caused buildbot failures on:
https://lab.llvm.org/buildbot/#/builders/139/builds/41248
https://lab.llvm.org/buildbot/#/builders/216/builds/21637
Simon Pilgrim [Tue, 23 May 2023 10:40:33 +0000 (11:40 +0100)]
Fix MSVC "ignoring return value of function declared with 'nodiscard' attribute" warning. NFC.
Timm Bäder [Tue, 23 May 2023 08:23:10 +0000 (10:23 +0200)]
[llvm][github] Allow github links in /cherry-pick actions
Differential Revision: https://reviews.llvm.org/D151191
Jay Foad [Mon, 15 May 2023 11:01:23 +0000 (12:01 +0100)]
[Mips] Avoid RegScavenger::forward in Mips16InstrInfo
RegScavenger::backward is preferred because it does not rely on accurate
kill flags.
Differential Revision: https://reviews.llvm.org/D150557
LLVM GN Syncbot [Tue, 23 May 2023 10:01:28 +0000 (10:01 +0000)]
[gn build] Port
0b91de5ea32d
Simon Pilgrim [Fri, 19 May 2023 21:45:14 +0000 (22:45 +0100)]
[X86] Add X86FixupVectorConstantsPass to re-fold AVX512 vector load folds as broadcast folds
This patch analyzes AVX512 instructions for full vector width folded loads from the constant pool and attempts to determine if it can be replaced with a smaller broadcast folded variant. Typically the broadcast opportunities were missed by type-width mismatches or mulituse limitations which have been removed in later passes.
As well as introducing broadcast fold tables (which can hopefully be extended/automated in the future), this also handles mismatches in the AND/ANDN/OR/XOR/TERNLOG type-widths, catching additional missed opportunities.
This is patch is pulled from the ongoing work based on D150143, but without removing the existing DAG constant broadcast lowering code - this patch is currently a late stage cleanup only.
The intention is to add additional broadcast/extension handling of constants in future patches, but it turned out that AVX512 broadcast handling was the easiest to start with.
Differential Revision: https://reviews.llvm.org/D150526
Vlad Serebrennikov [Tue, 23 May 2023 09:50:09 +0000 (12:50 +0300)]
[clang] Add tests for CWG issues 977, 1482, 2516
CWG977 focus on point of /completeness/ of enums. Wording provided in CWG1482.
CWG1482 and CWG2516 focus on locus (point) of /declaration/. Wording provided in CWG2516.
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D151042
Vlad Serebrennikov [Tue, 23 May 2023 09:43:47 +0000 (12:43 +0300)]
[clang] Add test for CWG2213
[[https://wg21.link/p1787 | P1787]]: CWG2213 is resolved by allowing an elaborated-type-specifier to contain a simple-template-id without friend.
Wording: see changes to [dcl.type.elab]]/1.
The gist of the issue is that forward declaration of partial class template specialization was disallowed.
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D151032
Jay Foad [Mon, 15 May 2023 11:01:36 +0000 (12:01 +0100)]
[PowerPC] Avoid RegScavenger::forward in PPCFrameLowering
RegScavenger::backward is preferred because it does not rely on accurate
kill flags.
Differential Revision: https://reviews.llvm.org/D150558
Guillaume Chatelet [Tue, 23 May 2023 09:14:28 +0000 (09:14 +0000)]
[libc] Display unit test runtime for hosted environments
With more tests added to LLVM libc each week we want to keep track of unittest's runtime, especially for low end build bots.
Top offender can be tracked with a bit of scripting (spoiler alert, mem function sweep tests are in the top ones)
```
ninja check-libc | grep "ms)" | awk '{print $(NF-1),$0}' | sort -nr | cut -f2- -d' '
```
Unfortunately this doesn't work for hermetic tests since `clock` is unavailable.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151097
Alex Bradbury [Tue, 23 May 2023 09:09:22 +0000 (10:09 +0100)]
[RISCV] Make zfbfmin imply the F extension
Our current approach is that if one extension requires another, we make
LLVM treat it as implied. My initial zfbfmin patch failed to do this for
the F extension (documented as a requirement of zfbfmin). This patch
fixes that.
Differential Revision: https://reviews.llvm.org/D151096
khei4 [Thu, 18 May 2023 03:49:10 +0000 (12:49 +0900)]
[SimplifyCFG] add nsw on SwitchToLookupTable index calculation on MinCaseVal subtraction
Differential Revision: https://reviews.llvm.org/D146903
Reviewed By: nikic
Qiu Chaofan [Tue, 23 May 2023 08:40:54 +0000 (16:40 +0800)]
[PowerPC] Simplify fp-to-int store optimization
On PowerPC VSX targets, fp-to-int will be transformed into xscv with
mfvsr. When the result is to be stored, mfvsr can be replaced by a
direct store.
This change simplifies the optimization by using existing fp-to-int
code, which helps CSE and handling strictfp cases.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D141473
Qiu Chaofan [Tue, 23 May 2023 08:22:32 +0000 (16:22 +0800)]
[Clang] Support more stdio builtins
Add more builtins for stdio functions as in GCC, along with their
mutations under IEEE float128 ABI.
Reviewed By: tuliom
Differential Revision: https://reviews.llvm.org/D150087
Joachim Jenke [Tue, 23 May 2023 08:26:13 +0000 (10:26 +0200)]
[OpenMP][Tests][NFC] Mark unsupported libomp tests for GCC
This patch properly marks the support level for libomp test when testing with
GCC.
Some new OpenMP features were only introduced with GCC 11.
Tests using the target construct are incompatibe with GCC.
Tests pass now with GCC 10, 11, 12
Joachim Jenke [Tue, 23 May 2023 08:22:50 +0000 (10:22 +0200)]
[OpenMP][Tests][NFC] Mark unsupported OMPT tests for GCC
Codegen for some OpenMP directives is different from clang, so some
OMPT tests fail. As we don't expect GCC codegen to change significantly,
we mark the tests as unsupported for GCC.
OMPT Tests pass now with GCC 10, 11, 12
Joachim Jenke [Tue, 23 May 2023 07:39:27 +0000 (09:39 +0200)]
[OpenMP][Tests][NFC] Fix libarcher tests for GCC
TSan in GCC filters duplicates less aggressively. With 8 threads we can
expect reports for up to 7 pairs of data race in some tests.
Tests pass now with GCC 10, 11, 12
Jay Foad [Mon, 15 May 2023 12:09:05 +0000 (13:09 +0100)]
[AArch64] Avoid RegScavenger::forward in AArch64SpeculationHardening
RegScavenger::backward is preferred because it does not rely on accurate
kill flags.
Differential Revision: https://reviews.llvm.org/D150560
Jay Foad [Mon, 15 May 2023 12:05:14 +0000 (13:05 +0100)]
[AArch64] Add implicit uses to speculative hardening MIR test
A couple of tests were setting liveins to add fake live registers, but
that only works if you track liveness forwards. Add some implicit uses
too, so that it also works if you track liveness backwards.
Differential Revision: https://reviews.llvm.org/D150559
Matt Arsenault [Tue, 23 May 2023 08:13:36 +0000 (09:13 +0100)]
AMDGPU/GlobalISel: Update test
Krasimir Georgiev [Tue, 23 May 2023 07:59:38 +0000 (07:59 +0000)]
Revert "[clang][ExprConstant] fix __builtin_object_size for flexible array members"
This reverts commit
57c5c1ab2a188b7962c9de5ac0f95e3c7441940a.
Causes an assertion failure: https://reviews.llvm.org/D150892#4363080
Matt Arsenault [Mon, 22 May 2023 09:44:32 +0000 (10:44 +0100)]
Reapply "InstSimplify: Pass AssumptionCache to isKnownNeverInfinity"
This reverts commit
481191b0a8318e55ce467e983d78d2141e827db1.
Matt Arsenault [Fri, 19 May 2023 09:25:38 +0000 (10:25 +0100)]
Reapply "SimplifyLibCalls: Pass AssumptionCache to isKnownNeverInfinity"
This reverts commit
b357f379c81811409348dd0e0273a248b055bb7a.
Matt Arsenault [Fri, 19 May 2023 08:15:22 +0000 (09:15 +0100)]
Reapply "ValueTracking: Delete body of isKnownNeverInfinity"
This reverts commit
d1dc3e13a791fe1b99a341406b5dafec64750cb1.
200bdd9e869e2982f54923b05e54c117fd33f5d9 should have fixed
the reported regression.
Matt Arsenault [Mon, 22 May 2023 09:42:58 +0000 (10:42 +0100)]
Reapply "InstSimplify: Use isKnownNeverInfOrNaN"
This reverts commit
f55224735ed39af16bccd7ff67b734fd758db6fc.
Matt Arsenault [Sun, 7 May 2023 10:13:28 +0000 (11:13 +0100)]
AMDGPU: Expand casted f16 fmed3 pattern to fmin/fmax on gfx8
If we have legal f16 instructions but no f16 med3, we can save
one instruction by expanding out the min/max sequence compared
to casting to f32 and casting back.
Jean Perier [Tue, 23 May 2023 07:17:36 +0000 (09:17 +0200)]
[flang][hlfir] Hoist forall bounds computation when possible
When inner forall bound computations do not depend on previous
forall indices, they can be hoisted.
This is possible because:
- bound computation are required to be pure (so evaluating them only
once is possible).
- If the bound computation depends on a value previously assigned, the
forall scheduling analysis created different run for it: the
assignment impacting the bounds value is not part of the current loop
nest.
The reason this optimization is done at that point and not as part of
generic loop hoisting optimization is that having the all the loop
bound computation hoisted will allow allocating simple temporary
storages. The number of iteration can be pre-computed and used as the
extent for the temporary.
Differential Revision: https://reviews.llvm.org/D151110
Congcong Cai [Tue, 23 May 2023 07:07:03 +0000 (09:07 +0200)]
[Sema] `setInvalidDecl` for error deduction declaration
Fixed: https://github.com/llvm/llvm-project/issues/62408
`setInvalidDecl` for invalid `CXXDeductionGuideDecl` to
avoid crashes during semantic analysis.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D149516
pvanhout [Mon, 15 May 2023 09:23:09 +0000 (11:23 +0200)]
[AMDGPU] Reintroduce CC exception for non-inlined functions in Promote Alloca limits
This is basically a partial revert of https://reviews.llvm.org/D145586 (
fd1d60873fdc )
D145586 was originally introduced to help with SWDEV-363662, and it did, but
it also caused a 25% drop in performance in
some MIOpen benchmarks where, it seems,
functions are inlined more conservatively.
This patch restores the pre-D145586 behavior
for PromoteAlloca: functions with a non-entry CC
have a 32 VGPRs threshold, but only if the function
is not marked with "alwaysinline".
A good number of AMDGPU code makes uses of
the AMDGPUAlwaysInline pass anyway, so in our
backend "alwaysinline" seems very common.
This change does not affect SWDEV-363662 (the motivating issue for introducing D145586).
Fixes SWDEV-399519
Reviewed By: rampitec, #amdgpu
Differential Revision: https://reviews.llvm.org/D150551
Adrian Kuegel [Tue, 23 May 2023 06:52:53 +0000 (08:52 +0200)]
[mlir] Apply ClangTidy performance finding (NFC)
Chuanqi Xu [Tue, 23 May 2023 06:31:05 +0000 (14:31 +0800)]
[NFC] [C++20] [Modules] Add a test
Add a test from https://github.com/llvm/llvm-project/issues/59999. It is
always good to have more tests.
Jianjian GUAN [Tue, 23 May 2023 03:44:08 +0000 (11:44 +0800)]
[RISCV][NFC] Simplify code.
Reduce scope of if-else statements.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151178
Tobias Hieta [Tue, 23 May 2023 06:31:02 +0000 (08:31 +0200)]
[NFC] Add clang python reformat SHA to .git-blame-ignore-revs
Tobias Hieta [Wed, 17 May 2023 08:56:49 +0000 (10:56 +0200)]
[NFC][Py Reformat] Reformat python files in clang and clang-tools-extra
This is an ongoing series of commits that are reformatting our
Python code.
Reformatting is done with `black`.
If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.
If you run into any problems, post to discourse about it and
we will try to help.
RFC Thread below:
https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D150761
Kazu Hirata [Tue, 23 May 2023 06:27:59 +0000 (23:27 -0700)]
[libc] Fix typos in documentation
Kazu Hirata [Tue, 23 May 2023 06:25:16 +0000 (23:25 -0700)]
[libc] Fix typos in documentation
Chuanqi Xu [Tue, 23 May 2023 05:26:16 +0000 (13:26 +0800)]
[C++20] [Modules] Don't ignore -fmodule-file when we compile pcm files
Close https://github.com/llvm/llvm-project/issues/62843.
Previously when we compile .pcm files into .o files, the
`-fmodule-file=<module-name>=<module-path>` option is ignored. This is
conflicted with our consensus in
https://github.com/llvm/llvm-project/issues/62707.
Kazu Hirata [Tue, 23 May 2023 06:19:58 +0000 (23:19 -0700)]
[BPF] Remove unused declaration probeJmpExt
The declaration was added without a corresponding function definition
by:
commit
dc1dbf6ef320175acbdc1206da4b0a176b304449
Author: Yonghong Song <yhs@fb.com>
Date: Wed Aug 23 04:25:57 2017 +0000
Med Ismail Bennani [Tue, 23 May 2023 05:13:23 +0000 (22:13 -0700)]
[lldb] Fix racing issue when loading inlined symbols from crash report
Following
abba5de72466, some tests started failing on green-dragon:
https://green.lab.llvm.org/green/job/lldb-cmake/55460/console
Looking at the backtrace, there seems to be a racing issue when deleting
the temporary directory containing all the JSON object files:
```
Traceback (most recent call last):
File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1115, in __call__
SymbolicateCrashLogs(debugger, shlex.split(command), result)
File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1457, in SymbolicateCrashLogs
SymbolicateCrashLog(crash_log, options)
File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1158, in SymbolicateCrashLog
with tempfile.TemporaryDirectory() as obj_dir:
File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 869, in __exit__
self.cleanup()
File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 873, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 855, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 731, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 729, in rmtree
os.rmdir(path)
OSError: [Errno 66] Directory not empty: '/var/folders/09/r4vw4v8n5kb67jl66zvlbljw0000gn/T/tmp6qfifxk7'
```
This patch should fix that issue since it won't delete the object file
directory until we're sure that the modules adding tasks completed.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Argyrios Kyrtzidis [Mon, 22 May 2023 22:16:20 +0000 (15:16 -0700)]
[ThinLTO] Make the cache key independent of the module identifier paths
Otherwise there are cache misses just from changing the name of a path, even though the input modules did not change.
rdar://
109672225
Differential Revision: https://reviews.llvm.org/D151165
Zhongyunde [Tue, 23 May 2023 03:30:26 +0000 (11:30 +0800)]
[test] precommit tests for D141188
Galen Elias [Tue, 23 May 2023 03:11:17 +0000 (20:11 -0700)]
This is a retry of https://reviews.llvm.org/D114583, which was backed
out for regressions.
Clang Format is detecting a nested scope followed by another open brace
as a braced initializer list due to incorrectly thinking it's matching a
braced initializer at the end of a constructor initializer list which is
followed by the body open brace.
Unfortunately, UnwrappedLineParser isn't doing a very detailed parse, so
it's not super straightforward to distinguish these cases given the
current structure of calculateBraceTypes. My current hypothesis is that
these can be disambiguated by looking at the token preceding the
l_brace, as initializer list parameters will be preceded by an
identifier, but a scope block generally will not (barring the MACRO
wildcard).
To this end, I am adding tracking of the previous token to the LBraceStack
to help scope this particular case.
TokenAnnotatorTests cherry picked from https://reviews.llvm.org/D150452.
Fixes #33891.
Fixes #52911.
Differential Revision: https://reviews.llvm.org/D150403
Joseph Huber [Mon, 22 May 2023 21:00:41 +0000 (16:00 -0500)]
[libc] Add an option to make `libc` only build the `libc-hdrgen` tool
The `libc-hdergen` tool is required for cross-builds, however some cases
can cause issues when configuring this build. This patch adds an
ovveride option `LIBC_HDRGEN_ONLY` to allow us to retain the old
(incorrect) behaviour where `libc` would not build with any other
runtimes enabled.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151155
Chuanqi Xu [Wed, 10 May 2023 03:54:04 +0000 (11:54 +0800)]
[NFC] [C++20] [Modules] Refactor Sema::isModuleUnitOfCurrentTU into
Decl::isInAnotherModuleUnit
Refactor `Sema::isModuleUnitOfCurrentTU` to `Decl::isInAnotherModuleUnit`
to make code simpler a little bit. Note that although this patch
introduces a FIXME, this is an existing issue and this patch just tries
to describe it explicitly.
Craig Topper [Tue, 23 May 2023 02:51:42 +0000 (19:51 -0700)]
[RISCV] Add more cost model tests for fixed vector casts. NFC
This covers a full mix of legal and illegal types. I've reduce
the fixed vector length from 128 to 256.
Reviewed By: fakepaper56
Differential Revision: https://reviews.llvm.org/D151127
Sergei Barannikov [Tue, 23 May 2023 02:11:38 +0000 (05:11 +0300)]
Revert "[CodeGen] Fix incorrect usage of MCPhysReg for diff list elements"
This reverts commit
fa2827f0796c08e36b0b157fc526dd59cd6368e3.
Causes build bot failres:
https://lab.llvm.org/buildbot/#/builders/38/builds/12037
wren romano [Mon, 22 May 2023 23:07:48 +0000 (16:07 -0700)]
[mlir][sparse] (NFC) Reordering extraClassDeclaration for STEA
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D151171
Sergei Barannikov [Sat, 20 May 2023 18:30:02 +0000 (21:30 +0300)]
[CodeGen] Fix incorrect usage of MCPhysReg for diff list elements
The lists contain differences between register numbers, not the register
numbers themselves. Since a difference can also be negative, this also
changes its type to signed.
Changing the type to signed exposed a "bug". For AMDGPU, which has many
registers, the first element of a sequence could be as big as ~45k.
The value does not fit into int16_t, but fits into uint16_t. The bug
didn't show up because of unsigned wrapping and truncation of the Val
field in the advance() method.
To fix the issue, I changed the way regunit difflists are encoded. The
4-bit 'scale' field of MCRegisterDesc::RegUnit was replaced by 12-bit
number of the first regunit, and the first element of each of the lists
was removed. The higher 20 bits of RegUnit field contain the initial
offset into DiffLists array.
AMDGPU has 1'409 regunits (2^12 = 4'096), and the biggest offset is
80'041 (2^20 = 1'048'576). That is, there is enough room.
Changing the encoding method also resulted in a smaller array size, the
numbers are below (I omitted targets with less than 100 elements).
```
AMDGPU | 80052 | 78741 | -1,6%
RISCV | 6498 | 6297 | -3,1%
ARM | 4181 | 3966 | -5,1%
AArch64 | 2770 | 2592 | -6,4%
PPC | 1578 | 1441 | -8,7%
Hexagon | 994 | 740 | -25,6%
R600 | 508 | 398 | -21,7%
VE | 471 | 459 | -2,5%
Sparc | 381 | 363 | -4,7%
X86 | 326 | 208 | -36,2%
Mips | 253 | 200 | -20,9%
SystemZ | 186 | 162 | -12,9%
```
Reviewed By: foad, arsenm
Differential Revision: https://reviews.llvm.org/D151036
Jie Fu [Tue, 23 May 2023 01:09:07 +0000 (09:09 +0800)]
[lldb][test] Fix -Wsign-compare in GDBRemoteCommunicationClientTest.cpp (NFC)
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: error: comparison of integers of different signs: 'const int' and 'const unsigned long' [-Werror,-Wsign-compare]
if (lhs == rhs) {
~~~ ^ ~~~
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1553:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned long>' requested here
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
^
/data/llvm-project/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp:303:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<int, unsigned long, nullptr>' requested here
ASSERT_EQ(10, num_packets);
^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2056:32: note: expanded from macro 'ASSERT_EQ'
^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2040:54: note: expanded from macro 'GTEST_ASSERT_EQ'
ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^
1 error generated.
LLVM GN Syncbot [Tue, 23 May 2023 00:36:57 +0000 (00:36 +0000)]
[gn build] Port
ca1b9943e1e4
LLVM GN Syncbot [Tue, 23 May 2023 00:36:57 +0000 (00:36 +0000)]
[gn build] Port
8313507a7c3f
Nico Weber [Tue, 23 May 2023 00:32:06 +0000 (20:32 -0400)]
[gn] port
98e342dca2372 (RISCV MCA)
Michael Maitland [Fri, 12 May 2023 16:56:43 +0000 (09:56 -0700)]
[llvm-mca] Print InstructionInfoView using Instrument information.
Previous reports calculated the overall report using Instrument
information but did not print out per-instruction data using
Instrument information. This patch fixes that.
Differential Revision: https://reviews.llvm.org/D150459
Med Ismail Bennani [Mon, 22 May 2023 22:51:43 +0000 (15:51 -0700)]
[lldb/crashlog] Remove tempfile prefix from inlined symbol object file
This patch changes the way we generate the ObjectFileJSON files
containing the inlined symbols from the crash report to remove the
tempfile prefix from the object file name.
To do so, instead of creating a new tempfile for each module, we create a
temporary directory that contains each module object file with the same
name as the module.
This makes the backtraces only contain the module name without the
temfile prefix which makes it look like a regular stackframe.
Differential Revision: https://reviews.llvm.org/D151045
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Sun, 21 May 2023 07:58:02 +0000 (00:58 -0700)]
[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module
This patch moves the `PassthroughScriptedProcess` & `PassthroughScriptedThread`
classes from the `interactive_scripted_process.py` test implementation
to the `lldb.scripted_process` python module.
This class is very versatile so it makes more sense to ship it with the
python module to make it easier for our adopters to derive their class
from it instead of copying it.
During the "migration", I've also noticed some bugs in the
`PassthroughScriptedThread` creation and update, so I also fixed that as
part of this patch.
Differential Revision: https://reviews.llvm.org/D151044
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Sun, 21 May 2023 07:55:50 +0000 (00:55 -0700)]
[lldb] Add "Trace" stop reason in Scripted Thread
This patch adds support to eStopReasonTrace to Scripted Threads.
This is necessary when using a Scrited Process with a Scripted Thread
Plan to report a special thread stop reason to the thread plan.
rdar://
109425542
Differential Revision: https://reviews.llvm.org/D151043
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Wed, 17 May 2023 08:38:14 +0000 (01:38 -0700)]
[lldb] Fix process LLDB_LOG typo (nfci)
This patch fixes the log commands by replacing the LLDB_LOG macro by the
LLDB_LOGF macro. This is necessary in order to format argument with printf.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Mon, 22 May 2023 20:52:09 +0000 (13:52 -0700)]
[lldb] Add support for negative integer to {SB,}StructuredData
This patch refactors the `StructuredData::Integer` class to make it
templated, makes it private and adds 2 public specialization for both
`int64_t` & `uint64_t` with a public type aliases, respectively
`SignedInteger` & `UnsignedInteger`.
It adds new getter for signed and unsigned interger values to the
`StructuredData::Object` base class and changes the implementation of
`StructuredData::Array::GetItemAtIndexAsInteger` and
`StructuredData::Dictionary::GetValueForKeyAsInteger` to support signed
and unsigned integers.
This patch also adds 2 new `Get{Signed,Unsigned}IntegerValue` to the
`SBStructuredData` class and marks `GetIntegerValue` as deprecated.
Finally, this patch audits all the caller of `StructuredData::Integer`
or `StructuredData::GetIntegerValue` to use the proper type as well the
various tests that uses `SBStructuredData.GetIntegerValue`.
rdar://
105575764
Differential Revision: https://reviews.llvm.org/D150485
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Mircea Trofin [Wed, 17 May 2023 22:59:18 +0000 (15:59 -0700)]
[NFC] Surface the validation of FunctionPropertiesAnalysis
Avoids relying on `assert` for some of the validation.
Differential Revision: https://reviews.llvm.org/D150827
Cassie Jones [Mon, 22 May 2023 22:09:37 +0000 (15:09 -0700)]
[test] Add C++ ext_vector_type tests
Add initial tests for the behavior of ext_vector_type vectors for
vector vs scalar ops in C++. Their behavior doesn't agree with the behavior in
C and what the behavior seems like it should be, these are baseline tests before
implementing those changes.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D151059
Alex Langford [Fri, 19 May 2023 21:47:20 +0000 (14:47 -0700)]
[DebugInfo][NFCI] Add unittest for DWARFAbbreviationDeclarationSet
The classes relevant to DWARFDebugAbbrev do not have any unittests
verifying their behavior. Seeing as there is not much error handling
around these classes right now, I want to add some testing as I plan on
making changes to these classes in the near future.
Differential Revision: https://reviews.llvm.org/D151001
Siva Chandra Reddy [Mon, 22 May 2023 21:49:37 +0000 (21:49 +0000)]
[libc] Add -fno-exceptions and -fno-rtti to integration test build.
Also adjust pthread_create_test to accomodate large page sizes. Both
these changes should now fix the full build builders.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D151158
Cassie Jones [Mon, 22 May 2023 22:06:56 +0000 (15:06 -0700)]
[test] Add more ext_vector_type tests for C
Test that all builtin operators type check successfully with one vector
operand and one scalar operand.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D151061
Peter Klausler [Mon, 22 May 2023 20:56:32 +0000 (13:56 -0700)]
[flang][preprocessing] Allow keyword macro to rename a function-like macro
#define FOO(x) ((x)+1)
#define BAR FOO
print *, BAR(1)
should work as one would expect.
Fixes https://github.com/llvm/llvm-project/issues/47162.
Differential Revision: https://reviews.llvm.org/D151154
Yuanfang Chen [Mon, 22 May 2023 21:34:01 +0000 (14:34 -0700)]
[llvm-vscode] update dependencies
Noah Goldstein [Mon, 22 May 2023 20:43:37 +0000 (15:43 -0500)]
Add some missing [[noreturn]] attributes
Missing in header for `pthread_exit` and `exit`.
Missing in spec file for `pthread_exit`.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151143
Noah Goldstein [Mon, 22 May 2023 20:43:26 +0000 (15:43 -0500)]
Cleanup code in `thread_exit`
1) Avoid proper function calls and referencing local variables after
the stack has been deallocated. A proper function call/return or local
variable reference that may have spilled will cause invalid memory
reads after the stack has been deallocated.
2) Mark the function as [[noreturn]] and place
`__builtin_unreachable()` after the `SYS_exit` syscalls.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151142
Noah Goldstein [Thu, 20 Apr 2023 20:05:04 +0000 (15:05 -0500)]
Support custom attributes in pthread_create
Only functional for stack growsdown (same as before), but custom
`stack`, `stacksize`, `guardsize`, and `detachstate` all should be
working.
Differential Revision: https://reviews.llvm.org/D148290
Alexey Bataev [Mon, 22 May 2023 20:12:45 +0000 (13:12 -0700)]
[SLP]Fix PR62665: compiler crash when trying to access non-existing mask
element.
Need to check at first if the SubMask element is PoisonMaskElem to avoid
compiler crash.
Yi Kong [Fri, 19 May 2023 21:56:46 +0000 (14:56 -0700)]
Reland^2 "[BOLT] Parallelize legacy profile merging"
Resovled the issue that when number of tasks is fewer than cores, we end
up creating as many threads as the number of cores, making the
performance worse than the single thread version.
Craig Topper [Mon, 22 May 2023 20:37:34 +0000 (13:37 -0700)]
[RISCV] Increase scalar integer divide latency for SiFive7.
The scalar divider produces 1 bit per cycle so the worst case
latency is the input width plus a couple cycles.
Reviewed By: michaelmaitland
Differential Revision: https://reviews.llvm.org/D151139
Lang Hames [Thu, 13 Apr 2023 18:43:37 +0000 (18:43 +0000)]
[JITLink][ELF][ppc64] Add skeleton ppc64 support and ELF/ppc64 JITLink backend.
This patch introduces a skeleton JITLink ppc64 support header and ELF/ppc64
backend. No relocations are supported in this initial version, but given a
program requiring no relocations (e.g. one that just returns a constant value
from main) the new backend is able to construct a LinkGraph from a ppc64 ELF
relocatable object, and the llvm-jitlink tool is able to execute it.
This commit should also serve as a good example of how to introduce a JITLink
backend for a new architecture.
Reviewed By: sgraenitz, v.g.vassilev, vchuravy, nemanjai, jain98, MaskRay
Differential Revision: https://reviews.llvm.org/D148192
Adrian Prantl [Mon, 22 May 2023 19:52:13 +0000 (12:52 -0700)]
Revert "[PostOrderIterator] Store end iterator (NFC)"
This reverts commit
50f0ee8fbfc1f597ae7d2d49e0996c4338e5652f.
This breaks the bots.
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/lastFailedBuild/consoleFull#-
1141050806a1ca8a51-895e-46c6-af87-
ce24fa4cd561
Craig Topper [Mon, 22 May 2023 19:46:25 +0000 (12:46 -0700)]
[RISCV] Fix some errors in the vector part of the scheduler model for SiFive7.
-FP compare latency was too high.
-Compare instructions need to increase latency to assume no chaining
to later instructions.
vmv.x.s, vmv.s.x, vfmv.f.s, and vfmv.s.f aren't 8 cycles. From the
the perspective of the vector pipeline they are only 4 cycles. Though
vector to scalar has a much higher latency from the perspective
of the scalar pipeline. Will need to adjust in the future.
Reviewed By: michaelmaitland
Differential Revision: https://reviews.llvm.org/D151136
Leandro Lupori [Mon, 22 May 2023 19:06:46 +0000 (16:06 -0300)]
Revert "[flang] Handle array constants of any rank"
This reverts commit
e26e68a4905cc13064987c9b19fa153b54035d36.
This broke gfortran test-suite, test regression/intrinsic_pack_3.f90.
Marcelo Juchem [Mon, 22 May 2023 19:05:41 +0000 (20:05 +0100)]
[CMake] Set compatibility policy for lists in LLVM-Config.cmake.
Fixes "dependent projects fail to build with cmake 3.25 and llvm 16-rc4".
When building [latest `iovisor/bcc`](https://github.com/iovisor/bcc/commit/
1ea0390725391e76256af6a4d0eb857816e6290f), `cmake` complains about a change in the behavior of operator `IN_LIST`:
```console
CMake Warning (dev) at /usr/local/lib/cmake/llvm/LLVM-Config.cmake:230 (if):
Policy CMP0057 is not set: Support new IN_LIST if() operator. Run "cmake
--help-policy CMP0057" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
IN_LIST will be interpreted as an operator when the policy is set to NEW.
Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
cmake/clang_libs.cmake:32 (llvm_map_components_to_libnames)
src/cc/CMakeLists.txt:132 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at /usr/local/lib/cmake/llvm/LLVM-Config.cmake:230 (if):
if given arguments:
"engine" "IN_LIST" "link_components"
Unknown arguments specified
Call Stack (most recent call first):
cmake/clang_libs.cmake:32 (llvm_map_components_to_libnames)
src/cc/CMakeLists.txt:132 (include)
```
This patch addresses this issue by setting the aforementioned policy in `LLVM-Config.cmake`.
Reviewed By: mgorny, thesamesam
Differential Revision: https://reviews.llvm.org/D150884
Closes: https://github.com/llvm/llvm-project/issues/61436
Peter Klausler [Thu, 18 May 2023 17:32:14 +0000 (10:32 -0700)]
[flang] Better error handling and testing of generics with homonymous specifics or derived types
Fortran allows a generic procedure interface to have the same name as a derived
type in the same scope or the same name as one of its specific procedures.
(It can't have both since a derived type and specific procedure can't have the
same name in a scope.)
Some popular compilers allow generic interfaces with distinct accessible homonymous
specific procedures to be merged by USE association. Thsi compiler does not,
and for good reason: it leads to ambiguity in cases where a procedure name appears
outside a reference, such as in a PROCEDURE declaration statement as the procedure's
interface, the target of a procedure pointer assignment statement, or as an
actual argument.
This patch cleans up the code that handles these cases, improves some error
messages, and adds more tests.
Resolves https://github.com/llvm/llvm-project/issues/60228.
Differential Revision: https://reviews.llvm.org/D150915
Peter Klausler [Mon, 22 May 2023 16:47:38 +0000 (09:47 -0700)]
[flang] More precise CONTIGUOUS checking
A recent fix to avoid bogus errors with the CONTIGUOUS attribute caused
declaration checking to miss errors with applications of CONTIGUOUS to
names that are not variables. Restore those error messages, and
add tests to ensure that the original problem remains fixed while
the recent regressions have been resolved.
Differential Revision: https://reviews.llvm.org/D151124
Nick Desaulniers [Mon, 22 May 2023 18:38:19 +0000 (11:38 -0700)]
[clang][ExprConstant] fix __builtin_object_size for flexible array members
As reported by @kees, GCC treats __builtin_object_size of structures
containing flexible array members (aka arrays with incomplete type) not
just as the sizeof the underlying type, but additionally the size of the
members in a designated initializer list.
Fixes: https://github.com/llvm/llvm-project/issues/62789
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D150892
max [Mon, 22 May 2023 16:12:53 +0000 (11:12 -0500)]
[MLIR][python bindings] Expose TypeIDs in python
This diff adds python bindings for `MlirTypeID`. It paves the way for returning accurately typed `Type`s from python APIs (see D150927) and then further along building type "conscious" `Value` APIs (see D150413).
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150839
Artem Belevich [Fri, 19 May 2023 20:19:27 +0000 (13:19 -0700)]
[NVPTX] generalize hasPTX/hasSM predicates. NFC.
Replaces hasSMxy/hasPTXxy with hasSM<xy>/hasPTX<xy> so we can use them as needed
without having to hardcode each version explicitly.
Differential Revision: https://reviews.llvm.org/D150999
Michael Jones [Mon, 15 May 2023 18:17:31 +0000 (11:17 -0700)]
[libc] Use MPFR for strtofloat fuzzing
The previous string to float tests didn't check correctness, but due to
the atof differential test proving unreliable the strtofloat fuzz test
has been changed to use MPFR for correctness checking. Some minor bugs
have been found and fixed as well.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D150905
Jorge Gorbe Moya [Fri, 12 May 2023 18:42:40 +0000 (11:42 -0700)]
[lldb-vscode] Make tests not wait for 'launch' process events if launch fails.
After https://reviews.llvm.org/D147831, lldb-vscode doesn't send a
process event after launch/attach in case of failure. I believe this is
the right interpretation of the spec, because the description of the
event says:
> The event indicates that the debugger has begun debugging a new
> process.
and we haven't started debugging a process if there's no process because
we failed to launch it. This is also supported by the fact that
`request_launch` in vscode.py doesn't wait for the event if passed
`expectFailure=True`. However, this doesn't take into account
*unexpected* launch failures. In that case, `request_launch` will hang
indefinitely waiting for the process event.
This patch changes it so we'll only wait for these events if
`request["success"]` is true, independently of whether any failure was
expected or not.
Differential Revision: https://reviews.llvm.org/D150470
Slava Zakharin [Mon, 22 May 2023 17:08:29 +0000 (10:08 -0700)]
[flang][hlfir] Support rank mismatch with IGNORE_TKR(R).
Reboxing of the actual argument according to the type of the dummy
argument has to be aware of the potential rank mismatch, when
IGNORE_TKR(R) is used. This change only adds support for the mismatching
rank when the dummy argument has unlimited polymorphic type.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D151016
Fangrui Song [Mon, 22 May 2023 17:40:04 +0000 (10:40 -0700)]
[Driver] -fsanitize=function: unsupport wasm after D148573
D148573 made x86-specific -fsanitize=function available to all targets,
but wasm doesn't allow placing data words before the function label,
so unsupport wasm.
Michael Maitland [Thu, 27 Apr 2023 01:19:46 +0000 (18:19 -0700)]
[RISCV][llvm-mca] Add mca tests for riscv lmul instruments
Add llvm-mca tests for RISCV LMUL instruments to show that llvm-mca RISCV LMUL
instruments work.
This commit was previously reverted in
847789d45712. It is now being
recommitted since the memory leak has been fixed in
4d2a1d7dd8f4.
Differential Revision: https://reviews.llvm.org/D149496
Michael Maitland [Wed, 17 May 2023 20:48:18 +0000 (13:48 -0700)]
[llvm-mca][RISCV] Fix llvm-mca RISCVInstrument memory leak
There was a memory leak that presented itself once the llvm-mca
tests were committed. This leak was not checked for by the pre-commit
tests. This change changes the shared_ptr to a unique_ptr to avoid
this problem.
We will know that this fix works once committed since I don't know
whether it is possible to force a lit test to use LSan. I spent the
day trying to build llvm with LSan enabled without much luck. If
anyone knows how to build llvm with LSan for the lit-tests, I am
happy to give it another try locally.
Differential Revision: https://reviews.llvm.org/D150816