Brian Gluzman [Fri, 26 May 2023 08:41:18 +0000 (10:41 +0200)]
[clangd] Remove inline Specifier for DefineOutline Tweak
`inline` specifiers should be removed from from the function declaration and
the newly-created implementation.
For example, take the following (working) code:
```cpp
// foo.hpp
struct A {
inline void foo() { std::cout << "hello world\n" << std::flush; }
};
// foo.cpp
#include "foo.hpp"
// main.cpp
#include "foo.hpp"
int main() {
A a;
a.foo();
return 0;
}
// compile: clang++ -std=c++20 main.cpp foo.cpp -o main
```
After applying the tweak:
```
// foo.hpp
struct A {
inline void foo();
};
// foo.cpp
#include "foo.hpp"
inline void A::foo() { std::cout << "hello world\n" << std::flush; }
// main.cpp
#include "foo.hpp"
int main() {
A a;
a.foo();
return 0;
}
// compile: clang++ -std=c++20 main.cpp foo.cpp -o main
```
We get a link error, as expected:
```
/usr/bin/ld: /tmp/main-4c5d99.o: in function `main':
main.cpp:(.text+0x14): undefined reference to `A::foo()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
This revision removes these specifiers from both the header and the source file. This was identified in Github issue llvm/llvm-project#61295.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D151294
Luke Lau [Thu, 25 May 2023 21:16:45 +0000 (22:16 +0100)]
[RISCV] Don't scalarize vector stores if volatile
As noted by @reames in https://reviews.llvm.org/D151211#4373404, we shouldn't
scalarize vector stores of constants if the store is volatile, or vector copies
if either the store or load are volatile.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D151500
Tres Popp [Fri, 26 May 2023 08:17:47 +0000 (10:17 +0200)]
[mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
This patch updates all remaining uses of the deprecated functionality in
mlir/. This was done with clang-tidy as described below and further
modifications to GPUBase.td and OpenMPOpsInterfaces.td.
Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
additional check:
main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
them to a pure state.
```
ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-header-filter=mlir/ mlir/* -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```
Differential Revision: https://reviews.llvm.org/D151542
eopXD [Fri, 26 May 2023 08:26:31 +0000 (01:26 -0700)]
[Clang][RISCV] Add test coverage for typedef of RVV intrinsic data types under riscv_vector.h. NFC
Signed-off by: eop Chen <eop.chen@sifive.com>
Mikael Holmen [Fri, 26 May 2023 08:17:59 +0000 (10:17 +0200)]
[AMDGPU] Silence gcc warning [NFC]
Without the fix gcc complains with
../lib/Target/AMDGPU/SIWholeQuadMode.cpp:1543: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
1542 | unsigned CopyOp = MI->getOperand(1).isReg()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1543 | ? AMDGPU::COPY
| ~~~~~~~~~~~~~~
1544 | : TII->getMovOpcode(TRI->getRegClassForOperandReg(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1545 | *MRI, MI->getOperand(0)));
|
Yeting Kuo [Wed, 26 Apr 2023 04:55:50 +0000 (12:55 +0800)]
[ASAN] Support memory checks on vp.gather/scatter.
The patch supports vp.gather/scatter by allowing addresses being pointer vectors.
And then we just need to check each active pointer element of those pointer vectors.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D149245
Qingyuan Zheng [Fri, 26 May 2023 07:15:10 +0000 (03:15 -0400)]
[clangd] Implement configs to stop clangd produce a certain semantic tokens
This patch introduces the following configurations to .clangd:
```
SemanticTokens:
DisabledKinds: [ ... ]
DisabledModifiers: [ ... ]
```
Based on the config, clangd would stop producing a certain type of semantic tokens from the source file.
Fixes https://github.com/clangd/clangd/discussions/1598
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D148489
eopXD [Fri, 26 May 2023 07:22:34 +0000 (00:22 -0700)]
[Clang][RISCV] Add description for test case . NFC
Jay Foad [Thu, 25 May 2023 15:18:25 +0000 (16:18 +0100)]
[AMDGPU] 4-align SGPR triples
Previously SGPR triples like s[3:5] were aligned on a 3-SGPR boundary
which has no basis in hardware.
Aligning them on a 4-SGPR boundary is at least justified by the
architecture reference guide which says: "Quad-alignment of SGPRs is
required for operation on more than 64-bits".
Currently there are no instructions that take SGPR triples as operands
so the issue is latent.
Differential Revision: https://reviews.llvm.org/D151463
Valery Pykhtin [Fri, 9 Dec 2022 16:34:22 +0000 (17:34 +0100)]
[AMDGPU] Add pass to rewrite partially used virtual superregisters after RenameIndependentSubregs pass with registers of minimal size.
The main purpose of this is to simplify register pressure tracking as after the pass there is no need
to track subreg liveness anymore.
On the other hand this pass creates more possibilites for the subreg unaware code, as many of the subregs
becomes ordinary registers.
Intersting sideeffect: spill-vgpr.ll has lost a lot of spills.
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D139732
Zi Xuan Wu (Zeson) [Fri, 26 May 2023 03:08:35 +0000 (11:08 +0800)]
[CSKY] Add missing relocation type for FK_Data_4 Fixup
Kazu Hirata [Fri, 26 May 2023 06:52:09 +0000 (23:52 -0700)]
[CodeGen] Remove unused declaration EmitMoveFromReturnSlot
The corresponding function definition was removed by:
commit
56e5a2e13e3048fc2ff39029cde406d9f4eb55f3
Author: George Burgess IV <george.burgess.iv@gmail.com>
Date: Sat Mar 10 01:11:17 2018 +0000
LiaoChunyu [Fri, 26 May 2023 06:19:45 +0000 (14:19 +0800)]
[RISCV] Custom lower vector llvm.is.fpclass to vfclass.v
After D149063.
This patch adds support for both scalable and fixed-length vector.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151176
Kazu Hirata [Fri, 26 May 2023 06:41:34 +0000 (23:41 -0700)]
[CodeGen] Remove unused member variable NextBlockInfo
The last use was removed by:
commit
c9a52de0026093327daedda7ea2eead8b64657b4
Author: Akira Hatanaka <ahatanaka@apple.com>
Date: Wed Jun 3 16:41:50 2020 -0700
Fraser Cormack [Fri, 26 May 2023 06:20:01 +0000 (07:20 +0100)]
[RISCV] Regenerate missing test checks
Codegen was different between RV32 and RV64 so the single unified CHECK
was skipping these functions.
Fraser Cormack [Fri, 26 May 2023 06:02:20 +0000 (07:02 +0100)]
[lit][NFC] Remove docs for nonexistent parameter
Fraser Cormack [Fri, 26 May 2023 06:01:09 +0000 (07:01 +0100)]
[lit][NFC] Remove double space after full stop/period
Fraser Cormack [Fri, 26 May 2023 05:59:24 +0000 (06:59 +0100)]
[lit][NFC] Fix a couple of typos
Kazu Hirata [Fri, 26 May 2023 06:31:17 +0000 (23:31 -0700)]
[clang] Remove unused declaration IgnoreLinkageSpecDecls
The declaration and its corresponding function definition were removed
once by:
commit
02093906fa0fd5bacc61b2189ea643c78cd02509
Author: Nathan Sidwell <nathan@acm.org>
Date: Mon Feb 14 10:19:04 2022 -0800
However, the declaration was added back without a corresponding
function definition a few days later by:
commit
18ead23385a4e0e6421d658591b1ee6a1c592b53
Author: Peter Collingbourne <peter@pcc.me.uk>
Date: Thu Feb 17 11:23:33 2022 -0800
This is most likely a rebasing error.
Siva Chandra Reddy [Mon, 15 May 2023 22:12:26 +0000 (22:12 +0000)]
[libc] Make ErrnoSetterMatcher handle logging floating point values.
Along the way, couple of additional things have been done:
1. Move `ErrnoSetterMatcher.h` to `test/UnitTest` as all other matchers live
there now.
2. `ErrnoSetterMatcher` ignores matching `errno` on GPUs.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D151129
Jean Perier [Fri, 26 May 2023 06:21:49 +0000 (08:21 +0200)]
[flang][hlfir] Only canonicalize forall_index if it can be erased
It seems the canonicalization was not correct: it cannot return that
it failed if it did modify the IR.
This was exposed by a new MLIR sanity check added in
https://reviews.llvm.org/D144552.
I am not sure it is legit to return success if the operation being
canonicalized is not modified either. So only remove the loads if
they are the only uses of the forall_index.
Should fix (intermittent?) bot failures like
https://lab.llvm.org/buildbot/#/builders/179/builds/6251
since the new MLIR check was added.
Differential Revision: https://reviews.llvm.org/D151487
Anshil Gandhi [Wed, 24 May 2023 16:37:07 +0000 (09:37 -0700)]
[AMDGPUCodegenPrepare] Add NewPM Support
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D151241
Tobias Hieta [Fri, 26 May 2023 06:11:06 +0000 (08:11 +0200)]
[NFC][Py Reformat] Reformat version-check.py in .github dir
Tobias Hieta [Fri, 26 May 2023 06:06:03 +0000 (08:06 +0200)]
[NFC] Add mlir python reformat SHA to .git-blame-ignore-revs
Tobias Hieta [Wed, 17 May 2023 14:53:39 +0000 (16:53 +0200)]
[NFC][Py Reformat] Reformat python files in mlir subdir
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
Differential Revision: https://reviews.llvm.org/D150782
Kazu Hirata [Fri, 26 May 2023 05:56:08 +0000 (22:56 -0700)]
[clang] Modernize SourceLocation (NFC)
Kazu Hirata [Fri, 26 May 2023 05:56:06 +0000 (22:56 -0700)]
[clang-tody] Fix typos in documentation
Tres Popp [Thu, 25 May 2023 14:35:45 +0000 (16:35 +0200)]
[mlir] Update cast/isa method calls to function calls
This updates the rest (at implementation) of MLIR's use of cast/isa
method calls where function calls are possible and automatic refactoring
is not. These changes occured in .td files or in macros.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Tres Popp [Thu, 25 May 2023 13:56:16 +0000 (15:56 +0200)]
[mlir] Move tblgen code generation to use functional forms of cast/isa
Summary:
The method forms are deprecated. This updates the rest of the tblgen
uses of methods where a function call is available.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Reviewers: rriddle
Tres Popp [Tue, 23 May 2023 09:52:31 +0000 (11:52 +0200)]
[mlir] Add CastInfo for mlir classes subclassing from PointerUnion
This is required to use the function variants of cast/isa/dyn_cast/etc
on them.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Kazu Hirata [Fri, 26 May 2023 05:36:48 +0000 (22:36 -0700)]
[flang] Fix an unused variable warning
This patch fixes:
flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:911:10:
error: unused variable 'inserted' [-Werror,-Wunused-variable]
Nikolas Klauser [Fri, 26 May 2023 05:31:40 +0000 (22:31 -0700)]
[libc++] Fix C++26 transitive includes list
Reviewed By: vitalybuka
Spies: vitalybuka, libcxx-commits
Differential Revision: https://reviews.llvm.org/D151508
Luo, Yuanke [Fri, 26 May 2023 03:47:55 +0000 (11:47 +0800)]
[X86] Add test for select folding.
When avx512 is available the lhs operand of select instruction can be
folded with mask instruction, while the rhs operand can't.
Mehdi Amini [Fri, 26 May 2023 04:50:39 +0000 (21:50 -0700)]
Fix link to the TOSA spec in the dialect doc (NFC)
Fangrui Song [Fri, 26 May 2023 04:23:23 +0000 (21:23 -0700)]
[ELF] findAllByVersion: optimize a find('@') with hasVersionSuffix. NFC
Mehdi Amini [Fri, 26 May 2023 03:58:53 +0000 (20:58 -0700)]
Revert "[MLIR] Add native Bytecode support for properties"
This reverts commit
ca5a12fd69d4acf70c08f797cbffd714dd548348
and follow-up fixes:
df34c288c428eb4b867c8075def48b3d1727d60b
07dc906883af660780cf6d0cc1044f7e74dab83e
ab80ad0095083fda062c23ac90df84c40b4332c8
837d1ce0dc8eec5b17255291b3462e6296cb369b
The first commit was incomplete and broken, I'll prepare a new version
later, in the meantime pull this work out of tree.
Vitaly Buka [Fri, 26 May 2023 03:58:52 +0000 (20:58 -0700)]
[fuzzer] Platfom specific version of PageSize
Mehdi Amini [Fri, 26 May 2023 03:39:26 +0000 (20:39 -0700)]
Bump the MLIR bytecode current revision (version 5) to match the implementation
Mehdi Amini [Fri, 26 May 2023 03:38:32 +0000 (20:38 -0700)]
Fix MLIR Bytecode backward deployment
The condition for guarding the properties section was reversed.
Eugene Burmako [Fri, 26 May 2023 03:17:00 +0000 (20:17 -0700)]
Fix MLIR back-deployment to version < 5 ; properties section should not be emitted.
This was an oversight in the development of bytecode version 5, which was
caught by downstream StableHLO compatibility tests.
Differential revision: https://reviews.llvm.org/D151531
zhanglimin [Fri, 26 May 2023 02:59:39 +0000 (19:59 -0700)]
[fuzzer] Don't hard-code page size in FuzzerUtil.h
Don't hard code the page in FuzzerUtil.h, this breaks on
e.g. LoongArch which defaults to a 16KiB page size.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D140607
Manna, Soumi [Fri, 26 May 2023 03:00:19 +0000 (20:00 -0700)]
[NFC][CLANG] Fix static code analyzer concerns
Reported by Static Code Analyzer Tool:
Inside "CGExprConstant.cpp" file, VisitObjCEncodeExpr() returns null value which is dereferenced without checking.
This patch adds an assert.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D151280
Jason Molenda [Fri, 26 May 2023 02:12:04 +0000 (19:12 -0700)]
TestStackCoreScriptedProcess.py is timing out, skip it
The x86_64 macOS CI bot is failing because this test
times out. It was marked as expectedFail earlier today,
but that's not considered a fail so the CI runs are
red. Skipping it on Darwin for now until Ismail can
look into it.
Shilei Tian [Fri, 26 May 2023 02:12:16 +0000 (22:12 -0400)]
[Clang] Simplify test `clang/test/OpenMP/bug59160.c`
David Blaikie [Fri, 26 May 2023 02:07:08 +0000 (02:07 +0000)]
Fix test by marking it x86 specific
Jie Fu [Fri, 26 May 2023 02:02:21 +0000 (10:02 +0800)]
[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t' error (NFC)
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1007:39: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
if (failed(propReader.parseVarInt(count)))
^~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
LogicalResult parseVarInt(uint64_t &result) {
^
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1033:41: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
if (failed(dialectReader.readVarInt(propertiesIdx)))
^~~~~~~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:926:38: note: passing argument to parameter 'result' here
LogicalResult readVarInt(uint64_t &result) override {
^
2 errors generated.
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1033:41: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
if (failed(dialectReader.readVarInt(propertiesIdx)))
^~~~~~~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:926:38: note: passing argument to parameter 'result' here
LogicalResult readVarInt(uint64_t &result) override {
^
1 error generated.
Jason Molenda [Fri, 26 May 2023 01:05:10 +0000 (18:05 -0700)]
Revert "[fuzzer] Don't hard-code page size in FuzzerUtil.h"
This reverts commit
a2b677e8153758997a9043360cf51333eecc3c44.
reverting
Differential Revision: https://reviews.llvm.org/D140607
because <sys/auxv.h> and getauxval() are not available on macOS;
this change is breaking the mac CI bots.
David Blaikie [Fri, 26 May 2023 00:59:40 +0000 (00:59 +0000)]
llvm-symbolizer: access the base address from the skeleton CU, not the split unit
In Split DWARF, if the unit had a non-trivial base address (a real
low_pc, rather than one with fixed value 0) then computing addresses
needs to access that base address to add to any base address-relative
values. But the code was trying to access the base address in the split
unit, when it's actually in the skeleton unit. So delegate to the
skeleton if it's available.
Fixes #62941
Shilei Tian [Fri, 26 May 2023 00:40:57 +0000 (20:40 -0400)]
[Clang] Fix test case issue introduced by D141627
Jin Xin Ng [Wed, 24 May 2023 00:04:53 +0000 (00:04 +0000)]
[sanitizer] Implement __sanitizer_get_allocated_size_fast
The primary motivation for this change is to allow FreeHooks to obtain
the allocated size of the pointer being freed in a fast, efficient manner.
Differential Revision: https://reviews.llvm.org/D151360
Shilei Tian [Fri, 26 May 2023 00:18:47 +0000 (20:18 -0400)]
[Clang][OpenMP] Fix the issue that list items in `has_device_addr` are still mapped to the target device
This patch fixes the issue that list items in `has_device_addr` are still mapped
to the target device because front end emits map type `OMP_MAP_TO`.
Fix #59160.
Reviewed By: jyu2
Differential Revision: https://reviews.llvm.org/D141627
Joseph Huber [Fri, 26 May 2023 00:15:02 +0000 (19:15 -0500)]
Revert "[libc] Enable hermetic floating point tests"
This passed locally but unfortauntely it seems some tests are not ready
to be made hermetic. Revert for now until we can investigate
specifically which tests are failing and mark those as `UNIT_TEST_ONLY`.
This reverts commit
417ea79e792a87d53f5ac4f5388af4b25aa04d7d.
Joseph Huber [Wed, 24 May 2023 23:07:39 +0000 (18:07 -0500)]
[libc] Enable hermetic floating point tests
This patch enables us to run the floating point tests as hermetic.
Importantly we now use the internal versions of the `fesetround` and
`fegetround` functions.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D151123
TatWai Chong [Thu, 25 May 2023 23:47:23 +0000 (23:47 +0000)]
[mlir][tosa] Add type checking traits to the appropriate ops
Add the trait `SameOperandsAndResultElementType` and
`SameOperandsElementType` to verify ops that are known
to have the same input and output type rather than generate
an invalid tosa IR with mixed data types like:
"tosa.add"(%0, %1) : (tensor<nxbf16>, tensor<nxf32>) -> tensor<nxf32>
Thus apply tosa.cast prior if needed.
Change-Id: Ie866b84e371e3b571ec04f7abb090c216dd39c33
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D150472
yronglin [Thu, 25 May 2023 23:40:51 +0000 (07:40 +0800)]
[Clang][Attribute] Improve the AST/diagnoses fidelity of alignas and _Alignas
- Fix diagnoses when the argument to `alignas` or `_Alignas` is an incomplete type.
Before:
```
./alignas.cpp:1:15: error: invalid application of 'alignof' to an incomplete type 'void'
class alignas(void) Foo {};
~^~~~~
1 error generated.
```
Now:
```
./alignas.cpp:1:15: error: invalid application of 'alignas' to an incomplete type 'void'
class alignas(void) Foo {};
~^~~~~
1 error generated.
```
- Improve the AST fidelity of `alignas` and `_Alignas` attribute.
Before:
```
AlignedAttr 0x13f07f278 <col:7> alignas
`-ConstantExpr 0x13f07f258 <col:15, col:21> 'unsigned long'
|-value: Int 8
`-UnaryExprOrTypeTraitExpr 0x13f07f118 <col:15, col:21> 'unsigned long' alignof 'void *'
```
Now:
```
AlignedAttr 0x14288c608 <col:7> alignas 'void *'
```
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D150528
zhanglimin [Thu, 25 May 2023 23:10:42 +0000 (16:10 -0700)]
[fuzzer] Don't hard-code page size in FuzzerUtil.h
Don't hard code the page in FuzzerUtil.h, this breaks on
e.g. LoongArch which defaults to a 16KiB page size.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D140607
Spenser Bauman [Thu, 25 May 2023 23:06:50 +0000 (16:06 -0700)]
[tosa] Improve inferred shapes of TOSA operations
The TosaInferShapes pass avoids updating the shapes of tensor operators
when the consumers are not TOSA operations, limiting the efficacy of
TosaInferShapes when the IR is a mix of TOSA and other operations.
This change attempts to update the result shapes when the consumers
themselves have reasonable type/shape inference methods.
Reviewed By: eric-k256
Differential Revision: https://reviews.llvm.org/D151228
Tue Ly [Wed, 24 May 2023 21:26:55 +0000 (17:26 -0400)]
[libc][darwin] Add OSUtil for darwin arm64 target so that unit tests can be run.
Currently unit tests cannot be run on macOS due to missing OSUtil.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D151377
Tue Ly [Thu, 25 May 2023 19:54:00 +0000 (15:54 -0400)]
[libc][doc] Update math function status page to show more targets.
Show availability of math functions on each target.
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D151489
Aart Bik [Thu, 25 May 2023 21:30:58 +0000 (14:30 -0700)]
[mlir][sparse][gpu] end to end test for matmul
(1) minor bug fix in copy back [always nice to run stuff ;-)]
(2) run with and without lib (even though some fall back to CPU)
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D151507
Mehdi Amini [Mon, 1 May 2023 15:43:50 +0000 (08:43 -0700)]
[MLIR] Add native Bytecode support for properties
This is adding a new interface (`BytecodeOpInterface`) to allow operations to
opt-in skipping conversion to attribute and serializing properties to native
bytecode.
The scheme relies on a new section where properties are stored in sequence
{ size, serialize_properties }, ...
The operations are storing the index of a properties, a table of offset is
built when loading the properties section the first time.
Back-deployment to version prior to 4 are relying on getAttrDictionnary() which
we intend to deprecate and remove: that is putting a de-factor end-of-support
horizon for supporting deployments to version older than 4.
Differential Revision: https://reviews.llvm.org/D151065
Mehdi Amini [Tue, 23 May 2023 10:04:21 +0000 (03:04 -0700)]
Add a `-verify-roundtrip` option to `mlir-opt` intended to validate custom printer/parser completeness
Running:
MLIR_OPT_CHECK_IR_ROUNDTRIP=1 ninja check-mlir
will now exercises all of our test with a round-trip to bytecode and a comparison for equality.
Reviewed By: rriddle, ftynse, jpienaar
Differential Revision: https://reviews.llvm.org/D90088
Med Ismail Bennani [Thu, 25 May 2023 22:06:44 +0000 (15:06 -0700)]
[lldb] Disable variable watchpoints when going out of scope
If we use a variable watchpoint with a condition using a scope variable,
if we go out-of-scope, the watpoint remains active which can the
expression evaluator to fail to parse the watchpoint condition (because
of the missing varible bindings).
This was discovered after `watchpoint_callback.test` started failing on
the green dragon bot.
This patch should address that issue by setting an internal breakpoint
on the return addresss of the current frame when creating a variable
watchpoint. The breakpoint has a callback that will disable the watchpoint
if the the breakpoint execution context matches the watchpoint execution
context.
This is only enabled for local variables.
This patch also re-enables the failing test following
e1086384e584.
rdar://
109574319
Differential Revision: https://reviews.llvm.org/D151366
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Fabian Mora [Thu, 25 May 2023 20:31:57 +0000 (20:31 +0000)]
[mlir][gpu] Add i64 & f64 support to gpu.shuffle
This patch adds support for i64, f64 values in `gpu.shuffle`, rewriting 64bit shuffles into two 32bit shuffles.
The reason behind this change is that both CUDA & HIP support this kind of shuffling.
The implementation provided by this patch is based on the LLVM IR emitted by clang for 64bit shuffles when using `-O3`.
Reviewed By: makslevental
Differential Revision: https://reviews.llvm.org/D148974
Nick Desaulniers [Thu, 25 May 2023 21:29:12 +0000 (14:29 -0700)]
[Demangle] avoid more std::string_view::substr
In D148959, I removed usage of std::string_view::substr because it may
throw, and libcxxabi cannot use such code. I missed one instance in
llvm::starts_with. That is blocking copying the code back upstream in
D148566.
Mark these helpers noexcept (as they are in C++20) as well, to remind
future travelers.
Make these changes upstream, and copy them back downstream using
libcxxabi/src/demangle/cp-to-llvm.sh.
Reviewed By: #libc_abi, MaskRay, ldionne
Differential Revision: https://reviews.llvm.org/D151260
Eugene Burmako [Thu, 25 May 2023 21:24:51 +0000 (14:24 -0700)]
[MLIR] Fixup Bazel build for Add a pattern for transforming gpu.global_id to thread + blockId * blockDim
This patch updates the Bazel build to catch up with changes in https://reviews.llvm.org/D148978.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D151496
Nick Desaulniers [Thu, 25 May 2023 21:22:47 +0000 (14:22 -0700)]
[libcxxabi] link abort_message into unittest_demangle
unittest_demangle.pass.cpp uses the preprocessor to #include
cxa_demangle.cpp. D148566 will make more use of std::string_view in
libcxxabi rather than the home-grown StringView, but as a result of
D149092, a definition of abort_message needs to be provided.
Otherwise builds of check-cxxabi with -DLLVM_ENABLE_ASSERTIONS=ON will
fail to link with the errors:
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o: in function `(anonymous namespace)::itanium_demangle::starts_with(std::__1::basic_string_view<char, std::__1::char_traits<char> >, char)':
unittest_demangle.pass.cpp:(.text+0x81): undefined reference to `abort_message'
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o: in function `(anonymous namespace)::itanium_demangle::starts_with(std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> >)':
unittest_demangle.pass.cpp:(.text+0x2aa): undefined reference to `abort_message'
/usr/bin/ld: unittest_demangle.pass.cpp:(.text+0x312): undefined reference to `abort_message'
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o: in function `(anonymous namespace)::itanium_demangle::OutputBuffer::writeUnsigned(unsigned long, bool)':
unittest_demangle.pass.cpp:(.text+0x54f): undefined reference to `abort_message'
/usr/bin/ld: unittest_demangle.pass.cpp:(.text+0x5b7): undefined reference to `abort_message'
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o:unittest_demangle.pass.cpp:(.text+0xe6e): more undefined references to `abort_message' follow
/usr/bin/ld: /home/libcxx-builder/.buildkite-agent/builds/google-libcxx-builder-
f0560ea595b1-1/llvm-project/libcxx-ci/build/generic-gcc/test/Output/unittest_demangle.pass.cpp.dir/t.tmp.exe: hidden symbol `abort_message' isn't defined
Use the preprocessor further to provide the definition of abort_message
for this unittest.
Reviewed By: #libc_abi, phosek
Differential Revision: https://reviews.llvm.org/D151160
Louis Dionne [Tue, 23 May 2023 18:50:05 +0000 (11:50 -0700)]
[libc++] Add support for generated tests in the libc++ test format
A recurring problem recently has been that libc++ has several generated
tests which all need to be re-generated before committing a change. This
creates noise during code reviews and friction for contributors.
Furthermore, the way we generated most of these tests resulted in
extremely bad compilation times when using modules, because we defined
a macro before compiling each file.
This commit introduces a new kind of test called a '.gen' test. These
tests are normal shell tests, however the Lit test format will run the
test to discover the actual Lit tests it should run. This basically
allows generating a Lit test suite on the fly using arbitrary code,
which can be used in the future to generate tests like our __verbose_abort
tests and several others.
Differential Revision: https://reviews.llvm.org/D151258
Roland McGrath [Thu, 25 May 2023 21:07:24 +0000 (14:07 -0700)]
[libc] Support LIBC_COPT_USE_C_ASSERT build flag
In this mode, LIBC_ASSERT is just standard C assert.
Reviewed By: abrachet
Differential Revision: https://reviews.llvm.org/D151498
Roland McGrath [Thu, 25 May 2023 20:57:47 +0000 (13:57 -0700)]
[libc] Fix compilation issues in memory_check_utils.h
Strict warnings require explicit static_cast to counteract
default widening of types narrower than int.
Functions in header files should have vague linkage (inline
keyword), not internal linkage (static) or external linkage
(no inline keyword) even for template functions. Note these
don't use the LIBC_INLINE macro since this is only for test code.
Reviewed By: abrachet
Differential Revision: https://reviews.llvm.org/D151494
Med Ismail Bennani [Thu, 25 May 2023 20:59:26 +0000 (13:59 -0700)]
Re-revert "[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module"
This reverts commit
429e74839506ea8ba962d24647264ed81f680bbf since it
didn't address the test failures on GreenDragon.
This patch will mark the tests as expected to fail until I can reproduce
the issue and find a solution.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Alexander Timofeev [Wed, 26 Apr 2023 18:58:17 +0000 (20:58 +0200)]
Don't disable loop unroll for vectorized loops on AMDGPU target
We've got a performance regression after the https://reviews.llvm.org/D115261.
Despite the loop being vectorized unroll is still required.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D149281
Fabian Mora [Thu, 25 May 2023 20:23:46 +0000 (20:23 +0000)]
[mlir][gpu] Add a pattern for transforming gpu.global_id to thread + blockId * blockDim
This patch implements a rewrite pattern for transforming gpu.global_id x
to gpu.thread_id + gpu.block_id * gpu.block_dim.
Reviewed By: makslevental
Differential Revision: https://reviews.llvm.org/D148978
Congcong Cai [Thu, 25 May 2023 20:07:48 +0000 (22:07 +0200)]
[Sema] cast to CXXRecordDecl correctly when diag a default comparison method
Fixed: https://github.com/llvm/llvm-project/issues/62791
Fixed: https://github.com/llvm/llvm-project/issues/62102
in c++20, default comparison is supported. `getLexicalDeclContext` maybe cannot
get the `CXXRecord` if default comparison defined out of `CXXRecord`.
This patch want to get these information from the first function argument.
Reviewed By: #clang-language-wg, erichkeane
Differential Revision: https://reviews.llvm.org/D151365
Fangrui Song [Thu, 25 May 2023 20:05:43 +0000 (13:05 -0700)]
[ELF][test] Add -NEXT and -NOT after D150644 (–-print-memory-usage)
Zenong Zhang [Thu, 25 May 2023 19:40:56 +0000 (12:40 -0700)]
Reapply: [clang][diagnostics] Adding -Wpacked-non-pod to -Wall
Users will be informed when non-POD is not packed using -Wall. This
is also consistent with GCC.
Fixes PR#60832.
Differential Revision: https://reviews.llvm.org/D151162
Jonas Devlieghere [Thu, 25 May 2023 19:54:56 +0000 (12:54 -0700)]
[NFC] Add more lldb python reformat SHA to .git-blame-ignore-revs
Jonas Devlieghere [Thu, 25 May 2023 15:48:57 +0000 (08:48 -0700)]
[NFC][Py Reformat] Reformat python files in lldb
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).
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.
RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style
Differential revision: https://reviews.llvm.org/D151460
Siva Chandra Reddy [Thu, 25 May 2023 19:29:19 +0000 (19:29 +0000)]
[libc] Add macro LIBC_THREAD_LOCAL.
It resolves to thread_local on all platform except for the GPUs on which
it resolves to nothing. The use of thread_local in the source code has been
replaced with the new macro.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D151486
Artem Belevich [Thu, 25 May 2023 19:39:37 +0000 (12:39 -0700)]
[CUDA] Explicitly construct dim3() return values.
Fixes CUDA build break caused by
5c082e7e15e38a2eea1f506725ef
Jan Svoboda [Thu, 25 May 2023 16:22:38 +0000 (09:22 -0700)]
[clang] Make `FileEntryRef::getDir()` return the as-requested `DirectoryEntryRef`
For redirected file entries, `FileEntryRef::getDir()` returns the parent directory entry of the target file entry. This differs from `FileEntry::getDir()` that always returns the parent directory that was last used to look up that file.
After switching from `FileEntry` to `FileEntryRef` for umbrella headers in D142113, this discrepancy became observable and caused Clang to emit incorrect diagnostics.
This patch changes Clang so that it always associates `FileEntryRef` with the parent directory that was used to look it up. This brings its behavior closer to `FileEntry`, but without the hacky mutation.
This also ensures that `llvm::sys::path::parent_path(FileRef->getNameAsRequested()) == FileRef->getDir()->getName()`. Previously, `FileRef->getDir()` would fall underneath the redirecting VFS into the world of on-disk paths.
Reviewed By: benlangmuir, rmaz
Differential Revision: https://reviews.llvm.org/D151398
Thurston Dang [Thu, 25 May 2023 19:16:38 +0000 (19:16 +0000)]
[sanitizer] Add new symbolizer symbol
wmemchr symbol is required after https://reviews.llvm.org/D144394
(see https://lab.llvm.org/buildbot/#/builders/37/builds/22340 for error message)
Differential Revision: https://reviews.llvm.org/D151484
Peiming Liu [Thu, 25 May 2023 18:35:28 +0000 (18:35 +0000)]
[mlir][sparse] fix bugs when computing the memory size when lowering pack op.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D151481
Artem Belevich [Mon, 22 May 2023 23:32:50 +0000 (16:32 -0700)]
[CUDA] Add CUDA wrappers over clang builtins for sm_90.
Differential Revision: https://reviews.llvm.org/D151362
Artem Belevich [Wed, 24 May 2023 00:05:30 +0000 (17:05 -0700)]
[NVPTX, CUDA] barrier intrinsics and builtins for sm_90
Differential Revision: https://reviews.llvm.org/D151363
Artem Belevich [Mon, 22 May 2023 22:14:40 +0000 (15:14 -0700)]
[CUDA] plumb through new sm_90-specific builtins.
Differential Revision: https://reviews.llvm.org/D151168
Artem Belevich [Fri, 19 May 2023 20:21:28 +0000 (13:21 -0700)]
[NVPTX] add new sm90-specific intrinsics.
Differential Revision: https://reviews.llvm.org/D151009
Artem Belevich [Wed, 24 May 2023 00:51:09 +0000 (17:51 -0700)]
[CUDA] bump supported CUDA version to 12.1/11.8
Differential Revision: https://reviews.llvm.org/D151361
Artem Belevich [Wed, 24 May 2023 19:13:41 +0000 (12:13 -0700)]
[CUDA] Relax restrictions on variadics in host-side compilation.
D150718 allows variadics during GPU compilation, but we also need to do it for
the host compilation as well, as it will see the same code.
Differential Revision: https://reviews.llvm.org/D151359
Alex Brachet [Thu, 25 May 2023 18:55:47 +0000 (18:55 +0000)]
[compiler-rt] Use ZLIB_FOUND not LLVM_ENABLE_ZLIB
LLVM_ENABLE_ZLIB is set to On by default and does not imply that ZLIB
was actually found, only being set to FORCE_ON would imply that it was
found before control reached compiler-rt/test/CMakeLists.txt. Instead,
use ZLIB_FOUND which guarantees that zlib is available.
Differential Revision: https://reviews.llvm.org/D151229
Aaron Ballman [Thu, 25 May 2023 18:50:51 +0000 (14:50 -0400)]
Revert "[clang][diagnostics] Add -Wpacked-non-pod to -Wall"
This reverts commit
9ed3d85e26d8594440bca84fe868a62ac6560ac8.
It broke some bots:
https://lab.llvm.org/buildbot/#/builders/245/builds/8876
Austin Chang [Thu, 25 May 2023 17:10:31 +0000 (12:10 -0500)]
[InstCombine] Improve bitreverse optimization
This patch utilizes the helper function implemented in D149699 and thus folds the following cases:
```
bitreverse(logic_op(x, bitreverse(y))) -> logic_op(bitreverse(x), y)
bitreverse(logic_op(bitreverse(x), y)) -> logic_op(x, bitreverse(y))
bitreverse(logic_op(bitreverse(x), bitreverse(y))) -> logic_op(x, y) in multiuse case
```
Reviewed By: goldstein.w.n, RKSimon
Differential Revision: https://reviews.llvm.org/D151246
Austin Chang [Thu, 25 May 2023 17:10:31 +0000 (12:10 -0500)]
[InstCombine] Add regression test cases for bitreverse optimization; NFC
Fold the following case on IR InstCombine pass. This patch includes the new test cases for this optimization
```
bitreverse(logic_op(x, bitreverse(y))) -> logic_op(bitreverse(x), y)
bitreverse(logic_op(bitreverse(x), y)) -> logic_op(x, bitreverse(y))
bitreverse(logic_op(bitreverse(x), bitreverse(y))) -> logic_op(x, y) with multi-use
```
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D151245
Rashmi Mudduluru [Thu, 25 May 2023 18:28:03 +0000 (11:28 -0700)]
[-Wunsafe-buffer-usage] Group variables associated by pointer assignments
Differential Revision: https://reviews.llvm.org/D145739
Zenong Zhang [Thu, 25 May 2023 18:17:29 +0000 (14:17 -0400)]
[clang][diagnostics] Add -Wpacked-non-pod to -Wall
Users will be informed when non-POD is not packed using -Wall. This is
also consistent with GCC.
Fixes https://github.com/llvm/llvm-project/issues/60832
Differential Revision: https://reviews.llvm.org/D151162
Chia-hung Duan [Thu, 25 May 2023 17:36:10 +0000 (17:36 +0000)]
[scudo] releaseToOSMaybe can fail if it can't allocate PageMap
PageMap is allocated with MAP_ALLOWNOMEM if there's no static buffer
left. So it can be failed and return nullptr without any assertion
triggered. Instead of crashing in the releaseToOSMaybe in the middle,
just return and let the program handles the page failure.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D151379
Craig Topper [Thu, 25 May 2023 18:01:19 +0000 (11:01 -0700)]
[SelectionDAG][AArch64][ARM] Remove setFlags call from DAGTypeLegalizer::SetPromotedInteger.
This was originally added to preserve FMF on SETCC. Unfortunately,
it also incorrectly preserves nuw/nsw on ADD/SUB in some cases.
There's also no guarantee the new opcode is even the same opcode
as the original node.
This patch removes the code and adds code to explicitly preserve
FMF flags in the SETCC promotion function.
The other test changes are from nuw/nsw not being preserved. I
believe for all these tests it was correct to preserve the flags,
so we need new code to preserve the flags when possible. I'll post
another patch for that since it's a riskier change.
This should unblock D150769.
Differential Revision: https://reviews.llvm.org/D151472
Shoaib Meenai [Thu, 25 May 2023 01:32:38 +0000 (18:32 -0700)]
[CodeGen] Make __clang_call_terminate have an unwind table entry
This enables unwinders to step past that frame on architectures that
don't use DWARF unwinding (such as armv7), e.g. when debugging. The
problem should theoretically be architecture-agnostic, but according to
https://discourse.llvm.org/t/51633/2 it gets masked on architectures
that use DWARF unwind info.
Fixes https://github.com/llvm/llvm-project/issues/40696
Reviewed By: efriedma, rnk
Differential Revision: https://reviews.llvm.org/D151393
Sterling Augustine [Thu, 25 May 2023 17:51:59 +0000 (10:51 -0700)]
Add missing dependency for tests.
Mark de Wever [Thu, 25 May 2023 17:45:50 +0000 (19:45 +0200)]
[libc++][test] Mark throw_format_error as noreturn.
This fixes and GCC error. This was tested in D135787.