Petr Hosek [Tue, 22 Mar 2022 01:30:35 +0000 (18:30 -0700)]
[CoverageMapping] Remove dots from paths inside the profile
We already remove dots from collected paths and path mappings. This
makes it difficult to match paths inside the profile which contain
dots. For example, we would never match /path/to/../file.c because
the collected path is always be normalized to /path/file.c. This
change enables dot removal for paths inside the profile to address
the issue.
Differential Revision: https://reviews.llvm.org/D123164
Peixin-Qiao [Wed, 29 Jun 2022 03:25:19 +0000 (11:25 +0800)]
[flang] Support check for BIND statement entity
As Fortran 2018 8.6.4(1), the BIND statement specifies the BIND attribute
for a list of variables and common blocks.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D127120
Chris Bieneman [Wed, 29 Jun 2022 02:53:54 +0000 (21:53 -0500)]
[DirectX] Properly fix for MaybeAlign API removal
My last attempt caused a test case failure. This resovles the issue.
Luo, Yuanke [Sat, 25 Jun 2022 14:00:44 +0000 (22:00 +0800)]
[X86][AMX] Split greedy RA for tile register
When we fill the shape to tile configure memory, the shape is gotten
from AMX pseudo instruction. However the register for the shape may be
split or spilled by greedy RA. That cause we fill the shape to config
memory after ldtilecfg is executed, so that the shape configuration
would be wrong.
This patch is to split the tile register allocation from greedy register
allocation, so that after tile registers are allocated the shape
registers are still virtual register. The shape register only may be
redefined or multi-defined by phi elimination pass, two address pass.
That doesn't affect tile register configuration.
Differential Revision: https://reviews.llvm.org/D128584
Rafael Auler [Wed, 29 Jun 2022 02:23:28 +0000 (19:23 -0700)]
Revert "[BOLT][AArch64] Handle gold linker veneers"
This reverts commit
425dda76e9fac93117289fd68a2abdfb1e4a0ba5.
This commit is currently causing BOLT to crash in one of our
binaries and needs a bit more checking to make sure it is safe
to land.
Guozhi Wei [Wed, 29 Jun 2022 01:37:56 +0000 (01:37 +0000)]
[AArch64] Update test case.
Replace the new generated virtual register number with a macro to avoid
name mismatch due to different configuration of compiler.
Chris Bieneman [Wed, 29 Jun 2022 00:45:11 +0000 (19:45 -0500)]
[DirectX] Fix broken build after API removal
This removes the DirectX backend's usage of the MaybeAlign API removed
in 1baf1fc.
Walter Erquinigo [Wed, 29 Jun 2022 00:38:17 +0000 (17:38 -0700)]
[trace] Fix errors when handling command arguments
https://reviews.llvm.org/D128453 recently added some safety checks for
command arguments. Unfortunately, some few commands started failing due
to that, and this diff fixes it. But fortunately, the fix is trivial, which is
simply declaring the argument that these commands will receive.
Differential Revision: https://reviews.llvm.org/D128775
Craig Topper [Tue, 28 Jun 2022 23:48:14 +0000 (16:48 -0700)]
[RISCV] Fold (add X, [-4096, -2049]) or (add X, [2048,4096]) into load/store address during isel.
Previously we iseled this to a pair of ADDIs and relied on a post
isel peephole to fold one of the ADDIs into the load/store. Now
we split the immediate in two parts the same way isel does and fold
one of the pieces. If the add has a non-memory use it will emit
two isels and larger one will CSE with the ADDI we created for the
the memory use.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D128741
Walter Erquinigo [Fri, 24 Jun 2022 18:19:09 +0000 (11:19 -0700)]
[trace] Improve the TraceCursor iteration API
The current way ot traversing the cursor is a bit uncommon and it can't handle empty traces, in fact, its invariant is that it shold always point to a valid item. This diff simplifies the cursor API and allows it to point to invalid items, thus being able to handle empty traces or to know it ran out of data.
- Removed all the granularity functionalities, because we are not actually making use of that. We can bring them back when they are actually needed.
- change the looping logic to the following:
```
for (; cursor->HasValue(); cursor->Next()) {
if (cursor->IsError()) {
.. do something for error
continue;
}
.. do something for instruction
}
```
- added a HasValue method that can be used to identify if the cursor ran out of data, the trace is empty, or the user tried to move to an invalid position via SetId() or Seek()
- made several simplifications to severals parts of the code.
Differential Revision: https://reviews.llvm.org/D128543
Stanislav Mekhanoshin [Tue, 28 Jun 2022 22:06:41 +0000 (15:06 -0700)]
[AMDGPU] Relax verification of soffset in scalar stores
It must use m0 only on GFX8. Later chips can use ang SGPR.
Differential Revision: https://reviews.llvm.org/D128765
Fangrui Song [Tue, 28 Jun 2022 23:01:30 +0000 (16:01 -0700)]
[Driver][ARM][AArch64] Use err_drv_unsupported_option_argument for -march=/-mcpu=/-mtune= diagnostics
err_drv_clang_unsupported is for a Clang unsupported option (any value is rejected).
err_drv_unsupported_option_argument is for an unsupported value (other values may be supported).
Philip Reames [Tue, 28 Jun 2022 22:54:34 +0000 (15:54 -0700)]
[RISCV] Rename getMin/MaxVLen to getArchMin/MaxVlen and make protected [nfc]
River Riddle [Tue, 28 Jun 2022 21:50:26 +0000 (14:50 -0700)]
[mlir] Add `enableSplitting` and `insertMarkerInOutput` options to `splitAndProcessBuffer`
`enableSplitting` simply enables/disables whether we should split
or use the full buffer. `insertMarkerInOutput` toggles if split markers
should be inserted in between prcessed output chunks.
These options allow for merging the duplicate code paths we have
when splitting is optional.
Differential Revision: https://reviews.llvm.org/D128764
Philip Reames [Tue, 28 Jun 2022 22:36:34 +0000 (15:36 -0700)]
[RISCV] Refine known bits for READ_VLENB
This implements known bits for READ_VALUE using any information known about minimum and maximum VLEN. There's an additional assumption that VLEN is a power of two.
The motivation here is mostly to remove the last use of getMinVLen, but while I was here, I decided to also fix the bug for VLEN < 128 and handle max from command line generically too.
Differential Revision: https://reviews.llvm.org/D128758
Med Ismail Bennani [Tue, 28 Jun 2022 01:28:30 +0000 (18:28 -0700)]
[lldb/Dataformatters] Adapt C++ std::string dataformatter for D128285
This patch changes the C++ `std::string` dataformatter to reflect
internal layout changes following D128285.
Now, in short-mode strings, in order to access the `__size_` and
`__is_long_` attributes, we need to access a packed anonymous struct,
which introduces another indirection.
We need to do the same in order to access the `__cap_` field for
long-mode strings.
This should fix the various test failures that are happening on
GreenDragon:
https://green.lab.llvm.org/green/job/lldb-cmake/44918/
rdar://
96010248
Differential Revision: https://reviews.llvm.org/D128694
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Fazlay Rabbi [Tue, 28 Jun 2022 21:35:43 +0000 (14:35 -0700)]
[OpenMP] Initial parsing and sema support for 'masked taskloop simd' construct
This patch gives basic parsing and semantic support for
"masked taskloop simd" construct introduced in OpenMP 5.1 (section 2.16.8)
Differential Revision: https://reviews.llvm.org/D128693
Johannes Doerfert [Mon, 27 Jun 2022 20:51:15 +0000 (15:51 -0500)]
[OpenMP][NFC] Remove unused check lines in Clang/OpenMP tests
The check lines are not referenced in RUN lines, hence useless.
Differential Revision: https://reviews.llvm.org/D128685
Johannes Doerfert [Mon, 27 Jun 2022 22:55:00 +0000 (17:55 -0500)]
[UpdateTestChecks] Handle prefix reuse for appended check lines
When we appended check lines at the end we could not share prefixes
before. This patch should make it possible and allow us to reduce
some check line counts (especially for Clang/OpenMP tests).
See also: https://reviews.llvm.org/D128686
Differential Revision: https://reviews.llvm.org/D128684
Corentin Jabot [Tue, 28 Jun 2022 22:03:23 +0000 (00:03 +0200)]
Revert "Improve handling of static assert messages."
This reverts commit
870b6d21839707a3e4c40a29b526995f065a220f.
This seems to break some libc++ tests, reverting while investigating
Mariusz Borsa [Tue, 7 Jun 2022 23:15:20 +0000 (16:15 -0700)]
[Sanitizers] Cleanup handling of stat64/statfs64
This is a follow up to <LLVM reviews>/D127343, which was reverted due to test failures.
There are differences in handling of stat64/statfs64 calls by sanitizers between Linux and macOS. Versions of macOS starting with 10.6 drop the stat64/statfs64 APIs completely, relying on the linker to redirect stat/statfs to the appropriate 64 bit versions. Emitting variables needed by sanitizers is thus controlled by convoluted sets of conditions, involving Linux, IOS, macOS and Android, sprinkled around files.
This change clarifies it a bit, allowing to specify presence/absence of stat64/statfs64 for each platform, in a single location.
Please note that I wasn't able to test this change on platforms other than macOS and Linux Fedora 34. The previous attempt has caused test failures but couldn't figure out the context. I have a vague suspicion that they were Android and perhaps Fuchsia builds - and some build involving ppc64le, I don't have hardware handy to attempt a test there. Tried to tighten the conditions this time to clearly separate macOS from Linux, so Linux builds should behave same (sanitizerwise) as before the change. Will add people who reported the tests failing before as reviewers, so they can provide context should the change cause the test failures again.
Differential Revision: https://reviews.llvm.org/D128476
Martin Sebor [Tue, 28 Jun 2022 21:54:56 +0000 (15:54 -0600)]
[InstCombine] Fold strncmp of constant arrays and variable size
Extend the solution accepted in D127766 to strncmp and simplify
strncmp(A, B, N) calls with constant A and B and variable N to
the equivalent of
N <= Pos ? 0 : (A < B ? -1 : B < A ? +1 : 0)
where Pos is the offset of either the first mismatch between A
and B or the terminating null character if both A and B are equal
strings.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D128089
Martin Sebor [Tue, 28 Jun 2022 21:04:26 +0000 (15:04 -0600)]
[InstCombine] Look through more casts when folding memchr and memcmp
Enhance getConstantDataArrayInfo to let the memchr and memcmp library
call folders look through arbitrarily long sequences of bitcast and
GEP instructions.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D128364
Matthias Braun [Tue, 28 Jun 2022 05:03:25 +0000 (22:03 -0700)]
build_symbolizer: Set LLVM_DEFAULT_TARGET_TRIPLE in llvm builds
Pass on the default target triple of the host clang to the LLVM builds
within the `build_symbolizer.sh` script.
Differential Revision: https://reviews.llvm.org/D128731
Matthias Braun [Tue, 28 Jun 2022 04:38:45 +0000 (21:38 -0700)]
Avoid ar_to_bc.sh script in symbolizer build; add -ignore-non-bitcode flag to llvm-link
Remove the `ar_to_bc.sh` helper script in the compiler-rt symbolizer
build. Instead use `llvm-link` directly as D81109 introduced the
capability to read archives. I just needed to add a new flag
`-ignore-non-bitcode` to avoid `llvm-link` aborting when it found a
non-bitcode file in the archive.
Differential Revision: https://reviews.llvm.org/D128729
Guozhi Wei [Tue, 28 Jun 2022 21:42:51 +0000 (21:42 +0000)]
[MachineCombiner, AArch64] Add a new pattern A-(B+C) => (A-B)-C to reduce latency
Add a new pattern A - (B + C) ==> (A - B) - C to give machine combiner a chance
to evaluate which instruction sequence has lower latency.
Differential Revision: https://reviews.llvm.org/D124564
LLVM GN Syncbot [Tue, 28 Jun 2022 21:25:13 +0000 (21:25 +0000)]
[gn build] Port
77df3be0dee4
Alexey Lapshin [Tue, 28 Jun 2022 16:52:12 +0000 (19:52 +0300)]
[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef.
This review is extracted from D96035.
This patch adds possibility to keep not only DwarfStringPoolEntry, but also
pointer to it. The DwarfStringPoolEntryRef keeps reference to the string map entry.
String map keeps string data and corresponding DwarfStringPoolEntry
info. Not all string map entries may be included into the result,
and then not all string entries should have DwarfStringPoolEntry
info. Currently StringMap keeps DwarfStringPoolEntry for all entries.
It leads to extra memory usage. This patch allows to keep
DwarfStringPoolEntry info only for entries which really need it.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D126883
Michael Jones [Fri, 10 Jun 2022 18:12:40 +0000 (11:12 -0700)]
[libc] add integer writing to printf
This patch adds %n to printf, as well as a compiler flag to disable it.
This is due to it having serious security issues when misused.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D127517
Philip Reames [Tue, 28 Jun 2022 20:53:22 +0000 (13:53 -0700)]
[RISCV] Pin two tests to fixed length vectorization to preserve test intent
Alexey Bataev [Mon, 27 Jun 2022 20:20:50 +0000 (13:20 -0700)]
[SLP]Fix PR56251: Do not remove the reordering from the root node, being used as an operand.
If the root order itself does not require reordering, we can just
remove its reorder mask safely (e.g., if the root node is a vector of
phis). But if this node is used as an operand in the graph, we cannot
delete the reordering, need to keep it. Otherwise the graph nodes are
not synchronized with the operands. It may cause an extra gather
instruction(s) or a compiler crash.
Also, need to be very careful when selecting the gather nodes for
reordering since there might several gather nodes with the same scalars
and we can try to reorder just the same node many times instead of
different nodes.
Differential Revision: https://reviews.llvm.org/D128680
Slava Zakharin [Wed, 22 Jun 2022 21:41:02 +0000 (14:41 -0700)]
[flang] Lower Fortran math intrinsic operations into MLIR ops or libm calls.
Added new -lower-math-early option that defaults to 'true' that matches
the current math lowering scheme. If set to 'false', the intrinsic math
operations will be lowered to MLIR operations, which should potentially
enable more MLIR optimizations, or libm calls, if there is no corresponding
MLIR operation exists or if "precise" mode is requested.
The generated math MLIR operations are then converted to LLVM dialect
during codegen phase.
The -lower-math-early option is not exposed to users currently. I plan to
get rid of the "early" lowering completely, when "late" lowering
is robust enough to support all math intrinsics that are currently
supported via pgmath. So "late" mode will become default and -lower-math-early
option will not be needed. This will effectively eliminate the mandatory
dependency on pgmath in Fortran lowering, but this is WIP.
Differential Revision: https://reviews.llvm.org/D128385
Corentin Jabot [Fri, 20 Aug 2021 15:52:28 +0000 (17:52 +0200)]
Improve handling of static assert messages.
Instead of dumping the string literal (which
quotes it and escape every non-ascii symbol),
we can use the content of the string when it is a
8 byte string.
Wide, UTF-8/UTF-16/32 strings are still completely
escaped, until we clarify how these entities should
behave (cf https://wg21.link/p2361).
`FormatDiagnostic` is modified to escape
non printable characters and invalid UTF-8.
This ensures that unicode characters, spaces and new
lines are properly rendered in static messages.
This make clang more consistent with other implementation
and fixes this tweet
https://twitter.com/jfbastien/status/
1298307325443231744 :)
Of note, `PaddingChecker` did print out new lines that were
later removed by the diagnostic printing code.
To be consistent with its tests, the new lines are removed
from the diagnostic.
Unicode tables updated to both use the Unicode definitions
and the Unicode 14.0 data.
U+00AD SOFT HYPHEN is still considered a print character
to match existing practices in terminals, in addition of
being considered a formatting character as per Unicode.
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D108469
Jacques Pienaar [Tue, 28 Jun 2022 20:11:25 +0000 (13:11 -0700)]
[mlir] Update flipped accessors (NFC)
Follow up with memref flipped and flipping any intermediate changes
made.
Mehdi Amini [Sun, 12 Jun 2022 18:05:22 +0000 (18:05 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in VectorDistribute.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:56:43 +0000 (17:56 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in SPIRVOps.cpp (NFC)
Michał Górny [Mon, 27 Jun 2022 12:22:38 +0000 (14:22 +0200)]
[lldb] [llgs] Fix premature server exit if multiprocess+nonstop
Fix lldb-server in the non-stop + multiprocess mode to exit on vStopped
only if all processes have exited, rather than when the first one exits.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128639
Michał Górny [Wed, 22 Jun 2022 18:04:08 +0000 (20:04 +0200)]
[lldb] [llgs] Add base nonstop fork/vfork tests
Extend the most of baseline fork tests to run in nonstop mode as well.
For more cases, we're just testing one example scenario to save time.
This patch does not cover tests that rely on correct exit handling,
as fixing that is addressed in a followup patch.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128638
Michał Górny [Tue, 28 Jun 2022 06:24:24 +0000 (08:24 +0200)]
[lldb] Add a NativeProcessProtocol::Threads() iterable
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128698
Louis Dionne [Tue, 28 Jun 2022 19:36:52 +0000 (15:36 -0400)]
[libc++] Fix signature of main() in tests
Otherwise, this breaks freestanding builds, where `main()` isn't mangled
specially and we need to assume that we have a `int main(int, char**)`
entry point in each test for things to work.
Arjun P [Tue, 28 Jun 2022 19:35:05 +0000 (20:35 +0100)]
[MLIR][Presburger] subtract: support non-div locals
Also added test cases. Also extend support for `computeReprWithOnlyDivLocals` from `IntegerPolyhedron` to `IntegerRelation` and `PresburgerRelation`.
Depends on D128736.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D128737
Shilei Tian [Tue, 28 Jun 2022 19:31:41 +0000 (15:31 -0400)]
[OpenMP][CUDA] Fix the issue that P2P memcpy doesn't work
This patch fixes the issue that P2P memcpy doesn't work. The root cause is we didn't set current context when calling the API function. In addition, a matrix to track the states of each pair of devices is also added such that we only need to query and configure the device once.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D122764
Arjun P [Tue, 28 Jun 2022 19:23:39 +0000 (20:23 +0100)]
[MLIR][Presburger] subtract: fix support for divs defined by equalities
Also added test cases to test this. Both IntegerRelation::addLocalFloorDiv and the fixed implementation of subtraction need to compute division inequalities from dividend and divisor, so this also adds helper util functions to avoid duplicating this logic.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D128736
Sam McCall [Tue, 28 Jun 2022 19:09:15 +0000 (21:09 +0200)]
Revert "[pseudo] Add error-recovery framework & brace-based recovery"
This reverts commit
a0f4c10ae227a62c2a63611e64eba83f0ff0f577.
This commit hadn't been reviewed yet, and was unintentionally included
on another branch.
Leonard Chan [Tue, 28 Jun 2022 19:08:12 +0000 (12:08 -0700)]
[NFC][HWASan] Refactor hwasan pass
This moves some code for getting PC and SP into their own functions. Since SP
is also retrieved in the prologue and getting the stack tag, we can cache the
SP if we get it once in the prologue. This caching will really only be relevant
in D128387 where StackBaseTag may not be set in the prologue if __hwasan_tls
is not used.
Differential Revision: https://reviews.llvm.org/D128551
Sam McCall [Tue, 28 Jun 2022 19:08:21 +0000 (21:08 +0200)]
[pseudo] Move ellipsis into initializer-list-item. NFC
This makes the list formation a bit simpler.
Sam McCall [Wed, 8 Jun 2022 21:27:23 +0000 (23:27 +0200)]
[pseudo] Add error-recovery framework & brace-based recovery
The idea is:
- a parse failure is detected when all heads die when trying to shift
the next token
- we can recover by choosing a nonterminal we're partway through parsing,
and determining where it ends through nonlocal means (e.g. matching brackets)
- we can find candidates by walking up the stack from the (ex-)heads
- the token range is defined using heuristics attached to grammar rules
- the unparsed region is represented in the forest by an Opaque node
This patch has the core GLR functionality.
It does not allow recovery heuristics to be attached as extensions to
the grammar, but rather infers a brace-based heuristic.
Expected followups:
- make recovery heuristics grammar extensions (depends on D127448)
- add recover to our grammar for bracketed constructs and sequence nodes
- change the structure of our augmented `_ := start` rules to eliminate
some special-cases in glrParse.
- (if I can work out how): avoid some spurious recovery cases described
in comments
- grammar changes to eliminate the hard distinction between init-list
and designated-init-list shown in the recovery-init-list.cpp testcase
Differential Revision: https://reviews.llvm.org/D128486
Konstantin Varlamov [Tue, 28 Jun 2022 18:59:59 +0000 (11:59 -0700)]
[libc++][ranges] Finish LWG issues directly related to the One Ranges Proposal.
- P1252 ("Ranges Design Cleanup") -- deprecate
`move_iterator::operator->` starting from C++20; add range comparisons
to the `<functional>` synopsis. This restores
`move_iterator::operator->` that was incorrectly deleted in D117656;
it's still defined in the latest draft, see
http://eel.is/c++draft/depr.move.iter.elem. Note that changes to
`*_result` types from 6.1 in the paper are no longer relevant now that
these types are aliases;
- P2106 ("Alternative wording for GB315 and GB316") -- add a few
`*_result` types to the synopsis in `<algorithm>` (some algorithms are
not implemented yet and thus some of the proposal still cannot be
marked as done);
Also mark already done issues as done (or as nothing to do):
- P2091 ("Fixing Issues With Range Access CPOs") was already implemented
(this patch adds tests for some ill-formed cases);
- LWG 3247 ("`ranges::iter_move` should perform ADL-only lookup of
`iter_move`") was already implemented;
- LWG 3300 ("Non-array ssize overload is underconstrained") doesn't
affect the implementation;
- LWG 3335 ("Resolve C++20 NB comments US 273 and GB 274") was already
implemented;
- LWG 3355 ("The memory algorithms should support move-only input
iterators introduced by P1207") was already implemented (except for
testing).
Differential Revision: https://reviews.llvm.org/D126053
Jim Ingham [Tue, 28 Jun 2022 18:48:28 +0000 (11:48 -0700)]
TestIgnoredExceptions.py needs support from debugserver, so it
needs to be marked skip if out of tree debugserver.
Craig Topper [Tue, 28 Jun 2022 18:34:39 +0000 (11:34 -0700)]
[RISCV] Teach RISCVMergeBaseOffset to handle read-modify-write of a global.
The pass was previously limited to LUI+ADDI being used by a single
instruction.
This patch allows the pass to optimize multiple memory operations
that use the same offset. Each of them will receive a separate %lo
relocation. My main motivation is to handle a read-modify-write
where we have a load and store to the same address, but I didn't
restrict it to that case.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D128599
Groverkss [Tue, 28 Jun 2022 18:33:58 +0000 (19:33 +0100)]
[MLIR][Affine][NFC] Fix affine utlities docs using "identifiers" instead of "variables"
Michael Jones [Tue, 28 Jun 2022 18:17:14 +0000 (11:17 -0700)]
[libc] disable algorithm_test.cpp temporarily
The unit tests introduced in patch D128335 are causing build failures,
and the fix is non-trivial. This patch disables these tests temporarily
until a proper fix can be implemented.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D128746
Mehdi Amini [Sun, 12 Jun 2022 17:51:08 +0000 (17:51 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in Shape.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:46:52 +0000 (17:46 +0000)]
Apply clang-tidy fixes for modernize-use-emplace in SCFTransformOps.cpp (NFC)
Groverkss [Tue, 28 Jun 2022 17:50:11 +0000 (18:50 +0100)]
[MLIR][Presburger] Rename variable/identifier -> variable
Currently, in the Presburger library, we use the words "variables" and
"identifiers" interchangeably. This patch changes this to only use "variables" to
refer to the variables of PresburgerSpace.
The reasoning behind this change is that the current usage of the word "identifier"
is misleading. variables do not "identify" anything. The information attached to them is the
actual "identifier" for the variable. The word "identifier", will later be used
to refer to the information attached to each variable in space.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D128585
Muiez Ahmed [Tue, 28 Jun 2022 17:59:49 +0000 (20:59 +0300)]
[SystemZ][z/OS] Modify cxxabi to be compatible with existing z/OS runtime
This patch is to enable exception handling on the z/OS platform that is compatible with the existing z/OS runtime. No functionality of libcxxabi has been changed for other platforms. With this patch the hope is we can add z/OS as a platform to perform testing on any C++ ABI changes.
There is a primary difference for the z/OS implementation. On z/OS the thrown object is added to a linked list of caught and uncaught exceptions. The unwinder uses the top one as the current exception it is trying to find the landing pad for. We have to pop the top exception after we get it’s landing pad for our unwinder to correctly get any subsequent rethrows or nested exception calls.
Differential Revision: https://reviews.llvm.org/D99913
Peter Klausler [Wed, 15 Jun 2022 16:18:25 +0000 (09:18 -0700)]
[flang] Enforce C1552, no binding labels allowed for internal procedures
If BIND(C) appears on an internal procedure, it must have a null binding
label, i.e. BIND(C,NAME="").
Also address conflicts with D127725 which was merged during development.
Differential Revision: https://reviews.llvm.org/D128676
Ben Langmuir [Tue, 28 Jun 2022 17:51:55 +0000 (10:51 -0700)]
Revert "Reland "[X86] Support `_Float16` on SSE2 and up""
Broke compiler-rt on Darwin: https://green.lab.llvm.org/green/job/clang-stage1-RA/29920/
This reverts commit
527ef8ca981e88a35758c0e4143be6853ea26dfc.
Stella Stamenova [Tue, 28 Jun 2022 17:39:13 +0000 (10:39 -0700)]
[mlir] Leverage CMake interface libraries for mlir python
This is already partially the case, but we can rely more heavily on interface libraries and how they are imported/exported in other to simplify the implementation of the mlir python functions in Cmake.
This change also makes a couple of other changes:
1) Add a new CMake function which handles "pure" sources. This was done inline previously
2) Moves the headers associated with CAPI libraries to the libraries themselves. These were previously managed in a separate source target. They can now be added directly to the CAPI libraries using DECLARED_HEADERS.
3) Cleanup some dependencies that showed up as an issue during the refactor
This is a big CMake change that should produce no impact on the build of mlir and on the produced *build tree*. However, this change fixes an issue with the *install tree* of mlir which was previously unusable for projects like torch-mlir because both the "pure" and "extension" targets were pointing to either the build or source trees.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D128230
Mehdi Amini [Tue, 28 Jun 2022 17:32:00 +0000 (17:32 +0000)]
Fix printing for ArrayRef attributes/types in declarative assembly format
These were abbreviated when parsing, but not when printing.
Reviewed By: Mogball, rriddle
Differential Revision: https://reviews.llvm.org/D128720
Yuanfang Chen [Tue, 28 Jun 2022 17:29:20 +0000 (10:29 -0700)]
[lit][test] relaxed GTEST_TOTAL_SHARDS checking for some googletests (2)
Missed this in
14d3021c10d08
Mehdi Amini [Sun, 12 Jun 2022 17:35:07 +0000 (17:35 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in LinalgStrategyPasses.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:19:15 +0000 (17:19 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in ArithmeticOps.cpp (NFC)
Michael Jones [Tue, 28 Jun 2022 17:20:13 +0000 (10:20 -0700)]
[libc] Fix compile options for algorithm test
This patch fixes the problem the bots were having with the algorithm
test not including pthreads correctly. They will likely need a manual
forced clean build for this to take effect.
Differential Revision: https://reviews.llvm.org/D128742
Philip Reames [Tue, 28 Jun 2022 16:58:52 +0000 (09:58 -0700)]
[RISCV] Add test coverage for high known bits for vscale
Nicolas Vasilache [Tue, 28 Jun 2022 15:29:46 +0000 (08:29 -0700)]
q[mlir][Vector] Add a ShapeCastOp(BroadcastOp) canonicalization pattern
This pattern can kick in when the source of the broadcast has a shape
that is a prefix/suffix of the result of the shape_cast.
Differential Revision: https://reviews.llvm.org/D128734
Alexey Lapshin [Mon, 27 Jun 2022 15:40:10 +0000 (18:40 +0300)]
[DWARFLinker] mark odr candidates inside the same object file.
This patch is extracted from D86539.
Current implementation of lookForDIEsToKeep() function skips types
duplications basing on the getCanonicalDIEOffset() data:
```
if (AttrSpec.Form != dwarf::DW_FORM_ref_addr && (UseOdr || IsModuleRef) &&
Info.Ctxt &&
Info.Ctxt != ReferencedCU->getInfo(Info.ParentIdx).Ctxt &&
Info.Ctxt->getCanonicalDIEOffset() && isODRAttribute(AttrSpec.Attr)) <<<<<
continue;
```
But that field is set after all compile units inside object file are processed:
```
for (auto &CurrentUnit : OptContext.CompileUnits)
lookForDIEsToKeep(.., &CurrentUnit, ..); // check CanonicalDIEOffset
DIECloner.cloneAllCompileUnits(); // set CanonicalDIEOffset
```
Thus, if the object file contains several compilation units - types would
not be deduplicated. The above solution works well for the case when the object file
contains only one compilation unit. But if the object file contains several compilation
units then types would not be deduplicated between these compilation units.
This patch changes the algorithm so that types were deduplicated between
compilation units from the same object file.
It produces binary incompatible output for the cases when several compilation units
are located inside the same object file.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D125469
Mehdi Amini [Tue, 28 Jun 2022 16:47:41 +0000 (16:47 +0000)]
Fix build with some GCC version: `global qualification of class name is invalid before '{' token`
Pengxuan Zheng [Thu, 23 Jun 2022 19:25:54 +0000 (12:25 -0700)]
[llvm-lib] Ignore /SUBSYSTEM flag
It's not clear what Microsoft's LIB.exe actually does based on the official
description of the flag (link below). We can probably ignore it for now.
https://docs.microsoft.com/en-us/cpp/build/reference/managing-a-library?view=msvc-170
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D128458
Aart Bik [Mon, 27 Jun 2022 23:51:27 +0000 (16:51 -0700)]
[mlir][sparse][bufferization] refine bufferization assumption enforcement
Enforce the assumption made on tensor buffers explicitly. When in-place,
reuse the buffer, but fill with all zeroes for the non-update case, since
the kernel assumes all elements are written to. When not in-place, zero
out the new buffer when materializing or when no-updates occur. Copy the
original tensor value when updates occur. This prepares migrating to the
new bufferization strategy, where these assumptions must be made explicit.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D128691
Craig Topper [Tue, 28 Jun 2022 16:07:23 +0000 (09:07 -0700)]
[X86] Remove unnecessary COPY from EmitLoweredCascadedSelect.
I believe we already checked that the destination of the first
CMOV is only used by the second CMOV so I don't think there is any
reason we need the PHI to write the register that was used by the
first CMOV. We can directly use the second CMOV destination and
avoid the copy.
This may be a left over from when the cascaded select handling
was part of the main algorithm before it was refactored in D35685.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D128124
Mitch Phillips [Tue, 28 Jun 2022 16:26:36 +0000 (09:26 -0700)]
Allow mangled names in sanitizer clang IR gen tests.
Looks like with https://reviews.llvm.org/D127911, Windows emits more
globals with mangled names into the IR. Relax the tests in order to
allow these mangled names.
Valentin Clement [Tue, 28 Jun 2022 16:26:26 +0000 (18:26 +0200)]
[flang] Fix couple of issue with user defined assignment in FORALL and WHERE
This patch fixes a couple of issues with the lowering of user defined assignment.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D128730
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Lei Zhang [Tue, 28 Jun 2022 15:58:42 +0000 (11:58 -0400)]
[mlir][spirv] Support more comparisons on boolean values
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D128692
Arjun P [Tue, 28 Jun 2022 10:34:57 +0000 (11:34 +0100)]
[MLIR][Presburger] getDivRepr: fix bug where dividend was negated
Also updated the tests, which were asserting the wrong behaviour.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D128735
Michał Górny [Tue, 28 Jun 2022 15:02:44 +0000 (17:02 +0200)]
[lldb] [test] XFAIL llgs tests failing on arm
Sponsored by: The FreeBSD Foundation
Rahman Lavaee [Tue, 28 Jun 2022 14:41:40 +0000 (07:41 -0700)]
[Propeller] Encode address offsets of basic blocks relative to the end of the previous basic blocks.
This is a resurrection of D106421 with the change that it keeps backward-compatibility. This means decoding the previous version of `LLVM_BB_ADDR_MAP` will work. This is required as the profile mapping tool is not released with LLVM (AutoFDO). As suggested by @jhenderson we rename the original section type value to `SHT_LLVM_BB_ADDR_MAP_V0` and assign a new value to the `SHT_LLVM_BB_ADDR_MAP` section type. The new encoding adds a version byte to each function entry to specify the encoding version for that function. This patch also adds a feature byte to be used with more flexibility in the future. An use-case example for the feature field is encoding multi-section functions more concisely using a different format.
Conceptually, the new encoding emits basic block offsets and sizes as label differences between each two consecutive basic block begin and end label. When decoding, offsets must be aggregated along with basic block sizes to calculate the final offsets of basic blocks relative to the function address.
This encoding uses smaller values compared to the existing one (offsets relative to function symbol).
Smaller values tend to occupy fewer bytes in ULEB128 encoding. As a result, we get about 17% total reduction in the size of the bb-address-map section (from about 11MB to 9MB for the clang PGO binary).
The extra two bytes (version and feature fields) incur a small 3% size overhead to the `LLVM_BB_ADDR_MAP` section size.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D121346
Sam McCall [Tue, 28 Jun 2022 14:24:38 +0000 (16:24 +0200)]
[pseudo] Grammar::parseBNF returns Grammar not unique_ptr. NFC
Aaron Ballman [Tue, 28 Jun 2022 14:27:26 +0000 (10:27 -0400)]
Update statuses and add tests for C89 DRs
This mostly finishes the DRs for C89, though there are still a few
outliers which remain. It also corrects some of the statuses of DRs
where it's not clear if it was fully resolved by the committee or not.
As a drive-by, it also adds -fsyntax-only to the tests which are
verifying diagnostic results. This was previously missed by accident.
Michał Górny [Tue, 28 Jun 2022 14:21:56 +0000 (16:21 +0200)]
[lldb] [test] Skip llgs tests broken due to #56268 on aarch64
Sponsored by: The FreeBSD Foundation
Egor Zhdan [Mon, 27 Jun 2022 15:09:56 +0000 (16:09 +0100)]
[MC] Allow annotating custom sections as zerofill
This is already possible for e.g. `cstring_literals`, but the entry for zerofill was unnamed.
rdar://
90336380
Differential Revision: https://reviews.llvm.org/D128654
Sam McCall [Tue, 28 Jun 2022 14:02:10 +0000 (16:02 +0200)]
[pseudo] Move cxx grammar into the cxx/ directory. NFC
Sam McCall [Tue, 28 Jun 2022 08:18:45 +0000 (10:18 +0200)]
[pseudo] Simplify/loosen the grammar around lambda captures.
Treat captures as a uniform list, rather than default-captures being special
snowflakes that may only appear at the start.
This accepts a larger set of (incorrect) code, and simplifies error-handling
by making this fit into the usual homogeneous-list pattern.
Differential Revision: https://reviews.llvm.org/D128708
Jay Foad [Fri, 6 Nov 2020 16:52:33 +0000 (16:52 +0000)]
[AMDGPU] llvm.amdgcn.exp.compr is not supported on GFX11
Differential Revision: https://reviews.llvm.org/D128259
Sam McCall [Mon, 27 Jun 2022 23:13:04 +0000 (01:13 +0200)]
[pseudo] Allow mixed designated/undesignated init lists.
This isn't allowed by the standard grammar but is allowed in C, and clang/GCC
permit it as an extension.
It avoids the need to determine which type of list we have in error-recovery.
While here, also support array index designators `{ [4]=1 }` which are
also legal in C, and common extensions in C++.
Differential Revision: https://reviews.llvm.org/D128687
Joe Nash [Mon, 20 Jun 2022 13:51:10 +0000 (09:51 -0400)]
[AMDGPU] Use GFX11 S_PACK_HL instruction in more cases
Differential Revision: https://reviews.llvm.org/D128527
Valentin Clement [Tue, 28 Jun 2022 13:28:25 +0000 (15:28 +0200)]
[flang] Fix bugs relating to support for characters of different kinds
Fix bugs relating to support for characters of different kinds. Lowering
was creating bad FIR and MLIR that crashed in conversion to LLVM IR.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128723
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Mehdi Amini [Tue, 28 Jun 2022 11:29:27 +0000 (11:29 +0000)]
Introduce a new Dense Array attribute
This attribute is similar to DenseElementsAttr but does not support
splat. As such it has a much simpler API and does not need any smart
iterator: it exposes direct ArrayRef access.
A new syntax is introduced so that the generic printing/parsing looks
like:
[:i64 1, -2, 3]
This attribute beings like an ArrayAttr but has a `:` token after the
opening square brace to introduce the element type (supported are I8,
I16, I32, I64, F32, F64) and the comma separated list for the data.
This is particularly convenient for attributes intended to be small,
like those referring to shapes.
For example a `transpose` operation with a `dims` attribute could be
defined as such:
let arguments = (ins AnyTensor:$input, DenseI64ArrayAttr:$dims);
let assemblyFormat = "$input `dims` `=` $dims attr-dict : type($input)";
And printed this way (the element type is elided in this case):
transpose %input dims = [0, 2, 1] : tensor<2x3x4xf32>
The C++ API for dims would just directly return an ArrayRef<int64>
RFC: https://discourse.llvm.org/t/rfc-introduce-a-new-dense-array-attribute/63279
Recommit with a custom DenseArrayBaseAttrStorage class to ensure
over-alignment of the storage to the largest type.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123774
Valentin Clement [Tue, 28 Jun 2022 13:24:21 +0000 (15:24 +0200)]
[flang] Make sure that conversions are applied in FORALL degenerate contexts
For the rapid triage push, just add a TODO for the degenerate POINTER
assignment case. The LHD ought to be a variable of type !fir.box, but it
is currently returning a shadow variable for the raw data pointer. More
investigation is needed there.
Make sure that conversions are applied in FORALL degenerate contexts.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128724
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Valentin Clement [Tue, 28 Jun 2022 13:21:44 +0000 (15:21 +0200)]
[flang] Add lowering tests
Add lowering tests left behind during the upstreaming.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128721
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Vladislav Khmelevsky [Wed, 15 Jun 2022 22:53:20 +0000 (01:53 +0300)]
[BOLT][AArch64] Handle gold linker veneers
The gold linker veneers are written between functions without symbols,
so we to handle it specially in BOLT.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D128082
Nikita Popov [Tue, 28 Jun 2022 13:09:01 +0000 (15:09 +0200)]
[IRBuilder] Migrate vector operations to fold infrastructure
Migrate extractelement, insertelement and shufflevector to use the
FoldXYZ rather than CreateXYZ APIs.
This is probably NFC in practice, because the places using
InstSimplifyFolder probably aren't using vector operations.
Mehdi Amini [Tue, 28 Jun 2022 12:46:49 +0000 (12:46 +0000)]
Revert "Introduce a new Dense Array attribute"
This reverts commit
508eb41d82ca956c30950d9a16b522a29aeeb333.
UBSAN indicates some pointer mis-alignment I need to investigate
Yi Kong [Tue, 28 Jun 2022 07:29:38 +0000 (15:29 +0800)]
[lldb] Fix build on older Linux kernel versions
PERF_COUNT_SW_DUMMY is introduced in Linux 3.12.
Differential Revision: https://reviews.llvm.org/D128707
Pavel Samolysov [Wed, 4 May 2022 08:38:21 +0000 (11:38 +0300)]
[ArgPromotion] Unify byval promotion with non-byval
It makes sense to handle byval promotion in the same way as non-byval
but also allowing `store` instructions. However, these should
use the same checks as the `load` instructions do, i.e. be part of the
`ArgsToPromote` collection. For these instructions, the check for
interfering modifications can be disabled, though. The promotion
algorithm itself has been modified a lot: all the accesses (i.e. loads
and stores) are rewritten to the emitted `alloca` instructions. To
optimize these new `alloca`s out, the `PromoteMemToReg` function from
`Transforms/Utils/PromoteMemoryToRegister.cpp` file is invoked after
promotion.
In order to let the `PromoteMemToReg` promote as many `alloca`s as it
is possible, there should be no `GEP`s from the `alloca`s. To
eliminate the `GEP`s, its own `alloca` is generated for every argument
part because a single `alloca` for the whole argument (that
significantly simplifies the code of the pass though) unfortunately
cannot be used.
The idea comes from the following discussion:
https://reviews.llvm.org/D124514#3479676
Differential Revision: https://reviews.llvm.org/D125485
Mehdi Amini [Tue, 28 Jun 2022 11:29:27 +0000 (11:29 +0000)]
Introduce a new Dense Array attribute
This attribute is similar to DenseElementsAttr but does not support
splat. As such it has a much simpler API and does not need any smart
iterator: it exposes direct ArrayRef access.
A new syntax is introduced so that the generic printing/parsing looks
like:
[:i64 1, -2, 3]
This attribute beings like an ArrayAttr but has a `:` token after the
opening square brace to introduce the element type (supported are I8,
I16, I32, I64, F32, F64) and the comma separated list for the data.
This is particularly convenient for attributes intended to be small,
like those referring to shapes.
For example a `transpose` operation with a `dims` attribute could be
defined as such:
let arguments = (ins AnyTensor:$input, DenseI64ArrayAttr:$dims);
let assemblyFormat = "$input `dims` `=` $dims attr-dict : type($input)";
And printed this way (the element type is elided in this case):
transpose %input dims = [0, 2, 1] : tensor<2x3x4xf32>
The C++ API for dims would just directly return an ArrayRef<int64>
RFC: https://discourse.llvm.org/t/rfc-introduce-a-new-dense-array-attribute/63279
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123774
Ting Wang [Tue, 28 Jun 2022 12:02:49 +0000 (08:02 -0400)]
[PowerPC] Improve getNormalLoadInput to reach more splat load
opportunities
There are straight forward splat load opportunities blocked by
getNormalLoadInput(), since those cases involve consecutive bitcasts.
Improve by looking through bitcasts.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D128703
Alex Bradbury [Tue, 28 Jun 2022 10:24:21 +0000 (11:24 +0100)]
[RISCV] Implement support for the Zicbop extension
Implements the ratified RISC-V Base Cache Management Operation ISA
Extension: Zicbop, as described in
https://github.com/riscv/riscv-CMOs/blob/master/specifications/cmobase-v1.0.pdf.
This is implemented in a separate patch to Zicbom and Zicboz due to it
requiring a new ASM operand type to be defined.
Differential Revision: https://reviews.llvm.org/D117433
Alex Bradbury [Tue, 28 Jun 2022 10:22:36 +0000 (11:22 +0100)]
[RISCV] Implement support for the Zicbom and Zicboz extensions
Implements the ratified RISC-V Base Cache Management Operation ISA
Extensions: Zicbom and Zicboz, as described in
https://github.com/riscv/riscv-CMOs/blob/master/specifications/cmobase-v1.0.pdf.
Zicbop is implemented in a separate patch due to it requiring a new ASM
operand type to be defined.
As discussed in the relevant issue in the upstream spec
https://github.com/riscv/riscv-CMOs/issues/47, the cbo.* instructions
use the format (rs1) or 0(rs1) for their operand, similar to the AMOs.
Differential Revision: https://reviews.llvm.org/D117432
Nikita Popov [Tue, 28 Jun 2022 11:25:16 +0000 (13:25 +0200)]
[ValueList] Include Error.h (NFC)
Hopefully fixes clang-ppc64-aix. Apparently std::function can't
be instantiated with a forward declared type in some environments.