platform/upstream/llvm.git
3 years ago[SyntaxTree] Use simplified grammar rule for `NestedNameSpecifier` grammar nodes
Eduardo Caldas [Tue, 4 Aug 2020 17:33:36 +0000 (17:33 +0000)]
[SyntaxTree] Use simplified grammar rule for `NestedNameSpecifier` grammar nodes

This is our grammar rule for nested-name-specifiers:
globalbal-specifier:
  /*empty*/
simple-template-specifier:
  template_opt simple-template-id
name-specifier:
  global-specifier
  decltype-specifier
  identifier
  simple-template-specifier
nested-name-specifier:
  list(name-specifier, ::, non-empty, terminated)

It is a relaxed version of C++ [expr.prim.id] and quite simpler to map to our API.

TODO: refine name specifiers, `simple-template-name-specifier` and
decltype-name-specifier` are token soup for now.

3 years ago[lld-macho] Add .tbd support for frameworks
Jez Ng [Fri, 7 Aug 2020 18:04:54 +0000 (11:04 -0700)]
[lld-macho] Add .tbd support for frameworks

Required for e.g. linking iOS apps since they don't have a platform-native
SDK

Reviewed By: #lld-macho, compnerd, smeenai

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

3 years ago[lld-macho] Support static linking of thread-locals
Jez Ng [Fri, 7 Aug 2020 18:04:52 +0000 (11:04 -0700)]
[lld-macho] Support static linking of thread-locals

Note: What ELF refers to as "TLS", Mach-O seems to refer to as "TLV", i.e.
thread-local variables.

This diff implements support for TLV relocations that reference defined
symbols. On x86_64, TLV relocations are always used with movq opcodes, so for
defined TLVs, we don't need to create a synthetic section to store the
addresses of the symbols -- we can just convert the `movq` to a `leaq`.

One notable quirk of Mach-O's TLVs is that absolute-address relocations
inside TLV-defining sections behave differently -- their addresses are
no longer absolute, but relative to the start of the target section.
(AFAICT, RIP-relative relocations are not allowed in these sections.)

Reviewed By: #lld-macho, compnerd, smeenai

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

3 years ago[lld-macho] Ensure .tbss sections are also considered as ZeroFilled
Jez Ng [Fri, 7 Aug 2020 18:04:41 +0000 (11:04 -0700)]
[lld-macho] Ensure .tbss sections are also considered as ZeroFilled

This diff makes the behavior in {D80859} and {D81888} apply to
thread-local ZeroFill sections too. I realized this was necessary whie
trying to implement thread-local variables.

Reviewed By: #lld-macho, compnerd, MaskRay

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

3 years ago[NewPM][CodeGen] Introduce machine pass and machine pass manager
Yuanfang Chen [Fri, 7 Aug 2020 16:24:52 +0000 (09:24 -0700)]
[NewPM][CodeGen] Introduce machine pass and machine pass manager

machine pass could define four methods:
- `PreservedAnalyses run(MachineFunction &, MachineFunctionAnalysisManager &)`
- `Error doInitialization(Module &, MachineFunctionAnalysisManager &)`
- `Error doFinalization(Module &, MachineFunctionAnalysisManager &)`
- `Error run(Module &, MachineFunctionAnalysisManager &)`

machine pass manger:
- MachineFunctionAnalysisManager:
  Basically an AnalysisManager<MachineFunction> augmented with the ability to
  register and query IR analyses
- MachineFunctionPassManager: support only two methods, `addPass` and `run`

Reviewed By: arsenm, asbirlea, aeubanks

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

3 years ago[NewPM] Only verify loop for nonskipped user loop pass
Yuanfang Chen [Fri, 7 Aug 2020 16:22:51 +0000 (09:22 -0700)]
[NewPM] Only verify loop for nonskipped user loop pass

No verification for pass mangers since it is not needed.
No verification for skipped loop pass since the asserted condition is not used.

Add a BeforeNonSkippedPass callback for this. The callback needs more
inputs than its parameters to work so the callback is added on-the-fly.

Reviewed By: aeubanks, asbirlea

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

3 years agoRevert "Reland D64327 [MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets"
Mitch Phillips [Fri, 7 Aug 2020 17:56:33 +0000 (10:56 -0700)]
Revert "Reland D64327 [MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets"

This reverts commit b497665d98ad5026b1d3d67d5793a28fefe27bea.

Spent some time trying to reproduce this locally, reverting in a
desparate attempt to fix the sanitizer buildbot:
 - http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/28828

I don't know exactly why or how this patch breaks the bots, but it seems
pretty concrete that it's the culprit.

3 years agoMake clang HIP headers compatible with C++98
Yaxun (Sam) Liu [Fri, 7 Aug 2020 17:50:22 +0000 (13:50 -0400)]
Make clang HIP headers compatible with C++98

Automation to detect compiler features, such as CMake's target_compile_features,
would attempt to detect compiler features by explicitly using langugage flags.
This change ensures that the HIP headers would still work with C++98.

Patch by Siu Chi Chan

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

Change-Id: I304e964b18a525b0fde55efd841da74b6c4dc8ed

3 years ago[analyzer] pr47030: MoveChecker: Unforget a comma in the suppression list.
Artem Dergachev [Fri, 7 Aug 2020 17:17:27 +0000 (10:17 -0700)]
[analyzer] pr47030: MoveChecker: Unforget a comma in the suppression list.

3 years ago[flang] Remove extra CMAKE_CXX_FLAGS in Lower and Optimizer
Tim Keith [Fri, 7 Aug 2020 17:21:52 +0000 (10:21 -0700)]
[flang] Remove extra CMAKE_CXX_FLAGS in Lower and Optimizer

`-Wno-error` and `-Wno-unused-parameter` appear to no longer be needed
for Lower and Optimizer.

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

3 years ago[NFC] Add utility to sum/merge stats files
Tyker [Fri, 7 Aug 2020 17:02:25 +0000 (19:02 +0200)]
[NFC] Add utility to sum/merge stats files

Add a small script to sum *.stats file given as input and output the totals
usage example:
    merge-stats.py $(find ./builddir/ -name "*.stats") > total.stats

Reviewed By: lebedev.ri

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

3 years ago[mlir] [VectorOps] Improve lowering of extract_strided_slice (and friends like shape_...
aartbik [Thu, 6 Aug 2020 22:34:47 +0000 (15:34 -0700)]
[mlir] [VectorOps] Improve lowering of extract_strided_slice (and friends like shape_cast)

Using a shuffle for the last recursive step in progressive lowering not only
results in much more compact IR, but also more efficient code (since the
backend is no longer confused on subvector aliasing for longer vectors).

E.g. the following

  %f = vector.shape_cast %v0: vector<1024xf32> to vector<32x32xf32>

yields much better x86-64 code that runs 3x faster than the original.

Reviewed By: bkramer, nicolasvasilache

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

3 years ago[ARM] Extra reduction plus tailpredication tests. NFC
David Green [Fri, 7 Aug 2020 16:16:56 +0000 (17:16 +0100)]
[ARM] Extra reduction plus tailpredication tests. NFC

3 years ago[PowerPC] Add Vector Extract/Expand/Count with Mask, Move to VSR Mask Instruction...
Amy Kwan [Thu, 6 Aug 2020 15:24:48 +0000 (10:24 -0500)]
[PowerPC] Add Vector Extract/Expand/Count with Mask, Move to VSR Mask Instruction Definitions and MC Tests

This patch adds the instruction definitions and assembly/disassembly tests for
the following set of instructions:

Vector Extract [byte | half | word | doubleword | quad] with mask
Vector Expand [byte | half | word | doubleword | quad] with mask
Move to VSR [byte | byte immediate | half | word | doubleword | quad] with mask
Vector Count Mask Bits [byte | half | word | doubleword]

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

3 years agoRevisit Dialect registration: require and store a TypeID on dialects
Mehdi Amini [Fri, 7 Aug 2020 02:41:44 +0000 (02:41 +0000)]
Revisit Dialect registration: require and store a TypeID on dialects

This patch moves the registration to a method in the MLIRContext: getOrCreateDialect<ConcreteDialect>()

This method requires dialect to provide a static getDialectNamespace()
and store a TypeID on the Dialect itself, which allows to lazyily
create a dialect when not yet loaded in the context.
As a side effect, it means that duplicated registration of the same
dialect is not an issue anymore.

To limit the boilerplate, TableGen dialect generation is modified to
emit the constructor entirely and invoke separately a "init()" method
that the user implements.

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

3 years ago[PowerPC][PCRelative] Set TLS unsupported with PC relative memops
Kamau Bridgeman [Thu, 6 Aug 2020 17:29:35 +0000 (12:29 -0500)]
[PowerPC][PCRelative] Set TLS unsupported with PC relative memops

Introduce a fatal error if any thread local storage code is compiled
using pc relative memory operations as well as a hidden override
option `-enable-ppc-pcrel-tls` so that this support can be incrementally
added if possible.

Reviewed By: #powerpc, nemanjai

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

3 years ago[OPENMP]Simplify representation for atomic, critical, master and section
Alexey Bataev [Mon, 6 Jul 2020 17:32:11 +0000 (13:32 -0400)]
[OPENMP]Simplify representation for atomic, critical, master and section
constrcut.

Several constructs may be represented wityout relying on CapturedStmt.
It saves memory and improves compilation speed.

3 years ago[PowerPC] Add compatibility check for PPC PLT stubs
Victor Huang [Fri, 7 Aug 2020 13:44:29 +0000 (13:44 +0000)]
[PowerPC] Add compatibility check for PPC PLT stubs

Compatibility checks for PPC64PltCallStub and PPC64PCRelPLTStub are
added in this patch to prevent the usage of incompatible thunk/stub.

Reviewed By: sfertile, nemanjai, stefanp

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

3 years ago[NFC][GVN] Fix "avaliable" typos
Jay Foad [Fri, 7 Aug 2020 12:38:43 +0000 (13:38 +0100)]
[NFC][GVN] Fix "avaliable" typos

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

3 years ago[Fixed Point] Add fixed-point shift operations and consteval.
Bevin Hansson [Fri, 3 Jul 2020 11:26:57 +0000 (13:26 +0200)]
[Fixed Point] Add fixed-point shift operations and consteval.

Reviewers: rjmccall, leonardchan, bjope

Subscribers: cfe-commits

Tags: #clang

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

3 years ago[Intrinsic] Add sshl.sat/ushl.sat, saturated shift intrinsics.
Bevin Hansson [Thu, 16 Jul 2020 15:02:04 +0000 (17:02 +0200)]
[Intrinsic] Add sshl.sat/ushl.sat, saturated shift intrinsics.

Summary:
This patch adds two intrinsics, llvm.sshl.sat and llvm.ushl.sat,
which perform signed and unsigned saturating left shift,
respectively.

These are useful for implementing the Embedded-C fixed point
support in Clang, originally discussed in
http://lists.llvm.org/pipermail/llvm-dev/2018-August/125433.html
and
http://lists.llvm.org/pipermail/cfe-dev/2018-May/058019.html

Reviewers: leonardchan, craig.topper, bjope, jdoerfert

Subscribers: hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

3 years ago[LangRef] Minor fixes to intrinsic headers and descriptions. NFC.
Bevin Hansson [Thu, 16 Jul 2020 15:00:34 +0000 (17:00 +0200)]
[LangRef] Minor fixes to intrinsic headers and descriptions. NFC.

3 years ago[clangd] Fix a typo, NFC.
Haojian Wu [Fri, 7 Aug 2020 13:02:06 +0000 (15:02 +0200)]
[clangd] Fix a typo, NFC.

3 years ago[Sema] Add casting check for fixed to fixed point conversions
Vince Bridgers [Mon, 3 Aug 2020 20:37:59 +0000 (15:37 -0500)]
[Sema] Add casting check for fixed to fixed point conversions

This change squelches the warning for a cast from fixed to fixed point
conversions when -Wbad-function-cast is enabled.

Fixes:

cast from function call of type '_Fract' to non-matching type '_Fract'
[-Wbad-function-cast]

Reviewed By: bjope

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

3 years ago[macho2yaml] Remove unused functions. NFC.
Xing GUO [Fri, 7 Aug 2020 12:33:18 +0000 (20:33 +0800)]
[macho2yaml] Remove unused functions. NFC.

dumpDebugStrings() and dumpDebugAbbrev() are no longer used in
macho2yaml. This patch helps remove them.

Reviewed By: grimar

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

3 years agoBEGIN_PUBLIC
Alexander Belyaev [Fri, 7 Aug 2020 12:31:02 +0000 (14:31 +0200)]
BEGIN_PUBLIC
[mlir] Add support for unranked case for `tensor_store` and `tensor_load` ops.
END_PUBLIC

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

3 years ago[mlir] Remove llvm::LLVMContext and llvm::Module from mlir::LLVMDialectImpl
Alex Zinenko [Thu, 6 Aug 2020 16:16:14 +0000 (18:16 +0200)]
[mlir] Remove llvm::LLVMContext and llvm::Module from mlir::LLVMDialectImpl

Original modeling of LLVM IR types in the MLIR LLVM dialect had been wrapping
LLVM IR types and therefore required the LLVMContext in which they were created
to outlive them, which was solved by placing the LLVMContext inside the dialect
and thus having the lifetime of MLIRContext. This has led to numerous issues
caused by the lack of thread-safety of LLVMContext and the need to re-create
LLVM IR modules, obtained by translating from MLIR, in different LLVM contexts
to enable parallel compilation. Similarly, llvm::Module had been introduced to
keep track of identified structure types that could not be modeled properly.

A recent series of commits changed the modeling of LLVM IR types in the MLIR
LLVM dialect so that it no longer wraps LLVM IR types and has no dependence on
LLVMContext and changed the ownership model of the translated LLVM IR modules.
Remove LLVMContext and LLVM modules from the implementation of MLIR LLVM
dialect and clean up the remaining uses.

The only part of LLVM IR that remains necessary for the LLVM dialect is the
data layout. It should be moved from the dialect level to the module level and
replaced with an MLIR-based representation to remove the dependency of the
LLVMDialect on LLVM IR library.

Reviewed By: rriddle

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

3 years ago[mlir] do not require LLVMDialect in conversion from LLVM IR
Alex Zinenko [Thu, 6 Aug 2020 16:16:04 +0000 (18:16 +0200)]
[mlir] do not require LLVMDialect in conversion from LLVM IR

Historically, LLVMDialect has been required in the conversion from LLVM IR in
order to be able to construct types. This is no longer necessary with the new
type model and the dialect can be replaced with a local LLVM context.

Reviewed By: rriddle, mehdi_amini

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

3 years ago[mlir] take LLVMContext in MLIR-to-LLVM-IR translation
Alex Zinenko [Thu, 6 Aug 2020 16:15:47 +0000 (18:15 +0200)]
[mlir] take LLVMContext in MLIR-to-LLVM-IR translation

Due to the original type system implementation, LLVMDialect in MLIR contains an
LLVMContext in which the relevant objects (types, metadata) are created. When
an MLIR module using the LLVM dialect (and related intrinsic-based dialects
NVVM, ROCDL, AVX512) is converted to LLVM IR, it could only live in the
LLVMContext owned by the dialect. The type system no longer relies on the
LLVMContext, so this limitation can be removed. Instead, translation functions
now take a reference to an LLVMContext in which the LLVM IR module should be
constructed. The caller of the translation functions is responsible for
ensuring the same LLVMContext is not used concurrently as the translation no
longer uses a dialect-wide context lock.

As an additional bonus, this change removes the need to recreate the LLVM IR
module in a different LLVMContext through printing and parsing back, decreasing
the compilation overhead in JIT and GPU-kernel-to-blob passes.

Reviewed By: rriddle, mehdi_amini

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

3 years ago[DAG] GetDemandedBits - remove custom AND handling.
Simon Pilgrim [Fri, 7 Aug 2020 11:55:47 +0000 (12:55 +0100)]
[DAG] GetDemandedBits - remove custom AND handling.

As mentioned on D85463, we should be using SimplifyMultipleUseDemandedBits (which is the default fallback).

The minor regression in illegal-bitfield-loadstore.ll will be addressed properly by D77804.

3 years agoRemove unreachable break. NFC
Simon Pilgrim [Fri, 7 Aug 2020 11:37:49 +0000 (12:37 +0100)]
Remove unreachable break. NFC

3 years agoRemove duplicate/unreachable break (PR47029)
Simon Pilgrim [Fri, 7 Aug 2020 10:48:48 +0000 (11:48 +0100)]
Remove duplicate/unreachable break (PR47029)

3 years ago[SLP][X86] Add smax intrinsic reduction tests
Simon Pilgrim [Fri, 7 Aug 2020 10:48:08 +0000 (11:48 +0100)]
[SLP][X86] Add smax intrinsic reduction tests

SLP currently only matches the ICMP+SELECT patterns for min/max reductions

3 years agoRemove unreachable return (PR47028)
Simon Pilgrim [Fri, 7 Aug 2020 10:33:07 +0000 (11:33 +0100)]
Remove unreachable return (PR47028)

3 years ago[Sema][BFloat] Forbid arithmetic on vectors of bfloat.
Simon Tatham [Fri, 7 Aug 2020 09:26:29 +0000 (10:26 +0100)]
[Sema][BFloat] Forbid arithmetic on vectors of bfloat.

Vectors of bfloat are a storage format only; you're supposed to
explicitly convert them to a wider type to do arithmetic on them.
But currently, if you write something like

  bfloat16x4_t test(bfloat16x4_t a, bfloat16x4_t b) { return a + b; }

then the clang frontend accepts it without error, and (ARM or AArch64)
isel fails to generate code for it.

Added a rule in Sema that forbids the attempt from even being made,
and tests that check it. In particular, we also outlaw arithmetic
between vectors of bfloat and any other vector type.

Patch by Luke Cheeseman.

Reviewed By: LukeGeeson

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

3 years agoRemove unreachable return (PR47026)
Simon Pilgrim [Fri, 7 Aug 2020 10:20:44 +0000 (11:20 +0100)]
Remove unreachable return (PR47026)

3 years ago[SLP][X86] Add abs/smax/smin/umax/umin intrinsic vectorization tests
Simon Pilgrim [Fri, 7 Aug 2020 10:19:04 +0000 (11:19 +0100)]
[SLP][X86] Add abs/smax/smin/umax/umin intrinsic vectorization tests

3 years ago[NFC][Test] Format the test with script update_llc_test_checks.py
QingShan Zhang [Fri, 7 Aug 2020 10:20:58 +0000 (10:20 +0000)]
[NFC][Test] Format the test with script update_llc_test_checks.py

3 years ago[mlir][Vector] Add 2-D vector contract lowering to ReduceOp
Nicolas Vasilache [Thu, 6 Aug 2020 13:00:38 +0000 (09:00 -0400)]
[mlir][Vector] Add 2-D vector contract lowering to ReduceOp

This new pattern mixes vector.transpose and direct lowering to vector.reduce.
This allows more progressive lowering than immediately going to insert/extract and
composes more nicely with other canonicalizations.
This has 2 use cases:
1. for very wide vectors the generated IR may be much smaller
2. when we have a custom lowering for transpose ops we can target it directly
rather than rely LLVM

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

3 years ago[Test] Added test showing missing range check elimination opportunity in IndVars
Max Kazantsev [Fri, 7 Aug 2020 09:46:39 +0000 (16:46 +0700)]
[Test] Added test showing missing range check elimination opportunity in IndVars

Seems that SCEV is not powerful enough to handle this.

3 years ago[AArch64] Disable waitid.cpp test for AArch64
Oliver Stannard [Fri, 7 Aug 2020 09:41:16 +0000 (10:41 +0100)]
[AArch64] Disable waitid.cpp test for AArch64

This test is failing intermittently on the AArch64 build bots, disable
it for now to keep the bots green while we investigate it.

3 years ago[clangd] Include the underlying decls in go-to-definition.
Haojian Wu [Fri, 7 Aug 2020 09:36:33 +0000 (11:36 +0200)]
[clangd] Include the underlying decls in go-to-definition.

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

Reviewed By: sammccall

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

3 years ago[NFC] Replace hasName in loop for hasAnyName
Nathan James [Fri, 7 Aug 2020 09:22:26 +0000 (10:22 +0100)]
[NFC] Replace hasName in loop for hasAnyName

3 years ago[VE] Change to expand multiply related instructions
Kazushi (Jam) Marukawa [Tue, 4 Aug 2020 07:41:12 +0000 (16:41 +0900)]
[VE] Change to expand multiply related instructions

Change to expand MULHU/MULHS/UMUL_LOHI/SMUL_LOHI for i32 and i64 since
those instructions are not available on Aurora SX VE.  Some of them
are used in expansion of i128 multiply, so need to modify them to
support i128.  Then, update basic arithmetic regression tests of
i128 and signed/unsigned i32 typed integer values.

Reviewed By: simoll

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

3 years ago[VE] Remove obsoleted getVEAsmModeForCPU function
Kazushi (Jam) Marukawa [Wed, 24 Jun 2020 11:55:40 +0000 (20:55 +0900)]
[VE] Remove obsoleted getVEAsmModeForCPU function

Reviewed By: simoll

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

3 years ago[AST][RecoveryExpr] Fix the missing type when rebuilding RecoveryExpr in TreeTransform.
Haojian Wu [Fri, 7 Aug 2020 09:14:37 +0000 (11:14 +0200)]
[AST][RecoveryExpr] Fix the missing type when rebuilding RecoveryExpr in TreeTransform.

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

3 years ago[DebugInfo] Remove DwarfUnit::getDwarfVersion(). NFC.
Igor Kudrin [Thu, 6 Aug 2020 10:48:57 +0000 (17:48 +0700)]
[DebugInfo] Remove DwarfUnit::getDwarfVersion(). NFC.

This helper method was used only in one place, which can easily use the
direct call.

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

3 years ago[DebugInfo] Clean up DIEUnit. NFC.
Igor Kudrin [Thu, 6 Aug 2020 10:49:05 +0000 (17:49 +0700)]
[DebugInfo] Clean up DIEUnit. NFC.

This removes members of the DIEUnit class which were used only in unit
tests. Note also that child classes shadowed some of these methods,
namely, getDwarfVersion() was overridden in DwartfUnit and getLength()
was overridden in DwarfCompileUnit.

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

3 years ago[SyntaxTree][NFC] remove redundant namespace-specifiers
Eduardo Caldas [Thu, 6 Aug 2020 12:13:36 +0000 (12:13 +0000)]
[SyntaxTree][NFC] remove redundant namespace-specifiers

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

3 years ago[Attributor] AAPotentialValues Interface
Shinji Okumura [Fri, 7 Aug 2020 08:06:42 +0000 (17:06 +0900)]
[Attributor] AAPotentialValues Interface

This is a split patch of D80991.
This patch introduces AAPotentialValues and its interface only.
For more detail of AAPotentialValues abstract attribute, see the original patch.

Reviewed By: jdoerfert

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

3 years ago[clang, test, Darwin] Fix tests expecting Darwin target
Thomas Preud'homme [Wed, 5 Aug 2020 22:03:21 +0000 (23:03 +0100)]
[clang, test, Darwin] Fix tests expecting Darwin target

Clang tests Driver/apple-arm64-arch.c and
Driver/darwin-warning-options.c test Darwin driver functionality but
only require the host system to be Darwin. This leads the tests to fail
when building a cross-compiler on Darwin and to be marked unsupported
when cross-compiling to Darwin from another system. This commit changes
the requirements for those tests to require the target to be Darwin.

Reviewed By: steven_wu

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

3 years agoRevert "[CMake] Simplify CMake handling for zlib"
Christian Kühnel [Fri, 7 Aug 2020 07:36:49 +0000 (09:36 +0200)]
Revert "[CMake] Simplify CMake handling for zlib"

This reverts commit 1adc494bce44f6004994deed61b30d4b71fe1d05.
This patch broke the Windows compilation on buildbot and pre-merge testing:
http://lab.llvm.org:8011/builders/mlir-windows/builds/5945
https://buildkite.com/llvm-project/llvm-master-build/builds/780

3 years ago[Test] Add one more test on IndVars that was failing on one of older builds
Max Kazantsev [Fri, 7 Aug 2020 07:11:53 +0000 (14:11 +0700)]
[Test] Add one more test on IndVars that was failing on one of older builds

3 years ago[clangd] Highlight structured bindings at local scope as LocalVariable
Nathan Ridge [Fri, 7 Aug 2020 05:31:03 +0000 (01:31 -0400)]
[clangd] Highlight structured bindings at local scope as LocalVariable

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

3 years ago[NFC] Add the stats for load/store cluster
QingShan Zhang [Fri, 7 Aug 2020 07:09:48 +0000 (07:09 +0000)]
[NFC] Add the stats for load/store cluster

We have the stats for MacroFusion but miss it for load/store cluster.

3 years ago[SVE][CodeGen] Fix bug with store of unpacked FP scalable vectors
David Sherwood [Thu, 6 Aug 2020 15:53:13 +0000 (16:53 +0100)]
[SVE][CodeGen] Fix bug with store of unpacked FP scalable vectors

Fixed an incorrect pattern in lib/Target/AArch64/AArch64SVEInstrInfo.td
for storing out <vscale x 2 x f32> unpacked scalable vectors. Added
a couple of tests to

  test/CodeGen/AArch64/sve-st1-addressing-mode-reg-imm.ll

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

3 years ago[LLDB] Mark test_launch_simple as a no-debug-info test
Jonas Devlieghere [Fri, 7 Aug 2020 06:18:18 +0000 (23:18 -0700)]
[LLDB] Mark test_launch_simple as a no-debug-info test

No need to run this test with the multiple variants.

3 years ago[PowerPC] Implement Vector Extract Low/High Order Builtins in LLVM/Clang
biplmish [Fri, 7 Aug 2020 06:02:29 +0000 (01:02 -0500)]
[PowerPC] Implement Vector Extract Low/High Order Builtins in LLVM/Clang

This patch implements the function prototypes vec_extractl and vec_extracth in altivec.h to utilize the vector extract double element instructions introduced in Power10.

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

3 years ago[PowerPC] Support constrained fp operation for setcc
QingShan Zhang [Fri, 7 Aug 2020 05:16:36 +0000 (05:16 +0000)]
[PowerPC] Support constrained fp operation for setcc

The constrained fp operation fcmp was added by https://reviews.llvm.org/D69281.
This patch is trying to add the support for PowerPC backend.

Reviewed By: uweigand

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

3 years ago[Scheduling] Create the missing dependency edges for store cluster
QingShan Zhang [Fri, 7 Aug 2020 04:53:37 +0000 (04:53 +0000)]
[Scheduling] Create the missing dependency edges for store cluster

If it is load cluster, we don't need to create the dependency edges(SUb->reg) from SUb to SUa
as they both depend on the base register "reg"

     +-------+
+---->  reg  |
|    +---+---+
|        ^
|        |
|        |
|        |
|    +---+---+
|    |  SUa  |  Load 0(reg)
|    +---+---+
|        ^
|        |
|        |
|    +---+---+
+----+  SUb  |  Load 4(reg)
     +-------+

But if it is store cluster, we need to create it as follow shows to avoid the instruction store
depend on scheduled in-between SUb and SUa.

     +-------+
+---->  reg  |
|    +---+---+
|        ^
|        |         Missing       +-------+
|        | +-------------------->+   y   |
|        | |                     +---+---+
|    +---+-+-+                       ^
|    |  SUa  |  Store x 0(reg)       |
|    +---+---+                       |
|        ^                           |
|        |  +------------------------+
|        |  |
|    +---+--++
+----+  SUb  |  Store y 4(reg)
     +-------+

Reviewed By: evandro, arsenm, rampitec, foad, fhahn

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

3 years ago[Polly] Support linking ScopPassManager against LLVM dylib
Michał Górny [Wed, 5 Aug 2020 08:22:32 +0000 (10:22 +0200)]
[Polly] Support linking ScopPassManager against LLVM dylib

Link ScopPassManager to LLVM dylib target if LLVM_LINK_LLVM_DYLIB
is enabled.  This fixes build failures on systems where static LLVM
libraries are not installed.

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

3 years ago[AArch64][NFC] require aarch64 support for hwasan test
Sameer Sahasrabuddhe [Fri, 7 Aug 2020 03:54:52 +0000 (09:24 +0530)]
[AArch64][NFC] require aarch64 support for hwasan test

This was breaking builds where the target is not enabled.

Reviewed By: danielkiss, eugenis

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

3 years ago[StackSafety,NFC] Fix tests in debug
Vitaly Buka [Fri, 7 Aug 2020 03:46:02 +0000 (20:46 -0700)]
[StackSafety,NFC] Fix tests in debug

3 years ago[flang] Improve message for assignment to subprogram
Tim Keith [Fri, 7 Aug 2020 03:33:59 +0000 (20:33 -0700)]
[flang] Improve message for assignment to subprogram

In the example below we were producing the error message
"Assignment to constant 'f' is not allowed":
```
function f() result(r)
  f = 1.0
end
```

This changes it to a more helpful message when the LHS is a subprogram
name and also mentions the function result name when it's a function.

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

3 years ago[Attributor] Check violation of returned position nonnull and noundef attribute in...
Shinji Okumura [Fri, 7 Aug 2020 02:40:53 +0000 (11:40 +0900)]
[Attributor] Check violation of returned position nonnull and noundef attribute in AAUndefinedBehavior

This patch is a follow up of D84733.
If a function has noundef attribute in returned position, instructions that return undef or poison value cause UB.

Reviewed By: jdoerfert

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

3 years ago[StackSafety,NFC] Add more tests
Vitaly Buka [Fri, 7 Aug 2020 02:49:26 +0000 (19:49 -0700)]
[StackSafety,NFC] Add more tests

3 years ago[StackSafety,NFC] Sort llvm-lto2 resolutions in tests
Vitaly Buka [Fri, 7 Aug 2020 02:46:52 +0000 (19:46 -0700)]
[StackSafety,NFC] Sort llvm-lto2 resolutions in tests

3 years ago[StackSafety,NFC] Add debug counters
Vitaly Buka [Thu, 6 Aug 2020 12:19:12 +0000 (05:19 -0700)]
[StackSafety,NFC] Add debug counters

3 years ago[StackSafety,NFC] Use CHECK-EMPTY in tests
Vitaly Buka [Thu, 6 Aug 2020 12:09:44 +0000 (05:09 -0700)]
[StackSafety,NFC] Use CHECK-EMPTY in tests

3 years ago[LLParser,NFC] Simplify forward GV refs update
Vitaly Buka [Fri, 7 Aug 2020 02:16:39 +0000 (19:16 -0700)]
[LLParser,NFC] Simplify forward GV refs update

Reviewed By: tejohnson

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

3 years ago[polly] Unbreak buildbot.
Michael Kruse [Fri, 7 Aug 2020 02:07:29 +0000 (21:07 -0500)]
[polly] Unbreak buildbot.

The test failed since commit
bc10888dc "DomTree: Make PostDomTree indifferent to block successors swap"
which is a re-commit of
c35585e20 "DomTree: Make PostDomTree immune to block successors swap"

3 years ago[StackSafety] Skip ambiguous lifetime analysis
Vitaly Buka [Fri, 7 Aug 2020 02:10:02 +0000 (19:10 -0700)]
[StackSafety] Skip ambiguous lifetime analysis

If we can't identify alloca used in lifetime marker we
need to assume to worst case scenario.

Reviewed By: eugenis

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

3 years agoReinstate check that we don't crash.
Richard Smith [Fri, 7 Aug 2020 02:07:50 +0000 (19:07 -0700)]
Reinstate check that we don't crash.

3 years agoDisable clang-tidy test that started failing after clang commit ed5a18f.
Richard Smith [Fri, 7 Aug 2020 02:03:23 +0000 (19:03 -0700)]
Disable clang-tidy test that started failing after clang commit ed5a18f.

This checker appears to be intentionally not diagnosing cases where an
operator appearing in a duplicated expression might have side-effects;
Clang is now modeling fold-expressions as having an unresolved operator
name within them, so they now trip up this check.

3 years ago[LTO,NFC] Skip generateParamAccessSummary when empty
Vitaly Buka [Fri, 7 Aug 2020 01:52:35 +0000 (18:52 -0700)]
[LTO,NFC] Skip generateParamAccessSummary when empty

addGlobalValueSummary can check newly added FunctionSummary
and set HasParamAccess to mark that generateParamAccessSummary
is needed.

Reviewed By: tejohnson

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

3 years ago[NewPM] Add callback for skipped passes
Arthur Eubanks [Thu, 6 Aug 2020 22:14:50 +0000 (15:14 -0700)]
[NewPM] Add callback for skipped passes

Parallel to https://reviews.llvm.org/D84772.

Will use this for printing when a pass is skipped.

Reviewed By: ychen

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

3 years ago[clangd] Semantic highlighting for dependent template name in template argument
Nathan Ridge [Wed, 5 Aug 2020 03:33:41 +0000 (23:33 -0400)]
[clangd] Semantic highlighting for dependent template name in template argument

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

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

3 years agofix doc typo to cycle bots
Nico Weber [Fri, 7 Aug 2020 01:02:41 +0000 (21:02 -0400)]
fix doc typo to cycle bots

3 years ago[VE] Optimize trunc related instructions
Kazushi (Jam) Marukawa [Tue, 4 Aug 2020 07:41:12 +0000 (16:41 +0900)]
[VE] Optimize trunc related instructions

Change to not generate truncate instructions if all use of a truncate
operation don't care about higher bits.  For example, an i32 add
instruction doesn't care about higher 32 bits in 64 bit registers.
Updates regression tests also.

Reviewed By: simoll

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

3 years agoPR30738: Implement two-phase name lookup for fold-expressions.
Richard Smith [Thu, 6 Aug 2020 22:57:35 +0000 (15:57 -0700)]
PR30738: Implement two-phase name lookup for fold-expressions.

3 years ago[GlobalISel] Fix computing known bits for loads with range metadata
Jessica Paquette [Wed, 5 Aug 2020 23:32:55 +0000 (16:32 -0700)]
[GlobalISel] Fix computing known bits for loads with range metadata

In GlobalISel, if you have a load into a small type with a range, you'll hit
an assert if you try to compute known bits on it starting at a larger type.

e.g.

```
%x:_(s8) = G_LOAD %whatever(p0) :: (load 1 ... !range !n)
...
%y:_(s32) = G_SOMETHING %x
```

When we walk through G_SOMETHING and hit the load, the width of our known bits
is 32. However, the width of the range is going to be 8. This will cause us
to hit an assert.

To fix this, make computeKnownBitsFromRangeMetadata zero extend or truncate
the range type to match the bitwidth of the known bits we're calculating.

Add a testcase in CodeGen/GlobalISel/KnownBitsTest.cpp to reflect that this
works now.

https://reviews.llvm.org/D85375

3 years agoFactor out common code from the iPhone/AppleTV/WatchOS simulator platform plugins...
Adrian Prantl [Wed, 5 Aug 2020 22:22:20 +0000 (15:22 -0700)]
Factor out common code from the iPhone/AppleTV/WatchOS simulator platform plugins. (NFC)

The implementation of these classes was copied & pasted from the
iPhone simulator plugin with only a handful of configuration
parameters substituted. This patch moves the redundant implementations
into the base class PlatformAppleSimulator.

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

3 years agoGlobalISel: Implement lower for G_INSERT_VECTOR_ELT
Matt Arsenault [Tue, 28 Jul 2020 01:13:40 +0000 (21:13 -0400)]
GlobalISel: Implement lower for G_INSERT_VECTOR_ELT

3 years ago[gn build] mac: use frameworks instead of libs where appropriate
Mark Mentovai [Thu, 6 Aug 2020 22:57:56 +0000 (18:57 -0400)]
[gn build] mac: use frameworks instead of libs where appropriate

As of GN 3028c6a426a4, the hack that transformed "libs" ending in
".framework" from -l arguments to -framework arguments has been removed.
Instead, "frameworks" must be used, and the toolchain must provide
support.

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

3 years ago[NewPM][GuardWidening] Fix loop guard widening tests under NPM
Arthur Eubanks [Thu, 6 Aug 2020 04:12:08 +0000 (21:12 -0700)]
[NewPM][GuardWidening] Fix loop guard widening tests under NPM

Reviewed By: ychen, asbirlea

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

3 years ago[ELF] Change tombstone values to (.debug_ranges/.debug_loc) 1 and (other .debug_*) 0
Fangrui Song [Thu, 6 Aug 2020 19:34:16 +0000 (12:34 -0700)]
[ELF] Change tombstone values to (.debug_ranges/.debug_loc) 1 and (other .debug_*) 0

tl;dr See D81784 for the 'tombstone value' concept. This patch changes our behavior to be almost the same as GNU ld (except that we also use 1 for .debug_loc):

* .debug_ranges & .debug_loc: 1 (LLD<11: 0+addend; GNU ld uses 1 for .debug_ranges)
* .debug_*: 0 (LLD<11: 0+addend; GNU ld uses 0; future LLD: -1)

We make the tweaks because:

1) The new tombstone is novel and needs more time to be adopted by consumers before it's the default.
2) The old (gold) strategy had problems with zero-length functions - so rather than going back that, we're going to the GNU ld strategy which doesn't have that problem.
3) One slight tweak to (2) is to apply the .debug_ranges workaround to .debug_loc for the same reasons it applies to debug_ranges - to avoid terminating lists early.

-----

http://lists.llvm.org/pipermail/llvm-dev/2020-July/143482.html

The tombstone value -1 in .debug_line caused problems to lldb (fixed by D83957;
will be included in 11.0.0) and breakpad (fixed by
https://crrev.com/c/2321300). It may potentially affects other DWARF consumers.

For .debug_ranges & .debug_loc: 1, an argument preferring 1 (GNU ld for .debug_ranges) over -2 is that:
```
{-1, -2}    <<< base address selection entry
{0, length} <<< address range
```
may create a situation where low_pc is greater than high_pc. So we use
1, the GNU ld behavior for .debug_ranges

For other .debug_* sections, there haven't been many reports. One issue is that
bloaty (src/dwarf.cc) can incorrectly count address ranges in .debug_ranges . To
reduce similar disruption, this patch changes the tombstone values to be similar to GNU ld.

This does mean another behavior change to the default trunk behavior. Sorry
about it. The default trunk behavior will be similar to release/11.x while we work on a transition plan for LLD users.

Reviewed By: dblaikie, echristo

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

3 years agoBPF: fix libLLVMBPFCodeGen.so build failure
Yonghong Song [Thu, 6 Aug 2020 22:22:03 +0000 (15:22 -0700)]
BPF: fix libLLVMBPFCodeGen.so build failure

Buildbot reported a build failure when building shared
library libLLVMBPFCodeGen.so with unknown reference to
"createCFGSimplificationPass".

Commit 87cba434027b ("BPF: add a SimplifyCFG IR pass during
generic Scalar/IPO optimization") added an IR pass SimplifyCFG
by BPF target. The commit called function
createCFGSimplificationPass() defined in "Scalar" library.
Add this library in Target/BPF/LLVMBuild.txt so
shared library build can succeed.

3 years ago[AMDGPU] Correct missing sram-ecc target feature for gfx906
Tony [Thu, 6 Aug 2020 22:04:20 +0000 (22:04 +0000)]
[AMDGPU] Correct missing sram-ecc target feature for gfx906

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

3 years agoAMDGPU/GlobalISel: Enable s_{and|or}n2_{b32|b64} patterns
Matt Arsenault [Sun, 26 Jul 2020 21:47:59 +0000 (17:47 -0400)]
AMDGPU/GlobalISel: Enable s_{and|or}n2_{b32|b64} patterns

3 years ago[msan] Support %ms in scanf.
Evgenii Stepanov [Wed, 5 Aug 2020 19:32:17 +0000 (12:32 -0700)]
[msan] Support %ms in scanf.

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

3 years ago[flang][msvc] Do not use gcc/clang command line options for msvc.
Michael Kruse [Thu, 6 Aug 2020 20:44:47 +0000 (15:44 -0500)]
[flang][msvc] Do not use gcc/clang command line options for msvc.

The command line options `-Wno-error` and `-Wno-unused-parameter` are specific to gcc/clang, do not use them when compiling with other compilers.

This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].

Reviewed By: isuruf

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

3 years ago[InstCombine] Fold (x + C1) * (-1<<C2) --> (-C1 - x) * (1<<C2)
Roman Lebedev [Thu, 6 Aug 2020 20:04:05 +0000 (23:04 +0300)]
[InstCombine] Fold  (x + C1) * (-1<<C2)  -->  (-C1 - x) * (1<<C2)

Negator knows how to do this, but the one-use reasoning is getting
a bit muddy here, we don't really want to increase instruction count,
so we need to both lie that "IsNegation" and have an one-use check
on the outermost LHS value.

3 years ago[InstCombine] Generalize %x * (-1<<C) --> (-%x) * (1<<C) fold
Roman Lebedev [Thu, 6 Aug 2020 18:10:43 +0000 (21:10 +0300)]
[InstCombine] Generalize  %x * (-1<<C)  -->  (-%x) * (1<<C)  fold

Multiplication is commutative, and either of operands can be negative,
so if the RHS is a negated power-of-two, we should try to make it
true power-of-two (which will allow us to turn it into a left-shift),
by trying to sink the negation down into LHS op.

But, we shouldn't re-invent the logic for sinking negation,
let's just use Negator for that.

Tests and original patch by: Simon Pilgrim @RKSimon!

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

3 years ago[NFC][InstCombine] Add some more tests for negation sinking into mul
Roman Lebedev [Thu, 6 Aug 2020 19:43:39 +0000 (22:43 +0300)]
[NFC][InstCombine] Add some more tests for negation sinking into mul

3 years ago[InstCombine] Fold sdiv exact X, -1<<C --> -(ashr exact X, C)
Roman Lebedev [Thu, 6 Aug 2020 18:08:30 +0000 (21:08 +0300)]
[InstCombine] Fold  sdiv exact X, -1<<C  -->  -(ashr exact X, C)

While that does increases instruction count,
shift is obviously better than a division.

Name: base
Pre: (1<<C1) >= 0
%o0 = shl i8 1, C1
%r = sdiv exact i8 C0, %o0
  =>
%r = ashr exact i8 C0, C1

Name: neg
%o0 = shl i8 -1, C1
%r = sdiv exact i8 C0, %o0
  =>
%t0 = ashr exact i8 C0, C1
%r = sub i8 0, %t0

Name: reverse
Pre: C1 != 0 && C1 u< 8
%t0 = ashr exact i8 C0, C1
%r = sub i8 0, %t0
  =>
%o0 = shl i8 -1, C1
%r = sdiv exact i8 C0, %o0

https://rise4fun.com/Alive/MRplf

3 years ago[NFC][InstCombine] Negator: add a comment about negating exact arithmentic shift
Roman Lebedev [Thu, 6 Aug 2020 18:07:45 +0000 (21:07 +0300)]
[NFC][InstCombine] Negator: add a comment about negating exact arithmentic shift

3 years ago[InstCombine] Generalize sdiv exact X, 1<<C --> ashr exact X, C fold to handle...
Roman Lebedev [Thu, 6 Aug 2020 17:18:55 +0000 (20:18 +0300)]
[InstCombine] Generalize  sdiv exact X, 1<<C  -->  ashr exact X, C  fold to handle non-splat vectors

3 years ago[NFC][InstCombine] Better tests for x s/EXACT (1 << y) pattern
Roman Lebedev [Thu, 6 Aug 2020 18:04:03 +0000 (21:04 +0300)]
[NFC][InstCombine] Better tests for  x s/EXACT (1 << y)  pattern

3 years ago[NFC][InstCombine] Tests for x s/EXACT (-1 << y) pattern
Roman Lebedev [Thu, 6 Aug 2020 16:57:33 +0000 (19:57 +0300)]
[NFC][InstCombine] Tests for  x s/EXACT (-1 << y)  pattern

3 years agoUnify the code that updates the ArchSpec after finding a fat binary
Adrian Prantl [Thu, 6 Aug 2020 17:52:16 +0000 (10:52 -0700)]
Unify the code that updates the ArchSpec after finding a fat binary
with how it is done for a lean binary

In particular this affects how target create --arch is handled — it
allowed us to override the deployment target (a useful feature for the
expression evaluator), but the fat binary case didn't.

rdar://problem/66024437

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

(cherry picked from commit 470bdd3caaab0b6e0ffed4da304244be40b78668)