Tejas Joshi [Fri, 26 May 2023 14:00:28 +0000 (16:00 +0200)]
[InstCombine] Add tests for icmp of select fold (NFC)
For D150360.
Nikita Popov [Thu, 25 May 2023 14:52:16 +0000 (16:52 +0200)]
[InstCombine] Handle undef when pruning unreachable code
If the branch condition is undef, then behavior is undefined and
neither of the successors are live.
This is to ensure that optimization quality does not decrease
when a constant gets replaced with undef/poison in this context.
Nikita Popov [Fri, 26 May 2023 13:54:51 +0000 (15:54 +0200)]
[ValueTracking] Avoid UB in test (NFC)
Don't use br undef, as it is UB.
Luo, Yuanke [Fri, 26 May 2023 05:28:59 +0000 (13:28 +0800)]
[X86] fold select to mask instructions.
When avx512 is available the lhs operand of select instruction can be
folded with mask instruction, while the rhs operand can't. This patch is
to commute the lhs and rhs of the select instruction to create the
opportunity of folding.
Differential Revision: https://reviews.llvm.org/D151535
Nikita Popov [Fri, 26 May 2023 13:47:50 +0000 (15:47 +0200)]
[InstCombine] Add additional tests for unreachable code (NFC)
Laszlo Kindrat [Thu, 25 May 2023 21:13:28 +0000 (17:13 -0400)]
[LLDB] Explicitly declare constructor in `PersistentExpressionState`
It seems that when trying to link the lldb library explicitly, the inlined default constructor cannot find the vtable for the class. This patch fixes this by explicitly declaring a default constructor in `PersistentExpressionState`, and providing the definition in the source file.
Differential Revision: https://reviews.llvm.org/D151501
Luo, Yuanke [Fri, 26 May 2023 13:04:04 +0000 (21:04 +0800)]
[NFC] refactor code
Split the NFC patch from D151535. Refactor canCombineAsMaskOperation to
take 1 input operand.
Nikita Popov [Fri, 26 May 2023 12:59:36 +0000 (14:59 +0200)]
[InstCombine] Add test for missing assume handling multi-use demanded bits (NFC)
Works if the assume is on a root value or an operation that does
not support multi-use demanded bits.
Nikita Popov [Fri, 26 May 2023 12:39:57 +0000 (14:39 +0200)]
[InstCombine] Use KnownBits::shl() in SimplifyDemandedBits()
It is more precise than the custom logic we had. This came up when
trying to enforce a consistency assertion with computeKnownBits().
Nikita Popov [Fri, 26 May 2023 12:03:12 +0000 (14:03 +0200)]
[KnownBits] Partially synchronize shift implementations (NFC)
And remove some bits of effectively dead code.
Benjamin Kramer [Fri, 26 May 2023 11:57:09 +0000 (13:57 +0200)]
[mlir] Make sure mlir-opt is in the list of substituted tools
otherwise it gets picked up from $PATH, which is not always working
properly.
Nikita Popov [Fri, 26 May 2023 10:09:44 +0000 (12:09 +0200)]
[KnownBits] Add fast-path for shl with unknown shift amount (NFC)
We currently don't call into KnownBits::shl() from ValueTracking
if the shift amount is unknown. If we do try to do so, we get
significant compile-time regressions, because evaluating all 64
shift amounts if quite expensive, and mostly pointless in this case.
Add a fast-path for the case where the shift amount is the full
[0, BitWidth-1] range. This primarily requires a more accurate
estimate of the max shift amount, to avoid taking the fast-path in
too many cases.
Differential Revision: https://reviews.llvm.org/D151540
Benjamin Kramer [Fri, 26 May 2023 11:11:48 +0000 (13:11 +0200)]
[bazel][libc] Add another missing dependency
Felipe de Azevedo Piovezan [Wed, 24 May 2023 11:13:17 +0000 (07:13 -0400)]
[FastISel][NFC] Remove repeated calls to get{Variable,Expr}
This will make it easy to reuse these values in subsequent commits.
Depends on D151331
Differential Revision: https://reviews.llvm.org/D151332
Felipe de Azevedo Piovezan [Wed, 24 May 2023 11:01:11 +0000 (07:01 -0400)]
[FastISel][NFC] Refactor if/else chain into early returns
This will make it easier to add more cases in a subsequent commit and also
better conforms to the coding guidelines.
Depends on D151330
Differential Revision: https://reviews.llvm.org/D151331
Felipe de Azevedo Piovezan [Tue, 23 May 2023 17:52:01 +0000 (13:52 -0400)]
[SelectionDAGBuilder] Handle entry_value dbg.value intrinsics
Summary:
DbgValue intrinsics whose expression is an entry_value and whose address is
described an llvm::Argument must be lowered to the corresponding livein physical
register for that Argument.
Depends on D151329
Reviewers: aprantl
Subscribers:
Felipe de Azevedo Piovezan [Tue, 23 May 2023 15:48:11 +0000 (11:48 -0400)]
[IRTranslator] Implement translation of entry_value dbg.value intrinsics
For dbg.value intrinsics targeting an llvm::Argument address whose expression
starts with an entry value, we lower this to a DEBUG_VALUE targeting the livein
physical register corresponding to that Argument.
Depends on D151328
Differential Revision: https://reviews.llvm.org/D151329
luxufan [Fri, 26 May 2023 03:48:28 +0000 (11:48 +0800)]
[RISCV] Support '.option arch' directive
The proposal of '.option arch' directive is https://github.com/riscv-non-isa/riscv-asm-manual/pull/67
Note: For '.option arch, +/-' directive, version number is not yet supported.
Reviewed By: luismarques, craig.topper
Differential Revision: https://reviews.llvm.org/D123515
dbakunevich [Thu, 11 May 2023 09:30:07 +0000 (16:30 +0700)]
[Utils] Added the ability to print the pass number and IR after it is triggered
As part of this patch, 2 options have been added:
print-pass-numbers and print-after-pass-number.
1) The print-pass-numbers option allows to print the pass names and their ordinals.
The output of the option looks like this:
Running pass ORDINAL PASS_NAME
2) The print-after-pass-number option allows to print IR after pass with the number
which reported by print-passes-names.
Reviewed By: apilipenko, aeubanks
Differential Revision: https://reviews.llvm.org/D149345
Benjamin Kramer [Fri, 26 May 2023 10:24:36 +0000 (12:24 +0200)]
Benjamin Kramer [Fri, 26 May 2023 10:14:50 +0000 (12:14 +0200)]
[bazel][libc] Adjust for
4f1fe19df385445fabde47998affca50c7f1bc1e
This also required a build rule for error_to_string, so add that too.
Benjamin Kramer [Fri, 26 May 2023 10:14:24 +0000 (12:14 +0200)]
[bazel] Run buildifier on libc BUILD. NFC.
Florian Hahn [Fri, 26 May 2023 10:01:18 +0000 (11:01 +0100)]
[Remarks] Retain all remarks by default, add option to drop without DL.
At the moment, dsymutil drops all remarks without debug location.
There are many cases where debug location may be missing for remarks,
mostly due LLVM not preserving debug locations. When using bitstream
remarks for statistical analysis, those missed remarks mean we get an
incomplete picture.
The patch flips the default to keeping all remarks and leaving it to
tools that display remarks to filter out remarks without debug locations
as needed.
The new --remarks-drop-without-debug flag can be used to drop remarks
without debug locations, i.e. restore the previous behavior.
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D151089
Ingo Müller [Fri, 26 May 2023 09:39:22 +0000 (09:39 +0000)]
[mlir][tensor] Fix one-shot bufferization of tensor.reshape.
I believe that the previous implementation did not work on any input. It
called getMemRefType with `layout = {}`, presumably with the intention
to create a MemrefType with identity layout. However, the implementation
of that function returns a MemrefType with *unknown* layout if it is
provided with a default-constructed layout attribute. This patch uses
getMemRefTypeWithStaticIdentityLayout instead, with has identical
behavior except for the case of a default-constructed layout, which it
passes on as-is to the MemrefType.
This problem did not surface in the test because tensor.reshape was not
tested with -one-shot-bufferize. This patch introduces a test copied
from the tests for -tesnor-bufferize adapted in as follows: since the
test is run with "bufferize-function-boundaries", a tensor that is
passed into the function is bufferized into a memref with unknown
layout, which wouldn't be a valid intput for memref.reshape, so the
tests now uses a tensor constructed with arith.constant inside of the
function.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D151544
Owen Pan [Fri, 26 May 2023 09:10:38 +0000 (02:10 -0700)]
[clang-format][doc] Fix a typo introduced in
9aab0db13fb6d
Mike Matthews [Fri, 26 May 2023 08:53:25 +0000 (01:53 -0700)]
[clang-format][doc] Fix contradiction in SortIncludes description
Fixes #62033.
Differential Revision: https://reviews.llvm.org/D147894
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