platform/upstream/llvm.git
5 years ago[AArch64][SVE] Add SVE2 intrinsics for polynomial arithmetic
Kerry McLaughlin [Wed, 19 Feb 2020 09:55:36 +0000 (09:55 +0000)]
[AArch64][SVE] Add SVE2 intrinsics for polynomial arithmetic

Summary:
Implements the following intrinsics:
 - @llvm.aarch64.sve.eorbt
 - @llvm.aarch64.sve.eortb
 - @llvm.aarch64.sve.pmullb.pair
 - @llvm.aarch64.sve.pmullt.pair

Reviewers: sdesmalen, c-rhodes, dancgr, cameron.mcinally, efriedma, rengolin

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

5 years agoReland "[DebugInfo] Enable the debug entry values feature by default"
Djordje Todorovic [Wed, 19 Feb 2020 09:17:52 +0000 (10:17 +0100)]
Reland "[DebugInfo] Enable the debug entry values feature by default"

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

5 years ago[LLD][ELF][ARM] Fix support for SBREL type relocations
Tamas Petz [Tue, 18 Feb 2020 17:53:26 +0000 (17:53 +0000)]
[LLD][ELF][ARM] Fix support for SBREL type relocations

With this patch lld recognizes ARM SBREL relocations.
R_ARM*_MOVW_BREL relocations are not tested because they are not used.

Patch by Tamas Petz

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

5 years ago[lldb] Let TestCppConstructors pass without fix-it intervention
Raphael Isemann [Wed, 19 Feb 2020 10:02:08 +0000 (11:02 +0100)]
[lldb] Let TestCppConstructors pass without fix-it intervention

This should use -> instead of '.', but the fix-it functionality of
the expression evaluator saved us here. Let's use the proper syntax
in the first place as we don't want to test fix-its here.

5 years ago[lldb] Put Host/common headers in a module
Raphael Isemann [Wed, 19 Feb 2020 09:47:37 +0000 (10:47 +0100)]
[lldb] Put Host/common headers in a module

This directory escaped the modularization effort it seems. Just adding
this to the Host module along with the other common headers, which should
make this code less likely to break under modules and speed up compilation.

5 years ago[ARM] Extra MVE VADDV reduction patterns
David Green [Fri, 14 Feb 2020 11:00:16 +0000 (11:00 +0000)]
[ARM] Extra MVE VADDV reduction patterns

We already make use of the VADDV vector reduction instruction for cases
where the input and the output start out at the same type. The MVE
instruction however will sum into an i32, so if we are summing a v16i8
into an i32, we can still use the same instructions. In terms of IR,
this looks like a sext of a legal type (v16i8) into a very illegal type
(v16i32) and a vecreduce.add of that into the result. This means we have
to catch the pattern early in a DAG combine, producing a target VADDVs/u
node, where the signedness is now important.

This is the first part, handling VADDV and VADDVA. There are also
VADDVL/VADDVLA instructions, which are interesting because they sum into
a 64bit value. And VMLAV and VMLALV, which are interesting because they
also do a multiply of two values. It may look a little odd in places as
a result.

On it's own this will probably not do very much, as the vectorizer will
not produce this IR yet.

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

5 years ago[DebugInfo] Pass linux triple to tests requiring ELF.
Florian Hahn [Wed, 19 Feb 2020 09:38:38 +0000 (10:38 +0100)]
[DebugInfo] Pass linux triple to tests requiring ELF.

The tests added in D74425/commit a71feda24ea092ec14474216532b3ce9883b81ab
fail with an assertion on macOS, as they seem to require ELF support.

Passing a linux triple ensures the object files are using ELF.

This fixes some GreenDragon failures.

5 years ago[lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.
Raphael Isemann [Wed, 19 Feb 2020 08:36:37 +0000 (09:36 +0100)]
[lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.

Summary:
Currently when printing data types we include implicit scopes such as inline namespaces or anonymous namespaces.
This leads to command output like this (for `std::set<X>` with X being in an anonymous namespace):

```
(lldb) print my_set
(std::__1::set<(anonymous namespace)::X, std::__1::less<(anonymous namespace)::X>, std::__1::allocator<(anonymous namespace)::X> >) $0 = size=0 {}
```

This patch removes all the implicit scopes when printing type names in TypeSystemClang::GetDisplayTypeName
so that our output now looks like this:

```
(lldb) print my_set
(std::set<X, std::less<X>, std::allocator<X> >) $0 = size=0 {}
```

As previously GetDisplayTypeName and GetTypeName had the same output we actually often used the
two as if they are the same method (they were in fact using the same implementation), so this patch also
fixes the places where we actually want the display type name and not the actual type name.

Note that this doesn't touch the `GetTypeName` class that for example the data formatters use, so this patch
is only changes the way we display types to the user. The full type name can also still be found when passing
'-R' to see the raw output of a variable in case someone is somehow interested in that.

Partly fixes rdar://problem/59292534

Reviewers: shafik, jingham

Reviewed By: shafik

Subscribers: christof, JDevlieghere, lldb-commits

Tags: #lldb

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

5 years ago[lldb][NFC] Add a missing test case to TestCppConstructors.py
Raphael Isemann [Wed, 19 Feb 2020 09:24:59 +0000 (10:24 +0100)]
[lldb][NFC] Add a missing test case to TestCppConstructors.py

5 years ago[lldb] Make TestFormatters.py not rely on working constructor calls
Raphael Isemann [Wed, 19 Feb 2020 09:00:02 +0000 (10:00 +0100)]
[lldb] Make TestFormatters.py not rely on working constructor calls

All calls to operator new in this test fail for me with:
```
expression --show-types -- *(new foo(47))`
Error output:
error: Execution was interrupted, reason: internal c++ exception breakpoint(-6)..
The process has been returned to the state before expression evaluation.
```

As calling operator new isn't the idea of this test, this patch moves that
logic to the binary with some new_* utility functions and explicitly tests
this logic in the constructor test (where we can isolate the failures and
skip them on Linux).

5 years ago[MLIR][Ploops] Add custom builders from ParallelOp and ReduceOp.
Alexander Belyaev [Wed, 19 Feb 2020 07:03:51 +0000 (08:03 +0100)]
[MLIR][Ploops] Add custom builders from ParallelOp and ReduceOp.

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

5 years ago[MIPS GlobalISel] RegBankSelect G_MERGE_VALUES and G_UNMERGE_VALUES
Petar Avramovic [Wed, 19 Feb 2020 09:06:28 +0000 (10:06 +0100)]
[MIPS GlobalISel] RegBankSelect G_MERGE_VALUES and G_UNMERGE_VALUES

Consider large operands in G_MERGE_VALUES and G_UNMERGE_VALUES as
Ambiguous during regbank selection.
Introducing new InstType AmbiguousWithMergeOrUnmerge which will
allow us to recognize whether to narrow scalar or use s64:fprb.

This change exposed a bug when reusing data from TypeInfoForMF.
Thus when Instr is about to get destroyed (using narrow scalar)
clear its data in TypeInfoForMF. Internal data is saved based on
Instr's address, and it will no longer be valid.
Add detailed asserts for InstType and operand size.

Generate generic instructions instead of MIPS target instructions
during argument lowering and custom legalizer.
Select G_UNMERGE_VALUES and G_MERGE_VALUES when proper banks are
selected: {s32:gprb, s32:gprb, s64:fprb} for G_UNMERGE_VALUES and
{s64:fprb, s32:gprb, s32:gprb} for G_MERGE_VALUES.
Update tests. One improvement is when floating point argument in
gpr(or two gprs) gets passed to another function through gpr
unnecessary fpr-to-gpr moves are no longer generated.

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

5 years ago[clang-tidy] Added a case to UnconventionalAssignOperatorCheck.
Balázs Kéri [Wed, 19 Feb 2020 09:06:58 +0000 (10:06 +0100)]
[clang-tidy] Added a case to UnconventionalAssignOperatorCheck.

Summary:
The check accepts now a `return (*this = something);` as return
statement too (beneath of `*this`).

Reviewers: alexfh, hokein, aaron.ballman, JonasToth

Reviewed By: aaron.ballman

Subscribers: xazax.hun, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang, #clang-tools-extra

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

5 years ago[CGP] Precommit tests for D74228.
Florian Hahn [Tue, 18 Feb 2020 14:43:01 +0000 (15:43 +0100)]
[CGP] Precommit tests for D74228.

5 years agoFix build after D74606
Kirill Bobyrev [Wed, 19 Feb 2020 08:18:38 +0000 (09:18 +0100)]
Fix build after D74606

5 years ago[X86] Remove vXi1 select optimization from LowerSELECT. Move it to DAG combine.
Craig Topper [Wed, 19 Feb 2020 07:38:36 +0000 (23:38 -0800)]
[X86] Remove vXi1 select optimization from LowerSELECT. Move it to DAG combine.

5 years ago[lldb/Core] Remove more duplicate code in PluginManager (NFCI)
Jonas Devlieghere [Wed, 19 Feb 2020 07:52:07 +0000 (23:52 -0800)]
[lldb/Core] Remove more duplicate code in PluginManager (NFCI)

The PluginManager contains a lot of duplicate code. I already removed a
bunch of it by introducing the templated PluginInstance class, and this
is the next step. The PluginInstances class combines the mutex and the
vector and implements the common operations.

To accommodate plugin instances with additional members it is possible
to access the underlying vector and mutex. The methods to query these
fields make use of that.

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

5 years ago[clangd] Add add commit characters to the server capabilities
Kirill Bobyrev [Tue, 18 Feb 2020 16:55:12 +0000 (17:55 +0100)]
[clangd] Add add commit characters to the server capabilities

Summary:
Make it more convinient for the clients to select completion items by
providing a set of default characters (punctuation).

Related issue: https://github.com/clangd/clangd/issues/284

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

5 years ago[X86] Handle splats in LowerBUILD_VECTORvXi1 by directly emitting scalar selects...
Craig Topper [Tue, 18 Feb 2020 07:21:48 +0000 (23:21 -0800)]
[X86] Handle splats in LowerBUILD_VECTORvXi1 by directly emitting scalar selects instead of deferring that to LowerSELECT.

LoweSELECT will detect the constant inputs and convert to scalar
selects, but we can do it directly here.

I might remove some of the code from LowerSELECT and move it to
DAG combine so doing this explicitly will make us less dependent
on it happening in lowering.

5 years ago[Coroutines][6/6] Clang schedules new passes
Brian Gesiak [Thu, 26 Dec 2019 13:00:00 +0000 (08:00 -0500)]
[Coroutines][6/6] Clang schedules new passes

Summary:
Depends on https://reviews.llvm.org/D71902.

The last in a series of six patches that ports the LLVM coroutines
passes to the new pass manager infrastructure.

This patch has Clang schedule the new coroutines passes when the
`-fexperimental-new-pass-manager` option is used. With this and the
previous 5 patches, Clang is capable of building and successfully
running the test suite of large coroutines projects such as
https://github.com/lewissbaker/cppcoro with
`ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=On`.

Reviewers: GorNishanov, lewissbaker, chandlerc, junparser

Subscribers: EricWF, cfe-commits, llvm-commits

Tags: #clang

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

5 years ago[Coroutines][5/6] Add coroutine passes to pipeline
Brian Gesiak [Thu, 26 Dec 2019 13:00:00 +0000 (08:00 -0500)]
[Coroutines][5/6] Add coroutine passes to pipeline

Summary:
Depends on https://reviews.llvm.org/D71901.

The fifth in a series of patches that ports the LLVM coroutines passes
to the new pass manager infrastructure.

The first 4 patches allow users to run coroutine passes by invoking, for
example `opt -passes=coro-early`. However, most of LLVM's tests for
coroutines use an option, `opt -enable-coroutines`, which adds all 4
coroutine passes to the appropriate legacy pass manager extension points.
This patch does the same, but using the new pass manager: when
coroutine features are enabled and the new pass manager is being used,
this adds the new-pass-manager-compliant coroutine passes to the pass
builder's pipeline.

This allows us to run all coroutine tests using the new pass manager
(besides those that use the coroutine retcon ABI used by the Swift
compiler, which is not yet supported in the new pass manager).

Reviewers: GorNishanov, lewissbaker, chandlerc, junparser, wenlei

Subscribers: wenlei, EricWF, Prazek, hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[Coroutines][4/6] New pass manager: coro-cleanup
Brian Gesiak [Thu, 26 Dec 2019 13:00:00 +0000 (08:00 -0500)]
[Coroutines][4/6] New pass manager: coro-cleanup

Summary:
Depends on https://reviews.llvm.org/D71900.

The fourth in a series of patches that ports the LLVM coroutines passes
to the new pass manager infrastructure. This patch implements
'coro-cleanup'.

No existing regression tests check the behavior of coro-cleanup on its
own, so this patch adds one. (A test named 'coro-cleanup.ll' exists, but
it relies on the entire coroutines pipeline being run. It's updated to
test the new pass manager in the 5th patch of this series.)

Reviewers: GorNishanov, lewissbaker, chandlerc, junparser, deadalnix, wenlei

Reviewed By: wenlei

Subscribers: wenlei, EricWF, hiraditya, llvm-commits

Tags: #llvm

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

5 years agoRe-land new pass manager coro-split and coro-elide
Brian Gesiak [Tue, 18 Feb 2020 21:29:13 +0000 (16:29 -0500)]
Re-land new pass manager coro-split and coro-elide

This re-applies patches https://reviews.llvm.org/D71899 and
https://reviews.llvm.org/D71900, which were reverted in
https://reviews.llvm.org/rG11053a1cc61 and
https://reviews.llvm.org/rGe999aa38d16. The underlying problem that
caused two buildbots to fail with these patches is explained in
https://reviews.llvm.org/rG26f356350bd -- older compliers disagree with
the order in which the left- and right-hand side of an assignment in
LazyCallGraph ought to be evaluated, which caused an assertion in
SmallVector::operator[] to fire when the test suite was run.

5 years ago[DebugInfo]: Added support for DWARFv5 Info section header parsing in llvm-dwp utility.
Sourabh Singh Tomar [Tue, 11 Feb 2020 18:29:40 +0000 (23:59 +0530)]
[DebugInfo]: Added support for DWARFv5 Info section header parsing in llvm-dwp utility.

Summary:
This patch teaches llvm-dwp to parse DWARFv5 info section header.
Tested this using asm test case caontaining DWARFv5 info.
Assemling it to DWO object, checking corresponding content using llvm-dwarfdump. Then finally, packaging it
to DWP using llvm-dwp and  again checking corresponding content using llvm-dwarfdump.

Reviewers: dblaikie, aprantl, probinson.

Reviewed By: dblaikie.

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

5 years ago[DebugInfo][test] Fix section flags/type to avoid warning/error in the future
Fangrui Song [Wed, 19 Feb 2020 04:08:36 +0000 (20:08 -0800)]
[DebugInfo][test] Fix section flags/type to avoid warning/error in the future

A future MC change may add a warning/error when a .section directive
specifies incorrect sh_flags/sh_type. Fix the tests to use correct
sh_flags/sh_type.

5 years ago[LazyCallGraph] Fix ambiguous index value
Brian Gesiak [Wed, 19 Feb 2020 04:28:00 +0000 (23:28 -0500)]
[LazyCallGraph] Fix ambiguous index value

After having committed https://reviews.llvm.org/D72226, 2 buildbots
running GCC 5.4.0 began failing. The cause was the order in which those
compilers evaluated the left- and right-hand sides of the expression
`RC.SCCIndices[C] = RC.SCCIndices.size();`. This commit splits the
expression into multiple statements to avoid ambiguity, and adds a test
case that exercises the code that caused the test failures on those
older compilers (which was originally included in the reviewed patch,
https://reviews.llvm.org/D72226).

5 years ago[lldb] Sort forward declarations in lldb-forward.h
Jonas Devlieghere [Wed, 19 Feb 2020 04:22:51 +0000 (20:22 -0800)]
[lldb] Sort forward declarations in lldb-forward.h

Sort forward declarations alphabetically. Also remove the two LLVM
forward declares as they frankly don't belong here.

5 years ago[lldb] Move ArchitectureCreateInstance into ldb-private-interfaces
Jonas Devlieghere [Wed, 19 Feb 2020 04:16:59 +0000 (20:16 -0800)]
[lldb] Move ArchitectureCreateInstance into ldb-private-interfaces

There's no reason this should be the only one living in the
PluginManager itself.

5 years ago[lldb/Docs] Update the features matrix
Jonas Devlieghere [Wed, 19 Feb 2020 04:08:41 +0000 (20:08 -0800)]
[lldb/Docs] Update the features matrix

Use YES/NO instead of OK, known issues instead of bugs and fix some
other small inconsistencies

5 years ago[lldb/Docs] Update the Windows documentation
Jonas Devlieghere [Wed, 19 Feb 2020 03:44:48 +0000 (19:44 -0800)]
[lldb/Docs] Update the Windows documentation

Update the build instructions for Windows with my recent experience.

5 years agoRe-land "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"
Jonas Devlieghere [Wed, 19 Feb 2020 03:13:45 +0000 (19:13 -0800)]
Re-land "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

This patch changes the way we initialize and terminate the plugins in
the system initializer. It uses an approach similar to LLVM's
TARGETS_TO_BUILD with a def file that enumerates the plugins.

Previous attempts to land this failed on the Windows bot because there's
a dependency between the different process plugins. Apparently
ProcessWindowsCommon needs to be initialized after all other process
plugins but before ProcessGDBRemote.

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

5 years agoP0593R6: Pseudo-destructor expressions end object lifetimes.
Richard Smith [Wed, 19 Feb 2020 02:39:57 +0000 (18:39 -0800)]
P0593R6: Pseudo-destructor expressions end object lifetimes.

This only has an observable effect on constant evaluation.

5 years agoFix test for profile remapper
Wenlei He [Tue, 18 Feb 2020 23:05:37 +0000 (15:05 -0800)]
Fix test for profile remapper

Subscribers: llvm-commits

Tags: #llvm

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

5 years ago[MLIR] change NVVM.mma.sync to the most useful variant.
Tim Shen [Fri, 14 Feb 2020 23:07:44 +0000 (15:07 -0800)]
[MLIR] change NVVM.mma.sync to the most useful variant.

Summary:
the .row.col variant turns out to be the popular one, contrary to what I
thought as .row.row. Since .row.col is so prevailing (as I inspect
cuDNN's behavior), I'm going to remove the .row.row support here, which
makes the patch a little bit easier.

Reviewers: ftynse

Subscribers: jholewinski, bixia, sanjoy.google, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

5 years ago[MLIR] Add std.assume_alignment op.
Tim Shen [Tue, 11 Feb 2020 03:44:42 +0000 (19:44 -0800)]
[MLIR] Add std.assume_alignment op.

Reviewers: ftynse, nicolasvasilache, andydavis1

Subscribers: bixia, sanjoy.google, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

5 years agoFix a signed/unsigned warning promoted to error.
Eric Christopher [Wed, 19 Feb 2020 01:49:22 +0000 (17:49 -0800)]
Fix a signed/unsigned warning promoted to error.

5 years ago[mlir][DialectConversion] Forward capture callback to fix build on older
River Riddle [Wed, 19 Feb 2020 01:36:25 +0000 (17:36 -0800)]
[mlir][DialectConversion] Forward capture callback to fix build on older
GCC

Older GCC confuses the type of 'callback' after it gets captured, so
add a forward capture to move it properly.

5 years ago[lldb/Core] Remove dead Get*PluginCreateCallbackForPluginName (NFC)
Jonas Devlieghere [Wed, 19 Feb 2020 01:35:11 +0000 (17:35 -0800)]
[lldb/Core] Remove dead Get*PluginCreateCallbackForPluginName (NFC)

The plugin manager had dedicated Get*PluginCreateCallbackForPluginName
methods for each type of plugin, and only a small subset of those were
used. This removes the dead duplicated code.

5 years ago[NFC] Update the testcase clang_f_opts.c for the removed options
Jim Lin [Wed, 19 Feb 2020 00:51:48 +0000 (08:51 +0800)]
[NFC] Update the testcase clang_f_opts.c for the removed options

5 years ago[lldb/Core] Remove blatant code duplication by using a template (NFC)
Jonas Devlieghere [Wed, 19 Feb 2020 01:08:46 +0000 (17:08 -0800)]
[lldb/Core] Remove blatant code duplication by using a template (NFC)

Remove a bunch of duplicate code by using a templated base class.

5 years agoRemove unused option that gcc ignored
Jim Lin [Wed, 19 Feb 2020 00:36:07 +0000 (08:36 +0800)]
Remove unused option that gcc ignored

Reviewers: efriedma, MaskRay

Reviewed By: efriedma, MaskRay

Subscribers: cfe-commits

Tags: #clang

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

5 years ago[mlir] Refactor TypeConverter to add conversions without inheritance
River Riddle [Tue, 18 Feb 2020 23:56:33 +0000 (15:56 -0800)]
[mlir] Refactor TypeConverter to add conversions without inheritance

Summary:
This revision refactors the TypeConverter class to not use inheritance to add type conversions. It instead moves to a registration based system, where conversion callbacks are added to the converter with `addConversion`. This method takes a conversion callback, which must be convertible to any of the following forms(where `T` is a class derived from `Type`:
* Optional<Type> (T type)
   - This form represents a 1-1 type conversion. It should return nullptr
     or `llvm::None` to signify failure. If `llvm::None` is returned, the
     converter is allowed to try another conversion function to perform
     the conversion.
* Optional<LogicalResult>(T type, SmallVectorImpl<Type> &results)
   - This form represents a 1-N type conversion. It should return
     `failure` or `llvm::None` to signify a failed conversion. If the new
     set of types is empty, the type is removed and any usages of the
     existing value are expected to be removed during conversion. If
     `llvm::None` is returned, the converter is allowed to try another
     conversion function to perform the conversion.

When attempting to convert a type, the TypeConverter walks each of the registered converters starting with the one registered most recently.

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

5 years agoAdd -std=c++20 flag, replace C++2a with C++20 throughout the Clang
Richard Smith [Wed, 19 Feb 2020 00:13:23 +0000 (16:13 -0800)]
Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang
user interface and documentation, and update __cplusplus for C++20.

WG21 considers the C++20 standard to be finished (even though it still
has some more steps to pass through in the ISO process).

The old flag names are accepted for compatibility, as usual, and we
still have lots of references to C++2a in comments and identifiers;
those can be cleaned up separately.

5 years ago[gn build] Port ca9ba76481f
LLVM GN Syncbot [Wed, 19 Feb 2020 00:02:12 +0000 (00:02 +0000)]
[gn build] Port ca9ba76481f

5 years ago[WebAssembly] Replace all calls with generalized multivalue calls
Thomas Lively [Fri, 7 Feb 2020 00:29:59 +0000 (16:29 -0800)]
[WebAssembly] Replace all calls with generalized multivalue calls

Summary:
Extends the multivalue call infrastructure to tail calls, removes all
legacy calls specialized for particular result types, and removes the
CallIndirectFixup pass, since all indirect call arguments are now
fixed up directly in the post-insertion hook.

In order to keep supporting pretty-printed defs and uses in test
expectations, MCInstLower now inserts an immediate containing the
number of defs for each call and call_indirect. The InstPrinter is
updated to query this immediate if it is present and determine which
MCOperands are defs and uses accordingly.

Depends on D72902.

Reviewers: aheejin

Subscribers: dschuff, mgorny, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

5 years ago[Driver] -pg -mfentry should respect target specific decisions for -mframe-pointer=all
Nick Desaulniers [Tue, 18 Feb 2020 23:33:42 +0000 (15:33 -0800)]
[Driver] -pg -mfentry should respect target specific decisions for -mframe-pointer=all

Summary:
$ clang -O2 -pg -mfentry foo.c

was adding frame pointers to all functions. This was exposed via
compiling the Linux kernel for x86_64 with CONFIG_FUNCTION_TRACER
enabled.

-pg was unconditionally setting the equivalent of -fno-omit-frame-pointer,
regardless of the presence of -mfentry or optimization level.  After this
patch, frame pointers will only be omitted at -O0 or if
-fno-omit-frame-pointer is explicitly set for -pg -mfentry.

See also:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=3c5273a96ba8dbf98c40bc6d9d0a1587b4cfedb2;hp=c9d75a48c4ea63ab27ccdb40f993236289b243f2#patch2
(modification to ix86_frame_pointer_required())

Fixes: pr/44934
Reviewers: void, manojgupta, dberris, MaskRay, hfinkel

Reviewed By: MaskRay

Subscribers: cfe-commits, llozano, niravd, srhines

Tags: #clang

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

5 years agoFix NDEBUG build after instruction ordering
Reid Kleckner [Tue, 18 Feb 2020 23:12:32 +0000 (15:12 -0800)]
Fix NDEBUG build after instruction ordering

5 years agoPR44958: Allow member calls and typeid / dynamic_cast on mutable objects
Richard Smith [Tue, 18 Feb 2020 22:53:54 +0000 (14:53 -0800)]
PR44958: Allow member calls and typeid / dynamic_cast on mutable objects
and objects with mutable subobjects.

The standard wording doesn't really cover these cases; accepting all
such cases seems most in line with what we do in other cases and what
other compilers do. (Essentially this means we're assuming that objects
external to the evaluation are always in-lifetime.)

5 years ago[WebAssembly] Fix RegStackify and ExplicitLocals to handle multivalue
Thomas Lively [Tue, 14 Jan 2020 22:22:49 +0000 (14:22 -0800)]
[WebAssembly] Fix RegStackify and ExplicitLocals to handle multivalue

Summary:
There is still room for improvement in the handling of multivalue
nodes in both passes, but the current algorithm is at least correct
and optimizes some simpler cases. In order to make future
optimizations of these passes easier and build confidence that the
current algorithms are correct, this CL also adds a script that
automatically and exhaustively generates interesting multivalue test
cases.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

5 years ago[GlobalISel]: Fix some non determinism exposed in CSE due to not notifying observers...
Aditya Nandakumar [Tue, 18 Feb 2020 22:42:49 +0000 (14:42 -0800)]
[GlobalISel]: Fix some non determinism exposed in CSE due to not notifying observers about mutations + add verification for CSE

https://reviews.llvm.org/D67133

While investigating some non determinism (CSE doesn't produce wrong
code, it just doesn't CSE some times) in GISel CSE on an out of tree
target, I realized that the core issue was that there were lots of code
that mutates (setReg, setRegClass etc), but doesn't notify observers
(CSE in this case but this could be any other observer). In order to
make the Observer be available in various parts of code and to avoid
having to thread it through various API, the MachineFunction now has the
observer as field. This allows it to be easily used in helper functions
such as constrainOperandRegClass.
Also added some invariant verification method in CSEInfo which can
catch these issues (when CSE is enabled).

5 years ago[IR] Lazily number instructions for local dominance queries
Reid Kleckner [Tue, 18 Feb 2020 22:33:54 +0000 (14:33 -0800)]
[IR] Lazily number instructions for local dominance queries

Essentially, fold OrderedBasicBlock into BasicBlock, and make it
auto-invalidate the instruction ordering when new instructions are
added. Notably, we don't need to invalidate it when removing
instructions, which is helpful when a pass mostly delete dead
instructions rather than transforming them.

The downside is that Instruction grows from 56 bytes to 64 bytes.  The
resulting LLVM code is substantially simpler and automatically handles
invalidation, which makes me think that this is the right speed and size
tradeoff.

The important change is in SymbolTableTraitsImpl.h, where the numbering
is invalidated. Everything else should be straightforward.

We probably want to implement a fancier re-numbering scheme so that
local updates don't invalidate the ordering, but I plan for that to be
future work, maybe for someone else.

Reviewed By: lattner, vsk, fhahn, dexonsmith

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

5 years ago[hexagon] Fix testcase issue with windows builder.
Sid Manning [Tue, 18 Feb 2020 22:36:38 +0000 (16:36 -0600)]
[hexagon] Fix testcase issue with windows builder.

5 years agoAdd coding standard recommending use of qualifiers in cpp files
Reid Kleckner [Tue, 18 Feb 2020 21:11:39 +0000 (13:11 -0800)]
Add coding standard recommending use of qualifiers in cpp files

There is prior art for this in the code base itself, and a recent
example of this here: c45f8d49897f

This came up in discussion on this review where @maskray was going the
opposite direction:
  https://reviews.llvm.org/D68772

Given that there is disagreement, we should make a choice and document
it.

Thanks to John McCall for the precise wording.

Reviewed By: MaskRay, rjmccall

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

5 years agoFix assertion on `!eq(?, 0)`
Daniel Sanders [Tue, 18 Feb 2020 21:12:28 +0000 (13:12 -0800)]
Fix assertion on `!eq(?, 0)`

Instead of asserting, emit a proper error message

5 years ago[WebAssembly] Implement multivalue call_indirects
Thomas Lively [Thu, 6 Feb 2020 06:35:01 +0000 (22:35 -0800)]
[WebAssembly] Implement multivalue call_indirects

Summary:
Unlike normal calls, call_indirects have immediate arguments that
caused a MachineVerifier failure without a small tweak to loosen the
verifier's requirements for variadicOpsAreDefs instructions.

One nice thing about the new call_indirects is that they do not need
to participate in the PCALL_INDIRECT mechanism because their post-isel
hook handles moving the function pointer argument and adding the flags
and typeindex arguments itself.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

5 years agoReland "[WebAssembly] Split and recombine multivalue calls for ISel"
Thomas Lively [Thu, 6 Feb 2020 02:17:45 +0000 (18:17 -0800)]
Reland "[WebAssembly] Split and recombine multivalue calls for ISel"

This reverts commit 8acedb595d039f68ad15f9e5f2e6cb79729307e4 and
relands a prerequisite for the patch series culminating in
https://reviews.llvm.org/D74192.

5 years agoReland "[WebAssembly][InstrEmitter] Foundation for multivalue call lowering"
Thomas Lively [Thu, 6 Feb 2020 02:17:11 +0000 (18:17 -0800)]
Reland "[WebAssembly][InstrEmitter] Foundation for multivalue call lowering"

This reverts commit 649aba93a27170cb03a4b17c98a19b9237a880b8, now that
the approach started there has been shown to be workable in the patch
series culminating in https://reviews.llvm.org/D74192.

5 years ago[TestTargetCommand] Remove another reference to a stale rdar.
Davide Italiano [Tue, 18 Feb 2020 21:39:37 +0000 (13:39 -0800)]
[TestTargetCommand] Remove another reference to a stale rdar.

The test passes, and the rdar is closed.

5 years ago[TestTargetCommand] `target var` without a process doesn't work on arm64e.
Davide Italiano [Tue, 18 Feb 2020 21:38:27 +0000 (13:38 -0800)]
[TestTargetCommand] `target var` without a process doesn't work on arm64e.

lldb needs to know about chains of authenticated relocations.

<rdar://problem/37773624>

5 years ago[TestGlobalVariables] Remove a reference to a stale rdar.
Davide Italiano [Tue, 18 Feb 2020 21:31:14 +0000 (13:31 -0800)]
[TestGlobalVariables] Remove a reference to a stale rdar.

The bug has been fixed and the rdar is closed. No need to
clutter the test.

5 years ago[TestGlobalVariables] `target var` without a process doesn't work on arm64e.
Davide Italiano [Tue, 18 Feb 2020 21:30:35 +0000 (13:30 -0800)]
[TestGlobalVariables] `target var` without a process doesn't work on arm64e.

lldb needs to know about chains of authenticated relocations.

<rdar://problem/37773624>

5 years ago[lldb/Plugin] Reject WASM and Hexagon in DynamicLoaderStatic
Jonas Devlieghere [Tue, 18 Feb 2020 20:49:03 +0000 (12:49 -0800)]
[lldb/Plugin] Reject WASM and Hexagon in DynamicLoaderStatic

The WASM and Hexagon plugin check the ArchType rather than the OSType,
so explicitly reject those in the DynamicLoaderStatic.

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

5 years ago[mlir][Linalg] Allow specifiying zero-rank shaped type operands to linalg.generic...
MaheshRavishankar [Tue, 18 Feb 2020 17:50:47 +0000 (09:50 -0800)]
[mlir][Linalg] Allow specifiying zero-rank shaped type operands to linalg.generic ops.

Fixing a bug where using a zero-rank shaped type operand to
linalg.generic ops hit an unrelated assert. This also meant that
lowering the operation to loops was not supported. Adding roundtrip
tests and lowering to loops test for zero-rank shaped type operand
with fixes to make the test pass.

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

5 years ago[mlir] NFC: rename LLVMOpLowering to ConvertToLLVMPattern
Alex Zinenko [Tue, 18 Feb 2020 15:55:52 +0000 (16:55 +0100)]
[mlir] NFC: rename LLVMOpLowering to ConvertToLLVMPattern

This better reflects the nature of the class and matches the current
naming scheme.

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

5 years ago[clang][XCOFF] Indicate that XCOFF does not support COMDATs
David Tenty [Tue, 18 Feb 2020 21:02:43 +0000 (16:02 -0500)]
[clang][XCOFF] Indicate that XCOFF does not support COMDATs

Summary: XCOFF doesn't support COMDATs, so clang shouldn't emit them.

Reviewers: stevewan, sfertile, Xiangling_L

Reviewed By: sfertile

Subscribers: dschuff, aheejin, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

5 years agoRemove "ELF Only" from -f*-sections help text
Reid Kleckner [Tue, 18 Feb 2020 20:59:34 +0000 (12:59 -0800)]
Remove "ELF Only" from -f*-sections help text

-ffunction-sections and -fdata-sections are well supported by many
object file formats:
- ELF
- COFF
- XCOFF
- wasm
Only MachO ignores this flag.

While here, remove it from -funique-section-names. Wasm honors this
option.

Addresses PR44910.

Reviewed By: hans, aaron.ballman

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

5 years agoFix PR#44620 'readability-redundant-string-cstr quick-fix causes invalid code'
Karasev Nikita [Tue, 18 Feb 2020 20:32:03 +0000 (15:32 -0500)]
Fix PR#44620 'readability-redundant-string-cstr quick-fix causes invalid code'

static void f2(std::string&&) {}
static void f() {
std::string const s;
f2(s.c_str()); // readability-redundant-string-cstr previously warning
}

Skips the problematic AST pattern in the matcher.

5 years ago[Hexagon] clang driver should consider --sysroot option
Sid Manning [Tue, 18 Feb 2020 19:35:00 +0000 (13:35 -0600)]
[Hexagon] clang driver should consider --sysroot option

Hexagon's clang driver should consider --sysroot option when setting
up include paths.

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

5 years ago[libc++] Fix overly complicated test of std::span's extent
Louis Dionne [Tue, 18 Feb 2020 20:04:33 +0000 (15:04 -0500)]
[libc++] Fix overly complicated test of std::span's extent

Thanks to Billy O'Neal for the patch.

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

5 years ago[libunwind] Fix memory leak in handling of DW_CFA_remember_state and DW_CFA_restore_state
Jorge Gorbe Moya [Tue, 18 Feb 2020 19:48:02 +0000 (11:48 -0800)]
[libunwind] Fix memory leak in handling of DW_CFA_remember_state and DW_CFA_restore_state

parseInstructions() doesn't always process the whole set of DWARF
instructions for a frame. It will stop once the target PC is reached, or
if malformed instructions are found. So, for example, if we have an
instruction sequence like this:

```
<start>
...
DW_CFA_remember_state
...
DW_CFA_advance_loc past the location we're unwinding at (pcoffset in parseInstructions() main loop)
...
DW_CFA_restore_state
<end>
```

... the saved state will never be freed, even though the
DW_CFA_remember_state opcode has a matching DW_CFA_restore_state later
in the sequence.

This change adds code to free whatever is left on rememberStack after
parsing the CIE and the FDE instructions.

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

5 years agoRevert "Support -fuse-ld=lld for riscv"
serge-sans-paille [Tue, 18 Feb 2020 19:56:02 +0000 (20:56 +0100)]
Revert "Support -fuse-ld=lld for riscv"

This reverts commit dd230142d8a00f5f30c3930a2407000e845dcfbf.

Failures:

http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/4749
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/4752

5 years ago[TargetLowering] Add SimplifyMultipleUseDemandedBits 'all elements' helper wrapper...
Simon Pilgrim [Tue, 18 Feb 2020 16:52:01 +0000 (16:52 +0000)]
[TargetLowering] Add SimplifyMultipleUseDemandedBits 'all elements' helper wrapper. NFC.

5 years agoRevert "[CUDA][HIP][OpenMP] Add lib/Sema/UsedDeclVisitor.h after D70172"
Yaxun (Sam) Liu [Tue, 18 Feb 2020 19:28:45 +0000 (14:28 -0500)]
Revert "[CUDA][HIP][OpenMP] Add lib/Sema/UsedDeclVisitor.h after D70172"

This reverts commit c7fa409bcadaf4ddba1862b2e52349e0ab03d1b4.

5 years agoRevert "[CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese"
Yaxun (Sam) Liu [Tue, 18 Feb 2020 19:23:59 +0000 (14:23 -0500)]
Revert "[CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese"

This reverts commit 1b978ddba05cb15e22b4e75adb5e7362ad861987.

5 years ago[mlir] Add a TypeRange class that functions similar to ValueRange.
River Riddle [Tue, 18 Feb 2020 19:36:53 +0000 (11:36 -0800)]
[mlir] Add a TypeRange class that functions similar to ValueRange.

Summary: This class wraps around the various different ways to construct a range of Type, without forcing the materialization of that range into a contiguous vector.

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

5 years ago[lldb/Plugin] Generate LLDB_PLUGIN_DECLARE with CMake
Jonas Devlieghere [Tue, 18 Feb 2020 19:25:42 +0000 (11:25 -0800)]
[lldb/Plugin] Generate LLDB_PLUGIN_DECLARE with CMake

Generate the LLDB_PLUGIN_DECLARE macros with CMake and a def file. I'm
landing D73067 in pieces so I can bisect what exactly is breaking the
Windows bot.

5 years agoImprove comments after 8404aeb56a73ab24f9b295111de3b37a37f0b841.
Alexandre Ganea [Tue, 18 Feb 2020 19:25:08 +0000 (14:25 -0500)]
Improve comments after 8404aeb56a73ab24f9b295111de3b37a37f0b841.

5 years ago[X86] Add a helper function to pull some repeated code out of combineGatherScatter...
Craig Topper [Tue, 18 Feb 2020 19:10:01 +0000 (11:10 -0800)]
[X86] Add a helper function to pull some repeated code out of combineGatherScatter. NFC

5 years ago[JumpThreading] Skip unconditional PredBB when threading jumps through two basic...
Fangrui Song [Tue, 18 Feb 2020 01:43:09 +0000 (17:43 -0800)]
[JumpThreading] Skip unconditional PredBB when threading jumps through two basic blocks

Fixes https://bugs.llvm.org/show_bug.cgi?id=44922 (caused by 4698bf145d583e26ed438026ef7fde031ef322b1)

ThreadThroughTwoBasicBlocks assumes PredBBBranch is conditional. The following code can segfault.

  AddPHINodeEntriesForMappedBlock(PredBBBranch->getSuccessor(1), PredBB, NewBB,
                                  ValueMapping);

We can also allow unconditional PredBB, but the produced code is not
better.

Reviewed By: kazu

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

5 years ago[gn build] Port c9e93c84f61
LLVM GN Syncbot [Tue, 18 Feb 2020 18:45:25 +0000 (18:45 +0000)]
[gn build] Port c9e93c84f61

5 years agoAdd Query API for llvm.assume holding attributes
Tyker [Tue, 18 Feb 2020 18:06:30 +0000 (19:06 +0100)]
Add Query API for llvm.assume holding attributes

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[NFC] Silence compiler warning [-Wmissing-braces].
Huihui Zhang [Tue, 18 Feb 2020 18:35:36 +0000 (10:35 -0800)]
[NFC] Silence compiler warning [-Wmissing-braces].

5 years ago[AMDGPU] Use generated RegisterPressureSets enum
Stanislav Mekhanoshin [Tue, 18 Feb 2020 01:22:28 +0000 (17:22 -0800)]
[AMDGPU] Use generated RegisterPressureSets enum

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

5 years agoCodeGen: Move undef_tied_input declaration
Matt Arsenault [Tue, 18 Feb 2020 18:01:55 +0000 (13:01 -0500)]
CodeGen: Move undef_tied_input declaration

This doesn't belong in ARM specific code since it's generally
recognized by tablegen.

5 years ago[lldb/Plugin] Unconditionally initialize DynamicLoaderDarwinKernel
Jonas Devlieghere [Tue, 18 Feb 2020 18:29:23 +0000 (10:29 -0800)]
[lldb/Plugin] Unconditionally initialize DynamicLoaderDarwinKernel

Other plugins depend on DynamicLoaderDarwinKernel and which means we
cannot conditionally enable/build this plugin based on the target
platform. This means that it will be past of the list of plugins
initialized once that's autogenerated.

5 years ago[gn build] (manually) port fc69967a4b9
Nico Weber [Tue, 18 Feb 2020 18:29:13 +0000 (13:29 -0500)]
[gn build] (manually) port fc69967a4b9

5 years ago[TBLGEN] Emit register pressure set enum
Stanislav Mekhanoshin [Fri, 14 Feb 2020 21:05:34 +0000 (13:05 -0800)]
[TBLGEN] Emit register pressure set enum

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

5 years ago[scudo][standalone] Shift some data from dynamic to static
Kostya Kortchinsky [Sun, 16 Feb 2020 23:29:46 +0000 (15:29 -0800)]
[scudo][standalone] Shift some data from dynamic to static

Summary:
Most of our larger data is dynamically allocated (via `map`) but it
became an hindrance with regard to init time, for a cost to benefit
ratio that is not great. So change the `TSD`s, `RegionInfo`, `ByteMap`
to be static.

Additionally, for reclaiming, we used mapped & unmapped a buffer each
time, which is costly. It turns out that we can have a static buffer,
and that there isn't much contention on it.

One of the other things changed here, is that we hard set the number
of TSDs on Android to the maximum number, as there could be a
situation where cores are put to sleep and we could miss some.

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

5 years agoRevert "[llvm-exegesis] Improve error reporting in Assembler.cpp"
Miloš Stojanović [Tue, 18 Feb 2020 17:30:50 +0000 (18:30 +0100)]
Revert "[llvm-exegesis] Improve error reporting in Assembler.cpp"

This reverts https://reviews.llvm.org/rG63bb9fee525f
due to buildbot failures:
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/1389

5 years ago[ARM,MVE] Add vbrsrq intrinsics family
Mikhail Maltsev [Tue, 18 Feb 2020 17:31:21 +0000 (17:31 +0000)]
[ARM,MVE] Add vbrsrq intrinsics family

Summary:
This patch adds a new MVE intrinsics family, `vbrsrq`: vector bit
reverse and shift right. The intrinsics are compiled into the VBRSR
instruction. Two new LLVM IR intrinsics were also added: arm.mve.vbrsr
and arm.mve.vbrsr.predicated.

Reviewers: simon_tatham, dmgreen, ostannard, MarkMurrayARM

Reviewed By: simon_tatham

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

5 years ago[SLPVectorizer] Do not assume extracelement idx is a ConstantInt.
Florian Hahn [Tue, 18 Feb 2020 16:23:01 +0000 (17:23 +0100)]
[SLPVectorizer] Do not assume extracelement idx is a ConstantInt.

The index of an ExtractElementInst is not guaranteed to be a
ConstantInt. It can be any integer value. Check explicitly for
ConstantInts.

The new test cases illustrate scenarios where we crash without
this patch. I've also added another test case to check the matching
of extractelement vector ops works.

Reviewers: RKSimon, ABataev, dtemirbulatov, vporpo

Reviewed By: ABataev

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

5 years ago[lldb] [nfc] Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()
Jan Kratochvil [Tue, 18 Feb 2020 17:08:10 +0000 (18:08 +0100)]
[lldb] [nfc] Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()

Reasons are the same as for D74637.

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

5 years ago[VectorUtils] Accept IRBuilderBase; NFC
Nikita Popov [Mon, 17 Feb 2020 20:59:46 +0000 (21:59 +0100)]
[VectorUtils] Accept IRBuilderBase; NFC

5 years ago[SimplifyLibCalls] Accept IRBuilderBase; NFC
Nikita Popov [Mon, 17 Feb 2020 21:23:24 +0000 (22:23 +0100)]
[SimplifyLibCalls] Accept IRBuilderBase; NFC

5 years ago[LoopUtils] Accept IRBuilderBase; NFC
Nikita Popov [Mon, 17 Feb 2020 20:56:28 +0000 (21:56 +0100)]
[LoopUtils] Accept IRBuilderBase; NFC

5 years ago[BuildLibCalls] Accept IRBuilderBase; NFC
Nikita Popov [Mon, 17 Feb 2020 20:52:11 +0000 (21:52 +0100)]
[BuildLibCalls] Accept IRBuilderBase; NFC

Accept IRBuilderBase instead of IRBuilder<>. Remove dependency
on IRBuilder from header.

5 years ago[InstCombine] Fix worklist management when simplifying demanded bits
Nikita Popov [Sat, 11 Jan 2020 15:58:01 +0000 (16:58 +0100)]
[InstCombine] Fix worklist management when simplifying demanded bits

When simplifying demanded bits, we currently only report the
instruction on which SimplifyDemandedBits was called as changed.
However, this is a recursive call, and the actually modified
instruction will usually be further up the chain. Additionally,
all the intermediate instructions should also be revisited,
as additional combines may be possible after the demanded bits
simplification. We fix this by explicitly adding them back to the
worklist.

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

5 years ago[InstCombine] Fix multi-use handling in cttz transform
Nikita Popov [Sun, 16 Feb 2020 10:00:22 +0000 (11:00 +0100)]
[InstCombine] Fix multi-use handling in cttz transform

The select-of-cttz transform can currently duplicate cttz intrinsics
and zext/trunc ops. The cause is that it unnecessarily duplicates
the intrinsic and the zext/trunc when setting the "undef_on_zero"
flag to false. However, it's always legal to set the flag from true
to false, so we can make this replacement even if there are extra users.

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

5 years ago[PowerPC][NFC] Add defines to help creating the SpillSlot arrays.
Sean Fertile [Tue, 18 Feb 2020 16:19:16 +0000 (11:19 -0500)]
[PowerPC][NFC] Add defines to help creating the SpillSlot arrays.

Create preprocessor defines for callee saved floating-point register spill
slots, vector register spill slots, and both 32-bit and 64-bit general
purpose register spill slots. This is an NFC refactor to prepare for
adding ABI compliant callee saves and restores for AIX.

5 years ago[InstCombine] Relax preconditions for ashr+and+icmp fold (PR44754)
Nikita Popov [Sun, 9 Feb 2020 08:57:59 +0000 (09:57 +0100)]
[InstCombine] Relax preconditions for ashr+and+icmp fold (PR44754)

Fix for https://bugs.llvm.org/show_bug.cgi?id=44754. We already have
a fold that converts icmp (and (ashr X, C3), C2), C1 into
icmp (and C2'), C1', but it imposed overly strict requirements on the
transform.

Relax this by checking that both C2 and C1 don't shift out bits
(in a signed sense) when forming the new constants.

Alive proofs (https://rise4fun.com/Alive/PTz0):

    Name: ashr_legal
    Pre: ((C2 << C3) >> C3) == C2 && ((C1 << C3) >> C3) == C1
    %a = ashr i16 %x, C3
    %b = and i16 %a, C2
    %c = icmp i16 %b, C1
    =>
    %d = and i16 %x, C2 << C3
    %c = icmp i16 %d, C1 << C3

    Name: ashr_shiftout_eq
    Pre: ((C2 << C3) >> C3) == C2 && ((C1 << C3) >> C3) != C1
    %a = ashr i16 %x, C3
    %b = and i16 %a, C2
    %c = icmp eq i16 %b, C1
    =>
    %c = false

Note that >> corresponds to ashr here. The case of an equality
comparison has some special handling in this transform, because
it will form to a true/false result if the condition on the comparison
constant it violated.

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