platform/upstream/llvm.git
5 years ago[AArch64][SVE] Adding patterns for floating point SVE add instructions.
Ehsan Amiri [Thu, 3 Oct 2019 14:19:55 +0000 (14:19 +0000)]
[AArch64][SVE] Adding patterns for floating point SVE add instructions.

llvm-svn: 373600

5 years agoRevert r373598 "[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG sections."
George Rimar [Thu, 3 Oct 2019 14:04:47 +0000 (14:04 +0000)]
Revert r373598 "[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG sections."

It broke BB:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18655/steps/test/logs/stdio

llvm-svn: 373599

5 years ago[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG sections.
George Rimar [Thu, 3 Oct 2019 13:57:08 +0000 (13:57 +0000)]
[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG sections.

SHT_LLVM_ADDRSIG is described here:
https://llvm.org/docs/Extensions.html#sht-llvm-addrsig-section-address-significance-table

This patch teaches tools to dump them and to parse the YAML declarations of such sections.

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

llvm-svn: 373598

5 years ago[NFC][InstCombine] Some tests for sub-of-negatible pattern
Roman Lebedev [Thu, 3 Oct 2019 13:36:00 +0000 (13:36 +0000)]
[NFC][InstCombine] Some tests for sub-of-negatible pattern

As we have previously estabilished, `sub` is an outcast,
and should be considered non-canonical iff it can be converted to `add`.

It can be converted to `add` if it's second operand can be negated.
So far we mostly only do that for constants and negation itself,
but we should be more through.

llvm-svn: 373597

5 years ago[llvm-locstats] Copy the script only when needed; NFC
Djordje Todorovic [Thu, 3 Oct 2019 13:18:14 +0000 (13:18 +0000)]
[llvm-locstats] Copy the script only when needed; NFC

llvm-svn: 373596

5 years ago[Alignment][NFC] Remove StoreInst::setAlignment(unsigned)
Guillaume Chatelet [Thu, 3 Oct 2019 13:17:21 +0000 (13:17 +0000)]
[Alignment][NFC] Remove StoreInst::setAlignment(unsigned)

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, bollu, jdoerfert

Subscribers: hiraditya, asbirlea, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 373595

5 years ago[llvm-readobj] - Stop using a precompiled binary in all.test
George Rimar [Thu, 3 Oct 2019 13:13:23 +0000 (13:13 +0000)]
[llvm-readobj] - Stop using a precompiled binary in all.test

Having a precompiled binary here is excessive.
I also added a few missing tags.

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

llvm-svn: 373594

5 years ago[libTooling] Add various Stencil combinators for expressions.
Yitzhak Mandelbaum [Thu, 3 Oct 2019 13:01:00 +0000 (13:01 +0000)]
[libTooling] Add various Stencil combinators for expressions.

Summary:
This revision adds three new Stencil combinators:
* `expression`, which idiomatically constructs the source for an expression,
  including wrapping the expression's source in parentheses if needed.
* `deref`, which constructs an idiomatic dereferencing expression.
* `addressOf`, which constructs an idiomatic address-taking expression.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373593

5 years ago[Alignment][Clang][NFC] Add CharUnits::getAsAlign
Guillaume Chatelet [Thu, 3 Oct 2019 13:00:29 +0000 (13:00 +0000)]
[Alignment][Clang][NFC] Add CharUnits::getAsAlign

Summary:
This is a prerequisite to removing `llvm::GlobalObject::setAlignment(unsigned)`.
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jholewinski, cfe-commits

Tags: #clang

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

llvm-svn: 373592

5 years ago[mips] Push `fixup_Mips_LO16` fixup for `jialc` and `jic` instructions
Simon Atanasyan [Thu, 3 Oct 2019 12:08:26 +0000 (12:08 +0000)]
[mips] Push `fixup_Mips_LO16` fixup for `jialc` and `jic` instructions

llvm-svn: 373591

5 years ago[llvm-readobj][mips] Remove non-standard --misp-xxx flags
Simon Atanasyan [Thu, 3 Oct 2019 12:08:11 +0000 (12:08 +0000)]
[llvm-readobj][mips] Remove non-standard --misp-xxx flags

llvm-readobj "non-standard" flags `--mips-plt-got`, `--mips-abi-flags`,
`--mips-reginfo`, and `--mips-options` are superseded by the `--arch-specific`
flag and can be removed now.

llvm-svn: 373590

5 years ago[mips] Use llvm-readobj `-A` flag in test cases. NFC
Simon Atanasyan [Thu, 3 Oct 2019 12:08:04 +0000 (12:08 +0000)]
[mips] Use llvm-readobj `-A` flag in test cases. NFC

llvm-svn: 373589

5 years ago[llvm-readobj][mips] Display MIPS specific info under --arch-specific flag
Simon Atanasyan [Thu, 3 Oct 2019 12:07:07 +0000 (12:07 +0000)]
[llvm-readobj][mips] Display MIPS specific info under --arch-specific flag

Old options `--mips-plt-got`, `--mips-abi-flags`, '--mips-reginfo`,
and `--mips-options` wiil be deleted in a separate patch.

llvm-svn: 373588

5 years ago[llvm-readobj][mips] Do not show an error if GOT is missed
Simon Atanasyan [Thu, 3 Oct 2019 12:06:56 +0000 (12:06 +0000)]
[llvm-readobj][mips] Do not show an error if GOT is missed

It is not an error if a file does not contain GOT.

llvm-svn: 373587

5 years agogn build: Revert 373554 "gn build: (manually) merge r373551"
Nico Weber [Thu, 3 Oct 2019 11:57:39 +0000 (11:57 +0000)]
gn build: Revert 373554 "gn build: (manually) merge r373551"

r373551 was reverted in r373581.

llvm-svn: 373586

5 years ago[AArch64] Static (de)allocation of SVE stack objects.
Sander de Smalen [Thu, 3 Oct 2019 11:33:50 +0000 (11:33 +0000)]
[AArch64] Static (de)allocation of SVE stack objects.

Adds support to AArch64FrameLowering to allocate fixed-stack SVE objects.

The focus of this patch is purely to allow the stack frame to
allocate/deallocate space for scalable SVE objects. More dynamic
allocation (at compile-time, i.e. determining placement of SVE objects
on the stack), or resolving frame-index references that include
scalable-sized offsets, are left for subsequent patches.

SVE objects are allocated in the stack frame as a separate region below
the callee-save area, and above the alignment gap. This is done so that
the SVE objects can be accessed directly from the FP at (runtime)
VL-based offsets to benefit from using the VL-scaled addressing modes.

The layout looks as follows:

     +-------------+
     | stack arg   |
     +-------------+
     | Callee Saves|
     |   X29, X30  |       (if available)
     |-------------| <- FP (if available)
     |     :       |
     |  SVE area   |
     |     :       |
     +-------------+
     |/////////////| alignment gap.
     |     :       |
     | Stack objs  |
     |     :       |
     +-------------+ <- SP after call and frame-setup

SVE and non-SVE stack objects are distinguished using different
StackIDs. The offsets for objects with TargetStackID::SVEVector should be
interpreted as purely scalable offsets within their respective SVE region.

Reviewers: thegameg, rovka, t.p.northover, efriedma, rengolin, greened

Reviewed By: efriedma

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

llvm-svn: 373585

5 years agoSilence static analyzer getAs<RecordType> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 3 Oct 2019 11:22:48 +0000 (11:22 +0000)]
Silence static analyzer getAs<RecordType> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<RecordType> directly and if not assert will fire for us.

llvm-svn: 373584

5 years agoFix uninitialized variable warning. NFCI
Simon Pilgrim [Thu, 3 Oct 2019 11:22:00 +0000 (11:22 +0000)]
Fix uninitialized variable warning. NFCI

llvm-svn: 373583

5 years agoFix uninitialized variable warning. NFCI
Simon Pilgrim [Thu, 3 Oct 2019 11:21:46 +0000 (11:21 +0000)]
Fix uninitialized variable warning. NFCI

llvm-svn: 373582

5 years agoRevert 373551 (CodeExpander.cpp CMake issue)
Kristina Brooks [Thu, 3 Oct 2019 11:04:48 +0000 (11:04 +0000)]
Revert 373551 (CodeExpander.cpp CMake issue)

Fix buildbots and revert the CodeExpander commit.

(See http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190930/699857.html )

llvm-svn: 373581

5 years ago[Alignment][NFC] Allow constexpr Align
Guillaume Chatelet [Thu, 3 Oct 2019 10:53:10 +0000 (10:53 +0000)]
[Alignment][NFC] Allow constexpr Align

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373580

5 years agoRevert 373555: libLLVM+modules failure with CMake 3.10.2
Kristina Brooks [Thu, 3 Oct 2019 10:48:37 +0000 (10:48 +0000)]
Revert 373555: libLLVM+modules failure with CMake 3.10.2

This reverts rL373555. I've sent an email out regarding the issue.

Commit on GitHub:
https://github.com/llvm/llvm-project/commit/45f682f47129c05414d4c5ae7be851772273978f

llvm-svn: 373579

5 years ago[clang][NFC] Fix misspellings in ExternalASTMerger.h
Raphael Isemann [Thu, 3 Oct 2019 09:55:13 +0000 (09:55 +0000)]
[clang][NFC] Fix misspellings in ExternalASTMerger.h

llvm-svn: 373577

5 years agoUpdate the FAQ: remove stuff related to the previous license +
Sylvestre Ledru [Thu, 3 Oct 2019 09:43:54 +0000 (09:43 +0000)]
Update the FAQ: remove stuff related to the previous license +
update info about the portability of LLVM.

llvm-svn: 373576

5 years ago"Fix" TestFileHandle.py on non-darwin platforms
Pavel Labath [Thu, 3 Oct 2019 08:44:33 +0000 (08:44 +0000)]
"Fix" TestFileHandle.py on non-darwin platforms

This test exposed a very long standing issue that the python file
objects returned by the FILE* typemap were unusable on non-darwin
platforms. The reason they work on darwin is that they rely on a
non-standard extension to fetch the "mode" of a FILE* object. On other
platforms, this code was #ifdefed out, and so we were returning an empty
mode.

As there's no portable way to get this information, I just change the
non-darwin path to return "r+", which should permit both reading and
writing operations on the object. If the underlying file descriptor
turns out to be incompatible with this mode, the operating system should
return EBADF (or equivalent), instead of the "file not open for XXX"
error from python.

llvm-svn: 373573

5 years agoFix a use-after-free in GDBRemoteCommunicationServerLLGS
Pavel Labath [Thu, 3 Oct 2019 07:59:26 +0000 (07:59 +0000)]
Fix a use-after-free in GDBRemoteCommunicationServerLLGS

Although it's called "GetString", StreamString::GetString actually
returns a StringRef. Creating a json object with a StringRef does not
make a copy, which means the StringRef will be dangling as soon as the
underlying stream is destroyed. Add a .str() to force the json object to
hold a copy of the string.

This fixes nearly every test on linux.

llvm-svn: 373572

5 years ago[llvm-exegesis][NFC] Rename ExegesisTarget::decrementLoopCounterAndLoop()
Clement Courbet [Thu, 3 Oct 2019 07:56:56 +0000 (07:56 +0000)]
[llvm-exegesis][NFC] Rename ExegesisTarget::decrementLoopCounterAndLoop()

Summary: To decrementLoopCounterAndJump, and explicitely take the jump target.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 373571

5 years agoFix libc++ pretty printer test for Python 3 after D67238 (take 2)
Fangrui Song [Thu, 3 Oct 2019 06:19:50 +0000 (06:19 +0000)]
Fix libc++ pretty printer test for Python 3 after D67238 (take 2)

In both Python 2 and Python 3, gdb.Value.string returns a 'str'. We just
need to delete a `encode("utf-8")` which would return a 'bytes' in
Python 3.

llvm-svn: 373570

5 years ago[X86] Add test case for v8i64->v8i8 truncate with avx512 and prefer-vector-width...
Craig Topper [Thu, 3 Oct 2019 06:18:45 +0000 (06:18 +0000)]
[X86] Add test case for v8i64->v8i8 truncate with avx512 and prefer-vector-width/min-legal-vector-width=256. NFC

With vpmovqb, we should be able to do better here until we get
AVX512VBMI on Cannonlake/Icelake.

llvm-svn: 373569

5 years agoAMDGPU/GlobalISel: Don't re-get subtarget
Matt Arsenault [Thu, 3 Oct 2019 05:46:10 +0000 (05:46 +0000)]
AMDGPU/GlobalISel: Don't re-get subtarget

It's already available in the class.

llvm-svn: 373568

5 years agoAMDGPU/GlobalISel: Expand G_BITCAST legality
Matt Arsenault [Thu, 3 Oct 2019 05:46:08 +0000 (05:46 +0000)]
AMDGPU/GlobalISel: Expand G_BITCAST legality

llvm-svn: 373567

5 years ago[X86] Add DAG combine to turn (bitcast (vbroadcast_load)) into just a vbroadcast_load...
Craig Topper [Thu, 3 Oct 2019 05:30:02 +0000 (05:30 +0000)]
[X86] Add DAG combine to turn (bitcast (vbroadcast_load)) into just a vbroadcast_load if the scalar size is the same.

This improves broadcast load folding of i64 elements on 32-bit
targets where i64 isn't legal.

Previously we had to represent these as vXf64 vbroadcast_loads and
a bitcast to vXi64. But we didn't have any isel patterns
looking for that.

This also allows us to remove or simplify some isel patterns that
were looking for bitcasted vbroadcast_loads.

llvm-svn: 373566

5 years agoFix driver tests when `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is `ON`
Serge Pavlov [Thu, 3 Oct 2019 04:52:46 +0000 (04:52 +0000)]
Fix driver tests when `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is `ON`

Some Driver tests relied on the default resource direcory having per-os per-arch
subdirectory layout, and when clang is built with `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`,
those test fail, because clang by default assumes per-target subdirectories.

Explicitly set `-resource-dir` flag to point to a tree with per-os per-arch layout.

See also: D45604, D62469

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

Patch by Sergej Jaskiewicz <jaskiewiczs@icloud.com>.

llvm-svn: 373565

5 years agofactor out an abstract base class for File
Lawrence D'Anna [Thu, 3 Oct 2019 04:31:46 +0000 (04:31 +0000)]
factor out an abstract base class for File

Summary:
This patch factors out File as an abstract base
class and moves most of its actual functionality into
a subclass called NativeFile.   In the next patch,
I'm going to be adding subclasses of File that
don't necessarily have any connection to actual OS files,
so they will not inherit from NativeFile.

This patch was split out as a prerequisite for
https://reviews.llvm.org/D68188

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373564

5 years agoSBDebugger::SetInputFile, SetOutputFile, etc.
Lawrence D'Anna [Thu, 3 Oct 2019 04:04:48 +0000 (04:04 +0000)]
SBDebugger::SetInputFile, SetOutputFile, etc.

Summary:
Add new methods to SBDebugger to set IO files as SBFiles instead of
as FILE* streams.

In future commits, the FILE* methods will be deprecated and these
will become the primary way to set the debugger I/O streams.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373563

5 years agonew api class: SBFile
Lawrence D'Anna [Thu, 3 Oct 2019 04:01:07 +0000 (04:01 +0000)]
new api class: SBFile

Summary:
SBFile is a scripting API wrapper for lldb_private::File

This is the first step in a project to enable arbitrary python
io.IOBase file objects -- including those that override the read()
and write() methods -- to be used as the main debugger IOStreams.

Currently this is impossible because python file objects must first
be converted into FILE* streams by SWIG in order to be passed into
the debugger.

full prototype: https://github.com/smoofra/llvm-project/tree/files

Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 373562

5 years ago[HIP] Support -emit-llvm for device compilation
Yaxun Liu [Thu, 3 Oct 2019 03:27:43 +0000 (03:27 +0000)]
[HIP] Support -emit-llvm for device compilation

Sometimes it is useful to compile HIP device code to LLVM BC. It is not convenient to use clang -cc1 since
there are lots of options needed.

This patch allows clang driver to compile HIP device code to LLVM BC with -emit-llvm -c.

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

llvm-svn: 373561

5 years ago[X86] Add broadcast load folding patterns to NoVLX VPMULLQ/VPMAXSQ/VPMAXUQ/VPMINSQ...
Craig Topper [Thu, 3 Oct 2019 03:16:27 +0000 (03:16 +0000)]
[X86] Add broadcast load folding patterns to NoVLX VPMULLQ/VPMAXSQ/VPMAXUQ/VPMINSQ/VPMINUQ patterns.

More fixes for PR36191.

llvm-svn: 373560

5 years ago[X86] Remove a couple redundant isel patterns that look to have been copy/pasted...
Craig Topper [Thu, 3 Oct 2019 03:16:21 +0000 (03:16 +0000)]
[X86] Remove a couple redundant isel patterns that look to have been copy/pasted from right above them. NFC

llvm-svn: 373559

5 years agogn build: Merge r373556
GN Sync Bot [Thu, 3 Oct 2019 02:43:27 +0000 (02:43 +0000)]
gn build: Merge r373556

llvm-svn: 373558

5 years agoRevert 373538 and follow-ups 373549 and 373552.
Nico Weber [Thu, 3 Oct 2019 02:38:43 +0000 (02:38 +0000)]
Revert 373538 and follow-ups 373549 and 373552.

They break tests on (at least) macOS.

llvm-svn: 373556

5 years ago[gicombiner] Make rL373551 compatible with older cmakes
Daniel Sanders [Thu, 3 Oct 2019 01:49:04 +0000 (01:49 +0000)]
[gicombiner] Make rL373551 compatible with older cmakes

Newer cmakes appear to be more flexible w.r.t object libraries. Convert to
a static library so that it works with older cmakes too

llvm-svn: 373555

5 years agogn build: (manually) merge r373551
Nico Weber [Thu, 3 Oct 2019 01:32:51 +0000 (01:32 +0000)]
gn build: (manually) merge r373551

llvm-svn: 373554

5 years agoPR43519: don't inject a diagnostic when constant-evaulation of a
Richard Smith [Thu, 3 Oct 2019 01:20:27 +0000 (01:20 +0000)]
PR43519: don't inject a diagnostic when constant-evaulation of a
pointer-to-member call can't determine a callee.

We will have produced a diagnostic already if the callee is known to be
unevaluatable, and diagnosing here rejects valid code during potential
constant expression checking.

llvm-svn: 373553

5 years agoFixing broken builds due to r373538, issues with filepath and hexagon toolchain.
Puyan Lotfi [Thu, 3 Oct 2019 01:19:51 +0000 (01:19 +0000)]
Fixing broken builds due to r373538, issues with filepath and hexagon toolchain.

It appears there are some issues with the hexagon toolchain, and also the file
path for the library file. If this doesn't fix the remaining breakages I will
attempt a revert.

llvm-svn: 373552

5 years ago[gicombiner] Add a CodeExpander to handle C++ fragments with variable expansion
Daniel Sanders [Thu, 3 Oct 2019 01:04:42 +0000 (01:04 +0000)]
[gicombiner] Add a CodeExpander to handle C++ fragments with variable expansion

Summary:
This will handle expansion of C++ fragments in the declarative combiner
including custom predicates, and escapes into C++ to aid the migration
effort.

Reviewers: bogner, volkan

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 373551

5 years agogn build: Merge r373538
GN Sync Bot [Thu, 3 Oct 2019 00:47:13 +0000 (00:47 +0000)]
gn build: Merge r373538

llvm-svn: 373550

5 years agoFixing broken builds due to r373538 due to test that should have been deleted.
Puyan Lotfi [Thu, 3 Oct 2019 00:41:13 +0000 (00:41 +0000)]
Fixing broken builds due to r373538 due to test that should have been deleted.

test/InterfaceStubs/object.cpp should have been deleted.

llvm-svn: 373549

5 years agoMark P0784R7 as complete and start defining its feature-test macro.
Richard Smith [Thu, 3 Oct 2019 00:39:37 +0000 (00:39 +0000)]
Mark P0784R7 as complete and start defining its feature-test macro.

Note that this only covers the language side of this feature. (The
library side has its own feature test macro.)

llvm-svn: 373548

5 years agoFor P0784R7: support placement new-expressions in constant evaluation.
Richard Smith [Thu, 3 Oct 2019 00:39:35 +0000 (00:39 +0000)]
For P0784R7: support placement new-expressions in constant evaluation.

For now, we restrict this support to use from within the standard
library implementation, since we're required to make parts of the
standard library that use placement new work, but not permitted to
make uses of placement new from user code work.

llvm-svn: 373547

5 years agoFor P0784R7: allow direct calls to operator new / operator delete from
Richard Smith [Thu, 3 Oct 2019 00:39:33 +0000 (00:39 +0000)]
For P0784R7: allow direct calls to operator new / operator delete from
std::allocator::{allocate,deallocate} in constant evaluation.

llvm-svn: 373546

5 years ago[gicombiner] Fix windows issue where single quotes in the command are passed through...
Daniel Sanders [Wed, 2 Oct 2019 23:38:06 +0000 (23:38 +0000)]
[gicombiner] Fix windows issue where single quotes in the command are passed through to tablegen

llvm-svn: 373545

5 years ago[AMDGPU] Fix illegal agpr use by VALU
Stanislav Mekhanoshin [Wed, 2 Oct 2019 23:23:46 +0000 (23:23 +0000)]
[AMDGPU] Fix illegal agpr use by VALU

When SIFixSGPRCopies attempts to fix an illegal copy from vector to
scalar register it calls moveToVALU(). A copy from an agpr to sgpr
becomes a copy from agpr to agpr, which may result in the illegal
register class at a use of this copy.

Solution is to copy it always into a vgpr. This may result in a
subsequent copy into an agpr if that is what really needed, however
should not happen too often and likely will be folded later.

The opposite situation may not happen because an sgpr is always
illegal where agpr is legal, so such user instructions may not
exist.

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

llvm-svn: 373544

5 years ago[gicombiner] Fix a nullptr dereference when -combiners is given a name that isn't...
Daniel Sanders [Wed, 2 Oct 2019 23:03:21 +0000 (23:03 +0000)]
[gicombiner] Fix a nullptr dereference when -combiners is given a name that isn't defined

This is unlikely to be the root cause for the windows bot failures but
it would explain the stack trace seen.

llvm-svn: 373543

5 years ago[InstCombine] Bypass high bit extract before variable sign-extension (PR43523)
Roman Lebedev [Wed, 2 Oct 2019 23:02:12 +0000 (23:02 +0000)]
[InstCombine] Bypass high bit extract before variable sign-extension (PR43523)

https://rise4fun.com/Alive/8BY - valid for lshr+trunc+variable sext
https://rise4fun.com/Alive/7jk - the variable sext can be redundant

https://rise4fun.com/Alive/Qslu - 'exact'-ness of first shift can be preserver

https://rise4fun.com/Alive/IF63 - without trunc we could view this as
                                  more general "drop redundant mask before right-shift",
                                  but let's handle it here for now
https://rise4fun.com/Alive/iip - likewise, without trunc, variable sext can be redundant.

There's more patterns for sure - e.g. we can have 'lshr' as the final shift,
but that might be best handled by some more generic transform, e.g.
"drop redundant masking before right-shift" (PR42456)

I'm singling-out this sext patch because you can only extract
high bits with `*shr` (unlike abstract bit masking),
and i *know* this fold is wanted by existing code.

I don't believe there is much to review here,
so i'm gonna opt into post-review mode here.

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

llvm-svn: 373542

5 years ago[NFC][InstCombine] Add tests for 'variable sext of variable high bit extract' pattern...
Roman Lebedev [Wed, 2 Oct 2019 23:01:58 +0000 (23:01 +0000)]
[NFC][InstCombine] Add tests for 'variable sext of variable high bit extract' pattern (PR43523)

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

llvm-svn: 373541

5 years agoDebugInfo: Rename DebugLocStream::Entry::Begin/EndSym to just Begin/End
David Blaikie [Wed, 2 Oct 2019 22:58:02 +0000 (22:58 +0000)]
DebugInfo: Rename DebugLocStream::Entry::Begin/EndSym to just Begin/End

Brings this struct in line with the RangeSpan class so they might
eventually be used by common template code for generating range/loc
lists with less duplicate code.

llvm-svn: 373540

5 years agoMove SanitizerInitializeUnwinder outside anonymous namespace.
Matt Morehouse [Wed, 2 Oct 2019 22:57:37 +0000 (22:57 +0000)]
Move SanitizerInitializeUnwinder outside anonymous namespace.

Fixes the Android build breakage introduced in r373528.

llvm-svn: 373539

5 years ago[clang][ifs] Clang Interface Stubs ToolChain plumbing.
Puyan Lotfi [Wed, 2 Oct 2019 22:50:07 +0000 (22:50 +0000)]
[clang][ifs] Clang Interface Stubs ToolChain plumbing.

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)

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

llvm-svn: 373538

5 years ago[InstCombine] Transform bcopy to memmove
David Bolvansky [Wed, 2 Oct 2019 22:49:20 +0000 (22:49 +0000)]
[InstCombine] Transform bcopy to memmove

bcopy is still widely used mainly for network apps. Sadly, LLVM has no optimizations for bcopy, but there are some for memmove.
Since bcopy == memmove, it is profitable to transform bcopy to memmove and use current optimizations for memmove for free here.

llvm-svn: 373537

5 years ago[X86] Add test cases for suboptimal vselect+setcc splitting.
Craig Topper [Wed, 2 Oct 2019 22:35:03 +0000 (22:35 +0000)]
[X86] Add test cases for suboptimal vselect+setcc splitting.

If the vselect result type needs to be split, it will try to
also try to split the condition if it happens to be a setcc.

With avx512 where k-registers are legal, its probably better
to just use a kshift to split the mask register.

llvm-svn: 373536

5 years ago[LegalizeTypes] Check for already split condition before calilng SplitVecRes_SETCC...
Craig Topper [Wed, 2 Oct 2019 22:34:49 +0000 (22:34 +0000)]
[LegalizeTypes] Check for already split condition before calilng SplitVecRes_SETCC in SplitRes_SELECT.

No point in manually splitting the SETCC if it was already done.

llvm-svn: 373535

5 years agogn build: (manually) merge r373527
Nico Weber [Wed, 2 Oct 2019 22:33:07 +0000 (22:33 +0000)]
gn build: (manually) merge r373527

llvm-svn: 373534

5 years agoDebugInfo: Simplify RangeSpan to be a plain struct
David Blaikie [Wed, 2 Oct 2019 22:27:24 +0000 (22:27 +0000)]
DebugInfo: Simplify RangeSpan to be a plain struct

This is an effort to make RangeSpan and DebugLocStream::Entry more
similar to share code for their emission (to reuse the more complicated
code for using (& choosing when to use) base address selection entries,
etc).

It didn't seem like this struct was worth the complexity of
encapsulation - when the members could be initialized by the ctor to any
value (no validation) and the type is assignable (so there's no
mutability or other constraint being implemented by its interface).

llvm-svn: 373533

5 years ago[sanitizer_common] Declare __sanitizer_on_print in Windows interception.
Matt Morehouse [Wed, 2 Oct 2019 22:00:29 +0000 (22:00 +0000)]
[sanitizer_common] Declare __sanitizer_on_print in Windows interception.

Speculative fix for Windows bot.

llvm-svn: 373532

5 years ago[sanitizer_common] Disable onprint.cpp on Android.
Matt Morehouse [Wed, 2 Oct 2019 21:38:22 +0000 (21:38 +0000)]
[sanitizer_common] Disable onprint.cpp on Android.

The test fails to find the written file on Android.

llvm-svn: 373531

5 years ago[sanitizer_common] Add __sanitizer_on_print to interface list.
Matt Morehouse [Wed, 2 Oct 2019 21:21:18 +0000 (21:21 +0000)]
[sanitizer_common] Add __sanitizer_on_print to interface list.

Should fix the current Windows buildbot failure.

llvm-svn: 373530

5 years ago[compiler-rt] Use GetNextInstructionPc in signal handlers
Vitaly Buka [Wed, 2 Oct 2019 21:20:37 +0000 (21:20 +0000)]
[compiler-rt] Use GetNextInstructionPc in signal handlers

Summary:
All other stack trace callers assume that PC contains return address.
HWAsan already use GetNextInstructionPc in similar code.

PR43339

Reviewers: eugenis, kcc, jfb

Subscribers: dexonsmith, dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373529

5 years agoNFC: add namespace {}
Vitaly Buka [Wed, 2 Oct 2019 21:20:32 +0000 (21:20 +0000)]
NFC: add namespace {}

llvm-svn: 373528

5 years ago[gicombiner] Add the boring boilerplate for the declarative combiner
Daniel Sanders [Wed, 2 Oct 2019 21:13:07 +0000 (21:13 +0000)]
[gicombiner] Add the boring boilerplate for the declarative combiner

Summary:
This is the first of a series of patches extracted from a much bigger WIP
patch. It merely establishes the tblgen pass and the way empty combiner
helpers are declared and integrated into a combiner info.

The tablegen pass takes a -combiners option to select the combiner helper
that will be generated. This can be given multiple values to generate
multiple combiner helpers at once. Doing so helps to minimize parsing
overhead.

The reason for creating a GlobalISel subdirectory in utils/TableGen is that
there will be quite a lot of non-pass files (~15) by the time the patch
series is done.

Reviewers: volkan

Subscribers: mgorny, hiraditya, simoncook, Petar.Avramovic, s.egerton, llvm-commits

Tags: #llvm

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

llvm-svn: 373527

5 years agoFix uninitialized variable warning in CodeGenPGO constructor. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 21:05:21 +0000 (21:05 +0000)]
Fix uninitialized variable warning in CodeGenPGO constructor. NFCI.

llvm-svn: 373526

5 years agoItaniumCXXABI - silence static analyzer getAs<RecordType> null dereference warnings...
Simon Pilgrim [Wed, 2 Oct 2019 20:45:16 +0000 (20:45 +0000)]
ItaniumCXXABI - silence static analyzer getAs<RecordType> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use castAs<RecordType> directly and if not assert will fire for us.

llvm-svn: 373525

5 years ago[NFC][libc++abi] Convert stray tabs to spaces
Louis Dionne [Wed, 2 Oct 2019 20:45:06 +0000 (20:45 +0000)]
[NFC][libc++abi] Convert stray tabs to spaces

llvm-svn: 373524

5 years ago[Clang][Driver][NFC] Corrected DeviceActionBuilder methods' comments.
Sergey Dmitriev [Wed, 2 Oct 2019 20:44:45 +0000 (20:44 +0000)]
[Clang][Driver][NFC] Corrected DeviceActionBuilder methods' comments.

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

llvm-svn: 373523

5 years agoRecommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing."
Florian Hahn [Wed, 2 Oct 2019 20:40:13 +0000 (20:40 +0000)]
Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing."

The cause for the revert should be fixed by r373513 /
a80b6c15425f82521c624ff24c5c0a34cd534d54

This reverts commit 47dbcbd8ec6bf6c0b9cbe5811e81a37cc55e73ef.

llvm-svn: 373522

5 years agoCGObjCMac - silence static analyzer dyn_cast<>/getAs<> null dereference warnings...
Simon Pilgrim [Wed, 2 Oct 2019 20:30:37 +0000 (20:30 +0000)]
CGObjCMac - silence static analyzer dyn_cast<>/getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use cast<>/castAs<> directly and if not assert will fire for us.

llvm-svn: 373520

5 years ago[PowerPC] Fix SH field overflow issue
Yi-Hong Lyu [Wed, 2 Oct 2019 20:25:16 +0000 (20:25 +0000)]
[PowerPC] Fix SH field overflow issue

Store rlwinm Rx, Ry, 32, 0, 31 as rlwinm Rx, Ry, 0, 0, 31 and store
rldicl Rx, Ry, 64, 0 as rldicl Rx, Ry, 0, 0. Otherwise SH field is overflow and
fails assertion in assembly printing stage.

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

llvm-svn: 373519

5 years ago[sanitizer_common] Rename OnPrint to __sanitizer_on_print.
Matt Morehouse [Wed, 2 Oct 2019 20:13:21 +0000 (20:13 +0000)]
[sanitizer_common] Rename OnPrint to __sanitizer_on_print.

Summary:
https://reviews.llvm.org/D28596 exposed OnPrint in the global namespace,
which can cause collisions with user-defined OnPrint() functions.

Reviewers: vitalybuka, dvyukov

Reviewed By: vitalybuka, dvyukov

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 373518

5 years ago[libc++] Use functions instead of global variables to set libc++ build flags
Louis Dionne [Wed, 2 Oct 2019 20:07:01 +0000 (20:07 +0000)]
[libc++] Use functions instead of global variables to set libc++ build flags

This commit follows the trend of doing things per-target instead of
modifying the C++ flags globally. It does so for visibility-related
flags, other basic build flags and Windows-specific flags.

llvm-svn: 373517

5 years agoFix inconsistent indentation in TableGen.cpp
Daniel Sanders [Wed, 2 Oct 2019 19:56:04 +0000 (19:56 +0000)]
Fix inconsistent indentation in TableGen.cpp

The anonymous namespace starts out (incorrectly) indented but isn't
indented from the TimeRegionsOpt declaration onwards.

llvm-svn: 373516

5 years agoHandle llvm.launder.invariant.group in msan.
Evgeniy Stepanov [Wed, 2 Oct 2019 19:53:19 +0000 (19:53 +0000)]
Handle llvm.launder.invariant.group in msan.

Summary:
[MSan] handle llvm.launder.invariant.group

    Msan used to give false-positives in

    class Foo {
     public:
      virtual ~Foo() {};
    };

    // Return true iff *x is set.
    bool f1(void **x, bool flag);

    Foo* f() {
      void *p;
      bool found;
      found = f1(&p,flag);
      if (found) {
        // p is always set here.
        return static_cast<Foo*>(p); // False positive here.
      }
      return nullptr;
    }

Patch by Ilya Tokar.

Reviewers: #sanitizers, eugenis

Reviewed By: #sanitizers, eugenis

Subscribers: eugenis, Prazek, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373515

5 years ago[TableGen] Improve error reporting of overlapping definitions (NFC)
Evandro Menezes [Wed, 2 Oct 2019 19:44:53 +0000 (19:44 +0000)]
[TableGen] Improve error reporting of overlapping definitions (NFC)

llvm-svn: 373514

5 years ago[Local] Handle terminators with users in removeUnreachableBlocks.
Florian Hahn [Wed, 2 Oct 2019 19:38:24 +0000 (19:38 +0000)]
[Local] Handle terminators with users in removeUnreachableBlocks.

Terminators like invoke can have users outside the current basic block.
We have to replace those users with undef, before replacing the
terminator.

This fixes a crash exposed by rL373430.

Reviewers: brzycki, asbirlea, davide, spatel

Reviewed By: asbirlea

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

llvm-svn: 373513

5 years ago[libc++] Use a function to set warning flags per target
Louis Dionne [Wed, 2 Oct 2019 19:31:30 +0000 (19:31 +0000)]
[libc++] Use a function to set warning flags per target

This is part of a larger shift to move to per-target settings and
eradicate global variables from the CMake build. I'm starting small
with warnings only because those are easy to transition over and I
want to see how it pans out, but we can handle all flags like exceptions
and RTTI in the future.

llvm-svn: 373511

5 years ago[ARM64] XPC services are unsupported on device.
Davide Italiano [Wed, 2 Oct 2019 19:20:24 +0000 (19:20 +0000)]
[ARM64] XPC services are unsupported on device.

While around, clean up support for a 8 years old OS.

<rdar://problem/55916729>

llvm-svn: 373510

5 years ago[RegisterContextDarwin_arm64] Include the headers for getsysctlbyname.
Davide Italiano [Wed, 2 Oct 2019 19:20:21 +0000 (19:20 +0000)]
[RegisterContextDarwin_arm64] Include the headers for getsysctlbyname.

This code is only used under __arm64__, use the correct guard.

<rdar://problem/55916729>

llvm-svn: 373509

5 years ago[ObjectFileMachO] FileSpec::SetFile() now takes the style as arg.
Davide Italiano [Wed, 2 Oct 2019 19:20:18 +0000 (19:20 +0000)]
[ObjectFileMachO] FileSpec::SetFile() now takes the style as arg.

Another block that's only compiled on __arm64__ and wasn't
updated.

<rdar://problem/55916729>

llvm-svn: 373508

5 years ago[ObjectFileMachO] Catch up with FileDesc changes.
Davide Italiano [Wed, 2 Oct 2019 19:20:15 +0000 (19:20 +0000)]
[ObjectFileMachO] Catch up with FileDesc changes.

This didn't show up because nobody built __arm64__ in a while.

<rdar://problem/55916729>

llvm-svn: 373507

5 years ago[libc++] Revert to using PUBLIC instead of PRIVATE when linking system libs
Louis Dionne [Wed, 2 Oct 2019 19:11:08 +0000 (19:11 +0000)]
[libc++] Revert to using PUBLIC instead of PRIVATE when linking system libs

It turns out the benchmarks need to link against those libraries
explicitly too, so CMake's propagation of PUBLIC dependencies is
used.

llvm-svn: 373506

5 years ago[MemorySSA] Update Phi creation when inserting a Def.
Alina Sbirlea [Wed, 2 Oct 2019 18:42:33 +0000 (18:42 +0000)]
[MemorySSA] Update Phi creation when inserting a Def.

MemoryPhis should be added in the IDF of the blocks newly gaining Defs.
This includes the blocks that gained a Phi and the block gaining a Def,
if the block did not have one before.
Resolves PR43427.

llvm-svn: 373505

5 years ago[Stencil] Hide implementaion detai. NFC.
Benjamin Kramer [Wed, 2 Oct 2019 18:33:44 +0000 (18:33 +0000)]
[Stencil] Hide implementaion detai. NFC.

llvm-svn: 373504

5 years ago[ARM] Make helpers static. NFC.
Benjamin Kramer [Wed, 2 Oct 2019 18:20:24 +0000 (18:20 +0000)]
[ARM] Make helpers static. NFC.

llvm-svn: 373503

5 years ago[OPENMP50]Add parsing/sema analysis for declare variant score.
Alexey Bataev [Wed, 2 Oct 2019 18:19:02 +0000 (18:19 +0000)]
[OPENMP50]Add parsing/sema analysis for declare variant score.

Context selectors may include optional score clause in format
`score(<expr>):`, where `<expr>` must be a constant integer expression.
Added parsing/sema analysis only.

llvm-svn: 373502

5 years ago[JSON] Remove Utility/JSON.{h|cpp}
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:36 +0000 (18:02 +0000)]
[JSON] Remove Utility/JSON.{h|cpp}

This patch is the final step in my quest to get rid of the JSON parser
in LLDB. Vedant's coverage report [1] shows that it was mostly untested.
Furthermore, the LLVM implementation has a much nicer API and using it
means one less thing to maintain for LLDB.

[1] http://lab.llvm.org:8080/coverage/coverage-reports/index.html

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

llvm-svn: 373501

5 years ago[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerCommon
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:32 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerCommon

This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerCommon.

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

llvm-svn: 373500

5 years ago[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerPlatform
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:29 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerPlatform

This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerPlatform.

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

llvm-svn: 373499

5 years ago[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationClient
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:26 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationClient

This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationClient.

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

llvm-svn: 373498

5 years ago[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerLLGS
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:23 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerLLGS

This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerLLGS.

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

llvm-svn: 373497

5 years ago[X86] Rewrite to the vXi1 subvector insertion code to not rely on the value of bits...
Craig Topper [Wed, 2 Oct 2019 17:47:09 +0000 (17:47 +0000)]
[X86] Rewrite to the vXi1 subvector insertion code to not rely on the value of bits that might be undef

The previous code tried to do a trick where we would extract the subvector from the location we were inserting. Then xor that with the new value. Take the xored value and clear out the bits above the subvector size. Then shift that xored subvector to the insert location. And finally xor that with the original vector. Since the old subvector was used in both xors, this would leave just the new subvector at the inserted location. Since the surrounding bits had been zeroed no other bits of the original vector would be modified.

Unfortunately, if the old subvector came from undef we might aggressively propagate the undef. Then we end up with the XORs not cancelling because they aren't using the same value for the two uses of the old subvector. @bkramer gave me a case that demonstrated this, but we haven't reduced it enough to make it easily readable to see what's happening.

This patch uses a safer, but more costly approach. It isolate the bits above the insertion and bits below the insert point and ORs those together leaving 0 for the insertion location. Then widens the subvector with 0s in the upper bits, shifts it into position with 0s in the lower bits. Then we do another OR.

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

llvm-svn: 373495

5 years agoFix: Actually erase remove the elements from AssumeHandles
Aditya Kumar [Wed, 2 Oct 2019 17:35:06 +0000 (17:35 +0000)]
Fix: Actually erase remove the elements from AssumeHandles

Reviewers: sdmitriev, tejohnson

Reviewed by: tejohnson

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 373494