platform/upstream/llvm.git
4 years ago[ELF] Handle -u before input files
Fangrui Song [Fri, 5 Jun 2020 15:41:03 +0000 (08:41 -0700)]
[ELF] Handle -u before input files

If both a.a and b.so define foo

```
ld.bfd -u foo a.a b.so  # foo is defined
ld.bfd a.a b.so -u foo  # foo is defined
ld.bfd -u foo b.so a.a  # foo is undefined (provided at runtime by b.so)
ld.bfd b.so a.a -u foo  # foo is undefined (provided at runtime by b.so)
```

In all cases we make foo undefined in the output.  I tend to think the
GNU ld behavior makes more sense.

* In their model, they have to treat -u as a fake object file with an
  undefined symbol before all input files, otherwise the first archive would not be fetched.
* Following their behavior allows us to drop a --warn-backrefs special case.

Reviewed By: psmith

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

4 years agoFix crash on misc-redundant-expression
Zinovy Nis [Sun, 31 May 2020 18:53:13 +0000 (21:53 +0300)]
Fix crash on misc-redundant-expression

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

4 years ago[dsymutil] Don't emit N_AST symbol entries in the Mach-O companion file
Jonas Devlieghere [Fri, 5 Jun 2020 15:39:02 +0000 (08:39 -0700)]
[dsymutil] Don't emit N_AST symbol entries in the Mach-O companion file

Treat N_AST symbol table entries like other debug entries and don't emit
them in the linked binary.

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

4 years ago[mlir][SCF] Add single iteration scf.for promotion to the FuncOp level helper.
Nicolas Vasilache [Fri, 5 Jun 2020 15:23:43 +0000 (11:23 -0400)]
[mlir][SCF] Add single iteration scf.for promotion to the FuncOp level helper.

Previously only the Affine version would be folded.

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

4 years ago[lit] Improve naming of test result categories
Julian Lettner [Wed, 8 Apr 2020 05:48:39 +0000 (22:48 -0700)]
[lit] Improve naming of test result categories

Improve consistency when printing test results:
Previously we were using different labels for group names (the header
for the list of, e.g., failing tests) and summary count lines.  For
example, "Failing Tests"/"Unexpected Failures".  This commit changes lit
to label things consistently.

Improve wording of labels:
When talking about individual test results, the first word in
"Unexpected Failures", "Expected Passes", and "Individual Timeouts" is
superfluous.  Some labels contain the word "Tests" and some don't.
Let's simplify the names.

Before:
```
Failing Tests (1):
  ...

Expected Passes    : 3
Unexpected Failures: 1
```

After:
```
Failed Tests (1):
  ...

Passed: 3
Failed: 1
```

Reviewed By: ldionne

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

4 years agoRevert "[CodeGen][SVE] Calculate correct type legalization for scalable vectors."
Sander de Smalen [Fri, 5 Jun 2020 15:03:13 +0000 (16:03 +0100)]
Revert "[CodeGen][SVE] Calculate correct type legalization for scalable vectors."

Seems to break some buildbots, reverting the patch for now.

This reverts commit 164f4b9d26fdf3cd640a09b63b5ec44d033cbe8a.

4 years ago[AST] Record SourceLocation for TypoExpr.
Haojian Wu [Tue, 2 Jun 2020 14:35:29 +0000 (16:35 +0200)]
[AST] Record SourceLocation for TypoExpr.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[VE] Support logical operation instructions in MC layer
Kazushi (Jam) Marukawa [Fri, 5 Jun 2020 14:57:37 +0000 (16:57 +0200)]
[VE] Support logical operation instructions in MC layer

Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
logical operation instructions. Also change asmparser to support CMOV
instruction. And, add new EQV/MRG/NND isntructions also.

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

4 years ago[mlir][gpu] Introduce mlir-rocm-runner.
Wen-Heng (Jack) Chung [Wed, 20 May 2020 21:07:49 +0000 (16:07 -0500)]
[mlir][gpu] Introduce mlir-rocm-runner.

Summary:
`mlir-rocm-runner` is introduced in this commit to execute GPU modules on ROCm
platform. A small wrapper to encapsulate ROCm's HIP runtime API is also inside
the commit.

Due to behavior of ROCm, raw pointers inside memrefs passed to `gpu.launch`
must be modified on the host side to properly capture the pointer values
addressable on the GPU.

LLVM MC is used to assemble AMD GCN ISA coming out from
`ConvertGPUKernelToBlobPass` to binary form, and LLD is used to produce a shared
ELF object which could be loaded by ROCm HIP runtime.

gfx900 is the default target be used right now, although it could be altered via
an option in `mlir-rocm-runner`. Future revisions may consider using ROCm Agent
Enumerator to detect the right target on the system.

Notice AMDGPU Code Object V2 is used in this revision. Future enhancements may
upgrade to AMDGPU Code Object V3.

Bitcode libraries in ROCm-Device-Libs, which implements math routines exposed in
`rocdl` dialect are not yet linked, and is left as a TODO in the logic.

Reviewers: herhut

Subscribers: mgorny, tpr, dexonsmith, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits

Tags: #mlir, #llvm

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

4 years ago[CodeGen][SVE] Calculate correct type legalization for scalable vectors.
Sander de Smalen [Fri, 5 Jun 2020 11:54:39 +0000 (12:54 +0100)]
[CodeGen][SVE] Calculate correct type legalization for scalable vectors.

This patch updates TargetLoweringBase::computeRegisterProperties and
TargetLoweringBase::getTypeConversion to support scalable vectors,
and make the right calls on how to legalise them. These changes are required
to legalise both MVTs and EVTs.

Reviewers: efriedma, david-arm, ctetreau

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[SCCP] Report changes after removing stores to constant global
serge-sans-paille [Thu, 4 Jun 2020 21:33:03 +0000 (23:33 +0200)]
[SCCP] Report changes after removing stores to constant global

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

4 years agoCorrectly report modified status for DivRemPairs
serge-sans-paille [Thu, 4 Jun 2020 20:24:31 +0000 (22:24 +0200)]
Correctly report modified status for DivRemPairs

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

4 years agoCorrectly report modified status for DSE
serge-sans-paille [Thu, 4 Jun 2020 20:23:32 +0000 (22:23 +0200)]
Correctly report modified status for DSE

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

4 years agoCorrectly report modified status for TailRecursionElimination
serge-sans-paille [Thu, 4 Jun 2020 20:24:03 +0000 (22:24 +0200)]
Correctly report modified status for TailRecursionElimination

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

4 years agoCorrectly report modified status for ObjCARCContract
serge-sans-paille [Thu, 4 Jun 2020 21:33:54 +0000 (23:33 +0200)]
Correctly report modified status for ObjCARCContract

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

4 years agoCorrectly report modified status for ObjCARCOpt
serge-sans-paille [Thu, 4 Jun 2020 13:38:32 +0000 (15:38 +0200)]
Correctly report modified status for ObjCARCOpt

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

4 years ago[llvm][AArch64] Fix unused variable
Kadir Cetinkaya [Fri, 5 Jun 2020 13:56:19 +0000 (15:56 +0200)]
[llvm][AArch64] Fix unused variable

4 years ago[libc++] Translate locale detection to the DSL
Louis Dionne [Fri, 17 Apr 2020 18:23:31 +0000 (14:23 -0400)]
[libc++] Translate locale detection to the DSL

4 years agoReturn "[InstCombine] Simplify compare of Phi with constant inputs against a constant"
Max Kazantsev [Fri, 5 Jun 2020 13:44:41 +0000 (20:44 +0700)]
Return "[InstCombine] Simplify compare of Phi with constant inputs against a constant"

This reverts commit c4b5a66e44f031eb89c9d6ea32b144f1169bdbae.

Returning along with Clang test fix

4 years agoCorrectly report modified status for LoopSimplify
serge-sans-paille [Thu, 4 Jun 2020 11:45:15 +0000 (13:45 +0200)]
Correctly report modified status for LoopSimplify

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

4 years agoFix return status of AddressSanitizer pass
serge-sans-paille [Thu, 4 Jun 2020 07:13:11 +0000 (09:13 +0200)]
Fix return status of AddressSanitizer pass

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

4 years ago[VE] Support branch instructions in MC layer
Kazushi (Jam) Marukawa [Fri, 5 Jun 2020 13:43:29 +0000 (15:43 +0200)]
[VE] Support branch instructions in MC layer

Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
branch instructions.  In order to support them, we enhance asmparser
by adding splitting mnemonic mechanism, e.g. "bgt.l.t" into "b", "gt",
and ".l.t", and parsing mechanism for AS style memory addressing.
We also implment encoding and decoding mechanism for branch instructions.

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

4 years agoSyncDependenceAnalysis.h - remove orphan method declarations. NFCI.
Simon Pilgrim [Fri, 5 Jun 2020 11:47:50 +0000 (12:47 +0100)]
SyncDependenceAnalysis.h - remove orphan method declarations. NFCI.

These have been there since the header was added by D51491 but afaict without an implementation, all functionality is actually in DivergenceAnalysis

4 years agoTargetLibraryInfo.h - reduce Triple.h include to forward declaration. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 11:17:32 +0000 (12:17 +0100)]
TargetLibraryInfo.h - reduce Triple.h include to forward declaration. NFC.

Move implicit include dependencies down to source files.

4 years agoScopedNoAliasAA.h - remove unnecessary InstrTypes.h include. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 10:31:35 +0000 (11:31 +0100)]
ScopedNoAliasAA.h - remove unnecessary InstrTypes.h include. NFC.

4 years ago[clang][BFloat] Add create/set/get/dup intrinsics
Ties Stuij [Fri, 5 Jun 2020 13:26:51 +0000 (14:26 +0100)]
[clang][BFloat] Add create/set/get/dup intrinsics

Summary:
This patch is part of a series that adds support for the Bfloat16 extension of
the Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type and its properties are specified in the Arm Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:
- Luke Cheeseman
- Momchil Velikov
- Luke Geeson
- Ties Stuij
- Mikhail Maltsev

Reviewers: t.p.northover, sdesmalen, fpetrogalli, LukeGeeson, stuij, labrinea

Reviewed By: labrinea

Subscribers: miyuki, dmgreen, labrinea, kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[Alignment][NFC] Migrate CallingConv tablegen code
Guillaume Chatelet [Thu, 4 Jun 2020 21:56:01 +0000 (21:56 +0000)]
[Alignment][NFC] Migrate CallingConv tablegen code

Summary:
We first migrate the generated code, more patches to come.

This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix a typo in AMDGPU docs
madhur13490 [Thu, 7 May 2020 17:27:32 +0000 (17:27 +0000)]
Fix a typo in AMDGPU docs

Reviewers: t-tye, arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Link against libatomic when it is found
Louis Dionne [Thu, 4 Jun 2020 18:54:38 +0000 (14:54 -0400)]
[libc++] Link against libatomic when it is found

Before this patch, we tried detecting whether small atomics were available
without linking against libatomic. However, that's not really what we want
to know -- instead, we want to know what's required in order to support
atomics fully, which is to link against libatomic when it's provided.

That is both much simpler, and it doesn't suffer the problem that we would
not link against libatomic when small atomics didn't require it, which
lead to non-lockfree atomics never working.

Furthermore, because we understand that some platforms might not want to
(or be able to) ship non-lockfree atomics, we add that notion to the test
suite, independently of a potential extern library.

After this patch, we therefore:
(1) Link against libatomic when it is provided
(2) Independently detect whether non-lockfree atomics are supported in
    the test suite, regardless of whether that means we're linking against
    an external library or not (which is an implementation detail).

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

4 years ago[clang][BFloat] add NEON emitter for bfloat
Ties Stuij [Fri, 5 Jun 2020 12:06:01 +0000 (13:06 +0100)]
[clang][BFloat] add NEON emitter for bfloat

Summary:
This patch adds the bfloat16_t struct typedefs (e.g. bfloat16x8x2_t) to
arm_neon.h

This patch is part of a series implementing the Bfloat16 extension of the
Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type, and its properties are specified in the Arm Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:
- Luke Cheeseman
- Simon Tatham
- Ties Stuij

Reviewers: t.p.northover, fpetrogalli, sdesmalen, az, LukeGeeson

Reviewed By: fpetrogalli

Subscribers: SjoerdMeijer, LukeGeeson, pbarrio, mgorny, kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[MLIR][SPIRV] Support flat, location, and noperspective decorations
HazemAbdelhafez [Fri, 5 Jun 2020 12:38:40 +0000 (08:38 -0400)]
[MLIR][SPIRV] Support flat, location, and noperspective decorations

Add support for flat, location, and noperspective decorations in the
serializer and deserializer to be able to process basic shader files
for graphics applications.

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

4 years agoFix build breakage caused by 66a1b83bf93ec46f6d7a06c47d5981ae154f9ea0
Denis Antrushin [Fri, 5 Jun 2020 12:52:14 +0000 (15:52 +0300)]
Fix build breakage caused by 66a1b83bf93ec46f6d7a06c47d5981ae154f9ea0

4 years ago[mlir][Vector] Move temporary alloc to top of the function alloca when lowering vecto...
Nicolas Vasilache [Fri, 5 Jun 2020 12:22:15 +0000 (08:22 -0400)]
[mlir][Vector] Move temporary alloc to top of the function alloca when lowering vector_transfers

Recently introduced allocation hoisting is quite conservative on the cases when it triggers.
This revision makes it such that the allocations for vector transfer lowerings are hoisted
to the top of the function.
This should be revisited in the context of parallelism and is a temporary workaround.

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

4 years ago[MsgPack] Added a convenience operator
Dineshkumar Bhaskaran [Fri, 5 Jun 2020 12:41:37 +0000 (12:41 +0000)]
[MsgPack] Added a convenience operator

Summary: Added "not equal to" operator for DocNode comparison

Reviewers: arsenm, scott.linder, saiislam

Reviewed By: saiislam

Subscribers: wdng, llvm-commits

Tags: #llvm

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

4 years agoRemove mention of counter from Archer readme
Joachim Protze [Fri, 5 Jun 2020 12:29:22 +0000 (14:29 +0200)]
Remove mention of counter from Archer readme

The feature was removed before upstreaming Archer, so the documentation is wrong

4 years ago[ARM] Add poly64_t on AArch32.
Ties Stuij [Fri, 5 Jun 2020 09:35:59 +0000 (10:35 +0100)]
[ARM] Add poly64_t on AArch32.

Summary:
The poly64 types are guarded with ifdefs for AArch64 only. This is wrong. This
was also incorrectly documented in the ACLE spec, but this has been rectified in
the latest release. See paragraph 13.1.2 "Vector data types":

https://developer.arm.com/docs/101028/latest

This patch was written by Alexandros Lamprineas.

Reviewers: ostannard, sdesmalen, fpetrogalli, labrinea, t.p.northover, LukeGeeson

Reviewed By: ostannard

Subscribers: pbarrio, LukeGeeson, kristof.beyls, danielkiss, cfe-commits

Tags: #clang

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

4 years ago[TargetLowering][NFC] More efficient emitPatchpoint().
Denis Antrushin [Thu, 4 Jun 2020 16:11:13 +0000 (19:11 +0300)]
[TargetLowering][NFC] More efficient emitPatchpoint().

Current implementation of emitPatchpoint() is very inefficient:
for every FrameIndex operand if creates new MachineInstr with
that operand expanded and all other copied as is.
Since PATCHPOINT/STATEPOINT instructions may have *a lot* of
FrameIndex operands, we end up creating and erasing many
machine instructions. But we can do it in single pass, with only
one new machine instruction generated.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D81181

4 years ago[Dexter] Add DexLimitSteps command and ConditionalController
Tom Weaver [Fri, 5 Jun 2020 11:53:56 +0000 (12:53 +0100)]
[Dexter] Add DexLimitSteps command and ConditionalController

* Adds DexLimitSteps Command.
* Add ConditionalController, a new DebuggerController type.
* 5 regression tests
* documentation

* recommit, fixed accidental adding of unnecessary file

Reviewers: jmorse

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

4 years ago[PowerPC] Remove extra nop after notoc call
Stefan Pintilie [Fri, 5 Jun 2020 11:37:21 +0000 (06:37 -0500)]
[PowerPC] Remove extra nop after notoc call

Calls that are marked as @notoc do not require the extra nop after the call
for the TOC restore.

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

4 years ago[mlir][Linalg] Add missing CMake dependency on SCFTransforms
Nicolas Vasilache [Fri, 5 Jun 2020 11:38:55 +0000 (07:38 -0400)]
[mlir][Linalg] Add missing CMake dependency on SCFTransforms

4 years ago[CodeGen][SVE] Legalisation of extends with scalable types
Kerry McLaughlin [Fri, 5 Jun 2020 10:11:50 +0000 (11:11 +0100)]
[CodeGen][SVE] Legalisation of extends with scalable types

Summary:
This patch adds legalisation of extensions where the operand
of the extend is a legal scalable type but the result is not.

EXTRACT_SUBVECTOR is used to split the result, before
being replaced by target-specific [S|U]UNPK[HI|LO] operations.

For example:

```
zext <vscale x 16 x i8> %a to <vscale x 16 x i16>
```
should emit:

```
uunpklo z2.h, z0.b
uunpkhi z1.h, z0.b
```

Reviewers: sdesmalen, efriedma, david-arm

Reviewed By: efriedma

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

Tags: #llvm

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

4 years agoRevert "[InstCombine] Simplify compare of Phi with constant inputs against a constant"
Kadir Cetinkaya [Fri, 5 Jun 2020 11:02:35 +0000 (13:02 +0200)]
Revert "[InstCombine] Simplify compare of Phi with constant inputs against a constant"

This reverts commit 16b7eb6dd1247dbe322061d33636a054d6c954dc.

Breaks build bots, see
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/29888
for an example.

4 years ago[clang][test] Put output into temp directory
Kadir Cetinkaya [Fri, 5 Jun 2020 11:01:08 +0000 (13:01 +0200)]
[clang][test] Put output into temp directory

To unbreak builds that happen on a read-only directory

4 years ago[PowerPC][NFC] Add more PC Relative tests
Stefan Pintilie [Fri, 5 Jun 2020 10:47:20 +0000 (05:47 -0500)]
[PowerPC][NFC] Add more PC Relative tests

Modify the pcrel.ll test file to add more testing for PC Relative.

4 years ago[mlir][Linalg] Add a hoistRedundantVectorTransfers helper function
Nicolas Vasilache [Fri, 5 Jun 2020 10:35:46 +0000 (06:35 -0400)]
[mlir][Linalg] Add a hoistRedundantVectorTransfers helper function

This revision adds a helper function to hoist vector.transfer_read /
vector.transfer_write pairs out of immediately enclosing scf::ForOp
iteratively, if the following conditions are true:
   1. The 2 ops access the same memref with the same indices.
   2. All operands are invariant under the enclosing scf::ForOp.
   3. No uses of the memref either dominate the transfer_read or are
   dominated by the transfer_write (i.e. no aliasing between the write and
   the read across the loop)

To improve hoisting opportunities, call the `moveLoopInvariantCode` helper
function on the candidate loop above which to hoist. Hoisting the transfers
results in scf::ForOp yielding the value that originally transited through
memory.

This revision additionally exposes `moveLoopInvariantCode` as a helper in
LoopUtils.h and updates SliceAnalysis to support return scf::For values and
allow hoisting across multiple scf::ForOps.

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

4 years ago[ObjectYAML][test] Reuse the chack tag "DWARF-HEADER". NFC.
Xing GUO [Fri, 5 Jun 2020 10:48:27 +0000 (18:48 +0800)]
[ObjectYAML][test] Reuse the chack tag "DWARF-HEADER". NFC.

4 years ago[lldb] Handle new BFloat16 type
Kadir Cetinkaya [Fri, 5 Jun 2020 10:25:09 +0000 (12:25 +0200)]
[lldb] Handle new BFloat16 type

4 years ago[InstCombine] Simplify compare of Phi with constant inputs against a constant
Max Kazantsev [Fri, 5 Jun 2020 09:43:45 +0000 (16:43 +0700)]
[InstCombine] Simplify compare of Phi with constant inputs against a constant

We can simplify
```
  icmp <pred> phi(C1, C2, ...), C
```
with
```
  phi(icmp(C1, C), icmp(C2, C), ...)
```
provided that all comparison of constants are constants themselves.

Differential Revision: https://reviews.llvm.org/D81151
Reviewed By: lebedev.ri

4 years ago[mlir] Make PassManager.h self-contained
Kadir Cetinkaya [Fri, 5 Jun 2020 10:01:03 +0000 (12:01 +0200)]
[mlir] Make PassManager.h self-contained

Forward declaring llvm::errs is not enough, as it is used as a default
parameter with a type that references the base class. So the class
hierarchy must be visible.

4 years ago[lldb] Fix UBSan regression in GetSLEB128
Jan Kratochvil [Fri, 5 Jun 2020 09:59:26 +0000 (11:59 +0200)]
[lldb] Fix UBSan regression in GetSLEB128

It regressed recently by my: https://reviews.llvm.org/D81119

4 years ago[VE] Support fixed-point operation instructions in MC layer
Kazushi (Jam) Marukawa [Fri, 5 Jun 2020 09:55:47 +0000 (11:55 +0200)]
[VE] Support fixed-point operation instructions in MC layer

Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
fixed-point operation instructions.  In order to support them, we add
MImm parser to asmparser.  Also add a new MPD instruction which is one
of multiply instructions.

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

4 years agoNFC: Formatting fix in TableGEn/OptParserEmitter.cpp
Daniel Grumberg [Fri, 5 Jun 2020 09:46:38 +0000 (10:46 +0100)]
NFC: Formatting fix in TableGEn/OptParserEmitter.cpp

4 years agoMemorySSAUpdater.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 09:45:42 +0000 (10:45 +0100)]
MemorySSAUpdater.h - reduce unnecessary includes to forward declarations. NFC.

Remove unnecessary MemoryAccess forward declaration as its already included from MemorySSA.h

Move implicit include dependencies down to source files.

4 years agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 09:41:31 +0000 (10:41 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.

Add llvm_unreachable after switch statement for TestLanguage enum

4 years ago[ARM] Add __bf16 as new Bfloat16 C Type
Ties Stuij [Thu, 4 Jun 2020 23:20:02 +0000 (00:20 +0100)]
[ARM] Add __bf16 as new Bfloat16 C Type

Summary:
This patch upstreams support for a new storage only bfloat16 C type.
This type is used to implement primitive support for bfloat16 data, in
line with the Bfloat16 extension of the Armv8.6-a architecture, as
detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type, and its properties are specified in the Arm Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

In detail this patch:
- introduces an opaque, storage-only C-type __bf16, which introduces a new bfloat IR type.

This is part of a patch series, starting with command-line and Bfloat16
assembly support. The subsequent patches will upstream intrinsics
support for BFloat16, followed by Matrix Multiplication and the
remaining Virtualization features of the armv8.6-a architecture.

The following people contributed to this patch:
- Luke Cheeseman
- Momchil Velikov
- Alexandros Lamprineas
- Luke Geeson
- Simon Tatham
- Ties Stuij

Reviewers: SjoerdMeijer, rjmccall, rsmith, liutianle, RKSimon, craig.topper, jfb, LukeGeeson, fpetrogalli

Reviewed By: SjoerdMeijer

Subscribers: labrinea, majnemer, asmith, dexonsmith, kristof.beyls, arphaman, danielkiss, cfe-commits

Tags: #clang

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

4 years ago[Mlir] Implement printer, parser, verifier and builder for shape.reduce.
Alexander Belyaev [Fri, 5 Jun 2020 09:16:53 +0000 (11:16 +0200)]
[Mlir] Implement printer, parser, verifier and builder for shape.reduce.

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

4 years ago[NFC][SCEV] Add test with 'or' with no common bits set
Roman Lebedev [Fri, 5 Jun 2020 09:18:15 +0000 (12:18 +0300)]
[NFC][SCEV] Add test with 'or' with no common bits set

4 years ago[CostModel] Unify getMemoryOpCost
Sam Parker [Fri, 5 Jun 2020 09:09:56 +0000 (10:09 +0100)]
[CostModel] Unify getMemoryOpCost

Use getMemoryOpCost from the generic implementation of getUserCost
and have getInstructionThroughput return the result of that for loads
and stores.

This also means that the X86 implementation of getUserCost can be
removed with the functionality folded into its getMemoryOpCost.

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

4 years ago[mlir] NFC formatting cleanup.
Tres Popp [Fri, 5 Jun 2020 08:12:00 +0000 (10:12 +0200)]
[mlir] NFC formatting cleanup.

4 years ago[mlir] Canonicalization of shape.assuming
Tres Popp [Wed, 20 May 2020 13:56:40 +0000 (15:56 +0200)]
[mlir] Canonicalization of shape.assuming

Summary:
This will inline the region to a shape.assuming in the case that the
input witness is found to be statically true.

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

4 years ago[mlir] Folding and canonicalization of shape.cstr_eq
Tres Popp [Wed, 20 May 2020 13:54:57 +0000 (15:54 +0200)]
[mlir] Folding and canonicalization of shape.cstr_eq

In the case of all inputs being constant and equal, cstr_eq will be
replaced with a true_witness.

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

4 years ago[mlir] Canonicalization and folding of shape.cstr_broadcastable
Tres Popp [Wed, 20 May 2020 13:52:55 +0000 (15:52 +0200)]
[mlir] Canonicalization and folding of shape.cstr_broadcastable

This allows replacing of this op with a true witness in the case of both
inputs being const_shapes and being found to be broadcastable.

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

4 years ago[mlir] Add folding for shape.any
Tres Popp [Wed, 20 May 2020 14:12:57 +0000 (16:12 +0200)]
[mlir] Add folding for shape.any

If any input to shape.any is a const_shape, shape.any can be replaced
with that input.

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

4 years ago[mlir] Folding of shape.assuming_all
Tres Popp [Thu, 4 Jun 2020 10:43:13 +0000 (12:43 +0200)]
[mlir] Folding of shape.assuming_all

This allows assuming_all to be replaced when all inputs are known to be
statically passing witnesses.

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

4 years ago[mlir] Add a shape op that returns a constant witness
Tres Popp [Wed, 20 May 2020 13:56:12 +0000 (15:56 +0200)]
[mlir] Add a shape op that returns a constant witness

This will later be used during canonicalization and folding steps to replace
statically known passing constraints.

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

4 years ago[Mlir] Add assembly format for `shape.mul`.
Alexander Belyaev [Thu, 4 Jun 2020 20:40:48 +0000 (22:40 +0200)]
[Mlir] Add assembly format for `shape.mul`.

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

4 years ago[NFC][SCEV] Some tests for shifts by bitwidth-2/bitwidth-1 w/ no-wrap flags
Roman Lebedev [Fri, 5 Jun 2020 08:23:16 +0000 (11:23 +0300)]
[NFC][SCEV] Some tests for shifts by bitwidth-2/bitwidth-1 w/ no-wrap flags

4 years agoFix gcc5 build of ASTMatchersTest.h
Hans Wennborg [Fri, 5 Jun 2020 08:32:40 +0000 (10:32 +0200)]
Fix gcc5 build of ASTMatchersTest.h

After a180d54 the build was failing with:

In file included from /work/llvm.monorepo/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp:9:0:
/work/llvm.monorepo/clang/unittests/ASTMatchers/ASTMatchersTest.h:
In function ‘llvm::ArrayRef<clang::TestLanguage> clang::ast_matchers::langCxx11OrLater()’:
/work/llvm.monorepo/clang/unittests/ASTMatchers/ASTMatchersTest.h:64:10:
error: could not convert ‘(const clang::TestLanguage*)(& Result)’ from
‘const clang::TestLanguage*’ to ‘llvm::ArrayRef<clang::TestLanguage>’
   return Result;
          ^

4 years ago[clangd] Populate the parse options to CodeCompletion/SignatureHelp.
Haojian Wu [Wed, 3 Jun 2020 08:34:05 +0000 (10:34 +0200)]
[clangd] Populate the parse options to CodeCompletion/SignatureHelp.

Summary: A followup of D79938.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[VE] Add AND/OR/XOR regression tests
Kazushi (Jam) Marukawa [Fri, 5 Jun 2020 08:03:10 +0000 (10:03 +0200)]
[VE] Add AND/OR/XOR regression tests

Summary:
Add AND/OR/XOR regression tests and separate bit-op tests from exisiting
tests.

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

4 years ago[StackSafety,NFC] Switch tests to aarch64
Vitaly Buka [Fri, 5 Jun 2020 06:52:38 +0000 (23:52 -0700)]
[StackSafety,NFC] Switch tests to aarch64

4 years ago[MLIR] Update linalg.conv lowering to use affine load in the absence of padding
Uday Bondhugula [Mon, 25 May 2020 12:10:44 +0000 (17:40 +0530)]
[MLIR] Update linalg.conv lowering to use affine load in the absence of padding

Update linalg to affine lowering for convop to use affine load for input
whenever there is no padding. It had always been using std.loads because
max in index functions (needed for non-zero padding if not materializing
zeros) couldn't be represented in the non-zero padding cases.

In the future, the non-zero padding case could also be made to use
affine - either by materializing or using affine.execute_region. The
latter approach will not impact the scf/std output obtained after
lowering out affine.

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

4 years agoRevert "Set the captures on a CXXRecordDecl representing a lambda closure type"
Jonas Devlieghere [Fri, 5 Jun 2020 06:34:05 +0000 (23:34 -0700)]
Revert "Set the captures on a CXXRecordDecl representing a lambda closure type"

This reverts commit c13dd74e311d2ac70dd3ea663d800307d1aa5b6b.

4 years agoRevert "PR46209: properly determine whether a copy assignment operator is"
Jonas Devlieghere [Fri, 5 Jun 2020 06:25:01 +0000 (23:25 -0700)]
Revert "PR46209: properly determine whether a copy assignment operator is"

This reverts commit c57f8a3a20540fcf9fbf98c0a73f381ec32fce2a.

4 years ago[nfc] [lldb] clang-format #include files order
Jan Kratochvil [Fri, 5 Jun 2020 06:28:06 +0000 (08:28 +0200)]
[nfc] [lldb] clang-format #include files order

4 years ago[Driver] Migrate some -f/-fno options to use OptInFFlag and OptOutFFlag
Fangrui Song [Fri, 5 Jun 2020 06:25:19 +0000 (23:25 -0700)]
[Driver] Migrate some -f/-fno options to use OptInFFlag and OptOutFFlag

Also assign OptInFFlag and OptOutFFlag to f_Group.

4 years agoRevert "[InstCombine][NFC] Factor out constant check"
Max Kazantsev [Fri, 5 Jun 2020 05:00:44 +0000 (12:00 +0700)]
Revert "[InstCombine][NFC] Factor out constant check"

This reverts commit 9bdb91889020b3e61cba26adb1b9c64a24c09f95.

This refactoring proved to not be useful.

4 years ago[DWARFYAML][debug_aranges] Replace InitialLength with Format and Length.
Xing GUO [Fri, 5 Jun 2020 04:15:34 +0000 (12:15 +0800)]
[DWARFYAML][debug_aranges] Replace InitialLength with Format and Length.

This patch addresses the comment in [D80972](https://reviews.llvm.org/D80972#inline-744217).

Before this patch, the initial length field of .debug_aranges section should be declared as:

```
## 32-bit DWARF
debug_aranges:
  - Length:
      TotalLength: 0x20
    Version: 2
    ...

## 64-bit DWARF
debug_aranges:
  - Length:
      TotalLength:   0xffffffff
      TotalLength64: 0x20
    Version: 2
    ...
```

After this patch:

```
## 32-bit DWARF
debug_aranges:
  - [[Format:  DWARF32]] ## Optional
    Length:  0x20
    Version: 2
    ...

## 64-bit DWARF
debug_aranges:
  - Format:  DWARF64
    Length:  0x20
    Version: 2
```

Current implementation of generating DWARF64 .debug_aranges section is buggy. A follow-up patch will improve it and add test cases for DWARF64.

Reviewed By: jhenderson

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

4 years ago[StackSafety,NFC] Ignore callee declarations
Vitaly Buka [Fri, 5 Jun 2020 02:44:42 +0000 (19:44 -0700)]
[StackSafety,NFC] Ignore callee declarations

It's going to fail FunctionInfo lookup anyway.

4 years ago[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals
Petr Hosek [Fri, 5 Jun 2020 03:18:35 +0000 (20:18 -0700)]
[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals

It should not be necessary to use weak linkage for these. Doing so
implies interposablity and thus PIC generates indirections and
dynamic relocations, which are unnecessary and suboptimal. Aside
from this, ASan instrumentation never introduces GOT indirection
relocations where there were none before--only new absolute relocs
in RELRO sections for metadata, which are less problematic for
special linkage situations that take pains to avoid GOT generation.

Patch By: mcgrathr

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

4 years ago[Driver] Migrate some -f/-fno options to use OptInFFlag and OptOutFFlag
Fangrui Song [Fri, 5 Jun 2020 02:28:54 +0000 (19:28 -0700)]
[Driver] Migrate some -f/-fno options to use OptInFFlag and OptOutFFlag

4 years agoPR46209: properly determine whether a copy assignment operator is
Richard Smith [Fri, 5 Jun 2020 02:16:05 +0000 (19:16 -0700)]
PR46209: properly determine whether a copy assignment operator is
trivial.

We previously took a shortcut by assuming that if a subobject had a
trivial copy assignment operator (with a few side-conditions), we would
always invoke it, and could avoid going through overload resolution.
That turns out to not be correct in the presenve of ref-qualifiers (and
also won't be the case for copy-assignments with requires-clauses
either). Use the same logic for lazy declaration of copy-assignments
that we use for all other special member functions.

4 years agoSet the captures on a CXXRecordDecl representing a lambda closure type
Richard Smith [Fri, 5 Jun 2020 02:15:22 +0000 (19:15 -0700)]
Set the captures on a CXXRecordDecl representing a lambda closure type
before marking it complete.

No functionality change intended.

4 years ago[Statepoint] Migrate a few tests to gc-live bundle format and fix assert
Philip Reames [Fri, 5 Jun 2020 01:15:04 +0000 (18:15 -0700)]
[Statepoint] Migrate a few tests to gc-live bundle format and fix assert

The assert was missed in 0e7c7705, migrating the test revealed the problem.

4 years ago[LiveDebugValues] Cache LexicalScopes::getMachineBasicBlocks, NFCI
Vedant Kumar [Thu, 28 May 2020 22:57:11 +0000 (15:57 -0700)]
[LiveDebugValues] Cache LexicalScopes::getMachineBasicBlocks, NFCI

Summary:
Cache the results from getMachineBasicBlocks in LexicalScopes to speed
up UserValueScopes::dominates queries.  This replaces the caching done
in UserValueScopes. Compared to the old caching method, this reduces
memory traffic when a VarLoc is copied (e.g. when a VarLocMap grows),
and enables caching across basic blocks.

When compiling sqlite 3.5.7 (CTMark version), this patch reduces the
number of calls to getMachineBasicBlocks from 10,207 to 1,093. I also
measured a small compile-time reduction (~ 0.1% of total wall time, on
average, on my machine).

As a drive-by, I made the DebugLoc in UserValueScopes a const reference
to cut down on MetadataTracking traffic.

Reviewers: jmorse, Orlando, aprantl, nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Refactor BoolAttr to be a special case of IntegerAttr
River Riddle [Wed, 3 Jun 2020 01:20:38 +0000 (18:20 -0700)]
[mlir] Refactor BoolAttr to be a special case of IntegerAttr

This simplifies a lot of handling of BoolAttr/IntegerAttr. For example, a lot of places currently have to handle both IntegerAttr and BoolAttr. In other places, a decision is made to pick one which can lead to surprising results for users. For example, DenseElementsAttr currently uses BoolAttr for i1 even if the user initialized it with an Array of i1 IntegerAttrs.

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

4 years ago[docs] Referenced llvm workflow in HowToAddABuilder
Mircea Trofin [Wed, 3 Jun 2020 00:48:02 +0000 (17:48 -0700)]
[docs] Referenced llvm workflow in HowToAddABuilder

Reviewers: gkistanova, dblaikie

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[WebAssembly] Fix a testcase to be independent of the sysroot default
Dan Gohman [Thu, 4 Jun 2020 22:55:08 +0000 (15:55 -0700)]
[WebAssembly] Fix a testcase to be independent of the sysroot default

As a followup to D62922, add a sysroot command-line option to this test
to ensure that the output is independent of any default sysroot options,
and adjust the reactor test to be more consistent with the command test.

4 years ago[mlir][Linalg] Add a hoistViewAllocOps helper function
Nicolas Vasilache [Thu, 4 Jun 2020 22:55:26 +0000 (18:55 -0400)]
[mlir][Linalg] Add a hoistViewAllocOps helper function

This revision adds a helper function to hoist alloc/dealloc pairs and
alloca op out of immediately enclosing scf::ForOp if both conditions are true:
   1. all operands are defined outside the loop.
   2. all uses are ViewLikeOp or DeallocOp.

This is now considered Linalg-specific and will be generalized on a per-need basis.

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

4 years ago[Analyzer][NoUncountedMembersChecker] Fix crash for C structs
Jan Korous [Thu, 4 Jun 2020 22:55:44 +0000 (15:55 -0700)]
[Analyzer][NoUncountedMembersChecker] Fix crash for C structs

Fixes https://bugs.llvm.org/show_bug.cgi?id=46177
Fixes second bug reported in https://bugs.llvm.org/show_bug.cgi?id=46142

4 years ago[Statepoint] Switch RS4GC to using gc-live bundle form
Philip Reames [Thu, 4 Jun 2020 22:22:07 +0000 (15:22 -0700)]
[Statepoint] Switch RS4GC to using gc-live bundle form

Now that we have an operand based form for the GC arguments to a statepoint intrinsic, update RS4GC to use it and update tests to reflect. This is pretty straight forward. I nearly landed without review, but figured a second set of eyes didn't hurt.

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

4 years ago[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime
Petr Hosek [Thu, 4 Jun 2020 22:47:05 +0000 (15:47 -0700)]
[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime

Follow the model used on Linux, where the clang driver passes the
linker a -u switch to force the profile runtime to be linked in,
rather than having every TU emit a dead function with a reference.

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

4 years agoRevert "[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime"
Petr Hosek [Thu, 4 Jun 2020 22:44:10 +0000 (15:44 -0700)]
Revert "[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime"

This reverts commit d51054217403b47f452619e11318bd214749a845 since
it broke several bots.

4 years agoMake linter happy
Julian Lettner [Thu, 4 Jun 2020 21:48:42 +0000 (14:48 -0700)]
Make linter happy

4 years ago[docs] HowToUpdateDebugInfo: Minor cleanups
Vedant Kumar [Thu, 4 Jun 2020 21:32:46 +0000 (14:32 -0700)]
[docs] HowToUpdateDebugInfo: Minor cleanups

- Change the reference to salvageDebugInfoOrUndef to salvageDebugInfo
  (in accordance with https://reviews.llvm.org/D78369).

- Reorganize a few sections in preparation for an upcoming change that
  attempts to specify rules for updating debug locations.

- Fix some intra-document links.

- Some spelling / wording fixes.

4 years ago[Docs] Add the entry for `Advanced builds` in UserGuide.rst
Yuanfang Chen [Tue, 2 Jun 2020 00:09:40 +0000 (17:09 -0700)]
[Docs] Add the entry for `Advanced builds` in UserGuide.rst

Also add a link to it from ThinLTO.rst.

4 years agoFix undefined behaviour when trying to deref nullptr.
Alexey Bataev [Thu, 4 Jun 2020 21:33:13 +0000 (17:33 -0400)]
Fix undefined behaviour when trying to deref nullptr.

4 years ago[Reassociate] Teach ConvertShiftToMul to preserve nsw flag if the shift amount is...
Craig Topper [Thu, 4 Jun 2020 19:21:04 +0000 (12:21 -0700)]
[Reassociate] Teach ConvertShiftToMul to preserve nsw flag if the shift amount is not bitwidth - 1.

Multiply and shl have different signed overflow behavior in
some cases. But it looks like we should be ok as long as the
shift amount is less than bitwidth - 1.

Alive2: http://volta.cs.utah.edu:8080/z/MM4WZP

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

4 years agoAMDGPU: Fix overriding global FP atomic feature predicates
Matt Arsenault [Thu, 4 Jun 2020 18:37:39 +0000 (14:37 -0400)]
AMDGPU: Fix overriding global FP atomic feature predicates

Global TableGen let override blocks are pretty dangerous and override
any local special cases. In this case, the broader HasFlatGlobalInsts
was overriding the more specific predicate for
FeatureAtomicFaddInsts. Make sure HasFlatGlobalInsts is implied by
FeatureAtomicFaddInsts, and make sure the right predicate is used.

One issue with independently setting the subtarget features on
incompatible targets is all of the encoding families do not define all
opcodes. This will hit an assert on gfx10 for example, since we set
the encoding independently based on the generation and not based on a
feature.

4 years agoAMDGPU: Select strict_fmul
Matt Arsenault [Thu, 28 May 2020 00:12:11 +0000 (20:12 -0400)]
AMDGPU: Select strict_fmul