platform/upstream/llvm.git
5 years ago[OPENMP][NVPTX]Use __kmpc_barrier_simple_spmd(nullptr, 0) instead of
Alexey Bataev [Thu, 3 Jan 2019 16:25:35 +0000 (16:25 +0000)]
[OPENMP][NVPTX]Use __kmpc_barrier_simple_spmd(nullptr, 0) instead of
nvvm_barrier0.

Use runtime functions instead of the direct call to the nvvm intrinsics.
It allows to prevent some dangerous LLVM optimizations, that breaks the
code for the NVPTX target.

llvm-svn: 350328

5 years agoPython compat - no explicit reference to Python version
Serge Guelton [Thu, 3 Jan 2019 15:44:24 +0000 (15:44 +0000)]
Python compat - no explicit reference to Python version

Update documentation and shebang.

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

llvm-svn: 350327

5 years agoPython compat - iterator protocol
Serge Guelton [Thu, 3 Jan 2019 15:43:14 +0000 (15:43 +0000)]
Python compat - iterator protocol

In Python2 next() is used wile it's __next__ in Python3.

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

llvm-svn: 350326

5 years ago[clangd] Move helpers from global namespace into anonymous namespace, NFC.
Haojian Wu [Thu, 3 Jan 2019 15:36:18 +0000 (15:36 +0000)]
[clangd] Move helpers from global namespace into anonymous namespace, NFC.

llvm-svn: 350325

5 years ago[clangd] Bump vscode-clangd v0.0.9
Haojian Wu [Thu, 3 Jan 2019 15:28:38 +0000 (15:28 +0000)]
[clangd] Bump vscode-clangd v0.0.9

llvm-svn: 350324

5 years ago[CostModel][X86] Add truncate cost tests to cover all legal destination types
Simon Pilgrim [Thu, 3 Jan 2019 14:49:39 +0000 (14:49 +0000)]
[CostModel][X86] Add truncate cost tests to cover all legal destination types

We were only testing costs for legal source vector element counts

llvm-svn: 350323

5 years ago[MCA] Improve code comment and reuse an helper function in ResourceManager. NFCI
Andrea Di Biagio [Thu, 3 Jan 2019 14:47:46 +0000 (14:47 +0000)]
[MCA] Improve code comment and reuse an helper function in ResourceManager. NFCI

llvm-svn: 350322

5 years ago[RISCV][MC] Accept %lo and %pcrel_lo on operands to li
Alex Bradbury [Thu, 3 Jan 2019 14:41:41 +0000 (14:41 +0000)]
[RISCV][MC] Accept %lo and %pcrel_lo on operands to li

This matches GNU assembler behaviour.

llvm-svn: 350321

5 years agoPython compat - decode/encode string
Serge Guelton [Thu, 3 Jan 2019 14:40:34 +0000 (14:40 +0000)]
Python compat - decode/encode string

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

llvm-svn: 350320

5 years agoPortable Python script across Python version
Serge Guelton [Thu, 3 Jan 2019 14:27:05 +0000 (14:27 +0000)]
Portable Python script across Python version

Get rid of Python version specific shebang.

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

llvm-svn: 350319

5 years agoPortable Python script across Python version
Serge Guelton [Thu, 3 Jan 2019 14:26:56 +0000 (14:26 +0000)]
Portable Python script across Python version

StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use.

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

llvm-svn: 350318

5 years agoDiagnose an unused result from a call through a function pointer whose return type...
Aaron Ballman [Thu, 3 Jan 2019 14:24:31 +0000 (14:24 +0000)]
Diagnose an unused result from a call through a function pointer whose return type is marked [[nodiscard]].

When a function returns a type and that type was declared [[nodiscard]], we diagnose any unused results from that call as though the function were marked nodiscard. The same behavior should apply to calls through a function pointer.

This addresses PR31526.

llvm-svn: 350317

5 years agoPython compat - test if type is integral
Serge Guelton [Thu, 3 Jan 2019 14:12:50 +0000 (14:12 +0000)]
Python compat - test if type is integral

Rely on numbers.Integral instead of int/long

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

llvm-svn: 350316

5 years agoPython compat - urllib
Serge Guelton [Thu, 3 Jan 2019 14:12:44 +0000 (14:12 +0000)]
Python compat - urllib

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

llvm-svn: 350315

5 years agoPython compat - has_key vs. in operator
Serge Guelton [Thu, 3 Jan 2019 14:12:37 +0000 (14:12 +0000)]
Python compat - has_key vs. in operator

Use portable `in` operator instead of `has_key(...)` method.

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

llvm-svn: 350314

5 years agoPython compat - map/filter
Serge Guelton [Thu, 3 Jan 2019 14:12:30 +0000 (14:12 +0000)]
Python compat - map/filter

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

llvm-svn: 350313

5 years agoPython compat - iteritems() vs. items()
Serge Guelton [Thu, 3 Jan 2019 14:12:23 +0000 (14:12 +0000)]
Python compat - iteritems() vs. items()

Always use `items()` and introduce extra `list(...)` call when needed.

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

llvm-svn: 350312

5 years agoPython compat - portable way of raising exceptions
Serge Guelton [Thu, 3 Jan 2019 14:12:13 +0000 (14:12 +0000)]
Python compat - portable way of raising exceptions

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

llvm-svn: 350311

5 years ago[NFC] Remove unused Python import
Serge Guelton [Thu, 3 Jan 2019 14:12:07 +0000 (14:12 +0000)]
[NFC] Remove unused Python import

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

llvm-svn: 350310

5 years agoPythran compat - range vs. xrange
Serge Guelton [Thu, 3 Jan 2019 14:11:58 +0000 (14:11 +0000)]
Pythran compat - range vs. xrange

Use range instead of xrange whenever possible. The extra list creation in Python2
is generally not a performance bottleneck.

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

llvm-svn: 350309

5 years agoPython compat - assertRaisesRegex
Serge Guelton [Thu, 3 Jan 2019 14:11:41 +0000 (14:11 +0000)]
Python compat - assertRaisesRegex

Python3 uses assertRaisesRegex instad of assertRaisesRegexp.

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

llvm-svn: 350308

5 years agoPython compat - print statement
Serge Guelton [Thu, 3 Jan 2019 14:11:33 +0000 (14:11 +0000)]
Python compat - print statement

Make sure all print statements are compatible with Python 2 and Python3 using
the `from __future__ import print_function` statement.

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

llvm-svn: 350307

5 years ago[clangd] Always try to build absolute path
Kadir Cetinkaya [Thu, 3 Jan 2019 13:46:10 +0000 (13:46 +0000)]
[clangd] Always try to build absolute path

Summary:
This only changes behavior in cases when the file itself is a symlink.

When canonicalizing paths do not look at tryGetRealPathName, which
contains the resolved path for files that are symlinks. Instead first build the
absolute path even if it contains some symlinks on the path. Then resolve only
the symlinks on the path and leave it as it is if the file itself is a symlink.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 350306

5 years ago[NewPM] Port Msan
Philip Pfaffe [Thu, 3 Jan 2019 13:42:44 +0000 (13:42 +0000)]
[NewPM] Port Msan

Summary:
Keeping msan a function pass requires replacing the module level initialization:
That means, don't define a ctor function which calls __msan_init, instead just
declare the init function at the first access, and add that to the global ctors
list.

Changes:
- Pull the actual sanitizer and the wrapper pass apart.
- Add a newpm msan pass. The function pass inserts calls to runtime
  library functions, for which it inserts declarations as necessary.
- Update tests.

Caveats:
- There is one test that I dropped, because it specifically tested the
  definition of the ctor.

Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka

Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji

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

llvm-svn: 350305

5 years ago[clangd] Check preceding char when completion triggers on ':' or '>'
Ilya Biryukov [Thu, 3 Jan 2019 13:37:12 +0000 (13:37 +0000)]
[clangd] Check preceding char when completion triggers on ':' or '>'

Summary:
Only run completion when we were trigerred on '->' and '::', otherwise
send an error code in return.
To avoid automatically invoking completions in cases like 'a >^' or
'a ? b :^'.

Reviewers: hokein

Reviewed By: hokein

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 350304

5 years ago[clangd] clang-format everything. NFC
Ilya Biryukov [Thu, 3 Jan 2019 13:28:05 +0000 (13:28 +0000)]
[clangd] clang-format everything. NFC

llvm-svn: 350303

5 years ago[NFC] Fix missing testfile change of rL350299
Diogo N. Sampaio [Thu, 3 Jan 2019 12:48:06 +0000 (12:48 +0000)]
[NFC] Fix missing testfile change of rL350299

This file was missing on the patch

llvm-svn: 350302

5 years ago[X86] Cleanup saturated add/sub tests
Simon Pilgrim [Thu, 3 Jan 2019 12:31:13 +0000 (12:31 +0000)]
[X86] Cleanup saturated add/sub tests
Use X86/X64 check prefixes
Use nounwind to reduce cfi noise

llvm-svn: 350301

5 years ago[SLPVectorizer] Flag ADD/SUB SSAT/USAT intrinsics trivially vectorizable (PR40123)
Simon Pilgrim [Thu, 3 Jan 2019 12:18:23 +0000 (12:18 +0000)]
[SLPVectorizer] Flag ADD/SUB SSAT/USAT intrinsics trivially vectorizable (PR40123)

Enables SLP vectorization for the SSE2 PADDS/PADDUS/PSUBS/PSUBUS style intrinsics

llvm-svn: 350300

5 years ago[ARM] Add command-line option for SB
Diogo N. Sampaio [Thu, 3 Jan 2019 12:09:12 +0000 (12:09 +0000)]
[ARM] 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 renames FeatureSpecRestrict to FeatureSB.

Reviewed By: olista01, LukeCheeseman

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

llvm-svn: 350299

5 years agoPECOFF: Remove tabs introduced accidentally in r350094
Pavel Labath [Thu, 3 Jan 2019 12:07:38 +0000 (12:07 +0000)]
PECOFF: Remove tabs introduced accidentally in r350094

llvm-svn: 350298

5 years ago[SLPVectorizer][X86] Add ADD/SUB SSAT/USAT tests (PR40123)
Simon Pilgrim [Thu, 3 Jan 2019 12:02:14 +0000 (12:02 +0000)]
[SLPVectorizer][X86] Add ADD/SUB SSAT/USAT tests (PR40123)

llvm-svn: 350297

5 years ago[MachinePipeliner] Add missing header file to MachinePipeliner.h
Lama Saba [Thu, 3 Jan 2019 11:56:27 +0000 (11:56 +0000)]
[MachinePipeliner] Add missing header file to MachinePipeliner.h

llvm-svn: 350296

5 years ago[X86] Add ADD/SUB SSAT/USAT vector costs (PR40123)
Simon Pilgrim [Thu, 3 Jan 2019 11:38:42 +0000 (11:38 +0000)]
[X86] Add ADD/SUB SSAT/USAT vector costs (PR40123)

Costs for real SSE2 instructions

llvm-svn: 350295

5 years agoFix some -Wreorder warnings introduced in r350274
Pavel Labath [Thu, 3 Jan 2019 11:31:50 +0000 (11:31 +0000)]
Fix some -Wreorder warnings introduced in r350274

llvm-svn: 350294

5 years ago[X86] Add ADD/SUB SSAT/USAT cost tests (PR40123)
Simon Pilgrim [Thu, 3 Jan 2019 11:29:24 +0000 (11:29 +0000)]
[X86] Add ADD/SUB SSAT/USAT cost tests (PR40123)

llvm-svn: 350293

5 years ago[AMDGPU] Change section name with metadata access
Piotr Sobczak [Thu, 3 Jan 2019 11:22:58 +0000 (11:22 +0000)]
[AMDGPU] Change section name with metadata access

Summary:
The commit rL348922 introduced a means to set Metadata
section kind for a global variable, if its explicit section
name was prefixed with ".AMDGPU.metadata.".

This patch changes that prefix to ".AMDGPU.comment.",
as "metadata" in the section name might lead to
ambiguity with metadata used by AMD PAL runtime.

Change-Id: Idd4748800d6fe801441d91595fc21e5a4171e668

Reviewers: kzhuravl

Reviewed By: kzhuravl

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

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

llvm-svn: 350292

5 years agoSimplify ObjectFile::GetArchitecture
Pavel Labath [Thu, 3 Jan 2019 10:37:19 +0000 (10:37 +0000)]
Simplify ObjectFile::GetArchitecture

Summary:
instead of returning the architecture through by-ref argument and a
boolean value indicating success, we can just return the ArchSpec
directly. Since the ArchSpec already has an invalid state, it can be
used to denote the failure without the additional bool.

Reviewers: clayborg, zturner, espindola

Subscribers: emaste, arichardson, JDevlieghere, lldb-commits

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

llvm-svn: 350291

5 years agoResubmit rL345008 "Split MachinePipeliner code into header and cpp files"
Lama Saba [Thu, 3 Jan 2019 10:03:54 +0000 (10:03 +0000)]
Resubmit rL345008 "Split MachinePipeliner code into header and cpp files"

The commit caused unclear failures in http://green.lab.llvm.org/green//job/lldb-cmake/
will revert if the error reappears

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

llvm-svn: 350290

5 years ago[CodeGen] Skip over dbg-instr in twoaddr pass
Markus Lavin [Thu, 3 Jan 2019 08:36:06 +0000 (08:36 +0000)]
[CodeGen] Skip over dbg-instr in twoaddr pass

A DBG_VALUE between a two-address instruction and a following COPY
would prevent rescheduleMIBelowKill optimization inside
TwoAddressInstructionPass.

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

llvm-svn: 350289

5 years ago[llvm-readobj] [COFF] Print the symbol index for relocations
Martin Storsjo [Thu, 3 Jan 2019 08:08:23 +0000 (08:08 +0000)]
[llvm-readobj] [COFF] Print the symbol index for relocations

There can be multiple local symbols with the same name (for e.g.
comdat sections), and thus the symbol name itself isn't enough
to disambiguate symbols.

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

llvm-svn: 350288

5 years ago[X86] Add test cases for opportunities to use KTEST when check if the result of ANDin...
Craig Topper [Thu, 3 Jan 2019 07:12:54 +0000 (07:12 +0000)]
[X86] Add test cases for opportunities to use KTEST when check if the result of ANDing two mask registers is zero.

The test cases are constructed to avoid folding the AND into a masked compare operation.

Currently we emit a KAND and a KORTEST for these cases.

llvm-svn: 350287

5 years agoDon't go over 80 chars in MCStreamer.cpp. NFC.
Kristina Brooks [Thu, 3 Jan 2019 06:06:38 +0000 (06:06 +0000)]
Don't go over 80 chars in MCStreamer.cpp. NFC.

Fixing up style issues around the area to prepare for
a larger differential.

llvm-svn: 350286

5 years ago[Power9] Enable the Out-of-Order scheduling model for P9 hw
QingShan Zhang [Thu, 3 Jan 2019 05:04:18 +0000 (05:04 +0000)]
[Power9] Enable the Out-of-Order scheduling model for P9 hw

When switched to the MI scheduler for P9, the hardware is modeled as out of order.
However, inside the MI Scheduler algorithm, we still use the in-order scheduling model
as the MicroOpBufferSize isn't set. The MI scheduler take it as the hw cannot buffer
the op. So, only when all the available instructions issued, the pending instruction
could be scheduled. That is not true for our P9 hw in fact.

This patch is trying to enable the Out-of-Order scheduling model. The buffer size 44 is
picked from the P9 hw spec, and the perf test indicate that, its value won't hurt the cpu2017.

With this patch, there are 3 specs improved over 3% and 1 spec deg over 3%. The detail is as follows:

x264_r: +6.95%
cactuBSSN_r: +6.94%
lbm_r: +4.11%
xz_r: -3.85%

And the GEOMEAN for all the C/C++ spec in spec2017 is about 0.18% improved.

Reviewer: Nemanjai
Differential Revision: https://reviews.llvm.org/D55810

llvm-svn: 350285

5 years agoTeach ObjCARC optimizer about equivalent PHIs when eliminating autoreleaseRV/retainRV...
Pete Cooper [Thu, 3 Jan 2019 01:38:08 +0000 (01:38 +0000)]
Teach ObjCARC optimizer about equivalent PHIs when eliminating autoreleaseRV/retainRV pairs

OptimizeAutoreleaseRVCall skips optimizing llvm.objc.autoreleaseReturnValue if it
sees a user which is llvm.objc.retainAutoreleasedReturnValue, and if they have
equivalent arguments (either identical or equivalent PHIs). It then assumes that
ObjCARCOpt::OptimizeRetainRVCall will optimize the pair instead.

Trouble is, ObjCARCOpt::OptimizeRetainRVCall doesn't know about equivalent PHIs
so optimizes in a different way and we are left with an unoptimized llvm.objc.autoreleaseReturnValue.

This teaches ObjCARCOpt::OptimizeRetainRVCall to also understand PHI equivalence.

rdar://problem/47005143

Reviewed By: ahatanak

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

llvm-svn: 350284

5 years agoFix incorrect column numbers in test from r350282.
Alex Lorenz [Thu, 3 Jan 2019 01:30:50 +0000 (01:30 +0000)]
Fix incorrect column numbers in test from r350282.

After the test was reformatted using clang-format the numbers became invalid.

llvm-svn: 350283

5 years ago[libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not Exprs
Alex Lorenz [Thu, 3 Jan 2019 01:13:33 +0000 (01:13 +0000)]
[libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not Exprs

This change ensures that the libclang CXCursor represents the CoroutineBody
and the Coreturn statement using the appropriate CXCursor_UnexposedStmt kind
instead of CXCursor_UnexposedExpr. The problem with CXCursor_UnexposedExpr is
that the consumer functions assumed that CoroutineBody/Coreturn statements
were valid expressions and performed an invalid downcast to Expr causing
assertion failures or other crashes.

rdar://40204290

llvm-svn: 350282

5 years agoCheck that a pointer is valid and fix a log message on Windows
Aaron Smith [Thu, 3 Jan 2019 00:54:08 +0000 (00:54 +0000)]
Check that a pointer is valid and fix a log message on Windows

llvm-svn: 350281

5 years agoFix MSVC visualizer for PointerUnion4
Mike Spertus [Thu, 3 Jan 2019 00:52:54 +0000 (00:52 +0000)]
Fix MSVC visualizer for PointerUnion4

Calculate which item is being held and then display it with the appropriate type. We also
optimize the display of PointerUnion3 to take advantage of our knowing that the IntMask is
always 1 in PointerUnion types

llvm-svn: 350280

5 years ago[LLVM-C] Expand LLVMRelocMode
Robert Widmann [Thu, 3 Jan 2019 00:33:44 +0000 (00:33 +0000)]
[LLVM-C] Expand LLVMRelocMode

Summary: Add read[only|write] PIC relocation models to the C API and teach the TargetMachine API about it.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 350279

5 years agoMake test/Driver/darwin-sdk-version.c pass if the host triple is 32-bit
Nico Weber [Thu, 3 Jan 2019 00:17:02 +0000 (00:17 +0000)]
Make test/Driver/darwin-sdk-version.c pass if the host triple is 32-bit

For some reason, the cmake build on my macbook has
LLVM_HOST_TRIPLE:STRING=i386-apple-darwin16.7.0 .
test/Driver/darwin-sdk-version.c assumed that the host triple is 64-bit, so
make it resilient against 32-bit host triples.

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

llvm-svn: 350278

5 years ago[tblgen][disasm] Emit record names again when decoder conflicts occur.
Daniel Sanders [Thu, 3 Jan 2019 00:14:33 +0000 (00:14 +0000)]
[tblgen][disasm] Emit record names again when decoder conflicts occur.

And add a test for it.

llvm-svn: 350277

5 years ago[gold] emit assembly listing from gold plugin on LTO stage
Teresa Johnson [Wed, 2 Jan 2019 23:48:00 +0000 (23:48 +0000)]
[gold] emit assembly listing from gold plugin on LTO stage

Summary:
Sometimes it's useful to emit assembly after LTO stage to modify it manually. Emitting precodegen bitcode file (via save-temps plugin option) and then feeding it to llc doesn't always give the same binary as original.
This patch is simpler alternative to https://reviews.llvm.org/D24020.

Patch by Denis Bakhvalov.

Reviewers: mehdi_amini, tejohnson

Reviewed By: tejohnson

Subscribers: MaskRay, inglorion, dexonsmith, llvm-commits

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

llvm-svn: 350276

5 years agoMSVC Visualizer for PointerUnion3
Mike Spertus [Wed, 2 Jan 2019 23:46:59 +0000 (23:46 +0000)]
MSVC Visualizer for PointerUnion3

llvm-svn: 350275

5 years agoRearrange bitfield to allow for more space in file_idx.
Adrian Prantl [Wed, 2 Jan 2019 23:37:54 +0000 (23:37 +0000)]
Rearrange bitfield to allow for more space in file_idx.

This is an alternate patch for the bug reported in
https://bugs.llvm.org/show_bug.cgi?id=39816 ("lldb doesn't show a file
of line entry for big project"). This limits the number of lines in a
source file to 32M, which I think is reasonable even for preprocessed
source inputs.

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

llvm-svn: 350274

5 years ago[Documentation] Alphabetical order in Clang-tidy checks changes list.
Eugene Zelenko [Wed, 2 Jan 2019 23:35:57 +0000 (23:35 +0000)]
[Documentation] Alphabetical order in Clang-tidy checks changes list.

llvm-svn: 350273

5 years ago[X86] Add load folding support to the custom isel we do for X86ISD::UMUL/SMUL.
Craig Topper [Wed, 2 Jan 2019 23:24:08 +0000 (23:24 +0000)]
[X86] Add load folding support to the custom isel we do for X86ISD::UMUL/SMUL.

The peephole pass isn't always able to fold the load because it can't commute the implicit usage of AL/AX/EAX/RAX.

llvm-svn: 350272

5 years ago[X86] Add test cases to show that we fail to fold loads into i8 smulo and i8/i16...
Craig Topper [Wed, 2 Jan 2019 23:24:03 +0000 (23:24 +0000)]
[X86] Add test cases to show that we fail to fold loads into i8 smulo and i8/i16/i32/i64 umulo lowering without the assistance of the peephole pass. NFC

llvm-svn: 350271

5 years ago[WebAssembly] made assembler parse block_type
Wouter van Oortmerssen [Wed, 2 Jan 2019 23:23:51 +0000 (23:23 +0000)]
[WebAssembly] made assembler parse block_type

Summary:
This was previously ignored and an incorrect value generated.

Also fixed Disassembler's handling of block_type.

Reviewers: dschuff, aheejin

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 350270

5 years ago[ThinLTO] Scan all variants of vague symbol for reachability.
Xin Tong [Wed, 2 Jan 2019 23:18:20 +0000 (23:18 +0000)]
[ThinLTO] Scan all variants of vague symbol for reachability.

Summary:
Alias can make one (but not all) live, we still need to scan all others if this symbol is reachable
from somewhere else.

Reviewers: tejohnson, grimar

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 350269

5 years ago[Driver] Remove unused imports
Jonas Devlieghere [Wed, 2 Jan 2019 22:38:16 +0000 (22:38 +0000)]
[Driver] Remove unused imports

Removes some unneeded includes from the driver.

llvm-svn: 350267

5 years agoAdd file-based synching to places missed in r350247.
Adrian Prantl [Wed, 2 Jan 2019 22:37:28 +0000 (22:37 +0000)]
Add file-based synching to places missed in r350247.

llvm-svn: 350266

5 years ago[BDCE] Fix typo in test; NFC
Nikita Popov [Wed, 2 Jan 2019 22:34:32 +0000 (22:34 +0000)]
[BDCE] Fix typo in test; NFC

shl by 32 is undefined. This was intended to be a shl by 31 as part
of a rotate sequence.

llvm-svn: 350265

5 years agoRemove Range.* from Xcode project
Adrian Prantl [Wed, 2 Jan 2019 22:23:51 +0000 (22:23 +0000)]
Remove Range.* from Xcode project

llvm-svn: 350264

5 years agoTry to fix Green Dragon bot.
Zachary Turner [Wed, 2 Jan 2019 21:04:22 +0000 (21:04 +0000)]
Try to fix Green Dragon bot.

It doesn't like this std::tie() for some reason, hopefuly this
fixes it.

llvm-svn: 350262

5 years agoFix assert in ObjCARC optimizer when deleting retainBlock of null or undef.
Pete Cooper [Wed, 2 Jan 2019 21:00:02 +0000 (21:00 +0000)]
Fix assert in ObjCARC optimizer when deleting retainBlock of null or undef.

The caller to EraseInstruction had this conditional:

    // ARC calls with null are no-ops. Delete them.
    if (IsNullOrUndef(Arg))

but the assert inside EraseInstruction only allowed ConstantPointerNull and not
undef or bitcasts.

This adds support for both of these cases.

rdar://problem/47003805

llvm-svn: 350261

5 years ago[WebAssembly][NFC] Elaborate on simd-noopt test comment
Thomas Lively [Wed, 2 Jan 2019 20:43:08 +0000 (20:43 +0000)]
[WebAssembly][NFC] Elaborate on simd-noopt test comment

llvm-svn: 350260

5 years ago[Sanitizer] Fix typo in funopen unit test.
David Carlier [Wed, 2 Jan 2019 20:23:47 +0000 (20:23 +0000)]
[Sanitizer] Fix typo in funopen unit test.

llvm-svn: 350259

5 years ago[TSan] Enable detection of lock-order-inversions for Objective-C @synchronized
Julian Lettner [Wed, 2 Jan 2019 20:10:30 +0000 (20:10 +0000)]
[TSan] Enable detection of lock-order-inversions for Objective-C @synchronized

Summary:
@synchronized semantics can be synthesized by using existing mutex_[un]lock operations.

```
@synchronized(obj) {
  // ...
}

=>
{
  mutex_lock(obj);
  // ...
  mutex_unlock(obj);
}
```
Let me know whether you think this a good idea.

Reviewers: dcoughlin, dvyukov, kubamracek, delcypher

Reviewed By: dvyukov

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350258

5 years ago[BDCE] Remove instructions without demanded bits
Nikita Popov [Wed, 2 Jan 2019 20:02:14 +0000 (20:02 +0000)]
[BDCE] Remove instructions without demanded bits

If an instruction has no demanded bits, remove it directly during BDCE,
instead of leaving it for something else to clean up.

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

llvm-svn: 350257

5 years agoGit ignore CLion project configuration files. NFC
Pawel Bylica [Wed, 2 Jan 2019 19:58:07 +0000 (19:58 +0000)]
Git ignore CLion project configuration files. NFC

llvm-svn: 350256

5 years agoFormat AggresiveInstCombine.cpp. NFC
Pawel Bylica [Wed, 2 Jan 2019 19:51:46 +0000 (19:51 +0000)]
Format AggresiveInstCombine.cpp. NFC

llvm-svn: 350255

5 years ago[libomptarget] Added install component for libomptarget
Vyacheslav Zakharin [Wed, 2 Jan 2019 19:39:49 +0000 (19:39 +0000)]
[libomptarget] Added install component for libomptarget

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

llvm-svn: 350254

5 years ago[test] Enable system-linker-elf feature on NetBSD [NFC]
Michal Gorny [Wed, 2 Jan 2019 19:39:26 +0000 (19:39 +0000)]
[test] Enable system-linker-elf feature on NetBSD [NFC]

Since NetBSD uses ELF linker, enable the relevant feature.  It's not
currently used for anything, though.

llvm-svn: 350253

5 years ago[OpenMP] Added support for explicit mapping of classes using 'this' pointer. Differen...
Patrick Lyster [Wed, 2 Jan 2019 19:28:48 +0000 (19:28 +0000)]
[OpenMP] Added support for explicit mapping of classes using 'this' pointer. Differential revision: https://reviews.llvm.org/D55982

llvm-svn: 350252

5 years agoFix linker-defined symbols possibly not being defined when -wrap is used
Thomas Anderson [Wed, 2 Jan 2019 19:28:00 +0000 (19:28 +0000)]
Fix linker-defined symbols possibly not being defined when -wrap is used

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

addWrappedSymbols() must be called before addReservedSymbols() because the
latter only defines reserved symbols when they are undefined in the symbol
table. If addWrappedSymbols() is called after, then addUndefined() is called
which may lazily pull in more object files that could reference reserved
symbols.

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

llvm-svn: 350251

5 years agoFix MSVC PointerUnion visualizer
Mike Spertus [Wed, 2 Jan 2019 19:26:50 +0000 (19:26 +0000)]
Fix MSVC PointerUnion visualizer

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

llvm-svn: 350250

5 years ago[Sanitizer] Disable arc4random seeding apis on for Non NetBSD platforms.
David Carlier [Wed, 2 Jan 2019 19:11:44 +0000 (19:11 +0000)]
[Sanitizer] Disable arc4random seeding apis on for Non NetBSD platforms.

- arc4random_stir / arc4random_addrandom had been made obsolete (and removed) from FreeBSD 12.

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350249

5 years ago[Sanitizer] Enable funopen on FreeBSD
David Carlier [Wed, 2 Jan 2019 19:07:27 +0000 (19:07 +0000)]
[Sanitizer] Enable funopen on FreeBSD

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350248

5 years agoAdd file-based synchronization to flaky test
Adrian Prantl [Wed, 2 Jan 2019 19:06:22 +0000 (19:06 +0000)]
Add file-based synchronization to flaky test

TestQueues is failing randomly on green dragon and I suspect it is
because the enqueued threads haven't executed by the time we expect
them. This patch adds file-based synchronization to the queues.

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

llvm-svn: 350247

5 years ago[sanitizer] Android does not provide <fstab.h>
Evgeniy Stepanov [Wed, 2 Jan 2019 19:05:26 +0000 (19:05 +0000)]
[sanitizer] Android does not provide <fstab.h>

llvm-svn: 350246

5 years ago[X86] Remove X86ISD::INC/DEC. Just select them from X86ISD::ADD/SUB at isel time
Craig Topper [Wed, 2 Jan 2019 19:01:05 +0000 (19:01 +0000)]
[X86] Remove X86ISD::INC/DEC. Just select them from X86ISD::ADD/SUB at isel time

INC/DEC are pretty much the same as ADD/SUB except that they don't update the C flag.

This patch removes the special nodes and just pattern matches from ADD/SUB during isel if the C flag isn't being used.

I had to avoid selecting DEC is the result isn't used. This will become a SUB immediate which will turned into a CMP later by optimizeCompareInstr. This lead to the one test change where we use a CMP instead of a DEC for an overflow intrinsic since we only checked the flag.

This also exposed a hole in our RMW flag matching use of hasNoCarryFlagUses. Our root node for the match is a store and there's no guarantee that all the flag users have been selected yet. So hasNoCarryFlagUses needs to check copyToReg and machine opcodes, but it also needs to check for the pre-match SETCC, SETCC_CARRY, BRCOND, and CMOV opcodes.

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

llvm-svn: 350245

5 years agoUse map::insert instead of try_emplace.
Zachary Turner [Wed, 2 Jan 2019 18:53:11 +0000 (18:53 +0000)]
Use map::insert instead of try_emplace.

try_emplace is C++17.

llvm-svn: 350244

5 years ago[NativePDB] Implement ParseDeclsForContext.
Zachary Turner [Wed, 2 Jan 2019 18:33:54 +0000 (18:33 +0000)]
[NativePDB] Implement ParseDeclsForContext.

This is a first step towards getting lldb-test symbols working
with the native plugin.  There is a remaining issue, which is
that the plugin expects that ParseDeclsForContext will also
create lldb symbols rather than just the decls, but the native
pdb plugin doesn't currently do this.  This will be addressed
in a followup patch.

llvm-svn: 350243

5 years ago[NativePDB] Update function-types-classes test to check VarDecls.
Zachary Turner [Wed, 2 Jan 2019 18:33:32 +0000 (18:33 +0000)]
[NativePDB] Update function-types-classes test to check VarDecls.

A Previous patch added support for creating VarDecls for global
variables.  This patch updates this test to be more strict and
actually check these, not just the types.

llvm-svn: 350242

5 years ago[MS Demangler] Add a flag for dumping types without tag specifier.
Zachary Turner [Wed, 2 Jan 2019 18:33:12 +0000 (18:33 +0000)]
[MS Demangler] Add a flag for dumping types without tag specifier.

Sometimes it's useful to be able to output demangled names without
tag specifiers like "struct", "class", etc.  This patch adds a
flag enabling this.

llvm-svn: 350241

5 years ago[NativePDB] Fix setting breakpoint by file and line.
Zachary Turner [Wed, 2 Jan 2019 18:32:50 +0000 (18:32 +0000)]
[NativePDB] Fix setting breakpoint by file and line.

There were several problems preventing this from working.  The
first is that when the PDB had an absolute path to the main
source file, we would construct an invalid path by prepending the
compilation directory to it anyway.  So we needed to check if the
path is already absolute first.

Second, LLDB assumes that the zero'th item in the support file list
is the main compilation unit.  We were respecting this requirement,
but LLDB *also* requires that file to appear somewhere in the list
starting from index 1 as well.  So the main compilation file should
appear in the support file list twice.  And when parsing a line
table, it expects the LineEntry records to be constructed using
the 1-based index.  With these two fixes we can now set breakpoints
by file and line using the native PDB reader.

llvm-svn: 350240

5 years ago[DAGCombiner] After performing the division by constant optimization for a DIV or...
Craig Topper [Wed, 2 Jan 2019 18:19:07 +0000 (18:19 +0000)]
[DAGCombiner] After performing the division by constant optimization for a DIV or REM node, replace the users of the corresponding REM or DIV node if it exists.

Currently we expand the two nodes separately. This gives DAG combiner an opportunity to optimize the expanded sequence taking into account only one set of users. When we expand the other node we'll create the expansion again, but might not be able to optimize it the same way. So the nodes won't CSE and we'll have two similarish sequences in the same basic block. By expanding both nodes at the same time we'll avoid prematurely optimizing the expansion until both the division and remainder have been replaced.

Improves the test case from PR38217. There may be additional opportunities after this.

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

llvm-svn: 350239

5 years ago[gn build] Add fuzzers in llvm/tools that are needed for check-llvm
Nico Weber [Wed, 2 Jan 2019 18:13:14 +0000 (18:13 +0000)]
[gn build] Add fuzzers in llvm/tools that are needed for check-llvm

Also add a fuzzer() template for defining fuzzers that's similar to
add_llvm_fuzzer in the CMake build, and a build file for dependency
llvm/lib/FuzzMutate.

Also make `assert(defined(...` error strings a bit more self-consistent.

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

llvm-svn: 350238

5 years ago[X86] Adding full coverage of MC encoding for the XOP and LWP ISAs.
Craig Topper [Wed, 2 Jan 2019 18:09:41 +0000 (18:09 +0000)]
[X86] Adding full coverage of MC encoding for the XOP and LWP ISAs.

Adding MC regressions tests to cover the XOP isa set.
This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952

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

llvm-svn: 350237

5 years ago[LegalizeIntegerTypes] When promoting the result of an extract_vector_elt also promot...
Craig Topper [Wed, 2 Jan 2019 17:58:30 +0000 (17:58 +0000)]
[LegalizeIntegerTypes] When promoting the result of an extract_vector_elt also promote the input type if necessary

By also promoting the input type we get a better idea for what scalar type to use. This can provide better results if the result of the extract is sign extended. What was previously happening is that the extract result would be legalized, sometime later the input of the sign extend would be legalized using the result of the extract. Then later the extract input would be legalized forcing a truncate into the input of the sign extend using a replace all uses. This requires DAG combine to combine out the sext/truncate pair. But sometimes we visited the truncate first and messed things up before the sext could be combined.

By creating the extract with the correct scalar type when we create legalize the result type, the truncate will be added right away. Then when the sign_extend input is legalized it will create an any_extend of the truncate which can be optimized by getNode to maybe remove the truncate. And then a sign_extend_inreg. Now DAG combine doesn't have to worry about getting rid of the extend.

This fixes the regression on X86 in D56156.

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

llvm-svn: 350236

5 years ago[DAGCombiner][X86][PowerPC] Teach visitSIGN_EXTEND_INREG to fold (sext_in_reg (aext...
Craig Topper [Wed, 2 Jan 2019 17:58:27 +0000 (17:58 +0000)]
[DAGCombiner][X86][PowerPC] Teach visitSIGN_EXTEND_INREG to fold (sext_in_reg (aext/sext x)) -> (sext x) when x has more than 1 sign bit and the sext_inreg is from one of them.

If x has multiple sign bits than it doesn't matter which one we extend from so we can sext from x's msb instead.

The X86 setcc-combine.ll changes are a little weird. It appears we ended up with a (sext_inreg (aext (trunc (extractelt)))) after type legalization. The sext_inreg+aext now gets optimized by this combine to leave (sext (trunc (extractelt))). Then we visit the trunc before we visit the sext. This ends up changing the truncate to an extractvectorelt from a bitcasted vector. I have a follow up patch to fix this.

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

llvm-svn: 350235

5 years ago[gn build] Add build files for bugpoint-passes and LLVMHello plugins
Nico Weber [Wed, 2 Jan 2019 17:38:22 +0000 (17:38 +0000)]
[gn build] Add build files for bugpoint-passes and LLVMHello plugins

These two plugins are loaded into a host process that contains all LLVM
symbols, so they don't link against anything. This required minor readjustments
to the tablegen() setup of IR.

Needed for check-llvm.

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

llvm-svn: 350234

5 years ago[sanitizer_common] Implement funopen*() interceptors for NetBSD
Michal Gorny [Wed, 2 Jan 2019 17:37:14 +0000 (17:37 +0000)]
[sanitizer_common] Implement funopen*() interceptors for NetBSD

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

llvm-svn: 350233

5 years ago[sanitizer_common] Implement popen, popenve, pclose interceptors
Michal Gorny [Wed, 2 Jan 2019 17:37:09 +0000 (17:37 +0000)]
[sanitizer_common] Implement popen, popenve, pclose interceptors

Implement the interceptors for popen(), pclose() and popenve()
functions.  The first two are POSIX, the third one is specific
to NetBSD.  popen() spawns a process and creates a FILE object piping
data from/to that process.  pclose() closes the pipe and waits for
the process to terminate appropriately.

For the purpose of popen(), the COMMON_INTERCEPTOR_FILE_OPEN macro is
modified to allow null path parameter.

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

llvm-svn: 350232

5 years ago[sanitizer_common] Add tests for NetBSD funopen*() functions
Michal Gorny [Wed, 2 Jan 2019 17:37:04 +0000 (17:37 +0000)]
[sanitizer_common] Add tests for NetBSD funopen*() functions

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

llvm-svn: 350231

5 years ago[sanitizer_common] Add test for popen()
Michal Gorny [Wed, 2 Jan 2019 17:37:00 +0000 (17:37 +0000)]
[sanitizer_common] Add test for popen()

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

llvm-svn: 350230

5 years ago[sanitizer_common] Add tests for more *putc and *getc variants
Michal Gorny [Wed, 2 Jan 2019 17:36:55 +0000 (17:36 +0000)]
[sanitizer_common] Add tests for more *putc and *getc variants

Add tests for the more character-oriented functions, that is:
- fputc(), putc() and putchar()
- getc_unlocked()
- putc_unlocked() and putchar_unlocked()

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

llvm-svn: 350229

5 years ago[sanitizer_common] Fix devname_r() return type on !NetBSD
Michal Gorny [Wed, 2 Jan 2019 17:36:50 +0000 (17:36 +0000)]
[sanitizer_common] Fix devname_r() return type on !NetBSD

Update the interceptor for devname_r() to account for correct return
types on different platforms.  This function returns int on NetBSD
but char* on FreeBSD/OSX.  Noticed by @krytarowski.

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

llvm-svn: 350228

5 years ago[sanitizer_common] Rewrite more Posix tests to use asserts
Michal Gorny [Wed, 2 Jan 2019 17:36:46 +0000 (17:36 +0000)]
[sanitizer_common] Rewrite more Posix tests to use asserts

Rewrite the tests for Posix functions that silently 'return 1'
or 'exit(1)' on error, to instead verbosely report the error using
assert.  This is based on requests made in review of D56136.

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

llvm-svn: 350227