platform/upstream/llvm.git
3 years agoSet the target branch for `arc land` to main
Mehdi Amini [Mon, 7 Dec 2020 21:57:32 +0000 (21:57 +0000)]
Set the target branch for `arc land` to main

3 years ago[CSSPGO][llvm-profgen] Context-sensitive profile data generation
wlei [Mon, 19 Oct 2020 19:55:59 +0000 (12:55 -0700)]
[CSSPGO][llvm-profgen] Context-sensitive profile data generation

This stack of changes introduces `llvm-profgen` utility which generates a profile data file from given perf script data files for sample-based PGO. It’s part of(not only) the CSSPGO work. Specifically to support context-sensitive with/without pseudo probe profile, it implements a series of functionalities including perf trace parsing, instruction symbolization, LBR stack/call frame stack unwinding, pseudo probe decoding, etc. Also high throughput is achieved by multiple levels of sample aggregation and compatible format with one stop is generated at the end. Please refer to: https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s for the CSSPGO RFC.

This change supports context-sensitive profile data generation into llvm-profgen. With simultaneous sampling for LBR and call stack, we can identify leaf of LBR sample with calling context from stack sample . During the process of deriving fall through path from LBR entries, we unwind LBR by replaying all the calls and returns (including implicit calls/returns due to inlining) backwards on top of the sampled call stack. Then the state of call stack as we unwind through LBR always represents the calling context of current fall through path.

we have two types of virtual unwinding 1) LBR unwinding and 2) linear range unwinding.
Specifically, for each LBR entry which can be classified into call, return, regular branch, LBR unwinding will replay the operation by pushing, popping or switching leaf frame towards the call stack and since the initial call stack is most recently sampled, the replay should be in anti-execution order, i.e. for the regular case, pop the call stack when LBR is call, push frame on call stack when LBR is return. After each LBR processed, it also needs to align with the next LBR by going through instructions from previous LBR's target to current LBR's source, which we named linear unwinding. As instruction from linear range can come from different function by inlining, linear unwinding will do the range splitting and record counters through the range with same inline context.

With each fall through path from LBR unwinding, we aggregate each sample into counters by the calling context and eventually generate full context sensitive profile (without relying on inlining) to driver compiler's PGO/FDO.

A breakdown of noteworthy changes:
- Added `HybridSample` class as the abstraction perf sample including LBR stack and call stack
* Extended `PerfReader` to implement auto-detect whether input perf script output contains CS profile, then do the parsing. Multiple `HybridSample` are extracted
* Speed up by aggregating  `HybridSample` into `AggregatedSamples`
* Added VirtualUnwinder that consumes aggregated  `HybridSample` and implements unwinding of calls, returns, and linear path that contains implicit call/return from inlining. Ranges and branches counters are aggregated by the calling context.
 Here calling context is string type, each context is a pair of function name and callsite location info, the whole context is like `main:1 @ foo:2 @ bar`.
* Added PorfileGenerater that accumulates counters by ranges unfolding or branch target mapping, then generates context-sensitive function profile including function body, inferring callee's head sample, callsite target samples, eventually records into ProfileMap.

* Leveraged LLVM build-in(`SampleProfWriter`) writer to support different serialization format with no stop
- `getCanonicalFnName` for callee name and name from ELF section
- Added regression test for both unwinding and profile generation

Test Plan:
ninja & ninja check-llvm

Reviewed By: hoy, wenlei, wmi

Differential Revision: https://reviews.llvm.org/D89723

3 years ago[CodeGen][MSan] Don't use offsets of zero-sized fields
Vitaly Buka [Sat, 5 Dec 2020 07:47:11 +0000 (23:47 -0800)]
[CodeGen][MSan] Don't use offsets of zero-sized fields

Such fields will likely have offset zero making
__sanitizer_dtor_callback poisoning wrong regions.
E.g. it can poison base class member from derived class constructor.

Differential Revision: https://reviews.llvm.org/D92727

3 years ago[OpenMPIRBuilder] introduce createStaticWorkshareLoop
Alex Zinenko [Wed, 2 Dec 2020 11:53:12 +0000 (12:53 +0100)]
[OpenMPIRBuilder] introduce createStaticWorkshareLoop

Introduce a function that creates a statically-scheduled workshare loop
out of a canonical loop created earlier by the OpenMPIRBuilder. This
basically amounts to injecting runtime calls to the preheader and the
after block and updating the trip count. Static scheduling kind is
currently hardcoded and needs to be extracted from the runtime library
into common TableGen definitions.

Differential Revision: https://reviews.llvm.org/D92476

3 years ago[Polly][CodeGen] Remove use of ScalarEvolution.
Michael Kruse [Mon, 7 Dec 2020 20:39:32 +0000 (14:39 -0600)]
[Polly][CodeGen] Remove use of ScalarEvolution.

ScalarEvolution::getSCEV cannot be used during codegen. ScalarEvolution
assumes a stable IR and control flow which is under construction during
Polly's CodeGen. In particular, it uses DominatorTree for compute the
backedge taken count. However the DominatorTree is not updated during
codegen.

In this case, SCEV was used to determine the base pointer of an array
access. Replace it by our own function. Polly generates only GEP and
BitCasts for array acceses, i.e. it is sufficient to handle these to to
find the base pointer.

Fixes llvm.org/PR48422

3 years ago[CodeView] Fix inline sites that are missing code offsets.
Amy Huang [Thu, 3 Dec 2020 17:03:55 +0000 (09:03 -0800)]
[CodeView] Fix inline sites that are missing code offsets.

When an inline site has a starting code offset of 0, we sometimes
don't emit the starting offset.

Bug: https://bugs.llvm.org/show_bug.cgi?id=48377

Differential Revision: https://reviews.llvm.org/D92590

3 years agodocs: Add pointer to cmake caches for PGO
Nico Weber [Mon, 7 Dec 2020 16:29:25 +0000 (11:29 -0500)]
docs: Add pointer to cmake caches for PGO

Also add a link to end-user PGO documentation.

Differential Revision: https://reviews.llvm.org/D92768

3 years agoAdd new 'preferred_name' attribute.
Richard Smith [Thu, 12 Nov 2020 01:12:18 +0000 (17:12 -0800)]
Add new 'preferred_name' attribute.

This attribute permits a typedef to be associated with a class template
specialization as a preferred way of naming that class template
specialization. This permits us to specify that (for example) the
preferred way to express 'std::basic_string<char>' is as 'std::string'.

The attribute is applied to the various class templates in libc++ that have
corresponding well-known typedef names.

Differential Revision: https://reviews.llvm.org/D91311

3 years ago[AArch64] Fix some minor coding style issues in AArch64CompressJumpTables
Amara Emerson [Mon, 7 Dec 2020 20:47:28 +0000 (12:47 -0800)]
[AArch64] Fix some minor coding style issues in AArch64CompressJumpTables

3 years ago[llvm][NFC] Made RefCountBase constructors protected
Nathan James [Mon, 7 Dec 2020 20:23:11 +0000 (20:23 +0000)]
[llvm][NFC] Made RefCountBase constructors protected

Matches ThreadSafeRefCountBase and forces the class to be inherited.

3 years ago[llvm] Add asserts in (ThreadSafe)?RefCountedBase destructors
Nathan James [Mon, 7 Dec 2020 20:20:08 +0000 (20:20 +0000)]
[llvm] Add asserts in (ThreadSafe)?RefCountedBase destructors

Added a trivial destructor in release mode and in debug mode a destructor that asserts RefCount is indeed zero.
This ensure people aren't manually (maybe accidentally) destroying these objects like in this contrived example.
```lang=c++
{
  std::unique_ptr<SomethingRefCounted> Object;
  holdIntrusiveOwnership(Object.get());
  // Object Destructor called here will assert.
}
```

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D92480

3 years ago[WebAssembly] Add Object and ObjectWriter support for wasm COMDAT sections
Derek Schuff [Fri, 4 Dec 2020 21:45:42 +0000 (13:45 -0800)]
[WebAssembly] Add Object and ObjectWriter support for wasm COMDAT sections

Allow sections to be placed into COMDAT groups, in addtion to functions and data
segments.

Also make section symbols unnamed, which allows sections with identical names
(section names are independent of their section symbols, but previously we
gave the symbols the same name as their sections, which results in collisions
when sections are identically-named).

Differential Revision: https://reviews.llvm.org/D92691

3 years ago[SLP] fix typo in debug string; NFC
Sanjay Patel [Mon, 7 Dec 2020 20:09:21 +0000 (15:09 -0500)]
[SLP] fix typo in debug string; NFC

3 years ago[mlir][sparse] hoist loop invariant tensor loads in sparse compiler
Aart Bik [Mon, 7 Dec 2020 19:54:58 +0000 (11:54 -0800)]
[mlir][sparse] hoist loop invariant tensor loads in sparse compiler

After bufferization, the backend has much more trouble hoisting loop invariant
loads from the loops generated by the sparse compiler. Therefore, this is done
during sparse code generation. Note that we don't bother hoisting derived
invariant expressions on SSA values, since the backend does that very well.

Still TBD: scalarize reductions to avoid load-add-store cycles

Reviewed By: penpornk

Differential Revision: https://reviews.llvm.org/D92534

3 years agoStop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo
Erich Keane [Mon, 7 Dec 2020 19:27:01 +0000 (11:27 -0800)]
Stop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo

As reported in PR48177, the type-deduction extraction ends up going into
an infinite loop when the type referred to has a recursive definition.
This stops recursing and just substitutes the type-source-info the
TypeLocBuilder identified when transforming the base.

3 years ago[LV] Epilogue Vectorization with Optimal Control Flow - Default Enablement
Bardia Mahjour [Mon, 7 Dec 2020 19:23:52 +0000 (14:23 -0500)]
[LV] Epilogue Vectorization with Optimal Control Flow - Default Enablement

This patch enables epilogue vectorization by default per reviewer requests.

Differential Revision: https://reviews.llvm.org/D89566

3 years ago[analyzer] Ignore annotations if func is inlined.
Yu Shan [Mon, 7 Dec 2020 18:58:44 +0000 (10:58 -0800)]
[analyzer] Ignore annotations if func is inlined.

When we annotating a function header so that it could be used by other
TU, we also need to make sure the function is parsed correctly within
the same TU. So if we can find the function's implementation,
ignore the annotations, otherwise, false positive would occur.
Move the escape by value case to post call and do not escape the handle
if the function is inlined and we have analyzed the handle.

Differential Revision: https://reviews.llvm.org/D91902

3 years ago[flang][openacc] Add clause validity tests for the kernels directive
Valentin Clement [Mon, 7 Dec 2020 19:26:50 +0000 (14:26 -0500)]
[flang][openacc] Add clause validity tests for the kernels directive

Add some clause validity tests for the kernels directive

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91873

3 years ago[AMDGPU] Annotate vgpr<->agpr spills in asm
Stanislav Mekhanoshin [Wed, 25 Nov 2020 20:30:43 +0000 (12:30 -0800)]
[AMDGPU] Annotate vgpr<->agpr spills in asm

Differential Revision: https://reviews.llvm.org/D92125

3 years ago[libc++] [docs] Mark LWG3055 as complete. Use string_view instead of string in path...
Marek Kurdej [Mon, 7 Dec 2020 19:07:25 +0000 (20:07 +0100)]
[libc++] [docs] Mark LWG3055 as complete. Use string_view instead of string in path::operator+=(ECharT).

The issue didn't change the behaviour which is tested in libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp.

The change to use string_view instead of string is not strictly necessary.

<filesystem> was added in commit 998a5c88312066fcc2b2de1358edc76587611354 (Implement <filesystem>).

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D92731

3 years ago[ConstraintElimination] Tweak placement in pipeline.
Florian Hahn [Mon, 7 Dec 2020 18:14:57 +0000 (18:14 +0000)]
[ConstraintElimination] Tweak placement in pipeline.

This patch adds the ConstraintElimination pass to the LTO pipeline and
also runs it after SCCP in the function simplification pipeline.

This increases the number of cases we can elimination. Pending further
tuning.

3 years agoFix missing error for use of 128-bit integer inside SPIR64 device code.
Jennifer Yu [Fri, 4 Dec 2020 22:54:12 +0000 (14:54 -0800)]
Fix missing error for use of 128-bit integer inside SPIR64 device code.
Emit error for use of 128-bit integer inside device code had been
already implemented in https://reviews.llvm.org/D74387.  However,
the error is not emitted for SPIR64, because for SPIR64, hasInt128Type
return true.

hasInt128Type: is also used to control generation of certain 128-bit
predefined macros, initializer predefined 128-bit integer types and
build 128-bit ArithmeticTypes.  Except predefined macros, only the
device target is considered, since error only emit when 128-bit
integer is used inside device code, the host target (auxtarget) also
needs to be considered.

The change address:
1. (SPIR.h) Correct hasInt128Type() for SPIR targets.
2. Sema.cpp and SemaOverload.cpp: Add additional check to consider host
   target(auxtarget) when call to hasInt128Type.  So that __int128_t
   and __int128() are allowed to avoid error when they used outside
   device code.
3. SemaType.cpp: add check for SYCLIsDevice to delay the error message.
   The error will be emitted if the use of 128-bit integer in the device
   code.

   Reviewed By: Johannes Doerfert and Aaron Ballman

   Differential Revision: https://reviews.llvm.org/D92439

3 years ago[PowerPC] Exploitation of xxeval instruction for AND and NAND
Stefan Pintilie [Mon, 7 Dec 2020 18:36:04 +0000 (12:36 -0600)]
[PowerPC] Exploitation of xxeval instruction for AND and NAND

The xxeval instruction was intorduced in Power PC in Power 10.
The instruction accepts three vector registers and an immediate.
Depending on the value of the immediate the instruction can be used
to perform certain bitwise boolean operations (and, or, xor, ...) on
the given vector registers.

This patch implements the AND and NAND patterns that can be used by
the instruction.

Reviewed By: nemanjai, #powerpc, bsaleil, NeHuang, jsji

Differential Revision: https://reviews.llvm.org/D92420

3 years ago[Sema] Make more overload candidate types use iterator_ranges (NFC)
Richard Sandiford [Mon, 7 Dec 2020 18:34:53 +0000 (18:34 +0000)]
[Sema] Make more overload candidate types use iterator_ranges (NFC)

I have a patch that adds another group of candidate types to
BuiltinCandidateTypeSet.  Currently two styles are in use: the older
begin/end pairs and the newer iterator_range approach.  I think the
group of candidates that I want to add should use iterator ranges,
but I'd also like to consolidate the handling of the new candidates
with some existing code that uses begin/end pairs.  This patch therefore
converts the begin/end pairs to iterator ranges as a first step.

No functional change intended.

Differential Revision: https://reviews.llvm.org/D92222

3 years ago[RISCV] Form GORCI from (or (rotl/rotr X, Bitwidth/2), X).
Craig Topper [Mon, 7 Dec 2020 17:45:06 +0000 (09:45 -0800)]
[RISCV] Form GORCI from (or (rotl/rotr X, Bitwidth/2), X).

A rotate by half the bitwidth swaps the bottom and top half which is the same as one of the MSB GREVI stage.

We have to do this as a special combine because we prefer to keep (rotl/rotr X, BitWidth/2) as a rotate rather than a single stage GREVI.

Differential Revision: https://reviews.llvm.org/D92286

3 years ago[X86] Fix static analyzer warnings. NFCI.
Simon Pilgrim [Mon, 7 Dec 2020 18:20:22 +0000 (18:20 +0000)]
[X86] Fix static analyzer warnings. NFCI.

Replace '|' with '||' in condition, and fix case of SignedMode variable.

3 years ago[DAG] Cleanup by folding some single use VT.getScalarSizeInBits() calls into its...
Simon Pilgrim [Mon, 7 Dec 2020 18:14:26 +0000 (18:14 +0000)]
[DAG] Cleanup by folding some single use VT.getScalarSizeInBits() calls into its comparison. NFCI.

3 years ago[IPO] Fix operator precedence warning. NFCI.
Simon Pilgrim [Mon, 7 Dec 2020 18:10:24 +0000 (18:10 +0000)]
[IPO] Fix operator precedence warning. NFCI.

Check the entire assertion condition before && with the message.

3 years ago[SLP][Test] Add test for PR46983
Anton Afanasyev [Mon, 7 Dec 2020 14:27:13 +0000 (17:27 +0300)]
[SLP][Test] Add test for PR46983

3 years ago[OpenMP] NFC: comment adjusted
AndreyChurbanov [Mon, 7 Dec 2020 16:50:14 +0000 (19:50 +0300)]
[OpenMP] NFC: comment adjusted

3 years ago[Parse] Delete unused declarations
Fangrui Song [Mon, 7 Dec 2020 16:46:17 +0000 (08:46 -0800)]
[Parse] Delete unused declarations

3 years ago[MLIR][Affine] Add affine.for normalization support
Navdeep Kumar [Mon, 7 Dec 2020 09:27:51 +0000 (14:57 +0530)]
[MLIR][Affine] Add affine.for normalization support

Add support to normalize affine.for ops i.e., convert the lower bound to zero
and loop step to one. The Upper bound is set to the trip count of the loop.
The exact value of loopIV is calculated just inside the body of affine.for.
Currently loops with lower bounds having single result are supported. No such
restriction exists on upper bounds.

Differential Revision: https://reviews.llvm.org/D92233

3 years agoTest commit
Hans Wennborg [Mon, 7 Dec 2020 16:27:03 +0000 (17:27 +0100)]
Test commit

3 years ago[OpenMP] libomp: Fix possible NULL dereferences
AndreyChurbanov [Mon, 7 Dec 2020 16:09:07 +0000 (19:09 +0300)]
[OpenMP] libomp: Fix possible NULL dereferences

Check pointer returned by strchr, as it can be NULL in case of broken
format of input string. Introduced new function __kmp_str_loc_numbers
for fast parsing of numbers only in the location string.
Also made some cleanup of __kmp_str_loc_init declaration and usage:
- changed type of init_fname parameter to bool;
- changed input from true to false in places where fname is not used.

Differential Revision: https://reviews.llvm.org/D90962

3 years ago[libTooling] Add `describe` combinator for formatting AST nodes for diagnostics.
Yitzhak Mandelbaum [Fri, 4 Dec 2020 15:23:34 +0000 (15:23 +0000)]
[libTooling] Add `describe` combinator for formatting AST nodes for diagnostics.

This new stencil combinator is intended for use in diagnostics and the like.

Differential Revision: https://reviews.llvm.org/D92658

3 years ago[SLP]Merge reorder and reuse shuffles.
Alexey Bataev [Fri, 4 Dec 2020 17:53:59 +0000 (09:53 -0800)]
[SLP]Merge reorder and reuse shuffles.

It is possible to merge reuse and reorder shuffles and reduce the total
cost of the ivectorization tree/number of final instructions.

Differential Revision: https://reviews.llvm.org/D92668

3 years ago[ARM] Revert low overhead loops with calls before registry allocation.
David Green [Mon, 7 Dec 2020 15:44:40 +0000 (15:44 +0000)]
[ARM] Revert low overhead loops with calls before registry allocation.

This adds code to revert low overhead loops with calls in them before
register allocation. Ideally we would not create low overhead loops with
calls in them to begin with, but that can be difficult to always get
correct. If we want to try and glue together t2LoopDec and t2LoopEnd
into a single instruction, we need to ensure that no instructions use LR
in the loop. (Technically the final code can be better too, as it
doesn't need to use the same registers but that has not been optimized
for here, as reverting loops with calls is expected to be very rare).

It also adds a MVETailPredUtils.h header to share the revert code
between different passes, and provides a place to expand upon, with
RevertLoopWithCall becoming a place to perform other low overhead loop
alterations like removing copies or combining LoopDec and End into a
single instruction.

Differential Revision: https://reviews.llvm.org/D91273

3 years ago[libomptarget][amdgpu] Add plumbing to call into hostrpc lib, if linked
Jon Chesterfield [Mon, 7 Dec 2020 15:23:08 +0000 (15:23 +0000)]
[libomptarget][amdgpu] Add plumbing to call into hostrpc lib, if linked

3 years ago[WebAssembly][MC] Fix placement of table section
Andy Wingo [Mon, 30 Nov 2020 15:16:33 +0000 (16:16 +0100)]
[WebAssembly][MC] Fix placement of table section

The table section goes after functions.

Differential Revision: https://reviews.llvm.org/D92323

3 years ago[PowerPC][Clang] Remove QPX support
Jinsong Ji [Mon, 7 Dec 2020 14:50:45 +0000 (09:50 -0500)]
[PowerPC][Clang] Remove QPX support

Clean up QPX code in clang missed in https://reviews.llvm.org/D83915

Reviewed By: #powerpc, steven.zhang

Differential Revision: https://reviews.llvm.org/D92329

3 years ago[LLD] Search archives for symbol defs to override COMMON symbols.
Sean Fertile [Mon, 7 Dec 2020 14:28:17 +0000 (09:28 -0500)]
[LLD] Search archives for symbol defs to override COMMON symbols.

This patch changes the archive handling to enable the semantics needed
for legacy FORTRAN common blocks and block data. When we have a COMMON
definition of a symbol and are including an archive, LLD will now
search the members for global/weak defintions to override the COMMON
symbol. The previous LLD behavior (where a member would only be included
if it satisifed some other needed symbol definition) can be re-enabled with the
option '-no-fortran-common'.

Differential Revision: https://reviews.llvm.org/D86142

3 years agoRevert "[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action"
Michał Górny [Mon, 7 Dec 2020 14:57:44 +0000 (15:57 +0100)]
Revert "[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action"

This reverts commit 09b08833f301ea375137931d26b7193101f82ceb.

This code is wrong on Linux, and causes ld-linux and linux-vdso to be
reported twice.  I need to work on it more.

3 years ago[lld/mac] Make X86_64::getImplicitAddend not do heap allocations
Nico Weber [Mon, 7 Dec 2020 14:05:46 +0000 (09:05 -0500)]
[lld/mac] Make X86_64::getImplicitAddend not do heap allocations

Speeds up linking Chromium's base_unittests almost 10%. According to ministat:

    N           Min           Max        Median           Avg        Stddev
x   5    0.72193289    0.73073196    0.72560811    0.72565799  0.0032265649
+   5    0.64069581    0.67173195    0.65876389    0.65796089   0.011349451
Difference at 95.0% confidence
-0.0676971 +/- 0.0121682
-9.32906% +/- 1.67685%
(Student's t, pooled s = 0.00834328)

Differential Revision: https://reviews.llvm.org/D92734

3 years ago[SLP]Update test checks, NFC.
Alexey Bataev [Mon, 7 Dec 2020 14:11:28 +0000 (06:11 -0800)]
[SLP]Update test checks, NFC.

3 years ago[clang-tidy][NFC] Streamline CheckOptions error reporting.
Nathan James [Mon, 7 Dec 2020 14:05:49 +0000 (14:05 +0000)]
[clang-tidy][NFC] Streamline CheckOptions error reporting.

3 years ago[VE] Add vcp and vex intrinsic instructions
Kazushi (Jam) Marukawa [Mon, 7 Dec 2020 10:56:10 +0000 (19:56 +0900)]
[VE] Add vcp and vex intrinsic instructions

Add vcp and vex intrinsic instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92752

3 years ago[SVE][CodeGen] Call refineIndexType & refineUniformBase from visitMGATHER
Kerry McLaughlin [Mon, 7 Dec 2020 13:20:19 +0000 (13:20 +0000)]
[SVE][CodeGen] Call refineIndexType & refineUniformBase from visitMGATHER

The refineIndexType & refineUniformBase functions added by D90942 can also be used to
improve CodeGen of masked gathers.

These changes were split out from D91092

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D92319

3 years ago[MemProf] Fix a potential "permission denied" test failure on some systems.
Haojian Wu [Mon, 7 Dec 2020 13:02:21 +0000 (14:02 +0100)]
[MemProf] Fix a potential "permission denied" test failure on some systems.

NFC, to make the test more robost.

3 years ago[AMDGPU] Fix default value of glc for mubuf rtn atomics
Petar Avramovic [Mon, 7 Dec 2020 12:59:15 +0000 (13:59 +0100)]
[AMDGPU] Fix default value of glc for mubuf rtn atomics

Mubuf rtn atomics use GLC_1 thus default value for glc operand
should be -1, see https://reviews.llvm.org/D90730.
This allows us to report error when rtn atomic requires glc=1
but does not have glc operand in input.

Differential Revision: https://reviews.llvm.org/D92654

3 years ago[NFC][LoopIdiom] Reshuffle left-shift-until-bittest test coverage (D91038)
Roman Lebedev [Mon, 7 Dec 2020 12:15:33 +0000 (15:15 +0300)]
[NFC][LoopIdiom] Reshuffle left-shift-until-bittest test coverage (D91038)

3 years ago[SVE][CodeGen] Lower scalable masked gathers
Kerry McLaughlin [Mon, 7 Dec 2020 10:39:04 +0000 (10:39 +0000)]
[SVE][CodeGen] Lower scalable masked gathers

Lowers the llvm.masked.gather intrinsics (scalar plus vector addressing mode only)

Changes in this patch:
- Add custom lowering for MGATHER, using getGatherVecOpcode() to choose the appropriate
  gather load opcode to use.
- Improve codegen with refineIndexType/refineUniformBase, added in D90942
- Tests added for gather loads with 32 & 64-bit scaled & unscaled offsets.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D91092

3 years ago[clang-tidy][docs] Update check options with boolean values instead of non-zero/0/1
Nathan James [Mon, 7 Dec 2020 12:13:56 +0000 (12:13 +0000)]
[clang-tidy][docs] Update check options with boolean values instead of non-zero/0/1

Using bools instead of integers better conveys the expected value of the option.

Reviewed By: Eugene.Zelenko, aaron.ballman

Differential Revision: https://reviews.llvm.org/D92652

3 years agoAdd ability to load a FixedCompilationDatabase from a buffer.
Sam McCall [Fri, 4 Dec 2020 08:58:50 +0000 (09:58 +0100)]
Add ability to load a FixedCompilationDatabase from a buffer.

Previously, loading one from a file meant allowing the library to do the IO.
Clangd would prefer to do such IO itself (e.g. to allow caching).

Differential Revision: https://reviews.llvm.org/D92640

3 years ago[llvm-readobj/elf] - Refine the implementation of "printFunctionStackSize".
Georgii Rymar [Tue, 1 Dec 2020 14:00:03 +0000 (17:00 +0300)]
[llvm-readobj/elf] - Refine the implementation of "printFunctionStackSize".

This rewrites the logic to get rid of "ELFSymbolRef" API where possible.
This allowed to handle possible errors better, improve warnings reported and add new ones.
Also 'reportWarning' was replaced with 'reportUniqueWarning'

Differential revision: https://reviews.llvm.org/D92545

3 years ago[clangd] Fix windows slashes in project config diagnostics
Sam McCall [Mon, 7 Dec 2020 11:54:38 +0000 (12:54 +0100)]
[clangd] Fix windows slashes in project config diagnostics

3 years ago[clangd] Temporarily test that uncovered broken behavior on windows
Sam McCall [Mon, 7 Dec 2020 11:33:34 +0000 (12:33 +0100)]
[clangd] Temporarily test that uncovered broken behavior on windows

3 years ago[Test] Auto-update test checks
Max Kazantsev [Mon, 7 Dec 2020 11:33:07 +0000 (18:33 +0700)]
[Test] Auto-update test checks

3 years ago[VE] Add vrcp, vrsqrt, vcvt, vmrg, and vshf intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 11:33:02 +0000 (20:33 +0900)]
[VE] Add vrcp, vrsqrt, vcvt, vmrg, and vshf intrinsic instructions

Add vrcp, vrsqrt, vcvt, vmrg, and vshf intrinsic instructions and
regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92750

3 years ago[LLDB] fix error message for one-line breakpoint scripts
Pedro Tammela [Sun, 6 Dec 2020 14:30:57 +0000 (14:30 +0000)]
[LLDB] fix error message for one-line breakpoint scripts

LLDB is ignoring compilation errors for one-line breakpoint scripts.
This patch fixes the issues and now the error message of the
ScriptInterpreter is shown to the user.

I had to remove a new-line character for the Lua interpreter since it
was duplicated.

Differential Revision: https://reviews.llvm.org/D92729

3 years ago[IR] Bail out for scalable vectors in ShuffleVectorInst::isConcat
Cullen Rhodes [Mon, 30 Nov 2020 11:35:46 +0000 (11:35 +0000)]
[IR] Bail out for scalable vectors in ShuffleVectorInst::isConcat

Shuffle mask for concat can't be expressed for scalable vectors, so we
should bail out. A test has been added that previously crashed, also
tested isIdentityWithPadding and isIdentityWithExtract where we already
bail out.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D92475

3 years ago[IR] Support scalable vectors in ShuffleVectorInst::increasesLength
Cullen Rhodes [Mon, 30 Nov 2020 11:35:46 +0000 (11:35 +0000)]
[IR] Support scalable vectors in ShuffleVectorInst::increasesLength

Since the length of the llvm::SmallVector shufflemask is related to the
minimum number of elements in a scalable vector, it is fine to just get
the Min field of the ElementCount. This is already done for the similar
function changesLength, tests have been added for both.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D92472

3 years ago[PowerPC] [Clang] Enable float128 feature on P9 by default
Qiu Chaofan [Mon, 7 Dec 2020 10:31:00 +0000 (18:31 +0800)]
[PowerPC] [Clang] Enable float128 feature on P9 by default

As Power9 introduced hardware support for IEEE quad-precision FP type,
the feature should be enabled by default on Power9 or newer targets.

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D90213

3 years ago[VE] Add vfmad, vfmsb, vfnmad, and vfnmsb intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 11:26:44 +0000 (20:26 +0900)]
[VE] Add vfmad, vfmsb, vfnmad, and vfnmsb intrinsic instructions

Add vfmad, vfmsb, vfnmad, and vfnmsb intrinsic instructions and
regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92697

3 years ago[lldb] [test] Remove duplicate xfail for Testtypedef
Michał Górny [Mon, 7 Dec 2020 10:20:58 +0000 (11:20 +0100)]
[lldb] [test] Remove duplicate xfail for Testtypedef

The @expectedFailureAll(compiler="clang") decorator works correctly
on FreeBSD these days, so it is sufficient.

3 years ago[clangd] Publish config file errors over LSP
Sam McCall [Fri, 4 Dec 2020 23:39:21 +0000 (00:39 +0100)]
[clangd] Publish config file errors over LSP

We don't act as a language server for these files (e.g. don't get open/close
notifications for them), but just blindly publish diagnostics for them.

This works reasonably well in coc.nvim and vscode: they show up in the
workspace diagnostic list and when you open the file.
The only update after the file is reparsed, not as you type which is a bit
janky, but seems a lot better than nothing.

Fixes https://github.com/clangd/clangd/issues/614

Differential Revision: https://reviews.llvm.org/D92704

3 years ago[clangd] Add language metrics for recovery AST usage.
Haojian Wu [Mon, 7 Dec 2020 09:52:04 +0000 (10:52 +0100)]
[clangd] Add language metrics for recovery AST usage.

Differential Revision: https://reviews.llvm.org/D92157

3 years agoProvide default location of sysroot for Baremetal toolchain.
Hafiz Abid Qadeer [Mon, 7 Dec 2020 09:09:59 +0000 (09:09 +0000)]
Provide default location of sysroot for Baremetal  toolchain.

Currently, Baremetal toolchain requires user to pass a sysroot location
using a --sysroot flag. This is not very convenient for the user. It also
creates problem for toolchain vendors who don't have a fixed location to
put the sysroot bits.

Clang does provide 'DEFAULT_SYSROOT' which can be used by the toolchain
builder to provide the default location. But it does not work if toolchain
is targeting multiple targets e.g. arm-none-eabi/riscv64-unknown-elf which
clang is capable of doing.

This patch tries to solve this problem by providing a default location of
the toolchain if user does not explicitly provides --sysroot. The exact
location and name can be different but it should fulfill these conditions:

1. The sysroot path should have a target triple element so that multi-target
toolchain problem (as I described above) could be addressed.

2. The location should not be $TOP/$Triple as this is used by gcc generally
and will be a problem for installing both gcc and clang based toolchain at
the same location.

Reviewed By: jroelofs

Differential Revision: https://reviews.llvm.org/D92677

3 years ago[Lit] Fix flaky test on heavily loaded bots
Oliver Stannard [Mon, 7 Dec 2020 09:04:26 +0000 (09:04 +0000)]
[Lit] Fix flaky test on heavily loaded bots

On some of the slow or heavily-loaded bots, this test was failing
intermittently because the infinite_loop.py script might not emit
anything to stdout before the 1 second timeout, so the "Command Output"
line isn't present in the output. That output isn't really important to
this test, we just care that the process is killed, so we can just rmove
that check line from  the test.

Differential revision: https://reviews.llvm.org/D92563

3 years ago[lldb] [test] Fix continue_to_breakpoint() args in TestThreadStepOut
Michał Górny [Mon, 7 Dec 2020 08:31:35 +0000 (09:31 +0100)]
[lldb] [test] Fix continue_to_breakpoint() args in TestThreadStepOut

The test is skipped/xfailing on all platforms, so it seems that the API
got out of sync.  Fix that so it returns to a 'proper' failure
on FreeBSD.

Differential Revision: https://reviews.llvm.org/D92746

3 years ago[lldb] [Process/FreeBSDRemote] Implement GetLoadedModuleFileSpec() and GetFileLoadAdd...
Michał Górny [Mon, 30 Nov 2020 12:07:25 +0000 (13:07 +0100)]
[lldb] [Process/FreeBSDRemote] Implement GetLoadedModuleFileSpec() and GetFileLoadAddress()

Copy the Linux implementation of GetLoadedModuleFileSpec()
and GetFileLoadAddress() into NativeProcessFreeBSD.  This does not seem
to change anything at the moment but reducing the differences between
the plugins should help us in the long term.

Differential Revision: https://reviews.llvm.org/D92314

3 years ago[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action
Michał Górny [Fri, 4 Dec 2020 17:56:46 +0000 (18:56 +0100)]
[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action

Explicitly consider the libraries reported on the initial eTakeSnapshot
action added, through adding them to the added soentry list
in DYLDRendezvous::SaveSOEntriesFromRemote().  This is necessary
on FreeBSD since the dynamic loader issues only a single 'consistent'
state rendezvous breakpoint hit for all the libraries present
in DT_NEEDED (while Linux issues an added-consistent event pair).

Reenable memory maps on FreeBSD since this fixed the issue triggered
by them.

Differential Revision: https://reviews.llvm.org/D92187

3 years ago[lldb] [Platform/POSIX] Use gdb-remote plugin when attaching
Michał Górny [Fri, 4 Dec 2020 16:10:55 +0000 (17:10 +0100)]
[lldb] [Platform/POSIX] Use gdb-remote plugin when attaching

Force gdb-remote plugin when attaching using the derivatives
of PlatformPOSIX class.  This is consistent with the behavior
for launching processes (via DebugProcess() method) and guarantees
consistent plugin choice on FreeBSD.

Differential Revision: https://reviews.llvm.org/D92667

3 years ago[lldb] [test] Link FreeBSD test failures to bugs
Michał Górny [Fri, 27 Nov 2020 13:10:10 +0000 (14:10 +0100)]
[lldb] [test] Link FreeBSD test failures to bugs

Differential Revision: https://reviews.llvm.org/D92740

3 years ago[TableGen][SchedModels] Simplify the code. NFC
Evgeny Leviant [Mon, 7 Dec 2020 08:53:33 +0000 (11:53 +0300)]
[TableGen][SchedModels] Simplify the code. NFC

Differential revision: https://reviews.llvm.org/D92304

3 years ago[VE][compiler-rt] Support VE in clear_cache.c
Kazushi (Jam) Marukawa [Fri, 4 Dec 2020 23:13:04 +0000 (08:13 +0900)]
[VE][compiler-rt] Support VE in clear_cache.c

Support SX Aurora VE by __clear_cache() function.  This modification
allows VE to run written data, e.g. clear_cache_test.c under compiler-rt
test.  We still have code alignment problem in enable_execute_stack_test.c,
though.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92703

3 years ago[lldb/test] Refactor socket_packet_pump
Pavel Labath [Fri, 4 Dec 2020 16:45:58 +0000 (17:45 +0100)]
[lldb/test] Refactor socket_packet_pump

Now that the class does not use a thread, the name is no longer
appropriate. Rename the class to "Server" and make it a long-lived
object (instead of recreating it for every expect_gdbremote_sequence
call). The idea is to make this class a wrapper for all communication
with debug/lldb-server. This will enable some additional cleanups as we
had some duplication between socket_pump non-pump code paths.

Also squeeze in some small improvements:
- use python-level timeouts on sockets instead of the manual select
  calls
- use byte arrays instead of strings when working with raw packets

3 years ago[lldb/test] Simplify TestLldbGdbServer.py
Pavel Labath [Sun, 6 Dec 2020 19:39:38 +0000 (20:39 +0100)]
[lldb/test] Simplify TestLldbGdbServer.py

Reuse existing code to start server+inferior.

3 years ago[lldb/test] Simplify TestGdbRemoteExitCode.py
Pavel Labath [Sun, 6 Dec 2020 19:37:55 +0000 (20:37 +0100)]
[lldb/test] Simplify TestGdbRemoteExitCode.py

Reuse the existing code to launch a debug server + inferior.

3 years ago[CodeGen] Restore accessing __stack_chk_guard via a .refptr stub on mingw after 25184...
Martin Storsjö [Sun, 6 Dec 2020 20:28:33 +0000 (22:28 +0200)]
[CodeGen] Restore accessing __stack_chk_guard via a .refptr stub on mingw after 2518433f861fcb87

Add tests for this particular detail for x86 and arm (similar tests
already existed for x86_64 and aarch64).

The libssp implementation may be located in a separate DLL, and in
those cases, the references need to be in a .refptr stub, to avoid
needing to touch up code in the text section at runtime (which is
supported but inefficient for x86, and unsupported for arm).

Differential Revision: https://reviews.llvm.org/D92738

3 years ago[PATCH] github actions: Pepare main branch for being read/write
Mike Edwards [Mon, 7 Dec 2020 06:16:36 +0000 (22:16 -0800)]
[PATCH] github actions: Pepare main branch for being read/write

Patch provided by Tom Stellard <tstellar@redhat.com>

3 years ago[PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.
Esme-Yi [Mon, 7 Dec 2020 05:19:06 +0000 (05:19 +0000)]
[PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.

Summary: This patch added support for the intrinsics llvm.ppc.dcbfps and llvm.ppc.dcbstps.
dcbfps and dcbstps are actually extended mnemonics of dcbf.
dcbfps RA,RB ---> dcbf RA,RB,4
dcbstps RA,RB ---> dcbf RA,RB,6

Reviewed By: amyk, steven.zhang

Differential Revision: https://reviews.llvm.org/D91323

3 years ago[MLIR,OpenMP] Added support for lowering MasterOp to LLVMIR
Sourabh Singh Tomar [Tue, 20 Oct 2020 08:53:00 +0000 (14:23 +0530)]
[MLIR,OpenMP] Added support for lowering MasterOp to LLVMIR

Some Ops in OMP dialect have regions associated with them i.e
`ParallelOp` `MasterOp`. Lowering of these regions involves interfacing
with `OMPIRBuilder` using callbacks, yet there still exist opportunities
for sharing common code in between.

This patch factors out common code into a separate function and adds
support for lowering `MasterOp` using that. Lowering of `ParallelOp` is
also modified appropriately.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D87247

3 years agoSema.h: delete unused variables/functions/type aliases
Fangrui Song [Mon, 7 Dec 2020 04:39:01 +0000 (20:39 -0800)]
Sema.h: delete unused variables/functions/type aliases

3 years ago[Sema] Delete unused declarations
Fangrui Song [Mon, 7 Dec 2020 04:16:00 +0000 (20:16 -0800)]
[Sema] Delete unused declarations

Notes about some declarations:

* clang::Sema::endsWithnarrowing: deleted by rC148381
* clang::Sema::ConvertIntegerToTypeWarnOnOverflow: deleted by rC214678
* clang::Sema::FreePackedContext: deleted by rC268085
* clang::Sema::ComputeDefaulted*: deleted by rC296067

3 years ago[CSKY 2/n] Add basic tablegen infra for CSKY
Zi Xuan Wu [Mon, 7 Dec 2020 03:06:43 +0000 (11:06 +0800)]
[CSKY 2/n] Add basic tablegen infra for CSKY

This introduce basic tablegen infra such as CSKY{InstrFormats,InstrInfo,RegisterInfo,}.td.
For now, only add instruction definitions for basic CSKY ISA operations, and the instruction format and register info are almost complete.

Our initial target is a working MC layer rather than codegen, so appropriate SelectionDAG patterns will come later.

Differential Revision: https://reviews.llvm.org/D89180

3 years ago[PowerPC] Fix chain for i1-to-fp operation
Qiu Chaofan [Mon, 7 Dec 2020 02:38:56 +0000 (10:38 +0800)]
[PowerPC] Fix chain for i1-to-fp operation

A simple SELECT is used for converting i1 to floating types on ppc32,
but in constrained cases, the chain is not handled properly. This patch
will fix that.

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D92365

3 years ago[Coroutines] Add DW_OP_deref for transformed dbg.value intrinsic.
Jun Ma [Wed, 2 Dec 2020 06:45:15 +0000 (14:45 +0800)]
[Coroutines] Add DW_OP_deref for transformed dbg.value intrinsic.

Differential Revision: https://reviews.llvm.org/D92462

3 years ago[CodeGen] Modify the refineIndexType(...)'s code to fix a bug in D90942.
Bing1 Yu [Mon, 7 Dec 2020 00:35:45 +0000 (08:35 +0800)]
[CodeGen] Modify the refineIndexType(...)'s code to fix a bug in D90942.

In previous code, when refineIndexType(...) is called and Index is undef, Index.getOperand(0) will raise a assertion fail.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D92548

3 years ago[compiler-rt][AArch64] Put outline atomic helpers into dedicated dir.
Pavel Iliin [Sat, 5 Dec 2020 20:45:22 +0000 (20:45 +0000)]
[compiler-rt][AArch64] Put outline atomic helpers into dedicated dir.

Differential Revision: https://reviews.llvm.org/D92724

3 years ago[llvm-readobj] Delete unused declaration
Fangrui Song [Sun, 6 Dec 2020 23:54:17 +0000 (15:54 -0800)]
[llvm-readobj] Delete unused declaration

3 years ago[MC] Delete unused declarations
Fangrui Song [Sun, 6 Dec 2020 23:36:39 +0000 (15:36 -0800)]
[MC] Delete unused declarations

Notes:

* llvm::createAsmStreamer: it has been moved to TargetRegistry.h
* (anon ns)::WasmObjectWriter::updateCustomSectionRelocations: remnant of D46335
* COFFAsmParser::ParseSEHRegisterNumber: remnant of D66625
* llvm::CodeViewContext::isValidCVFileNumber: accidentally added by r279847

3 years ago[lld] Delete unused declarations
Fangrui Song [Sun, 6 Dec 2020 23:26:37 +0000 (15:26 -0800)]
[lld] Delete unused declarations

Notes:

* runMSVCLinker: remnant of r338615
* wasm markSymbol: remnant of r374275
* wasm addDataAddressGlobal: accidentally added by r372779
* MachO Writer::createSymtabContents: accidentally added by D76839

3 years ago[LoopIdiomRecognize] Merge a conditional operator with an earlier if and remove an...
Craig Topper [Sun, 6 Dec 2020 19:44:22 +0000 (11:44 -0800)]
[LoopIdiomRecognize] Merge a conditional operator with an earlier if and remove an extra temporary variable. NFC

The CountPrev variable was only used to forward a value from
the if statement to the conditional operator under the same
condition.

While there move some variable declarations to their first
assignment.

3 years ago[llvm-c] Delete unimplemented llvm-c/LinkTimeOptimizer.h
Fangrui Song [Sun, 6 Dec 2020 23:18:25 +0000 (15:18 -0800)]
[llvm-c] Delete unimplemented llvm-c/LinkTimeOptimizer.h

The file was added in 2007 but the functions have never been implemented.
Having the file can only cause confusion to existing C API (llvm-c/lto.h) users.

3 years ago[X86] Delete 3 unused declarations
Fangrui Song [Sun, 6 Dec 2020 23:13:39 +0000 (15:13 -0800)]
[X86] Delete 3 unused declarations

3 years ago[CodeGen] Delete 4 unused declarations
Fangrui Song [Sun, 6 Dec 2020 23:02:18 +0000 (15:02 -0800)]
[CodeGen] Delete 4 unused declarations

3 years ago[CodeGen] Delete 15 unused declarations
Fangrui Song [Sun, 6 Dec 2020 22:55:04 +0000 (14:55 -0800)]
[CodeGen] Delete 15 unused declarations

Notes about a few declarations:

* LiveVariables::RegisterDefIsDead: deleted by r47927
* createForwardControlFlowIntegrityPass, createJumpInstrTablesPass: deleted by r230780
* RegScavenger::setLiveInsUsed: deleted by r292543
* ScheduleDAGInstrs::{toggleKillFlag,startBlockForKills}: deleted by r304055
* Localizer::shouldLocalize: remnant of D75207
* DwarfDebug::addSectionLabel: deleted by r373273

3 years ago[TableGen] Delete 11 unused declarations
Fangrui Song [Sun, 6 Dec 2020 21:21:07 +0000 (13:21 -0800)]
[TableGen] Delete 11 unused declarations

3 years ago[Transforms] Delete unused declarations from NewGVN/CoroSplit/ValueMapper
Fangrui Song [Sun, 6 Dec 2020 21:04:01 +0000 (13:04 -0800)]
[Transforms] Delete unused declarations from NewGVN/CoroSplit/ValueMapper

3 years ago[ConstraintElimination] Bail out if system gets too big.
Florian Hahn [Sun, 6 Dec 2020 19:58:33 +0000 (19:58 +0000)]
[ConstraintElimination] Bail out if system gets too big.

For some inputs, the constraint system can grow quite large during
solving, because it replaces complex constraints with one or more
simpler constraints. This adds a cut-off to avoid compile-time explosion
on problematic inputs.