platform/upstream/llvm.git
3 years ago[gn build] Port 8bb6347939b
Nico Weber [Fri, 13 Nov 2020 14:55:08 +0000 (09:55 -0500)]
[gn build] Port 8bb6347939b

3 years agollvmbuildectomy - support disabled native target
serge-sans-paille [Fri, 13 Nov 2020 14:49:27 +0000 (15:49 +0100)]
llvmbuildectomy - support disabled native target

3 years ago[gn build] (manually) merge 1d0676b54c4e3
Nico Weber [Fri, 13 Nov 2020 14:39:28 +0000 (09:39 -0500)]
[gn build] (manually) merge 1d0676b54c4e3

3 years ago[gn build] Hotfix to unbreak build after 9218ff50f9308
Nico Weber [Fri, 13 Nov 2020 14:26:43 +0000 (09:26 -0500)]
[gn build] Hotfix to unbreak build after 9218ff50f9308

3 years ago[DivergenceAnalysis] Use addRequiredTransitive
Piotr Sobczak [Tue, 10 Nov 2020 16:17:24 +0000 (17:17 +0100)]
[DivergenceAnalysis] Use addRequiredTransitive

For querying divergence the chained analysis passes are required
to be alive, for instance LoopInfoWrapperPass.

Ensure that by using addRequiredTransitive.

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

3 years agollvmbuildectomy - compatibility with ocaml bindings
serge-sans-paille [Fri, 13 Nov 2020 13:04:19 +0000 (14:04 +0100)]
llvmbuildectomy - compatibility with ocaml bindings

Use exact component name in add_ocaml_library.
Make expand_topologically compatible with new architecture.
Fix quoting in is_llvm_target_library.
Fix LLVMipo component name.
Write release note.

3 years agoAdd !annotation metadata and remarks pass.
Florian Hahn [Fri, 13 Nov 2020 09:46:55 +0000 (09:46 +0000)]
Add !annotation metadata and remarks pass.

This patch adds a new !annotation metadata kind which can be used to
attach annotation strings to instructions.

It also adds a new pass that emits summary remarks per function with the
counts for each annotation kind.

The intended uses cases for this new metadata is annotating
'interesting' instructions and the remarks should provide additional
insight into transformations applied to a program.

To motivate this, consider these specific questions we would like to get answered:

* How many stores added for automatic variable initialization remain after optimizations? Where are they?
* How many runtime checks inserted by a frontend could be eliminated? Where are the ones that did not get eliminated?

Discussed on llvm-dev as part of 'RFC: Combining Annotation Metadata and Remarks'
(http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)

Reviewed By: thegameg, jdoerfert

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

3 years ago[clang] Fix an assertion crash in delayed access check.
Haojian Wu [Fri, 13 Nov 2020 13:00:57 +0000 (14:00 +0100)]
[clang] Fix an assertion crash in delayed access check.

`TD->getTemplatedDecl()` might not be a DeclContext variant, which can
trigger an assertion inside `isa<>`.

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

3 years agoRevert "[AsmPrinter] fix -disable-debug-info option"
Hans Wennborg [Fri, 13 Nov 2020 12:46:13 +0000 (13:46 +0100)]
Revert "[AsmPrinter] fix -disable-debug-info option"

The test fails on Mac, see comment on the code review.

> This option was in a rather convoluted place, causing global parameters
> to be set in awkward and undesirable ways to try to account for it
> indirectly. Add tests for the -disable-debug-info option and ensure we
> don't print unintended markers from unintended places.
>
> Reviewed By: dstenb
>
> Differential Revision: https://reviews.llvm.org/D91083

This reverts commit 9606ef03f03904cec213db031b5ea6fd6052dc5d.

3 years agoReland [clang][cli] Port ObjCMTAction to new option parsing system
Jan Svoboda [Wed, 11 Nov 2020 10:05:24 +0000 (11:05 +0100)]
Reland [clang][cli] Port ObjCMTAction to new option parsing system

Merge existing marhsalling info kinds and add some primitives to
express flag options that contribute to a bitfield.

Depends on D82574

Original patch by Daniel Grumberg.

Reviewed By: Bigcheese

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

3 years ago[mlir] Transform scf.parallel to scf.for + async.execute
Eugene Zhulenev [Fri, 13 Nov 2020 11:01:52 +0000 (03:01 -0800)]
[mlir] Transform scf.parallel to scf.for + async.execute

Depends On D89958

1. Adds `async.group`/`async.awaitall` to group together multiple async tokens/values
2. Rewrite scf.parallel operation into multiple concurrent async.execute operations over non overlapping subranges of the original loop.

Example:

```
   scf.for (%i, %j) = (%lbi, %lbj) to (%ubi, %ubj) step (%si, %sj) {
     "do_some_compute"(%i, %j): () -> ()
   }
```

Converted to:

```
   %c0 = constant 0 : index
   %c1 = constant 1 : index

   // Compute blocks sizes for each induction variable.
   %num_blocks_i = ... : index
   %num_blocks_j = ... : index
   %block_size_i = ... : index
   %block_size_j = ... : index

   // Create an async group to track async execute ops.
   %group = async.create_group

   scf.for %bi = %c0 to %num_blocks_i step %c1 {
     %block_start_i = ... : index
     %block_end_i   = ... : index

     scf.for %bj = %c0 t0 %num_blocks_j step %c1 {
       %block_start_j = ... : index
       %block_end_j   = ... : index

       // Execute the body of original parallel operation for the current
       // block.
       %token = async.execute {
         scf.for %i = %block_start_i to %block_end_i step %si {
           scf.for %j = %block_start_j to %block_end_j step %sj {
             "do_some_compute"(%i, %j): () -> ()
           }
         }
       }

       // Add produced async token to the group.
       async.add_to_group %token, %group
     }
   }

   // Await completion of all async.execute operations.
   async.await_all %group
```
In this example outer loop launches inner block level loops as separate async
execute operations which will be executed concurrently.

At the end it waits for the completiom of all async execute operations.

Reviewed By: ftynse, mehdi_amini

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

3 years ago[MC][mips] Remove unused check prefixes. NFC
Simon Atanasyan [Thu, 12 Nov 2020 21:24:11 +0000 (00:24 +0300)]
[MC][mips] Remove unused check prefixes. NFC

3 years ago[mips] Add tests to check disassembling of add.ps/mul.ps/sub.ps instructions
Simon Atanasyan [Thu, 5 Nov 2020 13:30:45 +0000 (16:30 +0300)]
[mips] Add tests to check disassembling of add.ps/mul.ps/sub.ps instructions

3 years ago[clangd] Add missing tests to rename feature
Kirill Bobyrev [Fri, 13 Nov 2020 11:27:36 +0000 (12:27 +0100)]
[clangd] Add missing tests to rename feature

This adds a couple of missed tests from existing clang-rename ones and
introduces several new ones (e.g. static class member). This patch is required
to ensure feature parity for migration off Clang-Rename API D71880.

Reviewed By: hokein

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

3 years ago[UpdateTestChecks] Fix $ in function test for ARM.
Yvan Roux [Fri, 13 Nov 2020 11:20:56 +0000 (12:20 +0100)]
[UpdateTestChecks] Fix $ in function test for ARM.

Removes AArch64 target checking inside 32bit ARM test to bring back
buildbots to a green state.  But $ are not well handled for ARM and it
still need to be fixed.

3 years ago[SVE][CodeGen] Improve codegen of scalable masked scatters
Kerry McLaughlin [Fri, 13 Nov 2020 10:51:17 +0000 (10:51 +0000)]
[SVE][CodeGen] Improve codegen of scalable masked scatters

If the scatter store is able to perform the sign/zero extend of
its index, this is folded into the instruction with refineIndexType().
Additionally, refineUniformBase() will return the base pointer and index
from an add + splat_vector.

Reviewed By: sdesmalen

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

3 years ago[NFC] Move code between functions as a preparation step for further improvement
Max Kazantsev [Fri, 13 Nov 2020 10:45:42 +0000 (17:45 +0700)]
[NFC] Move code between functions as a preparation step for further improvement

3 years ago[ValueTracking] computeKnownBitsFromShiftOperator use KnownBits direct for constant...
Simon Pilgrim [Fri, 13 Nov 2020 10:47:56 +0000 (10:47 +0000)]
[ValueTracking] computeKnownBitsFromShiftOperator use KnownBits direct for constant shift amounts.

Let KnownBits shift handlers deal with out-of-range shift amounts.

3 years ago[NFC] Refactor lambda into static function
Max Kazantsev [Fri, 13 Nov 2020 10:18:16 +0000 (17:18 +0700)]
[NFC] Refactor lambda into static function

3 years ago[lldb][NFC] Fix flaky TestForwardDeclFromStdModule test
Raphael Isemann [Fri, 13 Nov 2020 10:39:21 +0000 (11:39 +0100)]
[lldb][NFC] Fix flaky TestForwardDeclFromStdModule test

"[lldb/DataFormatters] Display null C++ pointers as nullptr" added an assumption
that the member we check for is always a nullptr, but it is actually never
initialized. That causes the test to randomly fail due to the pointer having
some random value that isn't 0.

3 years agoFix MSVC signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Fri, 13 Nov 2020 10:20:28 +0000 (10:20 +0000)]
Fix MSVC signed/unsigned comparison warning. NFCI.

3 years ago[VE] Add vst intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 13 Nov 2020 09:27:05 +0000 (18:27 +0900)]
[VE] Add vst intrinsic instructions

Add vst intrinsic instructions and a regression test.

Reviewed By: simoll

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

3 years ago[NFC] Move lambdae into static functions
Max Kazantsev [Fri, 13 Nov 2020 10:00:49 +0000 (17:00 +0700)]
[NFC] Move lambdae into static functions

3 years ago[docs] Fix undefined reference in ORCv2 design doc.
Florian Hahn [Fri, 13 Nov 2020 09:42:36 +0000 (09:42 +0000)]
[docs] Fix undefined reference in ORCv2 design doc.

This fixes a typo introduced in 984e87923f1096c815cef900cda0926c68286ddf
which caused the docs build to fail.

3 years ago[AMDGPU] One more use of the new export target names. NFC.
Jay Foad [Fri, 13 Nov 2020 09:41:37 +0000 (09:41 +0000)]
[AMDGPU] One more use of the new export target names. NFC.

3 years agollvmbuildectomy - replace llvm-build by plain cmake
serge-sans-paille [Fri, 9 Oct 2020 16:41:21 +0000 (18:41 +0200)]
llvmbuildectomy - replace llvm-build by plain cmake

No longer rely on an external tool to build the llvm component layout.

Instead, leverage the existing `add_llvm_componentlibrary` cmake function and
introduce `add_llvm_component_group` to accurately describe component behavior.

These function store extra properties in the created targets. These properties
are processed once all components are defined to resolve library dependencies
and produce the header expected by llvm-config.

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

3 years ago[nfc] Fix missing include
serge-sans-paille [Tue, 10 Nov 2020 13:55:25 +0000 (14:55 +0100)]
[nfc] Fix missing include

3 years ago[ORC][examples] Fix missing includes/dependencies in more examples.
Lang Hames [Fri, 13 Nov 2020 09:22:01 +0000 (20:22 +1100)]
[ORC][examples] Fix missing includes/dependencies in more examples.

3 years ago[ORC] Make a narrowing conversion explicit.
Lang Hames [Fri, 13 Nov 2020 09:09:38 +0000 (20:09 +1100)]
[ORC] Make a narrowing conversion explicit.

3 years ago[Test] One more IndVars test with inverted exit condition
Max Kazantsev [Fri, 13 Nov 2020 09:02:31 +0000 (16:02 +0700)]
[Test] One more IndVars test with inverted exit condition

3 years ago[IndVars] Fix branches exiting by true with invariant conditions
Max Kazantsev [Fri, 13 Nov 2020 08:42:02 +0000 (15:42 +0700)]
[IndVars] Fix branches exiting by true with invariant conditions

Forgot to invert the condition for them.

3 years ago[Test] Add test with inverted branch
Max Kazantsev [Fri, 13 Nov 2020 08:21:52 +0000 (15:21 +0700)]
[Test] Add test with inverted branch

3 years ago[mlir][bufferize] Fix buffer promotion to stack for index types
Stephan Herhut [Thu, 12 Nov 2020 16:09:57 +0000 (17:09 +0100)]
[mlir][bufferize] Fix buffer promotion to stack for index types

The index type does not have a bitsize and hence the size of corresponding allocations cannot be computed.  Instead, the promotion pass now has an explicit option to specify the size of index.

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

3 years ago[mlir][gpu] Only transform mapped parallel loops to GPU.
Stephan Herhut [Thu, 12 Nov 2020 17:36:14 +0000 (18:36 +0100)]
[mlir][gpu] Only transform mapped parallel loops to GPU.

This exposes a hook to configure legality of operations such that only
`scf.parallel` operations that have mapping attributes are marked as
illegal. Consequently, the transformation can now also be applied to
mixed forms.

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

3 years ago[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.
Lang Hames [Fri, 13 Nov 2020 08:02:52 +0000 (19:02 +1100)]
[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.

Fix the Kaleidoscope examples after 1d0676b54c4 by explicitly creating the
SymbolStringPool.

3 years ago[PowerPC] Add test case for negated abs. NFC.
Kai Luo [Fri, 13 Nov 2020 08:05:08 +0000 (08:05 +0000)]
[PowerPC] Add test case for negated abs. NFC.

3 years ago[NFC] Refactor loop-invariant getters to return Optional
Max Kazantsev [Fri, 13 Nov 2020 07:39:19 +0000 (14:39 +0700)]
[NFC] Refactor loop-invariant getters to return Optional

3 years ago[mlir][Pass] Remove the verifierPass now that verification is run during normal pass...
River Riddle [Fri, 13 Nov 2020 07:45:07 +0000 (23:45 -0800)]
[mlir][Pass] Remove the verifierPass now that verification is run during normal pass execution

A recent refactoring removed the need to interleave verifier passes and instead opted to verify during the normal execution of passes instead. As such, the old verify pass is no longer necessary and can be removed.

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

3 years ago[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.
Lang Hames [Fri, 13 Nov 2020 07:40:40 +0000 (18:40 +1100)]
[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.

Fix the Kaleidoscope examples after 1d0676b54c4 by explicitly creating the
SymbolStringPool.

3 years ago[mlir][Asm] Add support for resolving operation locations after parsing has finished
River Riddle [Fri, 13 Nov 2020 07:33:43 +0000 (23:33 -0800)]
[mlir][Asm] Add support for resolving operation locations after parsing has finished

This revision adds support in the parser/printer for "deferrable" aliases, i.e. those that can be resolved after printing has finished. This allows for printing aliases for operation locations after the module instead of before, i.e. this is now supported:

```
"foo.op"() : () -> () loc(#loc)

#loc = loc("some_location")
```

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

3 years agodebugserver should advance pc past builtin_debugtrap insn
Jason Molenda [Fri, 13 Nov 2020 07:28:24 +0000 (23:28 -0800)]
debugserver should advance pc past builtin_debugtrap insn

On x86_64, when you hit a __builtin_debugtrap instruction, you
can continue past this in the debugger.  This patch has debugserver
recognize the specific instruction used for __builtin_debugtrap
and advance the pc past it, so that the user can continue execution
once they've hit one of these.

In the patch discussion, we were in agreement that it would be better
to have this knowledge up in lldb instead of depending on each
stub rewriting the pc behind the debugger's back, but that's a
larger scale change for another day.

<rdar://problem/65521634>
Differential revision: https://reviews.llvm.org/D91238

3 years ago[ORC][examples] Fix include and library dependence for SpeculativeJIT example.
Lang Hames [Fri, 13 Nov 2020 07:11:14 +0000 (18:11 +1100)]
[ORC][examples] Fix include and library dependence for SpeculativeJIT example.

3 years ago[Driver] Add option -fproc-stat-report
Serge Pavlov [Fri, 24 Apr 2020 10:53:05 +0000 (17:53 +0700)]
[Driver] Add option -fproc-stat-report

The new option `-fproc-stat-info=<file>` can be used to generate report
about used memory and execution tile of each stage of compilation.
Documentation for this option can be found in `UserManual.rst`. The
option can be used in parallel builds.

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

3 years ago[ORC] Add dependence of OrcJIT on OrcTargetProcess.
Lang Hames [Fri, 13 Nov 2020 06:48:27 +0000 (17:48 +1100)]
[ORC] Add dependence of OrcJIT on OrcTargetProcess.

The SelfTargetProcessControl class depends on OrcTargetProcess.

3 years ago[mlir] Remove C++17 only use of inline on constexpr variable
River Riddle [Fri, 13 Nov 2020 07:02:25 +0000 (23:02 -0800)]
[mlir] Remove C++17 only use of inline on constexpr variable

3 years ago[mlir][Interfaces] Add implicit casts from concrete operation types to the interfaces...
River Riddle [Fri, 13 Nov 2020 06:55:28 +0000 (22:55 -0800)]
[mlir][Interfaces] Add implicit casts from concrete operation types to the interfaces they implement.

This removes the need to have an explicit `cast<>` given that we always know it `isa` instance of the interface.

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

3 years ago[mlir][DenseElementsAttr] Allow for custom floating point types in `getValues`
River Riddle [Fri, 13 Nov 2020 06:43:06 +0000 (22:43 -0800)]
[mlir][DenseElementsAttr] Allow for custom floating point types in `getValues`

Some users have native c++ data types that correspond to floating point values stored within a DenseElementsAttr that do not have a corresponding native C++ data type(e.g. bfloat16/half/etc). This revision allows for such users to use those native types directly, and removes the need to go through APFloat when the much faster native value path is available.

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

3 years ago[NFC] Removed unused variable
Arthur Eubanks [Fri, 13 Nov 2020 06:20:39 +0000 (22:20 -0800)]
[NFC] Removed unused variable

Obsolete as of https://reviews.llvm.org/D91046.

3 years ago[ObjC][ARC] Clear the lists of basic blocks and instructions before
Akira Hatanaka [Fri, 13 Nov 2020 02:33:29 +0000 (18:33 -0800)]
[ObjC][ARC] Clear the lists of basic blocks and instructions before
continuing the loop

This fixes a bug introduced in c6f1713c46e61bbb8ece9ac5ac329d02e7f93228.

3 years ago[ORC] Make WrapperFunctionResult::zeroInit static
Lang Hames [Fri, 13 Nov 2020 06:15:13 +0000 (17:15 +1100)]
[ORC] Make WrapperFunctionResult::zeroInit static

3 years ago[ORC] Remove designated initializer.
Lang Hames [Fri, 13 Nov 2020 06:12:33 +0000 (17:12 +1100)]
[ORC] Remove designated initializer.

3 years ago[ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl
Lang Hames [Wed, 11 Nov 2020 00:55:24 +0000 (11:55 +1100)]
[ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl
implementation.

This patch aims to improve support for out-of-process JITing using OrcV2. It
introduces two new class templates, OrcRPCTargetProcessControlBase and
OrcRPCTPCServer, which together implement the TargetProcessControl API by
forwarding operations to an execution process via an Orc-RPC Endpoint. These
utilities are used to implement out-of-process JITing from llvm-jitlink to
a new llvm-jitlink-executor tool.

This patch also breaks the OrcJIT library into three parts:
  -- OrcTargetProcess: Contains code needed by the JIT execution process.
  -- OrcShared: Contains code needed by the JIT execution and compiler
     processes
  -- OrcJIT: Everything else.

This break-up allows JIT executor processes to link against OrcTargetProcess
and OrcShared only, without having to link in all of OrcJIT. Clients executing
JIT'd code in-process should start linking against OrcTargetProcess as well as
OrcJIT.

In the near future these changes will enable:
  -- Removal of the OrcRemoteTargetClient/OrcRemoteTargetServer class templates
     which provided similar functionality in OrcV1.
  -- Restoration of Chapter 5 of the Building-A-JIT tutorial series, which will
     serve as a simple usage example for these APIs.
  -- Implementation of lazy, cross-target compilation in lli's -jit-kind=orc-lazy
     mode.

3 years ago[AsmPrinter] fix -disable-debug-info option
Jameson Nash [Fri, 13 Nov 2020 04:49:43 +0000 (23:49 -0500)]
[AsmPrinter] fix -disable-debug-info option

This option was in a rather convoluted place, causing global parameters
to be set in awkward and undesirable ways to try to account for it
indirectly. Add tests for the -disable-debug-info option and ensure we
don't print unintended markers from unintended places.

Reviewed By: dstenb

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

3 years ago[X86] Use EVT::getIntegerVT instead of MVT::getIntegerVT where the type can be i2...
Craig Topper [Fri, 13 Nov 2020 05:46:34 +0000 (21:46 -0800)]
[X86] Use EVT::getIntegerVT instead of MVT::getIntegerVT where the type can be i2 or i4.

This was a mistake introduced in D91294. I'm not sure how to
exercise this with the existing code, but I hit it while trying
some follow up experiments.

3 years ago[X86] When storing v1i1/v2i1/v4i1 to memory, make sure we store zeros in the rest...
Craig Topper [Fri, 13 Nov 2020 04:18:50 +0000 (20:18 -0800)]
[X86] When storing v1i1/v2i1/v4i1 to memory, make sure we store zeros in the rest of the byte

We can't store garbage in the unused bits. It possible that something like zextload from i1/i2/i4 is created to read the memory. Those zextloads would be legalized assuming the extra bits are 0.

I'm not sure that the code in lowerStore is executed for the v1i1/v2i1/v4i1 case. It looks like the DAG combine in combineStore may have converted them to v8i1 first. And I think we're missing some cases to avoid going to the stack in the first place. But I don't have time to investigate those things at the moment so I wanted to focus on the correctness issue.

Should fix PR48147.

Reviewed By: RKSimon

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

3 years ago[IndVars] Replace checks with invariants if we cannot remove them
Max Kazantsev [Fri, 13 Nov 2020 05:05:14 +0000 (12:05 +0700)]
[IndVars] Replace checks with invariants if we cannot remove them

If we cannot prove that the check is trivially true, but can prove that it either
fails on the 1st iteration or never fails, we can replace it with first iteration check.

Differential Revision: https://reviews.llvm.org/D88527
Reviewed By: skatkov

3 years agoSuppress trailing template arguments equivalent to default arguments
Richard Smith [Fri, 13 Nov 2020 04:55:21 +0000 (20:55 -0800)]
Suppress trailing template arguments equivalent to default arguments
when printing the name of a member of a class template specialization.

3 years agoFix MLIR lit test configuration after cmake Python detection change
Mehdi Amini [Fri, 13 Nov 2020 04:43:06 +0000 (04:43 +0000)]
Fix MLIR lit test configuration after cmake Python detection change

07f1047f41d changed the CMake detection to use find_package(Python3 ...
but didn't update the lit configuration to use the expected Python3_EXECUTABLE
cmake variable to point to the interpreter path.
This resulted in an empty path on MacOS.

3 years ago[Tests][LoopVect] Exercise basic uniform memory operand logic
Philip Reames [Fri, 13 Nov 2020 03:08:45 +0000 (19:08 -0800)]
[Tests][LoopVect] Exercise basic uniform memory operand logic

3 years ago[OpenMP] Fixed a bug when displaying affinity
Shilei Tian [Fri, 13 Nov 2020 03:27:22 +0000 (22:27 -0500)]
[OpenMP] Fixed a bug when displaying affinity

Currently the affinity format string has initial value. When users set
the format via OMP_AFFINITY_FORMAT, it will overwrite the format string. However,
when copying the format, the tailing null is missing. As a result, if the user
format string is shorter than default value, the remaining part in the default
value still makes effort. This bug is not exposed because the test case doesn't
check the end of a string. It only checks whether given output "contains" the
check string.

Reviewed By: AndreyChurbanov

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

3 years ago[hip] Remove the coercion on aggregate kernel arguments.
Michael Liao [Tue, 10 Nov 2020 14:34:14 +0000 (09:34 -0500)]
[hip] Remove the coercion on aggregate kernel arguments.

- If an aggregate argument is indirectly accessed within kernels, direct
  passing results in unpromotable `alloca`, which degrade performance
  significantly. InferAddrSpace pass is enhanced in
  [D91121](https://reviews.llvm.org/D91121) to take the assumption that
  generic pointers loaded from the constant memory could be regarded
  global ones. The need for the coercion on aggregate arguments is
  mitigated.

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

3 years ago[Polly] Fix memory leak.
Michael Kruse [Fri, 13 Nov 2020 01:31:47 +0000 (19:31 -0600)]
[Polly] Fix memory leak.

3 years ago[InstCombine] fold sub of low-bit masked value from offset of same value
Sanjay Patel [Fri, 13 Nov 2020 00:59:56 +0000 (19:59 -0500)]
[InstCombine] fold sub of low-bit masked value from offset of same value

There might be some demanded/known bits way to generalize this,
but I'm not seeing it right now.

This came up as a regression when I was looking at a different
demanded bits improvement.

https://rise4fun.com/Alive/5fl

  Name: general
  Pre: ((-1 << countTrailingZeros(C1)) & C2) == 0
  %a1 = add i8 %x, C1
  %a2 = and i8 %x, C2
  %r = sub i8 %a1, %a2
  =>
  %r = and i8 %a1, ~C2

  Name: test 1
  %a1 = add i8 %x, 192
  %a2 = and i8 %x, 10
  %r = sub i8 %a1, %a2
  =>
  %r = and i8 %a1, -11

  Name: test 2
  %a1 = add i8 %x, -108
  %a2 = and i8 %x, 3
  %r = sub i8 %a1, %a2
  =>
  %r = and i8 %a1, -4

3 years ago[InstCombine] add tests for sub with masked bits; NFC
Sanjay Patel [Fri, 13 Nov 2020 00:44:13 +0000 (19:44 -0500)]
[InstCombine] add tests for sub with masked bits; NFC

3 years ago[MLIR] Fix standard -> LLVM conversion to fail for unsupported memref element type.
Rahul Joshi [Thu, 12 Nov 2020 20:05:35 +0000 (12:05 -0800)]
[MLIR] Fix standard -> LLVM conversion to fail for unsupported memref element type.

- Move isSupportedMemRefType() to ConvertToLLVMPatterns and check if the
  memref element type is supported there.

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

3 years ago[flang] Document DO CONCURRENT's problems (NFC)
peter klausler [Tue, 25 Aug 2020 16:43:16 +0000 (09:43 -0700)]
[flang] Document DO CONCURRENT's problems (NFC)

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

3 years ago[lldb/DataFormatters] Display null C++ pointers as nullptr
Jonas Devlieghere [Thu, 12 Nov 2020 20:11:47 +0000 (12:11 -0800)]
[lldb/DataFormatters] Display null C++ pointers as nullptr

Display null pointer as `nullptr`, `nil` and `NULL` for C++,
Objective-C/Objective-C++ and C respectively. The original motivation
for this patch was to display a null std::string pointer as nullptr
instead of "", but the fix seemed generic enough to be done for all
summary providers.

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

3 years ago[AMDGPU] Remove scratch rsrc from spill pseudos
Stanislav Mekhanoshin [Tue, 10 Nov 2020 00:40:35 +0000 (16:40 -0800)]
[AMDGPU] Remove scratch rsrc from spill pseudos

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

3 years ago[gn build] (manually) port 410626c9b56
Nico Weber [Thu, 12 Nov 2020 23:21:22 +0000 (18:21 -0500)]
[gn build] (manually) port 410626c9b56

3 years ago[mlir] Make tensor_to_memref op docs match reality
Sean Silva [Thu, 12 Nov 2020 20:45:05 +0000 (12:45 -0800)]
[mlir] Make tensor_to_memref op docs match reality

The previous code defined it as allocating a new memref for its result.
However, this is not how it is treated by the dialect conversion framework,
that does the equivalent of inserting and folding it away internally
(even independent of any canonicalization patterns that we have
defined).

The semantics as they were previously written were also very
constraining: Nontrivial analysis is needed to prove that the new
allocation isn't needed for correctness (e.g. to avoid aliasing).
By removing those semantics, we avoid losing that information.

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

3 years ago[mlir] Bufferize tensor constant ops
Sean Silva [Tue, 10 Nov 2020 00:48:00 +0000 (16:48 -0800)]
[mlir] Bufferize tensor constant ops

We lower them to a std.global_memref (uniqued by constant value) + a
std.get_global_memref to produce the corresponding memref value.
This allows removing Linalg's somewhat hacky lowering of tensor
constants, now that std properly supports this.

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

3 years ago[mlir] Fix subtensor_insert bufferization.
Sean Silva [Thu, 12 Nov 2020 18:33:04 +0000 (10:33 -0800)]
[mlir] Fix subtensor_insert bufferization.

It was incorrect in the presence of a tensor argument with multiple
uses.

The bufferization of subtensor_insert was writing into a converted
memref operand, but there is no guarantee that the converted memref for
that operand is safe to write into. In this case, the same converted
memref is written to in-place by the subtensor_insert bufferization,
violating the tensor-level semantics.

I left some comments in a TODO about ways forward on this. I will be
working actively on this problem in the coming days.

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

3 years ago[AArch64][GlobalISel] Select CSINC and CSINV for G_SELECT with constants
Jessica Paquette [Tue, 3 Nov 2020 19:08:08 +0000 (11:08 -0800)]
[AArch64][GlobalISel] Select CSINC and CSINV for G_SELECT with constants

Select the following:

- G_SELECT cc, 0, 1 -> CSINC zreg, zreg, cc
- G_SELECT cc 0, -1 -> CSINV zreg, zreg cc
- G_SELECT cc, 1, f -> CSINC f, zreg, inv_cc
- G_SELECT cc, -1, f -> CSINV f, zreg, inv_cc
- G_SELECT cc, t, 1 -> CSINC t, zreg, cc
- G_SELECT cc, t, -1 -> CSINC t, zreg, cc

(IR example: https://godbolt.org/z/YfPna9)

These correspond to a bunch of the AArch64csel patterns in AArch64InstrInfo.td.

Unfortunately, it doesn't seem like we can import patterns that use NZCV like
those ones do. E.g.

```
def : Pat<(AArch64csel GPR32:$tval, (i32 1), (i32 imm:$cc), NZCV),
          (CSINCWr GPR32:$tval, WZR, (i32 imm:$cc))>;
```

So we have to manually select these for now.

This replaces `selectSelectOpc` with an `emitSelect` function, which performs
these optimizations.

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

3 years ago[VE] Support vld intrinsics
Kazushi (Jam) Marukawa [Mon, 9 Nov 2020 21:50:15 +0000 (06:50 +0900)]
[VE] Support vld intrinsics

Add intrinsics for vector load instructions.  Add a regression test also.

Reviewed By: simoll

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

3 years ago[LoopVectorize] regenerate test checks; NFC
Sanjay Patel [Thu, 12 Nov 2020 22:15:26 +0000 (17:15 -0500)]
[LoopVectorize] regenerate test checks; NFC

3 years ago[LLDB] Fix handling of bit-fields in a union
shafik [Thu, 12 Nov 2020 19:22:02 +0000 (11:22 -0800)]
[LLDB] Fix handling of bit-fields in a union

When parsing DWARF and laying out bit-fields we don't properly take into account when they are in a union, they will all have a zero offset.

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

3 years ago[PhaseOrdering] regenerate test checks; NFC
Sanjay Patel [Thu, 12 Nov 2020 22:01:38 +0000 (17:01 -0500)]
[PhaseOrdering] regenerate test checks; NFC

3 years ago[InstCombine] add tests for low-mask-of-add; NFC
Sanjay Patel [Thu, 12 Nov 2020 21:37:13 +0000 (16:37 -0500)]
[InstCombine] add tests for low-mask-of-add; NFC

3 years agoSome updates/fixes to the creduce script.
Amy Huang [Wed, 7 Aug 2019 23:38:58 +0000 (16:38 -0700)]
Some updates/fixes to the creduce script.

This was motivated by changes to llvm's `not --crash` disabling symbolization
but I ended up removing `not` from the script entirely because it
returns differently depending on  whether clang "crashes" or exits for some
other reason. The script had to choose between calling `not` and `not --crash`
and sometimes it was wrong.

The script also now disables symbolization when we don't read the stack
trace because symbolizing is kind of slow.

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

3 years ago[AMDGPU] Enable multi-dword flat scratch load/stores
Stanislav Mekhanoshin [Thu, 12 Nov 2020 21:04:33 +0000 (13:04 -0800)]
[AMDGPU] Enable multi-dword flat scratch load/stores

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

3 years ago[mlir][Python] Fix 'unreferenced local variable' warning on MSVC.
Stella Laurenzo [Wed, 11 Nov 2020 18:02:32 +0000 (10:02 -0800)]
[mlir][Python] Fix 'unreferenced local variable' warning on MSVC.

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

3 years ago[PatternMatch] Add single index InsertValue matcher.
Florian Hahn [Thu, 12 Nov 2020 20:13:13 +0000 (20:13 +0000)]
[PatternMatch] Add single index InsertValue matcher.

This patch adds a new matcher for single index InsertValue instructions,
similar to the existing matcher for ExtractValue.

Reviewed By: lebedev.ri

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

3 years ago[OPENMP]Fix PR47790: segfault in frontend while parsing Objective-C with OpenMP.
Alexey Bataev [Thu, 12 Nov 2020 19:42:30 +0000 (11:42 -0800)]
[OPENMP]Fix PR47790: segfault in frontend while parsing Objective-C with OpenMP.

Need to check if the sema is actually finishing a function decl.

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

3 years ago[VE] Disable -fsigaddr option for VE
Kazushi (Jam) Marukawa [Thu, 12 Nov 2020 11:41:04 +0000 (20:41 +0900)]
[VE] Disable -fsigaddr option for VE

VE needs to support integrated assembler and "nas".  This "nas"
doesn't recognize ".sigaddr" pseudo mnemonics, so need to disable
it.  This patch disable it on VE by default.  Also add a regression
test for that.

Reviewed By: simoll

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

3 years ago[flang] Include source information in an invalid file-unit-number message
peter klausler [Thu, 12 Nov 2020 19:57:23 +0000 (11:57 -0800)]
[flang] Include source information in an invalid file-unit-number message

An io-unit that is an internal-file-variable is syntactically identical
to a file-unit-number expression that is a variable reference.  An
ambiguous unit is initially parsed as an internal-file-variable.  If
semantic analysis determines that the unit is not of character type,
it is rewritten as an internal-file-variable.  This modification must
retain source coordinate information.

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

3 years ago[fuzzer] Add Windows Visual C++ exception intercept
Joe Pletcher [Thu, 12 Nov 2020 20:37:35 +0000 (12:37 -0800)]
[fuzzer] Add Windows Visual C++ exception intercept

Adds a new option, `handle_winexcept` to try to intercept uncaught
Visual C++ exceptions on Windows. On Linux, such exceptions are handled
implicitly by `std::terminate()` raising `SIBABRT`. This option brings the
Windows behavior in line with Linux.

Unfortunately this exception code is intentionally undocumented, however
has remained stable for the last decade. More information can be found
here: https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273

Reviewed By: morehouse, metzman

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

3 years ago[flang] Recognize END FILE as ENDFILE in free form source
peter klausler [Thu, 12 Nov 2020 20:02:09 +0000 (12:02 -0800)]
[flang] Recognize END FILE as ENDFILE in free form source

The ENDFILE statement may be spelled as two words.

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

3 years ago[NFC][NewPM] Reuse PassBuilder callbacks with -O0
Arthur Eubanks [Thu, 5 Nov 2020 18:25:35 +0000 (10:25 -0800)]
[NFC][NewPM] Reuse PassBuilder callbacks with -O0

This removes lots of duplicated code which was necessary before
https://reviews.llvm.org/D89158.
Now we can use PassBuilder::runRegisteredEPCallbacks().
This is mostly sanitizers.

There is likely more that can be done to simplify, but let's start with this.

Reviewed By: ychen

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

3 years ago[OPENMP]Fix PR48076: Check map types array before accessing its front.
Alexey Bataev [Thu, 12 Nov 2020 18:20:22 +0000 (10:20 -0800)]
[OPENMP]Fix PR48076: Check map types array before accessing its front.

Need to check if there are map types for the components before trying to
access them when trying to modify type mappings for combined partial
mappings.

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

3 years ago[AMDGPU] Fix scheduling of exp pos4
Jay Foad [Wed, 11 Nov 2020 19:29:53 +0000 (19:29 +0000)]
[AMDGPU] Fix scheduling of exp pos4

Also fix a similar issue in SIInsertWaitcnts, but I don't think that fix
has any effect in practice.

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

3 years ago[AMDGPU] Define and use names for export targets. NFC.
Jay Foad [Wed, 11 Nov 2020 19:21:02 +0000 (19:21 +0000)]
[AMDGPU] Define and use names for export targets. NFC.

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

3 years ago[msan] Break the getShadow loop after matching an argument
Jianzhou Zhao [Thu, 12 Nov 2020 19:47:39 +0000 (19:47 +0000)]
[msan] Break the getShadow loop after matching an argument

Reviewed-by: eugenis
Differential Revision: https://reviews.llvm.org/D91320

3 years ago[SystemZ][ZOS] libcxx - no posix memalign
Zbigniew Sarbinowski [Thu, 12 Nov 2020 19:40:35 +0000 (14:40 -0500)]
[SystemZ][ZOS] libcxx - no posix memalign

The unavailability of posix_memalign on z/OS forces us to define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION'. The use of posix_memalign is being used in libcxx/src/new.cpp.

Reviewed By: #libc, ldionne

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

3 years ago[BasicAA] Remove checks for GEP decomposition limit reached
Nikita Popov [Sat, 7 Nov 2020 18:02:49 +0000 (19:02 +0100)]
[BasicAA] Remove checks for GEP decomposition limit reached

The GEP aliasing code currently checks for the GEP decomposition
limit being reached (i.e., we did not reach the "final" underlying
object). As far as I can see, these checks are not necessary. It is
perfectly fine to work with a GEP whose base can still be further
decomposed.

Looking back through the commit history, these checks were originally
introduced in 1a444489e9d90915cfdda0720489893896ef1503. However, I
believe that the problem this was intended to address was later
properly fixed with 1726fc698ccb85fe4bb23c200a50f28b57fc53cb, and
the checks are no longer necessary since then (and were not the
right fix in the first place).

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

3 years ago[Frontend] Treat .cuh files as CUDA source files
Anatoliy Tomilov [Thu, 12 Nov 2020 19:42:52 +0000 (11:42 -0800)]
[Frontend] Treat .cuh files as CUDA source files

to synchronize with tools/clang-format/git-clang-format

tra: Keeping them in sync does have a minor benefit of not raising a question why the two maps are different.

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

3 years agofix clang build
peter klausler [Thu, 12 Nov 2020 19:38:20 +0000 (11:38 -0800)]
fix clang build

3 years ago[libc++] NFC: Remove symbol from ABI list changelog that was never added
Louis Dionne [Thu, 12 Nov 2020 19:34:35 +0000 (14:34 -0500)]
[libc++] NFC: Remove symbol from ABI list changelog that was never added

The `posix_memalign@GLIBC_2.2.5` symbol can't have been added by r284206,
because it doesn't show up in the corresponding ABI list. It's also not
defined in libc++, so that wouldn't make sense. It must have made it into
that comment by mistake.

3 years ago[NFC] Switch printFunctionLikeOp and parseFunctionLikeOp to only support "inline...
Rahul Joshi [Thu, 12 Nov 2020 18:46:44 +0000 (10:46 -0800)]
[NFC] Switch printFunctionLikeOp and parseFunctionLikeOp to only support "inline" visibility.

- Remove the default valued arguments from these functions.
- Besides FuncOp, looks like no other in-tree op is using these functions.

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

3 years agoRevert "[gn build] (semi-manually) port 173b51169b8"
Nico Weber [Thu, 12 Nov 2020 18:54:24 +0000 (13:54 -0500)]
Revert "[gn build] (semi-manually) port 173b51169b8"

This reverts commit 37a1336de722c6920a24e8cd4278e396402f1b2a.
173b51169b8 was reverted in 777ca48.

3 years ago[libc++] Instantiate additional <iostream> members in the dylib
Louis Dionne [Wed, 21 Oct 2020 15:11:45 +0000 (11:11 -0400)]
[libc++] Instantiate additional <iostream> members in the dylib

This commit adds new explicit instantiations for some classes in <iostream>
in the library. This is done after noticing that many programs that use
streams end up containing weak definitions of these classes, which has a
negative impact on both code size and load times (due to the need to
resolve weak symbols at load time). Note that we are just adding the
additional explicit instantiations for the `char` specializations, since
the `wchar_t` specializations are not used as often, and as a result there
wouldn't be a clear benefit.

This change is not an ABI break, since we are just adding additional
symbols.

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