platform/upstream/llvm.git
3 years ago[HWASan] Fix brittle stack-oob.c test.
Matt Morehouse [Mon, 22 Mar 2021 18:07:58 +0000 (11:07 -0700)]
[HWASan] Fix brittle stack-oob.c test.

3 years agoFix obvious breakage of update_analysis_test_checks.py from 1ce846b
Philip Reames [Mon, 22 Mar 2021 18:03:55 +0000 (11:03 -0700)]
Fix obvious breakage of update_analysis_test_checks.py from 1ce846b

3 years agoAutogen some tests for ease of update
Philip Reames [Mon, 22 Mar 2021 17:53:55 +0000 (10:53 -0700)]
Autogen some tests for ease of update

3 years ago[mlir][tosa] Fix tosa.mul to use tosa.apply_scale
Rob Suderman [Sat, 20 Mar 2021 06:04:39 +0000 (23:04 -0700)]
[mlir][tosa] Fix tosa.mul to use tosa.apply_scale

Multiply-shift requires wider compute types or CPU specific code to avoid
premature truncation, apply_shift fixes this issue

Also, Tosa's mul op supports different input / output types. Added path that
sign-extends input values to int-32 values before multiplying.

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

3 years ago[flang] Specific procedures named the same as the generic and a derived type
Peter Steinfeld [Mon, 22 Mar 2021 16:04:45 +0000 (09:04 -0700)]
[flang] Specific procedures named the same as the generic and a derived type

If you specify a specific procedure of a generic interface that has the same
name as both the generic interface and a preceding derived type, the compiler
would fail an internal call to CHECK().  I fixed this by testing for this
situation when processing specific procedures.  I also added a test that will
cause the call to CHECK() to fail without this new code.

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

3 years ago[tests] Refresh a bunch of autogen test to adjust for format changes
Philip Reames [Mon, 22 Mar 2021 17:39:02 +0000 (10:39 -0700)]
[tests] Refresh a bunch of autogen test to adjust for format changes

3 years ago[JITLink][ELF/x86-64] Add support for GOTOFF64 relocation.
Lang Hames [Mon, 22 Mar 2021 16:51:36 +0000 (09:51 -0700)]
[JITLink][ELF/x86-64] Add support for GOTOFF64 relocation.

3 years ago2nd attempt at a speculative fix for windows builders after d4648eea
Philip Reames [Mon, 22 Mar 2021 17:32:46 +0000 (10:32 -0700)]
2nd attempt at a speculative fix for windows builders after d4648eea

3 years ago[LegalizeDAG] Add asserts to verify the types of custom legalized operation matches...
Craig Topper [Mon, 22 Mar 2021 17:18:27 +0000 (10:18 -0700)]
[LegalizeDAG] Add asserts to verify the types of custom legalized operation matches the original node.

We've messed this up a few times recently on RISCV. Experiments
with these asserts found a couple issues on other targets as well.
They've all been cleaned up now so we can put in these asserts to
catch future issues

I had to waive Glue because ADDC/ADDE/etc legalization replaces
Glue with i32 on at least AArch64. X86 used to do the same before
we switched to ADDCARRY. So I guess that's just how that works.

Reviewed By: RKSimon

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

3 years agoSpeculative fix for windows builders after d4648eea
Philip Reames [Mon, 22 Mar 2021 17:21:29 +0000 (10:21 -0700)]
Speculative fix for windows builders after d4648eea

3 years ago[RISCV] Add support for fixed vector masked gather/scatter.
Craig Topper [Mon, 22 Mar 2021 16:54:17 +0000 (09:54 -0700)]
[RISCV] Add support for fixed vector masked gather/scatter.

I've split the gather/scatter custom handler to avoid complicating
it with even more differences between gather/scatter.

Tests are the scalable vector tests with the vscale removed and
dropped the tests that used vector.insert. We're probably not
as thorough on the splitting cases since we use 128 for VLEN here
but scalable vector use a known min size of 64.

Reviewed By: frasercrmck

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

3 years agoRevert "[Driver] Gnu.cpp: drop an unneeded special rule related to sysroot"
Arthur Eubanks [Mon, 22 Mar 2021 17:14:03 +0000 (10:14 -0700)]
Revert "[Driver] Gnu.cpp: drop an unneeded special rule related to sysroot"

This reverts commits 56700e937903969a4a95f68c59e38e35daaaa1ea and c2f9086b6184a132ec8cac7edeb620813796e1e8.

Breaks multiple Android bots, e.g. https://lab.llvm.org/buildbot/#/builders/77/builds/4777.

3 years ago[gn build] Port 5a87f81fe9ae
LLVM GN Syncbot [Mon, 22 Mar 2021 17:10:11 +0000 (17:10 +0000)]
[gn build] Port 5a87f81fe9ae

3 years agonew altera unroll loops check
Frank Derry Wanye [Mon, 22 Mar 2021 17:08:14 +0000 (13:08 -0400)]
new altera unroll loops check

This lint check is a part of the FLOCL (FPGA Linters for OpenCL)
project out of the Synergy Lab at Virginia Tech.

FLOCL is a set of lint checks aimed at FPGA developers who write code
in OpenCL.

The altera unroll loops check finds inner loops that have not been
unrolled, as well as fully-unrolled loops that should be partially
unrolled due to unknown loop bounds or a large number of loop
iterations.

Based on the Altera SDK for OpenCL: Best Practices Guide.

3 years ago[ASTImporter] Fix import of ObjCPropertyDecl that share the same name
Raphael Isemann [Mon, 22 Mar 2021 16:52:43 +0000 (17:52 +0100)]
[ASTImporter] Fix import of ObjCPropertyDecl that share the same name

Objective-C apparently allows name conflicts between instance and class
properties, so this is valid code:

```
@protocol DupProp
@property (class, readonly) int prop;
@property (readonly) int prop;
@end
```

The ASTImporter however isn't aware of this and will consider the two properties
as if they are the same property because it just compares their name and types.
This causes that when importing both properties we only end up with one property
(whatever is imported first from what I can see).

Beside generating a different AST this also leads to a bunch of asserts and
crashes as we still correctly import the two different getters for both
properties (the import code for methods does the correct check where it
differentiated between instance and class methods). As one of the setters will
not have its associated ObjCPropertyDecl imported, any call to
`ObjCMethodDecl::findPropertyDecl` will just lead to an assert or crash.

Fixes rdar://74322659

Reviewed By: shafik, kastiglione

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

3 years ago[libc][NFC] Add an alias named "check-llvmlibc" for "check-libc".
Siva Chandra [Mon, 22 Mar 2021 16:43:31 +0000 (16:43 +0000)]
[libc][NFC] Add an alias named "check-llvmlibc" for "check-libc".

3 years ago[Orc] Fix copy elision warning in RPCUtils
Stefan Gränitz [Fri, 19 Mar 2021 13:46:05 +0000 (14:46 +0100)]
[Orc] Fix copy elision warning in RPCUtils

The `callB()` template function always moved errors on return, because in the majority of cases its return type is an `Expected<T>` and the error must be moved into the implicit ctor.
For the special case of a `void` result, however, the `ResultTraits` class is specialized and the return type is a raw `Error`. Some build bots complain, that in favor of NRVO errors should not be moved in this case.

```
llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h:1513:27:
llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h:1519:27:
llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h:1526:29:
  warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
```

The warning is reasonable from a type-system point of view. For performance it's entirely insignificant.

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

3 years ago[Orc] Make usage of ResourceKeys thread-safe in DebugObjectManagerPlugin
Stefan Gränitz [Thu, 18 Mar 2021 13:08:21 +0000 (14:08 +0100)]
[Orc] Make usage of ResourceKeys thread-safe in DebugObjectManagerPlugin

Don't leak ResourceKeys from MaterializationResponsibility::withResourceKeyDo() in notifyEmitted().
Also make some improvements in the overall implementation.

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

3 years ago[Orc] Fix tracking of pending debug objects in DebugObjectManagerPlugin
Stefan Gränitz [Thu, 18 Mar 2021 12:13:10 +0000 (13:13 +0100)]
[Orc] Fix tracking of pending debug objects in DebugObjectManagerPlugin

There can be multiple MaterializationResponsibilitys in-flight for a single ResourceKey. Hence, pending debug objects must be tracked by MaterializationResponsibility and not by ResourceKey.

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

3 years ago[SCEV] Use trip count information to improve shift recurrence ranges
Philip Reames [Mon, 22 Mar 2021 16:37:39 +0000 (09:37 -0700)]
[SCEV] Use trip count information to improve shift recurrence ranges

This patch exploits the knowledge that we may be running many fewer than bitwidth iterations of the loop, and may be able to disallow the overflow case. This patch specifically implements only the shl case, but this can be generalized to ashr and lshr without difficulty.

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

3 years ago[SLP] Honor min/max regsize and min/max VF in vectorizeStores
Bjorn Pettersson [Mon, 1 Mar 2021 13:44:12 +0000 (14:44 +0100)]
[SLP] Honor min/max regsize and min/max VF in vectorizeStores

Make sure we use PowerOf2Floor instead of PowerOf2Ceil when
calculating max number of elements that fits inside a vector
register (otherwise we could end up creating vectors larger
than the maximum vector register size).

Also make sure we honor the min/max VF (as given by TTI or
cmd line parameters) when doing vectorizeStores.

Reviewed By: anton-afanasyev

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

3 years ago[SLP] Add test case showing shortcoming in honoring max reg size
Bjorn Pettersson [Mon, 1 Mar 2021 12:36:19 +0000 (13:36 +0100)]
[SLP] Add test case showing shortcoming in honoring max reg size

3 years agoClarify comments on recurrence matcher [NFC]
Philip Reames [Mon, 22 Mar 2021 16:21:43 +0000 (09:21 -0700)]
Clarify comments on recurrence matcher [NFC]

Triggered by discussion on D98222.  The case where we have a loop variant step is suprising, and doesn't match the behavior of SCEV's recurrences.  As such, make sure we call that out explicitly.

3 years ago[CSSPGO][llvm-profgen] Use profile summary based threshold for context trimming and...
Wenlei He [Thu, 18 Mar 2021 16:45:07 +0000 (09:45 -0700)]
[CSSPGO][llvm-profgen] Use profile summary based threshold for context trimming and merging

Switch to use cold threshold from profile summary for cold context merging and trimming, instead of relying on hard coded values. Minor refactoring included for switch names, etc.

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

3 years ago[lldb] Re-disable dwarf5-debug_line-file-index.s
Pavel Labath [Mon, 22 Mar 2021 15:28:12 +0000 (16:28 +0100)]
[lldb] Re-disable dwarf5-debug_line-file-index.s

The fix in 10d54e2f did not work.

3 years ago[libc++] Move __libcpp_erase_if_container into <iterator>, and ADL-proof it.
Arthur O'Dwyer [Sun, 21 Mar 2021 20:53:09 +0000 (16:53 -0400)]
[libc++] Move __libcpp_erase_if_container into <iterator>, and ADL-proof it.

The container headers don't need to include <functional> for any other reason
(or at least, they wouldn't if we moved `less` and `equal_to` out of <functional>),
so let's put `__libcpp_erase_if_container` somewhere that's common to the
containers but outside of <functional>.

Also, calling `std::erase_if(c, pred)` should not trigger ADL.

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

3 years ago[HWASan] Disable stack, globals and force callbacks for x86_64.
Matt Morehouse [Mon, 22 Mar 2021 15:01:48 +0000 (08:01 -0700)]
[HWASan] Disable stack, globals and force callbacks for x86_64.

Subsequent patches will implement page-aliasing mode for x86_64, which
will initially only work for the primary heap allocator.  We force
callback instrumentation to simplify the initial aliasing
implementation.

Reviewed By: vitalybuka, eugenis

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

3 years agoAMDGPU: Allow tail calls for amdgpu_gfx functions
Matt Arsenault [Sun, 14 Mar 2021 20:14:03 +0000 (16:14 -0400)]
AMDGPU: Allow tail calls for amdgpu_gfx functions

3 years ago[lldb] Attempt to fix dwarf5-debug_line-file-index.s
Pavel Labath [Mon, 22 Mar 2021 14:27:25 +0000 (15:27 +0100)]
[lldb] Attempt to fix dwarf5-debug_line-file-index.s

The file contained bogus input - the DIE list was not properly
terminated. This should not cause a crash, but it seems it was crashing
at least on linux arm and x86 windows.

3 years ago[PowerPC][NFC] Do not enter prefix selection if it cannot do better.
Stefan Pintilie [Mon, 22 Mar 2021 13:40:17 +0000 (08:40 -0500)]
[PowerPC][NFC] Do not enter prefix selection if it cannot do better.

Do not try to materialize a constant using prefix instructions if the selection
using non prefix instructions was able to do it using a single non prefix
instruction.

Reviewed By: nemanjai, #powerpc

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

3 years ago[lldb] Fix test_exec_root of API tests
Pavel Labath [Mon, 22 Mar 2021 14:13:15 +0000 (15:13 +0100)]
[lldb] Fix test_exec_root of API tests

lit has grown a feature where it stores the runtimes of all tests.
Normally, these times should be stored in the build directory, but
because our API tests have set test_exec_root to point to the source
tree, it has ended up polluting our checkout and led to the
.lit_test_times.txt being committed to the repository.

Delete this file, and adjust the exec root of API tests. I've also
needed to adjust the root of Shell tests, in order to avoid the two
overlapping.

3 years ago[AArch64][SVE] Test more types in sve-fixed-length-subvector.ll
Joe Ellis [Wed, 17 Mar 2021 11:40:12 +0000 (11:40 +0000)]
[AArch64][SVE] Test more types in sve-fixed-length-subvector.ll

Previously only the i32 type was tested. Now, the {i,f}{16,32,64} types
are tested.

The v8{i,f}16 cases lower differently to the other cases, which is worth
defending. The lowering for the other cases is currently identical, but
probably worth having for the better coverage.

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

3 years ago[X86][AVX] Add missing AVX1 PMULDQ combine tests
Simon Pilgrim [Mon, 22 Mar 2021 12:39:16 +0000 (12:39 +0000)]
[X86][AVX] Add missing AVX1 PMULDQ combine tests

Yet another case of update_llc_test_checks.py not reporting when a RUN doesn't have any matching prefixes

3 years ago[RISCV][NFC] Add test of stack slot sizes of large split arguments
Luís Marques [Mon, 22 Mar 2021 13:36:22 +0000 (13:36 +0000)]
[RISCV][NFC] Add test of stack slot sizes of large split arguments

Illustrates bug 49500 <https://bugs.llvm.org/show_bug.cgi?id=49500>.

3 years ago[mlir][Linalg] Fix linalg on tensor fusion
Nicolas Vasilache [Mon, 22 Mar 2021 12:34:45 +0000 (12:34 +0000)]
[mlir][Linalg] Fix linalg on tensor fusion

- Drop unnecessary occurrences of rewriter.eraseOp: dead linalg ops on tensors should be cleaned up by DCE.
- reimplement the part of Linalg on fusion that constructs the body and block arguments: the previous implementation had too much magic. Instead this spells out all cases explicitly and asserts / introduces TODOs for incorrect cases.

As a consequence, we can use the default traversal order for this pattern.

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

3 years ago[clang][ASTImporter] Add import API for 'const Type *' (NFC).
Balázs Kéri [Mon, 22 Mar 2021 10:50:44 +0000 (11:50 +0100)]
[clang][ASTImporter] Add import API for 'const Type *' (NFC).

There was only an `Import` function for `QualType` but not for `Type`.
For correct import of some AST nodes where not `QualType` is used
an import of `Type *` is needed. (It is the case with
`FieldDecl::getCapturedVLAType`.)

Reviewed By: shafik, teemperor, martong

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

3 years ago[libc++] Run ninja with --verbose
Louis Dionne [Fri, 19 Mar 2021 23:26:15 +0000 (16:26 -0700)]
[libc++] Run ninja with --verbose

This makes it easier to see what exact build commands are used.

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

3 years ago[cmake] Disable GCC 9's -Wpessimizing-move
Martin Storsjö [Fri, 19 Mar 2021 11:45:52 +0000 (13:45 +0200)]
[cmake] Disable GCC 9's -Wpessimizing-move

Similar to the existing code for disabling GCC's -Wredudant-move,
also check for the -Wpessimizing-move option and disable it if
possible.

This silences another bunch of noisy warnings when building LLVM
with GCC 9.

As noted for -Wredundant-move, the code can't be fixed to silence the
warnings while retaining support for older compilers.

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

3 years ago[llvm-objcopy][Support] move writeToOutput helper function to Support.
Alexey Lapshin [Thu, 4 Mar 2021 09:51:30 +0000 (12:51 +0300)]
[llvm-objcopy][Support] move writeToOutput helper function to Support.

writeToOutput function is useful when it is necessary to create different kinds
of streams(based on stream name) and when we need to use a temporary file
while writing(which would be renamed into the resulting file in a success case).
This patch moves the writeToStream helper into the Support library.

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

3 years ago[analyzer] Don't include private gtest headers
Dmitri Gribenko [Mon, 22 Mar 2021 12:30:28 +0000 (13:30 +0100)]
[analyzer] Don't include private gtest headers

3 years ago[lit] Do not forget test times for tests that weren't executed
Roman Lebedev [Mon, 22 Mar 2021 12:24:52 +0000 (15:24 +0300)]
[lit] Do not forget test times for tests that weren't executed

Even though we have read the times before,
we intentionally forget about it for performance reasons.
But that means we also forget all the times for the tests
that weren't executed this time. This is mildly inconvenient.

So, when recording the new times, first re-read the old times,
and update times for the tests that were executed,
thus preserving all original times, too.

3 years ago[NFC][lit] Extract 'test time' reading/writing into standalone functions
Roman Lebedev [Mon, 22 Mar 2021 09:05:04 +0000 (12:05 +0300)]
[NFC][lit] Extract 'test time' reading/writing into standalone functions

Simply refactor code into reusable functions,
to allow read_test_times() to be reused later.

3 years ago[NFC][lit] Add a test showing that timing data for tests not executed is lost
Roman Lebedev [Mon, 22 Mar 2021 10:14:29 +0000 (13:14 +0300)]
[NFC][lit] Add a test showing that timing data for tests not executed is lost

I.e. when you first run lit on a directory, and then on a single test,
the timing knowledge about anything else other than that single test
is lost. This isn't right.

3 years ago[NFCI][lit] Unbreak more lit self-tests after D98179
Roman Lebedev [Mon, 22 Mar 2021 11:44:30 +0000 (14:44 +0300)]
[NFCI][lit] Unbreak more lit self-tests after D98179

All of these depend on the order of tests, so if one runs them twice,
the tests within them will naturally be reordered
using the previous run times, which breaks them.

3 years ago[NFC][lit] discovery: find_tests_for_inputs: avoid py warning when no suites found
Roman Lebedev [Mon, 22 Mar 2021 09:26:07 +0000 (12:26 +0300)]
[NFC][lit] discovery: find_tests_for_inputs: avoid py warning when no suites found

If lit was run on a directory that contained no suites,
then naturally suite[0] will not be there,
and that line would cause python warnings.

So just predicate it with a check that it is there in the first place.

3 years ago[ConstraintElimination] Add gep tests without inbounds.
Florian Hahn [Mon, 15 Mar 2021 11:22:50 +0000 (11:22 +0000)]
[ConstraintElimination] Add gep tests without inbounds.

Add a set of interesting test cases for GEPs without inbounds for
upcoming patches.

3 years ago[LLDB] XFAIL dwarf5-debug_line-file-index.s on arm-linux
Muhammad Omair Javaid [Mon, 22 Mar 2021 12:03:48 +0000 (17:03 +0500)]
[LLDB] XFAIL dwarf5-debug_line-file-index.s on arm-linux

Tests dwarf5-debug_line-file-index.s fails on arm-linux-gnueabihf.
Bug # 49678 has been filed against it.

3 years ago[IR] Add vscale_range IR function attribute
Bradley Smith [Wed, 3 Mar 2021 13:53:30 +0000 (13:53 +0000)]
[IR] Add vscale_range IR function attribute

This attribute represents the minimum and maximum values vscale can
take. For now this attribute is not hooked up to anything during
codegen, this will be added in the future when such codegen is
considered stable.

Additionally hook up the -msve-vector-bits=<x> clang option to emit this
attribute.

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

3 years ago[OpenCL] Support template parameters for as_type
Sven van Haastregt [Mon, 22 Mar 2021 11:59:05 +0000 (11:59 +0000)]
[OpenCL] Support template parameters for as_type

Implement the TreeTransform for AsTypeExpr.  Split `BuildAsTypeExpr`
out of `ActOnAsTypeExpr`, such that we can call the Build method from
the TreeTransform.

Fixes PR47979.

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

3 years ago[clangd] Replace usages of dummy with more descriptive words
Kadir Cetinkaya [Mon, 22 Mar 2021 10:18:18 +0000 (11:18 +0100)]
[clangd] Replace usages of dummy with more descriptive words

Dummy is a word with inappropriate associations. This patch updates the
references to it in clangd code base with more precise ones.

The only user-visible change is the default variable name used when extracting a
variable. It will be named as `placeholder` from now on.

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

3 years ago[clang][flang] Moke the definition of `-module-dir` restricted to Flang
Andrzej Warzynski [Sat, 20 Mar 2021 15:26:46 +0000 (15:26 +0000)]
[clang][flang] Moke the definition of `-module-dir` restricted to Flang

`-module-dir` is a Flang specific option and should not be visible in
Clang. This patch adds `FlangOnlyOption` flag to its definition. This
way Clang will know that it should reject it and skip it when generating
output for `clang -help`.

The definition of `-module-dir` is moved next to other Flang options.
As `-J` is an alias for `-module-dir`, it has to be moved as well (the
alias cannot be defined before the original option). As `gfortran` mode
is effectively no longer supported (*), `-J` is claimed as Flang only
option.

This is a follow-up of a post-commit review for
https://reviews.llvm.org/D95448.

* https://reviews.llvm.org/rG6a75496836ea14bcfd2f4b59d35a1cad4ac58cee

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

3 years ago[AArch64] Add some float -> int -> float conversion patterns
Sjoerd Meijer [Fri, 19 Mar 2021 14:16:17 +0000 (14:16 +0000)]
[AArch64] Add some float -> int -> float conversion patterns

This adds some conversion match patterns for which we want to keep the int
values in FP registers using the corresponding NEON instructions (not the FP
instructions) to avoid more costly int <-> fp register transfers.

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

3 years ago[analyzer][solver] Redesign constraint ranges data structure
Valeriy Savchenko [Fri, 24 Jul 2020 11:13:31 +0000 (14:13 +0300)]
[analyzer][solver] Redesign constraint ranges data structure

ImmutableSet doesn't seem like the perfect fit for the RangeSet
data structure.  It is good for saving memory in a persistent
setting, but not for the case when the population of the container
is tiny.  This commit replaces RangeSet implementation and
redesigns the most common operations to be more efficient.

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

3 years ago[llvm-jitlink] Fix Windows build after 4a8161fe40cc
Stefan Gränitz [Mon, 22 Mar 2021 10:41:59 +0000 (11:41 +0100)]
[llvm-jitlink] Fix Windows build after 4a8161fe40cc

3 years ago[ConstraintElimination] Add multi-dimension GEP tests.
Florian Hahn [Mon, 22 Mar 2021 10:09:19 +0000 (10:09 +0000)]
[ConstraintElimination] Add multi-dimension GEP tests.

Add a set of interesting test cases with multi-dimensional GEPs for
upcoming patches.

3 years ago[llvm-jitlink] Add diagnostic output and port executor to getaddrinfo(3) as well
Stefan Gränitz [Mon, 22 Mar 2021 10:17:11 +0000 (11:17 +0100)]
[llvm-jitlink] Add diagnostic output and port executor to getaddrinfo(3) as well

Add diagnostic output for TCP connections on both sides, llvm-jitlink and llvm-jitlink-executor.
Port the executor to use getaddrinfo(3) as well. This makes the code more symmetric and seems to be the recommended way for implementing the server side.

Reviewed By: rzurob

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

3 years ago[llvm-jitlink] Fix use of getaddrinfo(3) when connecting remote executor via TCP...
Stefan Gränitz [Mon, 22 Mar 2021 10:18:49 +0000 (11:18 +0100)]
[llvm-jitlink] Fix use of getaddrinfo(3) when connecting remote executor via TCP socket

Since llvm-jitlink moved from gethostbyname to getaddrinfo in D95477, it seems to no longer connect to llvm-jitlink-executor via TCP. I can reproduce this behavior on both, Debian 10 and macOS 10.15.7:

```
> llvm-jitlink-executor listen=localhost:10819
--
> llvm-jitlink --oop-executor-connect=localhost:10819 /path/to/obj.o
Failed to resolve localhost:10819
```

Reviewed By: rzurob

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

3 years ago[OpenCL] Use -fdeclare-opencl-builtins for some tests
Sven van Haastregt [Mon, 22 Mar 2021 09:46:28 +0000 (09:46 +0000)]
[OpenCL] Use -fdeclare-opencl-builtins for some tests

This speeds up the test running times, as the large `opencl-c.h`
header no longer needs to be parsed.

3 years agoMake clangd CompletionModel usable even with non-standard (but supported) layout
serge-sans-paille [Mon, 22 Mar 2021 09:05:25 +0000 (10:05 +0100)]
Make clangd CompletionModel usable even with non-standard (but supported) layout

llvm supports specifying a non-standard layout where each project lies in its
own place. Do not assume a fixed layout and use the appropriate cmake variable
instead.

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

3 years ago[NFC] Simpler and faster key computation for getSubtargetImpl memoization
serge-sans-paille [Mon, 22 Mar 2021 08:52:39 +0000 (09:52 +0100)]
[NFC] Simpler and faster key computation for getSubtargetImpl memoization

There's no use in computing a large key that's only used for a memoization
optimization.

3 years ago[mlir] Add an option to still use bottom-up traversal
Adrian Kuegel [Mon, 22 Mar 2021 08:42:57 +0000 (09:42 +0100)]
[mlir] Add an option to still use bottom-up traversal

GreedyPatternRewriteDriver was changed from bottom-up traversal to top-down traversal. Not all passes work yet with that change for traversal order. To give some time for fixing, add an option to allow to switch back to bottom-up traversal. Use this option in FusionOfTensorOpsPass which fails otherwise.

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

3 years ago[Driver] -m32: Add /usr/include/i386-linux-gnu for Debian
Fangrui Song [Mon, 22 Mar 2021 08:27:06 +0000 (01:27 -0700)]
[Driver] -m32: Add /usr/include/i386-linux-gnu for Debian

3 years ago[docs] GettingInvolved: split out flang and openmp meeting series
Kristof Beyls [Sat, 20 Mar 2021 08:09:39 +0000 (09:09 +0100)]
[docs] GettingInvolved: split out flang and openmp meeting series

Split out the flang and openmp meeting series, as each has a separate
canonical page where the information is maintained.
As part of that, also call out the alias analysis series separately as
it doesn't seem to be relevant for just flang.

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

3 years ago[ELF][docs] Add line breaks
Yang Fan [Mon, 22 Mar 2021 08:08:47 +0000 (16:08 +0800)]
[ELF][docs] Add line breaks

3 years ago[analyzer][solver] Fix infeasible constraints (PR49642)
Valeriy Savchenko [Fri, 19 Mar 2021 14:00:00 +0000 (17:00 +0300)]
[analyzer][solver] Fix infeasible constraints (PR49642)

Additionally, this patch puts an assertion checking for feasible
constraints in every place where constraints are assigned to states.

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

3 years ago[lldb] Use CompileUnit::ResolveSymbolContext in SymbolFileDWARF
Kim-Anh Tran [Thu, 18 Mar 2021 20:32:39 +0000 (21:32 +0100)]
[lldb] Use CompileUnit::ResolveSymbolContext in SymbolFileDWARF

SymbolFileDWARF::ResolveSymbolContext is currently unaware that in DWARF5 the primary file is specified at file index 0. As a result it misses to correctly resolve the symbol context for the primary file when DWARF5 debug data is used and the primary file is only specified at index 0.

This change makes use of CompileUnit::ResolveSymbolContext to resolve the symbol context. The ResolveSymbolContext in CompileUnit has been previously already updated to reflect changes in DWARF5
and contains a more readable version. It can resolve more, but will also do a bit more work than
SymbolFileDWARF::ResolveSymbolContext (getting the Module, and going through SymbolFileDWARF::ResolveSymbolContextForAddress), however, it's mostly directed by $resolve_scope
what will be resolved, and ensures that code is easier to maintain if there's only one path.

Reviewed By: labath

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

3 years ago[Driver] Gnu.cpp: remove obsoleted i386 triple detection from end-of-life distributio...
Fangrui Song [Mon, 22 Mar 2021 07:23:54 +0000 (00:23 -0700)]
[Driver] Gnu.cpp: remove obsoleted i386 triple detection from end-of-life distribution versions

This saves 16 openat syscalls for `clang a.cc` on x86_64.

3 years ago[clangd] Fix linker error when linking clang-index-server with shared libraries
Nathan Ridge [Mon, 22 Mar 2021 05:30:18 +0000 (01:30 -0400)]
[clangd] Fix linker error when linking clang-index-server with shared libraries

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

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

3 years ago[PowerPC] Enable redundant TOC save removal on AIX
Qiu Chaofan [Mon, 22 Mar 2021 06:29:22 +0000 (14:29 +0800)]
[PowerPC] Enable redundant TOC save removal on AIX

Reviewed By: shchenz

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

3 years ago[Driver] Clean up Debian multiarch /usr/include/<triplet> madness
Fangrui Song [Mon, 22 Mar 2021 05:40:38 +0000 (22:40 -0700)]
[Driver] Clean up Debian multiarch /usr/include/<triplet> madness

Debian multiarch additionally adds /usr/include/<triplet> and somehow
Android borrowed the idea. (Note /usr/<triplet>/include is already an
include dir...). On Debian, we should just assume a GCC installation is
available and use its triple.

3 years agoFix extraneous context parameter in templated helper function.
Stella Laurenzo [Mon, 22 Mar 2021 04:58:17 +0000 (04:58 +0000)]
Fix extraneous context parameter in templated helper function.

(missed in lattner's overall updates related to D99028)

3 years ago[X86] Pass to transform tdpbf16ps intrinsics to scalar operation.
Bing1 Yu [Mon, 22 Mar 2021 01:48:59 +0000 (09:48 +0800)]
[X86] Pass to transform tdpbf16ps intrinsics to scalar operation.

In previous patch https://reviews.llvm.org/D93594, we only scalarize tilezero, tileload, tilestore and tiledpbssd. In this patch we scalarize tdpbf16ps intrinsic.

Reviewed By: pengfei

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

3 years ago[IndVars] Sharpen context in eliminateIVComparison
Max Kazantsev [Mon, 22 Mar 2021 04:07:32 +0000 (11:07 +0700)]
[IndVars] Sharpen context in eliminateIVComparison

When eliminating comparisons, we can use common dominator of
all its users as context. This gives better results when ICMP is not
computed right before the branch that uses it.

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

3 years ago[JITLink][ELF/x86-64] Add support for R_X86_64_GOTPC64 and R_X86_64_GOT64.
Lang Hames [Mon, 22 Mar 2021 02:58:08 +0000 (19:58 -0700)]
[JITLink][ELF/x86-64] Add support for R_X86_64_GOTPC64 and R_X86_64_GOT64.

Start adding support for ELF x86-64 large code model, PIC relocations.

3 years ago[libc] Add a target "install-llvmlibc" to install LLVM libc static archive.
Siva Chandra [Sat, 20 Mar 2021 04:50:48 +0000 (04:50 +0000)]
[libc] Add a target "install-llvmlibc" to install LLVM libc static archive.

3 years ago[JITLink] Start laying the groundwork for ELF x86-64 large code model support.
Lang Hames [Sun, 21 Mar 2021 03:22:40 +0000 (20:22 -0700)]
[JITLink] Start laying the groundwork for ELF x86-64 large code model support.

Introduces DefineExternalSectionStartAndEndSymbols.h, which defines a template
for a JITLink pass that transforms external symbols meeting a user-supplied
predicate into defined symbols pointing at the start and end of a Section
identified by the predicate. JITLink.h is updated with a new makeAbsolute
function to support this pass.

Also renames BasicGOTAndStubsBuilder to PerGraphGOTAndPLTStubsBuilder -- the new
name better describes the intent of this GOT and PLT stubs builder, and will
help to distinguish it from future GOT and PLT stub builders that build entries
that may be shared between multiple graphs.

3 years ago[JITLink][ELF/x86-64] Add Delta32, NegDelta32, NegDelta64 support.
Lang Hames [Mon, 22 Mar 2021 00:20:07 +0000 (17:20 -0700)]
[JITLink][ELF/x86-64] Add Delta32, NegDelta32, NegDelta64 support.

These were missing, but are used in eh-frame section support.

3 years ago[ASTMatcher] Add AST Matcher support for C++20 coroutine keywords
Chuanqi Xu [Mon, 22 Mar 2021 02:25:32 +0000 (10:25 +0800)]
[ASTMatcher] Add AST Matcher support for C++20 coroutine keywords

Summary: Try to enable the support for C++20 coroutine keywords for AST
Matchers.

Reviewers: sammccall, njames93, aaron.ballman

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

3 years ago[X86][AMX] Add test cases for AMX load/store lowering.
Luo, Yuanke [Sun, 21 Mar 2021 02:58:57 +0000 (10:58 +0800)]
[X86][AMX] Add test cases for AMX load/store lowering.

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

3 years ago[Driver] Detect Debian hack g++-multiarch-incdir.diff to simplify addLibStdCXXInclude...
Fangrui Song [Mon, 22 Mar 2021 00:33:30 +0000 (17:33 -0700)]
[Driver] Detect Debian hack g++-multiarch-incdir.diff to simplify addLibStdCXXIncludePaths call sites

3 years ago[test] Add test for cross compiling on Linux
Fangrui Song [Sun, 21 Mar 2021 22:37:35 +0000 (15:37 -0700)]
[test] Add test for cross compiling on Linux

3 years ago[test] Delete obsoleted debian_multiarch_tree and ubuntu_13.04_multiarch_tree
Fangrui Song [Sun, 21 Mar 2021 22:23:49 +0000 (15:23 -0700)]
[test] Delete obsoleted debian_multiarch_tree and ubuntu_13.04_multiarch_tree

They are quite outdated. Delete them to avoid unnecessary test churn.

3 years agoUpdate examples post OwningRewritePatternList change
Jacques Pienaar [Sun, 21 Mar 2021 22:15:34 +0000 (15:15 -0700)]
Update examples post OwningRewritePatternList change

3 years agoRevert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)"
Nico Weber [Sun, 21 Mar 2021 20:35:38 +0000 (16:35 -0400)]
Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)"

This reverts commit c53a1322f329e29446c7625da423f58f09ec1a55.
Test only passes depending on build dir having a lexicographically later name
than the source dir, and doesn't link on mac/win. See
https://reviews.llvm.org/D98559#2640265 onward.

3 years ago[clang][Codegen] EmitBranchOnBoolExpr(): emit prof branch counts even at -O0
Roman Lebedev [Sun, 21 Mar 2021 20:22:41 +0000 (23:22 +0300)]
[clang][Codegen] EmitBranchOnBoolExpr(): emit prof branch counts even at -O0

This restores the original behaviour before i unadvertedly broke it in
e3a470162738871bba982416748ae5f5e3572947 and clang/test/Profile/ caught it.

3 years ago[clang][CodeGen] Lower Likelihood attributes to @llvm.expect intrin instead of branch...
Roman Lebedev [Sun, 21 Mar 2021 19:13:47 +0000 (22:13 +0300)]
[clang][CodeGen] Lower Likelihood attributes to @llvm.expect intrin instead of branch weights

08196e0b2e1f8aaa8a854585335c17ba479114df exposed LowerExpectIntrinsic's
internal implementation detail in the form of
LikelyBranchWeight/UnlikelyBranchWeight options to the outside.

While this isn't incorrect from the results viewpoint,
this is suboptimal from the layering viewpoint,
and causes confusion - should transforms also use those weights,
or should they use something else, D98898?

So go back to status quo by making LikelyBranchWeight/UnlikelyBranchWeight
internal again, and fixing all the code that used it directly,
which currently is only clang codegen, thankfully,
to emit proper @llvm.expect intrinsics instead.

3 years agoRevert "[BranchProbability] move options for 'likely' and 'unlikely'"
Roman Lebedev [Sun, 21 Mar 2021 16:55:21 +0000 (19:55 +0300)]
Revert "[BranchProbability] move options for 'likely' and 'unlikely'"

Upon reviewing D98898 i've come to realization that these are
implementation detail of LowerExpectIntrinsicPass,
and they should not be exposed to outside of it.

This reverts commit ee8b53815ddf6f6f94ade0068903cd5ae843fafa.

3 years ago[Driver] Gnu.cpp: fix libstdc++ search path for multilib
Fangrui Song [Sun, 21 Mar 2021 19:01:44 +0000 (12:01 -0700)]
[Driver] Gnu.cpp: fix libstdc++ search path for multilib

With this change, on Debian x86-64 (with a MULTILIB_OSDIRNAMES local patch
../lib64 -> ../lib; this does not matter because /usr/lib64/crt{1,i,n}.o do not exist),
`clang++ --target=aarch64-linux-gnu a.cc -Wl,--dynamic-linker=/usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 -Wl,-rpath,/usr/aarch64-linux-gnu/lib`
built executable can run under qemu-user. Previously this failed with
`/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../include/c++/10/iostream:38:10: fatal error: 'bits/c++config.h' file not found`

On Arch Linux, due to the MULTILIB_OSDIRNAMES patch and the existence of
/usr/lib64/crt{1,i,n}.o, clang driver may pick
/usr/lib64/crt{1,i,n}.o and cause a linker error. -B can work around the problem.
`clang++ --target=aarch64-linux-gnu -B /usr/aarch64-linux-gnu/lib a.cc -Wl,--dynamic-linker=/usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 -Wl,-rpath,/usr/aarch64-linux-gnu/lib64:/usr/aarch64-linux-gnu/lib`

3 years ago[lld-macho] Implement -dependency_info (partially - more opcodes needed)
Vy Nguyen [Fri, 12 Mar 2021 22:40:37 +0000 (17:40 -0500)]
[lld-macho] Implement -dependency_info (partially - more opcodes needed)

Bug: https://bugs.llvm.org/show_bug.cgi?id=49278
The flag is not well documented, so this implementation is based on observed behaviour.

When specified, `-dependency_info <path>` produced a text file containing information pertaining to the current linkage, such as input files, output file, linker version, etc.

This file's layout is also not documented, but it seems to be a series of null ('\0') terminated strings in the form `<op code><path>`

`<op code>` could be:
   `0x00` : linker version
   `0x10` : input
   `0x11` : files not found(??)
   `0x40` : output

`<path>` : is the file path, except for the linker-version case.

(??) This part is a bit unclear. I think it means all the files the linker attempted to look at, but could not find.

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

3 years ago[DAGCombiner] Minor compile time improvement to (sext_in_reg (sign_extend_vector_inre...
Craig Topper [Sun, 21 Mar 2021 17:44:31 +0000 (10:44 -0700)]
[DAGCombiner] Minor compile time improvement to (sext_in_reg (sign_extend_vector_inreg x)) optimization.

Don't bother calling ComputeNumSignBits if N00Bits < ExtVTBits. No
matter what answer we get back this will be true:
(N00Bits - DAG.ComputeNumSignBits(N00, DemandedSrcElts)) < ExtVTBits)

So we might as well save the computation. This makes the code more
consistent with the similar (sext_in_reg (sext x)) handling above.

3 years ago[ValueTracking] Improve mul handling in isKnownNonEqual()
Nikita Popov [Sun, 21 Mar 2021 17:36:20 +0000 (18:36 +0100)]
[ValueTracking] Improve mul handling in isKnownNonEqual()

X != X * C is true if:
 * C is not 0 or 1
 * X is not 0
 * mul is nsw or nuw

Proof: https://alive2.llvm.org/ce/z/uwF29z

This is motivated by one of the cases in D98422.

3 years ago[ValueTracking] Add more tests for isKnownNonEqual() of mul (NFC)
Nikita Popov [Sun, 21 Mar 2021 17:14:43 +0000 (18:14 +0100)]
[ValueTracking] Add more tests for isKnownNonEqual() of mul (NFC)

This is for the case of (x * C) == x, rather than the
(x * C1) == (x * C2) variant that we already cover.

3 years agoRemove the extraneous MLIRContext argument from populateWithGenerated. NFC.
Chris Lattner [Sun, 21 Mar 2021 17:38:35 +0000 (10:38 -0700)]
Remove the extraneous MLIRContext argument from populateWithGenerated.  NFC.

3 years agoMIR: Fix missing serialization for HasTailCall
Matt Arsenault [Sun, 21 Mar 2021 16:00:55 +0000 (12:00 -0400)]
MIR: Fix missing serialization for HasTailCall

3 years agoAMDGPU: Fix allowing immediates for tail call pseudo.
Matt Arsenault [Sun, 14 Mar 2021 20:59:34 +0000 (16:59 -0400)]
AMDGPU: Fix allowing immediates for tail call pseudo.

The pseudo was using SSrc_b64, so it allowed folding immediates into
the destination operand for a tail call to null. However, this is not
a valid operand for the s_setpc_b64 this will be lowered to. Avoids
printing the operand as an invalid immediate.

Avoids a regression when tail calls are enabled in GlobalISel (somehow
tail calls to null get deleted in the DAG).

3 years ago[ShapeDialect] Silence a build warning, NFC
Chris Lattner [Sun, 21 Mar 2021 17:10:38 +0000 (10:10 -0700)]
[ShapeDialect] Silence a build warning, NFC

mlir/lib/Dialect/Shape/IR/Shape.cpp:573:26: warning: loop variable 'shape' is always a copy because the range of type '::mlir::Operation::operand_range' (aka 'mlir::OperandRange') does not return a reference [-Wrange-loop-analysis]
        for (const auto &shape : shapes()) {
                         ^

3 years agoChange OwningRewritePatternList to carry an MLIRContext with it.
Chris Lattner [Sat, 20 Mar 2021 23:29:41 +0000 (16:29 -0700)]
Change OwningRewritePatternList to carry an MLIRContext with it.

This updates the codebase to pass the context when creating an instance of
OwningRewritePatternList, and starts removing extraneous MLIRContext
parameters.  There are many many more to be removed.

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

3 years agoReapply [ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()
Nikita Popov [Sat, 6 Mar 2021 11:14:48 +0000 (12:14 +0100)]
Reapply [ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()

There seems to be an impedance mismatch between what the type
system considers an aggregate (structs and arrays) and what
constants consider an aggregate (structs, arrays and vectors).

Adjust the type check to consider vectors as well. The previous
version of the patch dropped the type check entirely, but it
turns out that getAggregateElement() does require the constant
to be an aggregate in some edge cases: For Poison/Undef the
getNumElements() API is called, without checking in advance that
we're dealing with an aggregate. Possibly the implementation should
avoid doing that, but for now I'm adding an assert so the next
person doesn't fall into this trap.

3 years ago[InstSimplify] Add load of undef aggregate test (NFC)
Nikita Popov [Sun, 21 Mar 2021 16:40:17 +0000 (17:40 +0100)]
[InstSimplify] Add load of undef aggregate test (NFC)

To make sure this doesn't crash the following commit.

3 years ago[InstSimplify] Regenerate test checks (NFC)
Nikita Popov [Sun, 21 Mar 2021 16:32:14 +0000 (17:32 +0100)]
[InstSimplify] Regenerate test checks (NFC)