17 months agoDe-templatify EmitCallArgs argument type checking, NFCI
Reid Kleckner [Tue, 8 Dec 2020 21:54:34 +0000 (13:54 -0800)]
De-templatify EmitCallArgs argument type checking, NFCI

This template exists to abstract over FunctionPrototype and
ObjCMethodDecl, which have similar APIs for storing parameter types. In
place of a template, use a PointerUnion with two cases to handle this.
Hopefully this improves readability, since the type of the prototype is
easier to discover. This allows me to sink this code, which is mostly
assertions, out of the header file and into the cpp file. I can also
simplify the overloaded methods for computing isGenericMethod, and get
rid of the second EmitCallArgs overload.

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

17 months ago[lldb][NFC] Refactor _get_bool_config_skip_if_decorator
Raphael Isemann [Wed, 9 Dec 2020 19:02:00 +0000 (20:02 +0100)]
[lldb][NFC] Refactor _get_bool_config_skip_if_decorator

NFC preparation for another patch. Also add some documentation for why the
error value is true (and not false).

17 months ago[libomptarget][amdgpu] Improve diagnostics on arch mismatch
Jon Chesterfield [Wed, 9 Dec 2020 18:55:21 +0000 (18:55 +0000)]
[libomptarget][amdgpu] Improve diagnostics on arch mismatch

17 months agoLimit the recursion depth of SelectionDAG::isSplatValue()
Justin Bogner [Wed, 9 Dec 2020 18:33:59 +0000 (10:33 -0800)]
Limit the recursion depth of SelectionDAG::isSplatValue()

This method previously always recursively checked both the left-hand
side and right-hand side of binary operations for splatted (broadcast)
vector values to determine if the parent DAG node is a splat.

Like several other SelectionDAG methods, limit the recursion depth to
MaxRecursionDepth (6). This prevents stack overflow.
See also https://issuetracker.google.com/173785481

Patch by Nicolas Capens. Thanks!

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

17 months ago[MCJIT] Add cmake variables to customize ittapi git location and revision.
Alexey Bader [Wed, 9 Dec 2020 18:01:06 +0000 (21:01 +0300)]
[MCJIT] Add cmake variables to customize ittapi git location and revision.

To support llorg builds this patch provides the following changes:

1)  Added cmake variable ITTAPI_GIT_REPOSITORY to control the location of ITTAPI repository.
     Default value of ITTAPI_GIT_REPOSITORY is github location: https://github.com/intel/ittapi.git
     Also, the separate cmake variable ITTAPI_GIT_TAG was added for repo tag.
2)  Added cmake variable ITTAPI_SOURCE_DIR to control the place where the repo will be cloned.
     Default value of ITTAPI_SOURCE_DIR is build area: PROJECT_BINARY_DIR

Reviewed By: etyurin, bader

Patch by ekovanov.

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

17 months agoReland Pin -loop-reduce to legacy PM
Arthur Eubanks [Mon, 7 Dec 2020 23:25:43 +0000 (15:25 -0800)]
Reland Pin -loop-reduce to legacy PM

This was accidentally reverted by a later change.

LSR currently only runs in the codegen pass manager.
There are a couple issues with LSR and the NPM.
1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
bunch of tests' expected output. This is fixable with some time put in.
2) LSR doesn't preserve LCSSA. See
llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
off. Turning it on causes some code sinking out of loops to fail due to
SCEVExpander's inability to handle the newly created trivial PHI nodes in the
broken critical edge (I was looking at
I also tried simply just calling formLCSSA() at the end of LSR, but the extra
PHI nodes cause regressions in codegen tests.

We'll delay figuring these issues out until later.

This causes the number of check-llvm failures with -enable-new-pm true
by default to go from 60 to 29.

Reviewed By: asbirlea

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

17 months ago[CMake] Add llvm-profgen to LLVM_TEST_DEPENDS
Fangrui Song [Wed, 9 Dec 2020 17:34:51 +0000 (09:34 -0800)]
[CMake] Add llvm-profgen to LLVM_TEST_DEPENDS

Otherwise `check-llvm-*` may not rebuild llvm-profgen, causing llvm-profgen tests
to fail if llvm-profgen happens to be stale.

17 months ago[lldb] Track the API boundary using a thread_local variable.
Jonas Devlieghere [Tue, 8 Dec 2020 04:59:13 +0000 (20:59 -0800)]
[lldb] Track the API boundary using a thread_local variable.

The reproducers currently use a static variable to track the API
boundary. This is obviously incorrect when the SB API is used
concurrently. While I do not plan to support that use-case (right now),
I do want to avoid us crashing. As a first step, correctly track API
boundaries across multiple threads.

Before this patch SB API calls made by the embedded script interpreter
would be considered "behind the API boundary" and correctly ignored.
After this patch, we need to tell the reproducers to ignore the
scripting thread as a "private thread".

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

Arthur Eubanks [Tue, 8 Dec 2020 18:21:17 +0000 (10:21 -0800)]

Reviewed By: hans

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

17 months ago[FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms
Mircea Trofin [Tue, 1 Dec 2020 18:00:11 +0000 (10:00 -0800)]
[FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms

Explicitly opt-out llvm/test/Transforms/Attributor.

Verified by flipping the default value of allow-unused-prefixes and
observing that none of the failures were under llvm/test/Transforms.

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

17 months ago[clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Tue, 1 Dec 2020 11:48:41 +0000 (12:48 +0100)]
[clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This is a step towards making compile_commands.json reloadable.

The idea is:
 - in addition to rare CDB loads we're soon going to have somewhat-rare CDB
   reloads and fairly-common stat() of files to validate the CDB
 - so stop doing all our work under a big global lock, instead using it to
   acquire per-directory structures with their own locks
 - each directory can be refreshed from disk every N seconds, like filecache
 - avoid locking these at all in the most common case: directory has no CDB

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

17 months ago[libc++] Run back-deployment CI on macOS 10.15 instead of 10.14
Louis Dionne [Wed, 9 Dec 2020 14:58:25 +0000 (09:58 -0500)]
[libc++] Run back-deployment CI on macOS 10.15 instead of 10.14

The goal was to add coverage for back-deployment over the filesystem
library, but it was added in macOS 10.15, not 10.14.

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

17 months ago[gn build] Port b804eef0905
LLVM GN Syncbot [Wed, 9 Dec 2020 16:19:07 +0000 (16:19 +0000)]
[gn build] Port b804eef0905

17 months ago[gn build] Port ac7864ec019
LLVM GN Syncbot [Wed, 9 Dec 2020 16:19:07 +0000 (16:19 +0000)]
[gn build] Port ac7864ec019

17 months ago[gn build] Port 5934a79196b
LLVM GN Syncbot [Wed, 9 Dec 2020 16:19:06 +0000 (16:19 +0000)]
[gn build] Port 5934a79196b

17 months ago[clangd] Split tweak tests into one file per tweak.
Adam Czachorowski [Wed, 9 Dec 2020 15:22:10 +0000 (16:22 +0100)]
[clangd] Split tweak tests into one file per tweak.

No changes to the tests themselves, other than some auto -> const auto
diagnostic fixes and formatting.

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

17 months ago[VE] Add vsum and vfsum intrinsic instructions
Kazushi (Jam) Marukawa [Mon, 7 Dec 2020 11:33:20 +0000 (20:33 +0900)]
[VE] Add vsum and vfsum intrinsic instructions

Add vsum and vfsum intrinsic instructions and regression tests.

Reviewed By: simoll

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

17 months ago[TableGen] Cache the vectors of records returned by getAllDerivedDefinitions().
Paul C. Anagnostopoulos [Thu, 3 Dec 2020 14:58:37 +0000 (09:58 -0500)]
[TableGen] Cache the vectors of records returned by getAllDerivedDefinitions().

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

17 months ago[VectorCombine] allow peeking through an extractelt when creating a vector load
Sanjay Patel [Wed, 9 Dec 2020 15:35:12 +0000 (10:35 -0500)]
[VectorCombine] allow peeking through an extractelt when creating a vector load

This is an enhancement to load vectorization that is motivated by
a pattern in https://llvm.org/PR16739.
Unfortunately, it's still not enough to make a difference there.
We will have to handle multi-use cases in some better way to avoid
creating multiple overlapping loads.

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

17 months ago[InstCombine] canonicalizeSaturatedAdd(): last fold is only valid for strict comparis...
Roman Lebedev [Wed, 9 Dec 2020 15:04:08 +0000 (18:04 +0300)]
[InstCombine] canonicalizeSaturatedAdd(): last fold is only valid for strict comparison (PR48390)

We could create uadd.sat under incorrect circumstances
if a select with -1 as the false value was canonicalized
by swapping the T/F values. Unlike the other transforms
in the same function, it is not invariant to equality.

Some alive proofs: https://alive2.llvm.org/ce/z/emmKKL

Based on original patch by David Green!

Fixes https://bugs.llvm.org/show_bug.cgi?id=48390

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

17 months ago[NFC][InstCombine] Add test coverage for @llvm.uadd.sat canonicalization
Roman Lebedev [Wed, 9 Dec 2020 14:51:32 +0000 (17:51 +0300)]
[NFC][InstCombine] Add test coverage for @llvm.uadd.sat canonicalization

The non-strict variants are already handled because they are canonicalized
to strict variants by swapping hands in both the select and icmp,
and the fold simply considers that strictness is irrelevant here.

But that isn't actually true for the last pattern, as PR48390 reports.

17 months ago[VE] Add vfmk intrinsic instructions
Kazushi (Jam) Marukawa [Mon, 7 Dec 2020 11:17:36 +0000 (20:17 +0900)]
[VE] Add vfmk intrinsic instructions

Add vfmk intrinsic instructions, a few pseudo instructions to expand
vfmk intrinsic using VM512 correctly, and regression tests.

Reviewed By: simoll

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

17 months ago[LLD][ELF] Fix typo in relocation-model-pic.ll
Yvan Roux [Wed, 9 Dec 2020 14:31:49 +0000 (15:31 +0100)]
[LLD][ELF] Fix typo in relocation-model-pic.ll

Should fix non-x86 bot failures.

17 months ago[X86] Fold CONCAT(VPERMV3(X,Y,M0),VPERMV3(Z,W,M1)) -> VPERMV3(CONCAT(X,Z),CONCAT...
Simon Pilgrim [Tue, 8 Dec 2020 18:35:23 +0000 (18:35 +0000)]

Further prep work toward supporting different subvector sizes in combineX86ShufflesRecursively

17 months ago[DFSan] Add custom wrapper for epoll_wait.
Matt Morehouse [Wed, 9 Dec 2020 14:05:12 +0000 (06:05 -0800)]
[DFSan] Add custom wrapper for epoll_wait.

The wrapper clears shadow for any events written.

Reviewed By: stephan.yichao.zhao

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

17 months ago[LLDB] Temporarily incrase DEFAULT_TIMEOUT on gdbremote_testcase.py
Muhammad Omair Javaid [Wed, 9 Dec 2020 13:39:40 +0000 (18:39 +0500)]
[LLDB] Temporarily incrase DEFAULT_TIMEOUT on gdbremote_testcase.py

TestLldbGdbServer.py testcases are timing out on LLDB/AArch64 Linux
buildbot since recent changes. I am temporarily increasing
DEFAULT_TIMEOUT to 20 seconds to see impact.

17 months ago[SLP] Use the width of value truncated just before storing
Anton Afanasyev [Tue, 8 Dec 2020 09:51:45 +0000 (12:51 +0300)]
[SLP] Use the width of value truncated just before storing

For stores chain vectorization we choose the size of vector
elements to ensure we fit to minimum and maximum vector register
size for the number of elements given. This patch corrects vector
element size choosing the width of value truncated just before
storing instead of the width of value stored.

Fixes PR46983

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

17 months ago[Debuginfo] [CSInfo] Do not create CSInfo for undef arguments
Djordje Todorovic [Wed, 9 Dec 2020 11:46:30 +0000 (12:46 +0100)]
[Debuginfo] [CSInfo] Do not create CSInfo for undef arguments

If a function parameter is marked as "undef", prevent creation
of CallSiteInfo for that parameter.
Without this patch, the parameter's call_site_value would be incorrect.
The incorrect call_value case reported in PR39716,
addressed in D85111.

Patch by Nikola Tesic

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

17 months ago[SVE][CodeGen] Add DAG combines for s/zext_masked_gather
Kerry McLaughlin [Wed, 9 Dec 2020 11:21:51 +0000 (11:21 +0000)]
[SVE][CodeGen] Add DAG combines for s/zext_masked_gather

This patch adds the following DAGCombines, which apply if isVectorLoadExtDesirable() returns true:
 - fold (and (masked_gather x)) -> (zext_masked_gather x)
 - fold (sext_inreg (masked_gather x)) -> (sext_masked_gather x)

LowerMGATHER has also been updated to fetch the LoadExtType associated with the
gather and also use this value to determine the correct masked gather opcode to use.

Reviewed By: sdesmalen

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

17 months ago[LoopVectorizer][SVE] Vectorize a simple loop with with a scalable VF.
Sander de Smalen [Tue, 8 Dec 2020 14:20:04 +0000 (14:20 +0000)]
[LoopVectorizer][SVE] Vectorize a simple loop with with a scalable VF.

* Steps are scaled by `vscale`, a runtime value.
* Changes to circumvent the cost-model for now (temporary)
  so that the cost-model can be implemented separately.

This can vectorize the following loop [1]:

   void loop(int N, double *a, double *b) {
     #pragma clang loop vectorize_width(4, scalable)
     for (int i = 0; i < N; i++) {
       a[i] = b[i] + 1.0;

[1] This source-level example is based on the pragma proposed
separately in D89031. This patch only implements the LLVM part.

Reviewed By: dmgreen

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

17 months ago[LoopVectorizer] NFC: Remove unnecessary asserts that VF cannot be scalable.
Sander de Smalen [Tue, 8 Dec 2020 14:19:52 +0000 (14:19 +0000)]
[LoopVectorizer] NFC: Remove unnecessary asserts that VF cannot be scalable.

This patch removes a number of asserts that VF is not scalable, even though
the code where this assert lives does nothing that prevents VF being scalable.

Reviewed By: dmgreen

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

17 months ago[SVE][CodeGen] Add the ExtensionType flag to MGATHER
Kerry McLaughlin [Wed, 9 Dec 2020 10:49:43 +0000 (10:49 +0000)]
[SVE][CodeGen] Add the ExtensionType flag to MGATHER

Adds the ExtensionType flag, which reflects the LoadExtType of a MaskedGatherSDNode.
Also updated SelectionDAGDumper::print_details so that details of the gather
load (is signed, is scaled & extension type) are printed.

Reviewed By: sdesmalen

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

17 months ago[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation. This...
Christian Sigg [Wed, 9 Dec 2020 10:50:18 +0000 (11:50 +0100)]
[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation. This is a preparation step to remove the corresponding methods from OpState.

Reviewed By: silvas, rriddle

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

17 months ago[SelectionDAG] Add llvm.vector.{extract,insert} intrinsics
Joe Ellis [Wed, 9 Dec 2020 11:05:51 +0000 (11:05 +0000)]
[SelectionDAG] Add llvm.vector.{extract,insert} intrinsics

This commit adds two new intrinsics.

- llvm.experimental.vector.insert: used to insert a vector into another
  vector starting at a given index.

- llvm.experimental.vector.extract: used to extract a subvector from a
  larger vector starting from a given index.

The codegen work for these intrinsics has already been completed; this
commit is simply exposing the existing ISD nodes to LLVM IR.

Reviewed By: cameron.mcinally

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

17 months ago[IR] Support scalable vectors in CastInst::CreatePointerCast
Cullen Rhodes [Wed, 2 Dec 2020 13:21:00 +0000 (13:21 +0000)]
[IR] Support scalable vectors in CastInst::CreatePointerCast

Reviewed By: sdesmalen

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

17 months ago[VP] Build VP SDNodes
Simon Moll [Wed, 9 Dec 2020 10:36:30 +0000 (11:36 +0100)]
[VP] Build VP SDNodes

Translate VP intrinsics to VP_* SDNodes.  The tests check whether a
matching vp_* SDNode is emitted.

Reviewed By: craig.topper

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

17 months ago[OpenMPIRBuilder] Put the barrier in the exit block in createWorkshapeLoop
Alex Zinenko [Tue, 8 Dec 2020 22:22:36 +0000 (23:22 +0100)]
[OpenMPIRBuilder] Put the barrier in the exit block in createWorkshapeLoop

The original code was inserting the barrier at the location given by the
caller. Make sure it is always inserted at the end of the loop exit block

Reviewed By: Meinersbur

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

17 months agoAArch64: use correct operand for ubsantrap immediate.
Tim Northover [Wed, 9 Dec 2020 10:13:36 +0000 (10:13 +0000)]
AArch64: use correct operand for ubsantrap immediate.

I accidentally pushed the wrong patch originally.

17 months ago[LLDB] Fix failing test dwp-separate-debug-file.cpp
Muhammad Omair Javaid [Wed, 9 Dec 2020 09:57:18 +0000 (14:57 +0500)]
[LLDB] Fix failing test dwp-separate-debug-file.cpp

Fix failure introduced by 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

17 months ago[lldb] Fix one more failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.
Haojian Wu [Wed, 9 Dec 2020 09:43:01 +0000 (10:43 +0100)]
[lldb] Fix one more failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

17 months ago[NFC][Instructions] Refactor CmpInst::getFlippedStrictnessPredicate() in terms of...
Roman Lebedev [Wed, 9 Dec 2020 08:37:52 +0000 (11:37 +0300)]
[NFC][Instructions] Refactor CmpInst::getFlippedStrictnessPredicate() in terms of is{,Non}StrictPredicate()/get{Non,}StrictPredicate()

In particular, this creates getStrictPredicate() method,
to be symmetrical with already-existing getNonStrictPredicate().

17 months ago[RISCV] Fix missing def operand when creating VSETVLI pseudos
Fraser Cormack [Tue, 8 Dec 2020 09:20:28 +0000 (09:20 +0000)]
[RISCV] Fix missing def operand when creating VSETVLI pseudos

The register operand was not being marked as a def when it should be. No tests
for this in the main branch as there are not yet any pseudos without a
non-negative VLIndex.

Also change the type of a virtual register operand from unsigned to Register
and adjust formatting.

Reviewed By: craig.topper

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

17 months agoRevert "[clang][cli] CompilerInvocationTest: add tests for boolean options"
Jan Svoboda [Wed, 9 Dec 2020 09:35:07 +0000 (10:35 +0100)]
Revert "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Differential Revision of original patch: https://reviews.llvm.org/D92774

17 months ago[llvm-readelf/obj] - Improve diagnostics when printing NT_FILE notes.
Georgii Rymar [Thu, 3 Dec 2020 14:14:05 +0000 (17:14 +0300)]
[llvm-readelf/obj] - Improve diagnostics when printing NT_FILE notes.

This changes the `printNotesHelper` to report warnings on its side when
there are errors when dumping notes.

With that we can provide more content when reporting warnings about broken notes.

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

17 months ago[MLIR] Expose target configuration for lowering to NVVM
Frederik Gossen [Tue, 8 Dec 2020 18:34:06 +0000 (19:34 +0100)]
[MLIR] Expose target configuration for lowering to NVVM

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

17 months ago[obj2yaml] - Support dumping objects that have multiple SHT_SYMTAB_SHNDX sections.
Georgii Rymar [Fri, 4 Dec 2020 10:23:26 +0000 (13:23 +0300)]
[obj2yaml] - Support dumping objects that have multiple SHT_SYMTAB_SHNDX sections.

It is allowed to have multiple `SHT_SYMTAB_SHNDX` sections, though
we currently don't implement it.

The current implementation assumes that there is a maximum of one SHT_SYMTAB_SHNDX
section and that it is always linked with .symtab section.

This patch drops this limitations.

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

17 months agoFix typo in llvm/lib/Target/README.txt
Siddhesh Poyarekar [Wed, 9 Dec 2020 08:29:06 +0000 (09:29 +0100)]
Fix typo in llvm/lib/Target/README.txt

Trivial typo, replace __builtin_objectsize with __builtin_object_size.

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

17 months ago[compiler-rt sanitizer] Use our own PTRACE_GETREGSET if it does not exist.
Jeroen Dobbelaere [Wed, 9 Dec 2020 08:59:47 +0000 (00:59 -0800)]
[compiler-rt sanitizer] Use our own PTRACE_GETREGSET if it does not exist.

On RH66 does not support 'PTRACE_GETREGSET'. This change makes this part of compiler-rt build again on older os-es

Reviewed By: vitalybuka

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

17 months ago[lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.
Haojian Wu [Wed, 9 Dec 2020 08:32:13 +0000 (09:32 +0100)]
[lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

The behavior of -gsplit-dwarf is changed because of the new commit.

Restore the old behavior by replacing -gsplit-dwarf with -gsplit-dwarf -g.

17 months ago[clang][cli] CompilerInvocationTest: add tests for boolean options
Jan Svoboda [Tue, 8 Dec 2020 11:29:14 +0000 (12:29 +0100)]
[clang][cli] CompilerInvocationTest: add tests for boolean options

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

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

17 months ago[clang][cli] CompilerInvocationTest: join and add test cases
Jan Svoboda [Tue, 8 Dec 2020 11:15:35 +0000 (12:15 +0100)]
[clang][cli] CompilerInvocationTest: join and add test cases

Depends on D92829.

Reviewed By: dexonsmith

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

17 months ago[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics
Jan Svoboda [Tue, 8 Dec 2020 09:52:31 +0000 (10:52 +0100)]
[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics

Depends on D92828.

Reviewed By: dexonsmith

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

17 months ago[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments
Jan Svoboda [Tue, 8 Dec 2020 09:44:03 +0000 (10:44 +0100)]
[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments

Depends on D92827.

Reviewed By: dexonsmith

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

17 months ago[clang][cli] CompilerInvocationTest: split enum test into two
Jan Svoboda [Tue, 8 Dec 2020 09:37:16 +0000 (10:37 +0100)]
[clang][cli] CompilerInvocationTest: split enum test into two

Depends on D92826.

Reviewed By: dexonsmith

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

17 months ago[clang][cli] CompilerInvocationTest: rename member variable in fixture
Jan Svoboda [Tue, 8 Dec 2020 09:31:12 +0000 (10:31 +0100)]
[clang][cli] CompilerInvocationTest: rename member variable in fixture

Depends on D92825.

Reviewed By: dexonsmith

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

17 months ago[clang][cli] CompilerInvocationTest: join two test fixtures into one
Jan Svoboda [Tue, 8 Dec 2020 09:28:18 +0000 (10:28 +0100)]
[clang][cli] CompilerInvocationTest: join two test fixtures into one

Reviewed By: dexonsmith

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

17 months ago[ARM] Common inverse constant predicates to VPNOT
David Green [Wed, 9 Dec 2020 07:56:45 +0000 (07:56 +0000)]
[ARM] Common inverse constant predicates to VPNOT

This scans through blocks looking for constants used as predicates in
MVE instructions. When two constants are found which are the inverse of
one another, the second can be replaced by a VPNOT of the first,
potentially allowing that not to be folded away into an else predicate
of a vpt block.

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

17 months ago[lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)
Dave Lee [Mon, 7 Dec 2020 18:38:14 +0000 (10:38 -0800)]
[lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)

`is_variadic_ptr` is unused.

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

17 months ago[ARM] Constant Mask VPT block tests. NFC
David Green [Wed, 9 Dec 2020 07:44:49 +0000 (07:44 +0000)]
[ARM] Constant Mask VPT block tests. NFC

17 months ago[RISCV] Use SDLoc created early in RISCVDAGToDAGISel::Select instead of recreating...
Craig Topper [Wed, 9 Dec 2020 05:12:34 +0000 (21:12 -0800)]
[RISCV] Use SDLoc created early in RISCVDAGToDAGISel::Select instead of recreating it in multiple cases in the switch. NFC

17 months ago[lldb] Fix -Wformat warning in debugserver unit test
Jonas Devlieghere [Wed, 9 Dec 2020 03:30:10 +0000 (19:30 -0800)]
[lldb] Fix -Wformat warning in debugserver unit test

RNBSocketTest.cpp:31:35: warning: format specifies type 'char *' but the
argument has type 'const void *' [-Wformat]

17 months ago[RISCV] Add a table showing the layout of the fields in VTYPE. Rename MaskedOffAgnost...
Craig Topper [Wed, 9 Dec 2020 04:40:15 +0000 (20:40 -0800)]
[RISCV] Add a table showing the layout of the fields in VTYPE. Rename MaskedOffAgnostic->MaskAgnostic. NFC

17 months ago[PowerPC] Set SubRegIndex offset for sub_vsx1/sub_pair1
Jinsong Ji [Wed, 9 Dec 2020 03:29:38 +0000 (22:29 -0500)]
[PowerPC] Set SubRegIndex offset for sub_vsx1/sub_pair1

We defined SubRegIndex for 256/512 regs,
but we did not set the offset for higher part,
so the offset of lower and higher part are the same.
This may cause problem in assessing ranges of SubReg,
it is great that this haven't affected any testcases,
but I think we should fix it to avoid hidden bugs in the future.

Reviewed By: bsaleil, #powerpc

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

17 months ago[PowerPC] Precommit testcases for regpressure compute fix
Jinsong Ji [Wed, 9 Dec 2020 03:15:45 +0000 (03:15 +0000)]
[PowerPC] Precommit testcases for regpressure compute fix

17 months agoFix MLIR Python bindings build after changes to the C API to use StringRef (NFC)
Mehdi Amini [Wed, 9 Dec 2020 03:26:37 +0000 (03:26 +0000)]
Fix MLIR Python bindings build after changes to the C API to use StringRef (NFC)

17 months ago[MemorySSA] Remove unused declaration determineInsertionPoint (NFC)
Kazu Hirata [Wed, 9 Dec 2020 03:21:44 +0000 (19:21 -0800)]
[MemorySSA] Remove unused declaration determineInsertionPoint (NFC)

The declaration was introduced without a corresponding definition on
Feb 2, 2016 in commit e1100f533f0a48f55e80e1152b06f5deab5f9b30.

17 months ago[IR] Use llvm::is_contained (NFC)
Kazu Hirata [Wed, 9 Dec 2020 03:06:37 +0000 (19:06 -0800)]
[IR] Use llvm::is_contained (NFC)

17 months ago[WebAssembly] Fix code generated for atomic operations in PIC mode
Sam Clegg [Mon, 7 Dec 2020 05:13:55 +0000 (21:13 -0800)]
[WebAssembly] Fix code generated for atomic operations in PIC mode

The main this this test does is to add the `IsNotPIC` predicate to the
all the atomic instructions pattern that directly refer to

This is because in PIC mode we need to generate separate instruction
sequence (either a direct global.get, or __memory_base + offset) for
accessing global addresses.

As part of this change I noticed that many of the `Requires` attributes
added to the instruction in `WebAssemblyInstrAtomics.td` were being
honored.  This is because the wrapped in a `let Predicates =
[HasAtomics]` block and it seems that that outer wrapping overrides any
`Requires` on defs within it.   As a workaround I removed the outer
`let` and added `HasAtomics` to all the inner `Requires`.  I believe
that all the instrucitons that don't have `Requires` explicit bottom out
in `ATOMIC_I` and `ATOMIC_NRI` which have `HasAtomics` so this should
not remove this predicate from any patterns (at least that is the idea).

The alternative to this approach looks like implementing something
like `PredicateControl` in `Mips.td` where we can split the predicates
into groups so they don't clobber each other.

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

17 months ago[NFC] Added test for PR33549
Dávid Bolvanský [Wed, 9 Dec 2020 02:20:02 +0000 (03:20 +0100)]
[NFC] Added test for PR33549

17 months agoBasic: Add hashing support for FileEntryRef and DirectoryEntryRef
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 22:25:44 +0000 (18:25 -0400)]
Basic: Add hashing support for FileEntryRef and DirectoryEntryRef

Allow hashing FileEntryRef and DirectoryEntryRef via `hash_value`, and
use that to implement `DenseMapInfo`. This hash should be equal whenever
the entry is the same (the name used to reference it is not relevant).

Also add `DirectoryEntryRef::isSameRef` to simplify the implementation
and facilitate testing.

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

17 months ago[PowerPC] prepare more dq form for P10 pair load/store
Chen Zheng [Tue, 1 Dec 2020 13:48:17 +0000 (08:48 -0500)]
[PowerPC] prepare more dq form for P10 pair load/store

Reviewed By: steven.zhang

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

17 months agoSupport: Add RedirectingFileSystem::create from simple list of redirections
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 04:03:38 +0000 (23:03 -0500)]
Support: Add RedirectingFileSystem::create from simple list of redirections

Add an overload of `RedirectingFileSystem::create` that builds a
redirecting filesystem off of a simple vector of string pairs. This is
intended to be used to support `clang::arcmt::FileRemapper` and

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

17 months agoVFS: Return new file systems as uniquely owned when possible, almost NFC
Duncan P. N. Exon Smith [Tue, 8 Dec 2020 22:58:46 +0000 (14:58 -0800)]
VFS: Return new file systems as uniquely owned when possible, almost NFC

Uniformly return uniquely-owned filesystems from VFS creation APIs. The
one exception is `getRealFileSystem`, which has a single instance and
needs to be shared.

This is almost NFC, except that it fixes a memory leak in

Depends on https://reviews.llvm.org/D92888

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

17 months agoADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC
Duncan P. N. Exon Smith [Tue, 8 Dec 2020 22:54:55 +0000 (14:54 -0800)]
ADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC

Allow a `std::unique_ptr` to be moved into the an `IntrusiveRefCntPtr`,
and remove a couple of now-unnecessary `release()` calls.

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

17 months ago[SampleFDO] Store fixed length MD5 in NameTable instead of using ULEB128 if
Wei Mi [Thu, 3 Dec 2020 20:19:25 +0000 (12:19 -0800)]
[SampleFDO] Store fixed length MD5 in NameTable instead of using ULEB128 if
MD5 is used.

Currently during sample profile loading, NameTable has to be loaded entirely
up front before any name string is retrieved. That is because NameTable is
stored using ULEB128 encoding and cannot be directly accessed like an array.
However, if MD5 is used to represent name in the NameTable, it has fixed
length. If MD5 names are stored in uint64_t type instead of ULEB128, NameTable
can be accessed like an array then in many cases only part of the NameTable
has to be read. This is helpful for reducing compile time especially when
small source file is compiled. We find that after this change, the elapsed
time to build a large application distributively is reduced by 5% and the
accumulative cpu time used for building is also reduced by 5%. The size of
the profile is slightly reduced with this change by ~0.2%, and that also
indicates encoding MD5 in ULEB128 doesn't save the storage space.

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

17 months ago[OpenMP] Add doxygen generation for the runtime
Giorgis Georgakoudis [Fri, 4 Dec 2020 20:50:52 +0000 (12:50 -0800)]
[OpenMP] Add doxygen generation for the runtime

Reviewed By: jdoerfert

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

17 months ago[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for...
Craig Topper [Wed, 9 Dec 2020 00:02:00 +0000 (16:02 -0800)]
[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for adding VSETVLI before vector instructions

This merges the SEW and LMUL enums that each used into singles enums in RISCVBaseInfo.h. The patch also adds a new encoding helper to take SEW, LMUL, tail agnostic, mask agnostic and turn it into a vtype immediate.

I also stopped storing the Encoding in the VTYPE operand in the assembler. It is easy to calculate when adding the operand which should only happen once per instruction.

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

17 months agoPrevent FENTRY_CALL reordering
Ilya Leoshkevich [Tue, 8 Dec 2020 21:04:00 +0000 (22:04 +0100)]
Prevent FENTRY_CALL reordering

FEntryInserter prepends FENTRY_CALL to the first basic block. In case
there are other instructions, PostRA Machine Instruction Scheduler can
move FENTRY_CALL call around. This actually occurs on SystemZ (see the
testcase). This is bad for the following reasons:

* FENTRY_CALL clobbers registers.
* Linux Kernel depends on whatever FENTRY_CALL expands to to be the very
  first instruction in the function.

Fix by adding isCall attribute to FENTRY_CALL, which prevents reordering
by making it a scheduling boundary for PostRA Machine Instruction

Reviewed By: niravd

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

17 months ago[indvars] Common a bit of code [NFC]
Philip Reames [Tue, 8 Dec 2020 23:25:22 +0000 (15:25 -0800)]
[indvars] Common a bit of code [NFC]

17 months agoADT: Add hash_value overload for Optional
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 03:26:56 +0000 (19:26 -0800)]
ADT: Add hash_value overload for Optional

Add a `hash_value` for Optional so that other data structures with
optional fields can easily hash them. I have a use for this in an
upcoming patch.

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

17 months agoADT: Remove the unused explicit `OptionalTest` fixture, NFC
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 19:27:02 +0000 (11:27 -0800)]
ADT: Remove the unused explicit `OptionalTest` fixture, NFC

`OptionalTest` was empty; drop it and switch all the tests to use the
shorter `TEST` instead of `TEST_F`.

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

Arthur Eubanks [Tue, 8 Dec 2020 18:29:05 +0000 (10:29 -0800)]

Reviewed By: MaskRay

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

Arthur Eubanks [Tue, 8 Dec 2020 22:27:39 +0000 (14:27 -0800)]

Reviewed By: MaskRay

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

17 months ago[clang-tidy][NFC] Made Globlist::contains const
Nathan James [Tue, 8 Dec 2020 22:26:55 +0000 (22:26 +0000)]
[clang-tidy][NFC] Made Globlist::contains const

17 months ago[libc++] Mark my new <algorithm> test unsupported on clang-8.
Arthur O'Dwyer [Tue, 8 Dec 2020 22:23:47 +0000 (17:23 -0500)]
[libc++] Mark my new <algorithm> test unsupported on clang-8.

Because in C++20 mode, it tests that `copy_n` is constexpr;
so it depends on the compiler supporting `is_constant_evaluated`.

17 months ago[AArch64][GlobalISel] Swap select operands when inverting condition code
Jessica Paquette [Tue, 8 Dec 2020 22:05:38 +0000 (14:05 -0800)]
[AArch64][GlobalISel] Swap select operands when inverting condition code

This was not obvious when reading the imported tablegen patterns in

Update select-select.mir.

17 months ago[ScalarizeMaskedMemIntrin] Add new PM support
Anna Thomas [Mon, 7 Dec 2020 03:51:23 +0000 (22:51 -0500)]
[ScalarizeMaskedMemIntrin] Add new PM support

This patch adds new PM support for the pass and the pass can be now used
during middle-end transforms. The old pass is remamed to

Reviewed-By: skatkov, aeubanks
Differential Revision: https://reviews.llvm.org/D92743

17 months ago[libc++] Add _VSTD:: qualifications to ADL-proof <algorithm>.
Arthur O'Dwyer [Sun, 22 Nov 2020 18:21:11 +0000 (13:21 -0500)]
[libc++] Add _VSTD:: qualifications to ADL-proof <algorithm>.

Relevant blog post: https://quuxplusone.github.io/blog/2019/09/26/uglification-doesnt-stop-adl/

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

17 months ago[libc++] ADL-proof __libcpp_is_nothrow_constructible.
Arthur O'Dwyer [Tue, 8 Dec 2020 20:41:48 +0000 (15:41 -0500)]
[libc++] ADL-proof __libcpp_is_nothrow_constructible.

The GCC C++20 buildbot hit this ADL call; Clang doesn't,
presumably because it uses a compiler builtin instead of
this codepath in <type_traits>.

17 months ago[DFSan] Add pthread and other functions to ABI list.
Matt Morehouse [Tue, 8 Dec 2020 21:55:25 +0000 (13:55 -0800)]
[DFSan] Add pthread and other functions to ABI list.

The non-pthread functions are all clear discard functions.

Some of the pthread ones could clear shadow, but aren't worth writing
custom wrappers for.  I can't think of any reasonable scenario where we
would pass tainted memory to these pthread functions.

Reviewed By: stephan.yichao.zhao

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

17 months agoPin -loop-reduce to legacy PM
Arthur Eubanks [Mon, 7 Dec 2020 23:25:43 +0000 (15:25 -0800)]
Pin -loop-reduce to legacy PM

LSR currently only runs in the codegen pass manager.
There are a couple issues with LSR and the NPM.
1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
bunch of tests' expected output. This is fixable with some time put in.
2) LSR doesn't preserve LCSSA. See
llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
off. Turning it on causes some code sinking out of loops to fail due to
SCEVExpander's inability to handle the newly created trivial PHI nodes in the
broken critical edge (I was looking at
I also tried simply just calling formLCSSA() at the end of LSR, but the extra
PHI nodes cause regressions in codegen tests.

We'll delay figuring these issues out until later.

This causes the number of check-llvm failures with -enable-new-pm true
by default to go from 60 to 29.

Reviewed By: asbirlea

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

17 months ago[AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops
Jessica Paquette [Tue, 8 Dec 2020 21:39:28 +0000 (13:39 -0800)]
[AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops

`TryFoldBinOpIntoSelect` didn't have a check for `Optimized`, meaning you could
end up folding twice. (e.g. a select with a G_ADD on the true side, and a G_SUB
on the false side)

Add in the missing `if` and a test.

17 months agoARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 03:05:11 +0000 (19:05 -0800)]
ARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry

Simplify the DenseMapInfo for `EditEntry` by migrating from
`FoldingSetNodeID` to `llvm::hash_combine`. Besides the cleanup, this
reduces the diff for a future patch which changes the type of one of the

There should be no real functionality change here, although I imagine
the hash value will churn since its a different hashing infrastructure.

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

17 months ago[NFC] Rename IsCodeGenPass to ShouldPinPassToLegacyPM
Arthur Eubanks [Tue, 8 Dec 2020 07:14:49 +0000 (23:14 -0800)]
[NFC] Rename IsCodeGenPass to ShouldPinPassToLegacyPM

Codegen-specific passes are being ported to the NPM. Rename for better
clarity and note that ported passes that fully work with the NPM should
be removed from these lists.

Reviewed By: asbirlea

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

17 months ago[VE] Correct LVLGen (LVL instruction insert pass)
Kazushi (Jam) Marukawa [Sat, 5 Dec 2020 07:53:39 +0000 (16:53 +0900)]
[VE] Correct LVLGen (LVL instruction insert pass)

SX Aurora VE uses an intermediate representation similar to VP as its MIR.
VE itself uses invidiual VL register as its own vector length register at
the hardware level.  So, LLVM needs to insert load VL (LVL) instruction just
before vector instructions if the value of VL is changed.  This LVLGen pass
generates LVL instructions for such purpose.  Previously, a bug is pointed
out in D91416.  This patch correct this bug and add a regression test.

Reviewed By: craig.topper

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

17 months ago[Driver] Add -gno-split-dwarf which can disable debug fission
Fangrui Song [Tue, 8 Dec 2020 21:24:58 +0000 (13:24 -0800)]
[Driver] Add -gno-split-dwarf which can disable debug fission

Currently when -gsplit-dwarf is specified (could be buried in a build system),
there is no convenient way to cancel debug fission without affecting the debug
information amount (all of -g0, -g1 -fsplit-dwarf-inlining and -gline-directives-only
can, but they affect the debug information amount).

Reviewed By: #debug-info, dblaikie

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

17 months ago[libc] Raise x87 exceptions by synchronizing with "fwait".
Siva Chandra Reddy [Tue, 8 Dec 2020 06:46:03 +0000 (22:46 -0800)]
[libc] Raise x87 exceptions by synchronizing with "fwait".

Couple of helper functions enableExcept and disableExcept have been
added. In a later round, they will be used to implemented the GNU
extension functions feenableexcept and fedisableexcept.

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

17 months agoAPINotes: add bitcode format schema definitions
Saleem Abdulrasool [Fri, 6 Nov 2020 00:01:20 +0000 (00:01 +0000)]
APINotes: add bitcode format schema definitions

This adds the bitcode format schema required for serialization of the
YAML data to a binary format.  APINotes are pre-compiled and re-used in
the binary format from the frontend.  These definitions provide the data
layout representation enabling writing (and eventually) reading of the
data in bitcode format.

This is extracted from the code contributed by Apple at

Differential Revision: https://reviews.llvm.org/D91997
Reviewed By: Gabor Marton

17 months agoBitcode: add some convenience helpers for streaming bitcode
Saleem Abdulrasool [Tue, 29 Sep 2020 21:16:02 +0000 (21:16 +0000)]
Bitcode: add some convenience helpers for streaming bitcode

This adds a set of metaprogramming helpers to help define records and
serialize them out.  This is motivated by API Notes which use the
bitcode format to serialize out a binary representation of the data.
These helpers are generically useful though and could help simplify some
of the existing bitcode consumers as well.

This is extracted from the code contributed by Apple at

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

17 months ago[Driver] Don't make -gsplit-dwarf imply -g2
Fangrui Song [Tue, 8 Dec 2020 21:14:34 +0000 (13:14 -0800)]
[Driver] Don't make -gsplit-dwarf imply -g2

RFC: http://lists.llvm.org/pipermail/cfe-dev/2020-May/065430.html
Agreement from GCC: https://sourceware.org/pipermail/gcc-patches/2020-May/545688.html

g_flags_Group options generally don't affect the amount of debugging
information. -gsplit-dwarf is an exception. Its order dependency with
other gN_Group options make it inconvenient in a build system:

* -g0 -gsplit-dwarf -> level 2
   -gsplit-dwarf "upgrades" the amount of debugging information despite
   the previous intention (-g0) to drop debugging information
* -g1 -gsplit-dwarf -> level 2
  -gsplit-dwarf "upgrades" the amount of debugging information.
* If we have a higher-level -gN, -gN -gsplit-dwarf will supposedly decrease the
  amount of debugging information. This happens with GCC -g3.

The non-orthogonality has confused many users. GCC 11 will change the semantics
(-gsplit-dwarf no longer implies -g2) despite the backwards compatibility break.
This patch matches its behavior.

New semantics:

* If there is a g_Group, allow split DWARF if useful
  (none of: -g0, -gline-directives-only, -g1 -fno-split-dwarf-inlining)
* Otherwise, no-op.

To restore the original behavior, replace -gsplit-dwarf with -gsplit-dwarf -g.

Reviewed By: dblaikie

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