platform/upstream/llvm.git
3 years ago[flang][msvc] Disambiguate injected class name.
Michael Kruse [Sat, 22 Aug 2020 17:05:17 +0000 (12:05 -0500)]
[flang][msvc] Disambiguate injected class name.

The identifier `Expr` within the scope of the Expr class (including its temple specializations) refers to the current template/instantiation (see https://en.cppreference.com/w/cpp/language/injected-class-name for details). The `MapTemplate` template expect a non-instantiated template as the first template argument, not the concrete instantiation of `Expr`.

At least msvc interprets `Expr` as the injected class name, whereas gcc and clang use the global `flang::evaluate::Expr` template. Disambiguate by explicitly using the namespace.

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

Reviewed By: DavidTruby

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

3 years ago[flang] Fix assert on bad character kind
Tim Keith [Sat, 22 Aug 2020 17:11:36 +0000 (10:11 -0700)]
[flang] Fix assert on bad character kind

When we report an error for a bad character kind, don't keep it in the
`DeclTypeSpec`. Otherwise there could be further problems. In this case,
`ComputeOffsets()` got an assertion error because we didn't recognize
`CHARACTER(*,8)` as needing a descriptor because of the bad kind.

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

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

3 years ago[lldb] Extract reproducer providers & co into their own header.
Jonas Devlieghere [Sat, 22 Aug 2020 07:36:32 +0000 (00:36 -0700)]
[lldb] Extract reproducer providers & co into their own header.

Extract all the provider related logic from Reproducer.h and move it
into its own header ReproducerProvider.h. These classes are seeing most
of the development these days and this reorganization reduces
incremental compilation from ~520 to ~110 files when making changes to
the new header.

3 years ago[Polly] Ensure consistent Scop::InstStmtMap. NFC.
Michael Kruse [Sat, 22 Aug 2020 15:14:20 +0000 (10:14 -0500)]
[Polly] Ensure consistent Scop::InstStmtMap. NFC.

InstStmtMap became inconsistent with ScopStmt::getInstructions() after
the statement's instructions is modified, e.g. by being considered
unused by the Simplify pass or being moved by ForwardOpTree.

Change ScopStmt::setInstructions() to also update its parent's
InstStmtMap. Also add assertions checking the consistency.

3 years ago[Polly] Fix use-after-free.
Michael Kruse [Sat, 22 Aug 2020 14:47:10 +0000 (09:47 -0500)]
[Polly] Fix use-after-free.

VirtualUse of type UseKind::Inter expects the definition of a
llvm::Value to be represented in another statement. In the bug report
that statement has been removed due to its domain being empty.
Scop::InstStmtMap for the llvm::Value's defintion still pointed to the
removed statement, which resulted in the use-after-free.

The defintion statement was removed by Simplify because it was
considered to not be reachable by other uses; trivially because it is
never executed due to its empty domain. However, no such thing happend
to the using statement using the value altough its domain is also empty.

Fix by always removing statements with empty domains in Simplify since
these are not properly analyzable. A UseKind::Inter should always have a
statement with its defintion due to LLVM's SSA form.
Scop::removeStmtNotInDomainMap() also removes statements with empty
domains but does so without considering the context as used by
Simplify's analyzes.

In another angle, InstStmtMap pointing to removed statements should not
happen either and ForwardOpTree would have bailed out if the llvm::Value
definition was not represented by a statement. This will be corrected in
a followup-commit.

This fixes llvm.org/PR47098

3 years agoGlobalISel: Merge FewerElements for G_BUILD_VECTOR/G_CONCAT_VECTORS
Matt Arsenault [Mon, 3 Aug 2020 22:37:29 +0000 (18:37 -0400)]
GlobalISel: Merge FewerElements for G_BUILD_VECTOR/G_CONCAT_VECTORS

This switches from using G_EXTRACT in odd cases to widen with undef
and unmerge.

3 years ago[X86] ia32intrin.h - pull out common attributes used in cast helpers into define...
Simon Pilgrim [Sat, 22 Aug 2020 14:09:44 +0000 (15:09 +0100)]
[X86] ia32intrin.h - pull out common attributes used in cast helpers into define. NFCI.

3 years agoFix some builds after 20bb9fe565a
Jeremy Morse [Sat, 22 Aug 2020 14:18:52 +0000 (15:18 +0100)]
Fix some builds after 20bb9fe565a

-Wsuggest-override indicates this VarLocBasedLDV method needs the
override keyword.

3 years ago[gn build] Port 20bb9fe565a
LLVM GN Syncbot [Sat, 22 Aug 2020 13:52:08 +0000 (13:52 +0000)]
[gn build] Port 20bb9fe565a

3 years ago[LiveDebugValues] Install an implementation-picking LiveDebugValues pass
Jeremy Morse [Sat, 22 Aug 2020 13:10:16 +0000 (14:10 +0100)]
[LiveDebugValues] Install an implementation-picking LiveDebugValues pass

This patch renames the current LiveDebugValues class to "VarLocBasedLDV"
and removes the pass-registration code from it. It creates a separate
LiveDebugValues class that deals with pass registration and management,
that calls through to VarLocBasedLDV::ExtendRanges when
runOnMachineFunction is called. This is done through the "LDVImpl"
abstract class, so that a future patch can install the new
instruction-referencing LiveDebugValues implementation and have it
picked at runtime.

No functional change is intended, just shuffling responsibilities.

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

3 years agoEnable constexpr on BITREVERSE builtin intrinsics (PR47249)
Simon Pilgrim [Sat, 22 Aug 2020 13:41:40 +0000 (14:41 +0100)]
Enable constexpr on BITREVERSE builtin intrinsics (PR47249)

This enables us to use the __builtin_bitreverse 8/16/32/64 intrinsics inside constexpr code.

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

3 years agoEnable constexpr on ROTATELEFT/ROTATERIGHT builtin intrinsics (PR47249)
Simon Pilgrim [Sat, 22 Aug 2020 13:34:08 +0000 (14:34 +0100)]
Enable constexpr on ROTATELEFT/ROTATERIGHT builtin intrinsics (PR47249)

This enables us to use the __builtin_rotateleft / __builtin_rotateright 8/16/32/64 intrinsics inside constexpr code.

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

3 years ago[InstCombine] canonicalize 'not' ops before logical shifts
Sanjay Patel [Sat, 22 Aug 2020 13:38:13 +0000 (09:38 -0400)]
[InstCombine] canonicalize 'not' ops before logical shifts

This reverses the existing transform that would uniformly canonicalize any 'xor' after any shift. In the case of logical shifts, that turns a 'not' into an arbitrary 'xor' with constant, and that's probably not as good for analysis, SCEV, or codegen.

The SCEV motivating case is discussed in:
http://bugs.llvm.org/PR47136

There's an analysis motivating case at:
http://bugs.llvm.org/PR38781

I did draft a patch that would do the same for 'ashr' but that's questionable because it's just swapping the position of a 'not' and uncovers at least 2 missing folds that we would probably need to deal with as preliminary steps.

Alive proofs:
https://rise4fun.com/Alive/BBV

  Name: shift right of 'not'
  Pre: C2 == (-1 u>> C1)
  %a = lshr i8 %x, C1
  %r = xor i8 %a, C2
  =>
  %n = xor i8 %x, -1
  %r = lshr i8 %n, C1

  Name: shift left of 'not'
  Pre: C2 == (-1 << C1)
  %a = shl i8 %x, C1
  %r = xor i8 %a, C2
  =>
  %n = xor i8 %x, -1
  %r = shl i8 %n, C1

  Name: ashr of 'not'
  %a = ashr i8 %x, C1
  %r = xor i8 %a, -1
  =>
  %n = xor i8 %x, -1
  %r = ashr i8 %n, C1

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

3 years ago[DAGCombiner] clean up merge of truncated stores; NFC
Sanjay Patel [Fri, 21 Aug 2020 21:30:57 +0000 (17:30 -0400)]
[DAGCombiner] clean up merge of truncated stores; NFC

This code handles the special-case of i8 stores,
but it could be generalized to deal with other types.

3 years ago[docs] Replace "constexpr expressions" with "constant expressions".
Simon Pilgrim [Sat, 22 Aug 2020 13:12:05 +0000 (14:12 +0100)]
[docs] Replace "constexpr expressions" with "constant expressions".

Based off comment from @rsmith on D86339

3 years ago[clang-tidy] readability-simplify-boolean-expr detects negated literals
Nathan James [Sat, 22 Aug 2020 12:57:34 +0000 (13:57 +0100)]
[clang-tidy] readability-simplify-boolean-expr detects negated literals

Adds support for detecting cases like `if (!true) ...`.
Addresses [[ https://bugs.llvm.org/show_bug.cgi?id=47166 | readability-simplify-boolean-expr not detected for negated boolean literals. ]]

Reviewed By: aaron.ballman

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

3 years ago[gn build] Port fba06e3c85a
LLVM GN Syncbot [Sat, 22 Aug 2020 12:40:06 +0000 (12:40 +0000)]
[gn build] Port fba06e3c85a

3 years ago[LiveDebugValues][NFC] Move LiveDebugValues source for refactor
Jeremy Morse [Sat, 22 Aug 2020 11:53:49 +0000 (12:53 +0100)]
[LiveDebugValues][NFC] Move LiveDebugValues source for refactor

This is a pure file move of LiveDebugValues.cpp ahead of the pass being
refactored, with an experimental new implementation to follow.

The motivation for these changes can be found here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-June/142368.html

And the other related changes can be found in the phabricator stack for
this revision:

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

3 years agoInstantiate Error in Target::GetEntryPointAddress() only when necessary
Dimitry Andric [Fri, 21 Aug 2020 19:03:00 +0000 (21:03 +0200)]
Instantiate Error in Target::GetEntryPointAddress() only when necessary

When `Target::GetEntryPointAddress()` calls `exe_module->GetObjectFile()->GetEntryPointAddress()`, and the returned
`entry_addr` is valid, it can immediately be returned.

However, just before that, an `llvm::Error` value has been setup, but in this case it is not consumed before returning, like is done further below in the function.

In https://bugs.freebsd.org/248745 we got a bug report for this, where a very simple test case aborts and dumps core:

```
* thread #1, name = 'testcase', stop reason = breakpoint 1.1
    frame #0: 0x00000000002018d4 testcase`main(argc=1, argv=0x00007fffffffea18) at testcase.c:3:5
   1 int main(int argc, char *argv[])
   2 {
-> 3     return 0;
   4 }
(lldb) p argc
Program aborted due to an unhandled Error:
Error value was Success. (Note: Success values must still be checked prior to being destroyed).

Thread 1 received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:3
3 thr_kill.S: No such file or directory.
(gdb) bt
#0  thr_kill () at thr_kill.S:3
#1  0x00000008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x000000000451b5f5 in fatalUncheckedError () at /usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112
#4  0x00000000019cf008 in GetEntryPointAddress () at /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267
#5  0x0000000001bccbd8 in ConstructorSetup () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67
#6  0x0000000001bcd2c0 in ThreadPlanCallFunction () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114
#7  0x00000000020076d4 in InferiorCallMmap () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97
#8  0x0000000001f4be33 in DoAllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604
#9  0x0000000001fe51b9 in AllocatePage () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347
#10 0x0000000001fe5385 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383
#11 0x0000000001974da2 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301
#12 CanJIT () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331
#13 0x0000000001a1bf3d in Evaluate () at /usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190
#14 0x00000000019ce7a2 in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372
#15 0x0000000001ad784c in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414
#16 0x0000000001ad86ae in DoExecute () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646
#17 0x0000000001a5e3ed in Execute () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003
#18 0x0000000001a6c4a3 in HandleCommand () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762
#19 0x0000000001a6f98c in IOHandlerInputComplete () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760
#20 0x0000000001a90b08 in Run () at /usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548
#21 0x00000000019a6c6a in ExecuteIOHandlers () at /usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903
#22 0x0000000001a70337 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946
#23 0x0000000001d9d812 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169
#24 0x0000000001918be8 in MainLoop () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675
#25 0x000000000191a114 in main () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890```

Fix the incorrect error catch by only instantiating an `Error` object if it is necessary.

Reviewed By: JDevlieghere

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

3 years ago[DSE,MemorySSA] Use BatchAA for AA queries.
Florian Hahn [Sat, 22 Aug 2020 07:36:35 +0000 (08:36 +0100)]
[DSE,MemorySSA] Use BatchAA for AA queries.

We can use BatchAA to avoid some repeated AA queries. We only remove
stores, so I think we will get away with using a single BatchAA instance
for the complete run.

The changes in AliasAnalysis.h mirror the changes in D85583.

The change improves compile-time by roughly 1%.
http://llvm-compile-time-tracker.com/compare.php?from=67ad786353dfcc7633c65de11601d7823746378e&to=10529e5b43809808e8c198f88fffd8f756554e45&stat=instructions

This is part of the patches to bring down compile-time to the level
referenced in
http://lists.llvm.org/pipermail/llvm-dev/2020-August/144417.html

Reviewed By: asbirlea

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

3 years ago[MLIR][SPIRVToLLVM] Updated the documentation for the conversion
George Mitenkov [Sat, 22 Aug 2020 07:03:27 +0000 (10:03 +0300)]
[MLIR][SPIRVToLLVM] Updated the documentation for the conversion

This patch updates the SPIR-V to LLVM conversion manual.
Particularly, the following sections are added:
- `spv.EntryPoint`/`spv.ExecutionMode` handling
- Mapping for `spv.AccessChain`
- Change in allowed storage classes for `spv.globalVariable`
- Change of the runner section name

Reviewed By: mravishankar

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

3 years ago[DebugInfo][test] Move distringtype.ll to X86/ subdir to fix failures when X86 target...
Fangrui Song [Sat, 22 Aug 2020 06:14:35 +0000 (23:14 -0700)]
[DebugInfo][test] Move distringtype.ll to X86/ subdir to fix failures when X86 target is not built

3 years ago[MLIR][NFC] Update MLIR vim syntax file - std ops + types
Uday Bondhugula [Fri, 21 Aug 2020 20:07:36 +0000 (01:37 +0530)]
[MLIR][NFC] Update MLIR vim syntax file - std ops + types

Update vim syntax file to include more std ops, and for int types.

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

3 years agoFix arm bot failure after f91d18eaa946b2
Sourabh Singh Tomar [Sat, 22 Aug 2020 05:31:42 +0000 (11:01 +0530)]
Fix arm bot failure after f91d18eaa946b2

llc doesn't seem to automatically pick default `--triple`.
using `%llc_dwarf` should fix this.

Builder:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/20310

Error log:
bin/llc: error: : error: unable to get target for 'x86_64-unknown-linux-gnu', see --version and --triple.

3 years ago[DebugInfo][flang]Added support for representing Fortran assumed length strings
Sourabh Singh Tomar [Thu, 20 Aug 2020 10:41:22 +0000 (16:11 +0530)]
[DebugInfo][flang]Added support for representing Fortran assumed length strings

This patch adds support for representing Fortran `character(n)`.

Primarily patch is based out of D54114 with appropriate modifications.

Test case IR is generated using our downstream classic-flang. We're in process
of upstreaming flang PR's but classic-flang has dependencies on llvm, so
this has to get in first.

Patch includes functional test case for both IR and corresponding
dwarf, furthermore it has been manually tested as well using GDB.

Source snippet:
```
 program assumedLength
   call sub('Hello')
   call sub('Goodbye')
   contains
   subroutine sub(string)
           implicit none
           character(len=*), intent(in) :: string
           print *, string
   end subroutine sub
 end program assumedLength
```

GDB:
```
(gdb) ptype string
type = character (5)
(gdb) p string
$1 = 'Hello'
```

Reviewed By: aprantl, schweitz

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

3 years ago[lldb] Don't pass --rerun-all-issues on Windows.
Jonas Devlieghere [Sat, 22 Aug 2020 02:57:50 +0000 (19:57 -0700)]
[lldb] Don't pass --rerun-all-issues on Windows.

The functionality has been removed for a while and now the dotest
argument has been removed asll.

3 years agoFix llvm/test/tools/lto/hide-linkonce-odr.ll
Azharuddin Mohammed [Fri, 21 Aug 2020 23:13:10 +0000 (16:13 -0700)]
Fix llvm/test/tools/lto/hide-linkonce-odr.ll

Remove unnecessary dependency on libSystem.

3 years agolld: link libatomic if needed for Timer
Josh Stone [Mon, 17 Aug 2020 22:31:32 +0000 (15:31 -0700)]
lld: link libatomic if needed for Timer

D80298 made Timer::total atomic, but this requires linking libatomic
on some targets.

Reviewed By: aaronpuchert

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

3 years ago[DomTree] Extend update API to allow a post CFG view.
Alina Sbirlea [Wed, 26 Feb 2020 21:33:02 +0000 (13:33 -0800)]
[DomTree] Extend update API to allow a post CFG view.

Extend the `applyUpdates` in DominatorTree to allow a post CFG view,
different from the current CFG.
This patch implements the functionality of updating an already up to
date DT, to the desired PostCFGView.
Combining a set of updates towards an up to date DT and a PostCFGView is
not yet supported.

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

3 years ago[Attributor][test] Add REQUIRES: asserts after D86129
Fangrui Song [Fri, 21 Aug 2020 23:20:41 +0000 (16:20 -0700)]
[Attributor][test] Add REQUIRES: asserts after D86129

3 years agoFix swig scripts install target name
António Afonso [Wed, 19 Aug 2020 18:21:10 +0000 (11:21 -0700)]
Fix swig scripts install target name

LLVM install component targets needs to be in the form of: install-{target}[-stripped]

I tested with:
```
cmake ... -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_DISTRIBUTION_COMPONENTS="lldb;liblldb;lldb-python-scripts;" ...
DESTDIR=... ninja install-distribution
```

@JDevlieghere `finish_swig_python_scripts` is a really weird name for a distribution component, any reason that it has to be this way?

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

3 years agoReplace TableGen range piece punctuator with '...'
Paul C. Anagnostopoulos [Fri, 21 Aug 2020 21:22:06 +0000 (23:22 +0200)]
Replace TableGen range piece punctuator with '...'

The TableGen range piece punctuator is currently '-' (e.g., {0-9}),
which interacts oddly with the fact that an integer literal's sign
is part of the literal. This patch replaces the '-' with the new
punctuator '...'. The '-' punctuator is deprecated.

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

Change-Id: I3d53d14e23f878b142d8f84590dd465a0fb6c09c

3 years agoTemporairly revert "[SimplifyCFG][LoopRotate] SimplifyCFG: disable common instruction...
Roman Lebedev [Fri, 21 Aug 2020 21:24:13 +0000 (00:24 +0300)]
Temporairly revert "[SimplifyCFG][LoopRotate] SimplifyCFG: disable common instruction hoisting by default, enable late in pipeline"

As disscussed in post-commit review starting with
https://reviews.llvm.org/D84108#2227365
while this appears to be mostly a win overall, especially code-size-wise,
this appears to shake //certain// code pattens in a way that is extremely
unfavorable for performance (+30% runtime regression)
on certain CPU's (i personally can't reproduce).

So until the behaviour is better understood, and a path forward is mapped,
let's back this out for now.

This reverts commit 1d51dc38d89bd33fb8874e242ab87b265b4dec1c.

3 years ago[NFC][documentation] clarify comment in test
Christopher Tetreault [Fri, 21 Aug 2020 20:47:56 +0000 (13:47 -0700)]
[NFC][documentation] clarify comment in test

test referenced a relative path to a file, but the path was not correct
relative to the project the test is in

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

3 years ago[lldb] Remove --rerun-all-issues as its functionality no longer exists
Jonas Devlieghere [Fri, 21 Aug 2020 21:16:55 +0000 (14:16 -0700)]
[lldb] Remove --rerun-all-issues as its functionality no longer exists

The logic behind --rerun-all-issues was removed when we switched to LIT
as the test driver. This patch just removes the dotest option and
corresponding entry in configuration.py.

3 years agoFix two bugs in TGParser::ParseValue
Nicolai Hähnle [Fri, 21 Aug 2020 21:19:36 +0000 (23:19 +0200)]
Fix two bugs in TGParser::ParseValue

TGParser::ParseValue contains two recursive calls, one to parse the RHS of a list paste operator and one to parse the RHS of a paste operator in a class/def name. Both of these calls neglect to check the return value to see if it is null (because of some error). This causes a crash in the next line of code, which uses the return value. The code now checks for null returns.

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

3 years agoNew TableGen Programmer's Reference document
Paul C. Anagnostopoulos [Fri, 21 Aug 2020 21:07:30 +0000 (23:07 +0200)]
New TableGen Programmer's Reference document

This new TableGen Programmer's Reference document replaces the current Language Introduction and Language Reference documents. It brings all the TableGen reference information into one document.

As an experiment, I numbered the sections in the document. See what you think about that.

Reviewed By: lattner

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

(changes by Nicolai Hähnle <nicolai.haehnle@amd.com>:
- fixed build error due to toctree in docs/LangRef/index.rst
- fixed reference to ProgRef)

Change-Id: Ifbdfa39768b8a460aae2873103d31c7b347aff00

3 years ago[opt][NewPM] Add basic-aa in legacy PM compatibility mode
Arthur Eubanks [Tue, 18 Aug 2020 19:34:19 +0000 (12:34 -0700)]
[opt][NewPM] Add basic-aa in legacy PM compatibility mode

The legacy PM alias analysis pipeline by default includes basic-aa.
When running `opt -foo-pass` under the NPM and -disable-basic-aa is not
specified, use basic-aa.

This decreases the number of check-llvm failures under NPM from 913 to 752.

Reviewed By: ychen, asbirlea

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

3 years agoMachineSSAUpdater: Allow initialization with just a register class
Nicolai Hähnle [Mon, 18 May 2020 14:28:34 +0000 (16:28 +0200)]
MachineSSAUpdater: Allow initialization with just a register class

The register class is required for inserting PHIs, but the "current
virtual register" isn't actually used for anything, so let's remove it
while we're at it.

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

Change-Id: I1e647f31570ef21a7ea8e20db3454178e98a6a8b

3 years ago[Attributor] Function seed allow list
kuterd [Fri, 21 Aug 2020 17:46:27 +0000 (20:46 +0300)]
[Attributor] Function seed allow list

  -  Adds a command line option to seed only selected functions.
  - Makes seed allow listing exclusive to assertions enabled builds.

Reviewed By: sstefan1

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

3 years ago[DomTree] Avoid creating an empty GD to reduce compile time.
Alina Sbirlea [Fri, 21 Aug 2020 20:24:25 +0000 (13:24 -0700)]
[DomTree] Avoid creating an empty GD to reduce compile time.

3 years ago[lldb] Fix build error in TestSimulatorPlatform.py
Jonas Devlieghere [Fri, 21 Aug 2020 20:33:51 +0000 (13:33 -0700)]
[lldb] Fix build error in TestSimulatorPlatform.py

Before e5d08fcbac72 the Makefile would always compute the min-version,
even if it wasn't set in the triple. This nuance got lost when passing
the ARCH_CFLAGS directly from TestSimulatorPlatform.

3 years ago[Attributor] fix AANoUndef initialization
Shinji Okumura [Fri, 21 Aug 2020 20:06:14 +0000 (05:06 +0900)]
[Attributor] fix AANoUndef initialization

Currently, `AANoUndefImpl::initialize` mistakenly always indicates optimistic fixpoint for function returned position.
 This is because an associated value is `Function` in the case, and `isGuaranteedNotToBeUndefOrPoison` returns true for Function.

Reviewed By: jdoerfert

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

3 years ago[Cloning] Fix to cloning DISubprograms.
Amy Huang [Fri, 21 Aug 2020 18:54:27 +0000 (11:54 -0700)]
[Cloning] Fix to cloning DISubprograms.

When trying to enable -debug-info-kind=constructor there was an assert
that occurs during debug info cloning ("mismatched subprogram between
llvm.dbg.value variable and !dbg attachment").
It appears that during llvm::CloneFunctionInto, a DISubprogram could be
duplicated when MapMetadata is called, and then added to the MD map again
when DIFinder gets a list of subprograms. This results in two different
versions of the DISubprogram.

This patch switches the order so that the DIFinder subprograms are
added before MapMetadata is called.

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

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

3 years ago[docs] Move the label for __builtin_shufflevector below __builtin_dump_struct so...
Craig Topper [Fri, 21 Aug 2020 18:50:49 +0000 (11:50 -0700)]
[docs] Move the label for __builtin_shufflevector below __builtin_dump_struct so the see also link in 'vector operations' will go to the right place and have the right name.

3 years ago[AMDGPU] Avoid sorting stalls in regbank-reassign
Stanislav Mekhanoshin [Thu, 20 Aug 2020 23:22:59 +0000 (16:22 -0700)]
[AMDGPU] Avoid sorting stalls in regbank-reassign

This is the slowest operation in the already slow pass.
Instead of sorting just put a stall list into an ordered
map.

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

3 years agoRe-land 7a527f17776be78ec44b88e82b39afb65fc148e4 with fixes.
Vaibhav Garg [Fri, 21 Aug 2020 18:40:09 +0000 (14:40 -0400)]
Re-land 7a527f17776be78ec44b88e82b39afb65fc148e4 with fixes.

The original commit was reverted in 58c305f466d1f78adb10e7295b9bc9fc192a6e09
due to broken bots. This commit corrects the triple and command line paths.

3 years ago[InstCombine] Remove unused entries in gc-live bundle of statepoint
Serguei Katkov [Fri, 14 Aug 2020 05:00:09 +0000 (12:00 +0700)]
[InstCombine] Remove unused entries in gc-live bundle of statepoint

If some of gc live value are not used in gc.relocate we can remove them
from gc-live bundle of statepoint instruction.

Also the CL removes duplicated Values in gc-live bundle.

Reviewers: reames, dantrushin
Reviewed By: dantrushin
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D85959

3 years ago[llvm-mca][NFC] Refactor views to separate data collection from printing.
Wolfgang Pieb [Wed, 19 Aug 2020 18:53:39 +0000 (11:53 -0700)]
[llvm-mca][NFC] Refactor views to separate data collection from printing.

    Reviewed By: andreadb, lebedev.ri

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

3 years agoPrintStackTrace: don't symbolize if LLVM_DISABLE_SYMBOLIZATION is set
Fangrui Song [Thu, 20 Aug 2020 15:14:10 +0000 (08:14 -0700)]
PrintStackTrace: don't symbolize if LLVM_DISABLE_SYMBOLIZATION is set

See http://lists.llvm.org/pipermail/llvm-dev/2017-June/113975.html for a related previous discussion.
Many tools install signal handlers to print stack traces and optionally
symbolize the addresses with an external program 'llvm-symbolizer' (when
searching for 'llvm-symbolizer', the directory containg the executable
is preferred over PATH).

'llvm-symbolizer' can be slow if the executable is large and/or if
llvm-symbolizer' itself is under-optimized. For example, my 'llvm-lto2' from a
-DCMAKE_BUILD_TYPE=Debug build is 443MiB. The 'llvm-symbolizer' from the same
build takes ~2s to symbolize it. (An optimized 'llvm-symbolizer' takes 0.34s).
A crashed clang may take more than 5s to symbolize a stack trace.

If a test file has several `not --crash` RUN lines. It can be very slow in a Debug build.
This patch makes `not --crash` set an environment variable to suppress symbolization.
This is similar to D33804 which uses a command line option.
I pick 'symbolization' instead of 'symbolication' because the former is
used much more commonly and its stem matches 'llvm-symbolizer'.

Also set LLVM_DISABLE_CRASH_REPORT=1, which is currently only applicable on
`__APPLE__`.

Reviewed By: dblaikie, aganea

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

3 years agoForgot to update the test case for ppc64-tls-missing-gdld.s for 02e02f5398d0
Stefan Pintilie [Fri, 21 Aug 2020 18:13:10 +0000 (13:13 -0500)]
Forgot to update the test case for ppc64-tls-missing-gdld.s for 02e02f5398d0

3 years ago[lldb] Make it a fatal error when %lldb cannot be substituted
Jonas Devlieghere [Fri, 21 Aug 2020 17:57:12 +0000 (10:57 -0700)]
[lldb] Make it a fatal error when %lldb cannot be substituted

Refuse to run the shell tests when %lldb cannot be substituted. This
prevents the test from silently running again the `lldb` in your PATH.

I noticed because when this happens, %lldb-init gets substituted with
lldb-init, which does not exists.

3 years ago[ASan][Darwin] Enable test on additional platforms
Julian Lettner [Fri, 21 Aug 2020 18:11:50 +0000 (11:11 -0700)]
[ASan][Darwin] Enable test on additional platforms

3 years ago[PowerPC] Support constrained scalar sitofp/uitofp
Qiu Chaofan [Fri, 21 Aug 2020 17:58:07 +0000 (01:58 +0800)]
[PowerPC] Support constrained scalar sitofp/uitofp

This patch adds support for constrained scalar int to fp operations on
PowerPC. Besides, this also fixes the FP exception bit of FCFID*
instructions.

Reviewed By: steven.zhang, uweigand

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

3 years agoPreserve the error message when MemoryBuffer creation fails
Aden Grue [Fri, 21 Aug 2020 18:03:00 +0000 (18:03 +0000)]
Preserve the error message when MemoryBuffer creation fails

Reviewed By: mehdi_amini

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

3 years ago[LLD][PowerPC] Add check in LLD to produce an error for missing TLSGD/TLSLD
Stefan Pintilie [Thu, 20 Aug 2020 11:02:34 +0000 (06:02 -0500)]
[LLD][PowerPC] Add check in LLD to produce an error for missing TLSGD/TLSLD

The function `__tls_get_addr` is used to get the address of an object that is Thread Local Storage.
It needs to have two relocations on it.
One relocation is for the function call itself and it is either R_PPC64_REL24 or R_PPC64_REL24_NOTOC.
The other is R_PPC64_TLSGD or R_PPC64_TLSLD for the symbol that is having its address computed.

In the early days of the transition from the ELFv1 ABI that is used for big endian PowerPC Linux distributions to the ELFv2 ABI that is used for little endian PowerPC Linux distributions, there was some ambiguity in the specification of the relocations for TLS. The GNU linker has implemented support for correct handling of calls to __tls_get_addr with a missing relocation. Unfortunately, we didn't notice that the IBM XL compiler did not handle TLS according to the updated ABI until we tried linking XL compiled libraries with LLD. As a result, there is a lot of code out there in various libraries compiled with XL that have this problem.

This patch adds a new error check in LLD that makes sure calls to `__tls_get_addr` are not missing the TLSGD/TLSLD relocation.

Reviewed By: MaskRay

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

3 years ago[mlir][GPUToVulkan] Fix signature of bindMemRef function for f16
Thomas Raoux [Fri, 21 Aug 2020 17:34:12 +0000 (10:34 -0700)]
[mlir][GPUToVulkan] Fix signature of bindMemRef function for f16

Binding MemRefs of f16 needs special handling as the type is not supported on
CPU. There was a bug in the type used.

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

3 years ago[lldb] Fix TestAPILog.py for reproducer replay
Jonas Devlieghere [Fri, 21 Aug 2020 17:02:14 +0000 (10:02 -0700)]
[lldb] Fix TestAPILog.py for reproducer replay

With the log file being a build artifact we don't need to clean it up.
If this happens before the reproducer is captured, the file will be
missing from the reproducer root but being part of the mapping.

3 years agoUpdate my email address.
Dan Gohman [Fri, 21 Aug 2020 16:16:35 +0000 (09:16 -0700)]
Update my email address.

3 years agoRevert "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator."
Azharuddin Mohammed [Fri, 21 Aug 2020 16:58:50 +0000 (09:58 -0700)]
Revert "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator."

This reverts commit bb54bcf84970c04c9748004f3a4cf59b0c1832a7.

It is causing the value-profile-load.test test to fail on macOS.

3 years ago[InstCombine] Move handling of gc.relocate in a gc.statepoint
Serguei Katkov [Wed, 12 Aug 2020 09:09:02 +0000 (16:09 +0700)]
[InstCombine] Move handling of gc.relocate in a gc.statepoint

The only def for gc.relocate is a gc.statepoint. But real dependency is not
described by def-use chain. Instead this dependency is encoded by indecies
of operands in gc-live bundle of statepoint as integer constants in gc.relocate.

InstCombine operates by def-use chain. As a result when value in gc-live bundle
is simplified the gc.statepoint itself is not simplified but it might simplify dependent
gc.relocates. To trigger the optimization of gc.relocate we now unconditionally trigger
check of all dependent gc.relocates by adding them to worklist.

This CL handles of gc.relocates as process of gc.statepoint optimization considering
gc.statepoint and related gc.relocate as whole entity.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D85954

3 years agoRevert "Teach AttachPreviousImpl to inherit MSInheritanceAttr attribute"
Aaron Ballman [Fri, 21 Aug 2020 16:42:10 +0000 (12:42 -0400)]
Revert "Teach AttachPreviousImpl to inherit MSInheritanceAttr attribute"

This reverts commit 7a527f17776be78ec44b88e82b39afb65fc148e4.

It caused some buildbot failures:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13600
http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/20294

3 years ago[LibFuzzer] [tests] [Darwin] Use the pthread library from the SDK
Azharuddin Mohammed [Fri, 21 Aug 2020 16:22:13 +0000 (09:22 -0700)]
[LibFuzzer] [tests] [Darwin] Use the pthread library from the SDK

3 years ago[lldb] Skip PDB and NativePDB tests with reproducers
Jonas Devlieghere [Fri, 21 Aug 2020 16:09:10 +0000 (09:09 -0700)]
[lldb] Skip PDB and NativePDB tests with reproducers

3 years agoTeach AttachPreviousImpl to inherit MSInheritanceAttr attribute
Vaibhav Garg [Fri, 21 Aug 2020 16:04:43 +0000 (12:04 -0400)]
Teach AttachPreviousImpl to inherit MSInheritanceAttr attribute

This commit teaches ASTDeclReader::attachPreviousDecl to successfully merge
two Decl's when one contains an inheritable attribute like the
MSInheritanceAttr. Usually, attributes that are needed to be present along the
redeclaration chain are attached during ASTReading from
ASTDeclReader::attachPreviousDecl, but no such thing is done for inheritable
attributes. Currently, only the logic for merging MSInheritanceAttr is
provided.

3 years ago[gn build] Port 57903cf0933 -- https://reviews.llvm.org/rG57903cf0933
Nico Weber [Fri, 21 Aug 2020 16:02:30 +0000 (12:02 -0400)]
[gn build] Port 57903cf0933 -- https://reviews.llvm.org/rG57903cf0933

3 years ago[Constants] Handle FNeg in getWithOperands.
Florian Hahn [Fri, 21 Aug 2020 15:10:02 +0000 (16:10 +0100)]
[Constants] Handle FNeg in getWithOperands.

Currently ConstantExpr::getWithOperands does not handle FNeg and
subsequently treats FNeg as binary operator, leading to an assertion
failure or segmentation fault if built without assertions.

Originally I reproduced this with llvm-dis on a bitcode file, which I
unfortunately cannot share and also cannot really reduce.

But PR45426 describes the same issue and has a reproducer with Clang, so
I'll go with that.

Reviewed By: aprantl

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

3 years ago[PowerPC][PCRelative] Thread Local Storage Support for Initial Exec
Kamau Bridgeman [Tue, 16 Jun 2020 16:18:38 +0000 (11:18 -0500)]
[PowerPC][PCRelative] Thread Local Storage Support for Initial Exec

This patch is the initial support for the Intial Exec Thread Local
Local Storage model to produce code sequence and relocations correct
to the ABI for the model when using PC relative memory operations.

Reviewed By: stefanp

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

3 years ago[AIX][XCOFF] emit symbol visibility for xcoff object file.
diggerlin [Fri, 21 Aug 2020 15:00:56 +0000 (11:00 -0400)]
[AIX][XCOFF] emit symbol visibility for xcoff object file.

SUMMARY:

Reviewers:  Jason liu

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

3 years ago[SyntaxTree] Use annotations in Statement tests
Eduardo Caldas [Fri, 21 Aug 2020 12:20:02 +0000 (12:20 +0000)]
[SyntaxTree] Use annotations in Statement tests

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

3 years agoRevert "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"
Raphael Isemann [Fri, 21 Aug 2020 14:08:37 +0000 (16:08 +0200)]
Revert "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"

This reverts commit a4c3ed42ba5625af54254584d762ebf96cc06942.

The test is curiously failing with a plain exit code 1 on Fuchsia.

3 years agoRecommit "[SCEVExpander] Add helper to clean up instrs inserted while expanding."
Florian Hahn [Fri, 21 Aug 2020 11:26:41 +0000 (12:26 +0100)]
Recommit "[SCEVExpander] Add helper to clean up instrs inserted while expanding."

Recommit the patch after fixing an issue reported caused by the fact
that re-used values are also added to InsertedValues.

Additional tests have been added in 88818491b9dea64ec65c92ce5652bc45bef337a4

This reverts the revert commit 38884641f28e373ce291dc5ea93416756216e536.

3 years ago[SVE] Lower fixed length UDIV to scalable
Cameron McInally [Fri, 21 Aug 2020 14:00:13 +0000 (09:00 -0500)]
[SVE] Lower fixed length UDIV to scalable

Pretty much just a copy of the SDIV patches (D86114 and D85982) with string replacement.

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

3 years ago[AST][RecoveryExpr] Fix a bogus unused diagnostic when the type is preserved.
Haojian Wu [Fri, 21 Aug 2020 13:48:59 +0000 (15:48 +0200)]
[AST][RecoveryExpr] Fix a bogus unused diagnostic when the type is preserved.

Reviewed By: sammccall

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

3 years agoCorrectly emit dwoIDs after ASTFileSignature refactoring (D81347)
Raphael Isemann [Fri, 21 Aug 2020 12:21:21 +0000 (14:21 +0200)]
Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)

D81347 changes the ASTFileSignature to be an array of 20 uint8_t instead of 5
uint32_t. However, it didn't update the code in ObjectFilePCHContainerOperations
that creates the dwoID in the module from the ASTFileSignature
(`Buffer->Signature` being the array subclass that is now `std::array<uint8_t,
20>` instead of `std::array<uint32_t, 5>`).

```
  uint64_t Signature = [..] (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
```

This code works with the old ASTFileSignature (where two uint32_t are enough to
fill the uint64_t), but after the patch this only took two bytes from the
ASTFileSignature and only partly filled the Signature uint64_t.

This caused that the dwoID in the module ref and the dwoID in the actual module
no longer match (which in turns causes that LLDB keeps warning about the dwoID's
not matching when debugging -gmodules-compiled binaries).

This patch just unifies the logic for turning the ASTFileSignature into an
uint64_t which makes the dwoID match again (and should prevent issues like that
in the future).

Reviewed By: aprantl, dang

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

3 years ago[LoopIdiom,LSR] Add additional tests for SCEVExpander cleanups.
Florian Hahn [Fri, 21 Aug 2020 11:48:05 +0000 (12:48 +0100)]
[LoopIdiom,LSR] Add additional tests for SCEVExpander cleanups.

3 years ago[NFC][SimplifyCFG] Formatting and variable rename
Sam Parker [Fri, 21 Aug 2020 12:10:25 +0000 (13:10 +0100)]
[NFC][SimplifyCFG] Formatting and variable rename

3 years ago[llvm-readelf][test] - Refine the merged.test
Georgii Rymar [Thu, 20 Aug 2020 12:45:27 +0000 (15:45 +0300)]
[llvm-readelf][test] - Refine the merged.test

The testing in merged.test is not ideal.
It uses the following set of flags: `-aeWhSrnudlVgIs`
and the precompiled object `trivial.obj.elf-i386`.

In fact, this object, for example, does not contain versioning stuff,
so specifying `-V` does not make much sense for it, so it is not really tested.
Also, we want to avoid using of precompiled objects, ideally we
want to use a YAML that triggers an output for each of the short options in use:

```
-a: --all
-e: --headers
-W: --wide
-h: --file-headers, --file-header
-S: --section-headers, --sections
-r: --relocations
-n: --notes
-u: --unwind
-d: --dynamic-table
-l: --program-headers
-V: --version-info
-g: --elf-section-groups
-I: --elf-hash-histogram
-s: --symbols
```

Note that, for example, we do not need to have groups to test `-g`, because for a
object with no groups llvm-readelf still prints "There are no section groups in this file.",
but that is not always the case. E.g. for `-d` we don't print anything when we have
no dynamic table, so we have to describe it in a YAML to test `-d` properly.

Also, we probably want to test cases with and without `-a`(-all) option separately
to be sure that we handle all options and not only the first one in the sequence.

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

3 years ago[compiler-rt][RISCV] Use muldi3 builtin assembly implementation
Luís Marques [Fri, 21 Aug 2020 12:04:25 +0000 (13:04 +0100)]
[compiler-rt][RISCV] Use muldi3 builtin assembly implementation

D80465 added an assembly implementation of muldi3 for RISC-V but it didn't
add it to the cmake `*_SOURCES` list, so the C implementation was being used
instead. This patch fixes that.

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

3 years ago[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.
Georgii Rymar [Thu, 20 Aug 2020 12:56:24 +0000 (15:56 +0300)]
[llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.

The code that reports "PT_DYNAMIC segment offset + size exceeds the size of the file"
has an issue: it is possible to bypass the validation by overflowing the size + offset result.

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

3 years ago[PowerPC] Pre-commit FISel with PC-Rel test
Nemanja Ivanovic [Fri, 21 Aug 2020 11:13:56 +0000 (06:13 -0500)]
[PowerPC] Pre-commit FISel with PC-Rel test

Our handling of PC-Relative addressing is currently broken with
Fast ISel in 3 ways:
- FISel emits calls without handling all the PC-Rel intricacies
- FISel materializes FP constants through the TOC
- FISel materializes GV's through the TOC

As it would be unnecessarily tedious to implement all the handling
for PC-Rel in Fast ISel, we will turn off FISel for anything that
generates references to the TOC.

3 years ago[AMDGPU][MC][NFC][DOC] Updated AMD GPU assembler syntax description.
Dmitry Preobrazhensky [Fri, 21 Aug 2020 11:22:25 +0000 (14:22 +0300)]
[AMDGPU][MC][NFC][DOC] Updated AMD GPU assembler syntax description.

Summary of changes:
- added description of MTBUF instructions and format modifier;
- described limitations of f16 inline constants when used with integer operands;
- updated description of gfx9+ flat global addressing modes;
- v_accvgpr_write_b32 src0 corrections (gfx908);
- minor bugfixing and improvements.

3 years ago[clangd] Discard diagnostics from another SourceManager.
Adam Czachorowski [Tue, 11 Aug 2020 16:48:22 +0000 (18:48 +0200)]
[clangd] Discard diagnostics from another SourceManager.

This can happen when building implicit modules, as demonstrated in test.
The CompilerInstance uses the same StoredDiags, but different
SourceManager. This used to crash clangd when it tried to relocate the
diagnostic to the main file, which, according to SourceManager from the
diagnostic, is a fake <module-includes> file.

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

3 years agoRecommit: [DWARFYAML] Add support for referencing different abbrev tables.
Xing GUO [Fri, 21 Aug 2020 11:01:35 +0000 (19:01 +0800)]
Recommit: [DWARFYAML] Add support for referencing different abbrev tables.

The original commit (7ff0ace96db9164dcde232c36cab6519ea4fce8) was causing
build failure and was reverted in 6d242a73264ef1e3e128547f00e0fe2d20d3ada0

==================== Original Commit Message ====================
This patch adds support for referencing different abbrev tables. We use
'ID' to distinguish abbrev tables and use 'AbbrevTableID' to explicitly
assign an abbrev table to compilation units.

The syntax is:
```
debug_abbrev:
  - ID: 0
    Table:
      ...
  - ID: 1
    Table:
      ...
debug_info:
  - ...
    AbbrevTableID: 1 ## Reference the second abbrev table.
  - ...
    AbbrevTableID: 0 ## Reference the first abbrev table.
```

Reviewed By: jhenderson

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

3 years ago[NFC] Add SimplifyCFG for ARM
Sam Parker [Fri, 21 Aug 2020 10:51:40 +0000 (11:51 +0100)]
[NFC] Add SimplifyCFG for ARM

Add some phi elimination threshold testing.

3 years ago[X86] Enable constexpr on BITSCAN intrinsics (PR31446)
Simon Pilgrim [Fri, 21 Aug 2020 10:37:40 +0000 (11:37 +0100)]
[X86] Enable constexpr on BITSCAN intrinsics (PR31446)

This enables constexpr BSF/BSR intrinsics defined in ia32intrin.h

3 years ago[RISCV] Fix inaccurate annotations on PseudoBRIND
lewis-revill [Fri, 21 Aug 2020 09:47:54 +0000 (10:47 +0100)]
[RISCV] Fix inaccurate annotations on PseudoBRIND

PseudoBRIND had seemingly inherited incorrect annotations denoting it as
a call instruction and that it defines X1/ra. This caused excess
save/restore code to be emitted for ra.

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

3 years ago[AMDGPU] Use ds_read/write_b96/b128 when possible for SDag
Mirko Brkusanin [Fri, 21 Aug 2020 09:51:06 +0000 (11:51 +0200)]
[AMDGPU] Use ds_read/write_b96/b128 when possible for SDag

Do not break down local loads and stores so ds_read/write_b96/b128 in
ISelLowering can be selected on subtargets that support them and if align
requirements allow them.

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

3 years ago[AMDGPU][GlobalISel] Fix 96 and 128 local loads and stores
Mirko Brkusanin [Fri, 21 Aug 2020 09:42:49 +0000 (11:42 +0200)]
[AMDGPU][GlobalISel] Fix 96 and 128 local loads and stores

Fix local ds_read/write_b96/b128 so they can be selected if the alignment
allows. Otherwise, either pick appropriate ds_read2/write2 instructions or break
them down.

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

3 years ago[AMDGPU] Reorganize GCN subtarget features for unaligned access
Mirko Brkusanin [Fri, 21 Aug 2020 09:37:23 +0000 (11:37 +0200)]
[AMDGPU] Reorganize GCN subtarget features for unaligned access

Features UnalignedBufferAccess and UnalignedDSAccess are now used to determine
whether hardware supports such access.
UnalignedAccessMode should be used to enable them.
hasUnalignedBufferAccessEnabled() and hasUnalignedDSAccessEnabled() can be
now used to quickly check both.

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

3 years ago[AMDGPU] Fix alignment requirements for 96bit and 128bit local loads and stores
Mirko Brkusanin [Fri, 21 Aug 2020 09:29:32 +0000 (11:29 +0200)]
[AMDGPU] Fix alignment requirements for 96bit and 128bit local loads and stores

Adjust alignment requirements for ds_read/write_b96/b128.
GFX9 and onwards allow misaligned access for reads and writes but only if
SH_MEM_CONFIG.alignment_mode allows it.
UnalignedDSAccess is set on GCN subtargets from GFX9 onward to let us know if we
can relax alignment requirements.
UnalignedAccessMode acts similary to UnalignedBufferAccess for DS instructions
but only from GFX9 onward and is supposed to match alignment_mode. By default
alignment of 4 is required.

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

3 years ago[llvm-readelf] - Start recognizing 'PT_OPENBSD_*' segment types.
Georgii Rymar [Wed, 19 Aug 2020 12:38:43 +0000 (15:38 +0300)]
[llvm-readelf] - Start recognizing 'PT_OPENBSD_*' segment types.

Its a follow-up for D85830, it stops ignoring 'PT_OPENBSD_*' segment types.
Now them are recognized properly.

Note: GNU readelf does not recognize them, though perhaps it shouldn't.
Anyways, it was reported to binutils: https://sourceware.org/bugzilla/show_bug.cgi?id=26405#c0

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

3 years ago[X86] Enable constexpr on BSWAP intrinsics (PR31446)
Simon Pilgrim [Fri, 21 Aug 2020 09:53:17 +0000 (10:53 +0100)]
[X86] Enable constexpr on BSWAP intrinsics (PR31446)

This enables constexpr BSWAP intrinsics defined in ia32intrin.h

3 years ago[DSE,MemorySSA] Handle atomicrmw/cmpxchg conservatively.
Florian Hahn [Fri, 21 Aug 2020 09:18:32 +0000 (10:18 +0100)]
[DSE,MemorySSA] Handle atomicrmw/cmpxchg conservatively.

This adds conservative handling of AtomicRMW/AtomicCmpXChg to
isDSEBarrier, similar to atomic loads and stores.

3 years ago[NFC] Port InstCount pass to new pass manager
Roman Lebedev [Fri, 17 Jul 2020 11:30:51 +0000 (14:30 +0300)]
[NFC] Port InstCount pass to new pass manager

3 years ago[SelectionDAG] Better legalization for FSHL and FSHR
Jay Foad [Tue, 31 Mar 2020 16:24:07 +0000 (17:24 +0100)]
[SelectionDAG] Better legalization for FSHL and FSHR

In SelectionDAGBuilder always translate the fshl and fshr intrinsics to
FSHL and FSHR (or ROTL and ROTR) instead of lowering them to shifts and
ORs. Improve the legalization of FSHL and FSHR to avoid code quality
regressions.

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

3 years ago[X86] Enable constexpr on POPCNT intrinsics (PR31446)
Simon Pilgrim [Fri, 21 Aug 2020 09:19:41 +0000 (10:19 +0100)]
[X86] Enable constexpr on POPCNT intrinsics (PR31446)

Followup to D86229, this enables constexpr on the alternative (which fallback to generic code) POPCNT intrinsics defined in ia32intrin.h

3 years ago[DSE,MemorySSA] Regenerate check lines for atomic.ll tests.
Florian Hahn [Fri, 21 Aug 2020 08:50:01 +0000 (09:50 +0100)]
[DSE,MemorySSA] Regenerate check lines for atomic.ll tests.

3 years ago[AMDGPU] Apply llvm-prefer-register-over-unsigned from clang-tidy
Jay Foad [Fri, 21 Aug 2020 09:01:01 +0000 (10:01 +0100)]
[AMDGPU] Apply llvm-prefer-register-over-unsigned from clang-tidy

3 years ago[Attributor][NFC] run update_test_checks with --check-attributes.
sstefan1 [Fri, 21 Aug 2020 09:11:47 +0000 (11:11 +0200)]
[Attributor][NFC] run update_test_checks with --check-attributes.