platform/upstream/llvm.git
4 years ago[llvm][NFC][CallSite] Remove CallSite from Lint.cpp
Mircea Trofin [Mon, 20 Apr 2020 17:28:11 +0000 (10:28 -0700)]
[llvm][NFC][CallSite] Remove CallSite from Lint.cpp

Summary: The CallSite arg iterator is really User::op_iterator.

Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[MLIR] Fix affine loop tiling utility upper bound bug
Uday Bondhugula [Mon, 20 Apr 2020 16:59:21 +0000 (22:29 +0530)]
[MLIR] Fix affine loop tiling utility upper bound bug

Fix intra-tile upper bound setting in a scenario where the tile size was
larger than the trip count.

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

4 years ago[SemaObjC] Forbid storing an unboxed integer literal in an NSNumber
Erik Pilkington [Mon, 13 Apr 2020 20:19:16 +0000 (16:19 -0400)]
[SemaObjC] Forbid storing an unboxed integer literal in an NSNumber

This fixes a common mistake (the 3 should be @3): NSNumber *n = 3. This extends
an existing check for NSString. Also, this only errs if the initializer isn't a
null pointer constant, so NSNumber *n = 0; continues to work. rdar://47029572

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

4 years ago[clangd] Enable diagnostic fixes within macro argument expansions.
Sam McCall [Thu, 16 Apr 2020 23:38:42 +0000 (01:38 +0200)]
[clangd] Enable diagnostic fixes within macro argument expansions.

Summary: This seems like a pretty safe case, and common enough to be useful.

Reviewers: hokein

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

Tags: #clang

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

4 years ago[NFC] [AIX] [PowerPC] Add missing instruction to AIX byval test
Chris Bowler [Mon, 20 Apr 2020 18:59:26 +0000 (14:59 -0400)]
[NFC] [AIX] [PowerPC] Add missing instruction to AIX byval test

4 years agoRequire "target datalayout" to be at the beginning of an IR file.
Eli Friedman [Sat, 18 Apr 2020 02:33:26 +0000 (19:33 -0700)]
Require "target datalayout" to be at the beginning of an IR file.

This will allow us to use the datalayout to disambiguate other
constructs in IR, like load alignment. Split off from D78403.

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

4 years ago[lldb/Test] Don't friend std::make_unique
Jonas Devlieghere [Mon, 20 Apr 2020 18:33:35 +0000 (11:33 -0700)]
[lldb/Test] Don't friend std::make_unique

This wasn't a great idea to begin with, as you can't really rely on the
implementation, but since it also doesn't work with MSVC I've just made
the ctors public.

4 years ago[AIX] Return the correct set of callee saved regs
David Tenty [Mon, 20 Apr 2020 17:11:22 +0000 (13:11 -0400)]
[AIX] Return the correct set of callee saved regs

Summary:
r13 isn't reserved on 32-bit AIX, which is reflected in our calling
convention but not callee saved regs.

Reviewers: sfertile, ZarkoCA, cebowleratibm, jasonliu

Reviewed By: sfertile

Subscribers: thakis, lei, wuzish, nemanjai, hiraditya, kbarton, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without FPCVT
Nemanja Ivanovic [Mon, 20 Apr 2020 17:59:47 +0000 (12:59 -0500)]
[PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without FPCVT

We call the function that attempts to reuse the conversion without checking
whether the target matches the constraints that the callee expects. This patch
adds the check prior to the call.

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

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

4 years ago[libc++] Fix a few warnings when running the test suite with GCC
Louis Dionne [Mon, 20 Apr 2020 17:48:16 +0000 (13:48 -0400)]
[libc++] Fix a few warnings when running the test suite with GCC

4 years ago[ARM] Add an low overhead sibling loop test. NFC
David Green [Mon, 20 Apr 2020 17:12:43 +0000 (18:12 +0100)]
[ARM] Add an low overhead sibling loop test. NFC

4 years agoRevert "[MS] Fix assert handling enum forward decls in hasVisibleDefinition"
Rumeet Dhindsa [Mon, 20 Apr 2020 17:23:46 +0000 (10:23 -0700)]
Revert "[MS] Fix assert handling enum forward decls in hasVisibleDefinition"

This reverts commit e62dc1f6252c1dcdcc2a64e8e3b07a32412e9d89.

Reverting as per discussion with the patch author.
This patch causes module import error, but there was no intended
behavior change for code that does not use Microsoft extensions.

4 years ago[CallSite removal][ExecutionEngine] Use CallBase in the Interpreter. NFC
Craig Topper [Mon, 20 Apr 2020 17:02:08 +0000 (10:02 -0700)]
[CallSite removal][ExecutionEngine] Use CallBase in the Interpreter. NFC

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

4 years ago[dfsan] Add "DataFlow" option to LLVM_USE_SANITIZER
Zola Bridges [Fri, 17 Apr 2020 17:15:58 +0000 (10:15 -0700)]
[dfsan] Add "DataFlow" option to LLVM_USE_SANITIZER

Summary:
This patch add the dataflow option to LLVM_USE_SANITIZER and documents
it.

Tested via check-cxx (wip to fix the errors).

Reviewers: morehouse, #libc!

Subscribers: mgorny, cfe-commits, libcxx-commits

Tags: #clang, #libc

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

4 years ago[PowerPC][AIX] Use a file check variable for register used in addressing.
Sean Fertile [Mon, 20 Apr 2020 17:02:07 +0000 (13:02 -0400)]
[PowerPC][AIX] Use a file check variable for register used in addressing.

4 years agoRevert "[AIX] Return the correct set of callee saved regs"
David Tenty [Mon, 20 Apr 2020 17:00:26 +0000 (13:00 -0400)]
Revert "[AIX] Return the correct set of callee saved regs"

This reverts commit 6c881bf1fec2288907cd87a7895c863243bba7c5.

4 years ago[LSan] Disable a failing test on ARM
Oliver Stannard [Mon, 20 Apr 2020 14:54:41 +0000 (15:54 +0100)]
[LSan] Disable a failing test on ARM

This started failing after an OS upgrade on a buildbot machine, and I
don't see anything obvious to fix or revert, so disable it for now to
get the bot green.

Covered by https://bugs.llvm.org/show_bug.cgi?id=44158

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

4 years ago[lldb/Reproducers] Support new replay mode: passive replay
Jonas Devlieghere [Mon, 20 Apr 2020 16:37:07 +0000 (09:37 -0700)]
[lldb/Reproducers] Support new replay mode: passive replay

Support passive replay as proposed in the RFC [1] on lldb-dev and
described in more detail on the lldb website [2].

This patch extends the LLDB_RECORD macros to re-invoke the current
function with arguments deserialized from the reproducer. This relies on
the function being called in the exact same order as during replay. It
uses the same mechanism to toggle the API boundary as during recording,
which guarantees that only boundary crossing calls are replayed.

Another major change is that before this patch we could ignore the
result of an API call, because we only cared about the observable
behavior. Now we need to be able to return the replayed result to the
SWIG bindings.

We reuse a lot of the recording infrastructure, which can be a little
confusing. We kept the existing naming to limit the amount of churn, but
might revisit that in a future patch.

[1] http://lists.llvm.org/pipermail/lldb-dev/2020-April/016100.html
[2] https://lldb.llvm.org/resources/reproducers.html

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

4 years ago[ValueLattice] Add move constructor (NFC)
Nikita Popov [Fri, 17 Apr 2020 17:15:01 +0000 (19:15 +0200)]
[ValueLattice] Add move constructor (NFC)

Following the rule of five, declare move constructor and move
assignment operator for ValueLatticeElement. This allows moving
the ConstantRange rather than copying it.

This does not matter in most cases, where we're dealing with
APInts <= 64 bits. It does avoid unnecessary copies of allocations
for larger APInts.

Additionally we change the implementation approach to make the
copy/move assignment operators make use of the copy/move constructors,
rather than the other way around. The constructors are the more
primitive operations.

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

4 years ago[IPT] Don't use OrderedInstructions (NFC)
Nikita Popov [Sun, 19 Apr 2020 20:12:05 +0000 (22:12 +0200)]
[IPT] Don't use OrderedInstructions (NFC)

Use Instruction::comesBefore() instead of OrderedInstructions
inside InstructionPrecedenceTracking. This also removes the
dominator tree dependency.

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

4 years ago[libcxx][docs] Clearer mark up for --param
Zola Bridges [Fri, 17 Apr 2020 21:51:40 +0000 (14:51 -0700)]
[libcxx][docs] Clearer mark up for --param

Summary:
When I read this on the website it looks like the `--` in the used font turns
into an em dash. I updated this with inline literal mark up so the `--` will
remain obvious.

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

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

4 years ago[PowerPC][AIX] ByVal formal argument support: passing on the stack.
Sean Fertile [Wed, 8 Apr 2020 13:26:57 +0000 (09:26 -0400)]
[PowerPC][AIX] ByVal formal argument support: passing on the stack.

Adds support for passing a ByVal formal argument completely on the stack
(ie after all argument registers are exhausted).

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

4 years ago[lldb/Scripts] Add verbose and failure only mode to replay script.
Jonas Devlieghere [Mon, 20 Apr 2020 15:52:07 +0000 (08:52 -0700)]
[lldb/Scripts] Add verbose and failure only mode to replay script.

Add two modes to the reproducer replay script that make debugging a
little easier. Verbose mode prints stdout and stderr, regardless of
whether replay was successful. When --failure-only is passed, output is
limited to tests that failed to replay.

4 years ago[SveEmitter] Implement zeroing of false lanes
Sander de Smalen [Mon, 20 Apr 2020 15:34:23 +0000 (16:34 +0100)]
[SveEmitter] Implement zeroing of false lanes

This implements zeroing of false lanes for binary operations,
where instead of merging into the first operand vector (_m)
a `select` is placed on the first input vector. This approach
easily translates to the use of the `zeroing movprfx` instruction.

This patch also adds builtins for svabd, svadd, svdiv, svdivr,
svmax, svmin, svmul, svmulh, svub and svsubr.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years ago[mlir][ods] Update doc regarding attribute definitions
Lei Zhang [Mon, 13 Apr 2020 18:54:09 +0000 (14:54 -0400)]
[mlir][ods] Update doc regarding attribute definitions

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

4 years ago[mlir][spirv] NFC: remove unnecessary `%N =` in test CHECKs
Lei Zhang [Mon, 20 Apr 2020 15:52:29 +0000 (11:52 -0400)]
[mlir][spirv] NFC: remove unnecessary `%N =` in test CHECKs

4 years ago[mlir][spirv] Lower memref with dynamic dimensions to runtime arrays
Lei Zhang [Wed, 15 Apr 2020 12:42:28 +0000 (08:42 -0400)]
[mlir][spirv] Lower memref with dynamic dimensions to runtime arrays

memref types with dynamic dimensions do not have a compile-time
known size. They should be mapped to SPIR-V runtime array types.

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

4 years ago[compiler-rt] Use --standalone when running tests on the iOS simulator
Julian Lettner [Sat, 18 Apr 2020 00:09:33 +0000 (17:09 -0700)]
[compiler-rt] Use --standalone when running tests on the iOS simulator

We can use `simctl spawn --standalone` to enable running tests without
the need for an already-booted simulator instance.  This also side-steps
the problem of not having a good place to shutdown the instance after
we are finished with testing.

rdar://58118442

Reviewed By: delcypher

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

4 years ago[VectorUtils] Use early_inc_range instead of DelSet (NFC).
Florian Hahn [Mon, 20 Apr 2020 15:03:21 +0000 (16:03 +0100)]
[VectorUtils] Use early_inc_range instead of DelSet (NFC).

DelSet was used to avoid invalidating the current iterator while
modifying the map we are iterating over.

By using an early_inc_range, (which increments to iterator 'early',
allowing us to remove the current element), we can get rid of DelSet.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[Preamble] Allow recursive inclusion of header-guarded mainfile.
Sam McCall [Fri, 17 Apr 2020 14:07:21 +0000 (16:07 +0200)]
[Preamble] Allow recursive inclusion of header-guarded mainfile.

Summary:
This is guaranteed to be a no-op without the preamble, so should be a
no-op with it too.

Partially fixes https://github.com/clangd/clangd/issues/337
This doesn't yet work for #ifndef guards, which are not recognized in preambles.
see D78038

I can't for the life of me work out how to test this outside clangd.
The original reentrant preamble diagnostic was untested, I added a test
to clangd for that too.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[SveEmitter] Explicitly merge with zero/undef
Sander de Smalen [Mon, 20 Apr 2020 14:13:34 +0000 (15:13 +0100)]
[SveEmitter] Explicitly merge with zero/undef

Builtins that have the merge type MergeAnyExp or MergeZeroExp,
merge into a 'undef' or 'zero' vector respectively, which enables the
_x and _z behaviour for unary operations.

This patch also adds builtins for svabs and svneg.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years ago[AIX] Return the correct set of callee saved regs
David Tenty [Fri, 17 Apr 2020 17:06:08 +0000 (13:06 -0400)]
[AIX] Return the correct set of callee saved regs

Summary:
r13 isn't reserved on 32-bit AIX, which is reflected in our calling
convention but not callee saved regs.

Reviewers: sfertile, ZarkoCA, cebowleratibm, jasonliu

Reviewed By: sfertile

Subscribers: lei, wuzish, nemanjai, hiraditya, kbarton, llvm-commits

Tags: #llvm

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

4 years ago[MLIR] Add AtomicRMWRegionOp.
Alexander Belyaev [Mon, 20 Apr 2020 13:16:52 +0000 (15:16 +0200)]
[MLIR] Add AtomicRMWRegionOp.

https://llvm.discourse.group/t/rfc-add-std-atomic-rmw-op/489

Differensial revision: https://reviews.llvm.org/D78352

4 years agoRevert "[ARM] Fix conditions for lowering to S[LR]I"
Petre-Ionut Tudor [Mon, 20 Apr 2020 14:43:56 +0000 (15:43 +0100)]
Revert "[ARM] Fix conditions for lowering to S[LR]I"

This reverts commit cabfcf840a9d15d92466c6774953d3aa399cde92.
The patch introduced another bug in the optimization.

4 years agoBranchFolding.h - cleanup includes and forward declarations. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 14:59:24 +0000 (15:59 +0100)]
BranchFolding.h - cleanup includes and forward declarations. NFC.
Push MBFIWrapper.h include down to BranchFolding.cpp/IfConversion.cpp

4 years agoMIRVRegNamerUtils.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 13:33:21 +0000 (14:33 +0100)]
MIRVRegNamerUtils.h - remove unnecessary includes. NFC.
Replace with forward declarations or push down to MIRVRegNamerUtils.cpp where necessary.

4 years ago[ELF] Add --warn-backrefs-exclude=<glob>
Fangrui Song [Sun, 5 Apr 2020 04:31:36 +0000 (21:31 -0700)]
[ELF] Add --warn-backrefs-exclude=<glob>

D77522 changed --warn-backrefs to not warn for linking sandwich
problems (-ldef1 -lref -ldef2). This removed lots of false positives.

However, glibc still has some problems. libc.a defines some symbols
which are normally in libm.a and libpthread.a, e.g. __isnanl/raise.

For a linking order `-lm -lpthread -lc`, I have seen:

```
// different resolutions: GNU ld/gold select libc.a(s_isnan.o) as the definition
backward reference detected: __isnanl in libc.a(printf_fp.o) refers to libm.a(m_isnanl.o)

// different resolutions: GNU ld/gold select libc.a(raise.o) as the definition
backward reference detected: raise in libc.a(abort.o) refers to libpthread.a(pt-raise.o)
```

To facilitate deployment of --warn-backrefs, add --warn-backrefs-exclude= so that
certain known issues (which may be impractical to fix) can be whitelisted.

Deliberate choices:

* Not a comma-separated list (`--warn-backrefs-exclude=liba.a,libb.a`).
  -Wl, splits the argument at commas, so we cannot use commas.
  --export-dynamic-symbol is similar.
* Not in the style of `--warn-backrefs='*' --warn-backrefs=-liba.a`.
  We just need exclusion, not inclusion. For easier build system
  integration, we should avoid order dependency. With the current
  scheme, we enable --warn-backrefs, and indivial libraries can add
  --warn-backrefs-exclude=<glob> to their LDFLAGS.

Reviewed By: psmith

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

4 years ago[Dexter][NFC] Add Debugger Controller To Dexter
Tom Weaver [Mon, 20 Apr 2020 14:46:55 +0000 (15:46 +0100)]
[Dexter][NFC] Add Debugger Controller To Dexter

  Add DebuggerControllerBase and DefaultController to Dexter
  implements a new architecture that supports new and novel ways of running
  a debugger under dexter.
  Current implementation adds the original default behaviour via the new
  architecture via the DefaultController, this should have NFC.

Reviewers: Orlando

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

4 years ago[libc++] Fix the no-exceptions build of libc++ on Apple
Louis Dionne [Mon, 20 Apr 2020 09:22:20 +0000 (05:22 -0400)]
[libc++] Fix the no-exceptions build of libc++ on Apple

We previously tried re-exporting symbols that didn't exist when
exceptions were disabled. Note that building libc++abi without
exceptions still doesn't work when linking against the default-provided
libSystem.dylib, because it transitively depends on libobjc.dylib,
and that requires __gxx_personality_v0. But building libc++abi
with exceptions and libc++ without exceptions does work.

4 years ago[lldb] Remove m_last_file_sp from SourceManager
Emre Kultursay [Mon, 20 Apr 2020 14:17:36 +0000 (16:17 +0200)]
[lldb] Remove m_last_file_sp from SourceManager

Summary:
...and replace it with m_last_file_spec instead.

When Source Cache is enabled, the value stored in m_last_file_sp is
already in the Source Cache, and caching it again in SourceManager
brings no extra benefit. All we need is to "remember" the last used
file, and FileSpec can serve the same purpose.

When Source Cache is disabled, the user explicitly requested no caching
of source files, and therefore, m_last_file_sp should NOT be used.

Bug: llvm.org/PR45310

Depends on D76805.

Reviewers: labath, jingham

Reviewed By: jingham

Subscribers: labath, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Fix SourceManager::SourceFileCache insertion
Emre Kultursay [Mon, 20 Apr 2020 14:17:27 +0000 (16:17 +0200)]
[lldb] Fix SourceManager::SourceFileCache insertion

Summary:
Lookup and subsequent insert was done using uninitialized
FileSpec object, which caused the cache to be a no-op.

Bug: llvm.org/PR45310

Depends on D76804.

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: mgorny, jingham, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Add new LLDB setting: use-source-cache
Emre Kultursay [Mon, 20 Apr 2020 14:17:17 +0000 (16:17 +0200)]
[lldb] Add new LLDB setting: use-source-cache

Summary:
LLDB memory-maps large source files, and at the same time, caches
all source files in the Source Cache.

On Windows, memory-mapped source files are not writeable, causing
bad user experience in IDEs (such as errors when saving edited files).
IDEs should have the ability to disable the Source Cache at LLDB
startup, so that users can edit source files while debugging.

Bug: llvm.org/PR45310

Reviewers: labath, JDevlieghere, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb] Fix gcc warnings in TypeCategory.cpp
Pavel Labath [Mon, 20 Apr 2020 14:07:16 +0000 (16:07 +0200)]
[lldb] Fix gcc warnings in TypeCategory.cpp

The cleanup in 3e3701f8a0bf left these variable unused.

4 years ago[lldb] Prefer executable files from sysroot over files from local filesystem
Yuri Per [Mon, 20 Apr 2020 14:03:42 +0000 (16:03 +0200)]
[lldb] Prefer executable files from sysroot over files from local filesystem

Summary:
In D49685 sysroot behaviour was partially fixed. But files from local filesystem with same path still has priority over files from sysroot.

This patch fixes it by removing fallback to local filesystem from RemoteAwarePlatform::GetModuleSpec(). It is not actually required because higher level code do such fallback itself. See, for example, resolver in Platform::GetSharedModule().

Reviewers: labath, clayborg, EugeneBi

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[SveEmitter] Add immediate checks for lanes and complex imms
Sander de Smalen [Mon, 20 Apr 2020 13:57:13 +0000 (14:57 +0100)]
[SveEmitter] Add immediate checks for lanes and complex imms

Adds another bunch of of intrinsics that take immediates with
varying ranges based, some being a complex rotation immediate
which are a set of allowed immediates rather than a range.

    svmla_lane:   lane immediate ranging 0..(128/(1*sizeinbits(elt)) - 1)
    svcmla_lane:  lane immediate ranging 0..(128/(2*sizeinbits(elt)) - 1)
    svdot_lane:   lane immediate ranging 0..(128/(4*sizeinbits(elt)) - 1)
    svcadd:       complex rotate immediate [90, 270]
    svcmla:
    svcmla_lane:  complex rotate immediate [0, 90, 180, 270]

Reviewers: efriedma, SjoerdMeijer, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years ago[Scalarizer] Fix a non-deterministic scatter order problem
Bjorn Pettersson [Sun, 19 Apr 2020 10:56:16 +0000 (12:56 +0200)]
[Scalarizer] Fix a non-deterministic scatter order problem

Summary:
The indexing operator in Scatterer may result in building new
instructions. When using multiple such operators in a function
argument list the order in which we build instructions depend on
argument evaluation order (which is undefined in C++).
This patch avoid such problems by expanding the components using
the [] operator prior to the function call.

Problem was seen when comparing output, while builing LLVM with
different compilers (clang vs gcc).

Reviewers: foad, cameron.mcinally, uabelho

Reviewed By: foad

Subscribers: hiraditya, mgrang, llvm-commits

Tags: #llvm

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

4 years ago[SveEmitter] Add more immediate operand checks.
Sander de Smalen [Mon, 20 Apr 2020 13:41:58 +0000 (14:41 +0100)]
[SveEmitter] Add more immediate operand checks.

This patch adds a number of intrinsics that take immediates with
varying ranges based on the element size one of the operands.

    svext:   immediate ranging 0 to (2048/sizeinbits(elt) - 1)
    svasrd:  immediate ranging 1..sizeinbits(elt)
    svqshlu: immediate ranging 1..sizeinbits(elt)/2
    ftmad:   immediate ranging 0..(sizeinbits(elt) - 1)

Reviewers: efriedma, SjoerdMeijer, rovka, rengolin

Reviewed By: SjoerdMeijer

Tags: #clang

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

4 years agoX86MacroFusion.cpp - ensure X86MacroFusion.h module header is included first. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 12:55:46 +0000 (13:55 +0100)]
X86MacroFusion.cpp - ensure X86MacroFusion.h module header is included first. NFC.

4 years agoExplicitly move from llvm::json Array/Object to Value
Michael Forster [Mon, 20 Apr 2020 13:16:11 +0000 (15:16 +0200)]
Explicitly move from llvm::json Array/Object to Value

Summary: The implicit conversion fails under Clang 3.8.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[gn build] Port 12030494fce
LLVM GN Syncbot [Mon, 20 Apr 2020 13:10:45 +0000 (13:10 +0000)]
[gn build] Port 12030494fce

4 years ago[GlobalISel] Introduce InlineAsmLowering class
Konstantin Schwarz [Wed, 8 Apr 2020 12:40:43 +0000 (14:40 +0200)]
[GlobalISel] Introduce InlineAsmLowering class

Summary:
Similar to the CallLowering class used for lowering LLVM IR calls to MIR calls,
we introduce a separate class for lowering LLVM IR inline asm to MIR INLINEASM.

There is no functional change yet, all existing tests should pass.

Reviewers: arsenm, dsanders, aemerson, volkan, t.p.northover, paquette

Reviewed By: aemerson

Subscribers: gargaroff, wdng, mgorny, rovka, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[LLD][ELF][ARM] Convert ADR/LDR to .inst .reloc
Peter Smith [Mon, 20 Apr 2020 12:55:01 +0000 (13:55 +0100)]
[LLD][ELF][ARM] Convert ADR/LDR to .inst .reloc

After D78301 MC no longer emits a relocation for this case. Change to use
.inst and .reloc to synthesize the same instruction and relocation.

4 years ago[nfc] Cleanup extension header generation
serge-sans-paille [Mon, 20 Apr 2020 12:43:21 +0000 (14:43 +0200)]
[nfc] Cleanup extension header generation

4 years ago[analyzer] GenericTaint: Don't expect CallEvent to always have a Decl.
Artem Dergachev [Mon, 20 Apr 2020 12:30:30 +0000 (15:30 +0300)]
[analyzer] GenericTaint: Don't expect CallEvent to always have a Decl.

This isn't the case when the callee is completely unknown,
eg. when it is a symbolic function pointer.

4 years agoRevert 3ce0ad1b336e67a76d78ae7ff7d66fe127586620 Die to breakage in check-lld.
Mark Murray [Mon, 20 Apr 2020 12:01:36 +0000 (13:01 +0100)]
Revert 3ce0ad1b336e67a76d78ae7ff7d66fe127586620 Die to breakage in check-lld.

Requested-by: Nico Weber
4 years ago[AVR] Do not place functions in .progmem.data
Ayke van Laethem [Wed, 15 Apr 2020 15:30:47 +0000 (17:30 +0200)]
[AVR] Do not place functions in .progmem.data

Previously, the AVR backend would put functions in .progmem.data. This
is probably a regression from when functions still lived in address
space 0. With this change, only global constants are placed in
.progmem.data.

This is not complete: avr-gcc additionally respects -fdata-sections for
progmem global constants, which LLVM doesn't yet do. But fixing that is
a bit more complicated (and I believe other backends such as RISC-V
might also have similar issues).

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

4 years ago[AVR] Do not use divmod calls for bigger integers
Ayke van Laethem [Sat, 18 Apr 2020 21:42:48 +0000 (23:42 +0200)]
[AVR] Do not use divmod calls for bigger integers

The avr-libc provides *divmodqi4, *divmodhi4, and *divmodsi4 functions,
but does not provide a *divmoddi4. Instead it provides regular *divdi3
and *moddi3 functions.

Note that avr-libc doesn't support *divti3 or *modti3 for 128-bit
integer manipulation.

Source:
https://github.com/gcc-mirror/gcc/blob/releases/gcc-5.4.0/libgcc/config/avr/lib1funcs.S

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

4 years ago[FileCheck] - Refactor the code related to string arrays. NFCI.
Georgii Rymar [Wed, 15 Apr 2020 12:30:21 +0000 (15:30 +0300)]
[FileCheck] - Refactor the code related to string arrays. NFCI.

There are few `std::vector<std::string>` members in
`FileCheckRequest`. This patch changes these arrays to `std::vector<StringRef>`
and refactors the code related to cleanup/improve/simplify it.

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

4 years ago[obj2yaml] - Teach obj2yaml to dump SHT_NOBITS sections when dumping program headers.
Georgii Rymar [Tue, 7 Apr 2020 15:20:51 +0000 (18:20 +0300)]
[obj2yaml] - Teach obj2yaml to dump SHT_NOBITS sections when dumping program headers.

SHT_NOBITS are a bit special because occupy no physical space.
This patch adds support for them.

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

4 years ago[llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken string...
Georgii Rymar [Wed, 1 Apr 2020 13:40:25 +0000 (16:40 +0300)]
[llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken string tables.

There are cases when we either might print garbage or crash when
reading strings for dumping dynamic tags.

For example when a string table is not null-terminated or goes past the EOF.
This patch fixes issues mentioned.

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

4 years agoX86Subtarget.h - remove unused includes. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 11:10:25 +0000 (12:10 +0100)]
X86Subtarget.h - remove unused includes. NFC.
Replace with forward declarations.

4 years ago[MC][DWARF] Corrected handling of is_stmt flag in .loc directives
Dmitry Preobrazhensky [Mon, 20 Apr 2020 10:53:15 +0000 (13:53 +0300)]
[MC][DWARF] Corrected handling of is_stmt flag in .loc directives

According to DWARF standard, is_stmt is a global flag; when set or cleared it should affect subsequent .loc directives.

However llvm assembler handled is_stmt differently: it forced all locations to have is_stmt=1 unless is_stmt was specified explicitly as 0.

The fix utilizes current DWARF state flags to compute correct is_stmt values.

See https://bugs.llvm.org/show_bug.cgi?id=45529 for a detailed issue description.

Reviewers: arsenm, probinson, enderby

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

4 years agoX86Subtarget.cpp - sort includes. NFC
Simon Pilgrim [Mon, 20 Apr 2020 10:54:04 +0000 (11:54 +0100)]
X86Subtarget.cpp - sort includes. NFC
Ensure X86Subtarget.h module header is at the top, and sort the remaining includes.

4 years agoX86MCTargetDesc.h - remove unnecessary MCStreamer.h include. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 10:39:21 +0000 (11:39 +0100)]
X86MCTargetDesc.h - remove unnecessary MCStreamer.h include. NFC.
We don't need all of MCStreamer.h, just FormattedStream.h. The rest can be replaced with forward declarations.
X86WinAllocaExpander.cpp had an implicit dependency on MapVector.h which I've added locally.

4 years agoX86MCAsmInfo.h - remove unnecessary MCAsmInfo.h include. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 10:22:26 +0000 (11:22 +0100)]
X86MCAsmInfo.h - remove unnecessary MCAsmInfo.h include. NFC.
We only use the COFF/Darwin/ELF classes directly.

4 years agoX86InstrFoldTables.h - remove unnecessary include. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 10:20:22 +0000 (11:20 +0100)]
X86InstrFoldTables.h - remove unnecessary include. NFC.
We don't need the limits defines, just the sized integer types so use cstdint system header directly.

4 years ago[AArch64][SVE] Remove LD1/ST1 dependency on llvm.masked.load/store
Kerry McLaughlin [Mon, 20 Apr 2020 10:07:48 +0000 (11:07 +0100)]
[AArch64][SVE] Remove LD1/ST1 dependency on llvm.masked.load/store

Summary:
The SVE masked load and store intrinsics introduced in D76688 rely on
common llvm.masked.load/store nodes. This patch creates new ISD nodes
for LD1(S) & ST1 to remove this dependency.

Additionally, this adds support for sign & zero extending
loads and truncating stores.

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

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[analyzer] Do not report CFError null dereference for nonnull params.
Valeriy Savchenko [Mon, 20 Apr 2020 08:08:57 +0000 (11:08 +0300)]
[analyzer] Do not report CFError null dereference for nonnull params.

We want to trust user type annotations and stop assuming pointers declared
as nonnull still can be null. This functionality is implemented as part
of NonNullParamChecker because it already checks parameter attributes.
Whenever we start analyzing a new function, we assume that all parameters
with 'nonnull' attribute are indeed non-null.

Patch by Valeriy Savchenko!

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

4 years ago[analyzer] Do not report NSError null dereference for _Nonnull params.
Valeriy Savchenko [Wed, 8 Apr 2020 15:58:40 +0000 (18:58 +0300)]
[analyzer] Do not report NSError null dereference for _Nonnull params.

We want to trust user type annotations and stop assuming pointers declared
as _Nonnull still can be null. This functionality is implemented as part
of NullabilityChecker as it already tracks non-null types.

Patch by Valeriy Savchenko!

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

4 years ago[VPlan] Clean up tryToCreate(Widen)Recipe. (NFC)
Florian Hahn [Mon, 20 Apr 2020 08:42:02 +0000 (09:42 +0100)]
[VPlan] Clean up tryToCreate(Widen)Recipe. (NFC)

This patch includes some clean-ups to tryToCreateRecipe, suggested in
D77973.

It includes:
  * Renaming tryToCreateRecipe to tryToCreateWidenRecipe.
  * Move VPBB insertion logic to caller of tryToCreateWidenRecipe.
  * Hoists instruction checks to tryToCreateWidenRecipe, making it
    clearer which instructions are handled by which recipe, simplifying
    the checks by using early exits.
  * Split up handling of induction PHIs and truncates using inductions.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[ARM][MVE] Add patterns for VRHADD
Sam Parker [Wed, 15 Apr 2020 10:10:09 +0000 (11:10 +0100)]
[ARM][MVE] Add patterns for VRHADD

Add patterns which use standard add nodes along with arm vshr imm
nodes.

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

4 years ago[ARM][MC][Thumb] Revert relocation for some pc-relative fixups.
Mark Murray [Thu, 16 Apr 2020 14:17:34 +0000 (15:17 +0100)]
[ARM][MC][Thumb] Revert relocation for some pc-relative fixups.

Summary:
This commit reverts https://reviews.llvm.org/D75039. Concensus appears to
be in favour of assembly-time resolution of these ADR and LDR relocations,
in line with GNU.

Reviewers: psmith

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

Tags: #llvm

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

4 years ago[PredicateInfo] Use new Instruction::comesBefore instead of OI (NFC).
Florian Hahn [Mon, 20 Apr 2020 08:11:32 +0000 (09:11 +0100)]
[PredicateInfo] Use new Instruction::comesBefore instead of OI (NFC).

The recently added Instruction::comesBefore can be used instead of
OrderedInstructions.

Reviewers: rnk, nikic, efriedma

Reviewed By: nikic

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

4 years ago[MLIR] Add #include "llvm/ADT/SmallPtrSet.h" back to LoopUtils.h.
Alexander Belyaev [Mon, 20 Apr 2020 08:16:52 +0000 (10:16 +0200)]
[MLIR] Add #include "llvm/ADT/SmallPtrSet.h" back to LoopUtils.h.

4 years ago[NFC][TTI] Explicit use of VectorType
Sam Parker [Fri, 17 Apr 2020 12:29:31 +0000 (13:29 +0100)]
[NFC][TTI] Explicit use of VectorType

The API for shuffles and reductions uses generic Type parameters,
instead of VectorType, and so assertions and casts are used a lot.
This patch makes those types explicit, which means that the clients
can't be lazy, but results in less ambiguity, and that can only be a
good thing.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45562

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

4 years ago[CodeGen] Support freeze expand for ppc_fp128
Kang Zhang [Mon, 20 Apr 2020 07:27:41 +0000 (07:27 +0000)]
[CodeGen] Support freeze expand for ppc_fp128

Summary:
The patch D29014 has added the new ISD::FREEZE and can deal with the
integer.
The patch D76980 has added SoftenFloatRes_FREEZE for float point.
But we still lack of expand for ppc_fp128, this will cause assertion for
some cases.
This patch is to support freeze expand for ppc_fp128.

Reviewed By: efriedma

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

4 years ago[MLIR] Move `replaceAllUsesExcept` from LoopUtil.h to Value.h.
Alexander Belyaev [Mon, 20 Apr 2020 07:17:45 +0000 (09:17 +0200)]
[MLIR] Move `replaceAllUsesExcept` from LoopUtil.h to Value.h.

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

4 years ago[CallSite removal][SCCP] Use CallBase instead of CallSite. NFC
Craig Topper [Mon, 20 Apr 2020 07:05:18 +0000 (00:05 -0700)]
[CallSite removal][SCCP] Use CallBase instead of CallSite. NFC

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

4 years ago[clangd][test] Make sed git bash compliant
Kadir Cetinkaya [Mon, 20 Apr 2020 06:27:15 +0000 (08:27 +0200)]
[clangd][test] Make sed git bash compliant

4 years ago[CallSite removal][Analysis] Use CallBase instead of CallSite in SparsePropagation...
Craig Topper [Mon, 20 Apr 2020 05:39:24 +0000 (22:39 -0700)]
[CallSite removal][Analysis] Use CallBase instead of CallSite in SparsePropagation unit test. NFC

4 years ago[CallSite removal][CalledValuePropagation] Use CallBase instead of CallSite. NFC
Craig Topper [Mon, 20 Apr 2020 04:54:38 +0000 (21:54 -0700)]
[CallSite removal][CalledValuePropagation] Use CallBase instead of CallSite. NFC

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

4 years agollvm-dwarfdump: Fix UB (unsequenced writes) introduced in e0fd87cc64d5
David Blaikie [Mon, 20 Apr 2020 04:32:33 +0000 (21:32 -0700)]
llvm-dwarfdump: Fix UB (unsequenced writes) introduced in e0fd87cc64d5

Unsequenced write due to "x &= f()" where 'f()' modifies 'x'.

Detected by the llvm-clang-x86_64-expensive-checks-win buildbot.
Investigated/identified by Galina - thanks!

4 years ago[Test] Fix test failure: platform-dependent printout
Max Kazantsev [Mon, 20 Apr 2020 03:26:15 +0000 (10:26 +0700)]
[Test] Fix test failure: platform-dependent printout

4 years agoHandle CET for -exception-model sjlj
Xiang1 Zhang [Mon, 20 Apr 2020 02:17:34 +0000 (10:17 +0800)]
Handle CET for -exception-model sjlj

Summary:
In SjLj exception mode, the old landingpad BB will create a new landingpad BB and use indirect branch jump to the old landingpad BB in lowering.
So we should add 2 endbr for this exception model.

Reviewers: hjl.tools, craig.topper, annita.zhang, LuoYuanke, pengfei, efriedma

Reviewed By: LuoYuanke

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Object] Use BFD name for little-endian PowerPC64
Bill Wendling [Mon, 20 Apr 2020 03:08:30 +0000 (20:08 -0700)]
[Object] Use BFD name for little-endian PowerPC64

Summary:
Little-endian PowerPC object files should report "elf64-powerpcle" instead of
"elf64-powerpc".

Reviewers: jhenderson, MaskRay, espindola, alexshap, rupprecht, #powerpc

Reviewed By: MaskRay

Subscribers: wuzish, emaste, nemanjai, shchenz, steven.zhang, llvm-commits

Tags: #llvm, #powerpc

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

4 years ago[Test] Add a test showing how CFG analyses are invalidated after LV
Max Kazantsev [Mon, 20 Apr 2020 02:37:30 +0000 (09:37 +0700)]
[Test] Add a test showing how CFG analyses are invalidated after LV

It demonstrates that, even if LV does no actual vectorization and only
forms LCSSA, CFG analyses get dropped.

4 years ago[X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part III)
Shengchen Kan [Sat, 18 Apr 2020 08:52:50 +0000 (16:52 +0800)]
[X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part III)

Summary:
When we encode an instruction, we need to know the number of bytes being
emitted to determine the fixups in `X86MCCodeEmitter::emitImmediate`.
There are only two callers for `emitImmediate`: `emitMemModRMByte` and
`encodeInstruction`.

Before this patch, we kept track of the current byte being emitted
by passing a reference parameter `CurByte` across all the `emit*`
funtions, which is ugly and unnecessary. For example, we don't have any
fixups when emitting prefixes, so we don't need to track this value.

In this patch, we use `StartByte` to record the initial status of the
streamer, and use `OS.tell()` to get the current status of the streamer
when we need to know the number of bytes being emitted. On one hand,
this eliminates the parameter `CurByte` for most `emit*` functions, on
the other hand, this make things clear: Only pass the parameter when we
really need it.

Reviewers: craig.topper, pengfei, MaskRay

Reviewed By: craig.topper, MaskRay

Subscribers: hiraditya, llvm-commits, annita.zhang

Tags: #llvm

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

4 years ago[CallSite removal][WebAssembly] Replace CallSite with CallBase in WebAssemblyOptimize...
Craig Topper [Mon, 20 Apr 2020 01:32:20 +0000 (18:32 -0700)]
[CallSite removal][WebAssembly] Replace CallSite with CallBase in WebAssemblyOptimizeReturned.

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

4 years ago[CallSite removal][Analysis] Replace CallSite with CallBase in MemoryBuiltins. NFC
Craig Topper [Mon, 20 Apr 2020 01:32:03 +0000 (18:32 -0700)]
[CallSite removal][Analysis] Replace CallSite with CallBase in MemoryBuiltins. NFC

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

4 years ago[CallSite removal][Lint] Replace visitCallSite with visitCallBase. NFC
Craig Topper [Mon, 20 Apr 2020 01:31:42 +0000 (18:31 -0700)]
[CallSite removal][Lint] Replace visitCallSite with visitCallBase. NFC

Drop visitCallInst/visitInvokeInst since the generic implementation
will delegate to visitCallBase. They appear to be from a time
before visitCallSite existed in the InstVisitor system.

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

4 years ago[X86] Add X86ISD nodes for PDEP and PEXT.
Craig Topper [Sun, 19 Apr 2020 23:13:22 +0000 (16:13 -0700)]
[X86] Add X86ISD nodes for PDEP and PEXT.

This will allow use to add DAG combines for these instructions.

4 years ago[CallSite removal][AMDGPU] Use CallBase instead of CallSite in AMDGPUFixFunctionBitca...
Craig Topper [Sun, 19 Apr 2020 07:41:43 +0000 (00:41 -0700)]
[CallSite removal][AMDGPU] Use CallBase instead of CallSite in AMDGPUFixFunctionBitcasts. NFC

4 years agoX86CallLowering.h - remove unnecessary ArrayRef.h include. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 20:24:25 +0000 (21:24 +0100)]
X86CallLowering.h - remove unnecessary ArrayRef.h include. NFC.

4 years agoSectionMemoryManager.h - remove unnecessary StringRef.h include. NFC.
Simon Pilgrim [Sat, 18 Apr 2020 17:52:07 +0000 (18:52 +0100)]
SectionMemoryManager.h - remove unnecessary StringRef.h include. NFC.

4 years ago[LVI] Use Optional instead of out parameter (NFC)
Nikita Popov [Thu, 9 Apr 2020 19:13:03 +0000 (21:13 +0200)]
[LVI] Use Optional instead of out parameter (NFC)

As suggested on D76788, this switches the LVI implementation to
return Optional<ValueLatticeElement> from various methods, instead
of passing in a ValueLatticeElement reference and returning a boolean.

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

4 years ago[TTI] Clean up includes (NFC).
Florian Hahn [Sun, 19 Apr 2020 19:02:45 +0000 (20:02 +0100)]
[TTI] Clean up includes (NFC).

Remove some unnecessary includes, replace some with forward
declarations.

This also exposed a few places that were missing some includes.

4 years ago[IVDescriptors] Clean up includes.
Florian Hahn [Sun, 19 Apr 2020 18:39:55 +0000 (19:39 +0100)]
[IVDescriptors] Clean up includes.

Some includes are not required and forward declarations can be used
instead. This also exposed a few places that were not directly including
required files.

4 years ago[LoopUtils] Clean up includes, use forward decls if appropriate (NFC).
Florian Hahn [Sun, 19 Apr 2020 17:17:20 +0000 (18:17 +0100)]
[LoopUtils] Clean up includes, use forward decls if appropriate (NFC).

Most of the includes in LoopUtils.h are not required in the header and
they can be replaced by forward declarations.

Unfortunately includes of TargetTransformInfo.h and IVDescriptors.h pull
in a bunch of additional things, but there is no easy way to get rid of
them at the moment I think.

4 years agoFix one more link for a Rationale doc moved under Rationale/
Mehdi Amini [Sun, 19 Apr 2020 17:03:01 +0000 (17:03 +0000)]
Fix one more link for a Rationale doc moved under Rationale/

4 years agoDependenceGraphBuilder.h - remove unused includes. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 16:52:35 +0000 (17:52 +0100)]
DependenceGraphBuilder.h - remove unused includes. NFC.
Replace with forward declarations.