Nicolai Hähnle [Fri, 21 Aug 2020 21:19:36 +0000 (23:19 +0200)]
Fix two bugs in TGParser::ParseValue
TGParser::ParseValue contains two recursive calls, one to parse the RHS of a list paste operator and one to parse the RHS of a paste operator in a class/def name. Both of these calls neglect to check the return value to see if it is null (because of some error). This causes a crash in the next line of code, which uses the return value. The code now checks for null returns.
Differential Revision: https://reviews.llvm.org/D85852
Paul C. Anagnostopoulos [Fri, 21 Aug 2020 21:07:30 +0000 (23:07 +0200)]
New TableGen Programmer's Reference document
This new TableGen Programmer's Reference document replaces the current Language Introduction and Language Reference documents. It brings all the TableGen reference information into one document.
As an experiment, I numbered the sections in the document. See what you think about that.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D85838
(changes by Nicolai Hähnle <nicolai.haehnle@amd.com>:
- fixed build error due to toctree in docs/LangRef/index.rst
- fixed reference to ProgRef)
Change-Id: Ifbdfa39768b8a460aae2873103d31c7b347aff00
Arthur Eubanks [Tue, 18 Aug 2020 19:34:19 +0000 (12:34 -0700)]
[opt][NewPM] Add basic-aa in legacy PM compatibility mode
The legacy PM alias analysis pipeline by default includes basic-aa.
When running `opt -foo-pass` under the NPM and -disable-basic-aa is not
specified, use basic-aa.
This decreases the number of check-llvm failures under NPM from 913 to 752.
Reviewed By: ychen, asbirlea
Differential Revision: https://reviews.llvm.org/D86167
Nicolai Hähnle [Mon, 18 May 2020 14:28:34 +0000 (16:28 +0200)]
MachineSSAUpdater: Allow initialization with just a register class
The register class is required for inserting PHIs, but the "current
virtual register" isn't actually used for anything, so let's remove it
while we're at it.
Differential Revision: https://reviews.llvm.org/D85602
Change-Id: I1e647f31570ef21a7ea8e20db3454178e98a6a8b
kuterd [Fri, 21 Aug 2020 17:46:27 +0000 (20:46 +0300)]
[Attributor] Function seed allow list
- Adds a command line option to seed only selected functions.
- Makes seed allow listing exclusive to assertions enabled builds.
Reviewed By: sstefan1
Differential Revision: https://reviews.llvm.org/D86129
Alina Sbirlea [Fri, 21 Aug 2020 20:24:25 +0000 (13:24 -0700)]
[DomTree] Avoid creating an empty GD to reduce compile time.
Jonas Devlieghere [Fri, 21 Aug 2020 20:33:51 +0000 (13:33 -0700)]
[lldb] Fix build error in TestSimulatorPlatform.py
Before
e5d08fcbac72 the Makefile would always compute the min-version,
even if it wasn't set in the triple. This nuance got lost when passing
the ARCH_CFLAGS directly from TestSimulatorPlatform.
Shinji Okumura [Fri, 21 Aug 2020 20:06:14 +0000 (05:06 +0900)]
[Attributor] fix AANoUndef initialization
Currently, `AANoUndefImpl::initialize` mistakenly always indicates optimistic fixpoint for function returned position.
This is because an associated value is `Function` in the case, and `isGuaranteedNotToBeUndefOrPoison` returns true for Function.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86361
Amy Huang [Fri, 21 Aug 2020 18:54:27 +0000 (11:54 -0700)]
[Cloning] Fix to cloning DISubprograms.
When trying to enable -debug-info-kind=constructor there was an assert
that occurs during debug info cloning ("mismatched subprogram between
llvm.dbg.value variable and !dbg attachment").
It appears that during llvm::CloneFunctionInto, a DISubprogram could be
duplicated when MapMetadata is called, and then added to the MD map again
when DIFinder gets a list of subprograms. This results in two different
versions of the DISubprogram.
This patch switches the order so that the DIFinder subprograms are
added before MapMetadata is called.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46784
Differential Revision: https://reviews.llvm.org/D86185
Craig Topper [Fri, 21 Aug 2020 18:50:49 +0000 (11:50 -0700)]
[docs] Move the label for __builtin_shufflevector below __builtin_dump_struct so the see also link in 'vector operations' will go to the right place and have the right name.
Stanislav Mekhanoshin [Thu, 20 Aug 2020 23:22:59 +0000 (16:22 -0700)]
[AMDGPU] Avoid sorting stalls in regbank-reassign
This is the slowest operation in the already slow pass.
Instead of sorting just put a stall list into an ordered
map.
Differential Revision: https://reviews.llvm.org/D86253
Vaibhav Garg [Fri, 21 Aug 2020 18:40:09 +0000 (14:40 -0400)]
Re-land
7a527f17776be78ec44b88e82b39afb65fc148e4 with fixes.
The original commit was reverted in
58c305f466d1f78adb10e7295b9bc9fc192a6e09
due to broken bots. This commit corrects the triple and command line paths.
Serguei Katkov [Fri, 14 Aug 2020 05:00:09 +0000 (12:00 +0700)]
[InstCombine] Remove unused entries in gc-live bundle of statepoint
If some of gc live value are not used in gc.relocate we can remove them
from gc-live bundle of statepoint instruction.
Also the CL removes duplicated Values in gc-live bundle.
Reviewers: reames, dantrushin
Reviewed By: dantrushin
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D85959
Wolfgang Pieb [Wed, 19 Aug 2020 18:53:39 +0000 (11:53 -0700)]
[llvm-mca][NFC] Refactor views to separate data collection from printing.
Reviewed By: andreadb, lebedev.ri
Differential Revision: https://reviews.llvm.org/D86177
Fangrui Song [Thu, 20 Aug 2020 15:14:10 +0000 (08:14 -0700)]
PrintStackTrace: don't symbolize if LLVM_DISABLE_SYMBOLIZATION is set
See http://lists.llvm.org/pipermail/llvm-dev/2017-June/113975.html for a related previous discussion.
Many tools install signal handlers to print stack traces and optionally
symbolize the addresses with an external program 'llvm-symbolizer' (when
searching for 'llvm-symbolizer', the directory containg the executable
is preferred over PATH).
'llvm-symbolizer' can be slow if the executable is large and/or if
llvm-symbolizer' itself is under-optimized. For example, my 'llvm-lto2' from a
-DCMAKE_BUILD_TYPE=Debug build is 443MiB. The 'llvm-symbolizer' from the same
build takes ~2s to symbolize it. (An optimized 'llvm-symbolizer' takes 0.34s).
A crashed clang may take more than 5s to symbolize a stack trace.
If a test file has several `not --crash` RUN lines. It can be very slow in a Debug build.
This patch makes `not --crash` set an environment variable to suppress symbolization.
This is similar to D33804 which uses a command line option.
I pick 'symbolization' instead of 'symbolication' because the former is
used much more commonly and its stem matches 'llvm-symbolizer'.
Also set LLVM_DISABLE_CRASH_REPORT=1, which is currently only applicable on
`__APPLE__`.
Reviewed By: dblaikie, aganea
Differential Revision: https://reviews.llvm.org/D86170
Stefan Pintilie [Fri, 21 Aug 2020 18:13:10 +0000 (13:13 -0500)]
Forgot to update the test case for ppc64-tls-missing-gdld.s for
02e02f5398d0
Jonas Devlieghere [Fri, 21 Aug 2020 17:57:12 +0000 (10:57 -0700)]
[lldb] Make it a fatal error when %lldb cannot be substituted
Refuse to run the shell tests when %lldb cannot be substituted. This
prevents the test from silently running again the `lldb` in your PATH.
I noticed because when this happens, %lldb-init gets substituted with
lldb-init, which does not exists.
Julian Lettner [Fri, 21 Aug 2020 18:11:50 +0000 (11:11 -0700)]
[ASan][Darwin] Enable test on additional platforms
Qiu Chaofan [Fri, 21 Aug 2020 17:58:07 +0000 (01:58 +0800)]
[PowerPC] Support constrained scalar sitofp/uitofp
This patch adds support for constrained scalar int to fp operations on
PowerPC. Besides, this also fixes the FP exception bit of FCFID*
instructions.
Reviewed By: steven.zhang, uweigand
Differential Revision: https://reviews.llvm.org/D81669
Aden Grue [Fri, 21 Aug 2020 18:03:00 +0000 (18:03 +0000)]
Preserve the error message when MemoryBuffer creation fails
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D86326
Stefan Pintilie [Thu, 20 Aug 2020 11:02:34 +0000 (06:02 -0500)]
[LLD][PowerPC] Add check in LLD to produce an error for missing TLSGD/TLSLD
The function `__tls_get_addr` is used to get the address of an object that is Thread Local Storage.
It needs to have two relocations on it.
One relocation is for the function call itself and it is either R_PPC64_REL24 or R_PPC64_REL24_NOTOC.
The other is R_PPC64_TLSGD or R_PPC64_TLSLD for the symbol that is having its address computed.
In the early days of the transition from the ELFv1 ABI that is used for big endian PowerPC Linux distributions to the ELFv2 ABI that is used for little endian PowerPC Linux distributions, there was some ambiguity in the specification of the relocations for TLS. The GNU linker has implemented support for correct handling of calls to __tls_get_addr with a missing relocation. Unfortunately, we didn't notice that the IBM XL compiler did not handle TLS according to the updated ABI until we tried linking XL compiled libraries with LLD. As a result, there is a lot of code out there in various libraries compiled with XL that have this problem.
This patch adds a new error check in LLD that makes sure calls to `__tls_get_addr` are not missing the TLSGD/TLSLD relocation.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D85994
Thomas Raoux [Fri, 21 Aug 2020 17:34:12 +0000 (10:34 -0700)]
[mlir][GPUToVulkan] Fix signature of bindMemRef function for f16
Binding MemRefs of f16 needs special handling as the type is not supported on
CPU. There was a bug in the type used.
Differential Revision: https://reviews.llvm.org/D86328
Jonas Devlieghere [Fri, 21 Aug 2020 17:02:14 +0000 (10:02 -0700)]
[lldb] Fix TestAPILog.py for reproducer replay
With the log file being a build artifact we don't need to clean it up.
If this happens before the reproducer is captured, the file will be
missing from the reproducer root but being part of the mapping.
Dan Gohman [Fri, 21 Aug 2020 16:16:35 +0000 (09:16 -0700)]
Update my email address.
Azharuddin Mohammed [Fri, 21 Aug 2020 16:58:50 +0000 (09:58 -0700)]
Revert "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator."
This reverts commit
bb54bcf84970c04c9748004f3a4cf59b0c1832a7.
It is causing the value-profile-load.test test to fail on macOS.
Serguei Katkov [Wed, 12 Aug 2020 09:09:02 +0000 (16:09 +0700)]
[InstCombine] Move handling of gc.relocate in a gc.statepoint
The only def for gc.relocate is a gc.statepoint. But real dependency is not
described by def-use chain. Instead this dependency is encoded by indecies
of operands in gc-live bundle of statepoint as integer constants in gc.relocate.
InstCombine operates by def-use chain. As a result when value in gc-live bundle
is simplified the gc.statepoint itself is not simplified but it might simplify dependent
gc.relocates. To trigger the optimization of gc.relocate we now unconditionally trigger
check of all dependent gc.relocates by adding them to worklist.
This CL handles of gc.relocates as process of gc.statepoint optimization considering
gc.statepoint and related gc.relocate as whole entity.
Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D85954
Aaron Ballman [Fri, 21 Aug 2020 16:42:10 +0000 (12:42 -0400)]
Revert "Teach AttachPreviousImpl to inherit MSInheritanceAttr attribute"
This reverts commit
7a527f17776be78ec44b88e82b39afb65fc148e4.
It caused some buildbot failures:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13600
http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/20294
Azharuddin Mohammed [Fri, 21 Aug 2020 16:22:13 +0000 (09:22 -0700)]
[LibFuzzer] [tests] [Darwin] Use the pthread library from the SDK
Jonas Devlieghere [Fri, 21 Aug 2020 16:09:10 +0000 (09:09 -0700)]
[lldb] Skip PDB and NativePDB tests with reproducers
Vaibhav Garg [Fri, 21 Aug 2020 16:04:43 +0000 (12:04 -0400)]
Teach AttachPreviousImpl to inherit MSInheritanceAttr attribute
This commit teaches ASTDeclReader::attachPreviousDecl to successfully merge
two Decl's when one contains an inheritable attribute like the
MSInheritanceAttr. Usually, attributes that are needed to be present along the
redeclaration chain are attached during ASTReading from
ASTDeclReader::attachPreviousDecl, but no such thing is done for inheritable
attributes. Currently, only the logic for merging MSInheritanceAttr is
provided.
Nico Weber [Fri, 21 Aug 2020 16:02:30 +0000 (12:02 -0400)]
[gn build] Port
57903cf0933 -- https://reviews.llvm.org/rG57903cf0933
Florian Hahn [Fri, 21 Aug 2020 15:10:02 +0000 (16:10 +0100)]
[Constants] Handle FNeg in getWithOperands.
Currently ConstantExpr::getWithOperands does not handle FNeg and
subsequently treats FNeg as binary operator, leading to an assertion
failure or segmentation fault if built without assertions.
Originally I reproduced this with llvm-dis on a bitcode file, which I
unfortunately cannot share and also cannot really reduce.
But PR45426 describes the same issue and has a reproducer with Clang, so
I'll go with that.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D86274
Kamau Bridgeman [Tue, 16 Jun 2020 16:18:38 +0000 (11:18 -0500)]
[PowerPC][PCRelative] Thread Local Storage Support for Initial Exec
This patch is the initial support for the Intial Exec Thread Local
Local Storage model to produce code sequence and relocations correct
to the ABI for the model when using PC relative memory operations.
Reviewed By: stefanp
Differential Revision: https://reviews.llvm.org/D81947
diggerlin [Fri, 21 Aug 2020 15:00:56 +0000 (11:00 -0400)]
[AIX][XCOFF] emit symbol visibility for xcoff object file.
SUMMARY:
Reviewers: Jason liu
Differential Revision: https://reviews.llvm.org/D84265
Eduardo Caldas [Fri, 21 Aug 2020 12:20:02 +0000 (12:20 +0000)]
[SyntaxTree] Use annotations in Statement tests
Differential Revision: https://reviews.llvm.org/D86345
Raphael Isemann [Fri, 21 Aug 2020 14:08:37 +0000 (16:08 +0200)]
Revert "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"
This reverts commit
a4c3ed42ba5625af54254584d762ebf96cc06942.
The test is curiously failing with a plain exit code 1 on Fuchsia.
Florian Hahn [Fri, 21 Aug 2020 11:26:41 +0000 (12:26 +0100)]
Recommit "[SCEVExpander] Add helper to clean up instrs inserted while expanding."
Recommit the patch after fixing an issue reported caused by the fact
that re-used values are also added to InsertedValues.
Additional tests have been added in
88818491b9dea64ec65c92ce5652bc45bef337a4
This reverts the revert commit
38884641f28e373ce291dc5ea93416756216e536.
Cameron McInally [Fri, 21 Aug 2020 14:00:13 +0000 (09:00 -0500)]
[SVE] Lower fixed length UDIV to scalable
Pretty much just a copy of the SDIV patches (D86114 and D85982) with string replacement.
Differential Revision: https://reviews.llvm.org/D86316
Haojian Wu [Fri, 21 Aug 2020 13:48:59 +0000 (15:48 +0200)]
[AST][RecoveryExpr] Fix a bogus unused diagnostic when the type is preserved.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D85716
Raphael Isemann [Fri, 21 Aug 2020 12:21:21 +0000 (14:21 +0200)]
Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)
D81347 changes the ASTFileSignature to be an array of 20 uint8_t instead of 5
uint32_t. However, it didn't update the code in ObjectFilePCHContainerOperations
that creates the dwoID in the module from the ASTFileSignature
(`Buffer->Signature` being the array subclass that is now `std::array<uint8_t,
20>` instead of `std::array<uint32_t, 5>`).
```
uint64_t Signature = [..] (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
```
This code works with the old ASTFileSignature (where two uint32_t are enough to
fill the uint64_t), but after the patch this only took two bytes from the
ASTFileSignature and only partly filled the Signature uint64_t.
This caused that the dwoID in the module ref and the dwoID in the actual module
no longer match (which in turns causes that LLDB keeps warning about the dwoID's
not matching when debugging -gmodules-compiled binaries).
This patch just unifies the logic for turning the ASTFileSignature into an
uint64_t which makes the dwoID match again (and should prevent issues like that
in the future).
Reviewed By: aprantl, dang
Differential Revision: https://reviews.llvm.org/D84013
Florian Hahn [Fri, 21 Aug 2020 11:48:05 +0000 (12:48 +0100)]
[LoopIdiom,LSR] Add additional tests for SCEVExpander cleanups.
Sam Parker [Fri, 21 Aug 2020 12:10:25 +0000 (13:10 +0100)]
[NFC][SimplifyCFG] Formatting and variable rename
Georgii Rymar [Thu, 20 Aug 2020 12:45:27 +0000 (15:45 +0300)]
[llvm-readelf][test] - Refine the merged.test
The testing in merged.test is not ideal.
It uses the following set of flags: `-aeWhSrnudlVgIs`
and the precompiled object `trivial.obj.elf-i386`.
In fact, this object, for example, does not contain versioning stuff,
so specifying `-V` does not make much sense for it, so it is not really tested.
Also, we want to avoid using of precompiled objects, ideally we
want to use a YAML that triggers an output for each of the short options in use:
```
-a: --all
-e: --headers
-W: --wide
-h: --file-headers, --file-header
-S: --section-headers, --sections
-r: --relocations
-n: --notes
-u: --unwind
-d: --dynamic-table
-l: --program-headers
-V: --version-info
-g: --elf-section-groups
-I: --elf-hash-histogram
-s: --symbols
```
Note that, for example, we do not need to have groups to test `-g`, because for a
object with no groups llvm-readelf still prints "There are no section groups in this file.",
but that is not always the case. E.g. for `-d` we don't print anything when we have
no dynamic table, so we have to describe it in a YAML to test `-d` properly.
Also, we probably want to test cases with and without `-a`(-all) option separately
to be sure that we handle all options and not only the first one in the sequence.
Differential revision: https://reviews.llvm.org/D86283
Luís Marques [Fri, 21 Aug 2020 12:04:25 +0000 (13:04 +0100)]
[compiler-rt][RISCV] Use muldi3 builtin assembly implementation
D80465 added an assembly implementation of muldi3 for RISC-V but it didn't
add it to the cmake `*_SOURCES` list, so the C implementation was being used
instead. This patch fixes that.
Differential Revision: https://reviews.llvm.org/D86036
Georgii Rymar [Thu, 20 Aug 2020 12:56:24 +0000 (15:56 +0300)]
[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.
The code that reports "PT_DYNAMIC segment offset + size exceeds the size of the file"
has an issue: it is possible to bypass the validation by overflowing the size + offset result.
Differential revision: https://reviews.llvm.org/D85519
Nemanja Ivanovic [Fri, 21 Aug 2020 11:13:56 +0000 (06:13 -0500)]
[PowerPC] Pre-commit FISel with PC-Rel test
Our handling of PC-Relative addressing is currently broken with
Fast ISel in 3 ways:
- FISel emits calls without handling all the PC-Rel intricacies
- FISel materializes FP constants through the TOC
- FISel materializes GV's through the TOC
As it would be unnecessarily tedious to implement all the handling
for PC-Rel in Fast ISel, we will turn off FISel for anything that
generates references to the TOC.
Dmitry Preobrazhensky [Fri, 21 Aug 2020 11:22:25 +0000 (14:22 +0300)]
[AMDGPU][MC][NFC][DOC] Updated AMD GPU assembler syntax description.
Summary of changes:
- added description of MTBUF instructions and format modifier;
- described limitations of f16 inline constants when used with integer operands;
- updated description of gfx9+ flat global addressing modes;
- v_accvgpr_write_b32 src0 corrections (gfx908);
- minor bugfixing and improvements.
Adam Czachorowski [Tue, 11 Aug 2020 16:48:22 +0000 (18:48 +0200)]
[clangd] Discard diagnostics from another SourceManager.
This can happen when building implicit modules, as demonstrated in test.
The CompilerInstance uses the same StoredDiags, but different
SourceManager. This used to crash clangd when it tried to relocate the
diagnostic to the main file, which, according to SourceManager from the
diagnostic, is a fake <module-includes> file.
Differential Revision: https://reviews.llvm.org/D85753
Xing GUO [Fri, 21 Aug 2020 11:01:35 +0000 (19:01 +0800)]
Recommit: [DWARFYAML] Add support for referencing different abbrev tables.
The original commit (
7ff0ace96db9164dcde232c36cab6519ea4fce8) was causing
build failure and was reverted in
6d242a73264ef1e3e128547f00e0fe2d20d3ada0
==================== Original Commit Message ====================
This patch adds support for referencing different abbrev tables. We use
'ID' to distinguish abbrev tables and use 'AbbrevTableID' to explicitly
assign an abbrev table to compilation units.
The syntax is:
```
debug_abbrev:
- ID: 0
Table:
...
- ID: 1
Table:
...
debug_info:
- ...
AbbrevTableID: 1 ## Reference the second abbrev table.
- ...
AbbrevTableID: 0 ## Reference the first abbrev table.
```
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D83116
Sam Parker [Fri, 21 Aug 2020 10:51:40 +0000 (11:51 +0100)]
[NFC] Add SimplifyCFG for ARM
Add some phi elimination threshold testing.
Simon Pilgrim [Fri, 21 Aug 2020 10:37:40 +0000 (11:37 +0100)]
[X86] Enable constexpr on BITSCAN intrinsics (PR31446)
This enables constexpr BSF/BSR intrinsics defined in ia32intrin.h
lewis-revill [Fri, 21 Aug 2020 09:47:54 +0000 (10:47 +0100)]
[RISCV] Fix inaccurate annotations on PseudoBRIND
PseudoBRIND had seemingly inherited incorrect annotations denoting it as
a call instruction and that it defines X1/ra. This caused excess
save/restore code to be emitted for ra.
Differential Revision: https://reviews.llvm.org/D86286
Mirko Brkusanin [Fri, 21 Aug 2020 09:51:06 +0000 (11:51 +0200)]
[AMDGPU] Use ds_read/write_b96/b128 when possible for SDag
Do not break down local loads and stores so ds_read/write_b96/b128 in
ISelLowering can be selected on subtargets that support them and if align
requirements allow them.
Differential Revision: https://reviews.llvm.org/D84403
Mirko Brkusanin [Fri, 21 Aug 2020 09:42:49 +0000 (11:42 +0200)]
[AMDGPU][GlobalISel] Fix 96 and 128 local loads and stores
Fix local ds_read/write_b96/b128 so they can be selected if the alignment
allows. Otherwise, either pick appropriate ds_read2/write2 instructions or break
them down.
Differential Revision: https://reviews.llvm.org/D81638
Mirko Brkusanin [Fri, 21 Aug 2020 09:37:23 +0000 (11:37 +0200)]
[AMDGPU] Reorganize GCN subtarget features for unaligned access
Features UnalignedBufferAccess and UnalignedDSAccess are now used to determine
whether hardware supports such access.
UnalignedAccessMode should be used to enable them.
hasUnalignedBufferAccessEnabled() and hasUnalignedDSAccessEnabled() can be
now used to quickly check both.
Differential Revision: https://reviews.llvm.org/D84522
Mirko Brkusanin [Fri, 21 Aug 2020 09:29:32 +0000 (11:29 +0200)]
[AMDGPU] Fix alignment requirements for 96bit and 128bit local loads and stores
Adjust alignment requirements for ds_read/write_b96/b128.
GFX9 and onwards allow misaligned access for reads and writes but only if
SH_MEM_CONFIG.alignment_mode allows it.
UnalignedDSAccess is set on GCN subtargets from GFX9 onward to let us know if we
can relax alignment requirements.
UnalignedAccessMode acts similary to UnalignedBufferAccess for DS instructions
but only from GFX9 onward and is supposed to match alignment_mode. By default
alignment of 4 is required.
Differential Revision: https://reviews.llvm.org/D82788
Georgii Rymar [Wed, 19 Aug 2020 12:38:43 +0000 (15:38 +0300)]
[llvm-readelf] - Start recognizing 'PT_OPENBSD_*' segment types.
Its a follow-up for D85830, it stops ignoring 'PT_OPENBSD_*' segment types.
Now them are recognized properly.
Note: GNU readelf does not recognize them, though perhaps it shouldn't.
Anyways, it was reported to binutils: https://sourceware.org/bugzilla/show_bug.cgi?id=26405#c0
Differential revision: https://reviews.llvm.org/D86208
Simon Pilgrim [Fri, 21 Aug 2020 09:53:17 +0000 (10:53 +0100)]
[X86] Enable constexpr on BSWAP intrinsics (PR31446)
This enables constexpr BSWAP intrinsics defined in ia32intrin.h
Florian Hahn [Fri, 21 Aug 2020 09:18:32 +0000 (10:18 +0100)]
[DSE,MemorySSA] Handle atomicrmw/cmpxchg conservatively.
This adds conservative handling of AtomicRMW/AtomicCmpXChg to
isDSEBarrier, similar to atomic loads and stores.
Roman Lebedev [Fri, 17 Jul 2020 11:30:51 +0000 (14:30 +0300)]
[NFC] Port InstCount pass to new pass manager
Jay Foad [Tue, 31 Mar 2020 16:24:07 +0000 (17:24 +0100)]
[SelectionDAG] Better legalization for FSHL and FSHR
In SelectionDAGBuilder always translate the fshl and fshr intrinsics to
FSHL and FSHR (or ROTL and ROTR) instead of lowering them to shifts and
ORs. Improve the legalization of FSHL and FSHR to avoid code quality
regressions.
Differential Revision: https://reviews.llvm.org/D77152
Simon Pilgrim [Fri, 21 Aug 2020 09:19:41 +0000 (10:19 +0100)]
[X86] Enable constexpr on POPCNT intrinsics (PR31446)
Followup to D86229, this enables constexpr on the alternative (which fallback to generic code) POPCNT intrinsics defined in ia32intrin.h
Florian Hahn [Fri, 21 Aug 2020 08:50:01 +0000 (09:50 +0100)]
[DSE,MemorySSA] Regenerate check lines for atomic.ll tests.
Jay Foad [Fri, 21 Aug 2020 09:01:01 +0000 (10:01 +0100)]
[AMDGPU] Apply llvm-prefer-register-over-unsigned from clang-tidy
sstefan1 [Fri, 21 Aug 2020 09:11:47 +0000 (11:11 +0200)]
[Attributor][NFC] run update_test_checks with --check-attributes.
Yevgeny Rouban [Fri, 21 Aug 2020 08:52:26 +0000 (15:52 +0700)]
[NewPM][PassInstrumentation] Add PreservedAnalyses parameter to AfterPass* callbacks
Both AfterPass and AfterPassInvalidated pass instrumentation
callbacks get additional parameter of type PreservedAnalyses.
This patch was created by @fedor.sergeev. I have just slightly
changed it.
Reviewers: fedor.sergeev
Differential Revision: https://reviews.llvm.org/D81555
Simon Pilgrim [Fri, 21 Aug 2020 09:02:37 +0000 (10:02 +0100)]
[X86] ia32intrin.h - pull out common attributes into defines. NFCI.
Matches what we do in most other x86 headers
Sam Parker [Fri, 21 Aug 2020 08:27:21 +0000 (09:27 +0100)]
[SimplifyCFG] Cost required selects
Before we speculatively execute a basic block, query the cost of
inserting the necessary select instructions against the phi folding
threshold. For non-trivial insertions, a more accurate decision can
probably be made during machine if-conversion. With minsize we query
the CodeSize cost, otherwise we use SizeAndLatency.
Differential Revision: https://reviews.llvm.org/D82438
Gongyu Deng [Fri, 21 Aug 2020 07:57:18 +0000 (09:57 +0200)]
[lldb] Tab completion for process load/unload
1. Complete `process load` with the common disk file completion, so there is not test provided for it;
2. Complete `process unload` with the tokens of valid loaded images.
Thanks for Raphael's help on the test for `process unload`.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D79887
Georgii Rymar [Thu, 20 Aug 2020 15:40:52 +0000 (18:40 +0300)]
[llvm-readobj] - Change how we create DynRegionInfo objects. NFCI.
Currently we have `checkDRI` and two `createDRIFrom` methods which
are used to create `DynRegionInfo` objects.
And we have an issue: constructions like:
`ObjF->getELFFile()->base() + P->p_offset`
that are used in `createDRIFrom` functions might overflow.
I had to revert `D85519` which triggered such UBSan failure.
This NFC, simplifies and generalizes how we create `DynRegionInfo` objects.
It will allow us to introduce more/better validation checks in a single place.
It also will allow to change `createDRI` to return `Expected<>` so
that we will be able to stop using the `reportError`, which
is used inside currently, and have a warning instead.
Differential revision: https://reviews.llvm.org/D86297
Florian Hahn [Fri, 21 Aug 2020 08:13:59 +0000 (09:13 +0100)]
[DSE,MemorySSA] Split off partial tracking from isOverwite.
When traversing memory uses to look for aliasing reads/writes, we only
care about complete overwrites. This patch splits off the partial
overwrite tracking from isOverwrite This avoids some unnecessary work
when checking for read/write clobbers with MemorySSA-DSE.
isOverwrite, which skips the partial overwrite tracking.
This gives a relatively small improvement
http://llvm-compile-time-tracker.com/compare.php?from=
ef2a2f77f87553a0a4a39f518eb9ac86b756bda6&to=
658f3905dd96d3415f3782adc712c79fa59a4665&stat=instructions
This is part of the patches to bring down compile-time to the level
referenced in
http://lists.llvm.org/pipermail/llvm-dev/2020-August/144417.html
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86280
Eduardo Caldas [Thu, 20 Aug 2020 15:47:48 +0000 (15:47 +0000)]
[SyntaxTree] Add support for `this`
Differential Revision: https://reviews.llvm.org/D86298
Sam Parker [Tue, 18 Aug 2020 11:52:58 +0000 (12:52 +0100)]
[ARM][CostModel] Select instruction costs.
Modify the ARM getCmpSelInstrCost implementation for the code size
costs of selects. Now consider the legalization cost and increase
the cost of i1 because those values wouldn't live in a general purpose
register. We also make selects +1 more expensive to account for the IT
instruction.
Differential Revision: https://reviews.llvm.org/D82091
David Green [Fri, 21 Aug 2020 07:48:12 +0000 (08:48 +0100)]
[ARM][LV] Add a preferPredicatedReductionSelect target hook
As part of D84741, this adds a target hook for the
preferPredicatedReductionSelect option and makes use
of it under MVE, allowing us to tail predicate most
reduction loops.
Differential Revision: https://reviews.llvm.org/D85980
Qiu Chaofan [Fri, 21 Aug 2020 07:12:19 +0000 (15:12 +0800)]
[PowerPC] Add readflm/setflm intrinsics to Clang
Commit
dbcfbffc adds ppc.readflm and ppc.setflm intrinsics to read or
write FPSCR register. This patch adds them to Clang.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D85874
Craig Topper [Fri, 21 Aug 2020 06:45:34 +0000 (23:45 -0700)]
[X86] Correct the implementation of the testFeature macro in getIntelProcessorTypeAndSubtype to do a proper bit test.
Instead of ANDing with a one hot mask representing the bit to
be tested, we were ANDing with just the bit number. This tests
multiple bits none of them the correct one.
This caused skylake-avx512, cascadelake and cooperlake to all
be misdetected. Based on experiments with the Intel SDE, it seems
that all of these CPUs are being detected as being cooperlake.
This is bad since its the newest CPU of the 3.
Mehdi Amini [Fri, 21 Aug 2020 04:25:57 +0000 (04:25 +0000)]
Allow multiple calls to InitLLVM() (NFC)
In
e99dee82b0, the "out_of_memory_new_handler" was changed to be
explicitly initialized instead of relying on a global static
constructor.
However before this change, install_out_of_memory_new_handler could be
called multiple times while it asserts right now.
We can be more tolerant to calling multiple time InitLLVM without
reintroducing a global constructor for this handler.
Differential Revision: https://reviews.llvm.org/D86330
Jonas Devlieghere [Fri, 21 Aug 2020 05:59:13 +0000 (22:59 -0700)]
[lldb] Fix a new -Wdocumetnation issues (NFC)
Jonas Devlieghere [Fri, 21 Aug 2020 05:40:48 +0000 (22:40 -0700)]
[lldb] Remove redundant call to FindBacktrace (NFC)
We're not using any of the Backtrace_* CMake variables set by
FindBacktrace in LLDB.
Jonas Devlieghere [Fri, 21 Aug 2020 05:32:31 +0000 (22:32 -0700)]
[lldb] Simplify CMake logic with LLVM's append_if function
Use the append_if CMake function from HandleLLVMOptions. Since we
include this file in LLDBStandalone it should work in both for in-tree
and out-of-tree builds.
Michael Kruse [Fri, 21 Aug 2020 05:17:29 +0000 (00:17 -0500)]
[Polly] Update isl to isl-0.22.1-416-g61d6dc75.
This fixes llvm.org/PR47104
Mauricio Sifontes [Fri, 21 Aug 2020 04:59:23 +0000 (04:59 +0000)]
Refactor Reduction Tree Pass
Refactor the way the reduction tree pass works in the MLIR Reduce tool by introducing a set of utilities that facilitate the implementation of new Reducer classes to be used in the passes.
This will allow for the fast implementation of general transformations to operate on all mlir modules as well as custom transformations for different dialects.
These utilities allow for the implementation of Reducer classes by simply defining a method that indexes the operations/blocks/regions to be transformed and a method to perform the deletion or transfomration based on the indexes.
Create the transformSpace class member in the ReductionNode class to keep track of the indexes that have already been transformed or deleted at a current level.
Delete the FunctionReducer class and replace it with the OpReducer class to reflect this new API while performing the same transformation and allowing the instantiation of a reduction pass for different types of operations at the module's highest hierarchichal level.
Modify the SinglePath Traversal method to reflect the use of the new API.
Reviewed: jpienaar
Differential Revision: https://reviews.llvm.org/D85591
Xing GUO [Fri, 21 Aug 2020 04:14:58 +0000 (12:14 +0800)]
Revert "[DWARFYAML] Add support for referencing different abbrev tables."
This reverts commit
f7ff0ace96db9164dcde232c36cab6519ea4fce8.
This change is causing build failure.
http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/10400
Yevgeny Rouban [Fri, 21 Aug 2020 03:45:11 +0000 (10:45 +0700)]
[ADT] Allow IsSizeLessThanThresholdT for incomplete types. NFC
If the type T is incomplete then sizeof(T) results in C++ compilation error at line:
static constexpr bool value = sizeof(T) <= (2 * sizeof(void *));
This patch allows incomplete types in parameters of function. Example:
using SomeFunc = void(SomeIncompleteType &);
llvm::unique_function<SomeFuncType> SomeFunc;
Reviewers: DaniilSuchkov, vvereschaka
Differential Revision: https://reviews.llvm.org/D81554
Xing GUO [Fri, 21 Aug 2020 02:33:58 +0000 (10:33 +0800)]
[DWARFYAML] Add support for referencing different abbrev tables.
This patch adds support for referencing different abbrev tables. We use
'ID' to distinguish abbrev tables and use 'AbbrevTableID' to explicitly
assign an abbrev table to compilation units.
The syntax is:
```
debug_abbrev:
- ID: 0
Table:
...
- ID: 1
Table:
...
debug_info:
- ...
AbbrevTableID: 1 ## Reference the second abbrev table.
- ...
AbbrevTableID: 0 ## Reference the first abbrev table.
```
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D83116
Xing GUO [Thu, 20 Aug 2020 02:33:51 +0000 (10:33 +0800)]
[DWARFYAML] Add support for emitting multiple abbrev tables.
This patch adds support for emitting multiple abbrev tables. Currently,
compilation units will always reference the first abbrev table.
Reviewed By: jhenderson, labath
Differential Revision: https://reviews.llvm.org/D86194
Shoaib Meenai [Fri, 21 Aug 2020 02:50:09 +0000 (19:50 -0700)]
[cmake] Don't use ld.lld when targeting Darwin
ld.lld is an ELF linker. We can switch to the new LLD for Mach-O port
when it's more complete, but for now, assume the user will have set
CMAKE_LINKER correctly themselves when targeting Darwin.
Xing GUO [Fri, 21 Aug 2020 02:11:33 +0000 (10:11 +0800)]
[DWARFYAML] Add support for emitting multiple abbrev tables.
This patch adds support for emitting multiple abbrev tables. Currently,
compilation units will always reference the first abbrev table.
Reviewed By: jhenderson, labath
Differential Revision: https://reviews.llvm.org/D86194
Michael Liao [Wed, 24 Jun 2020 16:13:10 +0000 (12:13 -0400)]
[amdgpu] Add codegen support for HIP dynamic shared memory.
Summary:
- HIP uses an unsized extern array `extern __shared__ T s[]` to declare
the dynamic shared memory, which size is not known at the
compile time.
Reviewers: arsenm, yaxunl, kpyzhov, b-sumner
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82496
Shoaib Meenai [Thu, 20 Aug 2020 19:18:15 +0000 (12:18 -0700)]
[runtimes] Allow LLVM_BUILTIN_TARGETS to include Darwin
We have two ways of using the runtimes build setup to build the
builtins. You can either have an empty LLVM_BUILTIN_TARGETS (or have it
include the "default" target), in which case builtin_default_target is
called to set up the default target, or you can have actual triples in
LLVM_BUILTIN_TARGETS, in which case builtin_register_target is called
for each triple. builtin_default_target lets you build the builtins for
Darwin (assuming your default triple is Darwin); builtin_register_target
does not.
I don't understand the reason for this distinction. The Darwin builtins
build is special in that a single CMake configure handles building the
builtins for multiple platforms (e.g. macOS, iPhoneSimulator, and iOS)
and architectures (e.g. arm64, armv7, and x86_64). Consequently, if you
specify multiple Darwin triples in LLVM_BUILTIN_TARGETS, expecting each
configure to only build for that particular triple, it won't work.
However, if you specify a *single* x86_64-apple-darwin triple in
LLVM_BUILTIN_TARGETS, that single configure will build the builtins for
all Darwin targets, exactly the same way that the default target would.
The only difference between the configuration for the default target and
the x86_64-apple-darwin triple is that the latter runs the configuration
with `-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON`, but that makes no
difference for Apple targets (none of the CMake codepaths which have
different behavior based on that variable are run for Apple targets).
I tested this by running two builtins builds on my Mac, one with the
default target and one with the x86_64-apple-darwin19.5.0 target (which
is the default target triple for my clang). The only relevant
CMakeCache.txt difference was the following, and as discussed above, it
has no effect on the actual build for Apple targets:
```
-//Default triple for which compiler-rt runtimes will be built.
-COMPILER_RT_DEFAULT_TARGET_TRIPLE:STRING=x86_64-apple-darwin19.5.0
+//No help, variable specified on the command line.
+COMPILER_RT_DEFAULT_TARGET_ONLY:UNINITIALIZED=ON
```
Furthermore, when I add the `-D` flag to compiler-rt's libtool
invocations, the libraries produced by the two builds are *identical*.
If anything, I would expect builtin_register_target to complain if you
tried specifying a triple for a particular Apple platform triple (e.g.
macosx), since that's the scenario in which it won't work as you want.
The generic darwin triple should be fine though, as best as I can tell.
I'm happy to add the error for specific Apple platform triples, either
in this diff or in a follow-up.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D86313
Gousemoodhin Nadaf [Fri, 21 Aug 2020 01:07:46 +0000 (18:07 -0700)]
[clang]: Remove assertion which checks explicit declaration
explicit keyword is declared outside of class is invalid, invalid explicit declaration is handled inside DiagnoseFunctionSpecifiers() function. To avoid compiler crash in case of invalid explicit declaration, remove assertion.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D83929
Kang Zhang [Fri, 21 Aug 2020 01:10:52 +0000 (01:10 +0000)]
[PowerPC] Fix a typo for InstAlias of mfsprg
D77531 has a type for mfsprg, it should be mtsprg. This patch is to fix
this typo.
Jonas Devlieghere [Thu, 20 Aug 2020 23:19:17 +0000 (16:19 -0700)]
[lldb] Capture and load home directory from the reproducer.
When replaying the reproducer, lldb should source the .lldbinit file
that was captured by the reproducer and not the one in the current home
directory. This requires that we store the home directory as part of the
reproducer. By returning the virtual home directory during replay, we
ensure the correct virtual path gets constructed which the VFS can then
find and remap to the correct file in the reproducer root.
This patch adds a new HomeDirectoryProvider, similar to the existing
WorkingDirectoryProvider. As the home directory is not part of the VFS,
it is stored in LLDB's FileSystem instance.
Jonas Devlieghere [Thu, 20 Aug 2020 23:03:45 +0000 (16:03 -0700)]
[lldb] Implement WorkingDirectoryProvider in terms of DirectoryProvider (NFC)
Add an abstract base class that can be used to create other directory
providers.
Vitaly Buka [Fri, 21 Aug 2020 00:47:41 +0000 (17:47 -0700)]
Revert "[libFuzzer] Fix value-profile-load test."
D86247 fails on Windows.
This reverts commit
428bebaf10e177db5e42206ca8f871f0bcbef058.
Volodymyr Sapsai [Wed, 20 May 2020 00:29:35 +0000 (17:29 -0700)]
[HeaderSearch] Fix processing #import-ed headers multiple times with modules enabled.
HeaderSearch was marking requested HeaderFileInfo as Resolved only based on
the presence of ExternalSource. As the result, using any module was enough
to set ExternalSource and headers unknown to this module would have
HeaderFileInfo with empty fields, including `isImport = 0`, `NumIncludes = 0`.
Such HeaderFileInfo was preserved without changes regardless of how the
header was used in other modules and caused incorrect result in
`HeaderSearch::ShouldEnterIncludeFile`.
Fix by marking HeaderFileInfo as Resolved only if ExternalSource knows
about this header.
rdar://problem/
62126911
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D80263
Vitaly Buka [Fri, 21 Aug 2020 00:33:51 +0000 (17:33 -0700)]
[NFC][libFuzzer] Try to fix test on Windows
Broken after D86247
Vitaly Buka [Fri, 21 Aug 2020 00:25:57 +0000 (17:25 -0700)]
Fix msan build
After D85820 TERMINFO_LIB is undefined.
Justin Bogner [Fri, 21 Aug 2020 00:03:18 +0000 (17:03 -0700)]
[GISel] Correct the known bits of G_ANYEXT
Known bits for G_ANYEXT was incorrectly using KnownBits::zext, causing
us to treat the high bits as zero even though they're (by definition)
unknown.
Differential Revision: https://reviews.llvm.org/D86323
Richard Smith [Thu, 20 Aug 2020 23:41:16 +0000 (16:41 -0700)]
Improve pretty-printing for APValues of void type.
No functionality change intended: there doesn't seem to be any way to
cause Clang to print such a value, but they can show up when dumping
APValues from a debugger.