platform/upstream/llvm.git
4 years ago[clangd] Don't mangle workdir-relevant driver path in compile commands
Sam McCall [Wed, 17 Jun 2020 13:56:01 +0000 (15:56 +0200)]
[clangd] Don't mangle workdir-relevant driver path in compile commands

Summary:
We can't resolve this (if it's a symlink) without further refactoring, but the
current behaviour is just incorrect.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[llvm-readobj] - Add a validation of the GNU hash table to printGnuHashHistogram().
Georgii Rymar [Wed, 17 Jun 2020 10:47:37 +0000 (13:47 +0300)]
[llvm-readobj] - Add a validation of the GNU hash table to printGnuHashHistogram().

Similar to D81937, we might crash when printing a histogram for a GNU hash table
with a 'symndx' index that is larger than the number of dynamic symbols.

This patch adopts and reuses the `getGnuHashTableChains()` helper which performs
a validation of the table. As a side effect the warning reported for
the --gnu-hash-table was improved.

Also with this change we start to report a warning when the histogram is requested for
the GNU hash table, but the dynamic symbols table is empty (size == 0).

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

4 years ago[DSE,MSSA] Enable XFAIL'd merge-stores.ll test (NFC).
Florian Hahn [Fri, 19 Jun 2020 11:08:40 +0000 (12:08 +0100)]
[DSE,MSSA] Enable XFAIL'd merge-stores.ll test (NFC).

All cases in the test are supported now, it only still failed because an
over-eager regex match not accounting for `, align ` being added to each
load/store now.

4 years ago[clang-tidy] Extend InheritParentConfig to CommandLineConfig
Nathan James [Fri, 19 Jun 2020 11:02:08 +0000 (12:02 +0100)]
[clang-tidy] Extend InheritParentConfig to CommandLineConfig

Extend the `InheritParentConfig` support introduced in D75184 for the command line option `--config`.
The current behaviour of `--config` is to when set, disable looking for `.clang-tidy` configuration files.
This new behaviour lets you set `InheritParentConfig` to true in the command line to then look for `.clang-tidy` configuration files to be merged with what's been specified on the command line.

Reviewed By: DmitryPolukhin

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

4 years ago[OpenMP][OMPT] Pass mutexinoutset to the tool
Joachim Protze [Fri, 19 Jun 2020 08:59:18 +0000 (10:59 +0200)]
[OpenMP][OMPT] Pass mutexinoutset to the tool

Adds OMPT support for the mutexinoutset dependency

Reviewed by: hbae

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

4 years ago[X86][SSE] combineHorizontalPredicateResult - improve all_of(X == 0) for vXi64 on...
Simon Pilgrim [Thu, 18 Jun 2020 16:41:15 +0000 (17:41 +0100)]
[X86][SSE] combineHorizontalPredicateResult - improve all_of(X == 0) for vXi64 on pre-SSE41 targets

Without SSE41 we don't have the PCMPEQQ instruction, making cmp-with-zero reductions more complicated than necessary. We can compare as vXi32 (PCMPEQD) and tweak the MOVMSK comparison to test upper/lower DWORD comparisons.

This pre-fixes something that occurs with null tests for vectors of (64-bit) pointers such as in PR35129.

4 years ago[clangd] Drop usage of PreambleStatCache in scanPreamble
Kadir Cetinkaya [Wed, 17 Jun 2020 16:09:54 +0000 (18:09 +0200)]
[clangd] Drop usage of PreambleStatCache in scanPreamble

Summary: It was used inside buildCompilerInvocation to speed up stats. But
preambleStatCache doesn't contain stat information performed while
building compiler invocation. So it was an unnecessary optimization.

Furthermore, buildCompilerInvocation in scanPreamble doesn't need to
find gcc installation, include paths and such, as it is only trying to
lex directives. Hence we are passing an empty FS to get rid of any
redundant IO.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[gn build] Port 0628705efaf
LLVM GN Syncbot [Fri, 19 Jun 2020 10:15:53 +0000 (10:15 +0000)]
[gn build] Port 0628705efaf

4 years ago[clangd] Rename FSProvider to TFS in case of ThreadsafeFS
Kadir Cetinkaya [Wed, 17 Jun 2020 16:09:54 +0000 (18:09 +0200)]
[clangd] Rename FSProvider to TFS in case of ThreadsafeFS

Summary: Depends on D81998

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd][NFC] Rename FSProvider and getFileSystem
Kadir Cetinkaya [Wed, 17 Jun 2020 09:53:32 +0000 (11:53 +0200)]
[clangd][NFC] Rename FSProvider and getFileSystem

Summary:
Clangd uses FSProvider to get threadsafe views into file systems. This
patch changes naming to make that more explicit.

Depends on D81920

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd] Change FSProvider::getFileSystem to take CurrentWorkingDirectory
Kadir Cetinkaya [Tue, 16 Jun 2020 10:16:24 +0000 (12:16 +0200)]
[clangd] Change FSProvider::getFileSystem to take CurrentWorkingDirectory

Summary:
We've faced a couple of problems when the returned FS didn't have the
proper working directory. New signature makes the API safer against such
problems.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[StackSafety,NFC] Fix comment
Vitaly Buka [Fri, 19 Jun 2020 10:10:01 +0000 (03:10 -0700)]
[StackSafety,NFC] Fix comment

4 years agotry to fix build bot after b7338fb1a6a464472850211165391983d2c8fdf3
Tyker [Fri, 19 Jun 2020 10:01:59 +0000 (12:01 +0200)]
try to fix build bot after b7338fb1a6a464472850211165391983d2c8fdf3

4 years ago[X86][SSE] combineSetCCMOVMSK - fold MOVMSK(SHUFFLE(X,u)) -> MOVMSK(X)
Simon Pilgrim [Fri, 19 Jun 2020 09:27:09 +0000 (10:27 +0100)]
[X86][SSE] combineSetCCMOVMSK - fold MOVMSK(SHUFFLE(X,u)) -> MOVMSK(X)

If we're permuting ALL the elements of a single vector, then for allof/anyof MOVMSK tests we can avoid the shuffle entirely.

4 years ago[SVE] Fall back on DAG ISel at -O0 when encountering scalable types
David Sherwood [Tue, 9 Jun 2020 13:51:38 +0000 (14:51 +0100)]
[SVE] Fall back on DAG ISel at -O0 when encountering scalable types

At the moment we use Global ISel by default at -O0, however it is
currently not capable of dealing with scalable vectors for two
reasons:

1. The register banks know nothing about SVE registers.
2. The LLT (Low Level Type) class knows nothing about scalable
   vectors.

For now, the easiest way to avoid users hitting issues when using
the SVE ACLE is to fall back on normal DAG ISel when encountering
instructions that operate on scalable vector types.

I've added a couple of RUN lines to existing SVE tests to ensure
we can compile at -O0. I've also added some new tests to

  CodeGen/AArch64/GlobalISel/arm64-fallback.ll

that demonstrate we correctly fallback to DAG ISel at -O0 when
lowering formal arguments or translating instructions that involve
scalable vector types.

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

4 years ago[SveEmitter] Add builtins for struct loads/stores (ld2/ld3/etc)
Sander de Smalen [Fri, 19 Jun 2020 09:06:39 +0000 (10:06 +0100)]
[SveEmitter] Add builtins for struct loads/stores (ld2/ld3/etc)

The struct store intrinsics in LLVM IR take the individual parts
as arguments, so this patch uses the intrinsics used for `svget`
to break the tuples into individual parts.

Reviewers: c-rhodes, efriedma, ctetreau, david-arm

Reviewed By: efriedma

Tags: #clang

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

4 years ago[CodeGen,AArch64] Fix up warnings in performExtendCombine
David Sherwood [Wed, 10 Jun 2020 13:37:25 +0000 (14:37 +0100)]
[CodeGen,AArch64] Fix up warnings in performExtendCombine

Try to avoid calling getVectorNumElements() or relying upon the
TypeSize conversion to uin64_t.

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

4 years ago[StackSafety] Add StackLifetime::isAliveAfter
Vitaly Buka [Fri, 12 Jun 2020 21:10:47 +0000 (14:10 -0700)]
[StackSafety] Add StackLifetime::isAliveAfter

This function is going to be added into StackSafety checks.
This patch uses function in ::print implementation to make sure
that it works as expected.

4 years ago[SafeStack,NFC] Print liveness for all instrunctions
Vitaly Buka [Fri, 19 Jun 2020 07:49:23 +0000 (00:49 -0700)]
[SafeStack,NFC] Print liveness for all instrunctions

4 years ago[StackSafety,NFC] Replace map with vector
Vitaly Buka [Fri, 19 Jun 2020 01:17:59 +0000 (18:17 -0700)]
[StackSafety,NFC] Replace map with vector

We don't need to lookup InstructionNumbering by number, so
we can use vector with index as assigned number.

4 years ago[StackSafety,NFC] Don't test terminators
Vitaly Buka [Fri, 19 Jun 2020 01:08:37 +0000 (18:08 -0700)]
[StackSafety,NFC] Don't test terminators

Code does not track terminators and do not expose them through interface.
State there is just a state of the last instruction or entry.
So this information is just redundant and doesn't need to be tested.

4 years ago[SCCP] Turn sext into zext for non-negative ranges.
Florian Hahn [Fri, 19 Jun 2020 08:27:52 +0000 (09:27 +0100)]
[SCCP] Turn sext into zext for non-negative ranges.

This patch updates SCCP/IPSCCP to use the computed range info to turn
sexts into zexts, if the value is known to be non-negative. We already
to a similar transform in CorrelatedValuePropagation, but it seems like
we can catch a lot of additional cases by doing it in SCCP/IPSCCP as
well.

The transform is limited to ranges that are known to not include undef.

Currently constant ranges from conditions are treated as potentially
containing undef, due to PR46144. Once we flip this, the transform will
be more effective in practice.

Reviewers: efriedma, davide

Reviewed By: efriedma

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

4 years ago[LiveIntervals] Fix early-clobber handling in handleMoveUp
Jay Foad [Thu, 18 Jun 2020 17:20:58 +0000 (18:20 +0100)]
[LiveIntervals] Fix early-clobber handling in handleMoveUp

Without this fix, handleMoveUp can create an invalid live range like
this:

[98904e,98908r:0)[98908e,227504r:1)

where the two segments overlap, but only because we have lost the "e"
(early-clobber) on the end point of the first segment.

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

4 years ago[libc++] Implement <numbers>
Raul Tambre [Fri, 19 Jun 2020 07:13:33 +0000 (12:43 +0530)]
[libc++] Implement <numbers>

Summary: Constants have 33 significant decimal digits for IEEE 754 128-bit floating-point numbers.

Reviewers: ldionne, #libc, EricWF, zoecarver, curdeius

Reviewed By: ldionne, #libc, curdeius

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

4 years ago[NFC] Make AST_BLOCK_HASH test more robust with downstream changes
Daniel Grumberg [Fri, 19 Jun 2020 08:07:42 +0000 (09:07 +0100)]
[NFC] Make AST_BLOCK_HASH test more robust with downstream changes

4 years ago[AssumeBundles] add cannonicalisation to the assume builder
Tyker [Fri, 19 Jun 2020 08:32:09 +0000 (10:32 +0200)]
[AssumeBundles] add cannonicalisation to the assume builder

Summary:
this reduces significantly the number of assumes generated without aftecting too much
the information that is preserved. this improves the compile-time cost
of enable-knowledge-retention significantly.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, asbirlea, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Remove EDSC NestedBuilder
Alex Zinenko [Thu, 18 Jun 2020 20:55:53 +0000 (22:55 +0200)]
[mlir] Remove EDSC NestedBuilder

All class derived from `edsc::NestedBuilder` in core MLIR have been replaced
with alternatives based on OpBuilder+callbacks. The *Builder EDSC
infrastructure has been deprecated. Remove edsc::NestedBuilder.

This completes the "structured builders" refactoring.

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

4 years ago[mlir] Remove EDSC BlockBuilder, BlockHandle and related functionality
Alex Zinenko [Thu, 18 Jun 2020 20:55:46 +0000 (22:55 +0200)]
[mlir] Remove EDSC BlockBuilder, BlockHandle and related functionality

Callback-based constructions of blocks where the body is populated in the same
function as the block creation is a natural extension of callback-based loop
construction. They provide more concise and simple APIs than EDSC BlockBuilder
at less than 20% infrastructural code cost, and are compatible with
ScopedContext. BlockBuilder, Blockhandle and related functionality has been
deprecated, remove them.

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

4 years ago[mlir] Remove EDSC LoopBuilder, derived classes and related functionality
Alex Zinenko [Thu, 18 Jun 2020 20:55:40 +0000 (22:55 +0200)]
[mlir] Remove EDSC LoopBuilder, derived classes and related functionality

Callback-based loop construction, with loop bodies being constructed during the
construction of the parent op using a function, is now fully supported by the
core infrastructure. This provides almost the same level of brevity as EDSC
LoopBuilder at less than 30% infrastructural code cost. Functional equivalents
compatible with EDSC ScopedContext are implemented on top of the main builders.
LoopBuilder and related functionality has been deprecated, remove it.

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

4 years ago[CodeGen] Fix SimplifyDemandedBits for scalable vectors
David Sherwood [Tue, 26 May 2020 06:46:01 +0000 (07:46 +0100)]
[CodeGen] Fix SimplifyDemandedBits for scalable vectors

For now I have changed SimplifyDemandedBits and it's various callers
to assume we know nothing for scalable vectors and to ignore the
demanded bits completely. I have also done something similar for
SimplifyDemandedVectorElts. These changes fix up lots of warnings
due to calls to EVT::getVectorNumElements() for types with scalable
vectors. These functions are all used for optimisations, rather than
functional requirements. In future we can revisit this code if
there is a need to improve code quality for SVE.

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

4 years ago[CodeGen] Fix ComputeNumSignBits for scalable vectors
David Sherwood [Wed, 3 Jun 2020 14:02:44 +0000 (15:02 +0100)]
[CodeGen] Fix ComputeNumSignBits for scalable vectors

When trying to calculate the number of sign bits for scalable vectors
we should just bail out for now and pretend we know nothing.

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

4 years ago[AST] Dump containsErrors bit for the Type.
Haojian Wu [Tue, 16 Jun 2020 07:08:02 +0000 (09:08 +0200)]
[AST] Dump containsErrors bit for the Type.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years agoFix `check-mlir` target when the host target isn't configured
Mehdi Amini [Fri, 19 Jun 2020 03:21:36 +0000 (03:21 +0000)]
Fix `check-mlir` target when the host target isn't configured

This patch adds the `default_triple` feature to MLIR test suite.
This feature was added to LLVM in d178f4fc8 in order to be able to
run the LLVM tests without having the host targets configured in.
With this change, `ninja check-mlir` passes without the host
target, i.e. this config:

  cmake ../llvm -DLLVM_TARGETS_TO_BUILD="" -DLLVM_DEFAULT_TARGET_TRIPLE="" -DLLVM_ENABLE_PROJECTS=mlir -GNinja

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

4 years agoMark some LLVM tests which require a default_triple (NFC)
Mehdi Amini [Fri, 19 Jun 2020 04:41:24 +0000 (04:41 +0000)]
Mark some LLVM tests which require a default_triple (NFC)

These tests involve a JIT, and like other tests should have the
REQUIRE: default_triple present.
This allow to run `ninja check` without the host target configured
in.

4 years ago[AArch64] Add clang command line support for -mharden-sls=
Kristof Beyls [Mon, 25 May 2020 14:48:22 +0000 (15:48 +0100)]
[AArch64] Add clang command line support for -mharden-sls=

The accepted options to -mharden-sls= are:
* all: enable all mitigations against Straight Line Speculation that are
  implemented.
* none: disable all mitigations against Straight Line Speculation.
* retbr: enable the mitigation against Straight Line Speculation for RET
  and BR instructions.
* blr: enable the mitigation against Straight Line Speculation for BLR
  instructions.

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

4 years ago[Test] Add more tests on select->phi transform
Max Kazantsev [Fri, 19 Jun 2020 05:56:26 +0000 (12:56 +0700)]
[Test] Add more tests on select->phi transform

4 years ago[AVR] Remove duplicate specification of lib directory
Dylan McKay [Fri, 19 Jun 2020 05:34:59 +0000 (17:34 +1200)]
[AVR] Remove duplicate specification of lib directory

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: Jim, cfe-commits

Tags: #clang

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

This was originally committed in
03b0831144a9fe25aac81498b0a1dec82f4ec5df but I missed the commit
attribution.

Patch by Dennis van der Schagt.

4 years agoRevert "[AVR] Remove duplicate specification of lib directory"
Dylan McKay [Fri, 19 Jun 2020 05:35:43 +0000 (17:35 +1200)]
Revert "[AVR] Remove duplicate specification of lib directory"

This reverts commit 03b0831144a9fe25aac81498b0a1dec82f4ec5df.

I forgot to attribute the commit originally so I am recommitting in a
subsequent patch.

4 years ago[AVR] Remove duplicate specification of lib directory
Dylan McKay [Fri, 19 Jun 2020 05:34:59 +0000 (17:34 +1200)]
[AVR] Remove duplicate specification of lib directory

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: Jim, cfe-commits

Tags: #clang

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

4 years ago[AArch64] Avoid incompatibility between SLSBLR mitigation and BTI codegen.
Kristof Beyls [Fri, 22 May 2020 20:00:46 +0000 (21:00 +0100)]
[AArch64] Avoid incompatibility between SLSBLR mitigation and BTI codegen.

A "BTI c" instruction only allows jumping/calling to using a BLR* instruction.
However, the SLSBLR mitigation changes a BLR to a BR to implement the
function call. Therefore, a "BTI c" check that passed before could
trigger after the BLR->BL change done by the SLSBLR mitigation.
However, if the register used in BR is X16 or X17, this trigger will not
fire (see ArmARM for further details).

Therefore, this patch simply changes the function stubs for the SLSBLR
mitigation from
__llvm_slsblr_thunk_x<N>:
    br x<N>
    SpeculationBarrier
to
__llvm_slsblr_thunk_x<N>:
    mov x16, x<N>
    br  x16
    SpeculationBarrier

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

4 years ago[libc] Migrate the libc benchmark instruction to ninja.
Anthony Steinhauser [Fri, 19 Jun 2020 04:54:30 +0000 (21:54 -0700)]
[libc] Migrate the libc benchmark instruction to ninja.

    Reviewers: sivachandra

    Reviewed By: sivachandra

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

4 years ago[MC] Pass the symbol rather than its name to onSymbolStart()
Ronak Chauhan [Wed, 17 Jun 2020 19:52:08 +0000 (01:22 +0530)]
[MC] Pass the symbol rather than its name to onSymbolStart()

Summary: This allows targets to also consider the symbol's type and/or address if needed.

Reviewers: scott.linder, jhenderson, MaskRay, aardappel

Reviewed By: scott.linder, MaskRay

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, aheejin, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[llvm][SVE] Reg + reg addressing mode for LD1RO.
Francesco Petrogalli [Fri, 19 Jun 2020 03:31:01 +0000 (03:31 +0000)]
[llvm][SVE] Reg + reg addressing mode for LD1RO.

Reviewers: efriedma, sdesmalen

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[PowerPC] Canonicalize shuffles to match more single-instruction masks on LE
Nemanja Ivanovic [Fri, 19 Jun 2020 02:53:50 +0000 (21:53 -0500)]
[PowerPC] Canonicalize shuffles to match more single-instruction masks on LE

We currently miss a number of opportunities to emit single-instruction
VMRG[LH][BHW] instructions for shuffles on little endian subtargets. Although
this in itself is not a huge performance opportunity since loading the permute
vector for a VPERM can always be pulled out of loops, producing such merge
instructions is useful to downstream optimizations.
Since VPERM is essentially opaque to all subsequent optimizations, we want to
avoid it as much as possible. Other permute instructions have semantics that can
be reasoned about much more easily in later optimizations.

This patch does the following:
- Canonicalize shuffles so that the first element comes from the first vector
  (since that's what most of the mask matching functions want)
- Switch the elements that come from splat vectors so that they match the
  corresponding elements from the other vector (to allow for merges)
- Adds debugging messages for when a shuffle is matched to a VPERM so that
  anyone interested in improving this further can get the info for their code

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

4 years agoAMDGPU/GlobalISel: Remove selection of MAD/MAC when not available
Carl Ritson [Fri, 19 Jun 2020 01:29:47 +0000 (10:29 +0900)]
AMDGPU/GlobalISel: Remove selection of MAD/MAC when not available

Add code to respect mad-mac-f32-insts target feature.

Reviewed By: arsenm

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

4 years ago[gn build] Port 9ca50e887db
LLVM GN Syncbot [Fri, 19 Jun 2020 01:17:54 +0000 (01:17 +0000)]
[gn build] Port 9ca50e887db

4 years agoMore test cleanup for c36b03e32556a966e584386ac7dbb110bc7e4bc5.
Richard Smith [Fri, 19 Jun 2020 01:16:53 +0000 (18:16 -0700)]
More test cleanup for c36b03e32556a966e584386ac7dbb110bc7e4bc5.

4 years ago[libTooling] Add parser for string representation of `RangeSelector`.
Yitzhak Mandelbaum [Mon, 15 Jun 2020 19:23:57 +0000 (15:23 -0400)]
[libTooling] Add parser for string representation of `RangeSelector`.

This patch adds a parser for a `RangeSelector` written as a string. The format
is closely based on the way one would right the selector in C++. This should
enable use of `RangeSelector`s from tools like clang-query and web UIs.

4 years agoThe type of a reference to a non-type template parameter pack should
Richard Smith [Fri, 19 Jun 2020 00:45:55 +0000 (17:45 -0700)]
The type of a reference to a non-type template parameter pack should
not be a pack expansion type.

Using a pack expansion type for a pack declaration makes sense, but
general expressions should never have pack expansion types. If we have a
pack `T *...V`, then the type of `V` is the type `T *`, which contains
an unexpanded pack, and is a pointer type.

This allows us to better diagnose issues where a template is invalid due
to some non-dependent portion of a dependent type of a non-type template
parameter pack.

4 years ago[BFloat] Move LLVMBFloatTypeKind to the end of the enum
Ties Stuij [Thu, 18 Jun 2020 22:57:32 +0000 (23:57 +0100)]
[BFloat] Move LLVMBFloatTypeKind to the end of the enum

Summary: so it doesn't change the C ABI

Reviewers: deadalnix

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[flang] DATA statement processing (part 2/4): Initial images
peter klausler [Thu, 18 Jun 2020 21:37:59 +0000 (14:37 -0700)]
[flang] DATA statement processing (part 2/4): Initial images

Summary:
Defines a representation for the initialized memory image of
a variable.  This image is populated by DATA statement
processing as designator elements are put into correspondence
with values, then converted into an initializer in the symbol
table so that lowering can pass the initial image to the
code generator.

Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby

Reviewed By: tskeith

Subscribers: mgorny, llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years agoRevert "Hook up OpenBSD 64-bit PowerPC support"
Brad Smith [Fri, 19 Jun 2020 00:05:39 +0000 (20:05 -0400)]
Revert "Hook up OpenBSD 64-bit PowerPC support"

4 years agoSet appropriate host defines for building under emscripten
Derek Schuff [Thu, 18 Jun 2020 20:06:51 +0000 (13:06 -0700)]
Set appropriate host defines for building under emscripten

Emscripten has emulations for several headers found on Linux,
including spwan.h and endian.h

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

4 years ago[sanitizer] Update global_symbols.txt
Vitaly Buka [Thu, 18 Jun 2020 23:55:12 +0000 (16:55 -0700)]
[sanitizer] Update global_symbols.txt

4 years ago[StackSafety] Add "Must Live" logic
Vitaly Buka [Thu, 18 Jun 2020 09:24:00 +0000 (02:24 -0700)]
[StackSafety] Add "Must Live" logic

Summary:
Extend StackLifetime with option to calculate liveliness
where alloca is only considered alive on basic block entry
if all non-dead predecessors had it alive at terminators.

Depends on D82043.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Refactor Registry loops to range for
Nathan James [Thu, 18 Jun 2020 23:40:00 +0000 (00:40 +0100)]
[NFC] Refactor Registry loops to range for

4 years ago[StackSafety] Add pass for StackLifetime testing
Vitaly Buka [Wed, 17 Jun 2020 11:09:58 +0000 (04:09 -0700)]
[StackSafety] Add pass for StackLifetime testing

Summary: lifetime.ll is a copy of SafeStack/X86/coloring2.ll

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, mgrang, llvm-commits

Tags: #llvm

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

4 years agoHook up OpenBSD 64-bit PowerPC support
Brad Smith [Thu, 18 Jun 2020 23:19:45 +0000 (19:19 -0400)]
Hook up OpenBSD 64-bit PowerPC support

4 years ago[mlir][DialectConversion] Refactor how block argument types get converted
River Riddle [Thu, 18 Jun 2020 22:45:43 +0000 (15:45 -0700)]
[mlir][DialectConversion] Refactor how block argument types get converted

This revision removes the TypeConverter parameter passed to the apply* methods, and instead moves the responsibility of region type conversion to patterns. The types of a region can be converted using the 'convertRegionTypes' method, which acts similarly to the existing 'applySignatureConversion'. This method ensures that all blocks within, and including those moved into, a region will have the block argument types converted using the provided converter.

This has the benefit of making more of the legalization logic controlled by patterns, instead of being handled explicitly by the driver. It also opens up the possibility to support multiple type conversions at some point in the future.

This revision also adds a new utility class `FailureOr<T>` that provides a LogicalResult friendly facility for returning a failure or a valid result value.

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

4 years ago[NFC] Cleanup of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc()
Xiangling Liao [Tue, 16 Jun 2020 20:27:04 +0000 (16:27 -0400)]
[NFC] Cleanup of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc()

Tidy up some code of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc() as the
pre-work of D74166 patch.

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

4 years ago[flang] DATA stmt processing (part 1/4): designator folding
peter klausler [Thu, 18 Jun 2020 20:28:43 +0000 (13:28 -0700)]
[flang] DATA stmt processing (part 1/4): designator folding

Summary:
Add code to resolve constant Designators at compilation time
into a base Symbol, byte offset, and field size.  This is used in
later DATA statement processing to identify the static storage being
initialized by each object in a DATA statement.  Also implement
the reverse mapping so that Designators can be reconstructed for
use in error messages about (e.g.) duplicate initializers.

Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby

Reviewed By: PeteSteinfeld

Subscribers: mgorny, llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[docs] Regenerate clang/docs/ClangCommandLineReference.rst
Fangrui Song [Thu, 18 Jun 2020 21:52:39 +0000 (14:52 -0700)]
[docs] Regenerate clang/docs/ClangCommandLineReference.rst

4 years agoARC: Enforce function alignment at code emission time
Matt Arsenault [Thu, 18 Jun 2020 13:37:33 +0000 (09:37 -0400)]
ARC: Enforce function alignment at code emission time

Don't do this in the MachineFunctionInfo constructor. Also, ensure the
alignment rather than overwriting it outright. I vaguely remember
there was another place to enforce the target minimum alignment, but I
couldn't find it (it's there for instructions).

4 years agoAMDGPU/GlobalISel: Implement computeKnownAlignForTargetInstr
Matt Arsenault [Fri, 5 Jun 2020 19:29:18 +0000 (15:29 -0400)]
AMDGPU/GlobalISel: Implement computeKnownAlignForTargetInstr

We probably need to move where intrinsics are lowered to copies to
make this useful.

4 years agoAMDGPU: Update private null pointer value in documentation
Matt Arsenault [Thu, 18 Jun 2020 21:24:12 +0000 (17:24 -0400)]
AMDGPU: Update private null pointer value in documentation

Private pointers used to workaround IR semantics by artifically
reserving an object at offset 0 so no user object would be allocated
there. Since alloca now uses a non-0 address space, that workaround is
unnecssary and 0 can be treated as a valid pointer.

4 years agoBypassSlowDivision: Fix dropping debug info
Matt Arsenault [Thu, 11 Jun 2020 00:47:52 +0000 (20:47 -0400)]
BypassSlowDivision: Fix dropping debug info

I don't know anything about debug info, but this seems like more work
should be necessary. This constructs a new IRBuilder and reconstructs
the original divides rather than moving the original.

One problem this has is if a div/rem pair are handled, both end up
with the same debugloc. I'm not sure how to fix this, since this uses
a cache when it sees the same input operands again, which will have
the first instance's location attached.

4 years ago[flang] Roll up small fixes to runtime bugs found in testing
peter klausler [Thu, 18 Jun 2020 19:19:49 +0000 (12:19 -0700)]
[flang] Roll up small fixes to runtime bugs found in testing

Summary:
Fix several bugs in the Fortran runtime found in initial
testing.

Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby

Reviewed By: tskeith, PeteSteinfeld

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[PowerPC][Power10] Implement Parallel Bits Deposit/Extract Builtins in LLVM/Clang
Amy Kwan [Thu, 18 Jun 2020 18:11:09 +0000 (13:11 -0500)]
[PowerPC][Power10] Implement Parallel Bits Deposit/Extract Builtins in LLVM/Clang

This patch implements builtins for the following prototypes:

vector unsigned long long vec_pdep(vector unsigned long long, vector unsigned long long);
vector unsigned long long vec_pext(vector unsigned long long, vector unsigned long long __b);
unsigned long long __builtin_pdepd (unsigned long long, unsigned long long);
unsigned long long __builtin_pextd (unsigned long long, unsigned long long);

Revision Depends on D80758

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

4 years agoGlobalISel: Fix some artifact combiner worklist inconsistencies
Matt Arsenault [Tue, 16 Jun 2020 18:20:34 +0000 (14:20 -0400)]
GlobalISel: Fix some artifact combiner worklist inconsistencies

In one case, UpdateDefs was not getting set and a dead SmallVector
constructed. In another, it was adding new vreg defs to the updated
set which should be unnecessary. This also wasn't considering the
multiple defs of G_UNMERGE_VALUES.

Also increase the small vector sizes for merge/unmerge operands to the
usual semi-arbitrary 8. While debugging these, I'm usually seeing
merges and unmerges with at least 4 uses/defs.

I haven't run into an actual problem from any of these though.

4 years agoGlobalISel: Pass LegalizerHelper to custom legalize callbacks
Matt Arsenault [Tue, 9 Jun 2020 21:02:12 +0000 (17:02 -0400)]
GlobalISel: Pass LegalizerHelper to custom legalize callbacks

This was passing in all the parameters needed to construct a
LegalizerHelper in the custom legalization, when it's simpler to just
pass in the existing helper.

This is slightly more annoying to use in the common case where you
don't need the legalizer helper, but we could add back the common
parameters back in addition to the helper.

I didn't propagate this to all the internal target changes that this
logically implies, but did update a sample one for
legalizeMinNumMaxNum.

This is in preparation for moving AMDGPU load/store legalization
entirely into custom lowering. The current set of legalization actions
is really constraining and not really capable of expressing all the
actions needed to legalize loads/stores. In particular there's no way
to express when the memory access itself needs to change size vs. the
result type. There's also a lot of redundancy since the same
split/widen actions need to be applied in both vector and scalar
cases. All of the sub-cases logically belong as steps in the legalizer
helper, but it will be easier to consider everything at once in custom
lowering.

4 years ago[docs] Specify rules for updating debug locations
Vedant Kumar [Thu, 4 Jun 2020 21:33:17 +0000 (14:33 -0700)]
[docs] Specify rules for updating debug locations

Summary:
Restructure HowToUpdateDebugInfo.rst to specify rules for when
transformations should preserve, merge, or drop debug locations.

The goal is to have clear, well-justified rules that come with a few
examples and counter-examples, so that pass authors can pick the best
strategy for managing debug locations depending on the specific task at
hand.

I've tried to set down sensible rules here that mostly align with what
we already do in llvm today, and that take a diverse set of use cases
into account (interactive debugging, crash triage, SamplePGO).

Please *do* try to pick these rules apart and suggest clarifications or
improvements :).

Side note: Prior to 24660ea1, this document was structured as a long
list of very specific code transformations -- the idea being that we
would fill in what to do in each specific case. I chose to reorganize
the document as a list of actions to take because it drastically cuts
down on the amount of redundant exposition/explanation needed. I hope
that's fine...

Reviewers: jmorse, aprantl, dblaikie

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[Sphinx] Adjust for source_parsers deprecation in Sphinx 3.0
Jonas Devlieghere [Thu, 18 Jun 2020 21:04:34 +0000 (14:04 -0700)]
[Sphinx] Adjust for source_parsers deprecation in Sphinx 3.0

Update the Sphinx configuration for the removal of source_parsers in
Sphinx 3.0. The variable has been deprecated since version 1.8.

> Version 1.8 deprecates and version 3.0 removes the source_parsers
> configuration variable that was used by older recommonmark versions.

https://www.sphinx-doc.org/en/master/usage/markdown.html

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

4 years ago[mlir] Update Toy tutorial to use callback-based loop constructors
Alex Zinenko [Thu, 18 Jun 2020 15:53:59 +0000 (17:53 +0200)]
[mlir] Update Toy tutorial to use callback-based loop constructors

We recently introduced support for building loops or loop nests using callbacks
that populate the body. Use these in the tutorial instead of setInsertionPoint
manipulations.

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

4 years ago[mlir] Refactor affine loop nest builders
Alex Zinenko [Thu, 18 Jun 2020 15:53:50 +0000 (17:53 +0200)]
[mlir] Refactor affine loop nest builders

Existing implementation of affine loop nest builders relies on EDSC
ScopedContext, which is not used pervasively. Provide a common OpBuilder-based
helper function to construct a perfect nest of affine loops with the body of
the innermost loop populated by a callback. Use this function to implement the
EDSC version.

Affine "for" loops differ from SCF "for" loops by (1) not allowing to yield
values and (2) supporting short-hand form for constant bounds, which justifies
a separate implementation of the loop nest builder for the same of simplicity.

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

4 years ago[mlir] Allow for patterns to match any root kind.
River Riddle [Thu, 18 Jun 2020 20:58:25 +0000 (13:58 -0700)]
[mlir] Allow for patterns to match any root kind.

Traditionally patterns have always had the root operation kind hardcoded to a specific operation name. This has worked well for quite some time, but it has certain limitations that make it undesirable. For example, some lowering have the same implementation for many different operations types with a few lowering entire dialects using the same pattern implementation. This problem has led to several "solutions":
a) Provide a template implementation to the user so that they can instantiate it for each operation combination, generally requiring the inclusion of the auto-generated operation definition file.
b) Use a non-templated pattern that allows for providing the name of the operation to match
  - No one ever does this, because enumerating operation names can be cumbersome and so this quickly devolves into solution a.

This revision removes the restriction that patterns have a hardcoded root type, and allows for a class patterns that could match "any" operation type. The major downside of root-agnostic patterns is that they make certain pattern analyses more difficult, so it is still very highly encouraged that an operation specific pattern be used whenever possible.

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

4 years ago[mlir] Refactor RewritePatternMatcher into a new PatternApplicator class.
River Riddle [Thu, 18 Jun 2020 20:58:17 +0000 (13:58 -0700)]
[mlir] Refactor RewritePatternMatcher into a new PatternApplicator class.

This class enables for abstracting more of the details for the rewrite process, and will allow for clients to apply specific cost models to the pattern list. This allows for DialectConversion and the GreedyPatternRewriter to share the same underlying matcher implementation. This also simplifies the plumbing necessary to support dynamic patterns.

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

4 years ago[AIX] Split lit test shtest-format into two separate tests and add AIX as UNSUPPORTED...
Shuhong Liu [Thu, 18 Jun 2020 20:51:53 +0000 (16:51 -0400)]
[AIX] Split lit test shtest-format into two separate tests and add AIX as UNSUPPORTED for shtest-format-argv0

Summary: lit test `shtest-format.py` fails on AIX  because one of the subtest of shtest-format requires the tool `[` to be installed under the system PATH. For AIX, `[` is only available as a shell builtin and does not present as an executable file under PATH. Hence, split the original shtest-format into two separate test files and added AIX as UNSUPPORTED for the test using `[` .

Reviewers: daltenty, hubert.reinterpretcast

Reviewed By: hubert.reinterpretcast

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

4 years ago[mlir] [integration-test] [LLVMIR] Add reduction intrinsic tests
aartbik [Thu, 18 Jun 2020 19:55:54 +0000 (12:55 -0700)]
[mlir] [integration-test] [LLVMIR] Add reduction intrinsic tests

Reviewers: ftynse, nicolasvasilache, reidtatge

Reviewed By: nicolasvasilache

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

Tags: #mlir

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

4 years ago[SVE] Remove calls to VectorType::getNumElements from Transforms/Utils
Christopher Tetreault [Thu, 18 Jun 2020 19:57:08 +0000 (12:57 -0700)]
[SVE] Remove calls to VectorType::getNumElements from Transforms/Utils

Reviewers: efriedma, c-rhodes, david-arm, Tyker, asbirlea

Reviewed By: david-arm

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

Tags: #llvm

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

4 years ago[HIP] Enable -amdgpu-internalize-symbols
Yaxun (Sam) Liu [Tue, 16 Jun 2020 18:52:03 +0000 (14:52 -0400)]
[HIP] Enable -amdgpu-internalize-symbols

Enable -amdgpu-internalize-symbols to eliminate unused functions and global variables
for whole program to speed up compilation and improve performance.

For -fno-gpu-rdc, -amdgpu-internalize-symbols is passed to clang -cc1.

For -fgpu-rdc, -amdgpu-internalize-symbols is passed to lld.

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

4 years ago[mlir][vulkan-runner] add support for memref of i8, i16 types in vulkan runner
Thomas Raoux [Thu, 18 Jun 2020 20:24:51 +0000 (13:24 -0700)]
[mlir][vulkan-runner] add support for memref of i8, i16 types in vulkan runner

This extends the types supported as kernel arguments when using vulkan runner.

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

4 years ago[CodeView] Revert 8374bf43634725dc02a262a77b5f940fca25938c and 403f9537924b8910ed4f74...
Alexandre Ganea [Thu, 18 Jun 2020 20:17:05 +0000 (16:17 -0400)]
[CodeView] Revert 8374bf43634725dc02a262a77b5f940fca25938c and 403f9537924b8910ed4f741ed96c61f5e657915b

This reverts:
8374bf43634725dc02a262a77b5f940fca25938c [CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry which was previously a null reference, now an empty string.
403f9537924b8910ed4f741ed96c61f5e657915b [CodeView] Add full repro to LF_BUILDINFO record

This is causing the lld/test/COFF/pdb-relative-source-lines.test to fail: http://lab.llvm.org:8011/builders/lld-x86_64-win/builds/1096/steps/test-check-all/logs/FAIL%3A%20lld%3A%3Apdb-relative-source-lines.test
And clang/test/CodeGen/debug-info-codeview-buildinfo.c fails as well: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33346/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adebug-info-codeview-buildinfo.c

4 years ago[lld][WebAssembly] Allow ctors functions that return values
Sam Clegg [Tue, 16 Jun 2020 19:23:25 +0000 (12:23 -0700)]
[lld][WebAssembly] Allow ctors functions that return values

Some projects use the constructor attribute on functions that also
return values.  In this case we just ignore them.

The error was reported in the libgpg-error project that marks
gpg_err_init with the `__constructor__` attribute.

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

4 years ago[mlir][spirv] Allow mixed type cooperative matrix muladd
Thomas Raoux [Thu, 18 Jun 2020 20:05:09 +0000 (13:05 -0700)]
[mlir][spirv] Allow mixed type cooperative matrix muladd

muladd can have differenti types for lhs/rhs and acc/destination. Change
verifier and update the test to use supported example.

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

4 years ago[mlir][ods] Look through OpVariable for type constraint
Jacques Pienaar [Thu, 18 Jun 2020 19:51:51 +0000 (12:51 -0700)]
[mlir][ods] Look through OpVariable for type constraint

If one uses an OpVariable (such as via Res) then the result type constraint
should be returned.

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

4 years ago[BasicBlock] Added AnnotationWriter functionality to BasicBlock class
Kirill Naumov [Sat, 6 Jun 2020 00:06:09 +0000 (00:06 +0000)]
[BasicBlock] Added AnnotationWriter functionality to BasicBlock class

This functionality is very similar to Function compatibility with
AnnotationWriter. This change allows us to use AnnotationWriter with
BasicBlock through BB.print() method.

Reviewed-By: apilipenko
Differntial Revision: https://reviews.llvm.org/D81321

4 years ago[IRBuilder] add/use wrapper to create a generic compare based on predicate type; NFC
Sanjay Patel [Thu, 18 Jun 2020 19:44:02 +0000 (15:44 -0400)]
[IRBuilder] add/use wrapper to create a generic compare based on predicate type; NFC

The predicate can always be used to distinguish between icmp and fcmp,
so we don't need to keep repeating this check in the callers.

4 years agoAdd SveBFloat16 to type switch.
Eric Christopher [Thu, 18 Jun 2020 19:36:34 +0000 (12:36 -0700)]
Add SveBFloat16 to type switch.

4 years agoAMDGPU: Add IntrWillReturn to intrinsic definitions
Matt Arsenault [Thu, 28 May 2020 15:33:15 +0000 (11:33 -0400)]
AMDGPU: Add IntrWillReturn to intrinsic definitions

This should probably be implied for all the speculatable ones. I think
the only ones where this plausibly doesn't apply is s_sendmsghalt and
maybe kill.

4 years ago[SimplifyCFG] Update debug location when folding branch to common destination
Davide Italiano [Thu, 18 Jun 2020 19:33:02 +0000 (12:33 -0700)]
[SimplifyCFG] Update debug location when folding branch to common destination

Sometimes a dead block gets folded and the debug information is still
retained. This manifests as jumpy stepping in lldb, see the bugzilla PR
for an end-to-end C testcase.

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

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

4 years agoAdd support for DeclRefExpr in SyntaxTree, by generating IdExpressions
Eduardo Caldas [Thu, 18 Jun 2020 18:41:43 +0000 (20:41 +0200)]
Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: hlopko, gribozavr2, cfe-commits

Tags: #clang

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

4 years ago[scudo][standalone] Allow Primary allocations to fail up multiple times.
Christopher Ferris [Thu, 18 Jun 2020 18:18:16 +0000 (11:18 -0700)]
[scudo][standalone] Allow Primary allocations to fail up multiple times.

Summary:
When enabling some malloc debug features on Android, multiple 32 bit
regions become exhausted, and the allocations fail. Allow allocations
to keep trying each bigger class in the Primary until it finds a fit.
In addition, some Android tests running on 32 bit fail sometimes due
to a running out of space in two regions, and then fail the allocation.

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[TTI] Expose isNoopAddrSpaceCast in TTI.
Michael Liao [Tue, 9 Jun 2020 19:07:08 +0000 (15:07 -0400)]
[TTI] Expose isNoopAddrSpaceCast in TTI.

Reviewers: arsenm

Subscribers: wdng, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Add a dummy CMake file to include runtime subprojects
Louis Dionne [Thu, 18 Jun 2020 18:04:01 +0000 (14:04 -0400)]
[libc++] Add a dummy CMake file to include runtime subprojects

Add a simple CMakeLists.txt to build the runtimes in lockstep without
building all of LLVM. See [1] for details.

[1]: http://lists.llvm.org/pipermail/llvm-dev/2020-June/142384.html

4 years ago[flang] Fix build problems on osx
peter klausler [Wed, 17 Jun 2020 23:56:28 +0000 (16:56 -0700)]
[flang] Fix build problems on osx

Summary:
Fix build problems encountered on osx in two files.
The one in character.cpp fixes a legitimate bug that
elicited a valid warning.

Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby

Reviewed By: tskeith, PeteSteinfeld

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years agoFix return status of LoopDistribute
serge-sans-paille [Thu, 4 Jun 2020 21:35:25 +0000 (23:35 +0200)]
Fix return status of LoopDistribute

Move code that may update the IR after precondition, so that if precondition
fail, the IR isn't modified.

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

4 years agoAMDGPU: Remove mayLoad/mayStore from some side effecting intrinsics
Matt Arsenault [Thu, 28 May 2020 04:11:26 +0000 (00:11 -0400)]
AMDGPU: Remove mayLoad/mayStore from some side effecting intrinsics

These don't really modify any memory, and should not expect memory
operands.

4 years ago[libc] Add implementations long double fabsl and truncl functions.
Siva Chandra Reddy [Mon, 8 Jun 2020 18:11:49 +0000 (11:11 -0700)]
[libc] Add implementations long double fabsl and truncl functions.

Current implementations of single precision and double precision
floating point operations operate on bits of the integer type of
same size. The code made use of magic masks which were listed as
literal integer values. This is not possible in the case of long
double type as the mantissa of quad-precision long double type used
on non-x86 architectures is wider that the widest integer type for
which we can list literal values. So, in this patch, to avoid
using magic masks specified with literal values, we use packed
bit-field struct types and let the compiler generate the masks.
This new scheme allows us to implement long double flavors of the
various floating point operations. To keep the size of the patch
small, only the implementations of fabs and trunc have been
switched to the new scheme. In following patches, all exisiting
implementations will be switched to the new scheme.

Reviewers: asteinhauser

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

4 years ago[mlir] [VectorOps] remove print_i1 from runtime support library
aartbik [Thu, 18 Jun 2020 17:48:56 +0000 (10:48 -0700)]
[mlir] [VectorOps] remove print_i1 from runtime support library

Summary:
The "i1" (viz. bool) type does not have a proper equivalent on the "C"
size. So, to avoid any ABIs issues, we simply use print_i32 on an i32
value of one or zero for true and false. This has the added advantage
that one less function needs to be implemented when porting the runtime
support library.

Reviewers: ftynse, bkramer, nicolasvasilache

Reviewed By: ftynse

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

Tags: #mlir

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

4 years agoOptimize 'construct at end' loops in vector
Martijn Vels [Thu, 18 Jun 2020 17:14:02 +0000 (13:14 -0400)]
Optimize 'construct at end' loops in vector

Summary:
This change adds local 'end' and 'pos' variables for the main loop inmstead of using the ConstructTransaction variables directly.

We observed that not all vector initialization and resize operations got properly vectorized, i.e., (partially) unrolled into XMM stores for floats.

For example, `vector<int32_t> v(n, 1)` gets vectorized, but `vector<float> v(n, 1)`. It looks like the compiler assumes the state is leaked / aliased in the latter case (unclear how/why for float, but not for int32), and because of this fails to see vectorization optimization?

See https://gcc.godbolt.org/z/UWhiie

By using a local `__new_end_` (fixed), and local `__pos` (copied into __tx.__pos_ per iteration), we offer the compiler a clean loop for unrolling.

A demonstration can be seen in the isolated logic in https://gcc.godbolt.org/z/KoCNWv

The com

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

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