rkayaith [Wed, 9 Nov 2022 03:39:18 +0000 (22:39 -0500)]
[mlir][CAPI] Allow running pass manager on any operation
`mlirPassManagerRun` is currently restricted to running on
`builtin.module` ops, but this restriction doesn't exist on the C++
side. This renames it to `mlirPassManagerRunOnOp` and updates it to take
`MlirOperation` instead of `MlirModule`.
Depends on D143352
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D143354
rkayaith [Tue, 8 Nov 2022 21:55:06 +0000 (16:55 -0500)]
[mlir][python] Add generic operation parse APIs
Currently the bindings only allow for parsing IR with a top-level
`builtin.module` op, since the parse APIs insert an implicit module op.
This change adds `Operation.parse`, which returns whatever top-level op
is actually in the source.
To simplify parsing of specific operations, `OpView.parse` is also
added, which handles the error checking for `OpView` subclasses.
Reviewed By: ftynse, stellaraccident
Differential Revision: https://reviews.llvm.org/D143352
Rahul Kayaith [Sat, 25 Feb 2023 07:30:46 +0000 (02:30 -0500)]
[mlir][AsmParser] Improve parse{Attribute,Type} error handling
Currently these functions report errors directly to stderr, this updates
them to use diagnostics instead. This also makes partially-consumed
strings an error if the `numRead` parameter isn't provided (the
docstrings already claimed this happened, but it didn't.)
While here I also tried to reduce the number of overloads by switching
to using default parameters.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D144804
Arthur Eubanks [Wed, 1 Mar 2023 21:21:04 +0000 (13:21 -0800)]
[NFC][Pipeline] Move PromotePass into GlobalCleanupPM
Joseph Huber [Wed, 1 Mar 2023 21:02:00 +0000 (15:02 -0600)]
[OpenMP][NFC] Clean up Twines and other issues in plugins
Summary:
Tihs patch is mostly NFC to fix some warning currently present in OpenMP
offloading plugins. Specifically this mostly removes the use of Twine
variables in favor of LLVM's small string. Twine variables are prone to
use-after-free and this is a cleaner way to concatenate a string.
Nick Desaulniers [Wed, 1 Mar 2023 20:58:13 +0000 (12:58 -0800)]
[llvm][LowerConstantIntrinsics] add debug statements
These can help us better understand what __builtin_constant_p and
__builtin_object_size get folded to.
$ clang -mllvm -debug-only=lower-is-constant-intrinsic ...
Reviewed By: void
Differential Revision: https://reviews.llvm.org/D143521
Jeff Bailey [Wed, 1 Mar 2023 20:55:59 +0000 (20:55 +0000)]
[libc] Fix mismatch in exception decl
When running the libc tests under vscode, I got an error about a
mismatches exception declaration for strerror. Since string.h
seems to be getting included transitively anyway, just include
it and rely on its definition.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D144803
Peiming Liu [Wed, 1 Mar 2023 19:03:02 +0000 (19:03 +0000)]
[mlir][sparse] support coiteration with fused reshape tensor
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145091
Konstantin Belousov [Fri, 20 Jan 2023 23:32:11 +0000 (18:32 -0500)]
[libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches
Only 64bit architectures can be supported this way, because libcxx
defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit
arches do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.
Fixes:
83387dbc18e7998f87aa4a2d35320bcb2ed5c392
Reviewed by: arichardson, ldionne, emaste, Mordante
Differential Revision: https://reviews.llvm.org/D142422
Andrew Gozillon [Wed, 1 Mar 2023 20:32:54 +0000 (14:32 -0600)]
[Flang][Tool][bbc] Emit module wrapper in addition to body
This change seeks to emit the full module from the bbc tool and
not just the body. This change currently does not break existing tests
when running check-(mlir, flang, all). This stops the discarding of
any attributes that may be applied to the Module during
compilation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D144869
Louis Dionne [Wed, 1 Mar 2023 20:25:29 +0000 (15:25 -0500)]
[libc++] Use generic-cxx20 instead of apple-cxx20 on Apple CI
apple-cxx20 is equivalent to generic-cxx20, so we don't need it anymore.
It had been introduced when clang-tidy was enabled explicitly from
run-buildbot, but that's not needed anymore since clang-tidy is
enabled from the buildkite pipeline definition.
Louis Dionne [Wed, 1 Mar 2023 20:11:44 +0000 (15:11 -0500)]
[libc++][NFC] Remove trailing whitespace on line and clang-format
This broke the CI after
813e1da974 was checked in.
Joseph Huber [Wed, 1 Mar 2023 20:02:40 +0000 (14:02 -0600)]
[Libomptarget] Fix block and thread limit environment variables not being respected
The next-gen plugins did not properly set the values from
`OMP_NUM_TEAMS` and `OMP_TEAMS_THREAD_LIMIT`. This is because these
maximum values are set by each plugin to its hardware maximum. This
happens *after* the previous initialization. Move it to the correct
place and then add a test.
Fixes https://github.com/llvm/llvm-project/issues/61082
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D145105
Sjoerd Meijer [Wed, 1 Mar 2023 14:43:35 +0000 (14:43 +0000)]
[AArch64] Precommit some more LD1R splat tests for scalar int/fp loads
Differential Revision: https://reviews.llvm.org/D145067
Slava Zakharin [Wed, 1 Mar 2023 16:42:22 +0000 (08:42 -0800)]
[flang] Check for BIND(C) through use association.
If the interface specifies BIND(C), then the declarations using
this interface inherit BIND(C), and if they are referenced via use
association they must be classified as BIND(C) subprograms.
Differential Revision: https://reviews.llvm.org/D145084
Louis Dionne [Wed, 1 Mar 2023 19:45:17 +0000 (14:45 -0500)]
[libc++] Refactor the std/depr C headers tests
Move multiple tests to .compile.pass.cpp when they were not running
anything and reindent a bit more consistently.
Leonard Chan [Wed, 1 Mar 2023 19:42:15 +0000 (19:42 +0000)]
[llvm] Prevent building for riscv32-unknown-fuchsia
Fuchsia is exclusively 64-bit so this throw an error when using this
triple.
Differential Revision: https://reviews.llvm.org/D144998
Frederik Gossen [Wed, 1 Mar 2023 19:33:49 +0000 (14:33 -0500)]
[MLIR] Add `print-ir` pass for debugging purposes
Add pass to print the entire IR on the debug stream.
This is meant for debugging purposes to inspect the IR at a specific point in the pipeline.
Differential Revision: https://reviews.llvm.org/D144918
Renaud-K [Mon, 27 Feb 2023 22:39:18 +0000 (14:39 -0800)]
[flang] Move fir.select_type into the PolymorphicOpConversion pass
https://reviews.llvm.org/D144921
Fangrui Song [Wed, 1 Mar 2023 19:16:18 +0000 (11:16 -0800)]
[DivRemPairs] Remove legacy pass
Following recent changes to remove non-core legacy passes.
Dan Liew [Tue, 28 Feb 2023 01:05:19 +0000 (17:05 -0800)]
[LLDB] Expose several methods in SBWatchpoint
This patch adds the following methods:
* `GetType()`
* `GetWatchValueKind()`
* `GetWatchSpec()`
* `IsWatchingReads()`
* `IsWatchingWrites()`
These mostly expose methods that `lldb_private::Watchpoint` already
had. Tests are included that exercise these new methods.
The motivation for exposing these are as follows:
* `GetType()` - With this information and the address from a watchpoint
it is now possible to construct an SBValue from an SBWatchpoint.
Previously this wasn't possible. The included test case illustrates
doing this.
* `GetWatchValueKind()` - This allows the caller to determine whether the
watchpoint is a variable watchpoint or an expression watchpoint. A new
enum (`WatchpointValueKind`) has been introduced to represent the
return values. Unfortunately the name `WatchpointKind` was already
taken.
* `GetWatchSpec()` - This allows (at least for variable watchpoints)
to use a sensible name for SBValues created from an SBWatchpoint.
* `IsWatchingReads()` - This allow checking if a watchpoint is
monitoring read accesses.
* `IsWatchingWRites()` - This allow checking if a watchpoint is
monitoring write accesses.
rdar://
105606978
Reviewers: jingham, mib, bulbazord, jasonmolenda, JDevlieghere
Differential Revision: https://reviews.llvm.org/D144937
Mitch Phillips [Wed, 1 Mar 2023 19:00:49 +0000 (11:00 -0800)]
[lld] [MTE] Add DT_AARCH64_MEMTAG_* dynamic entries, and small cleanup
Adds the new AArch64-ABI dynamic entry generation to LLD. This will
allow Android to move from the Android-specific ELF note onto the
dynamic entries.
Change the behaviour of an unspecified --android-memtag-mode. Now, when
unspecified, this will print a warning that you're doing a no-op, rather
than implicitly turning on sync mode. This is important for MTE globals
later, where a binary containing static tagged global descriptors
shouldn't have MTE turned on without specific intent being passed to the
linker.
For now, continue to emit the Android ELF note by default. In future, we
can probably make it only emit the note when provided a flag.
Do a quick NFC-cleanup of the ELF note while we're here. It doesn't
change anything about the ELF note itself, but makes it more clear to
the reader of the code what alignment requirements are being (previously
implicitly) met.
Reviewed By: fmayer, MaskRay
Differential Revision: https://reviews.llvm.org/D143769
usama hameed [Wed, 1 Mar 2023 19:07:03 +0000 (00:07 +0500)]
[Sanitizers] Error out for -static-libsan on darwin
since it is not supported
Differential Revision: https://reviews.llvm.org/D144672
Peiming Liu [Mon, 27 Feb 2023 22:40:34 +0000 (22:40 +0000)]
[mlir][sparse] fuse collapse_shape on sparse tensor with GenericOp.
Instead of always materializing a new sparse tensor after reshape, this patch tries to fuses the reshape (currently only on COO) with GenericOp and coiterates with the reshaped tensors without allocating a new sparse tensor.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145016
Jakub Kuderski [Wed, 1 Mar 2023 19:03:17 +0000 (14:03 -0500)]
[mlir][spirv] Support shaped types with index element
This makes the SPIR-V type converter first convert `index` element types
to the right integer type.
Fixes: https://github.com/llvm/llvm-project/issues/61054
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D145090
Simon Pilgrim [Wed, 1 Mar 2023 19:03:56 +0000 (19:03 +0000)]
[DAG] expandIntMINMAX - attempt to match existing SETCC node
As noticed on D144789, when we have pairs of min/max nodes we often end up with multiple comparisons which we could reuse with commuted select ops, so check to see if a suitable SETCC already exists. This also allowed us to remove a similar X86 peephole.
There are other getSETCC cases where we could safely reuse other CondCodes as well - I've been trying to think of how we could reuse this logic in SelectionDAG but haven't found anything that always works well.
An alternative would be to have a TLI callback that returns a preferred CondCode from a list of options, I've noticed this helped fpclamptosat tests on some other targets (MVE + WebAssembly), but other tests suffered.
Differential Revision: https://reviews.llvm.org/D145065
Mitch Phillips [Wed, 1 Mar 2023 18:49:39 +0000 (10:49 -0800)]
[llvm-readobj] Add --memtag
This adds functionality to readelf/readobj to specifically handle
MTE-related bits, like the AARCH64_MEMTAG_* dynamic entries, and a
decoder for the Android-specific ELF note.
Reviewed By: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D143693
Alex Brachet [Wed, 1 Mar 2023 18:57:07 +0000 (18:57 +0000)]
[libc] Fix strcspn
Differential Revision: https://reviews.llvm.org/D144995
Michael Jones [Tue, 28 Feb 2023 23:10:08 +0000 (15:10 -0800)]
[libc] Fix printf %f rounding condition
When running the tbin2dec tests I found a rounding error in my code.
Upon inspection I realized it was due to a lack of parenthesis when
calculating the number of trailing digits. This patch fixes that mistake
and adds unit tests to catch regressions in future.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145011
Alex Brachet [Wed, 1 Mar 2023 18:54:05 +0000 (18:54 +0000)]
[GWP-ASan][Fuchsia] Use more modern zxtest testing macros
Alex Brachet [Wed, 1 Mar 2023 18:49:18 +0000 (18:49 +0000)]
[GWP-ASan] Stop using type aliases for ::testing:: types
Louis Dionne [Wed, 1 Mar 2023 18:21:01 +0000 (13:21 -0500)]
[libc++][NFC] Move test to .compile.pass.cpp since it doesn't run anything
Shivam kunwar [Wed, 1 Mar 2023 18:11:36 +0000 (23:41 +0530)]
[libc++] implement move_iterator<T*> should be a random access iterator \n Differntial Revision- https://reviews.llvm.org/D135248
Sanjay Patel [Wed, 1 Mar 2023 17:18:44 +0000 (12:18 -0500)]
[PhaseOrdering] add test for vector load and cast transforms; NFC
issue #51397
Sanjay Patel [Wed, 1 Mar 2023 14:24:54 +0000 (09:24 -0500)]
[InstCombine] add tests for signed absolute diff; NFC
Kazu Hirata [Wed, 1 Mar 2023 17:42:31 +0000 (09:42 -0800)]
[mlir] Fix a warning
This patch fixes:
mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp:37:13: error:
unused function 'debugPrintLoopInShortForm'
[-Werror,-Wunused-function]
Arthur Eubanks [Tue, 28 Feb 2023 23:06:51 +0000 (15:06 -0800)]
[ADCE] Keep track of if we modified the CFG and preserve analyses accordingly
No measurable compile time impact, but might as well resolve the TODO.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145014
Arthur Eubanks [Tue, 28 Feb 2023 23:38:01 +0000 (15:38 -0800)]
[PassBuilder] Always enable CountVisitsPass when stats are enabled
Rather than having a separate flag.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D145015
Anshil Gandhi [Wed, 1 Mar 2023 17:19:17 +0000 (10:19 -0700)]
[SIAnnotateControlFlow] Use Uniformity analysis
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D145013
Anshil Gandhi [Wed, 1 Mar 2023 17:15:31 +0000 (10:15 -0700)]
[AMDGPUUnifyDivergentExitNodes] Use Uniformity Analysis
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D145018
Ashay Rane [Tue, 28 Feb 2023 01:14:13 +0000 (19:14 -0600)]
[clang] drop buggy use of `-serialize-diagnostics` flag
The `-serialize-diagnostics` flag requires a filename to be passed
immediately after it, but the filename argument was skipped in the
P1689.cppm clang test. This caused the code to incorrectly consume the
argument that followed as the dignostics file.
Since the `-serialize-diagnostics` flag isn't needed for this test to
work, this patch removes it instead of passing a file argument.
Differential Revision: https://reviews.llvm.org/D144934
Chris Cotter [Wed, 1 Mar 2023 16:51:46 +0000 (11:51 -0500)]
[ASTMatcher] Add coroutineBodyStmt matcher
The coroutineBodyStmt matcher matches CoroutineBodyStmt AST nodes.
Differential Revision: https://reviews.llvm.org/D140794
David Green [Wed, 1 Mar 2023 16:22:13 +0000 (16:22 +0000)]
[DAG] ABD is not reassociative
I'm not sure how I missed this in the testing, but as far as I understand
whilst ABDS and ABDU are commutive they are not associative. This patch
disables reassociateOps from visitABD, fixing the problems found in #61069.
ABDU: https://alive2.llvm.org/ce/z/eiT5QG
ABDS: https://alive2.llvm.org/ce/z/HzE29l
Differential Revision: https://reviews.llvm.org/D145064
Jakub Kuderski [Wed, 1 Mar 2023 16:10:40 +0000 (11:10 -0500)]
[ADT] Use `adl_begin`/`end` in `enumerate`
This allows `enumerate` to work with range types that expose custom
`begin`/`end` functions.
This is a cleanup in preparation for future changes in
https://reviews.llvm.org/D144503.
Reviewed By: zero9178
Differential Revision: https://reviews.llvm.org/D145026
Nicolas Vasilache [Wed, 1 Mar 2023 16:10:49 +0000 (08:10 -0800)]
Timm Bäder [Thu, 12 Jan 2023 11:47:02 +0000 (12:47 +0100)]
[clang][Interp] Handle DecompositionDecls
Differential Revision: https://reviews.llvm.org/D138802
Arthur O'Dwyer [Sun, 31 Jul 2022 16:25:05 +0000 (12:25 -0400)]
[libc++] Fix modules issues on OS X
First, fix a collision with the Point type from MacTypes.h, which was
reported on Slack, 2022-07-31: https://cpplang.slack.com/archives/C2X659D1B/p1659284691275889
Second, rename the meta:: namespace to types::. OSX's "/usr/include/ncurses.h"
defines a `meta` function, and is (for some reason) included in
"<SDK>/usr/include/module.modulemap", so that identifier is off-limits
for us to use in anything that compiles with -fmodules:
libcxx/test/support/type_algorithms.h:16:11: error: redefinition of 'meta' as different kind of symbol
namespace meta {
^
<SDK>/usr/include/ncurses.h:603:28: note: previous definition is here
extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */
^
Finally, add a CI configuration for modules on OS X to make sure it
does not regress.
Differential Revision: https://reviews.llvm.org/D144915
bixia1 [Tue, 28 Feb 2023 20:52:16 +0000 (12:52 -0800)]
[mlir][sparse] Improve the implementation of sparse_tensor.new for the codegen path.
Rewrite a NewOp into a NewOp of a sorted COO tensor and a ConvertOp for
converting the sorted COO tensor to the destination tensor type.
Codegen a NewOp of a sorted COO tensor to use the new bulk reader API and sort
the elements only when the input is not sorted.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D144504
Nicolas Vasilache [Wed, 1 Mar 2023 11:47:56 +0000 (03:47 -0800)]
[mlir][MemRef] Rewrite multi-buffering with proper composable abstractions
Rewrite and document multi-buffering properly:
1. Use IndexingUtils / StaticValueUtils instead of duplicating functionality
2. Properly plumb RewriterBase through.
3. Add support
4. Better debug messages.
This revision is otherwise almost NFC, if it weren't for the extra DeallocOp
support that would previoulsy make multi-buffering fail.
Depends on: D145036
Differential Revision: https://reviews.llvm.org/D145055
Alex Bradbury [Wed, 1 Mar 2023 15:17:19 +0000 (15:17 +0000)]
[clang][RISCV][test] Add coverage for __fp16 support in arguments/returns
By choice, we don't set HalfArgsAndReturns=true (which would allow
__fp16 in args and returns). Add test coverage for this to ensure it
isn't changed by accident.
Florian Hahn [Wed, 1 Mar 2023 15:06:33 +0000 (16:06 +0100)]
[SimpleLoopUnswitch] Forget loops before invalidating IR.
Invalidate SCEV before adjusting switch instruction, so the IR remains
in a valid state for SCEV invalidation.
Jirui Wu [Mon, 27 Feb 2023 15:03:42 +0000 (15:03 +0000)]
[ARM] Remove a redundant function fixupBTI
Since the redundant BTI instructions emitted by jump tables are now
removed in the ARMBranchTargets pass, the fixupBTI function is not needed
in the ARMConstantIslandPass. Some related tests are removed as well.
The relevant patch that removes the redundant BTI instructions:
https://reviews.llvm.org/D144470
Differential Revision: https://reviews.llvm.org/D145048
Valentin Clement [Wed, 1 Mar 2023 14:43:34 +0000 (15:43 +0100)]
[flang] MERGE result is polymorphic only if TSOURCE and FSOURCE are polymorphic
16.9.129 point 4: the result is polymorphic if and only if both TSOURCE and
FSOURCE are polymorphic.
If neither TSOURCE and FSOURCE are polymorphic then the current behavior is
preserved.
Depends on D145058
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D145060
Igor Kushnir [Wed, 1 Mar 2023 14:44:43 +0000 (09:44 -0500)]
LibclangTest: remove libclang-test-* tmp dir reliably
Temporary directories created by two LibclangReparseTest tests -
ReparseWithModule and clang_parseTranslationUnit2FullArgv - remained in
the system temporary directory after running libclangTests, because not
all files and subdirectories created in TestDir were added to set
LibclangParseTest::Files.
Differential Revision: https://reviews.llvm.org/D143415
Valentin Clement [Wed, 1 Mar 2023 14:41:56 +0000 (15:41 +0100)]
[flang] Allow scalar boxed record type in intrinsic elemental lowering
Relax a bit the condition added in D144417 and allow scalar polymorphic entities
and boxed scalar record type.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D145058
Timm Bäder [Wed, 26 Oct 2022 09:20:13 +0000 (11:20 +0200)]
[clang][Interp] This pointers are writable in de-/constructors
This is possible in C++20, so we need to check this when doing stores.
Differential Revision: https://reviews.llvm.org/D136751
Alexey Bataev [Wed, 1 Mar 2023 14:34:52 +0000 (06:34 -0800)]
[SLP][NFC]Update the test to simplify and avoid dead instruction
removal, NFC.
Nikita Popov [Mon, 27 Feb 2023 14:23:01 +0000 (15:23 +0100)]
[CodeGen] Always expand division larger than i128
Default MaxDivRemBitWidthSupported to 128, so that divisions larger
than 128 bits are always expanded, without requiring additional
configuration from the target.
Note that this may still emit calls to __udivti3 on 32-bit targets,
which likely don't have an implementation of that builtin. However,
I believe this is sufficient to fix
https://github.com/llvm/llvm-project/issues/60531, because Zig must
already be defining those builtins.
Differential Revision: https://reviews.llvm.org/D144871
Mel Chen [Tue, 21 Feb 2023 07:08:37 +0000 (23:08 -0800)]
[RISCV] Pre-commit test case for ordered reduction, NFC
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D144458
Sander de Smalen [Mon, 30 Jan 2023 11:21:31 +0000 (11:21 +0000)]
[LoopVectorize] Use overflow-check analysis to improve tail-folding.
This work follows on from D142109 and addresses a possible regression
when we know the loop iteration counter cannot overflow.
When we know the overflow-check always evaluates to false, it's better to
use the other style of tail folding where it assumes a runtime check was
added, because that avoids having to calculate a modified trip-count.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D142894
LLVM GN Syncbot [Wed, 1 Mar 2023 14:01:57 +0000 (14:01 +0000)]
[gn build] Port
f8d10d5ac9ab
Sanjay Patel [Wed, 1 Mar 2023 13:32:27 +0000 (08:32 -0500)]
[InstCombine] prevent miscompiles from select-of-div/rem transform
This avoids the danger shown in issue #60906.
There were no regression tests for these patterns, so these potential
failures have been around for a long time.
We freeze the condition and preserve the optimization because
getting rid of a div/rem is always a win.
Here are a couple of examples that can be corrected by freezing the
condition:
https://alive2.llvm.org/ce/z/sXHTTC
Differential Revision: https://reviews.llvm.org/D144671
David Green [Wed, 1 Mar 2023 13:54:03 +0000 (13:54 +0000)]
[AArch64] Load into zero vector patterns
A LDR will implicitly zero the rest of the vector, so vector_insert(zeros,
load, 0) can use a single load. This adds tablegen patterns for both scaled and
unscaled loads, detecting where we are inserting a load into the lower element
of a zero vector.
Differential Revision: https://reviews.llvm.org/D144086
Nico Weber [Wed, 1 Mar 2023 13:50:44 +0000 (08:50 -0500)]
[gn] port
e281d102fb73 more
Wu, Yingcong [Wed, 1 Mar 2023 13:38:00 +0000 (19:08 +0530)]
Move close() to the proper else block
`LogWriter::Close(LW)` is outside the null check if-else block, which, when `LW == nullptr`, will causing a NULL dereference.
I think the close() means to be in else block, which is when `LW != nullptr`.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D145039
Alex Bradbury [Wed, 1 Mar 2023 13:31:40 +0000 (13:31 +0000)]
[clang][RISCV][test] Add further test coverage for _Float16 on RISC-V
Check for size and alignment as we do for other types.
David Truby [Thu, 23 Feb 2023 16:24:50 +0000 (16:24 +0000)]
[flang] Implement isnan and ieee_is_nan intrinsics
To implement these we call the LLVM intrinsic is.fpclass indicating that
we are checking for either a quiet or signalling NaN.
Differential Revision: https://reviews.llvm.org/D144649
Nicolas Vasilache [Wed, 1 Mar 2023 07:41:39 +0000 (23:41 -0800)]
[mlir][Linalg] Improve HoistPadding to propagate through iter_args
This revision properly plumbs the subsitution of a padded op through
iter_args in the case of an scf::ForOp consumer.
Differential Revision: https://reviews.llvm.org/D145036
Ben Shi [Wed, 1 Mar 2023 10:23:52 +0000 (18:23 +0800)]
[NFC] Fix incorrect comment in VLIW packetizer
Reviewed By: bcain
Differential Revision: https://reviews.llvm.org/D145050
Marius Brehler [Wed, 1 Mar 2023 13:14:59 +0000 (14:14 +0100)]
[mlir][standalone] Enable to build as LLVM external project
In addition to the component build, this enables the standalone example
to be build as part of a monolithic LLVM build by using the LLVM
external projects mechanism (`LLVM_EXTERNAL_PROJECTS`).
Reviewed By: stephenneuendorffer, stellaraccident
Differential Revision: https://reviews.llvm.org/D143718
Pavel Labath [Wed, 1 Mar 2023 12:51:06 +0000 (13:51 +0100)]
[lldb/test] Update error message in debug-types-signature-loop.s
The error message changed in D144664.
Manuel Klimek [Wed, 1 Mar 2023 12:33:19 +0000 (12:33 +0000)]
[clang-format][NFC] Refactor formatting unit tests.
Pull out common base class for formatting unit tests, removing duplicate
code that accumulated over the years.
Pull out macro expansion test into its own test file.
Ivan Kosarev [Wed, 1 Mar 2023 12:01:55 +0000 (12:01 +0000)]
[AMDGPU][AsmParser][NFC] Simplify parsing cache policies.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D144954
Christian Ulmann [Wed, 1 Mar 2023 12:05:43 +0000 (13:05 +0100)]
[mlir-reduce] Create proper tmp test files (NFC)
This commit ensures that the sh script creates temporary files with
mktmp to ensure they do not collide with existing files. The previous
behaviour caused sporadic permission issues on a multi-user system.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D145054
Kiran Chandramohan [Wed, 1 Mar 2023 10:16:46 +0000 (10:16 +0000)]
[Flang][WWW] Update Bug Reports link to point to Github issues
Stephen Tozer [Tue, 28 Feb 2023 18:07:31 +0000 (18:07 +0000)]
[Dexter] Use non-blocking resume when debugging Visual Studio
The Visual Studio debugger currently uses blocking calls to Go and
StepInto, which interferes with Dexter's ability to do any processing
(e.g. checking for time outs) in between breakpoints. This patch updates
these functions to use non-blocking calls.
Reviewed By: Orlando
Differential Revision: https://reviews.llvm.org/D144986
Alex Bradbury [Wed, 1 Mar 2023 11:31:15 +0000 (11:31 +0000)]
[clang][test][RISCV] Add RISC-V to clang/test/Sema/Float16.c
Since D105001, HasFloat16 was unconditionally set to true for RISC-V.
This patch adds test coverage for this.
Christian Ulmann [Wed, 1 Mar 2023 10:08:50 +0000 (11:08 +0100)]
[mlir][llvm] Make DISubprogram name optional
This commit make the name parameter of the DISubprogramAttr optional.
LLVM will for example omit these subprogram names in initialization
functions for globals.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D145046
Mariya Podchishchaeva [Wed, 1 Mar 2023 10:58:20 +0000 (05:58 -0500)]
[NFC][clang] Refine tests by adding `:` to checks
The tests can fail if wokring directory where the tests were launched
has a `error` substring in its path.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D144495
Sjoerd Meijer [Wed, 1 Mar 2023 10:39:07 +0000 (10:39 +0000)]
[AArch64] More patterns to generate LD1R vector splats
We are missing patterns to generate vector splats using LD1R. A shuffle vector
with all 0s is a vector splat if the operands are a load and undef for which
we can generate a LD1R.
Differential Revision: https://reviews.llvm.org/D145004
Sjoerd Meijer [Wed, 1 Mar 2023 10:31:09 +0000 (10:31 +0000)]
[AArch64] Precommit tests to check more ld1r vector splat patterns in D145004.
Ingo Müller [Wed, 1 Mar 2023 10:10:12 +0000 (10:10 +0000)]
[mlir] Fix GreedyPatternRewriteDriver::notifyOperationModified.
The previous implementation did not notify the attached listener.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D145049
Jean Perier [Wed, 1 Mar 2023 09:43:16 +0000 (10:43 +0100)]
[flang][hlfir] Implement hlfir.declare optional codegen
The hlfir fir.box with the local lower bounds and type parameters
must be generated conditionally when the entity is optional.
Differential Revision: https://reviews.llvm.org/D144962
David Green [Wed, 1 Mar 2023 09:39:51 +0000 (09:39 +0000)]
[AArch64] Remove 64bit->128bit vector insert lowering
The AArch64 backend, during lowering, will convert an 64bit vector insert to a
128bit vector:
vector_insert %dreg, %v, %idx
=>
%qreg = insert_subvector undef, %dreg, 0
%ins = vector_insert %qreg, %v, %idx
EXTRACT_SUBREG %ins, dsub
This creates a bit of mess in the DAG, and the EXTRACT_SUBREG being a machine
nodes makes it difficult to simplify. This patch removes that, treating the
64bit vector insert as legal and handling them with extra tablegen patterns.
The end result is a simpler DAG that is easier to write tablegen patterns for.
Differential Revision: https://reviews.llvm.org/D144550
Zhongyunde [Wed, 1 Mar 2023 08:59:26 +0000 (16:59 +0800)]
[InstCombine] Improvement the analytics through the dominating condition
Address the dominating condition, the urem fold is benefit from the analytics improvements.
Fix https://github.com/llvm/llvm-project/issues/60546
NOTE: delete the calls in simplifyBinaryIntrinsic and foldICmpWithDominatingICmp
is used to reduce compile time.
Reviewed By: nikic, arsenm, erikdesjardins
Differential Revision: https://reviews.llvm.org/D144248
Sander de Smalen [Thu, 19 Jan 2023 10:29:16 +0000 (10:29 +0000)]
[LoopVectorize] Remove runtime check and scalar tail loop when tail-folding.
When using tail-folding and using the predicate for both data and control-flow
(the next vector iteration's predicate is generated with the llvm.active.lane.mask
intrinsic and then tested for the backedge), the LoopVectorizer still inserts a
runtime check to see if the 'i + VF' may at any point overflow for the given
trip-count. When it does, it falls back to a scalar epilogue loop.
We can get rid of that runtime check in the pre-header and therefore also
remove the scalar epilogue loop. This reduces code-size and avoids a runtime
check.
Consider the following loop:
void foo(char * __restrict__ dst, char *src, unsigned long N) {
for (unsigned long i=0; i<N; ++i)
dst[i] = src[i] + 42;
}
If 'N' is e.g. ULONG_MAX, and the VF > 1, then the loop iteration counter
will overflow when calculating the predicate for the next vector iteration
at some point, because LLVM does:
vector.ph:
%active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
vector.body:
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%active.lane.mask = phi <vscale x 16 x i1> [ %active.lane.mask.entry, %vector.ph ], [ %active.lane.mask.next, %vector.body ]
...
%index.next = add i64 %index, 16
; The add above may overflow, which would affect the lane mask and control flow. Hence a runtime check is needed.
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 %index.next, i64 %N)
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
The solution:
What we can do instead is calculate the predicate before incrementing
the loop iteration counter, such that the llvm.active.lane.mask is
calculated from 'i' to 'tripcount > VF ? tripcount - VF : 0', i.e.
vector.ph:
%active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
%N_minus_VF = select %N > 16 ? %N - 16 : 0
vector.body:
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%active.lane.mask = phi <vscale x 16 x i1> [ %active.lane.mask.entry, %vector.ph ], [ %active.lane.mask.next, %vector.body ]
...
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 %index, i64 %N_minus_VF)
%index.next = add i64 %index, %4
; The add above may still overflow, but this time the active.lane.mask is not affected
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
For N = 20, we'd then get:
vector.ph:
%active.lane.mask.entry = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 %N)
; %active.lane.mask.entry = <1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
%N_minus_VF = select 20 > 16 ? 20 - 16 : 0
; %N_minus_VF = 4
vector.body: (1st iteration)
... ; using <1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1> as predicate in the loop
...
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 0, i64 4)
; %active.lane.mask.next = <1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
%index.next = add i64 0, 16
; %index.next = 16
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
; %8 = 1
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
; branch to %vector.body
vector.body: (2nd iteration)
... ; using <1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> as predicate in the loop
...
%active.lane.mask.next = tail call <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64 16, i64 4)
; %active.lane.mask.next = <0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
%index.next = add i64 16, 16
; %index.next = 32
%8 = extractelement <vscale x 16 x i1> %active.lane.mask.next, i64 0
; %8 = 0
br i1 %8, label %vector.body, label %for.cond.cleanup, !llvm.loop !7
; branch to %for.cond.cleanup
Reviewed By: fhahn, david-arm
Differential Revision: https://reviews.llvm.org/D142109
Sander de Smalen [Thu, 19 Jan 2023 11:50:21 +0000 (11:50 +0000)]
NFC: Use generate_test_checks script for LV tests which seem to have been auto-generated.
Nikita Popov [Wed, 1 Mar 2023 08:51:29 +0000 (09:51 +0100)]
[Orc] Remove LLVMInitializeCore() calls from examples
Per discussion on D144970, these are no longer necessary.
Valentin Clement [Wed, 1 Mar 2023 08:51:03 +0000 (09:51 +0100)]
[flang][NFC] Remove redundant and incomplete comment
Valentin Clement [Wed, 1 Mar 2023 08:44:39 +0000 (09:44 +0100)]
[flang] Handle dynamic type in move_alloc
Update move_alloc to carry over the dyanmic type of `from` to `to`
and reset the dynamic type of `from` to its declared type when it
is polymorphic.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D144997
Lorenzo Chelini [Tue, 28 Feb 2023 14:31:18 +0000 (15:31 +0100)]
[MLIR][Linalg] Fix propagation for rank-zero tensor
`isScalar` only returns true if the operand is non-shaped.
But we need to handle also rank zero tensors.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D144989
Caroline Concatto [Tue, 28 Feb 2023 17:40:00 +0000 (17:40 +0000)]
[IR][Legalization] Split illegal deinterleave and interleave vectors
To make legalization easier, the operands and outputs have the same size for
these ISD Nodes. When legalizing the results in SplitVectorResult the operands
are legalized to the same size as the outputs.
The ISD Node has two output/results, therefore the legalizing functions update
both results/outputs.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144744
Tobias Gysi [Wed, 1 Mar 2023 08:15:37 +0000 (09:15 +0100)]
[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces.
The revision introduces two interfaces that provide access to
the alias analysis and access group metadata attributes. The
AliasAnalysis interface combines all alias analysis related
attributes (alias, noalias, and tbaa) similar to LLVM's getAAMetadata
method, while the AccessGroup interface is dedicated to the
access group metadata.
Previously, only the load and store operations supported alias analysis
and access group metadata. This revision extends this support to the
atomic operations. A follow up revision will also add support for the
memcopy, memset, and memove intrinsics. The interfaces then provide
convenient access to the metadata attributes and eliminate the need
of TypeSwitch or string based attribute access.
The revision still relies on string based attribute access for
the translation to LLVM IR (except for tbaa metadata). Only once
the the memory access intrinsics also implement the new interfaces,
the translation to LLVM IR can be fully switched to use interface
based attribute accesses.
Depends on D144875
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D144851
Balázs Kéri [Wed, 1 Mar 2023 07:42:32 +0000 (08:42 +0100)]
[clang][ASTImporter] Improve import of InjectedClassNameType.
During AST import multiple different InjectedClassNameType objects
could be created for a single class template. This can cause problems
and failed assertions when these types are compared and found to be
not the same (because the instance is different and there is no
canonical type).
The import of this type does not use the factory method in ASTContext,
probably because the preconditions are not fulfilled at that state.
The fix tries to make the code in ASTImporter work more like the code
in ASTContext::getInjectedClassNameType. If a type is stored at the
Decl or previous Decl object, it is reused instead of creating a new
one. This avoids crash at least a part of the cases.
Reviewed By: gamesh411, donat.nagy, vabridgers
Differential Revision: https://reviews.llvm.org/D140562
Benjamin Chetioui [Wed, 1 Mar 2023 08:18:14 +0000 (08:18 +0000)]
[mlir][NFC] Address filecheck_lint findings in Vector/CPU/test-broadcast.mlir.
Differential Revision: https://reviews.llvm.org/D144972
Sander de Smalen [Tue, 28 Feb 2023 15:20:46 +0000 (15:20 +0000)]
[IR] Add LLVM IR support for target("aarch64.svcount") type.
The C and C++ Language Extensions for AArch64 SME2 [1] adds a new type called
`svcount_t` which describes a predicate. This is not a predicate vector
mask, but rather a description of a predicate vector mask that can be
expanded into a mask using explicit instructions. The type is a scalable
opaque type.
To implement `svcount_t` type this patch uses the existing Target Extension Type
mechanism, but adds further support so that this type can be a scalable type.
AArch64 CodeGen support will follow in a separate patch.
[1] https://github.com/ARM-software/acle/pull/217
Reviewed By: jcranmer-intel, nikic
Differential Revision: https://reviews.llvm.org/D136861
Christian Ulmann [Wed, 1 Mar 2023 07:57:59 +0000 (08:57 +0100)]
[mlir][llvm] Prioritize DILocalScope over file loc
This commit ensures that the LLVMIR export prioritizes existing
DILocalScope attribute information as location scopes over files
constructed from filenames. All DILocalScope attributes contain file
information, so no information is lost. The previous implementation
caused the introduction of superfluous DILexicalBlockFile nodes in
certain cases. The old implementation remains as a fallback when no
DILocalScope is present.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D144968
Ben Shi [Wed, 1 Mar 2023 07:38:22 +0000 (15:38 +0800)]
[clang][driver] Do not emit default '-Tdata' for AVR devices
Different AVR devices have different data regions. Current clang
driver emits a default '-Tdata' option to the linker. This way
works fine if there is no user specified linker script, but it
will cause conflicts if there is one.
A better solution for setting the default data region to GNU ld
is defining symbol __DATA_REGION_ORIGIN__, which is expected by
GNU ld's default AVR linker script.
Fixes https://github.com/llvm/llvm-project/issues/60362
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D144533
Emilio Cobos Alvarez [Wed, 1 Mar 2023 06:29:11 +0000 (07:29 +0100)]
[libclang] Remove redundant return statements in CXType.cpp
Let the branch fall through the error path like other functions here do.
Differential Revision: https://reviews.llvm.org/D140074
Craig Topper [Tue, 28 Feb 2023 08:09:27 +0000 (00:09 -0800)]
[TableGen] Minor tweak to AssemblerCondDag evaluation to be more consistent with other dags. NFC
Instead of using getAsString on the dag operator, check if the operator
is a DefInit and then get the name of the Def.