Teresa Johnson [Mon, 2 Nov 2020 17:05:11 +0000 (09:05 -0800)]
[test] Fix unused FileCheck prefix in ThinLTO test
Add intended and missing prefix check.
Shoaib Meenai [Sat, 31 Oct 2020 00:43:41 +0000 (17:43 -0700)]
[clangd] Account for vendor in version string
The vendor will be prefixed to the "clangd" and can be an arbitrary
string, so account for it in the test.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D90517
Shoaib Meenai [Sat, 31 Oct 2020 00:42:09 +0000 (17:42 -0700)]
[clang] Limit scope of CLANG_VENDOR definition
It's only used by Version.cpp, so limit the definition to just that one
file instead of making all of Clang recompile if you change CLANG_VENDOR.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D90516
Teresa Johnson [Fri, 30 Oct 2020 15:03:35 +0000 (08:03 -0700)]
[MemProf] Reenable test with fix for bot failures
The issue was unexpected macro expansion when the bot's test output
directory contained a token matching a build system macro (e.g.
"linux"). Switch to using a hardcoded path, which is invalid but is
sufficient for ensuring that the path is passed down to the runtime.
Differential Revision: https://reviews.llvm.org/D90466
Louis Dionne [Mon, 2 Nov 2020 16:58:01 +0000 (11:58 -0500)]
[libc++][CI] Allow retries in case an agent is lost
We see this fairly often on our Linux bots, which appear to be killed
by GCE from time to time.
Pedro Tammela [Sun, 1 Nov 2020 18:02:30 +0000 (18:02 +0000)]
[LLDB/Lua] call lua_close() on Lua dtor
This patch calls `lua_close()` on Lua dtor.
This guarantees that the Lua GC finalizers are honored, aside from the
usual internal clean up.
It also guarantees a call to the `__close` metamethod of any active
to-be-closed variable in Lua 5.4.
Since the previous `luaL_openlibs()` was a noop, because the standard
library is cached internally, I've removed it.
Differential Revision: https://reviews.llvm.org/D90557
Mircea Trofin [Mon, 2 Nov 2020 16:50:34 +0000 (08:50 -0800)]
[FileCheck] Fix comments and eof in allow-unused-prefixes.txt
Momchil Velikov [Mon, 2 Nov 2020 16:26:10 +0000 (16:26 +0000)]
[ARM][MachineOutliner] Do not overestimate LR liveness in return block
The `LiveRegUnits` utility (as well as `LivePhysRegs`) considers
callee-saved registers to be alive at the point after the return
instruction in a block. In the ARM backend, the `LR` register is
classified as callee-saved, which is not really correct (from an ARM
eABI or just common sense point of view). These two conditions cause
the `MachineOutliner` to overestimate the liveness of `LR`, which
results in unnecessary saves/restores of `LR` around calls to outlined
sequences. It also causes the `MachineVerifer` to crash in some
cases, because the save instruction reads a dead `LR`, for example
when the following program:
int h(int, int);
int f(int a, int b, int c, int d) {
a = h(a + 1, b - 1);
b = b + c;
return 1 + (2 * a + b) * (c - d) / (a - b) * (c + d);
}
int g(int a, int b, int c, int d) {
a = h(a - 1, b + 1);
b = b + c;
return 2 + (2 * a + b) * (c - d) / (a - b) * (c + d);
}
is compiled with `-target arm-eabi -march=armv7-m -Oz`.
This patch computes the liveness of `LR` in return blocks only, while
taking into account the few ARM instructions, which read `LR`, but
nevertheless the register is not mentioned (explicitly or implicitly)
in the instruction operands.
Differential Revision: https://reviews.llvm.org/D89189
Fangrui Song [Mon, 2 Nov 2020 16:37:15 +0000 (08:37 -0800)]
[ELF] --emit-relocs: fix st_value of STT_SECTION in the presence of a gap before the first input section
In the presence of a gap, the st_value field of a STT_SECTION symbol is the
address of the first input section (incorrect if there is a gap). Set it to the
output section address instead.
In -r mode, this bug can cause an incorrect non-zero st_value of a STT_SECTION
symbol (while output sections have zero addresses, input sections may have
non-zero outSecOff). The non-zero st_value can cause the final link to have
incorrect relocation computation (both GNU ld and LLD add st_value of the
STT_SECTION symbol to the output section address).
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D90520
Louis Dionne [Mon, 2 Nov 2020 16:35:21 +0000 (11:35 -0500)]
[libc++] NFC: Re-generate the ABI lists with the new script
The new script keeps the results sorted, which is why the ABI lists appear
to have changed so much. However, this commit makes no actual ABI change.
Louis Dionne [Wed, 30 Sep 2020 20:30:04 +0000 (16:30 -0400)]
[libc++] Make it easier to re-generate the ABI lists
Instead of having to remember the command-line to use every time, this
commit adds a CMake target to generate the ABI list in the current
configuration, if it is supported.
As a fly-by change, remove scripts that are now unused (sym_match.py
and sym_extract.py).
Frederik Gossen [Mon, 2 Nov 2020 16:13:15 +0000 (16:13 +0000)]
Revert "[MLIR] Support walks over regions and blocks"
This reverts commit
dbae3d50f114a8ec0a7c3211e3b1b9fb6ef22dbd.
Cannot build with gcc/g++ 7.5.0.
Frederik Gossen [Mon, 2 Nov 2020 16:10:59 +0000 (16:10 +0000)]
Revert "[MLIR] Use `llvm::is_one_of` in walk templates"
This reverts commit
56299b1e58bf3720dff2fe60163739ee1554a371.
Cannot build with gcc/g++ 7.5.0.
Fangrui Song [Mon, 2 Nov 2020 16:16:43 +0000 (08:16 -0800)]
[Debugify] Port -debugify-each to NewPM
Preemptively switch 2 tests to the new PM
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D90365
Louis Dionne [Mon, 2 Nov 2020 16:07:10 +0000 (11:07 -0500)]
[libc++/libc++abi] Use Python3_EXECUTABLE consistently to run utilities
Nico Weber [Mon, 2 Nov 2020 15:49:54 +0000 (10:49 -0500)]
[gn build] Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Mon, 2 Nov 2020 15:43:38 +0000 (10:43 -0500)]
[gn build] (manually) port
c6eaa14e11
Kirstóf Umann [Mon, 2 Nov 2020 15:37:59 +0000 (16:37 +0100)]
[analyzer][ReturnPtrRangeChecker] Fix a false positive on end() iterator
ReturnPtrRange checker emits a report if a function returns a pointer which
points out of the buffer. However, end() iterator of containers is always such
a pointer, so this always results a false positive report. This false positive
case is now eliminated.
This patch resolves these tickets:
https://bugs.llvm.org/show_bug.cgi?id=20929
https://bugs.llvm.org/show_bug.cgi?id=25226
https://bugs.llvm.org/show_bug.cgi?id=27701
Patch by Tibor Brunner!
Differential Revision: https://reviews.llvm.org/D83678
Florian Hahn [Mon, 2 Nov 2020 12:40:34 +0000 (12:40 +0000)]
Reland "[TTI] Add VecPred argument to getCmpSelInstrCost."
This reverts the revert commit
408c4408facc3a79ee4ff7e9983cc972f797e176.
This version of the patch includes a fix for a crash caused by
treating ICmp/FCmp constant expressions as instructions.
Original message:
On some targets, like AArch64, vector selects can be efficiently lowered
if the vector condition is a compare with a supported predicate.
This patch adds a new argument to getCmpSelInstrCost, to indicate the
predicate of the feeding select condition. Note that it is not
sufficient to use the context instruction when querying the cost of a
vector select starting from a scalar one, because the condition of the
vector select could be composed of compares with different predicates.
This change greatly improves modeling the costs of certain
compare/select patterns on AArch64.
I am also planning on putting up patches to make use of the new argument in
SLPVectorizer & LV.
Louis Dionne [Mon, 2 Nov 2020 15:30:29 +0000 (10:30 -0500)]
[libc++] Split off iostreams explicit instantiations into its own source file
This makes it cleaner to add more instantiations without cluttering the
actual implementation of ios.
Pavel Labath [Mon, 2 Nov 2020 15:11:47 +0000 (16:11 +0100)]
[lldb] Generalize an deflake gdb-remote *client* tests
This is similar in spirit to what D90313 did for server tests.
Nico Weber [Mon, 2 Nov 2020 15:29:13 +0000 (10:29 -0500)]
Revert "Add a new altera kernel name restriction check to clang-tidy."
This reverts commit
43a38a65233039b5e71797a644d41a890f8d7f2b,
and follow-up
5a7bc5e2595903e51f0b31e3faf82024e965c962.
The commit breaks check-clang-tools, the test added in the change
does not pass.
Matt Arsenault [Sat, 17 Oct 2020 18:28:52 +0000 (14:28 -0400)]
AMDGPU: Reorder checks
Louis Dionne [Fri, 30 Oct 2020 21:33:02 +0000 (17:33 -0400)]
[libc++abi] Get rid of warnings when running the tests with GCC
Aaron Ballman [Mon, 2 Nov 2020 15:18:47 +0000 (10:18 -0500)]
Fix link to a new check within the release notes.
Nico Weber [Mon, 2 Nov 2020 15:14:52 +0000 (10:14 -0500)]
[gn build] (manually) port
76a168bce01 better
Matt Arsenault [Tue, 20 Oct 2020 17:05:38 +0000 (13:05 -0400)]
RegisterCoalescer: Use Register
Frank Derry Wanye [Mon, 2 Nov 2020 15:11:38 +0000 (10:11 -0500)]
Add a new altera kernel name restriction check to clang-tidy.
The altera kernel name restriction check finds kernel files and include
directives whose filename is "kernel.cl", "Verilog.cl", or "VHDL.cl".
Such kernel file names cause the Altera Offline Compiler to generate
intermediate design files that have the same names as certain internal
files, which leads to a compilation error.
As per the "Guidelines for Naming the Kernel" section in the "Intel FPGA
SDK for OpenCL Pro Edition: Programming Guide."
Dávid Bolvanský [Mon, 2 Nov 2020 15:01:51 +0000 (16:01 +0100)]
[SLP] Added testcase for PR47623
Pavel Labath [Mon, 2 Nov 2020 10:35:13 +0000 (11:35 +0100)]
[lldb/test] Fix a fragile assumption in TestTypeGetModule
the binary can contain more than three compile units if the compiler
support files (crtbegin/end, etc.) come with their own debug info.
Evgeny Leviant [Mon, 2 Nov 2020 14:39:04 +0000 (17:39 +0300)]
[TableGen][SchedModels] Fix read/write variant substitution
Patch fixes case when sched class has write and read variants belonging
to different processor models.
Differential revision: https://reviews.llvm.org/D89777
Ben Dunbobbin [Mon, 2 Nov 2020 14:09:53 +0000 (14:09 +0000)]
[PS4] Support dllimport/export attributes
For PS4 development we support dllimport/export annotations in
source code. This patch enables the dllimport/export attributes
on PS4 by adding a new function to query the triple for whether
dllimport/export are used and using that function to decide
whether these attributes are supported. This replaces the current
method of checking if the target is Windows.
This means we can drop the use of "TargetArch" in the .td file
(which is an improvement as dllimport/export support isn't really
a function of the architecture).
I have included a simple codgen test to show that the attributes
are accepted and have an effect on codegen for PS4. I have also
enabled the DLLExportStaticLocal and DLLImportStaticLocal
attributes, which we support downstream. However, I am unable to
write a test for these attributes until other patches for PS4
dllimport/export handling land upstream. Whilst writing this
patch I noticed that, as these attributes are internal, they do
not need to be target specific (when these attributes are added
internally in Clang the target specific checks have already been
run); however, I think leaving them target specific is fine
because it isn't harmful and they "really are" target specific
even if that has no functional impact.
Differential Revision: https://reviews.llvm.org/D90442
Nico Weber [Mon, 2 Nov 2020 14:22:06 +0000 (09:22 -0500)]
[gn build] (manually) port
76a168bce01
Clement Courbet [Mon, 2 Nov 2020 14:10:41 +0000 (15:10 +0100)]
Revert "[llvm-exegesis] Save target state before running the benchmark."
_fxsave64 is not available on some buildbots.
This reverts commit
274de447fe9621082a523a7227157aeb84702a7d.
Caroline Concatto [Tue, 27 Oct 2020 12:26:47 +0000 (12:26 +0000)]
[Flang][Driver] Add PrintPreprocessedInput FrontendAction (`flang-new -E`)
This patch implements the first frontend action for the Flang parser (i.e.
Fortran::parser). This action runs the preprocessor and is invoked with the
`-E` flag. (i.e. `flang-new -E <input-file>). The generated output is printed
to either stdout or the output file (specified with `-` or `-o <output-file>`).
Note that currently there is no mechanism to map options for the
frontend driver (i.e. Fortran::frontend::FrontendOptions) to options for
the parser (i.e. Fortran::parser::Options). Instead,
Frotran::parser::options are hard-coded to:
```
std::vector<std::string> searchDirectories{"."s};
searchDirectories = searchDirectories;
isFixedForm = false;
_encoding(Fortran::parser::Encoding::UTF_8);
```
These default settings are compatible with the current Flang driver. Further
work is required in order for CompilerInvocation to read and map
clang::driver::options to Fortran::parser::options.
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Differential Revision: https://reviews.llvm.org/D88381
Clement Courbet [Mon, 2 Nov 2020 08:15:17 +0000 (09:15 +0100)]
[llvm-exegesis] Save target state before running the benchmark.
Some benchmarked instructions might set target state. Preserve this
state. See PR26418.
Differential Revision: https://reviews.llvm.org/D90592
Jay Foad [Mon, 2 Nov 2020 14:01:33 +0000 (14:01 +0000)]
Revert "Fix ds_read2/write2 unaligned offsets"
This reverts commit
2e7e898c8f0b38dc11fbce2553fc715067aaf42f.
It was committed by mistake.
Jay Foad [Mon, 2 Nov 2020 13:05:15 +0000 (13:05 +0000)]
Fix ds_read2/write2 unaligned offsets
Jay Foad [Mon, 2 Nov 2020 13:47:44 +0000 (13:47 +0000)]
[AMDGPU] Precommit ds_read2/write2 with unaligned offset tests. NFC.
Jay Foad [Mon, 2 Nov 2020 12:50:16 +0000 (12:50 +0000)]
[AMDGPU] Generate test checks. NFC.
Jay Foad [Mon, 2 Nov 2020 12:52:32 +0000 (12:52 +0000)]
[AMDGPU] Remove a comment. NFC.
This was obsoleted by
f78687df9b7 which added gfx9 aligned/unaligned
tests.
David Sanders [Mon, 2 Nov 2020 13:38:20 +0000 (08:38 -0500)]
Use --use-color in run-clang-tidy.py
Now that clang-tidy supports the --use-color command line option, it's
a better user experience to use --use-color in run-clang-tidy.py and
preserving the colored output.
Louis Dionne [Mon, 2 Nov 2020 13:25:16 +0000 (08:25 -0500)]
[libc++] NFC: Remove warning about non-void function returning void
Simon Pilgrim [Mon, 2 Nov 2020 11:57:37 +0000 (11:57 +0000)]
[LV][X86] Regenerate gather_scatter tests. NFCI.
Reduce diff in D90554
Simon Pilgrim [Mon, 2 Nov 2020 11:40:40 +0000 (11:40 +0000)]
[SLP][X86] Add AVX512VL test target coverage for PR47629
As suggested on D90445 - the AVX512F test case alone won't handle 128/256-bit vector gather pattern very well
Simon Pilgrim [Mon, 2 Nov 2020 11:30:39 +0000 (11:30 +0000)]
[RISCV] Avoid std::pair<> in FPReg StringSwitch to avoid MSVC compile failures. NFCI.
As discussed on D90322, some MSVC builds are failing with is_trivially_copyable static asserts (see D86126) - we can avoid this by not using the std::pair<unsigned,unsigned> which held both the FP+DP Registers, just handle the FP register and convert to DP on the fly.
Andrzej Warzynski [Wed, 28 Oct 2020 10:47:48 +0000 (10:47 +0000)]
[flang][driver] Rename the accessors/mutators (NFC)
As per point 3 in [1]:
```
Accessor member functions are named with the non-public data member's
name, less the trailing underscore. Mutator member functions are named
set_...
```
Originally we just followed the LLVM's style, which is incompatible with
Flang. This patch renames the accessors and mutators accordingly.
`getDiagnostics` and `GetDiagnostics` are replaced with one accessor:
`diagnostics`. `SetDiagnostics` was neither implemented nor used, so
it's deleted.
[1] https://github.com/llvm/llvm-project/blob/master/flang/docs/C++style.md#naming
Differential Revision: https://reviews.llvm.org/D90300
Kadir Cetinkaya [Thu, 29 Oct 2020 15:04:53 +0000 (16:04 +0100)]
[clangd] Value initialize SymbolIDs
We were default initializing SymbolIDs before, which would leave
indeterminate values in underlying std::array.
This patch updates the underlying data initalization to be value-init and adds a
way to check for validness of a SymbolID.
Differential Revision: https://reviews.llvm.org/D90397
Andrzej Warzynski [Mon, 2 Nov 2020 09:34:27 +0000 (09:34 +0000)]
[flang][driver] Use --match-full-lines in tests for `-test-io`
Use `--match-full-lines` to make sure that FileCheck doesn't match the
output against the `CHECK` lines (which, like other comments, are also
printed).
More specifically, we want to make sure that the following `check` in the
input file:
```
! CHECK: <some-fortran-input>
```
is matched by FileCheck with `<some-fortran-input>` in the generated
output. Without `--match-full-lines`, that check-line will be matched
with `!CHECK: <some-fortran-input>` instead (which is also
printed together with other contents of the file).
Adding `--match-full-lines` makes the tests stricter and this change
revealed that some `check`s were passing only because that flag was
missing. These are updated accordingly.
Reviewed By: CarolineConcatto, sameeranjoshi
Differential Revision: https://reviews.llvm.org/D90306
Kirill Bobyrev [Mon, 2 Nov 2020 09:55:17 +0000 (10:55 +0100)]
[clangd] Improve remote-index test
Introduce a separate thread that will kill `clangd-index-server` after 10 seconds regardless. This helps shut down the test if the server hangs and `stderr.readline()` does not contain inititalizatiton message. It prevents "necessary" waiting delay for the server warm-up and only introduces additional delay if the test fails.
It also makes use of `subprocess.Popen.kill()` which is a portable way of handling process shutdown and avoids using signals.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D90590
Clement Courbet [Fri, 30 Oct 2020 10:35:47 +0000 (11:35 +0100)]
[llvm-exegesis] Print signal name when the snippet crashed.
Differential Revision: https://reviews.llvm.org/D90453
Georgii Rymar [Fri, 30 Oct 2020 07:58:13 +0000 (10:58 +0300)]
[yaml2obj] - Add support of Offset for .strtab/.shstrtab/.dynstr sections.
These sections are implicit and handled a bit differently.
Currently the "Offset" is ignored for them.
This patch fixes an issue.
Differential revision: https://reviews.llvm.org/D90446
Caroline Concatto [Mon, 2 Nov 2020 08:15:50 +0000 (08:15 +0000)]
Revert "[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register."
This reverts commit
8b281bfaf35d00d42c2993fd5a80d749cc21f45e.
Caroline Concatto [Fri, 23 Oct 2020 09:37:08 +0000 (10:37 +0100)]
[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register.
Only the aliases 'xzr' and 'sp' exist for the physical register x31.
The reason for wanting to remove the alias 'x31' is because it allows users
to write invalid asm that is not accepted by the GNU assembler.
Is there any objection to removing this alias? Or do we want to keep
this for compatibility with existing code that uses w31/x31?
Differential Revision: https://reviews.llvm.org/D90153
Kirill Bobyrev [Mon, 2 Nov 2020 07:38:05 +0000 (08:38 +0100)]
[clangd] Add lit tests for remote index
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D90291
Ilya Golovenko [Mon, 2 Nov 2020 07:25:45 +0000 (08:25 +0100)]
[clangd] Fix ParsedASTTest.TopLevelDecls test.
Google test matcher `DeclKind` uses `NamedDecl::getDeclKindName()` to compare its result with expected declaration name.
Both, returned value of this function and the expected kind name argument have type `const char *`, so this matcher effectively
compares two pointers instead of the respective strings.
The test was passing on most platforms because compilers mostly were able to coalesce these string literals.
Patch By: Ilya Golovenko
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D90384
Wang, Pengfei [Mon, 2 Nov 2020 06:30:40 +0000 (14:30 +0800)]
[CodeGen][X86] Remove unused check-prefix in strict FP tests.
Craig Topper [Mon, 2 Nov 2020 06:12:20 +0000 (22:12 -0800)]
[RISCV] Add a test case for another issue in SelectRORIW. NFC
When validating C3 in (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1)), i32)
we are truncating it to 32 bits before checking its value. We need
to check all 64 bits.
Qiu Chaofan [Mon, 2 Nov 2020 06:29:43 +0000 (14:29 +0800)]
[PowerPC] Fix a crash in POWER 9 setb peephole
Variable InnerIsSel references FalseRes, while FalseRes might be
zext/sext. So InnerIsSel should reference SetOrSelCC, otherwise a crash
will happen.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D90142
Jim Lin [Mon, 2 Nov 2020 02:58:07 +0000 (10:58 +0800)]
[compiler-rt][NFC] Fix typo in comment
Craig Topper [Mon, 2 Nov 2020 04:24:09 +0000 (20:24 -0800)]
[RISCV] Add a test case to show a bug in SelectRORIW. NFC
The function is matching (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1))),
with appropriate checks for the constants to be a rotate. But it
fails to check that X and Y are the same which is also necessary.
Craig Topper [Sun, 1 Nov 2020 20:40:31 +0000 (12:40 -0800)]
[RISCV] Add more rev32 and rev16 test cases using fshl/fshr intrinsics. NFC
fshl/fshr intrinsics turn into rotl/rotr ISD opcodes and we don't
have a complete set of patterns.
We pattern match rotl, but we have a custom match for rori that gets
priority. We don't pattern match rotr and we don't have patterns
or custom code for rori from rotr.
Wang, Pengfei [Mon, 2 Nov 2020 03:38:46 +0000 (11:38 +0800)]
[CodeGen][X86] Remove unused check-prefix in adx tests.
Not needed after
226261353288e.
Stella Laurenzo [Mon, 2 Nov 2020 03:23:44 +0000 (19:23 -0800)]
NFC: Wrap lines in Python.md.
Teresa Johnson [Mon, 2 Nov 2020 03:06:50 +0000 (19:06 -0800)]
[MemProf] Fix test failure on windows
Fix failure in new test from
0949f96dc6521be80ebb8ebc1e1c506165c22aac:
Don't match exact file path separator.
Should fix:
http://lab.llvm.org:8011/#/builders/119/builds/437/steps/9/logs/FAIL__Clang__memory-profile-filename_c
Stella Laurenzo [Sun, 1 Nov 2020 06:40:25 +0000 (23:40 -0700)]
[mlir][Python] Context managers for Context, InsertionPoint, Location.
* Finishes support for Context, InsertionPoint and Location to be carried by the thread using context managers.
* Introduces type casters and utilities so that DefaultPyMlirContext and DefaultPyLocation in method signatures does the right thing (allows explicit or gets from the thread context).
* Extend the rules for the thread context stack to handle nesting, appropriately inheriting and clearing depending on whether the context is the same.
* Refactors all method signatures to follow the new convention on trailing parameters for defaulting parameters (loc, ip, context). When the objects are carried in the thread context, this allows most explicit uses of these values to be elided.
* Removes the style guide section on putting accessors to construct global objects on the PyMlirContext: this style fails to make good use of the new facility since it is often the only thing remaining needing an MlirContext.
* Moves Module parse/creation from mlir.ir.Context to static methods on mlir.ir.Module.
* Moves Context.create_operation to a static Operation.create method.
* Moves Type parsing from mlir.ir.Context to static methods on mlir.ir.Type.
* Moves Attribute parsing from mlir.ir.Context to static methods on mlir.ir.Attribute.
* Move Location factory methods from mlir.ir.Context to static methods on mlir.ir.Location.
* Refactors the std dialect fake "ODS" generated code to take advantage of the new scheme.
Differential Revision: https://reviews.llvm.org/D90547
Nico Weber [Mon, 2 Nov 2020 02:34:51 +0000 (21:34 -0500)]
[libcxx] Fix regression where `ninja all` doesn't copy libcxx headers
Before
6db314e86b2674, when running cmake with clang, libcxx, and
compiler-rt enabled, building `ninja all` would run the
generate-cxx-headers target, due to the sanitizers depending on it.
After
6db314e86b2674, if LIBCXX_ENABLE_SHARED and LIBCXX_ENABLE_STATIC
and LIBCXX_INCLUDE_TESTS and LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY are
disabled (https://reviews.llvm.org/D82702#2153627), `ninja all`
no longer copies the libcxx headers, which means clang can't compile
programs like `#include <string>` on macOS.
Explicitly add the copy target to the all target to restore the old
behavior.
Chen Zheng [Mon, 2 Nov 2020 01:55:05 +0000 (20:55 -0500)]
[MachineSink] sink more profitable loads
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D86864
QingShan Zhang [Mon, 2 Nov 2020 02:06:14 +0000 (02:06 +0000)]
[Scheduling] Fall back to the fast cluster algorithm if the DAG is too complex
We have added a new load/store cluster algorithm in D85517. However, AArch64 see
some compiling deg with the new algorithm as the IsReachable() is not cheap if
the DAG is complex. O(M+N) See https://bugs.llvm.org/show_bug.cgi?id=47966
So, this patch added a heuristic to switch to old cluster algorithm if the DAG is too complex.
Reviewed By: Owen Anderson
Differential Revision: https://reviews.llvm.org/D90144
Teresa Johnson [Tue, 29 Sep 2020 22:53:41 +0000 (15:53 -0700)]
[MemProf] Pass down memory profile name with optional path from clang
Similar to -fprofile-generate=, add -fmemory-profile= which takes a
directory path. This is passed down to LLVM via a new module flag
metadata. LLVM in turn provides this name to the runtime via the new
__memprof_profile_filename variable.
Additionally, always pass a default filename (in $cwd if a directory
name is not specified vi the = form of the option). This is also
consistent with the behavior of the PGO instrumentation. Since the
memory profiles will generally be fairly large, it doesn't make sense to
dump them to stderr. Also, importantly, the memory profiles will
eventually be dumped in a compact binary format, which is another reason
why it does not make sense to send these to stderr by default.
Change the existing memprof tests to specify log_path=stderr when that
was being relied on.
Depends on D89086.
Differential Revision: https://reviews.llvm.org/D89087
Nikita Popov [Sun, 1 Nov 2020 12:42:39 +0000 (13:42 +0100)]
[SCEV] Delay strengthening of nowrap flags
Strengthening nowrap flags is relatively expensive. Make sure we
only do it if we're actually going to use the flags -- we don't
use them for many recursive invocations. Additionally, if we're
reusing an existing SCEV node, there's no point in trying to
strengthen the flags if we don't have any new baseline facts.
This change falls slightly short of being NFC, because the way
flags during add+addrec / mul+addrec folding are handled may be
more precise (as less operands are included in the calculation).
Craig Topper [Sun, 1 Nov 2020 20:10:47 +0000 (12:10 -0800)]
[RISCV] Add tests to show missed opportunities to use rori for fshr intrinsic with same inputs. NFC
The fshr intrinsic with same inputs produces rotr ISD node. The
fshl intrinsic produces rotl ISD node.
There were only test cases and isel patterns for the fshl/rotl case.
This patch adds fshr/rotr test cases.
Craig Topper [Sun, 1 Nov 2020 18:31:59 +0000 (10:31 -0800)]
Recommit "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseInfo.h. NFCI"
This reverts
781917254dba17df7fb357a5f621ada2ac1b36e3 and recommits
781917254dba17df7fb357a5f621ada2ac1b36e3.
I've changed getRegForInlineAsmConstraint to not use a std::pair
of Register in a previous commit. Hopefully that fixes the reported
issue with expensive checks on Windows. I'm still not sure exactly
why this commit removing an include affected a different file.
Original message:
RISCVRegisterInfo.h is part of the CodeGen layer. The Utils library
is intended to be shared with the MC layer so shouldn't use files
from the CodeGen layer.
The register enum names are already available from
RISCVMCTargetDesc.h. It appears what was coming from this include
was a transitive include of the Register class which I've replaced
with MCRegister. Register has a constructor from MCRegister so it
should be convertible.
Craig Topper [Sun, 1 Nov 2020 18:16:50 +0000 (10:16 -0800)]
[RISCV] Use 'unsigned' instead of Register in getRegForInlineAsmConstraint. NFC
The return value of this interface still uses an 'unsigned' on all
targets. So we convert Register back to unsigned at the end.
I'm hoping this will prevent the issue that caused the revert of
D90322.
Nikita Popov [Sun, 1 Nov 2020 17:34:01 +0000 (18:34 +0100)]
[SCEV] Construct GEP expression more efficiently (NFCI)
Instead of performing a sequence of pairwise additions, directly
construct a multi-operand add expression.
This should be NFC modulo any SCEV canonicalization deficiencies.
Florian Hahn [Sat, 3 Oct 2020 20:05:39 +0000 (21:05 +0100)]
[VPlan] Assert no users remaining when deleting a VPValue.
When deleting a VPValue, all users must already by deleted. Add an
assertion to make sure and catch violations.
David Green [Sun, 1 Nov 2020 16:24:23 +0000 (16:24 +0000)]
[ARM] Add extra MVE tests for various patches. NFC
Qiu Chaofan [Sun, 1 Nov 2020 15:22:47 +0000 (23:22 +0800)]
[PowerPC] Avoid unnecessary fadd for unsigned to ppcf128
Unsigned 32-bit or shorter integer to ppcf128 conversion are currently
expanded as signed-to-double with an extra fadd to 'complement'. But on
PowerPC we have native instruction to directly convert unsigned to
double since ISA v2.06. This patch exploits it.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D89786
Nathan James [Sun, 1 Nov 2020 14:37:06 +0000 (14:37 +0000)]
[NFC][lldb] Silence unused variable warning
Ilya Bukonkin [Sun, 1 Nov 2020 10:53:06 +0000 (13:53 +0300)]
[lldb] TestTypeGetModule.py review improvements
Christudasan Devadasan [Sun, 1 Nov 2020 07:41:14 +0000 (13:11 +0530)]
[AMDGPU] Some refactoring after D90404. NFC.
Christudasan Devadasan [Thu, 29 Oct 2020 15:06:14 +0000 (20:36 +0530)]
[AMDGPU] Add alignment check for v3 to v4 load type promotion
It should be enabled only when the load alignment is at least 8-byte.
Fixes: SWDEV-256824
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D90404
Fangrui Song [Sun, 1 Nov 2020 06:29:57 +0000 (22:29 -0800)]
[test] Fix some unused check prefixes in test/Analysis/CostModel/X86
Fangrui Song [Sun, 1 Nov 2020 04:46:45 +0000 (20:46 -0800)]
[test] Fix unused check prefixes in test/AST
Fangrui Song [Sun, 1 Nov 2020 04:33:46 +0000 (20:33 -0800)]
[test] Clean up test/Frontend/gnu-mcount.c and fix unused check prefixes
Sam Clegg [Sat, 31 Oct 2020 23:39:27 +0000 (16:39 -0700)]
[lld][WebAssembly] Remove bad-reloc test
This test was checking behaviour that only exists in the debug
configuration so will fail in release builds.
Perhaps there is way to keep this test around and only run
it in debug builds but for now I'm removing so fix the
release builders.
Differential Revision: https://reviews.llvm.org/D90542
Ayke van Laethem [Sun, 23 Aug 2020 12:17:29 +0000 (14:17 +0200)]
[AVR] Improve inline rotate/shift expansions
These expansions were rather inefficient and were done with more code
than necessary. This change optimizes them to use expansions more
similar to GCC. The code size is the same (when optimizing for code
size) but somehow LLVM reorders blocks in a non-optimal way. Still, this
should be an improvement with a reduction in code size of around 0.12%
(when building compiler-rt).
Differential Revision: https://reviews.llvm.org/D86418
River Riddle [Sat, 31 Oct 2020 21:21:49 +0000 (14:21 -0700)]
[mlir][AsmPrinter] Fix crash in windows build after D89354
Switch to an index based loop instead of using enumerate.
Florian Hahn [Sat, 31 Oct 2020 19:30:19 +0000 (19:30 +0000)]
[DSE] Use same logic as legacy impl to check if free kills a location.
This patch updates DSE + MemorySSA to use the same check as the legacy
implementation to determine if a location is killed by a free call.
This changes the existing behavior so that a free does not kill
locations before the start of the freed pointer.
This should fix PR48036.
Florian Hahn [Sat, 31 Oct 2020 19:35:37 +0000 (19:35 +0000)]
[DSE] Add additional tests with free, regenerate check lines.
The new test cases are inspired by PR48036.
Reid Kleckner [Sat, 31 Oct 2020 18:19:28 +0000 (11:19 -0700)]
Fix lld/wasm test portability issue, and XFAIL the test
I don't see any warnings from lld.wasm locally. Needs more
investigation.
Reid Kleckner [Sat, 31 Oct 2020 18:08:58 +0000 (11:08 -0700)]
[COFF] Move ghash timers under the "add objects" timer
I had envisioned the ghash step as a big up front step, but as currently
written, the timers are nested, and we are notionally adding types from
objects, so we might as well arrange the timers this way.
Simon Pilgrim [Sat, 31 Oct 2020 17:32:04 +0000 (17:32 +0000)]
Add missing EOL. NFCI.
Kostya Kortchinsky [Fri, 30 Oct 2020 17:42:28 +0000 (10:42 -0700)]
[GWP-ASan] Fuchsia specific mapping & utilities functions
This CL introduces the Fuchsia versions of the existing platform
specific functions.
For Fuchsia, we need to track the VMAR (https://fuchsia.dev/fuchsia-src/reference/kernel_objects/vm_address_region)
of the Guarded Pool mapping, and for this purpose I added some platform
specific data structure that remains empty on POSIX platforms.
`getThreadID` is not super useful for Fuchsia so it's just left as a
stub for now.
While testing the changes in my Fuchsia tree, I realized that
`guarded_pool_allocator_tls.h` should have closed the namespace before
including `GWP_ASAN_PLATFORM_TLS_HEADER`, otherwise drama ensues.
This was tested in g3, upstream LLVM, and Fuchsia (with local changes).
Differential Revision: https://reviews.llvm.org/D90483
Florian Hahn [Sat, 31 Oct 2020 10:51:19 +0000 (10:51 +0000)]
Reland "[SLP] Consider alternatives for cost of select instructions."
This reverts the revert commit
a1b53db32418cb6ed6f5b2054d15a22b5aa3aeb9.
This patch includes a fix for a reported issue, caused by
matchSelectPattern returning UMIN for selects of pointers in
some cases by looking to some connected casts.
For now, ensure integer instrinsics are only returned for selects of
ints or int vectors.
Mark de Wever [Sat, 31 Oct 2020 12:07:06 +0000 (13:07 +0100)]
[Sema] Diagnose annotating `if constexpr` with a likelihood attribute
Adds a diagnostic when the user annotates an `if constexpr` with a
likelihood attribute. The `if constexpr` statement is evaluated at compile
time so the attribute has no effect. Annotating the accompanied `else`
with a likelihood attribute has the same effect as annotating a generic
statement. Since the attribute there is most likely not intended, a
diagnostic will be issued. Since the attributes can't conflict, the
"conflict" won't be diagnosed for an `if constexpr`.
Differential Revision: https://reviews.llvm.org/D90336
Mark de Wever [Sat, 31 Oct 2020 12:07:06 +0000 (13:07 +0100)]
[CodeGen] Implement [[likely]] and [[unlikely]] for while and for loop.
The attribute has no effect on a do statement since the path of execution
will always include its substatement.
It adds a diagnostic when the attribute is used on an infinite while loop
since the codegen omits the branch here. Since the likelihood attributes
have no effect on a do statement no diagnostic will be issued for
do [[unlikely]] {...} while(0);
Differential Revision: https://reviews.llvm.org/D89899
Paul C. Anagnostopoulos [Fri, 30 Oct 2020 20:09:41 +0000 (16:09 -0400)]
[TableGen] Eliminate uses of true and false in .td files.
They occurred in one NVPTX file and some test files.
Differential Revision: https://reviews.llvm.org/D90513
David Sanders [Sat, 31 Oct 2020 14:36:42 +0000 (10:36 -0400)]
Use ANSI escape codes for --use-color on Windows
On Windows the --use-color option cannot be used for its originally
intended purpose of forcing color when piping stdout, since Windows
does not use ANSI escape codes by default. This change turns on ANSI
escape codes on Windows when forcing color to a non-displayed stdout
(e.g. piped).
David Green [Sat, 31 Oct 2020 13:10:14 +0000 (13:10 +0000)]
[ARM] Fix crash for gather of pointer costs.
If the elt size is unknown due to it being a pointer, a comparison
against 0 will cause an assert. Make sure the elt size is large enough
before comparing and for the moment just return the scalar cost.