Simon Pilgrim [Wed, 8 Apr 2020 13:59:01 +0000 (14:59 +0100)]
[CodeExtractor] Fix typo in check label to fix issue reported on D77354
Uday Bondhugula [Wed, 8 Apr 2020 13:41:43 +0000 (19:11 +0530)]
[MLIR] Fix more gcc-5 build issues from D77528
820c420d4e1c630b5ead285917c6ecdd2f5092ad did not really fix all build
issues by D77528. This gets rid of two unnecessary 'using' declarations.
Differential Revision: https://reviews.llvm.org/D77726
Alexey Lapshin [Wed, 8 Apr 2020 12:21:21 +0000 (15:21 +0300)]
[DWARFLinker][dsymutil] followup for
88c2137b6d49f88186d0957a4e2d8030a3967334
That patch is a followup for "Move DwarfStreamer into DWARFLinker".
It fixes build with LLVM_LINK_LLVM_DYLIB.
Clement Courbet [Wed, 8 Apr 2020 12:37:38 +0000 (14:37 +0200)]
[llvm-exegesis][NFC] Let the pfm::Counter own the PerfHelper.
A perf helper is always only ever cretaed to be checked for validity
then passed as Counter ctor argument, never to be touched again.
Its lifetime should outlive that of the counter, and there is never any
reason to have two different counters of top of the perf helper.
Make sure these assumptions always hold by making the Counter consume the
PerfHelper.
Haojian Wu [Wed, 8 Apr 2020 13:08:48 +0000 (15:08 +0200)]
[Parser] Improve diagnostic and error recovery when C++ keywords are used as identifiers.
Summary:
Previously, clang emitted a less-usefull diagnostic and didnt recover
well when the keywords is used as identifier in function paramter.
```
void foo(int case, int x); // previously we drop all parameters after
`int case`.
```
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77633
Stefan Pintilie [Wed, 8 Apr 2020 13:07:35 +0000 (08:07 -0500)]
[PowerPC][Future] Add Support For Functions That Do Not Use A TOC.
On PowerPC most functions require a valid TOC pointer.
This is the case because either the function itself needs to use this
pointer to access the TOC or because other functions that are called
from that function expect a valid TOC pointer in the register R2.
The main exception to this is leaf functions that do not access the TOC
since they are guaranteed not to need a valid TOC pointer.
This patch introduces a feature that will allow more functions to not
require a valid TOC pointer in R2.
Differential Revision: https://reviews.llvm.org/D73664
Louis Dionne [Wed, 8 Apr 2020 13:03:58 +0000 (09:03 -0400)]
[libc++] Explicitly specify that we use libc++abi in Apple's cache
Sanjay Patel [Wed, 8 Apr 2020 13:01:01 +0000 (09:01 -0400)]
[LangRef] update text for shufflevector
D72467 updated the shufflevector instruction to include a constant mask
rather than a mask operand. The LangRef text was vague enough to still
make sense, but it is better to update here too, so there's no confusion
about valid mask values. The text here is adapted from the documentation
code comments for "class ShuffleVectorInst".
Differential Revision: https://reviews.llvm.org/D77396
Sanjay Patel [Wed, 8 Apr 2020 12:54:28 +0000 (08:54 -0400)]
[InstCombine] exclude bitcast of ppc_fp128 in icmp signbit fold
Based on the post-commit comments for rG0f56bbc, there might
be a problem with this transform:
(bitcast (fpext/fptrunc X)) to iX) < 0 --> (bitcast X to iY) < 0
...and the ppc_fp128 data type, so conservatively bypass if we
are bitcasting a ppc_fp128.
We might be able to account for endian or other differences to
enable this for PowerPC again if that is useful.
Differential Revision: https://reviews.llvm.org/D77642
Yitzhak Mandelbaum [Fri, 3 Apr 2020 17:10:51 +0000 (13:10 -0400)]
[libTooling] Simplify the representation of Transformer's RewriteRules.
Summary:
This revision simplifies the representation of edits in rewrite rules. The
simplified form is more general, allowing the user more flexibility in building
custom edit specifications.
The changes extend the API, without changing the signature of existing
functions. So this only risks breaking users that directly accessed the
`RewriteRule` struct.
Reviewers: gribozavr2
Subscribers: jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77419
Bevin Hansson [Thu, 23 Jan 2020 08:16:31 +0000 (09:16 +0100)]
[AST] Compress the FixedPointSemantics type better.
Reviewers: rjmccall, leonardchan, bjope
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73257
Bevin Hansson [Wed, 8 Jan 2020 13:01:30 +0000 (14:01 +0100)]
[CodeGen] Emit IR for compound assignment with fixed-point operands.
Reviewers: rjmccall, leonardchan
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73184
Bevin Hansson [Wed, 8 Jan 2020 10:12:55 +0000 (11:12 +0100)]
[CodeGen] Emit IR for fixed-point unary operators.
Reviewers: rjmccall, leonardchan
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73183
Bevin Hansson [Tue, 19 Nov 2019 12:15:06 +0000 (13:15 +0100)]
[CodeGen] Emit IR for fixed-point multiplication and division.
Reviewers: rjmccall, leonardchan
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73182
Clement Courbet [Wed, 8 Apr 2020 12:17:57 +0000 (14:17 +0200)]
[llvm-exegesis][NFC] Remove dead code.
Ilya Leoshkevich [Wed, 8 Apr 2020 12:25:20 +0000 (14:25 +0200)]
[compiler-rt] Don't use __libc_stack_end on ARM
Summary:
Commit
b684c1a50f70 ("Add a `Symbolizer::GetEnvP()` method that allows
symbolizer implementations to customise the environment of the
symbolizer binary.") exposed a latent ARM issue, and that broke
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-full-sh
This coincided with breakage caused by my commit
5f5fb56c68e4
("[compiler-rt] Intercept the uname() function"), so I had to
investigate.
The issue is that GetArgsAndEnv does not work on ARM: there glibc's
_start overwrites argc value stored at __libc_start_end, breaking the
existing argv/envp parsing logic.
Fix by inferring argc from argv.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: dberris, kristof.beyls, danielkiss, #sanitizers, delcypher
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D77400
Haojian Wu [Wed, 8 Apr 2020 09:03:50 +0000 (11:03 +0200)]
[clangd] Add missing GoToStmt in FindTarget.
Summary: so that go-to-def on label can work.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77715
Simon Pilgrim [Wed, 8 Apr 2020 12:18:32 +0000 (13:18 +0100)]
[AMDGPU] Regenerate vector-extract-insert test checks to fix issue reported on D77354
Simon Pilgrim [Wed, 8 Apr 2020 12:08:52 +0000 (13:08 +0100)]
[AMDGPU] Regenerate si-annotate-cfg-loop-assert test checks to fix issue reported on D77354
Sam McCall [Tue, 7 Apr 2020 13:26:42 +0000 (15:26 +0200)]
[clangd] Support dexp -c "some command"
Summary:
It runs one command and exits.
See D77385 for motivation.
Reviewers: mnauw, kbobyrev
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77645
Andrew Ng [Tue, 7 Apr 2020 20:47:38 +0000 (21:47 +0100)]
[ELF][test] Add reproduce test for dependent libraries
Differential Revision: https://reviews.llvm.org/D77659
Adam Czachorowski [Wed, 8 Apr 2020 11:42:10 +0000 (13:42 +0200)]
[clangd] Fix a crash bug in AddUsing tweak around template handling.
Summary:
The crash happened on cases like:
template<typename TT> using one = two::three<T^T>;
because we tried to call getName() on getBaseTypeIdentifier(), which can
be nullptr.
Ideally we would support this use case as well, but for now not crashing
will do.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77656
Uday Bondhugula [Wed, 8 Apr 2020 11:55:16 +0000 (17:25 +0530)]
[MLIR] Fix gcc-5 build failure cause by D77528
Fix gcc-5 build failure cause by D77528
Differential Revision: https://reviews.llvm.org/D77719
Peter Smith [Sat, 4 Apr 2020 16:15:19 +0000 (17:15 +0100)]
[LLD][ELF][ARM] Implement ARM pc-relative relocations for ADR and LDR
The R_ARM_ALU_PC_G0 and R_ARM_LDR_PC_G0 relocations are used by the
ADR and LDR pseudo instructions, and are the basis of the group
relocations that can load an arbitrary constant via a series of add, sub
and ldr instructions.
The relocations need to be obtained via the .reloc directive.
R_ARM_ALU_PC_G0 is much more complicated as the add/sub instruction uses
a modified immediate encoding of an 8-bit immediate rotated right by an
even 4-bit field. This means that the range of representable immediates
is sparse. We extract the encoding and decoding functions for the modified
immediate from llvm/lib/Target/ARM/MCTargetDesc/ARMAddressingModes.h as
this header file is not accessible from LLD. Duplication of code isn't
ideal, but as these are well-defined mathematical functions they are
unlikely to change.
Differential Revision: https://reviews.llvm.org/D75349
Simon Pilgrim [Wed, 8 Apr 2020 11:04:58 +0000 (12:04 +0100)]
[X86][SSE] Combine PTEST(AND(X,Y),AND(X,Y)) -> PTEST(X,Y) and ANDN equivalents
Tests derived from PR42035 examples
Sam McCall [Fri, 3 Apr 2020 01:07:10 +0000 (03:07 +0200)]
[clangd] show layout info when hovering on a class/field definition.
Summary:
This triggers only on the definition itself, not on references (probably too
noisy). Inspecting the definition seems like a decent hint for being interested
in layout.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77355
Jeremy Morse [Wed, 8 Apr 2020 11:24:13 +0000 (12:24 +0100)]
[DebugInfo][NFC] Early-exit when analyzing for single-location variables
This is a performance patch that hoists two conditions in DwarfDebug's
validThroughout to avoid a linear-scan of all instructions in a block. We
now exit early if validThrougout will never return true for the variable
location.
The first added clause filters for the two circumstances where
validThroughout will return true. The second added clause should be
identical to the one that's deleted from after the linear-scan.
Differential Revision: https://reviews.llvm.org/D77639
Peter Smith [Mon, 6 Apr 2020 21:21:39 +0000 (22:21 +0100)]
[ELF][AArch64] Add R_AARCH64_PLT32 relocation type.
The R_AARCH64_PLT32 relocation type will be documented in the next release
of ELF for the 64-bit Arm Architecture. It is being added in draft state
for the benefit of the position independent vtable feature.
R_AARCH64_PLT32 is very similar to R_AARCH64_PREL32. The intention is to
provide a signed 32-bit integer representing an offset from the place
to a function.
- It relocates 32-bit data
- The expression is S + A - P
- The overflow check for the expression is -2^31 <= X < 2^31
- The relocation generates Thunks/Veneers/Stubs and PLT entries as per
R_AArch64_CALL26
- If the symbol S is an undefined weak the ABI does not define its value.
The ABI defines a code for ilp32 for completeness, I have added the code
but have only added to the existing reloc-types-elf-aarch64.text as there
is no ilp32 equivalent.
Differential Revision: https://reviews.llvm.org/D77647
Shengchen Kan [Tue, 7 Apr 2020 04:27:45 +0000 (12:27 +0800)]
[X86][MC] Support enhanced relaxation for branch align
Summary:
Since D75300 has been landed, I want to support enhanced relaxation when we need to align branches and allow prefix padding. "Enhanced Relaxtion" means we allow an instruction that could not be traditionally relaxed to be emitted into RelaxableFragment so that we increase its length by adding prefixes for optimization.
The motivation is straightforward, RelaxFragment is mostly for relative jumps and we can not increase the length of jumps when we need to align them, so if we need to achieve D75300's purpose (reducing the bytes of nops) when need to align jumps, we have to make more instructions "relaxable".
Reviewers: reames, MaskRay, craig.topper, LuoYuanke, jyknight
Reviewed By: reames
Subscribers: hiraditya, llvm-commits, annita.zhang
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76286
Mikael Holmen [Wed, 8 Apr 2020 09:58:26 +0000 (11:58 +0200)]
[IfConversion] Disallow TrueBB == FalseBB for valid diamonds
Summary:
This fixes PR45302.
Previously the case
BB1
/ \
| |
TBB FBB
| |
\ /
BB2
was treated as a valid diamond also when TBB and FBB was the same basic
block. This then lead to a failed assertion in IfConvertDiamond.
Since TBB == FBB is quite a degenerated case of a diamond, we now
don't treat it as a valid diamond anymore, and thus we will avoid the
trouble of making IfConvertDiamond handle it correctly.
Reviewers: efriedma, kparzysz
Reviewed By: efriedma
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D77651
Anna Welker [Wed, 8 Apr 2020 10:43:55 +0000 (11:43 +0100)]
[ARM][MVE] Optimise offset addresses of gathers/scatters
This patch adds an analysis of the offset addresses used by gathers
and scatters to the MVEGatherScatterLowering pass to find
multiplications and additions that are loop invariant and thus can
be moved into the loop preheader, avoiding to execute them each time.
Differential Revision: https://reviews.llvm.org/D76681
Max Kazantsev [Wed, 8 Apr 2020 10:22:53 +0000 (17:22 +0700)]
[LoopLoadElim] Add test showing that LoopLoadElim doesn't work correctly with new PM
Dominik Montada [Mon, 23 Mar 2020 11:58:55 +0000 (12:58 +0100)]
[GlobalISel] combine trunc(trunc) pattern
Summary:
Legalization can introduce the trunc(trunc) pattern. This can cause
problems if one of these intermediate truncs is not legal.
Combine truncs of this pattern, if the resulting trunc is legal.
Reviewers: arsenm, aemerson, dsanders
Reviewed By: arsenm
Subscribers: jvesely, wdng, nhaehnle, rovka, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76601
James Henderson [Tue, 7 Apr 2020 10:51:26 +0000 (11:51 +0100)]
[llvm-objdump] Fix unstable disassembly output for sections with same address
When two sections shared the same address, the disassembly code was
using pointer values when sorting (see the SectionRef less than
operator). Since those values aren't guaranteed to have a specific
order, this meant the disassembly code would sometimes change which
section to pick when finding symbols targeted by calls in fully linked
objects.
This change fixes the non-determinism, so that the same section is
always picked. This might have a negative impact in that now a section
without any symbol might be picked over a section with symbols, but this
will be addressed in a later commit.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45411.
Reviewed by: grimar, MaskRay
Differential Revision: https://reviews.llvm.org/D77640
Uday Bondhugula [Mon, 6 Apr 2020 07:40:20 +0000 (13:10 +0530)]
[MLIR] Add support to use aligned_alloc to lower AllocOp from std to llvm
Support to recognize and deal with aligned_alloc was recently added to
LLVM's TLI/MemoryBuiltins and its various optimization passes. This
revision adds support for generation of aligned_alloc's when lowering
AllocOp from std to LLVM. Setting 'use-aligned_alloc=1' will lead to
aligned_alloc being used for all heap allocations. An alignment and size
that works with the constraints of aligned_alloc is chosen.
Using aligned_alloc is preferable to "using malloc and adjusting the
allocated pointer to align for indexing" because the pointer access
arithmetic done for the latter only makes it harder for LLVM passes to
deal with for analysis, optimization, attribute deduction, and rewrites.
Differential Revision: https://reviews.llvm.org/D77528
Balázs Kéri [Wed, 8 Apr 2020 06:52:24 +0000 (08:52 +0200)]
[Analyzer][StreamChecker] Introduction of stream error handling.
Summary:
Store the error flags (EOF or error) of a stream.
Support the functions feof, ferror, clearerr.
Added a test checker for setting the error flags.
Reviewers: Szelethus, NoQ, Charusso, baloghadamsoftware, xazax.hun
Reviewed By: Szelethus
Subscribers: steakhal, ASDenysPetrov, rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75682
Dominik Montada [Wed, 1 Apr 2020 09:20:15 +0000 (11:20 +0200)]
[GlobalISel] Combine sext([sz]ext) -> [sz]ext, zext(zext) -> zext
Summary:
Combine sext(zext x) to (zext x) since the sign-bit is 0
after the zero-extension.
Combine sext(sext x) to (sext x) and ext(zext x) to (zext x)
since the intermediate step is not needed.
Reviewers: arsenm, volkan, aemerson, aditya_nandakumar
Reviewed By: arsenm
Subscribers: jvesely, wdng, nhaehnle, rovka, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77210
Christian Sigg [Wed, 8 Apr 2020 06:59:59 +0000 (08:59 +0200)]
[MLIR] Add missing colon after CHECKs.
Reviewers: herhut
Reviewed By: herhut
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77709
Dominik Montada [Mon, 23 Mar 2020 11:30:55 +0000 (12:30 +0100)]
[GlobalISel] support narrow G_IMPLICIT_DEF for DstSize % NarrowSize != 0
Summary:
When narrowing G_IMPLICIT_DEF where the original size is not a multiple
of the narrow size, emit a smaller G_IMPLICIT_DEF and use G_ANYEXT.
To prevent a potential endless loop in the legalizer, the condition
to combine G_ANYEXT(G_IMPLICIT_DEF) is changed from isInstUnsupported
to !isInstLegal, since in this case the combine is only valid if
consequent legalization of the newly combined G_IMPLICIT_DEF does not
introduce G_ANYEXT due to narrowing.
Although this legalization for G_IMPLICIT_DEF would also be valid for
the general case, it actually caused a lot of code regressions when
tried due to superfluous COPYs and combines not getting hit anymore.
Reviewers: dsanders, aemerson, volkan, arsenm, aditya_nandakumar
Reviewed By: arsenm
Subscribers: jvesely, nhaehnle, kerbowa, wdng, rovka, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76598
Kadir Cetinkaya [Tue, 7 Apr 2020 19:07:44 +0000 (21:07 +0200)]
[clangd] Destroy context before resetting CurrentReq
Summary:
Our tests stash callbacks into request context and rely on it being
invoked before threads going idle.
Reviewers: sammccall
Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77671
Kadir Cetinkaya [Tue, 7 Apr 2020 18:08:55 +0000 (20:08 +0200)]
[clangd] Fix broken assertion
Summary:
This assertion was bad. It will show up once we start running preamble
thread async. Think about the following case:
- Update 1
builds a preamble, and an AST. Caches the AST.
- Update 2
Invalidates the cache, preamble hasn't changed.
- Update 3
Invalidates the cache, preamble hasn't changed
- Read
builds AST using preamble v1, and caches it.
preamble for v2 gets build, cache isn't invalidated since preamble is same.
generateDiags tries to reuse cached AST but latest version is 3 not 2, so
assertion fails.
Reviewers: sammccall
Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77664
Kazushi (Jam) Marukawa [Wed, 8 Apr 2020 07:52:46 +0000 (09:52 +0200)]
[VE] Simplify definitions of uimm6 and simm7
Summary: To prepare continuous changes, simplify uimm6 and simm7 operands.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D77700
Austin Conlon [Tue, 7 Apr 2020 06:36:49 +0000 (23:36 -0700)]
Add missing hyphens
Igor Kudrin [Mon, 6 Apr 2020 14:29:22 +0000 (21:29 +0700)]
[DebugInfo] Fix reading DWARFv5 type units in DWP.
In DWARFv5, type units are stored in .debug_info sections, along with
compilation units, and they are distinguished by the unit_type field
in the header, not by the name of the section. It is impossible to
associate the correct index section of a DWP file with the unit before
the unit's header is read. This patch fixes reading DWARFv5 type units
by parsing the header first and then applying the index entry according
to the actual unit type.
Differential Revision: https://reviews.llvm.org/D77552
Julian Lettner [Fri, 22 Nov 2019 21:49:51 +0000 (13:49 -0800)]
[lit] Print slowest tests and time histogram before result groups
Julian Lettner [Thu, 28 Feb 2019 06:29:00 +0000 (22:29 -0800)]
[lit] Improve test summary output
This change aligns the test summary output along the longest
category label. We also properly align test counts.
Before:
```
Testing Time: 10.30s
Unsupported Tests : 1
Expected Passes : 30
```
After:
```
Testing Time: 10.29s
Unsupported Tests: 1
Expected Passes : 30
```
LLVM GN Syncbot [Wed, 8 Apr 2020 04:48:03 +0000 (04:48 +0000)]
[gn build] Port
f85ae058f58
Stanislav Mekhanoshin [Tue, 7 Apr 2020 23:43:00 +0000 (16:43 -0700)]
[AMDGPU] Expand vector trunc stores from i16 to i8
Differential Revision: https://reviews.llvm.org/D77693
Johannes Doerfert [Sat, 28 Mar 2020 01:36:30 +0000 (20:36 -0500)]
[OpenMP] Provide math functions in OpenMP device code via OpenMP variants
For OpenMP target regions to piggy back on the CUDA/AMDGPU/... implementation of math functions,
we include the appropriate definitions inside of an `omp begin/end declare variant match(device={arch(nvptx)})` scope.
This way, the vendor specific math functions will become specialized versions of the system math functions.
When a system math function is called and specialized version is available the selection logic introduced in D75779
instead call the specialized version. In contrast to the code path we used so far, the system header is actually included.
This means functions without specialized versions are available and so are macro definitions.
This should address PR42061, PR42798, and PR42799.
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D75788
Johannes Doerfert [Sun, 29 Mar 2020 20:56:15 +0000 (15:56 -0500)]
[OpenMP] Specialize OpenMP calls after template instantiation
As with regular calls, we want to specialize a call that went through
template instantiation if it has an applicable OpenMP declare variant.
Reviewed By: erichkeane, mikerice
Differential Revision: https://reviews.llvm.org/D77290
Johannes Doerfert [Fri, 3 Apr 2020 16:29:53 +0000 (11:29 -0500)]
[OpenMP] Add match_{all,any,none} declare variant selector extensions.
By default, all traits in the OpenMP context selector have to match for
it to be acceptable. Though, we sometimes want a single property out of
multiple to match (=any) or no match at all (=none). We offer these
choices as extensions via
`implementation={extension(match_{all,any,none})}`
to the user. The choice will affect the entire context selector not only
the traits following the match property.
The first user will be D75788. There we can replace
```
#pragma omp begin declare variant match(device={arch(nvptx64)})
#define __CUDA__
#include <__clang_cuda_cmath.h>
// TODO: Hack until we support an extension to the match clause that allows "or".
#undef __CLANG_CUDA_CMATH_H__
#undef __CUDA__
#pragma omp end declare variant
#pragma omp begin declare variant match(device={arch(nvptx)})
#define __CUDA__
#include <__clang_cuda_cmath.h>
#undef __CUDA__
#pragma omp end declare variant
```
with the much simpler
```
#pragma omp begin declare variant match(device={arch(nvptx, nvptx64)}, implementation={extension(match_any)})
#define __CUDA__
#include <__clang_cuda_cmath.h>
#undef __CUDA__
#pragma omp end declare variant
```
Reviewed By: mikerice
Differential Revision: https://reviews.llvm.org/D77414
Johannes Doerfert [Wed, 1 Apr 2020 22:07:10 +0000 (17:07 -0500)]
[OpenMP] Try to find an existing base for `omp begin/end declare variant`
If we have a function definition in `omp begin/end declare variant` it
is a specialization of a base function with the same name and
"compatible" type. Before, we just created a declaration for the base.
With this patch we try to find an existing declaration first and only
create a new one if we did not find any with a compatible type. This is
preferable as we can tolerate slight mismatches, especially if the
specialized version is "more constrained", e.g., constexpr.
Reviewed By: mikerice
Differential Revision: https://reviews.llvm.org/D77252
Nicolas Vasilache [Wed, 8 Apr 2020 03:49:08 +0000 (23:49 -0400)]
[mlir][Linalg] Use subview instead of linalg.slice in Promotion.cpp
This revision removes the reliance of Promotion on `linalg.slice` which is meant
for the rank-reducing case.
Differential Revision: https://reviews.llvm.org/D77676
Johannes Doerfert [Wed, 8 Apr 2020 03:44:43 +0000 (22:44 -0500)]
[OpenMP] "UnFix" last layering problem with FrontendOpenMP
It seems one target was missed in D77666 which kept some bots red [0].
[0] http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/12079/steps/build%20stage%201/logs/stdio
Lukas Sommer [Wed, 8 Apr 2020 03:24:08 +0000 (03:24 +0000)]
Keep output file after successful execution of mlir-opt
Invoke `keep()` on the output file of `mlir-opt` in case the invocation of `MlirOptMain` was successful, to make sure the output file is not deleted on exit from `mlir-opt`.
Fixes a similar problem in `standalone-opt` from the example for an out-of-tree, standalone MLIR dialect.
This revision also adds a missing parameter to the invocation of `MlirOptMain` in `standalone-opt`.
Differential Revision: https://reviews.llvm.org/D77643
Kazu Hirata [Wed, 8 Apr 2020 00:41:50 +0000 (17:41 -0700)]
[JumpThreading] NFC: Simplify ComputeValueKnownInPredecessorsImpl
Summary:
ComputeValueKnownInPredecessorsImpl is the main folding mechanism in
JumpThreading.cpp. To avoid potential infinite recursion while
chasing use-def chains, it uses:
DenseSet<std::pair<Value *, BasicBlock *>> &RecursionSet
to keep track of Value-BB pairs that we've processed.
Now, when ComputeValueKnownInPredecessorsImpl recursively calls
itself, it always passes BB as is, so the second element is always BB.
This patch simplifes the function by dropping "BasicBlock *" from
RecursionSet.
Reviewers: wmi, efriedma
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77699
Julian Lettner [Wed, 8 Apr 2020 01:18:33 +0000 (18:18 -0700)]
[lit] Print slowest test first when timing tests
lit supports `--time-tests` which will report the 20 slowest tests and
print a nice histogram for test times. This change prints this list and
the histogram rows by decreasing test times. After all, we are most
interested in the slowest tests.
Julian Lettner [Thu, 28 Feb 2019 05:46:04 +0000 (21:46 -0800)]
[lit] Improve consistency when printing test results
Volodymyr Sapsai [Wed, 8 Apr 2020 00:41:30 +0000 (17:41 -0700)]
Revert "[ObjC generics] Fix not inheriting type bounds in categories/extensions."
This reverts commit
a8c8b627f23f204fb621bd2a8c495cfc8bc16ae7. It causes
intermittent
Clang :: SemaObjC/parameterized_classes_subst.m
test failures on various bots.
Dan Albert [Tue, 7 Apr 2020 23:29:13 +0000 (16:29 -0700)]
Reset more globalMemCounters.
Reviewers: EricWF, #libc
Reviewed By: EricWF, #libc
Subscribers: broadwaylamb, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D77681
LLVM GN Syncbot [Tue, 7 Apr 2020 23:30:51 +0000 (23:30 +0000)]
[gn build] Port
1adeeabb79a
Eli Friedman [Tue, 7 Apr 2020 23:25:52 +0000 (16:25 -0700)]
[NFC] Clean up uses of LoadInst constructor.
Davide Italiano [Tue, 7 Apr 2020 23:27:29 +0000 (16:27 -0700)]
[ManualDWARFIndex] Remove dead code, in preparation for moving this function.
Daniel Sanders [Fri, 3 Apr 2020 23:18:45 +0000 (16:18 -0700)]
Add MIR-level debugify with only locations support for now
Summary:
Re-used the IR-level debugify for the most part. The MIR-level code then
adds locations to the MachineInstrs afterwards based on the LLVM-IR debug
info.
It's worth mentioning that the resulting locations make little sense as
the range of line numbers used in a Function at the MIR level exceeds that
of the equivelent IR level function. As such, MachineInstrs can appear to
originate from outside the subprogram scope (and from other subprogram
scopes). However, it doesn't seem worth worrying about as the source is
imaginary anyway.
There's a few high level goals this pass works towards:
* We should be able to debugify our .ll/.mir in the lit tests without
changing the checks and still pass them. I.e. Debug info should not change
codegen. Combining this with a strip-debug pass should enable this. The
main issue I ran into without the strip-debug pass was instructions with MMO's and
checks on both the instruction and the MMO as the debug-location is
between them. I currently have a simple hack in the MIRPrinter to
resolve that but the more general solution is a proper strip-debug pass.
* We should be able to test that GlobalISel does not lose debug info. I
recently found that the legalizer can be unexpectedly lossy in seemingly
simple cases (e.g. expanding one instr into many). I have a verifier
(will be posted separately) that can be integrated with passes that use
the observer interface and will catch location loss (it does not verify
correctness, just that there's zero lossage). It is a little conservative
as the line-0 locations that arise from conflicts do not track the
conflicting locations but it can still catch a fair bit.
Depends on D77439, D77438
Reviewers: aprantl, bogner, vsk
Subscribers: mgorny, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77446
Fangrui Song [Tue, 7 Apr 2020 23:04:39 +0000 (16:04 -0700)]
[VE] Migrate to the getMachineMemOperand overload using llvm::Align
Just delete the deprecated overload because nothing uses it.
River Riddle [Tue, 7 Apr 2020 22:51:42 +0000 (15:51 -0700)]
[mlir][AsmFormat] Avoid invalidating the iterator when verifying attributes
Summary: 'it' may get invalidated when recursing into optional groups. This revision refactors the inner loop to avoid the need to compare the iterator after invalidation.
Differential Revision: https://reviews.llvm.org/D77686
Matt Arsenault [Tue, 7 Apr 2020 21:28:53 +0000 (17:28 -0400)]
CodeGen: More conversions to use Register
Fangrui Song [Sun, 16 Feb 2020 01:23:18 +0000 (17:23 -0800)]
[ThinLTO] Drop dso_local if a GlobalVariable satisfies isDeclarationForLinker()
dso_local leads to direct access even if the definition is not within this compilation unit (it is
still in the same linkage unit). On ELF, such a relocation (e.g. R_X86_64_PC32) referencing a
STB_GLOBAL STV_DEFAULT object can cause a linker error in a -shared link.
If the linkage is changed to available_externally, the dso_local flag should be dropped, so that no
direct access will be generated.
The current behavior is benign, because -fpic does not assume dso_local
(clang/lib/CodeGen/CodeGenModule.cpp:shouldAssumeDSOLocal).
If we do that for -fno-semantic-interposition (D73865), there will be an
R_X86_64_PC32 linker error without this patch.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D74751
Fangrui Song [Tue, 7 Apr 2020 22:41:04 +0000 (15:41 -0700)]
Dan Albert [Tue, 7 Apr 2020 22:36:44 +0000 (15:36 -0700)]
Revert "Don't expose unavailable cstdio functions."
Broke builders that emit different diagnostics. e.g.:
error: 'warning' diagnostics seen but not expected:
Line 13: alias declarations are a C++11 extension
Line 20: alias declarations are a C++11 extension
This reverts commit
ff87813715ec32741ce230dd37c13d0ae6673f9c.
Stephen Neuendorffer [Sun, 5 Apr 2020 05:54:35 +0000 (22:54 -0700)]
[MLIR] Add note for file-line numbers in tablegen errors for assembly formats
Error messages for the custom assembly format are difficult to understand
because there are no line numbers. This happens because the assembly format
is parsed as a standalone line, separate from it's parent file, with no useful
location information. Fixing this properly probably requires quite a bit
of invasive plumbing through the SourceMgr, similar to how included files
are handled
This proposal is a less invasive short term solution. When generating an
error message we generate an additional note which at least properly describes
the operation definition the error occured in, if not the actual line number
of the assemblyFormat definition.
A typical message is like:
error: type of operand #0, named 'operand', is not buildable and a buildable type cannot be inferred
$operand type($result) attr-dict
^
/src/llvm-project/mlir/test/mlir-tblgen/op-format-spec.td:296:1: note: in custom assembly format for this operation
def ZCoverageInvalidC : TestFormat_Op<"variable_invalid_c", [{
^
note: suggest adding a type constraint to the operation or adding a 'type($operand)' directive to the custom assembly format
$operand type($result) attr-dict
^
Differential Revision: https://reviews.llvm.org/D77488
Stephen Neuendorffer [Sat, 4 Apr 2020 01:17:51 +0000 (18:17 -0700)]
[MLIR] Cleanup mlir-tblgen error messages for custom assembly formats.
The messages are somewhat cryptic, since they are not complete sentences,
include lots of ambiguous words, like 'format' which are hard to parse,
and include names from the users code which may, or may not make sense in
the context of the message. Start to clean this up and provide some
guidance for fixes.
Also, add a test for one of the messages which didn't have a test at all.
Differential Revision: https://reviews.llvm.org/D77449
Dan Albert [Tue, 7 Apr 2020 22:02:15 +0000 (15:02 -0700)]
Don't expose unavailable cstdio functions.
Summary: These aren't available on Android in all configurations.
Reviewers: EricWF, mclow.lists, #libc, ldionne
Reviewed By: EricWF, #libc, ldionne
Subscribers: broadwaylamb, dexonsmith, ldionne, krytarowski, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D76093
Jorge Gorbe Moya [Tue, 7 Apr 2020 21:44:42 +0000 (14:44 -0700)]
[libunwind] Fix UB in EHHeaderParser::findFDE
When the EHHeaderInfo object filled by decodeEHHdr has fde_count == 0,
findFDE does the following:
- sets low = 0 and len = hdrInfo.fde_count as a preparation to start a
binary search
- because len is 0, the binary search loop is skipped
- the code still tries to find a table entry at
hdrInfo.table + low * tableEntrySize, and decode it.
This is wrong when fde_count is 0, and trying to decode a table entry
that isn't there will lead to reading garbage offsets and can cause
segfaults.
Differential Revision: https://reviews.llvm.org/D77679
Alexey Bataev [Tue, 7 Apr 2020 21:14:59 +0000 (17:14 -0400)]
[OPENMP]Do not capture global marked as shared in OpenMP region.
No need to capture the global variable marked as shared in the OpenMP
region, the original variable can be used.
Wei Mi [Fri, 3 Apr 2020 18:57:36 +0000 (11:57 -0700)]
Recommit [SampleFDO] Add flag for partial profile.
Fix the error of show-prof-info.test on some platforms without zlib.
The common profile usage is to collect profile from a target and then use the profile to guide the optimized build for the same target. There are some cases that no profile can be collected for a target. In those cases, although no full profile is available, it is possible to have some partial profile collected from other targets to optimize common libraries and utilities. A flag is needed to tell the partial profile from the full profile apart, so compiler can use different strategy for them.
Differential Revision: https://reviews.llvm.org/D77426
Stanislav Mekhanoshin [Fri, 28 Feb 2020 23:48:46 +0000 (15:48 -0800)]
[AMDGPU] Implement copyPhysReg for 16 bit subregs
Differential Revision: https://reviews.llvm.org/D74937
River Riddle [Tue, 7 Apr 2020 21:21:18 +0000 (14:21 -0700)]
[mlir][Pass] Update the documentation for the declarative pass specification
The pass tablegen backend now generates base classes instead of utilities, so this revision updates the documentation to reflect that.
Louis Dionne [Tue, 7 Apr 2020 21:00:23 +0000 (17:00 -0400)]
[libc++] Remove the %{not} substitution
It has never been used, and it actually doesn't really work because it
assumes that the target supports Python. Instead, it's better to just
use `!` since we're running ShTests in system shells anyway.
Francis Visoiu Mistrih [Tue, 7 Apr 2020 20:49:00 +0000 (13:49 -0700)]
[Driver] Only pass LTO remark arguments if the driver asks for it
Previous fix missed a check to willEmitRemarks, causing remarks to
always be enabled for LTO.
Benjamin Kramer [Tue, 7 Apr 2020 21:06:59 +0000 (23:06 +0200)]
Don't access reference to a vector after pop_back
This is undefined behavior. Found by asan's detect_container_overflow.
River Riddle [Tue, 7 Apr 2020 20:58:12 +0000 (13:58 -0700)]
[mlir][Pass] Update the PassGen to generate base classes instead of utilities
Summary:
This is much cleaner, and fits the same structure as many other tablegen backends. This was not done originally as the CRTP in the pass classes made it overly verbose/complex.
Differential Revision: https://reviews.llvm.org/D77367
River Riddle [Tue, 7 Apr 2020 20:56:16 +0000 (13:56 -0700)]
[mlir][Pass] Remove the use of CRTP from the Pass classes
This revision removes all of the CRTP from the pass hierarchy in preparation for using the tablegen backend instead. This creates a much cleaner interface in the C++ code, and naturally fits with the rest of the infrastructure. A new utility class, PassWrapper, is added to replicate the existing behavior for passes not suitable for using the tablegen backend.
Differential Revision: https://reviews.llvm.org/D77350
River Riddle [Tue, 7 Apr 2020 20:55:34 +0000 (13:55 -0700)]
[mlir][Pass][NFC] Replace usages of ModulePass with OperationPass<ModuleOp>
ModulePass doesn't provide any special utilities and thus doesn't give enough benefit to warrant a special pass class. This revision replaces all usages with the more general OperationPass.
Differential Revision: https://reviews.llvm.org/D77339
Matt Arsenault [Tue, 7 Apr 2020 20:33:58 +0000 (16:33 -0400)]
CodeGen: Use Register in TargetFrameLowering
Nikita Popov [Tue, 7 Apr 2020 19:21:30 +0000 (21:21 +0200)]
[BPI] Clear handles when releasing memory (NFC)
This reduces max-rss of sqlite compilation by 2.5%.
Jacques Pienaar [Tue, 7 Apr 2020 14:44:19 +0000 (07:44 -0700)]
[mlir][DRR] Add location directive
Summary:
Add directive to indicate the location to give to op being created. This
directive is optional and if unused the location will still be the fused
location of all source operations.
Currently this directive only works with other op locations, reusing an
existing op location or a fusion of op locations. But doesn't yet support
supplying metadata for the FusedLoc.
Based off initial revision by antiagainst@ and effectively mirrors GlobalIsel
debug_locations directive.
Differential Revision: https://reviews.llvm.org/D77649
Lawrence D'Anna [Tue, 7 Apr 2020 20:29:58 +0000 (13:29 -0700)]
Fix illegal early call to PyBuffer_Release in swig typemaps
Summary:
The buffer protocol does not allow us to just call PyBuffer_Release
and assume the buffer will still be there. Most things that implement the
buffer protocol will let us get away with that, but not all. We need
to release it at the end of the SWIG wrapper.
Reviewers: labath, jasonmolenda, JDevlieghere, vadimcn
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D77480
Nathan James [Tue, 7 Apr 2020 20:30:29 +0000 (21:30 +0100)]
[clang-tidy] Fix buildbot failing with explicit specialization in class scope
Stella Laurenzo [Sun, 5 Apr 2020 02:22:05 +0000 (19:22 -0700)]
Remove FxpMathOps dialect and Quantizer tool.
Summary:
* Removal of FxpMathOps was discussed on the mailing list.
* Will send a courtesy note about also removing the Quantizer (which had some dependencies on FxpMathOps).
* These were only ever used for experimental purposes and we know how to get them back from history as needed.
* There is a new proposal for more generalized quantization tooling, so moving these older experiments out of the way helps clean things up.
Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77479
David Blaikie [Tue, 7 Apr 2020 20:22:03 +0000 (13:22 -0700)]
Remove some top-level const from return values seen in review
Eric Astor [Tue, 7 Apr 2020 20:16:22 +0000 (16:16 -0400)]
[ms] Add new /PDBSTREAM option to lld-link allowing injection of streams into PDB files.
Summary:
/PDBSTREAM:<name>=<file> adds the contents of <file> to stream <name> in the resulting PDB.
This allows native uses with workflows that (for example) add srcsrv streams to PDB files to provide a location for the build's source files.
Results should be equivalent to linking with lld-link, then running Microsoft's pdbstr tool with the command line:
pdbstr.exe -w -p:<PDB LOCATION> -s:<name> -i:<file>
except in cases where the named stream overlaps with a default named stream, such as "/names". In those cases, the added stream will be overridden, making the /pdbstream option a no-op.
Reviewers: thakis, rnk
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D77310
Louis Dionne [Tue, 7 Apr 2020 19:42:00 +0000 (15:42 -0400)]
[libc++] Run tests in a directory related to %t instead of /tmp
Instead of creating a temporary directory inside /tmp and running the
tests there, use a directory name based on LIT's %t substitution. This
has the benefit of not hitting /tmp so much (which is slow on some
filesystems). It also has the benefit that `ninja -C build clean` will
automatically remove the artifacts even if a test somehow failed to
remove its temporary directory (I've seen this happen when CTRL-C is
received).
George Burgess IV [Tue, 7 Apr 2020 20:03:18 +0000 (13:03 -0700)]
[TLI] fix a function's (commented) signature; NFC
__strlen_chk returns a `size_t`, not a `char *`.
Matt Arsenault [Tue, 7 Apr 2020 18:50:47 +0000 (14:50 -0400)]
CodeGen: Use Register in more places
Wei Mi [Tue, 7 Apr 2020 19:54:51 +0000 (12:54 -0700)]
Revert "[SampleFDO] Add flag for partial profile." show-prof-info.test breaks on some platforms.
This reverts commit
e3ba652a1440794eff0b43ce747f1b0488585d22.
River Riddle [Tue, 7 Apr 2020 19:44:22 +0000 (12:44 -0700)]
[mlir][Diagnostic] Don't store Operation arguments as a DiagnosticArgument
Summary: Diagnostics may be cached in the parallel diagnostic handler to preserve proper ordering. Storing the Operation as a DiagnosticArgument is problematic as the operation may be erased or changed before it finally gets printed.
Differential Revision: https://reviews.llvm.org/D77675
Alexey Bataev [Tue, 7 Apr 2020 19:44:15 +0000 (15:44 -0400)]
[OPENMP][DOCS]Update status of oimplemented constructs, NFC.
Davide Italiano [Tue, 7 Apr 2020 19:41:31 +0000 (12:41 -0700)]
[ScriptInterpreterPython] Remove buggy code to save/restore stdin.
Discussed on lldb-dev with Pavel Labath. This doesn't work for
background processes [causes Python to be stuck forever], and it's
unclear whether it's needed. There's no test, also. If this turns
out to be useful, it can be recommitted with a functional implementation
and a test.
Johannes Doerfert [Tue, 7 Apr 2020 16:26:40 +0000 (11:26 -0500)]
[OpenMP] "UnFix" layering problem with FrontendOpenMP
This reverts commit
97aa593a8387586095b7eac12974ba2fdd08f4c3 as it
causes problems (PR45453) https://reviews.llvm.org/D77574#
1966321.
This additionally adds an explicit reference to FrontendOpenMP to
clang-tidy where ASTMatchers is used.
This is hopefully just a temporary solution. The dependence on
`FrontendOpenMP` from `ASTMatchers` should be handled by CMake
implicitly, not us explicitly.
Reviewed By: aheejin
Differential Revision: https://reviews.llvm.org/D77666