platform/upstream/llvm.git
5 years agoNativeProcessProtocolTest: fix -Winconsistent-missing-override warning
Pavel Labath [Wed, 2 Jan 2019 10:37:38 +0000 (10:37 +0000)]
NativeProcessProtocolTest: fix -Winconsistent-missing-override warning

The warning comes from the fact that the MOCK_METHOD macros don't use the
override keyword internally. This makes us not use it in the manually overriden
methods either, to be consistent.

llvm-svn: 350209

5 years ago[AMDGPU] Handle OR as operand of raw load/store
Piotr Sobczak [Wed, 2 Jan 2019 09:47:41 +0000 (09:47 +0000)]
[AMDGPU] Handle OR as operand of raw load/store

Summary:
Use isBaseWithConstantOffset() which handles OR as an operand
to llvm.amdgcn.raw.buffer.load and llvm.amdgcn.raw.buffer.store.

Change-Id: Ifefb9dc5ded8710d333df07ab1900b230e33539a

Reviewers: nhaehnle, mareko, arsenm

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 350208

5 years agoRevert rL350035 "[llvm-exegesis] Clustering: don't enqueue a point multiple times"
Clement Courbet [Wed, 2 Jan 2019 09:21:00 +0000 (09:21 +0000)]
Revert rL350035 "[llvm-exegesis] Clustering: don't enqueue a point multiple times"

Let's discuss this on the review thread before submitting.

llvm-svn: 350207

5 years ago[X86] Remove the separate SMUL8/UMUL8 X86ISD opcodes by merging with SMUL/UMUL. Remov...
Craig Topper [Wed, 2 Jan 2019 06:40:11 +0000 (06:40 +0000)]
[X86] Remove the separate SMUL8/UMUL8 X86ISD opcodes by merging with SMUL/UMUL. Remove the second result from X86ISD::UMUL.

All of these use custom isel so we can pretty easily detect the differences in the custom code in X86ISelDAGToDAG. The ISD opcodes just need to express the desired semantics not the details of how they would be selected by isel. So unifying them lets us remove the special casing from lowering.

llvm-svn: 350206

5 years ago[X86] Allow LowerSELECT and LowerBRCOND to directly lower i8 UMULO/SMULO.
Craig Topper [Wed, 2 Jan 2019 05:46:03 +0000 (05:46 +0000)]
[X86] Allow LowerSELECT and LowerBRCOND to directly lower i8 UMULO/SMULO.

These require a different X86ISD node to be created than i16/i32/i64. I guess no one wanted to add the special code for that except in LowerXALUO. But now LowerXALUO, LowerSELECT, and LowerBRCOND all use a common helper function so they all share the special code.

Unfortunately, there are no test changes because we seem to correct the miss in a DAG combine later. I did verify it manually using test cases from xmulo.ll

llvm-svn: 350205

5 years ago[X86] Add i8/i16 smulo/umulo test cases where the overflow indication is used by...
Craig Topper [Wed, 2 Jan 2019 05:46:02 +0000 (05:46 +0000)]
[X86] Add i8/i16 smulo/umulo test cases where the overflow indication is used by a mask.

llvm-svn: 350204

5 years ago[X86] Remove KNL specific check prefix from xmulo.ll test. NFC
Craig Topper [Wed, 2 Jan 2019 05:46:00 +0000 (05:46 +0000)]
[X86] Remove KNL specific check prefix from xmulo.ll test. NFC

This was added at a time when i1 was a legal type with avx512f and there was a bug. i1 is no longer considered a legal type with avx512f so there should be no codegen difference.

llvm-svn: 350203

5 years ago[CMake][Fuchsia] Include check-lld in the list of bootstrap targets
Petr Hosek [Wed, 2 Jan 2019 05:11:57 +0000 (05:11 +0000)]
[CMake][Fuchsia] Include check-lld in the list of bootstrap targets

This allows running lld tests when doing 2-stage toolchain build.

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

llvm-svn: 350202

5 years ago[InstCombine] canonicalize raw IR rotate patterns to funnel shift
Sanjay Patel [Tue, 1 Jan 2019 21:51:39 +0000 (21:51 +0000)]
[InstCombine] canonicalize raw IR rotate patterns to funnel shift

The final piece of IR-level analysis to allow this was committed with:
rL350188

Using the intrinsics should improve transforms based on cost models
like vectorization and inlining.

The backend should be prepared too, so we can now canonicalize more
sequences of shift/logic to the intrinsics and know that the end
result should be equal or better to the original code even if the
target does not have an actual rotate instruction.

llvm-svn: 350199

5 years ago[X86] Factor the core code out of LowerXALUO into a helper function. Use it in LowerB...
Craig Topper [Tue, 1 Jan 2019 19:34:11 +0000 (19:34 +0000)]
[X86] Factor the core code out of LowerXALUO into a helper function. Use it in LowerBRCOND and LowerSELECT to avoid some duplicated code.

This makes it easier to keep the LowerBRCOND and LowerSELECT code in sync with LowerXALUO so they always pick the same operation for overflowing instructions.

This is inspired by the helper functions used by ARM and AArch64 for the same purpose.

The test change is because LowerSELECT was not in sync with LowerXALUO with regard to INC/DEC for SADDO/SSUBO.

llvm-svn: 350198

5 years ago[LLVM-C] bool -> LLVMBool
Robert Widmann [Tue, 1 Jan 2019 19:03:37 +0000 (19:03 +0000)]
[LLVM-C] bool -> LLVMBool

llvm-svn: 350197

5 years ago[LLVM-C] Add Accessors for Discarding Value Names in the IR
Robert Widmann [Tue, 1 Jan 2019 18:56:51 +0000 (18:56 +0000)]
[LLVM-C] Add Accessors for Discarding Value Names in the IR

Summary: Add accessors so the performance improvement from this setting is accessible to third parties.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 350196

5 years ago[X86] Remove KNL specific check prefix from xaluo.ll test. NFC
Craig Topper [Tue, 1 Jan 2019 18:44:44 +0000 (18:44 +0000)]
[X86] Remove KNL specific check prefix from xaluo.ll test. NFC

This was added at a time when i1 was a legal type with avx512f and there was a bug. i1 is no longer considered a legal type with avx512f so there should be no codegen difference.

llvm-svn: 350195

5 years ago[X86] Add test cases to show where LowerSELECT doesn't select SADDO/SSUBO to INC...
Craig Topper [Tue, 1 Jan 2019 18:44:42 +0000 (18:44 +0000)]
[X86] Add test cases to show where LowerSELECT doesn't select SADDO/SSUBO to INC/DEC, but LowerXALUOOp does. Leading to duplicate code.

When SADDO/SSUBO is used as a part of a condition, the X86 backend has to lower the instruction twice. One for the flags use and then once for the data use. These two selections should be kept in sync so they end up with one node providing the data and the flags. This doesn't seem to be happening for INC/DEC.

llvm-svn: 350194

5 years ago[x86] move/rename helper for horizontal op codegen; NFC
Sanjay Patel [Tue, 1 Jan 2019 16:08:36 +0000 (16:08 +0000)]
[x86] move/rename helper for horizontal op codegen; NFC

Preliminary commit as suggested in D56011.

llvm-svn: 350193

5 years agoFix some typos in the clang doc.
Sylvestre Ledru [Tue, 1 Jan 2019 12:51:14 +0000 (12:51 +0000)]
Fix some typos in the clang doc.
Fixed with:
$ codespell -w ClangFormatStyleOptions.rst Toolchain.rst LanguageExtensions.rst ClangCommandLineReference.rst

llvm-svn: 350192

5 years agoclang-format-diff: add an example with hg
Sylvestre Ledru [Tue, 1 Jan 2019 12:32:08 +0000 (12:32 +0000)]
clang-format-diff: add an example with hg

llvm-svn: 350191

5 years ago[BDCE] Regenerate test checks; NFC
Nikita Popov [Tue, 1 Jan 2019 12:27:23 +0000 (12:27 +0000)]
[BDCE] Regenerate test checks; NFC

llvm-svn: 350190

5 years ago[BDCE] Remove -instsimplify from BDCE test; NFC
Nikita Popov [Tue, 1 Jan 2019 10:17:35 +0000 (10:17 +0000)]
[BDCE] Remove -instsimplify from BDCE test; NFC

To make it more obvious which part of the transformation is carried
out by BDCE. Also drop the CHECK-IO lines which only run -instsimplify
as they don't really seem meaningful if the main check doesn't run
-instsimplify either.

llvm-svn: 350189

5 years agoReapply "[BDCE][DemandedBits] Detect dead uses of undead instructions"
Nikita Popov [Tue, 1 Jan 2019 10:05:26 +0000 (10:05 +0000)]
Reapply "[BDCE][DemandedBits] Detect dead uses of undead instructions"

This (mostly) fixes https://bugs.llvm.org/show_bug.cgi?id=39771.

BDCE currently detects instructions that don't have any demanded bits
and replaces their uses with zero. However, if an instruction has
multiple uses, then some of the uses may be dead (have no demanded bits)
even though the instruction itself is still live. This patch extends
DemandedBits/BDCE to detect such uses and replace them with zero.
While this will not immediately render any instructions dead, it may
lead to simplifications (in the motivating case, by converting a rotate
into a simple shift), break dependencies, etc.

The implementation tries to strike a balance between analysis power and
complexity/memory usage. Originally I wanted to track demanded bits on
a per-use level, but ultimately we're only really interested in whether
a use is entirely dead or not. I'm using an extra set to track which uses
are dead. However, as initially all uses are dead, I'm not storing uses
those user is also dead. This case is checked separately instead.

The previous attempt to land this lead to miscompiles, because cases
where uses were initially dead but were later found to be live during
further analysis were not always correctly removed from the DeadUses
set. This is fixed now and the added test case demanstrates such an
instance.

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

llvm-svn: 350188

5 years agoReversing the commit in revision 350186. Revision causes regression in 4
Ayonam Ray [Tue, 1 Jan 2019 07:28:55 +0000 (07:28 +0000)]
Reversing the commit in revision 350186.  Revision causes regression in 4
tests.

llvm-svn: 350187

5 years agoOmit range checks from jump tables when lowering switches with unreachable
Ayonam Ray [Tue, 1 Jan 2019 06:37:50 +0000 (06:37 +0000)]
Omit range checks from jump tables when lowering switches with unreachable
default

During the lowering of a switch that would result in the generation of a jump
table, a range check is performed before indexing into the jump table, for the
switch value being outside the jump table range and a conditional branch is
inserted to jump to the default block. In case the default block is
unreachable, this conditional jump can be omitted. This patch implements
omitting this conditional branch for unreachable defaults.

Review Reference: D52002

llvm-svn: 350186

5 years ago[InstCombine] canonicalize MUL with NEG operand
Chen Zheng [Tue, 1 Jan 2019 01:09:20 +0000 (01:09 +0000)]
[InstCombine] canonicalize MUL with NEG operand

-X * Y --> -(X * Y)
X * -Y --> -(X * Y)

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

llvm-svn: 350185

5 years ago[gn build] Add some llvm/tools: llvm-exegesis, llvm-extract, llvm-link
Nico Weber [Mon, 31 Dec 2018 23:48:22 +0000 (23:48 +0000)]
[gn build] Add some llvm/tools: llvm-exegesis, llvm-extract, llvm-link

Also add build file for dependency llvm/lib/ExecutionEngine/MCJIT.

The exegesis stuff is pretty hairy and knows a lot about Target internals (in
general, not specifically in the GN build). I put the llvm-tblgen -gen-exegesis
call in llvm/tools/llvm-exegesis/lib/X86, instead of in llvm/lib/Target/X86
where it is in CMake land, and asked on D52932 why it's in that place in the
CMake build.

Needed for check-llvm.

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

llvm-svn: 350184

5 years ago[gn build] Add some llvm/tools: llvm-rc, llvm-rtdyld
Nico Weber [Mon, 31 Dec 2018 23:32:15 +0000 (23:32 +0000)]
[gn build] Add some llvm/tools: llvm-rc, llvm-rtdyld

Also add build file for dependencies llvm/lib/ExecutionEngine,
llvm/lib/ExecutionEngine/RuntimeDyld.

Needed for check-llvm.

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

llvm-svn: 350183

5 years agoMake clearer which clang::type subclasses have visualizers
Mike Spertus [Mon, 31 Dec 2018 23:01:34 +0000 (23:01 +0000)]
Make clearer which clang::type subclasses have visualizers

llvm-svn: 350182

5 years ago[X86] Add PR34641 masked shld/shrd test cases
Simon Pilgrim [Mon, 31 Dec 2018 19:46:18 +0000 (19:46 +0000)]
[X86] Add PR34641 masked shld/shrd test cases

llvm-svn: 350181

5 years ago[X86] Add additional RUN lines to prepare for D56156. NFC
Craig Topper [Mon, 31 Dec 2018 19:09:32 +0000 (19:09 +0000)]
[X86] Add additional RUN lines to prepare for D56156. NFC

llvm-svn: 350180

5 years ago[SelectionDAG] Add SIGN_EXTEND_VECTOR_INREG support to computeKnownBits.
Craig Topper [Mon, 31 Dec 2018 19:09:30 +0000 (19:09 +0000)]
[SelectionDAG] Add SIGN_EXTEND_VECTOR_INREG support to computeKnownBits.

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

llvm-svn: 350179

5 years ago[X86] Add X86ISD::VSRAI to computeKnownBitsForTargetNode.
Craig Topper [Mon, 31 Dec 2018 19:09:27 +0000 (19:09 +0000)]
[X86] Add X86ISD::VSRAI to computeKnownBitsForTargetNode.

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

llvm-svn: 350178

5 years ago[DWARFUnit] Remove commented out code. NFCI.
Davide Italiano [Mon, 31 Dec 2018 18:45:30 +0000 (18:45 +0000)]
[DWARFUnit] Remove commented out code. NFCI.

llvm-svn: 350177

5 years agoKeep tablegen commands in alphabetical order. NFCI.
Simon Pilgrim [Mon, 31 Dec 2018 14:51:53 +0000 (14:51 +0000)]
Keep tablegen commands in alphabetical order. NFCI.

Mentioned on D56167.

llvm-svn: 350176

5 years ago[test] Fix propagating HOME envvar to unittests
Michal Gorny [Mon, 31 Dec 2018 13:48:12 +0000 (13:48 +0000)]
[test] Fix propagating HOME envvar to unittests

Propagate HOME environment variable to unittests.  This is necessary
to fix test failures resulting from pw_home pointing to a non-existing
directory while being overriden with HOME.  Apparently Gentoo users
hit this sometimes when they override build directory for Portage.

Original bug report: https://bugs.gentoo.org/674088

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

llvm-svn: 350175

5 years ago[AArch64] Accept "sve" as arch feature in assembler
Martin Storsjo [Mon, 31 Dec 2018 10:22:04 +0000 (10:22 +0000)]
[AArch64] Accept "sve" as arch feature in assembler

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

llvm-svn: 350174

5 years ago[MSan] Handle llvm.is.constant intrinsic
Alexander Potapenko [Mon, 31 Dec 2018 09:42:23 +0000 (09:42 +0000)]
[MSan] Handle llvm.is.constant intrinsic

MSan used to report false positives in the case the argument of
llvm.is.constant intrinsic was uninitialized.
In fact checking this argument is unnecessary, as the intrinsic is only
used at compile time, and its value doesn't depend on the value of the
argument.

llvm-svn: 350173

5 years ago[DAGCombiner] Add missing one use check on the shuffle in the bitcast(shuffle(bitcast...
Craig Topper [Mon, 31 Dec 2018 05:40:46 +0000 (05:40 +0000)]
[DAGCombiner] Add missing one use check on the shuffle in the bitcast(shuffle(bitcast(s0),bitcast(s1))) -> shuffle(s0,s1) transform.

Found while trying out some other changes so I don't really have a test case.

llvm-svn: 350172

5 years ago[gn build] Make `ninja check-clang` also run Clang's unit tests
Nico Weber [Mon, 31 Dec 2018 00:10:47 +0000 (00:10 +0000)]
[gn build] Make `ninja check-clang` also run Clang's unit tests

Also add a build file for clang/lib/ASTMatchers/Dynamic, which is only needed
by tests (and clang/tools/extra).

Also make llvm/utils/gn/build/sync_source_lists_from_cmake.py check that every
CMakeLists.txt file below {lld,clang}/unittests has a corresponding BUILD.gn
file, so we notice if new test binaries get added (since the failure mode for
missing GN build files for tests is just the tests silently not running in the
GN build).

Also add a unittest() macro for defining unit test targets, and add a lengthy
comment there about where the unit test binaries go and why.

With this, the build files for //clang are complete.

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

llvm-svn: 350171

5 years agoMore tolerance for flaky tests in libc++ on NetBSD
Kamil Rytarowski [Sun, 30 Dec 2018 23:05:14 +0000 (23:05 +0000)]
More tolerance for flaky tests in libc++ on NetBSD

Summary:
Tests marked with the flaky attribute ("FLAKY_TEST.")
can still report false positives in local tests and on the
NetBSD buildbot.

Additionally a number of tests (probably all threaded
ones) unmarked with the flaky attribute is flaky on
NetBSD.

An ideal solution on the libcxx side would be to raise
max retries for NetBSD and mark failing tests with
the flaky flag, however this adds more maintenance
burden and constant monitoring of flaky tests.

Reduce the work and handle flaky tests as more flaky
on NetBSD and allow flakiness  of other tests on
NetBSD.

Reviewers: mgorny, EricWF

Reviewed By: mgorny

Subscribers: christof, llvm-commits, libcxx-commits

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

llvm-svn: 350170

5 years ago[AArch64] Implement the .arch_extension directive
Martin Storsjo [Sun, 30 Dec 2018 21:06:32 +0000 (21:06 +0000)]
[AArch64] Implement the .arch_extension directive

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

llvm-svn: 350169

5 years ago[llvm-objcopy] [COFF] Use Error/Expected returns instead of calling reportError....
Martin Storsjo [Sun, 30 Dec 2018 20:35:43 +0000 (20:35 +0000)]
[llvm-objcopy] [COFF] Use Error/Expected returns instead of calling reportError. NFC.

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

llvm-svn: 350168

5 years agoDeclAccessPair visualizer should be expandable
Mike Spertus [Sun, 30 Dec 2018 20:22:37 +0000 (20:22 +0000)]
DeclAccessPair visualizer should be expandable

llvm-svn: 350167

5 years ago[CommandInterpreter] Simplify PreprocessCommand. (NFCI)
Jonas Devlieghere [Sun, 30 Dec 2018 17:56:30 +0000 (17:56 +0000)]
[CommandInterpreter] Simplify PreprocessCommand. (NFCI)

Simplify some code in PreprocessCommand. This change improves
consistency, reduces the indentation and makes the code easier to follow
overall.

llvm-svn: 350166

5 years ago[PowerPC] Fix machine verify pass error for PATCHPOINT pseudo instruction that bad...
Kang Zhang [Sun, 30 Dec 2018 15:13:51 +0000 (15:13 +0000)]
[PowerPC] Fix machine verify pass error for PATCHPOINT pseudo instruction that bad machine code

Summary:
For SDAG, we pretend patchpoints aren't special at all until we emit the code for the pseudo.
Then the verifier runs and it seems like we have a use of an undefined register (the register will
be reserved later, but the verifier doesn't know that).

So this patch call setUsesTOCBasePtr before emit the code for the pseudo, so verifier can know
X2 is a reserved register.

Reviewed By: nemanjai

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

llvm-svn: 350165

5 years ago[Type] Simplify operator!=. NFC.
Davide Italiano [Sun, 30 Dec 2018 15:08:51 +0000 (15:08 +0000)]
[Type] Simplify operator!=. NFC.

llvm-svn: 350164

5 years ago[TypeName] Simplify operator!=. NFCI.
Davide Italiano [Sun, 30 Dec 2018 15:07:25 +0000 (15:07 +0000)]
[TypeName] Simplify operator!=. NFCI.

llvm-svn: 350163

5 years ago[NFC] Fixed extra semicolon warning
David Bolvansky [Sun, 30 Dec 2018 13:18:17 +0000 (13:18 +0000)]
[NFC] Fixed extra semicolon warning
-This line, and those below, will be ignored--

M    lib/Support/Error.cpp

llvm-svn: 350162

5 years ago[PowerPC] Fix ADDE, SUBE do not know how to promote operator
Kang Zhang [Sun, 30 Dec 2018 07:48:09 +0000 (07:48 +0000)]
[PowerPC] Fix ADDE, SUBE do not know how to promote operator

Summary:
This patch is created to fix the Bugzilla bug 39815:
https://bugs.llvm.org/show_bug.cgi?id=39815

This patch is to support promotion integer result for the instruction ADDE, SUBE.

Reviewed By: hfinkel

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

llvm-svn: 350161

5 years ago[test] Remove flakiness decorator from TestObjCDynamicSBType
Jonas Devlieghere [Sun, 30 Dec 2018 06:10:03 +0000 (06:10 +0000)]
[test] Remove flakiness decorator from TestObjCDynamicSBType

The quoted bug report (llvm.org/PR20270) was closed in 2014.

llvm-svn: 350160

5 years ago[X86] Don't mark SEXTLOAD from v4i8/v4i16/v8i8 as Custom on pre-sse4.1.
Craig Topper [Sun, 30 Dec 2018 03:05:07 +0000 (03:05 +0000)]
[X86] Don't mark SEXTLOAD from v4i8/v4i16/v8i8 as Custom on pre-sse4.1.

This seems to be getting in the way more than its helping. This does mean we stop scalarizing some cases, but I'm not convinced the scalarization was really better.

Some of the changes to vsel-cmp-load.ll are a regression but D56156 should fix it.

llvm-svn: 350159

5 years ago[X86] Add custom type legalization for SIGN_EXTEND_VECTOR_INREG from 16i16/v32i8...
Craig Topper [Sun, 30 Dec 2018 02:30:34 +0000 (02:30 +0000)]
[X86] Add custom type legalization for SIGN_EXTEND_VECTOR_INREG from 16i16/v32i8 to v4i64 when v4i64 needs splitting.

This allows us to sign extend to v4i32 first. And then share that extension to implement the final steps to v4i64 using a pcmpgt and punpckl and punpckh.

We already do something similar for SIGN_EXTEND with -x86-experimental-vector-widening-legalization.

llvm-svn: 350158

5 years ago[CodeGen] Replace '@' characters in block descriptors' symbol names with
Akira Hatanaka [Sat, 29 Dec 2018 17:28:30 +0000 (17:28 +0000)]
[CodeGen] Replace '@' characters in block descriptors' symbol names with
'\1'.

'@' can't be used in block descriptors' symbol names since it is
reserved on ELF platforms as a separator between symbol names and symbol
versions.

See the discussion here: https://reviews.llvm.org/D50783.

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

llvm-svn: 350157

5 years ago[PowerPC][NFC] Macro for register set defs for the Asm Parser
Nemanja Ivanovic [Sat, 29 Dec 2018 16:13:11 +0000 (16:13 +0000)]
[PowerPC][NFC] Macro for register set defs for the Asm Parser

We have some unfortunate code in the back end that defines a bunch of register
sets for the Asm Parser. Every time another class is needed in the parser, we
have to add another one of those definitions with explicit lists of registers.
This NFC patch simply provides macros to use to condense that code a little bit.

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

llvm-svn: 350156

5 years ago[PowerPC] Complete the custom legalization of vector int to fp conversion
Nemanja Ivanovic [Sat, 29 Dec 2018 13:40:48 +0000 (13:40 +0000)]
[PowerPC] Complete the custom legalization of vector int to fp conversion

A recent patch has added custom legalization of vector conversions of
v2i16 -> v2f64. This just rounds it out for other types where the input vector
has an illegal (narrower) type than the result vector. Specifically, this will
handle the following conversions:

v2i8 -> v2f64
v4i8 -> v4f32
v4i16 -> v4f32

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

llvm-svn: 350155

5 years ago[InstCombine] [NFC] update testcases for canonicalize MUL with NEG operand
Chen Zheng [Sat, 29 Dec 2018 12:18:15 +0000 (12:18 +0000)]
[InstCombine] [NFC] update testcases for canonicalize MUL with NEG operand

llvm-svn: 350154

5 years ago[PowerPC] Fix CR Bit spill pseudo expansion
Nemanja Ivanovic [Sat, 29 Dec 2018 11:43:54 +0000 (11:43 +0000)]
[PowerPC] Fix CR Bit spill pseudo expansion

The current CRBIT spill pseudo-op expansion creates a KILL instruction
that kills the CRBIT and defines the enclosing CR field. However, this
paints a false picture to the register allocator that all bits in the CR
field are killed so copies of other bits out of the field become dead and
removable.
This changes the expansion to preserve the KILL flag on the CRBIT as an
implicit use and to treat the CR field as an undef input.

Thanks to Hal Finkel for the review and Uli Weigand for implementation input.

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

llvm-svn: 350153

5 years ago[mips] Show an error on attempt to use 64-bit PC-relative relocation
Simon Atanasyan [Sat, 29 Dec 2018 10:10:02 +0000 (10:10 +0000)]
[mips] Show an error on attempt to use 64-bit PC-relative relocation

The following code requests 64-bit PC-relative relocations unsupported
by MIPS ABI. Now it triggers an assertion. It's better to show an error
message.
```
foo:
  .quad bar - foo
```

llvm-svn: 350152

5 years ago[mips] Show a regular error message on attempt to use one byte relocation
Simon Atanasyan [Sat, 29 Dec 2018 10:09:55 +0000 (10:09 +0000)]
[mips] Show a regular error message on attempt to use one byte relocation

llvm-svn: 350151

5 years ago[X86] Add test case from PR38217. NFC
Craig Topper [Sat, 29 Dec 2018 07:14:30 +0000 (07:14 +0000)]
[X86] Add test case from PR38217. NFC

llvm-svn: 350150

5 years ago[RegisterValue] Rewrite operator!= in terms of operator==. NFCI.
Davide Italiano [Sat, 29 Dec 2018 05:05:23 +0000 (05:05 +0000)]
[RegisterValue] Rewrite operator!= in terms of operator==. NFCI.

llvm-svn: 350149

5 years ago[CompilerType] Simplify operator!=. NFCI.
Davide Italiano [Sat, 29 Dec 2018 05:00:33 +0000 (05:00 +0000)]
[CompilerType] Simplify operator!=. NFCI.

llvm-svn: 350148

5 years ago[CompilerType] Remove dead code. NFCI.
Davide Italiano [Sat, 29 Dec 2018 04:59:07 +0000 (04:59 +0000)]
[CompilerType] Remove dead code. NFCI.

llvm-svn: 350147

5 years ago[SymbolContext] Rewrite operator== to be more concise.
Davide Italiano [Sat, 29 Dec 2018 04:57:00 +0000 (04:57 +0000)]
[SymbolContext] Rewrite operator== to be more concise.

And probably, less error prone. NFCI.

llvm-svn: 350146

5 years agoDrop SE cache early because loop parent can change in LoopSimplifyCFG
Max Kazantsev [Sat, 29 Dec 2018 04:26:22 +0000 (04:26 +0000)]
Drop SE cache early because loop parent can change in LoopSimplifyCFG

llvm-svn: 350145

5 years ago[WebAssembly] Fix comments in ExplicitLocals (NFC)
Heejin Ahn [Sat, 29 Dec 2018 02:42:04 +0000 (02:42 +0000)]
[WebAssembly] Fix comments in ExplicitLocals (NFC)

llvm-svn: 350144

5 years agoAdd vtable anchor to classes.
Richard Trieu [Sat, 29 Dec 2018 02:02:30 +0000 (02:02 +0000)]
Add vtable anchor to classes.

llvm-svn: 350143

5 years agoAdd vtable anchor to classes.
Richard Trieu [Sat, 29 Dec 2018 02:02:13 +0000 (02:02 +0000)]
Add vtable anchor to classes.

llvm-svn: 350142

5 years ago[X86] Don't mark SEXTLOAD v4i8->v4i64 and v8i8->v8i64 as custom under vector widening...
Craig Topper [Sat, 29 Dec 2018 01:17:11 +0000 (01:17 +0000)]
[X86] Don't mark SEXTLOAD v4i8->v4i64 and v8i8->v8i64 as custom under vector widening legalization.

This was tricking us into making these operations and then letting them get scalarized later. But I can't prove that the scalarized version is actually better.

llvm-svn: 350141

5 years agoReenable hard_rss_limit_mb_test.cc for android-26
Kamil Rytarowski [Sat, 29 Dec 2018 00:35:49 +0000 (00:35 +0000)]
Reenable hard_rss_limit_mb_test.cc for android-26

Noted by eugenis@ in D55887.

llvm-svn: 350140

5 years agoAdd support for background thread on NetBSD in ASan
Kamil Rytarowski [Sat, 29 Dec 2018 00:32:07 +0000 (00:32 +0000)]
Add support for background thread on NetBSD in ASan

Summary:
Change the point of calling MaybeStartBackgroudThread() from AsanInitInternal()
that is too early on NetBSD to a constructor (with aid of C++11 lambda construct).

Enable the code for background thread as is for NetBSD.

Rename test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc
to test/sanitizer_common/TestCases/hard_rss_limit_mb_test.cc and allow runs
on NetBSD. This tests passes correctly.

Reviewers: vitalybuka, joerg, eugenis

Reviewed By: eugenis

Subscribers: eugenis, kubamracek, fedor.sergeev, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350139

5 years ago[Sanitizer] Enable getfsent api for Darwin
David Carlier [Sat, 29 Dec 2018 00:17:21 +0000 (00:17 +0000)]
[Sanitizer] Enable getfsent api for Darwin

Reviewers: vitalybuka, kubamracek

Reviewed By: vitalybuka

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

llvm-svn: 350138

5 years ago[OPENMP][NVPTX]Added/fixed debugging messages, NFC.
Alexey Bataev [Fri, 28 Dec 2018 21:36:09 +0000 (21:36 +0000)]
[OPENMP][NVPTX]Added/fixed debugging messages, NFC.

Summary: Added or fixed new/old debugging messages for the better diagnostics.

Reviewers: gtbercea, kkwli0, grokos

Reviewed By: grokos

Subscribers: caomhin, guansong, openmp-commits

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

llvm-svn: 350137

5 years agoIntroduce `LocalAddressSpaceView::LoadWritable(...)` and make the `Load(...)` method...
Dan Liew [Fri, 28 Dec 2018 19:30:51 +0000 (19:30 +0000)]
Introduce `LocalAddressSpaceView::LoadWritable(...)` and make the `Load(...)` method return a const pointer.

Summary:
This is a follow-up to r346956 (https://reviews.llvm.org/D53975).

The purpose of this change to allow implementers of the
`AddressSpaceView` to be able to distinguish between when a caller wants
read-only memory and when a caller wants writable memory. Being able
distinguish these cases allows implementations to optimize for the
different cases and also provides a way to workaround possible platform
restrictions (e.g. the low level platform interface for reading
out-of-process memory may place memory in read-only pages).

For allocator enumeration in almost all cases read-only is sufficient so
we make `Load(...)` take on this new requirement and introduce the
`LoadWritable(...)` variants for cases where memory needs to be
writable.

The behaviour of `LoadWritable(...)` documented in comments are
deliberately very restrictive so that it will be possible in the future
to implement a simple write-cache (i.e. just a map from target address
to a writable region of memory). These restrictions can be loosened in
the future if necessary by implementing a more sophisticated
write-cache.

rdar://problem/45284065

Reviewers: kcc, cryptoad, eugenis, kubamracek, george.karpenkov

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 350136

5 years ago[UnrollRuntime] NFC: Updated exiting tests and added more tests
Anna Thomas [Fri, 28 Dec 2018 19:21:50 +0000 (19:21 +0000)]
[UnrollRuntime] NFC: Updated exiting tests and added more tests

Added more tests for multiple exiting blocks to the LatchExit.
Today these cases are not supported. Patch to follow soon.

llvm-svn: 350135

5 years ago[X86] Directly emit X86ISD::PMULUDQ from the ReplaceNodeResults handling of v2i8...
Craig Topper [Fri, 28 Dec 2018 19:19:39 +0000 (19:19 +0000)]
[X86] Directly emit X86ISD::PMULUDQ from the ReplaceNodeResults handling of v2i8/v2i16/v2i32 multiply.

Previously we emitted a multiply and some masking that was supposed to matched to PMULUDQ, but the masking could sometimes be removed before we got a chance to match it. So instead just emit the PMULUDQ directly.

Remove the DAG combine that was added when the ReplaceNodeResults code was originally added. Add a new DAG combine to avoid regressions in shrink_vmul.ll

Some of the shrink_vmul.ll test cases now pick PMULUDQ instead of PMADDWD/PMULLD, but I think this should be an improvement on most CPUs.

I think all of this can go away if/when we switch to -x86-experimental-vector-widening-legalization

llvm-svn: 350134

5 years ago[clang-tidy] Export the abseil duration inverse lookup function, NFC
Hyrum Wright [Fri, 28 Dec 2018 19:04:21 +0000 (19:04 +0000)]
[clang-tidy] Export the abseil duration inverse lookup function, NFC

This allows other tools to use this function.

llvm-svn: 350133

5 years agoSpeculative fix for xray assembler error on MachO since r349976
Reid Kleckner [Fri, 28 Dec 2018 18:53:00 +0000 (18:53 +0000)]
Speculative fix for xray assembler error on MachO since r349976

This .file directive wasn't doing anything on MachO, and now that's
diagnosed as an error.

llvm-svn: 350132

5 years ago[UnrollRuntime] NFC: Add comment and verify LCSSA
Anna Thomas [Fri, 28 Dec 2018 18:52:16 +0000 (18:52 +0000)]
[UnrollRuntime] NFC: Add comment and verify LCSSA

Added -verify-loop-lcssa to test cases.
Updated comments in ConnectProlog.

llvm-svn: 350131

5 years ago[objc-gnustep2] Fix a bug in category generation.
David Chisnall [Fri, 28 Dec 2018 17:44:54 +0000 (17:44 +0000)]
[objc-gnustep2] Fix a bug in category generation.

We were not emitting a protocol definition while generating the category
method list.  This was fine in most cases, because something else in the
library typically referenced any given protocol, but it caused linker
failures if the category was the only reference to a given protocol.

llvm-svn: 350130

5 years ago[OPENMP][NVPTX]Fixed initialization of the data-sharing interface.
Alexey Bataev [Fri, 28 Dec 2018 17:31:06 +0000 (17:31 +0000)]
[OPENMP][NVPTX]Fixed initialization of the data-sharing interface.

Summary:
Avoid using of the atomic loop to wait for the completion of the
data-sharing interface initialization, use __shfl_sync instead for the
communication within the warp to signal other threads in the warp about
completion of the initialization.

Reviewers: gtbercea, kkwli0, grokos

Subscribers: guansong, jfb, caomhin, openmp-commits

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

llvm-svn: 350129

5 years ago[OPENMP][NVPTX]Outline assert into noinline function, NFC.
Alexey Bataev [Fri, 28 Dec 2018 17:29:47 +0000 (17:29 +0000)]
[OPENMP][NVPTX]Outline assert into noinline function, NFC.

Summary:
At high optimization level asserts lead to some unexpected results
because of auto-inserted unreachable instructions. This outlining
prevents some of such dangerous optimizations and leads to better
stability.

Reviewers: gtbercea, kkwli0, grokos

Subscribers: guansong, caomhin, openmp-commits

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

llvm-svn: 350128

5 years ago[OPENMP]Fix processing of the clauses on target combined directives.
Alexey Bataev [Fri, 28 Dec 2018 17:27:32 +0000 (17:27 +0000)]
[OPENMP]Fix processing of the clauses on target combined directives.

For constants with the predefined data-sharing clauses we may had
troubles with the target combined directives. It may cause compiler
crash in some corner cases.

llvm-svn: 350127

5 years ago[AArch64] Add command-line option for SB
Diogo N. Sampaio [Fri, 28 Dec 2018 17:14:58 +0000 (17:14 +0000)]
[AArch64] Add command-line option for SB

SB (Speculative Barrier) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds a command
line option to enable SB, as it was previously only possible to
enable by selecting -march=armv8.5-a.

This patch also moves to FeatureSB the old FeatureSpecRestrict.

Reviewers: pbarrio, olista01, t.p.northover, LukeCheeseman

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

llvm-svn: 350126

5 years ago[CodeView] Extend the `MemberAttributes` interface with the `isStatic` method
Aleksandr Urakov [Fri, 28 Dec 2018 17:03:24 +0000 (17:03 +0000)]
[CodeView] Extend the `MemberAttributes` interface with the `isStatic` method

Summary:
This patch extends the MemberAttributes interface with the isStatic method.
It is needed for D56126.

Reviewers: zturner, rnk

Reviewed By: zturner

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

llvm-svn: 350125

5 years ago[Sanitizer] arc4random unit test missing case.
David Carlier [Fri, 28 Dec 2018 16:36:05 +0000 (16:36 +0000)]
[Sanitizer] arc4random unit test missing case.

llvm-svn: 350124

5 years ago[Sanitizer] Intercept arc4random_buf / arc4random_addrandom on FreeBSD/NetBSD
David Carlier [Fri, 28 Dec 2018 16:04:28 +0000 (16:04 +0000)]
[Sanitizer] Intercept arc4random_buf / arc4random_addrandom on FreeBSD/NetBSD

- Disabled on purpose on Android and Darwin platform (for now).
- Darwin supports it, would need interception in its specific code before enabling it.
- Linux does not support it but only via third party library.
- Android supports it via bionic however it is known to have issue with older versions of the implementations. Can be enabled by an Android committer later on if necessary once there is more 'certainity'/been more tested.

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 350123

5 years agoFix signed-unsigned comparisons in MinidumpParserTest
Pavel Labath [Fri, 28 Dec 2018 13:34:50 +0000 (13:34 +0000)]
Fix signed-unsigned comparisons in MinidumpParserTest

llvm-svn: 350122

5 years agoRemove unused variable from ClangASTContext
Pavel Labath [Fri, 28 Dec 2018 13:34:44 +0000 (13:34 +0000)]
Remove unused variable from ClangASTContext

llvm-svn: 350121

5 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description.
Dmitry Preobrazhensky [Fri, 28 Dec 2018 11:48:23 +0000 (11:48 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description.

Minor bugfixing and improvements.

See bug 36572: https://bugs.llvm.org/show_bug.cgi?id=36572

llvm-svn: 350120

5 years ago[NFC] Add failing test on LCSSA form preservation of LoopSimplifyCFG
Max Kazantsev [Fri, 28 Dec 2018 10:43:37 +0000 (10:43 +0000)]
[NFC] Add failing test on LCSSA form preservation of LoopSimplifyCFG

llvm-svn: 350119

5 years ago[PowerPC] handle ISD:TRUNCATE in BitPermutationSelector
Hiroshi Inoue [Fri, 28 Dec 2018 08:00:39 +0000 (08:00 +0000)]
[PowerPC] handle ISD:TRUNCATE in BitPermutationSelector

This is the last one in a series of patches to support better code generation for bitfield insert.
BitPermutationSelector already support ISD::ZERO_EXTEND but not TRUNCATE.
This patch adds support for ISD:TRUNCATE in BitPermutationSelector.

For example of this test case,
struct s64b {
  int a:4;
  int b:16;
  int c:24;
};
void bitfieldinsert64b(struct s64b *p, unsigned char v) {
  p->b = v;
}

the selection DAG loos like:

t14: i32,ch = load<(load 4 from %ir.0)> t0, t2, undef:i64
       t18: i32 = and t14, Constant:i32<-1048561>
            t4: i64,ch = CopyFromReg t0, Register:i64 %1
          t22: i64 = AssertZext t4, ValueType:ch:i8
        t23: i32 = truncate t22
      t16: i32 = shl nuw nsw t23, Constant:i32<4>
    t19: i32 = or t18, t16
  t20: ch = store<(store 4 into %ir.0)> t14:1, t19, t2, undef:i64

By handling truncate in the BitPermutationSelector, we can use information from AssertZext when selecting t19 and skip the mask operation corresponding to t18.
So the generated sequences with and without this patch are

without this patch
rlwinm 5, 5, 0, 28, 11 # corresponding to t18
rlwimi 5, 4, 4, 20, 27
with this patch
rlwimi 5, 4, 4, 12, 27

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

llvm-svn: 350118

5 years agoTemporarily disable term folding in LoopSimplifyCFG, add tests
Max Kazantsev [Fri, 28 Dec 2018 06:22:39 +0000 (06:22 +0000)]
Temporarily disable term folding in LoopSimplifyCFG, add tests

llvm-svn: 350117

5 years ago[LoopSimplifyCFG] Delete dead blocks in RPO
Max Kazantsev [Fri, 28 Dec 2018 06:08:51 +0000 (06:08 +0000)]
[LoopSimplifyCFG] Delete dead blocks in RPO

Deletion of dead blocks in arbitrary order may lead to failure
of assertion in `DeleteDeadBlock` that requires that we have
deleted all predecessors before we can delete the current block.
We should instead delete them in RPO order.

llvm-svn: 350116

5 years ago[PowerPC] Remove the implicit use of the register if it is replaced by Imm
QingShan Zhang [Fri, 28 Dec 2018 03:38:09 +0000 (03:38 +0000)]
[PowerPC] Remove the implicit use of the register if it is replaced by Imm
If we are changing the MI operand from Reg to Imm, we need also handle its implicit use if have.

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

llvm-svn: 350115

5 years ago[NFC] clang-format functions related to r350113
Zi Xuan Wu [Fri, 28 Dec 2018 02:45:17 +0000 (02:45 +0000)]
[NFC] clang-format functions related to r350113

llvm-svn: 350114

5 years ago[PowerPC] Fix assert from machine verify pass that atomic pseudo expanding causes...
Zi Xuan Wu [Fri, 28 Dec 2018 02:12:55 +0000 (02:12 +0000)]
[PowerPC] Fix assert from machine verify pass that atomic pseudo expanding causes mismatched register class

For atomic value operand which less than 4 bytes need to be masked.
And the related operation to calculate the newvalue can be done in 32 bit gprc.
So just use gprc for mask and value calculation.

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

llvm-svn: 350113

5 years agoRevert "[asan] Support running without /proc.", +1
Evgeniy Stepanov [Fri, 28 Dec 2018 01:27:18 +0000 (01:27 +0000)]
Revert "[asan] Support running without /proc.", +1

Revert r350104 "[asan] Fix build on windows."
Revert r350101 "[asan] Support running without /proc."

These changes break Mac build, too.

llvm-svn: 350112

5 years ago[PowerPC] fix register class after converting X-FORM instruction to D-FORM instruction
Chen Zheng [Fri, 28 Dec 2018 01:02:35 +0000 (01:02 +0000)]
[PowerPC] fix register class after converting X-FORM instruction to D-FORM instruction
Differential Revision: https://reviews.llvm.org/D55806

llvm-svn: 350111

5 years agoFix a mistake in previous
Kamil Rytarowski [Fri, 28 Dec 2018 00:17:37 +0000 (00:17 +0000)]
Fix a mistake in previous

Assign correct ioctl(2) operation number.

llvm-svn: 350110

5 years ago[CallSite removal] Add and flesh out APIs on the new `CallBase` base class that previ...
Chandler Carruth [Thu, 27 Dec 2018 23:40:17 +0000 (23:40 +0000)]
[CallSite removal] Add and flesh out APIs on the new `CallBase` base class that previously were only available on the `CallSite` wrapper.

Summary:
This will make migrating code easier and generally seems like a good collection
of API improvements.

Some of these APIs seem like more consistent / better naming of existing
ones. I've retained the old names for migration simplicit and am just
adding the new ones in this commit. I'll try to garbage collect these
once CallSite is gone.

Subscribers: sanjoy, mcrosier, hiraditya, llvm-commits

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

llvm-svn: 350109

5 years ago[gn build] Add check-clang target and make it work
Nico Weber [Thu, 27 Dec 2018 23:38:58 +0000 (23:38 +0000)]
[gn build] Add check-clang target and make it work

With this, check-clang runs and passes all of clang's lit tests. It doesn't run
any of its unit tests yet.

Like with check-lld, running just ninja -C out/gn will build all prerequisites
needed to run tests, but it won't run the tests (so that the build becomes
clean after one build). Running ninja -C out/gn check-clang will build
prerequisites if needed and run the tests. The check-clang target never becomes
clean and runs tests every time.

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

llvm-svn: 350108