OSDN Git Service
Fangrui Song [Thu, 12 Nov 2020 17:59:43 +0000 (09:59 -0800)]
[ELF] Don't consider SHF_ALLOC ".debug*" sections debug sections
Fixes PR48071
* The Rust compiler produces SHF_ALLOC `.debug_gdb_scripts` (which normally does not have the flag)
* `.debug_gdb_scripts` sections are removed from `inputSections` due to --strip-debug/--strip-all
* When processing --gc-sections, pieces of a SHF_MERGE section can be marked live separately
`=>` segfault when marking liveness of a `.debug_gdb_scripts` which is not split into pieces (because it is not in `inputSections`)
This patch circumvents the problem by not treating SHF_ALLOC ".debug*" as debug sections (to prevent --strip-debug's stripping)
(which is still useful on its own).
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D91291
Kevin P. Neal [Thu, 12 Nov 2020 17:49:39 +0000 (12:49 -0500)]
[FPEnv][Clang][Driver] Use MarshallingInfoFlag for -fexperimental-strict-floating-point
As of D80952 we are disabling strict floating point on all hosts except
those that are explicitly listed as supported. Use of strict floating point
on other hosts requires use of the -fexperimental-strict-floating-point
flag. This is to avoid bugs like "https://bugs.llvm.org/show_bug.cgi?id=45329"
(which has an incorrect link in the previous review).
In the review for D80952 I was asked to mark the -fexperimental option as
a MarshallingInfoFlag. This patch does exactly that.
Differential Revision: https://reviews.llvm.org/D88987
Sanjay Patel [Thu, 12 Nov 2020 16:48:16 +0000 (11:48 -0500)]
[InstCombine] add tests for mask of sext-in-reg; NFC
Jamie Schmeiser [Thu, 12 Nov 2020 17:39:10 +0000 (17:39 +0000)]
Reland: Introduce -dot-cfg-mssa option which creates dot-cfg style file with mssa comments included in source
Summary:
Expand the print-memoryssa and print<memoryssa> passes with a new hidden
option -cfg-dot-mssa that names a file. When set, a dot-cfg style file
will be generated into the named file with the memoryssa comments retained
and those blocks containing them shown in light pink. The option does
nothing in isolation.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea), dblaikie (David Blaikie)
Differential Revision: https://reviews.llvm.org/D90638
Nico Weber [Thu, 12 Nov 2020 17:15:09 +0000 (12:15 -0500)]
[gn build] (semi-manually) port
173b51169b8
Alexander Kornienko [Thu, 12 Nov 2020 17:14:06 +0000 (18:14 +0100)]
Fix unused variable warning in release builds
Simon Pilgrim [Thu, 12 Nov 2020 16:56:40 +0000 (16:56 +0000)]
[ValueTracking] Update computeKnownBitsFromShiftOperator callbacks to take KnownBits shift amount. NFCI.
We were creating this internally, but will need to support general KnownBits amounts as part of D90479.
Fangrui Song [Thu, 12 Nov 2020 16:56:12 +0000 (08:56 -0800)]
[ELF] Make SORT_INIT_PRIORITY support .ctors.N
Input sections `.ctors/.ctors.N` may go to either the output section `.init_array` or the output section `.ctors`:
* output `.ctors`: currently we sort them by name. This patch changes to sort by priority from high to low. If N in `.ctors.N` is in the form of %05u, there is no semantic difference. Actually GCC and Clang do use %05u. (In the test `ctors_dtors_priority.s` and Gold's test `gold/testsuite/script_test_14.s`, we can see %03u, but they are not really produced by compilers.)
* output `.init_array`: users can provide an input section description `SORT_BY_INIT_PRIORITY(.init_array.* .ctors.*)` to mix `.init_array.*` and `.ctors.*`. This can make .init_array.N and .ctors.(65535-N) interchangeable.
With this change, users can mix `.ctors.N` and `.init_array.N` in `.init_array` (PR44698 and PR48096) with linker scripts. As an example:
```
SECTIONS {
.init_array : {
*(SORT_BY_INIT_PRIORITY(.init_array.* .ctors.*))
*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)
}
} INSERT AFTER .fini_array;
SECTIONS {
.fini_array : {
*(SORT_BY_INIT_PRIORITY(.fini_array.* .dtors.*))
*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)
}
} INSERT BEFORE .init_array;
```
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D91187
Fangrui Song [Thu, 12 Nov 2020 16:53:11 +0000 (08:53 -0800)]
[ELF] Sort by input order within an input section description
According to
https://sourceware.org/binutils/docs/ld/Input-Section-Basics.html#Input-Section-Basics
for `*(.a .b)`, the order should match the input order:
* for `ld 1.o 2.o`, sections from 1.o precede sections from 2.o
* within a file, `.a` and `.b` appear in the section header table order
This patch implements the behavior. The interaction with `SORT*` and --sort-section is:
Matched sections are ordered by radix sort with the keys being `(SORT*, --sort-section, input order)`,
where `SORT*` (if present) is most significant.
> Note, multiple `SORT*` within an input section description has undocumented and
> confusing behaviors in GNU ld:
> https://sourceware.org/pipermail/binutils/2020-November/114083.html
> Therefore multiple `SORT*` is not the focus for this patch but
> this patch still strives to have an explainable behavior.
As an example, we partition `SORT(a.*) b.* c.* SORT(d.*)`, into
`SORT(a.*) | b.* c.* | SORT(d.*)` and perform sorting within groups. Sections
matched by patterns between two `SORT*` are sorted by input order. If
--sort-alignment is given, they are sorted by --sort-alignment, breaking tie by
input order.
This patch also allows a section to be matched by multiple patterns, previously
duplicated sections could occupy more space in the output and had erroneous zero bytes.
The patch is in preparation for support for
`*(SORT_BY_INIT_PRIORITY(.init_array.* .ctors.*)) *(.init_array .ctors)`,
which will allow LLD to mix .ctors*/.init_array* like GNU ld (gold's --ctors-in-init-array)
PR44698 and PR48096
Reviewed By: grimar, psmith
Differential Revision: https://reviews.llvm.org/D91127
Fangrui Song [Thu, 12 Nov 2020 16:46:53 +0000 (08:46 -0800)]
[ELF] Support multiple SORT in an input section description
The second `SORT` in `*(SORT(...) SORT(...))` is incorrectly parsed as a file pattern.
Fix the bug by stopping at `SORT*` in `readInputSectionsList`.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D91180
Baptiste Saleil [Thu, 12 Nov 2020 16:32:47 +0000 (10:32 -0600)]
[PowerPC] Prevent the use of MMA with P9 and earlier
We want to allow using MMA on P10 CPU only. This patch prevents the use of MMA
with the -mmma option on P9 CPUs and earlier.
Differential Revision: https://reviews.llvm.org/D91200
Raphael Isemann [Thu, 12 Nov 2020 16:20:11 +0000 (17:20 +0100)]
[lldb] Replace TestAbortExitCode with a debugserver specific test
When I added TestAbortExitCode I actually planned this to be a generic test for the
exit code functionality on POSIX systems. However due to all the different test setups we
can have I don't think this worked out. Right now the test had to be made so permissive
that it pretty much can't fail.
Just to summarize, we would need to support the following situations:
1. ToT debugserver (on macOS)
2. lldb-server (on other platforms)
3. Any old debugserver version when using the system debugserver (on macOS)
This patch is removing TestAbortExitCode and adds a ToT debugserver specific test
that checks the patch that motivated the whole exit code testing. There is already
an exit-code test for lldb-server from what I can see and 3) is pretty much untestable
as we don't know anything about the system debugserver.
Reviewed By: kastiglione
Differential Revision: https://reviews.llvm.org/D89305
Zbigniew Sarbinowski [Thu, 12 Nov 2020 16:22:04 +0000 (11:22 -0500)]
[SystemZ][ZOS] Porting the time functions within libc++ to z/OS
This patch is one part of many steps required to build libc++ and libc++abi libraries on z/OS. This particular deals with time related functions and consists of the following 3 parts.
1) Initialization of :timeval within libc++ library need to be adjusted to work on z/OS.
The following is z/OS definition from time.h which includes additional aggregate member.
typedef signed int suseconds_t;
struct timeval {
time_t tv_sec;
char tv_usec_pad[4];
suseconds_t tv_usec;
};
In contracts the following is definition from time.h on Linux.
typedef long int __suseconds_t;
struct timeval
{
__time_t tv_sec;
__suseconds_t tv_usec;
};
2) In addition, retrieving ::timespec within libc++ library needs to be adjusted to compensate the difference of some of the members of ::stat depending of the target host.
Here are the 2 members in conflict on z/OS extracted from stat.h.
struct stat {
...
time_t st_atime;
time_t st_mtime;
...
};
In contract here is Linux equivalent from stat.h.
struct stat
{
...
struct timespec st_atim;
struct timespec st_mtim;
...
};
3) On Linux both members are of type timespec whereas on z/OS an object of type timespec need to be constructed first before retrieving it within libc++ library.
The libc++ header file __threading_support calls nanosleep, which is not available on z/OS.
The equivalent functionality will be implemented by using both sleep() and usleep().
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D87940
Simon Pilgrim [Thu, 12 Nov 2020 16:15:46 +0000 (16:15 +0000)]
[KnownBits] Add KnownBits::makeConstant helper. NFCI.
Helper for cases where we need to create a KnownBits from a (fully known) constant value.
Anh Tuyen Tran [Thu, 12 Nov 2020 15:48:14 +0000 (15:48 +0000)]
Revert "Introduce -dot-cfg-mssa option which creates dot-cfg style file with mssa comments included in source"
This reverts commit
45d459e7522ddc512ac70c4c822d58d335099672 due to
build issue in Poly.
Craig Topper [Thu, 12 Nov 2020 15:37:29 +0000 (07:37 -0800)]
[RISCV] Don't include CodeGen layer files in MC layer
-Use MCRegister instead of Register in MC layer.
-Move some enums from RISCVInstrInfo.h to RISCVBaseInfo.h to be with other TSFlags bits.
Differential Revision: https://reviews.llvm.org/D91114
Jamie Schmeiser [Thu, 12 Nov 2020 15:41:11 +0000 (15:41 +0000)]
Introduce -dot-cfg-mssa option which creates dot-cfg style file with mssa comments included in source
Summary:
Expand the print-memoryssa and print<memoryssa> passes with a new hidden
option -cfg-dot-mssa that names a file. When set, a dot-cfg style file
will be generated into the named file with the memoryssa comments retained
and those blocks containing them shown in light pink. The option does
nothing in isolation.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea), dblaikie (David Blaikie)
Differential Revision: https://reviews.llvm.org/D90638
Craig Topper [Thu, 12 Nov 2020 15:21:27 +0000 (07:21 -0800)]
[RISCV] Add an ANDI to shift amount of FSL/FSR instructions
The fshl and fshr intrinsics are defined to modulo their shift amount by the bitwidth of one of their inputs. The FSR/FSL instructions read one extra bit from the shift amount. If that bit is set the inputs are swapped. In order to preserve the semantics of the llvm intrinsics we need to make sure that the extra bit isn't set. DAG combine or instcombine may have removed any mask that was originally present.
We could be smarter here and try to use computeKnownBits to check if the bit is known zero, but wanted to start with correctness.
Differential Revision: https://reviews.llvm.org/D90905
Simon Pilgrim [Thu, 12 Nov 2020 15:20:41 +0000 (15:20 +0000)]
[ValueTracking] Update computeKnownBitsFromShiftOperator callbacks to use KnownBits shift handling. NFCI.
Jamie Schmeiser [Thu, 12 Nov 2020 15:20:46 +0000 (15:20 +0000)]
Introduce -print-before-changed, making -print-changed also print before passes that modify IR
Summary:
Add an option -print-before-changed that modifies the print-changed
behaviour so that it prints the IR before a pass that changed it in
addition to printing the IR after the pass. Note that the option
does nothing in isolation. The filtering options work as expected.
Lit tests are included.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D88757
Raphael Isemann [Thu, 12 Nov 2020 15:07:58 +0000 (16:07 +0100)]
[lldb] Add expect_var_path to test variable path results
This adds `expect_var_path` to test variable paths so we no longer have to
use `frame var` and find substrs in the command output. The behaviour
is identical with `expect_expr` (and it also uses the same checking backend),
but it instead calls `GetValueForVariablePath` to evaluate the string as a variable
path.
Also rewrites a few of the tests that previously used `frame variable` to use
`expect_var_path`.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D90450
Zhuojia Shen [Thu, 12 Nov 2020 14:44:54 +0000 (14:44 +0000)]
[builtins] Add support for single-precision-only-FPU ARM targets.
This patch enables building compiler-rt builtins for ARM targets that
only support single-precision floating point instructions (e.g., those
with -mfpu=fpv4-sp-d16).
This fixes PR42838
Differential Revision: https://reviews.llvm.org/D90698
Jamie Schmeiser [Thu, 12 Nov 2020 15:06:53 +0000 (15:06 +0000)]
[NFC intended] Refactor SinkAndHoistLICMFlags to allow others to construct without exposing internals
Summary:
Refactor SinkAdHoistLICMFlags from a struct to a class with accessors and constructors to allow other
classes to construct flags with meaningful defaults while not exposing LICM internal details.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea)
Differential Revision: https://reviews.llvm.org/D90482
Paul C. Anagnostopoulos [Thu, 12 Nov 2020 14:46:42 +0000 (09:46 -0500)]
[CODE_OWNERS.TXT] Update to include yours truly as the TableGen owner
Jean-Michel Gorius [Thu, 12 Nov 2020 14:44:43 +0000 (15:44 +0100)]
[clang][docs] Remove wrongly spaced \brief in Doxygen comment (NFC)
Raphael Isemann [Tue, 10 Nov 2020 12:17:07 +0000 (13:17 +0100)]
[lldb][NFC] Move OptionDefinition from lldb-private-types.h to its own Utility header
Also moves the curious isprint8 function (which was used to check whether we have a
valid short option) into the struct and documents it.
Sylvain Audi [Tue, 10 Nov 2020 20:56:02 +0000 (15:56 -0500)]
[clang-scan-deps] Fix for input file given as relative path in compilation database "command" entry.
Differential Revision: https://reviews.llvm.org/D91204
David Green [Thu, 12 Nov 2020 13:47:46 +0000 (13:47 +0000)]
[ARM] Ensure CountReg definition dominates InsertPt when creating t2DoLoopStartTP
Of course there was something missing, in this case a check that the def
of the count register we are adding to a t2DoLoopStartTP would dominate
the insertion point.
In the future, when we remove some of these COPY's in between, the
t2DoLoopStartTP will always become the last instruction in the block,
preventing this from happening. In the meantime we need to check they
are created in a sensible order.
Differential Revision: https://reviews.llvm.org/D91287
Alexandre Ganea [Thu, 12 Nov 2020 13:31:57 +0000 (08:31 -0500)]
Alexander Kornienko [Thu, 12 Nov 2020 13:23:14 +0000 (14:23 +0100)]
[lld] Use temporary directory to create test outputs
Alexandre Ganea [Thu, 12 Nov 2020 13:14:20 +0000 (08:14 -0500)]
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures
This is a follow-up for D70378 (Cover usage of LLD as a library).
While debugging an intermittent failure on a bot, I recalled this scenario which
causes the issue:
1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach
lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(),
then ELFFileBase::init().
2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a
half-initialized ObjFile instance.
3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we
hapily restore the control flow to CrashRecoveryContext::RunSafely() then back
in lld::safeLldMain().
4.Before this patch, we called errorHandler().reset() just after, and this
attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried
to free the half-initialized ObjFile instance, and more precisely its
ObjFile::dwarf member.
Sometimes that worked, sometimes it failed and was catched by the
CrashRecoveryContext. This scenario was the reason we called
errorHandler().reset() through a CrashRecoveryContext.
But in some rare cases, the above repro somehow corrupted the heap, creating a
stack overflow. When the CrashRecoveryContext's filter (that is,
__except (ExceptionFilter(GetExceptionInformation()))) tried to handle the
exception, it crashed again since the stack was exhausted -- and that took the
whole application down. That is the issue seen on the bot. Locally it happens
about 1 times out of 15.
Now this situation can happen anywhere in LLD. Since catching stack overflows is
not a reliable scenario ATM when using CrashRecoveryContext, we're now
preventing further re-entrance when such failures occur, by signaling
lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above),
only one iteration will be executed, instead of two.
Differential Revision: https://reviews.llvm.org/D88348
Michał Górny [Wed, 11 Nov 2020 15:32:46 +0000 (16:32 +0100)]
[lldb] [test] Add a minimal test for x86 dbreg reading
Add a test verifying that after the 'watchpoint' command, new values
of x86 debug registers can be read back correctly. The primary purpose
of this test is to catch broken DRn reading and help debugging it.
Differential Revision: https://reviews.llvm.org/D91264
Michał Górny [Wed, 11 Nov 2020 13:51:16 +0000 (14:51 +0100)]
[lldb] [Process/Utility] Fix DR offsets for FreeBSD
Fix Debug Register offsets to be specified relatively to UserArea
on FreeBSD/amd64 and FreeBSD/i386, and add them to UserArea on i386.
This fixes overlapping GPRs and DRs in gdb-remote protocol, making it
impossible to correctly get and set debug registers from the LLDB
client.
Differential Revision: https://reviews.llvm.org/D91254
Raphael Isemann [Thu, 12 Nov 2020 13:01:09 +0000 (14:01 +0100)]
Revert "Generalize regex matching std::string variants to compensate for recent"
This reverts commit
856fd98a176240470dcc2b8ad54b5c17ef6a75b3. The type formatters
use inline namespaces to find the formatter that fits the type ABI, so they
can't just ignore the inline namespaces.
The failing tests should be fixed by
da121fff1184267a405f81a87f7314df2d474e1c .
Raphael Isemann [Thu, 12 Nov 2020 10:33:36 +0000 (11:33 +0100)]
[lldb] Introduce a LLDB printing policy for Clang type names that suppressed inline namespaces
Commit
5f12f4ff9078455cad9d4806da01f570553a5bf9 made suppressing inline namespaces
when printing typenames default to true. As we're using the inline namespaces
in LLDB to construct internal type names (which need internal namespaces in them
to, for example, differentiate libc++'s std::__1::string from the std::string
from libstdc++), this broke most of the type formatting logic.
Hans Wennborg [Mon, 9 Nov 2020 16:22:32 +0000 (17:22 +0100)]
[dllexport] Instantiate default ctor default args for explicit specializations (PR45811)
For dllexported default constructors with default arguments, we export
default constructor closures which pass in the default args. (See D8331
for a good explanation.)
For templates, that means those default args must be instantiated even
if the function isn't called. That is done by the
InstantiateDefaultCtorDefaultArgs() function, but it wasn't done for
explicit specializations, causing asserts (see bug).
Differential revision: https://reviews.llvm.org/D91089
Jean-Michel Gorius [Wed, 11 Nov 2020 17:01:39 +0000 (18:01 +0100)]
[mlir] Add plus, star and optional less/greater parsing
The tokens are already handled by the lexer. This revision exposes them
through the parser interface.
This revision also adds missing functions for question mark parsing and
completes the list of valid punctuation tokens in the documentation.
Differential Revision: https://reviews.llvm.org/D90907
Hans Wennborg [Thu, 5 Nov 2020 12:44:50 +0000 (13:44 +0100)]
[dllexport] Avoid assert for explicitly defaulted methods in explicit instantiation definitions (PR47683)
Clang was asserting due to attempting to codegen such methods twice.
Differential revision: https://reviews.llvm.org/D90849
Alex Zinenko [Tue, 10 Nov 2020 16:31:36 +0000 (17:31 +0100)]
[mlir] Generate Op builders for Python bindings
Add an ODS-backed generator of default builders. This currently does not
support operation with attribute arguments, for which the builder is
just ignored. Attribute support will be introduced separately for
builders and accessors.
Default builders are always generated with the same number of result and
operand groups as the ODS specification, i.e. one group per each operand
or result. Optional elements accept None but cannot be omitted. Variadic
groups accept iterable objects and cannot be replaced with a single
object.
For some operations, it is possible to infer the result type given the
traits, but most traits rely on inline pieces of C++ that we cannot
(yet) forward to Python bindings. Since the Ops where the inference is
possible (having the `SameOperandAndResultTypes` trait or
`TypeMatchesWith` without transform field) are a small minority, they
also require the result type to make the builder syntax more consistent.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D91190
Kazushi (Jam) Marukawa [Tue, 10 Nov 2020 12:00:20 +0000 (21:00 +0900)]
[VE] Change the default type of v64 register class
Change the default type of v64 register class from v512i32 to v256f64.
Add a regression test also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D91301
Julian Gross [Tue, 3 Nov 2020 11:28:49 +0000 (12:28 +0100)]
[MLIR] Added documentation and manual to use bufferization features.
Added documentation about the bufferization features.
Furthermore, the usage of pre- and post-processing is described.
This also includes information about optimization functionalities.
Differential Revision: https://reviews.llvm.org/D90675
Kadir Cetinkaya [Thu, 12 Nov 2020 09:33:30 +0000 (10:33 +0100)]
[clangd] Simplify relations deserialization loop, NFC.
David Sherwood [Thu, 22 Oct 2020 08:37:33 +0000 (09:37 +0100)]
[SVE] Deal with SVE tuple call arguments correctly when running out of registers
When passing SVE types as arguments to function calls we can run
out of hardware SVE registers. This is normally fine, since we
switch to an indirect mode where we pass a pointer to a SVE stack
object in a GPR. However, if we switch over part-way through
processing a SVE tuple then part of it will be in registers and
the other part will be on the stack.
I've fixed this by ensuring that:
1. When we don't have enough registers to allocate the whole block
we mark any remaining SVE registers temporarily as allocated.
2. We temporarily remove the InConsecutiveRegs flags from the last
tuple part argument and reinvoke the autogenerated calling
convention handler. Doing this prevents the code from entering
an infinite recursion and, in combination with 1), ensures we
switch over to the Indirect mode.
3. After allocating a GPR register for the pointer to the tuple we
then deallocate any SVE registers we marked as allocated in 1).
We also set the InConsecutiveRegs flags back how they were before.
4. I've changed the AArch64ISelLowering LowerCALL and
LowerFormalArguments functions to detect the start of a tuple,
which involves allocating a single stack object and doing the
correct numbers of legal loads and stores.
Differential Revision: https://reviews.llvm.org/D90219
David Green [Thu, 12 Nov 2020 08:37:46 +0000 (08:37 +0000)]
[ARM] Remove unused check labels. NFC
Marek Kurdej [Thu, 12 Nov 2020 08:32:29 +0000 (09:32 +0100)]
[libc++] [P0340] [C++20] Update status page. NFC.
This was implemented in
410b650e674496e61506fa88f3026759b8759d0f:
"Implement P0340R3: Make 'underlying_type' SFINAE-friendly. Reviewed as https://reviews.llvm.org/D63574
llvm-svn: 364094"
MaheshRavishankar [Thu, 12 Nov 2020 08:24:36 +0000 (00:24 -0800)]
[mlir][Linalg] Improve the logic to perform tile and fuse with better dependence tracking.
This change does two main things
1) An operation might have multiple dependences to the same
producer. Not tracking them correctly can result in incorrect code
generation with fusion. To rectify this the dependence tracking
needs to also have the operand number in the consumer.
2) Improve the logic used to find the fused loops making it easier to
follow. The only constraint for fusion is that linalg ops (on
buffers) have update semantics for the result. Fusion should be
such that only one iteration of the fused loop (which is also a
tiled loop) must touch only one (disjoint) tile of the output. This
could be relaxed by allowing for recomputation that is the default
when oeprands are tensors, or can be made legal with promotion of
the fused view (in future).
Differential Revision: https://reviews.llvm.org/D90579
Amara Emerson [Thu, 12 Nov 2020 06:45:19 +0000 (22:45 -0800)]
[AArch64][GlobalISel] Optimize G_PTR_ADD with a negated offset to be a G_SUB.
Max Kazantsev [Thu, 12 Nov 2020 05:24:18 +0000 (12:24 +0700)]
[NFC][SCEV] Generalize monotonicity check for full and limited iteration space
A piece of logic of `isLoopInvariantExitCondDuringFirstIterations` is actually
a generalized predicate monotonicity check. This patch moves it into the
corresponding method and generalizes it a bit.
Differential Revision: https://reviews.llvm.org/D90395
Reviewed By: apilipenko
Chuanqi Xu [Thu, 12 Nov 2020 05:17:16 +0000 (13:17 +0800)]
[NFC][coroutines] remove unused argument in SemaCoroutine
Test plan: check-llvm, check-clang
Reviewers: lxfind, junparser
Differential Revision: https://reviews.llvm.org/D91243
Xun Li [Thu, 12 Nov 2020 05:09:22 +0000 (21:09 -0800)]
Revert "[Coroutine] Allocas used by StoreInst does not always escape"
This reverts commit
8bc7b9278e55c4c8c731e7600a2d146438697964, which landed by accident.
Aart Bik [Thu, 12 Nov 2020 02:40:01 +0000 (18:40 -0800)]
[mlir][sparse] export sparse tensor runtime support through header file
Exposing the C versions of the methods of the sparse runtime support lib
through header files will enable using the same methods in an MLIR program
as well as a C++ program, which will simplify future benchmarking comparisons
(e.g. comparing MLIR generated code with eigen for Matrix Market sparse matrices).
Reviewed By: penpornk
Differential Revision: https://reviews.llvm.org/D91316
Max Kazantsev [Thu, 12 Nov 2020 05:01:12 +0000 (12:01 +0700)]
[IndVars] IV user should not prevent use widening
Sometimes the an instruction we are trying to widen is used by the IV
(which means the instruction is the IV increment). Currently this may
prevent its widening. We should ignore such user because it will be
dead once the transform is done anyways.
Differential Revision: https://reviews.llvm.org/D90920
Reviewed By: fhahn
Xun Li [Thu, 12 Nov 2020 04:53:45 +0000 (20:53 -0800)]
[Coroutine] Allocas used by StoreInst does not always escape
In the existing logic, for a given alloca, as long as its pointer value is stored into another location, it's considered as escaped.
This is a bit too conservative. Specifically, in non-optimized build mode, it's often to have patterns of code that first store an alloca somewhere and then load it right away.
These used should be handled without conservatively marking them escaped.
This patch tracks how the memory location where an alloca pointer is stored into is being used. As long as we only try to load from that location and nothing else, we can still
consider the original alloca not escaping and keep it on the stack instead of putting it on the frame.
Differential Revision: https://reviews.llvm.org/D91305
Max Kazantsev [Thu, 12 Nov 2020 03:49:01 +0000 (10:49 +0700)]
[IndVars] Recognize 'sub nuw' expressed as 'add' for widening
InstCombine canonicalizes 'sub nuw' instructions to 'add' without the
`nuw` flag. The typical case where we see it is decrementing induction
variables. For them, IndVars fails to prove that it's legal to widen them,
and inserts unprofitable `zext`'s.
This patch adds recognition of such pattern using SCEV.
Differential Revision: https://reviews.llvm.org/D89550
Reviewed By: fhahn, skatkov
Max Kazantsev [Thu, 12 Nov 2020 03:47:34 +0000 (10:47 +0700)]
[Test] Add Check statement
Richard Smith [Thu, 12 Nov 2020 03:05:32 +0000 (19:05 -0800)]
Fix structural comparison of template template arguments to compare the
right union member.
Should fix the armv8 buildbot.
Qiu Chaofan [Thu, 12 Nov 2020 02:19:52 +0000 (10:19 +0800)]
[PowerPC] [Clang] Define macros to identify quad-fp semantics
We have option -mabi=ieeelongdouble to set current long double to
IEEEquad semantics. Like what GCC does, we need to define
__LONG_DOUBLE_IEEE128__ macro in this case, and __LONG_DOUBLE_IBM128__
if using PPCDoubleDouble.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D90208
Lang Hames [Thu, 12 Nov 2020 02:10:47 +0000 (13:10 +1100)]
[docs] Fix formatting, clarify comment in ORCv2 doc
Richard Smith [Thu, 12 Nov 2020 01:54:26 +0000 (17:54 -0800)]
Generalize regex matching std::string variants to compensate for recent
improvements to Clang's type printing.
Aart Bik [Thu, 12 Nov 2020 00:37:48 +0000 (16:37 -0800)]
[mlir][sparse] integrate sparse annotation into generic linalg op
This CL integrates the new sparse annotations (hereto merely added as fully
transparent attributes) more tightly to the generic linalg op in order to add
verification of the annotations' consistency as well as to make make other
passes more aware of their presence (in the long run, rewriting rules must
preserve the integrity of the annotations).
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D91224
Joseph Huber [Mon, 9 Nov 2020 16:02:30 +0000 (11:02 -0500)]
[OpenMP] Begin Adding OpenMP Tool to Gather OpenMP Information
Summary:
This patch begins to add support for a set of scripts that can be used to get information from OpenMP programs to better describe problems and eventually show the data to the user in formatted output. Right now the only support is forformatting the register and memory usage reports from ptxas and nvlink. This is simply done as a wrapper around clang and clang++.
Reviewers: jdoerfert
DIfferential Revision: https://reviews.llvm.org/D91085
Joachim Protze [Thu, 12 Nov 2020 00:22:48 +0000 (01:22 +0100)]
[OpenMP][Tools][Tests] Fix ompt multiplex test
With
6213ed0 the master callback was renamed to masked.
The multiplex tests must check for masked now.
peter klausler [Tue, 10 Nov 2020 22:56:51 +0000 (14:56 -0800)]
[flang][MSVC] Use list<Message> rather than forward_list<> in Messages
The implementation of Messages with forward_list<> makes some
nonstandard assumptions about the validity of iterators that don't
hold up with MSVC's implementation. Use list<> instead. The
measured performance is comparable.
This change obviated a distinction between two member functions
of Messages, and the uses of one have been replaced with calls
to the other.
Similar usage in CharBuffer was also replaced for consistency.
Differential revision: https://reviews.llvm.org/D91210
Sam McCall [Wed, 11 Nov 2020 17:27:45 +0000 (18:27 +0100)]
[Syntax] Tablegen literal expressions.
Non-mechanical changes:
- Added FIXME to StringLiteral to cover multi-token string literals.
- LiteralExpression::getLiteralToken() is gone. (It was never called)
This is because we don't codegen methods in Alternatives
It's conceptually suspect if we consider multi-token string literals, though.
Differential Revision: https://reviews.llvm.org/D91277
Dave Lee [Tue, 10 Nov 2020 21:59:04 +0000 (13:59 -0800)]
[lldb] Switch expect to runCmd in TestRecursiveTypes (NFC)
Following discussion in D91193, a change made in D88792 was not quite right.
This restores the message argument, and switches from `expect` to `runCmd`.
Differential Revision: https://reviews.llvm.org/D91206
Lang Hames [Thu, 12 Nov 2020 00:08:58 +0000 (11:08 +1100)]
[docs] Fix formatting in ORCv2.rst.
Bold and fixed-width do not appear to mix well.
Lang Hames [Wed, 11 Nov 2020 23:05:43 +0000 (10:05 +1100)]
[docs] Update ORCv2 design doc.
Fixes some formatting and wording, and adds a roadmap section.
Arnold Schwaighofer [Mon, 9 Nov 2020 20:05:57 +0000 (12:05 -0800)]
[coro] Async coroutines: Allow more than 3 arguments in the dispatch function
We need to be able to call function pointers. Inline the dispatch
function.
Also inline the context projection function.
Transfer debug locations from the suspend point to the inlined functions.
Use the function argument index instead of the function argument in
coro.id.async. This solves any spurious use issues.
Coerce the arguments of the tail call function at a suspend point. The LLVM
optimizer seems to drop casts leading to a vararg intrinsic.
rdar://
70097093
Differential Revision: https://reviews.llvm.org/D91098
Arthur Eubanks [Sun, 8 Nov 2020 21:51:29 +0000 (13:51 -0800)]
[NewPM] Provide method to run all pipeline callbacks, used for -O0
Some targets may add required passes via
TargetMachine::registerPassBuilderCallbacks(). We need to run those even
under -O0. As an example, BPFTargetMachine adds
BPFAbstractMemberAccessPass, a required pass.
This also allows us to clean up BackendUtil.cpp (and out-of-tree Rust
usage of the NPM) by allowing us to share added passes like coroutines
and sanitizers between -O0 and other optimization levels.
Since callbacks may end up not adding passes, we need to check if the
pass managers are empty before adding them, so PassManager now has an
isEmpty() function. For example, polly adds callbacks but doesn't always
add passes in those callbacks, so this is necessary to keep
-debug-pass-manager tests' output from changing depending on if polly is
enabled or not.
Tests are a continuation of those added in
https://reviews.llvm.org/D89083.
Reviewed By: asbirlea, Meinersbur
Differential Revision: https://reviews.llvm.org/D89158
Richard Smith [Wed, 11 Nov 2020 22:34:20 +0000 (14:34 -0800)]
Suppress printing of inline namespace names in diagnostics by default,
except where they are necessary to disambiguate the target.
This substantially improves diagnostics from the standard library,
which are otherwise full of `::__1::` noise.
Richard Smith [Wed, 11 Nov 2020 21:04:35 +0000 (13:04 -0800)]
Suppress printing template arguments that match default template
arguments of types by default.
This somewhat improves the worst-case printing of types like
std::string, std::vector, etc., where many irrelevant default arguments
can be included in the type as printed if we've lost the type sugar.
Sam McCall [Mon, 2 Nov 2020 23:24:03 +0000 (00:24 +0100)]
[clangd] Add index server request logging
- Add verbose logging of payloads
- Add public logging of request summaries
- fix non-logging of messages in request scopes (oops!)
- add test for public/non-public logging, extending pipeline_helper a bit.
We've accumulated quite a lot of duplication in the request handlers by now.
I should factor that out, but not in this patch...
Differential Revision: https://reviews.llvm.org/D90654
Ruslan Arutyunyan [Tue, 10 Nov 2020 12:49:55 +0000 (07:49 -0500)]
[libc++] Implement P0919R3: heterogenous lookup for unordered containers
Implement heterogenous lookup for unordered containers, including the
refinement from P1690R1.
Differential Revision: https://reviews.llvm.org/D87171
Baptiste Saleil [Mon, 2 Nov 2020 15:38:24 +0000 (09:38 -0600)]
[PowerPC] Accumulator/Unprimed Accumulator register copy, spill and restore
This patch adds support for accumulator/unprimed accumulator
register copy, spill and restore for MMA.
Authored By: Baptiste Saleil
Reviewed By: #powerpc, bsaleil, amyk
Differential Revision: https://reviews.llvm.org/D90616
Michael Kruse [Wed, 11 Nov 2020 22:14:48 +0000 (16:14 -0600)]
[Polly][OpTree] Fix mid-processing change of access kind.
Operand tree forwarding can cause the change of an access kind; in
particular change from a scalar kind to an array kind if the scalar
dependency is not necessary. Such an access cannot and doesn't need to
be forwarded anymore.
Fixes llvm.org/PR48034
Michael Kruse [Wed, 11 Nov 2020 22:00:42 +0000 (16:00 -0600)]
[Polly][OpTree] Better report applied changes.
Print to dbgs() any taken action.
Also, read-only scalars do not require any action unless
-polly-analyze-read-only-scalars=true is used. Better refect this by
using ForwardingAction::triviallyForwardable and thus not bumping the
statistics.
Duncan P. N. Exon Smith [Thu, 5 Nov 2020 17:43:58 +0000 (12:43 -0500)]
Frontend: Change ComputePreambleBounds to take MemoryBufferRef, NFC
Avoid requiring an actual MemoryBuffer in ComputePreambleBounds, when
a MemoryBufferRef will do just fine.
Differential Revision: https://reviews.llvm.org/D90890
Sam McCall [Wed, 11 Nov 2020 12:45:19 +0000 (13:45 +0100)]
[clangd] Sanity-check array sizes read from disk before allocating them.
Previously a corrupted index shard could cause us to resize arrays to an
arbitrary int32. This tends to be a huge number, and can render the
system unresponsive.
Instead, cap this at the amount of data that might reasonably be read
(e.g. the #bytes in the file). If the specified length is more than that,
assume the data is corrupt.
Differential Revision: https://reviews.llvm.org/D91258
Louis Dionne [Wed, 11 Nov 2020 22:04:32 +0000 (17:04 -0500)]
[libc++] NFC: Simplify incude of <cstdlib>
We include <exception>, which includes <cstdlib> unconditionally anyway.
Louis Dionne [Wed, 11 Nov 2020 21:50:43 +0000 (16:50 -0500)]
[libc++abi] Reuse libc++'s refstring.h header instead of copying it
This has been a long-standing TODO item, however we have now been requiring
a monorepo layout to build libc++ and libc++abi for a while now. Hence,
we can fix this code duplication issue now.
Note that it's still not super pretty to reach into libc++ to include
headers, but it's better than having duplicated code which can get out
of sync.
peter klausler [Wed, 11 Nov 2020 19:05:23 +0000 (11:05 -0800)]
[flang] Fix CheckSpecificationExpr handling of associated names
Avoid a spurious error message about a dummy procedure reference
in a specification expression by restructuring the handling of
use-associated and host-associated symbols.
Updated to fix a circular dependence between shared library
binaries that was introduced by the original patch.
Differential revision: https://reviews.llvm.org/D91286
Arthur Eubanks [Sat, 7 Nov 2020 02:32:46 +0000 (18:32 -0800)]
[CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass
Previously the inliner did a bit of a hack by adding ref edges for all
new edges introduced by performing an inline before calling
updateCGAndAnalysisManagerForPass(). This was because
updateCGAndAnalysisManagerForPass() didn't handle new non-trivial call
edges.
This adds handling of non-trivial call edges to
updateCGAndAnalysisManagerForPass(). The inliner called
updateCGAndAnalysisManagerForFunctionPass() since it was handling adding
newly introduced edges (so updateCGAndAnalysisManagerForPass() would
only have to handle promotion), but now it needs to call
updateCGAndAnalysisManagerForCGSCCPass() since
updateCGAndAnalysisManagerForPass() is now handling the new call edges
and function passes cannot add new edges.
We follow the previous path of adding trivial ref edges then letting promotion
handle changing the ref edges to call edges and the CGSCC updates. So
this still does not allow adding call edges that result in an addition
of a non-trivial ref edge.
This is in preparation for better detecting devirtualization. Previously
since the inliner itself would add ref edges,
updateCGAndAnalysisManagerForPass() would think that promotion and thus
devirtualization had happened after any sort of inlining.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D91046
Florian Hahn [Wed, 11 Nov 2020 21:39:22 +0000 (21:39 +0000)]
[Matrix] Update mangling to use paramterized vendor ext type syntax.
The Itanium CXX ABI grammer has been extended to support parameterized
vendor extended types [1].
This patch updates Clang's mangling for matrix types to use the new
extension.
[1] https://github.com/itanium-cxx-abi/cxx-abi/commit/
b359d28971bdb961dd9b61bd0ef8c884452b4740
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D91253
Louis Dionne [Wed, 11 Nov 2020 21:33:38 +0000 (16:33 -0500)]
[libc++] NFC: Synchronize libc++abi and libc++ new definitions
Some changes were made to the libc++abi new/delete definitions, but
they were not copied back to the libc++ definition. It sucks that we
have this duplication, but for now at least let's keep them in sync.
Jessica Paquette [Wed, 11 Nov 2020 21:21:35 +0000 (13:21 -0800)]
[AArch64][GlobalISel] Mark G_FCONSTANT as legal when there is full fp16 support
When there is full fp16 support, there is no reason to widen 16-bit
G_FCONSTANTs to 32 bits. Mark them as legal in this case.
Also, we currently import a pattern for materializing a 16-bit 0.0.
Add a testcase showing we select it.
(All other 16-bit G_FCONSTANTS are not yet selected.)
Differential Revision: https://reviews.llvm.org/D89164
Kazushi (Jam) Marukawa [Wed, 11 Nov 2020 11:48:33 +0000 (20:48 +0900)]
[VE] Support vector register in inline asm
Support a vector register constraint in inline asm of clang.
Add a regression test also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D91251
Duncan P. N. Exon Smith [Fri, 6 Nov 2020 17:40:43 +0000 (12:40 -0500)]
Frontend: Skip namespace around createVFSFromCompilerInvocation definition, NFC
Qualify definitions with `clang::` rather than opening/closing a namespace.
Differential Revision: https://reviews.llvm.org/D90957
peter klausler [Tue, 10 Nov 2020 23:03:21 +0000 (15:03 -0800)]
[flang] Allow labels on END statements.
F18 clause 5.3.3 explicitly allows labels on program unit END statements.
Label resolution code accounts for this for singleton program units,
but incorrectly generates an error for host subprograms with internal
subprograms.
subroutine s(n)
call s1(n)
if (n == 0) goto 88 ! incorrect error
print*, 's'
contains
subroutine s1(n)
if (n == 0) goto 77 ! ok
print*, 's1'
77 end subroutine s1
88 end
Label resolution code makes a sequential pass over an entire file to
collect label information for all subprograms, followed by a pass through
that information for semantics checks. The problem is that END statements
may be separated from prior subprogram code by internal subprogram
definitions, so an END label can be associated with the wrong subprogram.
There are several ways to fix this. Labels are always local to a
subprogram. So the two separate passes over the entire file could probably
instead be interleaved to perform analysis on a subprogram as soon as the
end of the subprogram is reached, using a small stack. The stack structure
would account for the "split" code case. This might work.
It is possible that there is some not otherwise apparent advantage to
the current full-file pass design. The parse tree has productions that
provide access to a subprogram END statement "in advance". An alternative
is to access this information to solve the problem. This PR implements
this latter option.
Differential revision: https://reviews.llvm.org/D91217
Jianzhou Zhao [Wed, 11 Nov 2020 06:13:06 +0000 (06:13 +0000)]
Add a flag to control whether to propagate labels from condition values to results
Before the change, DFSan always does the propagation. W/o
origin tracking, it is harder to understand such flows. After
the change, the flag is off by default.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D91234
Xiang Xiao [Wed, 11 Nov 2020 20:30:21 +0000 (15:30 -0500)]
[libcxx] Check _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE first in __locale
This is consistent with what's done in locale.cpp, and it ensures that
we get the default rune table whenever _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
is defined, regardless of the actual platform.
Differential Revision: https://reviews.llvm.org/D91074
Walter Erquinigo [Wed, 11 Nov 2020 20:28:45 +0000 (12:28 -0800)]
Fix
21555fff4de811309ea7935f9cb65578c957d77f
Buildbot failed on Windows
http://lab.llvm.org:8011/#/builders/83/builds/693
Error: On Windows, std::future can't hold an Expected, as it doesn't have a default
constructor.
Solution: Use std::future<bool> instead of std::future<Expected<T>>
David Blaikie [Wed, 11 Nov 2020 20:29:08 +0000 (12:29 -0800)]
Add missing override (& fix an else-after-return while I'm here)
peter klausler [Tue, 10 Nov 2020 23:10:48 +0000 (15:10 -0800)]
[flang] Use IMPLICIT from scope of external function reference
Implicitly typed references to external functions are applying
the IMPLICIT typing rules of the global scope in which their
symbols were created, not the IMPLICIT typing rules in force in
the scope from which they were referenced.
Differential revision: https://reviews.llvm.org/D91214
Mehdi Amini [Wed, 11 Nov 2020 20:00:21 +0000 (20:00 +0000)]
Revert "[clang][cli] Port ObjCMTAction to new option parsing system"
This reverts commit
09248a5d25bb1c9f357247fa3da8fbe4470e9c67.
Some builds are broken. I suspect a `static constexpr` in a class missing a
definition out of class (required pre-c++17).
Peyton, Jonathan L [Mon, 2 Nov 2020 21:46:29 +0000 (15:46 -0600)]
[OpenMP] Fix shutdown hang/race bug
The deadlock/race happens when primary thread gets initz lock and tries to join
the worker thread which waits for the same lock in TLS key destructor.
The patch removes the lock and the code of setting TLS value which needed
the lock. Also removed setting TLS from __kmp_unregister_root_current_thread.
Differential Revision: https://reviews.llvm.org/D90647
Sam McCall [Wed, 11 Nov 2020 19:45:58 +0000 (20:45 +0100)]
[clangd] Fix serialization error check.
David Green [Wed, 11 Nov 2020 19:42:12 +0000 (19:42 +0000)]
[AArch4] Regenerate test checks for f16-imm.ll. NFC
peter klausler [Tue, 10 Nov 2020 23:07:53 +0000 (15:07 -0800)]
[flang] Add isnan() extension intrinsic function, with folding
It's nonstandard, but commonly implemented.
Differential revision: https://reviews.llvm.org/D91213
Pavel Iliin [Wed, 11 Nov 2020 19:08:46 +0000 (19:08 +0000)]
[NFC] [Legalize] Fix spaces and style.
Mehdi Amini [Wed, 11 Nov 2020 05:33:47 +0000 (05:33 +0000)]
Disable implicit nesting on parsing textual pass pipeline
Previous the textual form of the pass pipeline would implicitly nest,
instead we opt for the explicit form here: this has less surprise.
This also avoids asserting in the bindings when passing a pass pipeline
with incorrect nesting.
Differential Revision: https://reviews.llvm.org/D91233