platform/upstream/llvm.git
4 years ago[AssumeBundles] Use operand bundles to encode alignment assumptions
Tyker [Wed, 24 Jun 2020 11:18:21 +0000 (13:18 +0200)]
[AssumeBundles] Use operand bundles to encode alignment assumptions

Summary:
NOTE: There is a mailing list discussion on this: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html

Complemantary to the assumption outliner prototype in D71692, this patch
shows how we could simplify the code emitted for an alignemnt
assumption. The generated code is smaller, less fragile, and it makes it
easier to recognize the additional use as a "assumption use".

As mentioned in D71692 and on the mailing list, we could adopt this
scheme, and similar schemes for other patterns, without adopting the
assumption outlining.

Reviewers: hfinkel, xbolva00, lebedev.ri, nikic, rjmccall, spatel, jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: yamauchi, kuter, fhahn, merge_guards_bot, hiraditya, bollu, rkruppe, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[NFC] update test to make diff of the following commit clear
Tyker [Fri, 19 Jun 2020 13:45:27 +0000 (15:45 +0200)]
[NFC] update test to make diff of the following commit clear

4 years ago[Matrix] Use 1st/2nd instead of first/second in matrix diags.
Florian Hahn [Thu, 25 Jun 2020 10:48:07 +0000 (11:48 +0100)]
[Matrix] Use 1st/2nd instead of first/second in matrix diags.

This was suggested in D72782 and brings the diagnostics more in line
with how argument references are handled elsewhere.

Reviewers: rjmccall, jfb, Bigcheese

Reviewed By: rjmccall

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

4 years ago[ARM] Allow tail predication on sadd_sat and uadd_sat intrinsics
Sam Tebbs [Thu, 25 Jun 2020 10:53:11 +0000 (11:53 +0100)]
[ARM] Allow tail predication on sadd_sat and uadd_sat intrinsics

This patch stops the sadd_sat and uadd_sat intrinsics from blocking tail predication.

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

4 years ago[Matrix] Group matrix diagnostics together (NFC).
Florian Hahn [Wed, 24 Jun 2020 14:29:27 +0000 (15:29 +0100)]
[Matrix] Group matrix diagnostics together (NFC).

4 years agoFPEnv.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 10:40:25 +0000 (11:40 +0100)]
FPEnv.h - reduce includes to forward declarations. NFC.

Ensure FPEnv.cpp includes FPEnv.h first to check for hidden dependencies.

4 years agoMachineScheduler.h - reduce AliasAnalysis.h include to forward declaration. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 10:14:12 +0000 (11:14 +0100)]
MachineScheduler.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years ago[AST] Fix a crash on accessing a class without definition in constexpr function context.
Haojian Wu [Thu, 25 Jun 2020 10:11:57 +0000 (12:11 +0200)]
[AST] Fix a crash on accessing a class without definition in constexpr function context.

Reviewed By: rsmith

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

4 years ago[libclang] Get rid of relience on SourceManager member signature
Kadir Cetinkaya [Thu, 25 Jun 2020 08:56:51 +0000 (10:56 +0200)]
[libclang] Get rid of relience on SourceManager member signature

Summary:
Libclang was enforcing a singature on SourceManager::getLocalSLocEntry
which isn't possible to satisfy as pointed out in
https://reviews.llvm.org/D80681#inline-751438.

This patch updates the libclang, hopefully without breaking API stability, to
not rely on member signature. To enable changing the signature in D82498.

Reviewers: sammccall, bkramer

Subscribers: arphaman, cfe-commits

Tags: #clang

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

4 years agoEnsure that CompilerInvocationTest normalizes default target triples
Daniel Grumberg [Thu, 25 Jun 2020 09:36:12 +0000 (10:36 +0100)]
Ensure that CompilerInvocationTest normalizes default target triples

This fixes a build failure. More details at http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/78/steps/test-check-clang/logs/FAIL%3A%20Clang-Unit%3A%3ACC1CommandLineGenerationTest.CanGenerateCC1CommandLineSeparateRequiredAbsent

4 years ago[MLIR][Shape] Fix ambiguous symbol
Frederik Gossen [Thu, 25 Jun 2020 09:39:35 +0000 (09:39 +0000)]
[MLIR][Shape] Fix ambiguous symbol

4 years ago[analyzer] SATest: Use logger in single-threaded mode as well
Valeriy Savchenko [Tue, 9 Jun 2020 09:33:56 +0000 (12:33 +0300)]
[analyzer] SATest: Use logger in single-threaded mode as well

Summary:
It generalizes the way the output looks across any -jN.
Additionally it solves the buffering problems.

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

4 years ago[analyzer] SATest: Fix package versions for test dependencies
Valeriy Savchenko [Mon, 8 Jun 2020 14:08:01 +0000 (17:08 +0300)]
[analyzer] SATest: Fix package versions for test dependencies

Summary:
Another possible difference between various users of the
testing system might be a change in dependencies installed on the
container.  This commit tries to prevent any problem related to
different versions of the libraries/headers used and fixes them to
currently installed versions.

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

4 years ago[analyzer] SATest: Add 5 more projects for testing
Valeriy Savchenko [Mon, 8 Jun 2020 13:27:04 +0000 (16:27 +0300)]
[analyzer] SATest: Add 5 more projects for testing

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

4 years ago[analyzer] SATest: Add an easy option to connect to docker for debugging
Valeriy Savchenko [Mon, 8 Jun 2020 09:49:31 +0000 (12:49 +0300)]
[analyzer] SATest: Add an easy option to connect to docker for debugging

Summary:
Docker on its own has a pretty convenient way to run shell.
This method, however, requires target container to be currently running,
which is not a usual scenario for the test system.  For this purpose,
it is better to have a simple way to run the container, shell it, and
clean up at the end of it all.  New option `--shell` does exactly this.

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

4 years ago[analyzer] SATest: Do not re-run CMake in Docker if not needed
Valeriy Savchenko [Mon, 8 Jun 2020 09:47:21 +0000 (12:47 +0300)]
[analyzer] SATest: Do not re-run CMake in Docker if not needed

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

4 years ago[analyzer] SATest: Make main script Python2 compatible
Valeriy Savchenko [Mon, 8 Jun 2020 09:45:47 +0000 (12:45 +0300)]
[analyzer] SATest: Make main script Python2 compatible

Summary:
If the user has only python2 installed and wants to use
the dockerized testing system, it is now totally OK.

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

4 years ago[analyzer] SATest: Make docker interfaces transparent
Valeriy Savchenko [Fri, 5 Jun 2020 08:47:35 +0000 (11:47 +0300)]
[analyzer] SATest: Make docker interfaces transparent

Summary:
Forward results of every command executed in docker.  The actual commands
and their error codes are more informative than python stacktraces.

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

4 years ago[analyzer] SATest: Add a set of initial projects for testing
Valeriy Savchenko [Thu, 4 Jun 2020 15:40:39 +0000 (18:40 +0300)]
[analyzer] SATest: Add a set of initial projects for testing

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

4 years ago[analyzer] SATest: Add convenience 'docker' command
Valeriy Savchenko [Thu, 4 Jun 2020 15:35:54 +0000 (18:35 +0300)]
[analyzer] SATest: Add convenience 'docker' command

Summary:
It provides a simpler interface for testing within docker.
This way the user is not required to no how to use `docker run` and
its options.

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

4 years ago[analyzer] SATest: Add initial docker infrastructure
Valeriy Savchenko [Thu, 4 Jun 2020 15:34:34 +0000 (18:34 +0300)]
[analyzer] SATest: Add initial docker infrastructure

Summary:
Static analysis is very sensitive to environment.
OS and libraries installed can affect the results.  This fact makes
it extremely hard to have a regression testing system that will
produce stable results.

For this very reason, this commit introduces a new dockerized testing
environment, so that every analyzer developer can check their changes
against previous analysis results.

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

4 years agoUse concrete natural type alignment for masked load/store operations instead of 0.
Guillaume Chatelet [Wed, 24 Jun 2020 21:26:03 +0000 (21:26 +0000)]
Use concrete natural type alignment for masked load/store operations instead of 0.

Summary: Alignment needs to be resolved at this point so we replace the
0 value with the ABI Type Alignment.

4 years ago[docs][llvm-dwarfdump] Fix the warnings during docs-llvm-html buil
Djordje Todorovic [Thu, 25 Jun 2020 08:54:37 +0000 (10:54 +0200)]
[docs][llvm-dwarfdump] Fix the warnings during docs-llvm-html buil

Before the fix the build of docs-llvm-html would fail.
The D80959 introduced options that are not recognized, so we have
warning as:

  llvm-project/llvm/docs/CommandGuide/llvm-dwarfdump.rst:40\
  :unknown option: --debug-info

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

4 years ago[docs][GlobalISel] Fix the warnings during docs-llvm-html build
Djordje Todorovic [Thu, 25 Jun 2020 08:39:39 +0000 (10:39 +0200)]
[docs][GlobalISel] Fix the warnings during docs-llvm-html build

Before the fix the build of docs-llvm-html would fail.
The rG8bc03d216824 introduced a reference to an undefined label,
so we have warning as:

  llvm-project/llvm/docs/GlobalISel/GenericOpcode.rst:295:\
  undefined label: i_intr_llvm_ptrmask (if the link has no\
  caption the label must precede a section header)

4 years ago[MLIR][Shape] Lower `shape_of` for unranked tensors
Frederik Gossen [Thu, 25 Jun 2020 08:50:02 +0000 (08:50 +0000)]
[MLIR][Shape] Lower `shape_of` for unranked tensors

Lower `shape_of` for unranked tensors.
Materializes shape in stack-allocated memory.

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

4 years ago[MLIR][Shape] Lower `shape.rank`
Frederik Gossen [Thu, 25 Jun 2020 08:42:40 +0000 (08:42 +0000)]
[MLIR][Shape] Lower `shape.rank`

Lower `shape.rank` to standard dialect.
A shape's size is the same as the extent of the first and only dimension of the
`tensor<?xindex>` it is represented by.

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

4 years ago[PowerPC] add popcount CodeGen test; NFC
Shawn Landden [Wed, 24 Jun 2020 23:29:32 +0000 (03:29 +0400)]
[PowerPC] add popcount CodeGen test; NFC

4 years ago[MLIR][Shape] Add canonicalization pattern for `shape.rank`
Frederik Gossen [Thu, 25 Jun 2020 08:37:18 +0000 (08:37 +0000)]
[MLIR][Shape] Add canonicalization pattern for `shape.rank`

Replace any `rank(shape_of(tensor))` that relies on a ranked tensor with the
corresponding constant `const_size`.

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

4 years ago[AMDGPU] Select s_cselect
Piotr Sobczak [Wed, 4 Mar 2020 14:13:08 +0000 (15:13 +0100)]
[AMDGPU] Select s_cselect

Summary:
Add patterns to select s_cselect in the isel.

Handle more cases of implicit SCC accesses in si-fix-sgpr-copies
to allow new patterns to work.

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, asbirlea, kerbowa, llvm-commits

Tags: #llvm

Re-commit D81925 with a bugfix D82370.

Differential Revision: https://reviews.llvm.org/D81925
Differential Revision: https://reviews.llvm.org/D82370

4 years agoReland "[clang][Driver] Correct tool search path priority"
David Spickett [Wed, 24 Jun 2020 15:45:21 +0000 (16:45 +0100)]
Reland "[clang][Driver] Correct tool search path priority"

This reverts commit f570d5810485fa6fb2e1009f795a899d79bd429f.

The test was failing on MacOS if you set
LLVM_DEFAULT_TARGET_TRIPLE. For example if you set it to
"x86_64-apple-darwin" clang actually uses
"x86_64-apple-darwin<version>".

To fix this get default triple from clang itself during the
test instead of substituting it in via lit.

4 years ago[MLIR][Shape] Add constant folding to `shape.rank`
Frederik Gossen [Thu, 25 Jun 2020 08:31:49 +0000 (08:31 +0000)]
[MLIR][Shape] Add constant folding to `shape.rank`

Add constant folding for the `shape.rank` operation of the shape dialect.

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

4 years ago[lldb][PDB] Constexpr static member values as AST literals
Aleksandr Urakov [Thu, 25 Jun 2020 08:22:05 +0000 (11:22 +0300)]
[lldb][PDB] Constexpr static member values as AST literals

Summary:
When evaluating an expression referencing a constexpr static member variable, an
error is issued because the PDB does not specify a symbol with an address that
can be relocated against.

Rather than attempt to resolve the variable's value within the IR execution, the
values of all constants can be looked up and incorporated into the AST of the
record type as a literal, mirroring the original compiler AST.

This change applies to DIA and native PDB loaders.

Patch By: jackoalan

Reviewers: aleksandr.urakov, jasonmolenda, zturner, jdoerfert, teemperor

Reviewed By: aleksandr.urakov

Subscribers: sstefan1, lldb-commits, llvm-commits, #lldb

Tags: #lldb, #llvm

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

4 years ago[MLIR][Shape] Add `shape.rank` operation
Frederik Gossen [Thu, 25 Jun 2020 08:25:06 +0000 (08:25 +0000)]
[MLIR][Shape] Add `shape.rank` operation

Add `shape.rank` operation to the shape dialect.

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

4 years ago[mlir] parallel loop tiling optimization for loops with static bounds
Tobias Gysi [Thu, 25 Jun 2020 07:03:51 +0000 (09:03 +0200)]
[mlir] parallel loop tiling optimization for loops with static bounds

Summary: The patch optimizes the tiling of parallel loops with static bounds if the number of loop iterations is an integer multiple of the tile size.

Reviewers: herhut, ftynse, bondhugula

Reviewed By: herhut, ftynse

Subscribers: bondhugula, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

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

4 years ago[AArch64][SVE] Enable __ARM_FEATURE_SVE macros.
Sander de Smalen [Wed, 24 Jun 2020 15:52:41 +0000 (16:52 +0100)]
[AArch64][SVE] Enable __ARM_FEATURE_SVE macros.

This patch enables the following macros when their corresponding
target attributes are set:
      __ARM_FEATURE_SVE (+sve)
      __ARM_FEATURE_SVE2 (+sve2)
      __ARM_FEATURE_SVE2_AES (+sve2-aes)
      __ARM_FEATURE_SVE2_BITPERM (+sve2-bitperm)
      __ARM_FEATURE_SVE2_SHA3 (+sve2-sha3)
      __ARM_FEATURE_SVE2_SM4 (+sve2-sm4)

This implies that the base SVE and SVE2 ACLE (00bet2) are now feature
complete, meaning that all intrinsics are implemented in LLVM and Clang.

Disclaimer:

To implement the ACLE we have had to fix up many parts of LLVM to make it
support scalable vectors. We have also used many target-specific intrinsics
to reduce reliance on parts of LLVM where we know scalable vectors may
not yet be handled properly (e.g. some transformation might drop the
'scalable' flag on a vector type). While we've done a best effort with
the limited testing that is available to us, we're still working to improve the
stability of the implementation. Additionally, Clang may print warnings
that code may have miscompiled. We find this often to be a false alarm
where the wrong interfaces have been used in LLVM and where resulting
code is not actually incorrect. However, this warrants a bug report
and investigation. If you find any bugs or issues, please raise them on
bugs.llvm.org and let us know!

Reviewers: rengolin, efriedma, david-arm, SjoerdMeijer

Reviewed By: SjoerdMeijer

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

4 years ago[OpenMP] Upgrade default version of OpenMP to 5.0
Saiyedul Islam [Thu, 25 Jun 2020 07:01:15 +0000 (07:01 +0000)]
[OpenMP] Upgrade default version of OpenMP to 5.0

Summary:
When -fopenmp option is specified then version 5.0 will be set as
default.

Reviewers: gregrodgers, jdoerfert, ABataev

Reviewed By: ABataev

Subscribers: pdhaliwal, yaxunl, guansong, sstefan1, cfe-commits

Tags: #clang

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

4 years ago[SVE] Make ConstantFoldGetElementPtr work for scalable vectors of indices
David Sherwood [Fri, 19 Jun 2020 13:33:20 +0000 (14:33 +0100)]
[SVE] Make ConstantFoldGetElementPtr work for scalable vectors of indices

This patch fixes a compiler crash that was hit when trying to simplify
the following code:

getelementptr [2 x i64], [2 x i64]* null, i64 0, <vscale x 2 x i64> zeroinitializer

For the case where we have a null pointer value like above, we just
need to ensure we don't assume the indices are always fixed width.

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

4 years ago[Test] Add more tests for selects & phis
Max Kazantsev [Thu, 25 Jun 2020 03:54:07 +0000 (10:54 +0700)]
[Test] Add more tests for selects & phis

4 years ago[InstCombine] Combine select & Phi by same condition
Max Kazantsev [Thu, 25 Jun 2020 03:42:16 +0000 (10:42 +0700)]
[InstCombine] Combine select & Phi by same condition

This patch transforms
```
p = phi [x, y]
s = select cond, z, p
```
with
```
s = phi[x, z]
```
if we can prove that the Phi node takes values basing on select's condition.

Differential Revision: https://reviews.llvm.org/D82072
Reviewed By: nikic

4 years ago[X86] Emit a reg-reg copy for fast isel of vector bitcasts.
Craig Topper [Thu, 25 Jun 2020 02:46:31 +0000 (19:46 -0700)]
[X86] Emit a reg-reg copy for fast isel of vector bitcasts.

Previously we just updated a map and moved on. But it possible
we cached known bits information with the vreg that can be used by
another basic block. If the other basic block has a different view
of the VT these known bits won't make sense.

By emitting a copy we ensure we have different vregs before and
after the bitcast. This prevents the known bits from being used
with the wrong type.

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

4 years ago[VE] Add clang tests for VE
Kazushi (Jam) Marukawa [Thu, 25 Jun 2020 01:13:31 +0000 (10:13 +0900)]
[VE] Add clang tests for VE

Summary:
Add a preprocessor test to check VE predefinitions.  Add a driver test
to check VE toolchain behavior.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: krytarowski, jfb, ormris, cfe-commits

Tags: #llvm, #ve, #clang

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

4 years ago[X86] Fix a typo error.
Wang, Pengfei [Wed, 24 Jun 2020 15:37:06 +0000 (23:37 +0800)]
[X86] Fix a typo error.

Summary: This will result opcode MULX32Hrm been emitted to MULX32Hrr.

Reviewed by: craig.topper

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

4 years agoMove explicit template class specialization out of the class to fix gcc builds (NFC)
Mehdi Amini [Thu, 25 Jun 2020 01:40:53 +0000 (01:40 +0000)]
Move explicit template class specialization out of the class to fix gcc builds (NFC)

gcc fails with:

   explicit specialization in non-namespace scope

4 years ago[X86][NFC] Pre-commit test case for the following patch.
Pengfei Wang [Thu, 25 Jun 2020 01:37:01 +0000 (18:37 -0700)]
[X86][NFC] Pre-commit test case for the following patch.

4 years ago[NewPM][opt] Assert PassPipeline and Passes don't both contain passes
Arthur Eubanks [Thu, 25 Jun 2020 00:07:13 +0000 (17:07 -0700)]
[NewPM][opt] Assert PassPipeline and Passes don't both contain passes

Reviewers: asbirlea

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[Hexagon][llvm-objcopy] Add missing check for SHN_HEXAGON_SCOMMON_1
Sid Manning [Wed, 24 Jun 2020 14:36:03 +0000 (09:36 -0500)]
[Hexagon][llvm-objcopy] Add missing check for SHN_HEXAGON_SCOMMON_1

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

4 years ago[Inliner] Handle 'no-signed-zeros-fp-math' function attribute.
Michele Scandale [Thu, 25 Jun 2020 00:47:03 +0000 (17:47 -0700)]
[Inliner] Handle 'no-signed-zeros-fp-math' function attribute.

All other floating point math optimization related attribute are merged
in a conservative way during function inlining. This commit adds the
merge rule for the 'no-signed-zeros-fp-math' attribute.

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

4 years ago[lldb] Use std::make_unique<> (NFC)
Jonas Devlieghere [Thu, 25 Jun 2020 00:44:33 +0000 (17:44 -0700)]
[lldb] Use std::make_unique<> (NFC)

Update the rest of lldb to use std::make_unique<>. I used clang-tidy to
automate this, which probably missed cases that are wrapped in ifdefs.

4 years ago[MLIR][SPIRVToLLVM] Implementation of SPIR-V module conversion pattern
George Mitenkov [Thu, 25 Jun 2020 00:42:39 +0000 (20:42 -0400)]
[MLIR][SPIRVToLLVM] Implementation of SPIR-V module conversion pattern

This patch introduces conversion patterns for `spv.module` and `spv._module_end`.
SPIR-V module is converted into `ModuleOp`. This will play a role of enclosing
scope to LLVM ops. At the moment, SPIR-V module attributes (such as memory model,
etc) are ignored.

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

4 years ago[mlir][DialectConversion][NFC] Add comment blocks and organize a bit of the code
River Riddle [Thu, 25 Jun 2020 00:34:16 +0000 (17:34 -0700)]
[mlir][DialectConversion][NFC] Add comment blocks and organize a bit of the code

This helps improve the readability when scrolling through the many functions of ConversionPatternRewriterImpl.

4 years ago[mlir][spirv] Add TransposeOp
HazemAbdelhafez [Thu, 25 Jun 2020 00:34:34 +0000 (20:34 -0400)]
[mlir][spirv] Add TransposeOp

Add Transpose operation to SPIRV dialect.

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

4 years agoDon't inline dynamic allocas that simplify to huge static allocas.
Amara Emerson [Fri, 12 Jun 2020 17:19:28 +0000 (10:19 -0700)]
Don't inline dynamic allocas that simplify to huge static allocas.

Some sequences of optimizations can generate call sites which may never be
executed during runtime, and through constant propagation result in dynamic
allocas being converted to static allocas with very large allocation amounts.

The inliner tries to move these to the caller's entry block, resulting in the
stack limits being reached/bypassed. Avoid inlining functions if this would
result.

The threshold of 64k currently doesn't get triggered on the test suite with an
-Os LTO build on arm64, care should be taken in changing this in future to avoid
needlessly pessimising inlining behaviour.

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

4 years ago[mlir] Refactor OpInterface internals to be faster and factor out common bits.
River Riddle [Thu, 25 Jun 2020 00:23:41 +0000 (17:23 -0700)]
[mlir] Refactor OpInterface internals to be faster and factor out common bits.

This revision adds a new support header, InterfaceSupport, to contain various generic bits of functionality for implementing "Interfaces". Interfaces embody a mechanism for attaching concept-based polymorphism to a type system. With this refactoring a new InterfaceMap type is added to allow for efficient interface lookups without going through an indirect call. This should provide a decent performance speedup without changing the size of AbstractOperation.

In a future revision, this functionality will also be used to bring Interface like functionality to Attributes and Types.

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

4 years ago[DWARFYAML][debug_gnu_*] 'Descriptor' field should be 1-byte. NFC.
Xing GUO [Thu, 25 Jun 2020 00:06:56 +0000 (08:06 +0800)]
[DWARFYAML][debug_gnu_*] 'Descriptor' field should be 1-byte. NFC.

The 'Descriptor' field of .debug_gnu_pubnames and .debug_gnu_pubtypes
section should be 1-byte rather than 4-byte. This patch helps resolve
this issue.

4 years ago[MLIR][NFC] Adopt variadic isa<>
Rahul Joshi [Wed, 24 Jun 2020 18:49:30 +0000 (11:49 -0700)]
[MLIR][NFC] Adopt variadic isa<>

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

4 years ago[HostInfoMacOS] Parse correctly the triple for Apple Silicon.
Davide Italiano [Wed, 24 Jun 2020 23:37:21 +0000 (16:37 -0700)]
[HostInfoMacOS] Parse correctly the triple for Apple Silicon.

Again, debugging doesn't work on the new platform without this, so
it's implicitly covered by the testsuite.

4 years ago[Apple Silicon] Handle macOS in PlatformDarwin
Davide Italiano [Wed, 24 Jun 2020 23:35:10 +0000 (16:35 -0700)]
[Apple Silicon] Handle macOS in PlatformDarwin

This makes "target create /bin/ls" properly detect which platform
is needed when running lldb. Covered by many tests in the suite.

4 years ago[lldb/API] Use std::make_unique<> (NFC)
Jonas Devlieghere [Wed, 24 Jun 2020 23:25:05 +0000 (16:25 -0700)]
[lldb/API] Use std::make_unique<> (NFC)

I was holding off on this change until we moved to C++14 as to not have
to convert llvm::make_unique to std::make_unique. That happened a while
ago so here's the first patch for the API which had a bunch of raw
`new`s.

4 years ago[unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_T...
Fangrui Song [Wed, 24 Jun 2020 23:18:28 +0000 (16:18 -0700)]
[unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_TRIPLE is not normalized after D79796

`TargetOpts->Triple` is initialized as llvm::sys::getDefaultTargetTriple() which may not be normalized.
If LLVM_DEFAULT_TARGET_TRIPLE is powerpc64le-linux-gnu, we should check
check `-triple powerpc64le-linux-gnu`, instead of (normalized) `-triple powerpc64le-unknown-linux-gnu`

4 years ago[InlineCost] PrinterPass prints constants to which instructions are simplified
Kirill Naumov [Tue, 2 Jun 2020 18:57:30 +0000 (18:57 +0000)]
[InlineCost] PrinterPass prints constants to which instructions are simplified

This patch enables printing of constants to see which instructions were
constant-folded. Needed for tests and better visiual analysis of
inliner's work.

Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev

Reviewed By: mtrofin

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

4 years ago[clangd] Make background index thread count calculation clearer
Sam McCall [Tue, 23 Jun 2020 06:39:30 +0000 (08:39 +0200)]
[clangd] Make background index thread count calculation clearer

Summary:
This confusion was inadvertently introduced in a change to the
heavyweight_hardware_concurrency API: 8404aeb56a73ab24f9b295111de3b37a37f0b841

- don't indirect through the rebuilder policy when building the thread pool
- document that rebuilder thresholds are exposed for testing only
- don't use 0 as a sentinel value for "all threads", as we use it as a
  sentinel value for "synchronous" (though unsupported for BackgroundIndex)
- rather than pick some new sentinel value, just always use 4 threads for tests

Reviewers: kadircet, aganea

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[llvm-profdata] --hot-func-list: fix some style issues in D81800
Fangrui Song [Wed, 24 Jun 2020 22:17:03 +0000 (15:17 -0700)]
[llvm-profdata] --hot-func-list: fix some style issues in D81800

Reviewed By: wenlei, hoyFB

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

4 years ago[MIR] Fix CFI_INSTRUCTION escape printing
Scott Linder [Wed, 24 Jun 2020 22:15:27 +0000 (18:15 -0400)]
[MIR] Fix CFI_INSTRUCTION escape printing

Summary:
The printer seems to intend to not print the trailing comma but has a
copy-paste error for the last value in the escape, and the parser
enforces having no trailing comma, but somehow a test was never included
to actually confirm it.

Reviewers: thegameg, arsenm

Reviewed By: thegameg, arsenm

Subscribers: wdng, arsenm, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Port 1e2691fe238
LLVM GN Syncbot [Wed, 24 Jun 2020 22:11:22 +0000 (22:11 +0000)]
[gn build] Port 1e2691fe238

4 years ago[NFCI][InstSimplify] Add CHECK-LABEL to new icmp.ll test
Roman Lebedev [Wed, 24 Jun 2020 22:10:35 +0000 (01:10 +0300)]
[NFCI][InstSimplify] Add CHECK-LABEL to new icmp.ll test

4 years ago[SROA] convertValue(): we can have <N x iK*> to <M x iQ> cast
Roman Lebedev [Wed, 24 Jun 2020 21:51:18 +0000 (00:51 +0300)]
[SROA] convertValue(): we can have <N x iK*> to <M x iQ> cast

Provided test case crashes otherwise.
Much like to the opposite case.

4 years ago[SROA] convertValue(): we can have <N x iK> to <M x iQ*> cast
Roman Lebedev [Wed, 24 Jun 2020 18:12:19 +0000 (21:12 +0300)]
[SROA] convertValue(): we can have <N x iK> to <M x iQ*> cast

Provided test case crashes otherwise.

If NewTy is already DL.getIntPtrType(NewTy),
CreateBitCast() won't actually create any bitcast,
so we are better off just doing the general thing.

4 years ago[IR] GetUnderlyingObject(), stripPointerCastsAndOffsets(): don't crash on `bitcast...
Roman Lebedev [Wed, 24 Jun 2020 18:11:49 +0000 (21:11 +0300)]
[IR] GetUnderlyingObject(), stripPointerCastsAndOffsets(): don't crash on `bitcast <1 x i8*> to i8*`

I'm not sure how to write standalone tests for each of two changes here.
If either one of these two fixes is missing, the test fill crash.

4 years ago[InstCombine] visitBitCast(): do not crash on weird `bitcast <1 x i8*> to i8*`
Roman Lebedev [Wed, 24 Jun 2020 18:12:09 +0000 (21:12 +0300)]
[InstCombine] visitBitCast(): do not crash on weird `bitcast <1 x i8*> to i8*`

Even if we know that RHS of a bitcast is a pointer,
we can't assume LHS is, because it might be
a single-element vector of pointer.

4 years ago[NFCI] SCEV: promote ScalarEvolutionDivision into an publicly usable class
Roman Lebedev [Wed, 17 Jun 2020 10:09:22 +0000 (13:09 +0300)]
[NFCI] SCEV: promote ScalarEvolutionDivision into an publicly usable class

This makes it usable from outside of SCEV,
while previously it was internal to the ScalarEvolution.cpp

In particular, i want to use it in an WIP alloca promotion helper pass,
to analyze if some SCEV is a multiple of some other SCEV.

4 years agoRevert "Use concrete natural type alignment for masked load/store operations instead...
Guillaume Chatelet [Wed, 24 Jun 2020 21:52:52 +0000 (21:52 +0000)]
Revert "Use concrete natural type alignment for masked load/store operations instead of 0."

This reverts commit 39819ccd36b6dd61c9decd29df64fd4e8a7ee9ad.

4 years agoRemove Passes dependency on CodeGen
Yuanfang Chen [Wed, 24 Jun 2020 02:52:58 +0000 (19:52 -0700)]
Remove Passes dependency on CodeGen

The dependency was introduced in
5134020ea62d1e1e125fdac48d251a26b80e9781. The only functional change
from this removal would be the new PM interface for the two codegen
passes. This is not necessary since we don't have codegen pipeline using
new PM yet. This removal is to break the potential circular dependency between
Passes and CodeGen once the codegen begins to gain new PM support.

4 years ago[TextAPI/MachO] Fix style issues. NFC
Fangrui Song [Wed, 24 Jun 2020 21:39:54 +0000 (14:39 -0700)]
[TextAPI/MachO] Fix style issues. NFC

See https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions

4 years agoUse concrete natural type alignment for masked load/store operations instead of 0.
Guillaume Chatelet [Wed, 24 Jun 2020 21:26:03 +0000 (21:26 +0000)]
Use concrete natural type alignment for masked load/store operations instead of 0.

4 years agoRevert "[BitcodeReader] Fix DelayedShuffle handling for ConstantExpr shuffles."
Mitch Phillips [Wed, 24 Jun 2020 20:55:28 +0000 (13:55 -0700)]
Revert "[BitcodeReader] Fix DelayedShuffle handling for ConstantExpr shuffles."

Patch has a memory leak bug that broke the ASan buildbots. More info
available at: https://reviews.llvm.org/D80330

This reverts commit b5740105d270a2d76da8812cafb63e4b799ada73.

4 years ago[ARM] Make cp10 and cp11 usage a warning
Stefan Agner [Wed, 24 Jun 2020 19:50:17 +0000 (21:50 +0200)]
[ARM] Make cp10 and cp11 usage a warning

The ARM ARM considers p10/p11 valid arguments for MCR/MRC instructions.
MRC instructions with p10 arguments are also used in kernel code which
is shared for different architectures. Turn usage of p10/p11 to warnings
for ARMv7/ARMv8-M.

Reviewers: rengolin, olista01, t.p.northover, efriedma, psmith, simon_tatham

Reviewed By: simon_tatham

Subscribers: hiraditya, danielkiss, jcai19, tpimh, nickdesaulniers, peter.smith, javed.absar, kristof.beyls, jdoerfert, llvm-commits

Tags: #llvm

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

4 years ago[InlineCost] InlineCostAnnotationWriterPass introduced
Kirill Naumov [Thu, 11 Jun 2020 22:24:10 +0000 (22:24 +0000)]
[InlineCost] InlineCostAnnotationWriterPass introduced

This class allows to see the inliner's decisions for better
optimization verifications and tests. To use, use flag
"-passes="print<inline-cost>"".

This is the second attempt to integrate the patch.
The problem from the first try has been discussed and
fixed in D82205.

Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev

Reviewed By: mtrofin

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

4 years agoAdd a git hook script that can be manually setup to run some checks on every push
Mehdi Amini [Wed, 24 Jun 2020 21:12:41 +0000 (21:12 +0000)]
Add a git hook script that can be manually setup to run some checks on every push

Right now it just catches arcanist noisy tags, and include a script to
automatically clean these.

Follow up on http://lists.llvm.org/pipermail/llvm-dev/2019-December/137848.html

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

4 years ago[PowerPC][Power10] Implement Count Leading/Trailing Zeroes Builtins under bit Mask...
Amy Kwan [Wed, 24 Jun 2020 20:23:17 +0000 (15:23 -0500)]
[PowerPC][Power10] Implement Count Leading/Trailing Zeroes Builtins under bit Mask in LLVM/Clang

This patch implements builtins for the following prototypes:

unsigned long long __builtin_cntlzdm (unsigned long long, unsigned long long)
unsigned long long __builtin_cnttzdm (unsigned long long, unsigned long long)
vector unsigned long long vec_cntlzm (vector unsigned long long, vector unsigned long long)
vector unsigned long long vec_cnttzm (vector unsigned long long, vector unsigned long long)

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

4 years ago[ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851391d
Martin Storsjö [Wed, 24 Jun 2020 20:48:43 +0000 (23:48 +0300)]
[ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851391d

4 years ago[lld-macho] Remove using namespace llvm::MachO
Fangrui Song [Wed, 24 Jun 2020 20:45:41 +0000 (13:45 -0700)]
[lld-macho] Remove using namespace llvm::MachO

llvm/include/llvm/TextAPI/MachO/ inappropriately uses the llvm::MachO namespace (this is for BinaryFormat and Object) and causes conflicts in some MSVC builds::

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/65324/steps/stage%201%20build/logs/stdio

Removing `using namespace llvm::MachO` should decrease name collisions.

4 years ago[NFC][PowerPC] Fix some typos in MachineCombiner comments
Jinsong Ji [Wed, 24 Jun 2020 16:02:51 +0000 (16:02 +0000)]
[NFC][PowerPC] Fix some typos in MachineCombiner comments

4 years ago[SVE] Remove calls to VectorType::getNumElements from IPO
Christopher Tetreault [Wed, 24 Jun 2020 20:27:38 +0000 (13:27 -0700)]
[SVE] Remove calls to VectorType::getNumElements from IPO

Reviewers: efriedma, jdoerfert, sdesmalen, kmclaughlin

Reviewed By: efriedma, jdoerfert

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[ProcessGDBRemote] Placate the Windows buildbot.
Davide Italiano [Wed, 24 Jun 2020 20:23:06 +0000 (13:23 -0700)]
[ProcessGDBRemote] Placate the Windows buildbot.

I'm probably going to rewrite this function anyway, but, in
the meanwhile.

4 years ago[NFCI][CostModel] Add const to Value*.
dfukalov [Tue, 23 Jun 2020 13:07:44 +0000 (16:07 +0300)]
[NFCI][CostModel] Add const to Value*.

Summary:
Get back `const` partially lost in one of recent changes.
Additionally specify explicit qualifiers in few places.

Reviewers: samparker

Reviewed By: samparker

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Use expect_expr in TestStructTypes.py
Raphael Isemann [Wed, 24 Jun 2020 18:28:00 +0000 (20:28 +0200)]
[lldb][NFC] Use expect_expr in TestStructTypes.py

4 years ago[InlineCost] Added InlineCostCallAnalyzer::print()
Kirill Naumov [Fri, 19 Jun 2020 14:57:34 +0000 (14:57 +0000)]
[InlineCost] Added InlineCostCallAnalyzer::print()

For the upcoming changes, we need to have an ability to dump
InlineCostCallAnalyzer info in non-debug builds as well.

Reviewed-By: mtrofin
Differential Revision: https://reviews.llvm.org/D82205

4 years ago[x86][AArch64] add tests for fmul-fma combine; NFC
Sanjay Patel [Wed, 24 Jun 2020 19:54:22 +0000 (15:54 -0400)]
[x86][AArch64] add tests for fmul-fma combine; NFC

As discussed in D80801, there's a possible overstep in
what is allowed by the 'contract' fast-math-flag.

4 years agoFix a pair of wtype-limits and 3 wparentheses warnings from 29125ddf1
Erich Keane [Wed, 24 Jun 2020 19:49:33 +0000 (12:49 -0700)]
Fix a pair of wtype-limits and 3 wparentheses warnings from 29125ddf1

4 years agoAdd --hot-func-list to llvm-profdata show for sample profiles
weihe [Wed, 24 Jun 2020 19:43:27 +0000 (12:43 -0700)]
Add --hot-func-list to llvm-profdata show for sample profiles

Summary:
Add the --hot-func-list feature to llvm-profdata show for sample profiles. This feature prints a list of hot functions whose max sample count are above the 99% threshold, with their numbers of total samples, total samples percentage, max samples, entry samples, and their function names.

Test Plan:

Reviewers: wenlei, hoyFB

Reviewed By: wenlei, hoyFB

Subscribers: hoyFB, wenlei, weihe, llvm-commits

Tags: #llvm

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

4 years agoFix crash on XCore on unused inline in EmitTargetMetadata
Nigel Perks [Wed, 24 Jun 2020 19:20:29 +0000 (12:20 -0700)]
Fix crash on XCore on unused inline in EmitTargetMetadata

EmitTargetMetadata passed to emitTargetMD a null pointer as returned
from GetGlobalValue, for an unused inline function which has been
removed from the module at that point.

A FIXME in CodeGenModule.cpp commented that the calling code in
EmitTargetMetadata should be moved into the one target that needs it
(XCore). A review comment agreed. So the calling loop has been moved
into the XCore subclass. The check for null is done in that loop.

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

4 years ago[llvm-objcopy] Update help message tests
Alexander Shaposhnikov [Wed, 24 Jun 2020 19:24:50 +0000 (12:24 -0700)]
[llvm-objcopy] Update help message tests

This diff merges help message tests for llvm-objcopy, llvm-strip and
llvm-install-name-tool.

Patch by Sameer Arora!

Test plan: make check-all

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

4 years ago[lld-macho] Use namespace qualifiers (macho::) instead of `namespace lld { namespace...
Fangrui Song [Wed, 24 Jun 2020 19:22:13 +0000 (12:22 -0700)]
[lld-macho] Use namespace qualifiers (macho::) instead of `namespace lld { namespace macho {`

See https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions
Similar to D79982.

Reviewed By: #lld-macho, int3

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

4 years ago[Apple Silicon] Debugging of process under Rosetta is supported.
Davide Italiano [Wed, 24 Jun 2020 19:25:01 +0000 (12:25 -0700)]
[Apple Silicon] Debugging of process under Rosetta is supported.

Remove this early exit. It's vestigial from the ppc -> Intel transition,
but it doesn't apply anymore.

4 years ago[Apple Silicon] Initial support for Rosetta
Davide Italiano [Wed, 24 Jun 2020 19:18:29 +0000 (12:18 -0700)]
[Apple Silicon] Initial support for Rosetta

Translated processes talk with a different debugserver, shipped with
macOS 11. This patch detects whether a process is translated and
attaches to the correct debugserver implementation.
It's the first patch of a series. Tested on the lldb test suite.

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

4 years ago[SLP] Limit GEP lists based on width of index computation.
Florian Hahn [Wed, 24 Jun 2020 16:04:45 +0000 (17:04 +0100)]
[SLP] Limit GEP lists based on width of index computation.

D68667 introduced a tighter limit to the number of GEPs to simplify
together. The limit was based on the vector element size of the pointer,
but the pointers themselves are not actually put in vectors.

IIUC we try to vectorize the index computations here, so we should base
the limit on the vector element size of the computation of the index.

This restores the test regression on AArch64 and also restores the
vectorization for a important pattern in SPEC2006/464.h264ref on
AArch64 (@test_i16_extend). We get a large benefit from doing a single
load up front and then processing the index computations in vectors.

Note that we could probably even further improve the AArch64 codegen, if
we would do zexts to i32 instead of i64 for the sub operands and then do
a single vector sext on the result of the subtractions. AArch64 provides
dedicated vector instructions to do so. Sketch of proof in Alive:
https://alive2.llvm.org/ce/z/A4xYAB

Reviewers: craig.topper, RKSimon, xbolva00, ABataev, spatel

Reviewed By: ABataev, spatel

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

4 years ago[docs] Fix typo
Vedant Kumar [Wed, 24 Jun 2020 18:51:16 +0000 (11:51 -0700)]
[docs] Fix typo

4 years ago[FileCheck][NFC] Fix typo in test comment
Joel E. Denny [Wed, 24 Jun 2020 18:49:23 +0000 (14:49 -0400)]
[FileCheck][NFC] Fix typo in test comment

4 years ago[ObjC] Copy a block to the heap if it is passed as a variadic argument
Akira Hatanaka [Wed, 24 Jun 2020 18:46:38 +0000 (11:46 -0700)]
[ObjC] Copy a block to the heap if it is passed as a variadic argument

Call maybeExtendBlockObject in DefaultVariadicArgumentPromotion so that
the block is copied to the heap when it is passed as a variadic argument
to any calls, not only to C function calls.

rdar://problem/64201532

4 years ago[OpenMP][NFC] Remove hard-coded line numbers from test
Joel E. Denny [Wed, 24 Jun 2020 18:33:01 +0000 (14:33 -0400)]
[OpenMP][NFC] Remove hard-coded line numbers from test

Otherwise, it's painful to insert new code.  There are many existing
examples in the same test file where the line numbers are not
hard-coded.

I intend to do the same for several other OpenMP tests, but I want to
be sure there are no objections before I spend time on it.

Reviewed By: jdoerfert

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