platform/upstream/llvm.git
5 years agoRevert enabling frame pointer elimination on OpenBSD for now.
Brad Smith [Fri, 28 Jun 2019 19:57:51 +0000 (19:57 +0000)]
Revert enabling frame pointer elimination on OpenBSD for now.

llvm-svn: 364679

5 years ago[GVNSink] Add unary FNeg support to GVNSink pass
Cameron McInally [Fri, 28 Jun 2019 19:57:31 +0000 (19:57 +0000)]
[GVNSink] Add unary FNeg support to GVNSink pass

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

llvm-svn: 364678

5 years ago[demangle] Support for C++2a char8_t
Erik Pilkington [Fri, 28 Jun 2019 19:54:19 +0000 (19:54 +0000)]
[demangle] Support for C++2a char8_t

llvm-svn: 364677

5 years ago[TSan] Fix build build breakage on Android
Julian Lettner [Fri, 28 Jun 2019 19:49:14 +0000 (19:49 +0000)]
[TSan] Fix build build breakage on Android

Introduced in 5be69ebe121d5b6ea284c3dc6d1cd5098c94f353.

llvm-svn: 364676

5 years agoDefault to Secure PLT on PPC for musl libc.
Brad Smith [Fri, 28 Jun 2019 19:48:31 +0000 (19:48 +0000)]
Default to Secure PLT on PPC for musl libc.

This matches the default settings of clang.

llvm-svn: 364675

5 years ago[clang-doc] Handle anonymous namespaces
Julie Hockett [Fri, 28 Jun 2019 19:07:56 +0000 (19:07 +0000)]
[clang-doc] Handle anonymous namespaces

Improves output for anonymous decls, and updates the '--public' flag to exclude everything under an anonymous namespace.

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

llvm-svn: 364674

5 years ago[llvm-ar] Document response file support in --help
Sam Clegg [Fri, 28 Jun 2019 18:48:05 +0000 (18:48 +0000)]
[llvm-ar] Document response file support in --help

Also a test for this.

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

llvm-svn: 364673

5 years agoRe-apply r364600 with fixes.
Lang Hames [Fri, 28 Jun 2019 18:36:59 +0000 (18:36 +0000)]
Re-apply r364600 with fixes.

Fix: MachO/X86_64_RELOC_GOT is a 32-bit reloc, so only compare 32 bits.
llvm-svn: 364672

5 years ago[unittests][Support] Fix LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissio...
Rainer Orth [Fri, 28 Jun 2019 18:29:18 +0000 (18:29 +0000)]
[unittests][Support] Fix LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions on Solaris

LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions currently
FAILs on Solaris:

  FAIL: LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions (2940 of 51555)
  ******************** TEST 'LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions' FAILED ********************
  Note: Google Test filter = FileSystemTest.permissions
  [==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from FileSystemTest
  [ RUN      ] FileSystemTest.permissions
  /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1705: Failure
  Value of: CheckPermissions(fs::sticky_bit)
    Actual: false
  Expected: true
  /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1712: Failure
  Value of: CheckPermissions(fs::set_uid_on_exe | fs::set_gid_on_exe | fs::sticky_bit)
    Actual: false
  Expected: true
  /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1719: Failure
  Value of: CheckPermissions(fs::all_read | fs::set_uid_on_exe | fs::set_gid_on_exe | fs::sticky_bit)
    Actual: false
  Expected: true
  /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1722: Failure
  Value of: CheckPermissions(fs::all_perms)
    Actual: false
  Expected: true
  [  FAILED  ] FileSystemTest.permissions (0 ms)
  [----------] 1 test from FileSystemTest (0 ms total)

  [----------] Global test environment tear-down
  [==========] 1 test from 1 test case ran. (1 ms total)
  [  PASSED  ] 0 tests.
  [  FAILED  ] 1 test, listed below:
  [  FAILED  ] FileSystemTest.permissions

   1 FAILED TEST

Checking with truss reveals that this is the same issue as on AIX and
documented in chmod(2):

  If the process is not a privileged process and the file is not a direc-
  tory, mode bit 01000 (S_ISVTX, the sticky bit) is cleared.

The following patch fixes this in the same way.  Tested on amd64-pc-solaris2.11.

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

llvm-svn: 364671

5 years ago[clang-doc] De-duplicate comments and locations
Julie Hockett [Fri, 28 Jun 2019 18:17:58 +0000 (18:17 +0000)]
[clang-doc] De-duplicate comments and locations

De-duplicate comments and declaration locations in reduce function.
When two files include the same header file, this file's content is mapped
twice causing comments and locations to be duplicated after the reduce stage.

Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com).

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

llvm-svn: 364670

5 years ago[GDBRemote] Remove code that flushes GDB remote packets
Jonas Devlieghere [Fri, 28 Jun 2019 18:14:27 +0000 (18:14 +0000)]
[GDBRemote] Remove code that flushes GDB remote packets

The arbitrary timeout when flushing GDB remote packets caused
non-determinism and flakiness between test runs. I suspect it is what's
causing the flakiness of the reproducer tests on GreenDragon, and want
to see if removing it causes that to go away.

This change was originally introduced in r197579 to discard a
`$T02thread:01;#4` that QEMU was sending. If anybody knows how to test
that this continues working after removing this code, I'd love to hear
it.

llvm-svn: 364669

5 years ago[UpdateChecks] Add support for armv7-apple-darwin
Jinsong Ji [Fri, 28 Jun 2019 18:07:19 +0000 (18:07 +0000)]
[UpdateChecks] Add support for armv7-apple-darwin

armv7-apple-darwin was not supported well, the script can't generate
checks.

https://reviews.llvm.org/D60601/new/#inline-568671

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

llvm-svn: 364668

5 years ago[X86] CombineShuffleWithExtract - recurse through EXTRACT_SUBVECTOR chain
Simon Pilgrim [Fri, 28 Jun 2019 17:57:32 +0000 (17:57 +0000)]
[X86] CombineShuffleWithExtract - recurse through EXTRACT_SUBVECTOR chain

llvm-svn: 364667

5 years agoMake sure the thread list is updated before you set the stop reason
Jim Ingham [Fri, 28 Jun 2019 17:57:19 +0000 (17:57 +0000)]
Make sure the thread list is updated before you set the stop reason
on a thread.  When talking to some older gdb-remote stubs, We were getting
a stop reason from the stop reply packet and setting it on the relevant
thread before we updated the full stop list.  That would get discarded when
the full list was updated.

Also, if you already have a thread list when you go to see if there is an
Operating System plugin, and you do indeed load a new OS plugin, you have to
re-fetch the thread list or it will only show the raw threads.

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

llvm-svn: 364666

5 years agohwasan: Remove the old frame descriptor mechanism.
Peter Collingbourne [Fri, 28 Jun 2019 17:53:26 +0000 (17:53 +0000)]
hwasan: Remove the old frame descriptor mechanism.

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

llvm-svn: 364665

5 years ago[ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.
Volodymyr Sapsai [Fri, 28 Jun 2019 17:42:17 +0000 (17:42 +0000)]
[ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.

`Selector::getIdentifierInfoForSlot` returns NULL if a slot has no
corresponding identifier. Add a boolean to the hash and a NULL check.

rdar://problem/51615164

Reviewers: rtrieu

Reviewed By: rtrieu

Subscribers: dexonsmith, cfe-commits, jkorous

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

llvm-svn: 364664

5 years agoUpdate CODE_OWNERS.txt for clang-doc
Julie Hockett [Fri, 28 Jun 2019 17:32:26 +0000 (17:32 +0000)]
Update CODE_OWNERS.txt for clang-doc

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

llvm-svn: 364663

5 years ago[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.1
Julian Lettner [Fri, 28 Jun 2019 17:27:30 +0000 (17:27 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.1

TSan needs to infer which calls to setjmp/longjmp are corresponding
pairs. My understanding is, that we can't simply use the jmp_buf
address, since this buffer is just a plain data structure storing the
environment (registers) with no additional semantics, i.e., it can be
copied around and is still expected to work. So we use the stack pointer
(SP) instead.

The setjmp interceptor stores some metadata, which is then consumed in
the corresponding call to longjmp. We use the SP as an "index" (stable
identifier) into the metadata table. So far so good.

However, when mangling is used, the setjmp interceptor observes the
UNmangled SP, but the longjmp interceptor only knows the mangled value
for SP. To still correlate corresponding pairs of calls, TSan currently
derives the mangled representation in setjmp and uses it as the stable
identifer, so that longjmp can do it's lookup.

Currently, this works since "mangling" simply means XOR with a secret
value. However, in the future we want to use operations that do not
allow us to easily go from unmangled -> mangled (pointer
authentication). Going from mangled -> unmangled should still be
possible (for pointer authentication it means zeroing a few bits).

This patch is part 1 of changing set/longjmp interceptors to use the
unmangled SP for metadata lookup. Instead of deriving the mangled SP in
setjmp, we will derive the unmangled SP in longjmp. Since this change
involves difficult-to-test code, it will be done in (at least) 2 parts:
This patch only replicates the existing behavior and checks that the
newly computed value for SP matches with what we have been doing so far.
This should help me to fix issues on architectures I cannot test
directly. I tested this patch on x86-64 (Linux/Darwin) and arm64
(Darwin).

This patch will also address an orthogonal issue: there is a lot of code
duplication in the assembly files, because the
`void __tsan_setjmp(uptr sp, uptr mangled_sp)` already demands the
mangled SP. This means that the code for computing the mangled SP is
duplicated at every call site (in assembly).

Reviewed By: dvyukov

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

llvm-svn: 364662

5 years ago[NFC][Codegen] Revisit test coverage for X % C == 0 fold once more (add tests with...
Roman Lebedev [Fri, 28 Jun 2019 17:26:28 +0000 (17:26 +0000)]
[NFC][Codegen] Revisit test coverage for X % C == 0 fold once more (add tests with '1' divisor)

llvm-svn: 364661

5 years ago[COFF] Fix .rsrc sections with differing permissions
Martin Storsjo [Fri, 28 Jun 2019 17:13:52 +0000 (17:13 +0000)]
[COFF] Fix .rsrc sections with differing permissions

GNU windres, and MS cvtres (unless the /readonly option is passed)
produce read-write .rsrc sections, when creating resource object files.
This caused the sections to not be added to the precreated RsrcSec,
and therefore not be added to the data directory.

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

llvm-svn: 364660

5 years ago[WebAssembly] Added visibility and ident directives to WasmAsmParser.
Wouter van Oortmerssen [Fri, 28 Jun 2019 16:51:06 +0000 (16:51 +0000)]
[WebAssembly] Added visibility and ident directives to WasmAsmParser.

Summary:
These are output by clang -S, so can now be roundtripped thru clang.

(partially) fixes: https://bugs.llvm.org/show_bug.cgi?id=34544

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 364658

5 years ago[NFC][InstCombine] Shift amount reassociation: revisit flag preservation tests
Roman Lebedev [Fri, 28 Jun 2019 16:36:53 +0000 (16:36 +0000)]
[NFC][InstCombine] Shift amount reassociation: revisit flag preservation tests

llvm-svn: 364657

5 years ago[AMDGPU][MC] Fix 2 for sanitizer failure in 364645
Dmitry Preobrazhensky [Fri, 28 Jun 2019 16:28:46 +0000 (16:28 +0000)]
[AMDGPU][MC] Fix 2 for sanitizer failure in 364645

llvm-svn: 364656

5 years ago[OPENMP]Fix top DSA for static members.
Alexey Bataev [Fri, 28 Jun 2019 16:16:00 +0000 (16:16 +0000)]
[OPENMP]Fix top DSA for static members.

Fixed handling of the data-sharing attributes for static members when
requesting top most attribute. Previously, it might return the incorrect
attributes for static members if they were overriden in the outer
constructs.

llvm-svn: 364655

5 years ago[ARM] Add support for the MVE long shift instructions
Sam Tebbs [Fri, 28 Jun 2019 15:43:31 +0000 (15:43 +0000)]
[ARM] Add support for the MVE long shift instructions

MVE adds the lsll, lsrl and asrl instructions, which perform a shift on a 64 bit value separated into two 32 bit registers.

The Expand64BitShift function is modified to accept ISD::SHL, ISD::SRL and ISD::SRA and convert it into the appropriate opcode in ARMISD. An SHL is converted into an lsll, an SRL is converted into an lsrl for the immediate form and a negation and lsll for the register form, and SRA is converted into an asrl.

test/CodeGen/ARM/shift_parts.ll is added to test the logic of emitting these instructions.

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

llvm-svn: 364654

5 years ago[llvm-cov[ Fix lcov coverage report contains functions from other compilation units.
Max Moroz [Fri, 28 Jun 2019 15:38:25 +0000 (15:38 +0000)]
[llvm-cov[ Fix lcov coverage report contains functions from other compilation units.

Summary: Patch by Chuan Qiu (@eagleonhill).

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: lebedev.ri, llvm-commits

Tags: #llvm

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

llvm-svn: 364653

5 years ago[NFC][InstCombine] Shift amount reassociation: add flag preservation test
Roman Lebedev [Fri, 28 Jun 2019 15:32:52 +0000 (15:32 +0000)]
[NFC][InstCombine] Shift amount reassociation: add flag preservation test

As discussed in https://reviews.llvm.org/D63812#inline-569870
* exact on both lshr => exact https://rise4fun.com/Alive/plHk
* exact on both ashr => exact https://rise4fun.com/Alive/QDAA
* nuw on both shl => nuw https://rise4fun.com/Alive/5Uk
* nsw on both shl => nsw https://rise4fun.com/Alive/0plg

So basically if the same flag is set on both original shifts -> set it on new shift.
Don't think we can do anything with non-matching flags on shl.

llvm-svn: 364652

5 years ago[AMDGPU][MC] Fix for sanitizer failure in 364645
Dmitry Preobrazhensky [Fri, 28 Jun 2019 15:22:47 +0000 (15:22 +0000)]
[AMDGPU][MC] Fix for sanitizer failure in 364645

llvm-svn: 364651

5 years ago[OPENMP]Fix DSA for loop iteration variables in simd loops.
Alexey Bataev [Fri, 28 Jun 2019 15:16:37 +0000 (15:16 +0000)]
[OPENMP]Fix DSA for loop iteration variables in simd loops.

According to the OpenMP 5.0 standard, the loop iteration variable in the associated
for-loop of a simd construct with just one associated for-loop may be
listed in a private, lastprivate, or linear clause with a linear-step
that is the increment of the associated for-loop. Also, the loop
teration variables in the associated for-loops of a simd construct with
multiple associated for-loops may be listed in a private or lastprivate
clause.

llvm-svn: 364650

5 years ago[NFC][Float2Int] Pre-commit unary FNeg test to basic.ll
Cameron McInally [Fri, 28 Jun 2019 15:12:15 +0000 (15:12 +0000)]
[NFC][Float2Int] Pre-commit unary FNeg test to basic.ll

llvm-svn: 364649

5 years ago[Hexagon] driver uses out-of-date option name and binary name
Krzysztof Parzyszek [Fri, 28 Jun 2019 15:08:03 +0000 (15:08 +0000)]
[Hexagon] driver uses out-of-date option name and binary name

Patch by A. Skrobov (t.yomitch).

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

llvm-svn: 364648

5 years ago[OPENMP]Fix checks for DSA in simd constructs.
Alexey Bataev [Fri, 28 Jun 2019 14:59:25 +0000 (14:59 +0000)]
[OPENMP]Fix checks for DSA in simd constructs.

The errors for incorrectly specified data-sharing attributes for simd
constructs must be emitted only for the explicitly provided clauses, not
the predetermined ones.

llvm-svn: 364647

5 years ago[NFC][NewGVN] Pre-commit unary FNeg test to fpmath.ll
Cameron McInally [Fri, 28 Jun 2019 14:39:58 +0000 (14:39 +0000)]
[NFC][NewGVN] Pre-commit unary FNeg test to fpmath.ll

llvm-svn: 364646

5 years ago[AMDGPU][MC] Enabled constant expressions as operands of sendmsg
Dmitry Preobrazhensky [Fri, 28 Jun 2019 14:14:02 +0000 (14:14 +0000)]
[AMDGPU][MC] Enabled constant expressions as operands of sendmsg

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

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 364645

5 years ago[X86] CombineShuffleWithExtract - only require 1 source to be EXTRACT_SUBVECTOR
Simon Pilgrim [Fri, 28 Jun 2019 12:24:49 +0000 (12:24 +0000)]
[X86] CombineShuffleWithExtract - only require 1 source to be EXTRACT_SUBVECTOR

We were requiring that both shuffle operands were EXTRACT_SUBVECTORs, but we can relax this to only require one of them to be.

Also, we shouldn't bother attempting this if both operands are from the lowest subvector (or not EXTRACT_SUBVECTOR at all).

llvm-svn: 364644

5 years ago[ARM] Add MVE mul patterns
David Green [Fri, 28 Jun 2019 11:44:03 +0000 (11:44 +0000)]
[ARM] Add MVE mul patterns

This simply adds integer and floating point VMUL patterns for MVE, same as we
have add and sub.

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

llvm-svn: 364643

5 years ago[NFC][Codegen] Revisit test coverage for X % C == 0 fold
Roman Lebedev [Fri, 28 Jun 2019 11:36:34 +0000 (11:36 +0000)]
[NFC][Codegen] Revisit test coverage for X % C == 0 fold

llvm-svn: 364642

5 years ago[ARM] Mark math routines as non-legal for MVE
David Green [Fri, 28 Jun 2019 11:17:38 +0000 (11:17 +0000)]
[ARM] Mark math routines as non-legal for MVE

This adds handling and tests for a number of floating point math routines,
which have no MVE instructions.

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

llvm-svn: 364641

5 years ago[ARM] MVE patterns for VABS and VNEG
David Green [Fri, 28 Jun 2019 10:25:35 +0000 (10:25 +0000)]
[ARM] MVE patterns for VABS and VNEG

This simply adds the required patterns for fp neg and abs.

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

llvm-svn: 364640

5 years ago[ELF] Do not produce DT_JMPREL and DT_PLTGOT if .rela.plt is empty.
Igor Kudrin [Fri, 28 Jun 2019 10:14:14 +0000 (10:14 +0000)]
[ELF] Do not produce DT_JMPREL and DT_PLTGOT if .rela.plt is empty.

If .rela.plt is mentioned in a linker script, it might be preserved
even if it is empty. In that case, LLD created DT_JMPREL and DT_PLTGOT
dynamic tags. When the tags exist, a dynamic loader writes values into
reserved slots in .got.plt to support lazy symbol resolution.
The problem is that, in fact, the linker has not reserved that space,
and the writing may occur into the memory allocated for something else.

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

llvm-svn: 364639

5 years ago[DebugInfo] Fix setStartAddress after r364637
Fangrui Song [Fri, 28 Jun 2019 10:10:10 +0000 (10:10 +0000)]
[DebugInfo] Fix setStartAddress after r364637

llvm-svn: 364638

5 years ago[DebugInfo] Simplify GSYM::AddressRange and GSYM::AddressRanges
Fangrui Song [Fri, 28 Jun 2019 10:06:11 +0000 (10:06 +0000)]
[DebugInfo] Simplify GSYM::AddressRange and GSYM::AddressRanges

Delete unnecessary getters of AddressRange.
Simplify AddressRange::size(): Start <= End check should be checked in an upper layer.
Delete isContiguousWith() that doesn't make sense.
Simplify AddressRanges::insert. Delete commented code. Fix it when more than 1 ranges are to be deleted.
Delete trailing newline.

llvm-svn: 364637

5 years ago[ARM] Widening loads and narrowing stores
David Green [Fri, 28 Jun 2019 09:47:55 +0000 (09:47 +0000)]
[ARM] Widening loads and narrowing stores

MVE has instructions to widen as it loads, and narrow as it stores. This adds
the required patterns and legalisation to make them work including specifying
that they are legal, patterns to select them and test changes.

Patch by David Sherwood.

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

llvm-svn: 364636

5 years ago[ARM] Fix integer UB in MVE load/store immediate handling.
Simon Tatham [Fri, 28 Jun 2019 09:28:39 +0000 (09:28 +0000)]
[ARM] Fix integer UB in MVE load/store immediate handling.

llvm-svn: 364635

5 years ago[DebugInfo] GSYM cleanups after D63104/r364427
Fangrui Song [Fri, 28 Jun 2019 08:58:05 +0000 (08:58 +0000)]
[DebugInfo] GSYM cleanups after D63104/r364427

llvm-svn: 364634

5 years ago[ARM] MVE loads and stores
David Green [Fri, 28 Jun 2019 08:41:40 +0000 (08:41 +0000)]
[ARM] MVE loads and stores

This fills in the gaps for basic MVE loads and stores, allowing unaligned
access and adding far too many tests. These will become important as
narrowing/expanding and pre/post inc are added. Big endian might still not be
handled very well, because we have not yet added bitcasts (and I'm not sure how
we want it to work yet). I've included the alignment code anyway which maps
with our current patterns. We plan to return to that later.

Code written by Simon Tatham, with additional tests from Me and Mikhail Maltsev.

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

llvm-svn: 364633

5 years ago[AVR] Don't look for the TargetFrameLowering in the FrameLowering implementation
Dylan McKay [Fri, 28 Jun 2019 08:35:21 +0000 (08:35 +0000)]
[AVR] Don't look for the TargetFrameLowering in the FrameLowering implementation

c.f. r364349

llvm-svn: 364632

5 years ago[ARM] Mark div and rem as expand for MVE
David Green [Fri, 28 Jun 2019 08:18:55 +0000 (08:18 +0000)]
[ARM] Mark div and rem as expand for MVE

We don't have vector operations for these, so they need to be expanded for both
integer and float.

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

llvm-svn: 364631

5 years ago[CTU] Add missing statistics
Gabor Marton [Fri, 28 Jun 2019 08:08:51 +0000 (08:08 +0000)]
[CTU] Add missing statistics

Reviewers: xazax.hun

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 364630

5 years ago[ARM] Select MVE fp add and sub
David Green [Fri, 28 Jun 2019 07:41:09 +0000 (07:41 +0000)]
[ARM] Select MVE fp add and sub

The same as integer arithmetic, we can add simple floating point MVE addition and
subtraction patterns.

Initial code by David Sherwood

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

llvm-svn: 364629

5 years ago[HardwareLoops] Loop counter guard intrinsic
Sam Parker [Fri, 28 Jun 2019 07:38:16 +0000 (07:38 +0000)]
[HardwareLoops] Loop counter guard intrinsic

Introduce llvm.test.set.loop.iterations which sets the loop counter
and also produces an i1 after testing that the count is not zero.

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

llvm-svn: 364628

5 years ago[ARM] Select MVE add and sub
David Green [Fri, 28 Jun 2019 07:21:11 +0000 (07:21 +0000)]
[ARM] Select MVE add and sub

This adds the first few patterns for MVE code generation, adding simple integer
add and sub patterns.

Initial code by David Sherwood

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

llvm-svn: 364627

5 years ago[ARM] MVE vector shuffles
David Green [Fri, 28 Jun 2019 07:08:42 +0000 (07:08 +0000)]
[ARM] MVE vector shuffles

This patch adds necessary shuffle vector and buildvector support for ARM MVE.
It essentially adds support for VDUP, VREVs and some VMOVs, which are often
required by other code (like upcoming patches).

This mostly uses the same code from Neon that already generated
NEONvdup/NEONvduplane/NEONvrev's. These have been renamed to ARMvdup/etc and
moved to ARMInstrInfo as they are common to both architectures. Most of the
selection code seems to be applicable to both, but NEON does have some more
instructions making some parts specific.

Most code originally by David Sherwood.

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

llvm-svn: 364626

5 years ago[X86] Connect the output chain properly when combining vzext_movl+load into vzext_load.
Craig Topper [Fri, 28 Jun 2019 06:58:50 +0000 (06:58 +0000)]
[X86] Connect the output chain properly when combining vzext_movl+load into vzext_load.

llvm-svn: 364625

5 years agoSilence gcc warning in testcase [NFC]
Mikael Holmen [Fri, 28 Jun 2019 06:45:20 +0000 (06:45 +0000)]
Silence gcc warning in testcase [NFC]

Without the fix gcc (7.4.0) complains with

../unittests/ADT/APIntTest.cpp: In member function 'virtual void {anonymous}::APIntTest_MultiplicativeInverseExaustive_Test::TestBody()':
../unittests/ADT/APIntTest.cpp:2510:36: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (unsigned Value = 0; Value < (1 << BitWidth); ++Value) {
                              ~~~~~~^~~~~~~~~~~~~~~~~

llvm-svn: 364624

5 years ago[X86] Remove some duplicate patterns that already exist as part of their instruction...
Craig Topper [Fri, 28 Jun 2019 05:03:47 +0000 (05:03 +0000)]
[X86] Remove some duplicate patterns that already exist as part of their instruction definition. NFC

llvm-svn: 364623

5 years ago[Support] Fix add fs::getUmask() patch
Alex Brachet [Fri, 28 Jun 2019 04:07:13 +0000 (04:07 +0000)]
[Support] Fix add fs::getUmask() patch

llvm-svn: 364622

5 years ago[Support] Add fs::getUmask() function and change fs::setPermissions
Alex Brachet [Fri, 28 Jun 2019 03:21:00 +0000 (03:21 +0000)]
[Support] Add fs::getUmask() function and change fs::setPermissions

Summary: This patch changes fs::setPermissions to optionally set permissions while respecting the umask. It also adds the function fs::getUmask() which returns the current umask.

Reviewers: jhenderson, rupprecht, aprantl, lhames

Reviewed By: jhenderson, rupprecht

Subscribers: sanaanajjar231288, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 364621

5 years ago[NFC][PowerPC] Move XS*QP series instruction apart from XS*QPO series in position...
Zi Xuan Wu [Fri, 28 Jun 2019 02:51:03 +0000 (02:51 +0000)]
[NFC][PowerPC] Move XS*QP series instruction apart from XS*QPO series in position of td file

llvm-svn: 364620

5 years ago[AMDGPU] Packed thread ids in function call ABI
Stanislav Mekhanoshin [Fri, 28 Jun 2019 01:52:13 +0000 (01:52 +0000)]
[AMDGPU] Packed thread ids in function call ABI

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

llvm-svn: 364619

5 years agoGlobalISel: Use Register
Matt Arsenault [Fri, 28 Jun 2019 01:47:44 +0000 (01:47 +0000)]
GlobalISel: Use Register

llvm-svn: 364618

5 years ago[PowerPC][NFC] Use `|=` to update `Simplified` flag
Kai Luo [Fri, 28 Jun 2019 01:38:42 +0000 (01:38 +0000)]
[PowerPC][NFC] Use `|=` to update `Simplified` flag

llvm-svn: 364617

5 years agoAMDGPU/GlobalISel: Convert to using Register
Matt Arsenault [Fri, 28 Jun 2019 01:16:46 +0000 (01:16 +0000)]
AMDGPU/GlobalISel: Convert to using Register

llvm-svn: 364616

5 years agoGlobalISel: Convert rest of MachineIRBuilder to using Register
Matt Arsenault [Fri, 28 Jun 2019 01:16:41 +0000 (01:16 +0000)]
GlobalISel: Convert rest of MachineIRBuilder to using Register

llvm-svn: 364615

5 years agoFixing a couple of wrong logical operator bugs.
Ali Tamur [Fri, 28 Jun 2019 00:11:26 +0000 (00:11 +0000)]
Fixing a couple of wrong logical operator bugs.

llvm-svn: 364614

5 years ago[GlobalISel][IRTranslator] Fix some PHI bugs related to jump tables when optimization...
Amara Emerson [Thu, 27 Jun 2019 23:56:34 +0000 (23:56 +0000)]
[GlobalISel][IRTranslator] Fix some PHI bugs related to jump tables when optimizations are used.

The new switch lowering code that tries to generate jump tables and range checks
were tested at -O0 on arm64, but on -O3 the generic switch lowering code goes to
town on trying to generate optimized lowerings, e.g. multiple jump tables, range
checks etc. This exposed bugs in the way PHI nodes are handled because the CFG
looks even stranger after all of this is done.

llvm-svn: 364613

5 years ago[InlineCost] make InlineCost assignable
Fedor Sergeev [Thu, 27 Jun 2019 23:41:03 +0000 (23:41 +0000)]
[InlineCost] make InlineCost assignable

Summary:
Current InlineCost is not assignable because of const members Cost and Threshold.
I dont see practical benefits from having them const (access to these members is
private and internal interactions are rather simple). On other hand that makes
it hard to use as a member in some other data structure where assignability is necessary.

I'm going to use InlineCost in a downstream inliner that maintains a complex queue
of candidate call-sites and thus keeping and recalculating InlineCost is necessary.

This patch just removes 'const' from both members, making InlineCost assignable.

Reviewers: eraman, greened, chandlerc, yrouban, apilipenko
Reviewed By: apilipenko
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63823

llvm-svn: 364612

5 years agoFix ASAN error caused by commit r364512.
Rumeet Dhindsa [Thu, 27 Jun 2019 23:37:04 +0000 (23:37 +0000)]
Fix ASAN error caused by commit r364512.

This patch intends to fix ASAN stack-use-after-scope error.
This is at least a short-term fix to unbreak LLVM's mainline.

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

llvm-svn: 364611

5 years ago[LangRef] Clarify codegen expectations for intrinsics with fp/integer-only overloads.
Amara Emerson [Thu, 27 Jun 2019 23:33:05 +0000 (23:33 +0000)]
[LangRef] Clarify codegen expectations for intrinsics with fp/integer-only overloads.

This change is a result of discussions on list: "GlobalISel: Ambiguous intrinsic semantics problem"

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

llvm-svn: 364610

5 years agohwasan: Fix an off-by-one error in PrintTagsAroundAddr.
Peter Collingbourne [Thu, 27 Jun 2019 23:24:36 +0000 (23:24 +0000)]
hwasan: Fix an off-by-one error in PrintTagsAroundAddr.

Previously we were printing 16 rows of tags, not 17.

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

llvm-svn: 364609

5 years agohwasan: Use llvm.read_register intrinsic to read the PC on aarch64 instead of taking...
Peter Collingbourne [Thu, 27 Jun 2019 23:24:07 +0000 (23:24 +0000)]
hwasan: Use llvm.read_register intrinsic to read the PC on aarch64 instead of taking the function's address.

This shaves an instruction (and a GOT entry in PIC code) off prologues of
functions with stack variables.

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

llvm-svn: 364608

5 years agohwasan: Teach the runtime to identify the local variable being accessed in UAR reports.
Peter Collingbourne [Thu, 27 Jun 2019 23:16:13 +0000 (23:16 +0000)]
hwasan: Teach the runtime to identify the local variable being accessed in UAR reports.

Each function's PC is recorded in the ring buffer. From there we can access
the function's local variables and reconstruct the tag of each one with the
help of the information printed by llvm-symbolizer's new FRAME command. We
can then find the variable that was likely being accessed by matching the
pointer's tag against the reconstructed tag.

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

llvm-svn: 364607

5 years agoRevert "[JITLink][MachO/x86-64] Add a testcase for X86_64_RELOC_GOT."
Lang Hames [Thu, 27 Jun 2019 23:00:30 +0000 (23:00 +0000)]
Revert "[JITLink][MachO/x86-64] Add a testcase for X86_64_RELOC_GOT."

Reverts commit r364600 while I investigate bot failures.

llvm-svn: 364606

5 years ago[analyzer] Fix clang-tidy crash on GCCAsmStmt
Nathan Huckleberry [Thu, 27 Jun 2019 22:46:40 +0000 (22:46 +0000)]
[analyzer] Fix clang-tidy crash on GCCAsmStmt

Summary:
Added entry in switch statement to recognize GCCAsmStmt
as a possible block terminator.

Handling to build CFG using GCCAsmStmt was already implemented.

Reviewers: nickdesaulniers, george.karpenkov, NoQ

Reviewed By: nickdesaulniers, NoQ

Subscribers: xbolva00, tmroeder, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, cfe-commits

Tags: #clang

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

llvm-svn: 364605

5 years ago[CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case) (try 3)
Roman Lebedev [Thu, 27 Jun 2019 21:52:10 +0000 (21:52 +0000)]
[CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case) (try 3)

Summary:
I'm submitting a new revision since i don't understand how to reclaim/reopen/take over the existing one, D50222.
There is no such action in "Add Action" menu...

This implements an optimization described in Hacker's Delight 10-17: when `C` is constant,
the result of `X % C == 0` can be computed more cheaply without actually calculating the remainder.
The motivation is discussed here: https://bugs.llvm.org/show_bug.cgi?id=35479.

This is a recommit, the original commit rL364563 was reverted in rL364568
because test-suite detected miscompile - the new comparison constant 'Q'
was being computed incorrectly (we divided by `D0` instead of `D`).

Original patch D50222 by @hermord (Dmytro Shynkevych)

Notes:
- In principle, it's possible to also handle the `X % C1 == C2` case, as discussed on bugzilla.
  This seems to require an extra branch on overflow, so I refrained from implementing this for now.
- An explicit check for when the `REM` can be reduced to just its LHS is included:
  the `X % C` == 0 optimization breaks `test1` in `test/CodeGen/X86/jump_sign.ll` otherwise.
  I hadn't managed to find a better way to not generate worse output in this case.
- The `test/CodeGen/X86/jump_sign.ll` regresses, and is being fixed by a followup patch D63390.

Reviewers: RKSimon, craig.topper, spatel, hermord, xbolva00

Reviewed By: RKSimon, xbolva00

Subscribers: dexonsmith, kristina, xbolva00, javed.absar, llvm-commits, hermord

Tags: #llvm

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

llvm-svn: 364600

5 years ago[NFC][APInt] Add (exhaustive) test for multiplicativeInverse()
Roman Lebedev [Thu, 27 Jun 2019 21:51:54 +0000 (21:51 +0000)]
[NFC][APInt] Add (exhaustive) test for multiplicativeInverse()

Else there is no direct test coverage at all.
The function should either return '0' or precise answer.

llvm-svn: 364599

5 years ago[JITLink][MachO/x86-64] Add a testcase for X86_64_RELOC_GOT.
Lang Hames [Thu, 27 Jun 2019 21:50:29 +0000 (21:50 +0000)]
[JITLink][MachO/x86-64] Add a testcase for X86_64_RELOC_GOT.

This is the data-section counterpart to X86_64_RELOC_GOTPCREL.

llvm-svn: 364598

5 years ago[NFC][GVNSink] Pre-commit unary FNeg test to fpmath.ll
Cameron McInally [Thu, 27 Jun 2019 21:23:07 +0000 (21:23 +0000)]
[NFC][GVNSink] Pre-commit unary FNeg test to fpmath.ll

llvm-svn: 364597

5 years ago[WebAssembly] Enable an atomic.notify MC test
Heejin Ahn [Thu, 27 Jun 2019 21:22:04 +0000 (21:22 +0000)]
[WebAssembly] Enable an atomic.notify MC test

Summary:
Assembly of atomic.notify has been fixed in r364576, so we can enable
it.

Reviewers: aardappel

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

Tags: #llvm

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

llvm-svn: 364596

5 years agoPattern match struct types in test case.
Akira Hatanaka [Thu, 27 Jun 2019 21:16:19 +0000 (21:16 +0000)]
Pattern match struct types in test case.

This simplifies the test cases in a patch I'm planning to send later.

llvm-svn: 364595

5 years ago[libFuzzer] Migrate to the new exception syscalls on Fuchsia
Petr Hosek [Thu, 27 Jun 2019 21:13:06 +0000 (21:13 +0000)]
[libFuzzer] Migrate to the new exception syscalls on Fuchsia

This is part of the transition to the new Fuchsia exception syscalls
signature.

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

llvm-svn: 364594

5 years ago[sanitizer_common] Switch from zx_clock_get_new to zx_clock_get
Petr Hosek [Thu, 27 Jun 2019 21:13:05 +0000 (21:13 +0000)]
[sanitizer_common] Switch from zx_clock_get_new to zx_clock_get

This is part of the soft-transition to the new system call name.
These two system calls are the same so this change is no-op.

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

llvm-svn: 364593

5 years ago[GVN] Add support for unary FNeg to GVN pass
Cameron McInally [Thu, 27 Jun 2019 21:05:02 +0000 (21:05 +0000)]
[GVN] Add support for unary FNeg to GVN pass

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

llvm-svn: 364592

5 years ago[compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*
Reid Kleckner [Thu, 27 Jun 2019 20:56:04 +0000 (20:56 +0000)]
[compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*

These lit configuration files are really Python source code. Using the
.py file extension helps editors and tools use the correct language
mode. LLVM and Clang already use this convention for lit configuration,
this change simply applies it to all of compiler-rt.

Reviewers: vitalybuka, dberris

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

llvm-svn: 364591

5 years agoConvert line endings to LF.
Alexandre Ganea [Thu, 27 Jun 2019 20:46:11 +0000 (20:46 +0000)]
Convert line endings to LF.

llvm-svn: 364590

5 years agoMake nrvo-string test more robust.
Adrian Prantl [Thu, 27 Jun 2019 20:38:37 +0000 (20:38 +0000)]
Make nrvo-string test more robust.

This is a follow-up to r364466, but better implemented. Original
commit message still applies:

    The breakpoint locations were in places where clang doesn't actually
    emit a source location for and depend on the debugger's ability to
    move the breakpoint forward onto a line that is already in the
    function epilogue. In my testing older versions of LLDB fail to do
    that, so I'm modifying the test to force a break-able location by
    calling a noinline function.

    <rdar://problem/52079841>

llvm-svn: 364589

5 years ago[x86] remove whitespace; NFC
Sanjay Patel [Thu, 27 Jun 2019 20:37:12 +0000 (20:37 +0000)]
[x86] remove whitespace; NFC

llvm-svn: 364588

5 years ago[NFC][GVN] Pre-commit unary FNeg tests to fpmath.ll
Cameron McInally [Thu, 27 Jun 2019 20:33:44 +0000 (20:33 +0000)]
[NFC][GVN] Pre-commit unary FNeg tests to fpmath.ll

llvm-svn: 364587

5 years ago[libcxxabi] Use an explicit list to export symbols from the dylib
Louis Dionne [Thu, 27 Jun 2019 20:17:22 +0000 (20:17 +0000)]
[libcxxabi] Use an explicit list to export symbols from the dylib

Reviewers: EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 364586

5 years ago[x86] prevent crashing from select narrowing with AVX512
Sanjay Patel [Thu, 27 Jun 2019 20:16:58 +0000 (20:16 +0000)]
[x86] prevent crashing from select narrowing with AVX512

llvm-svn: 364585

5 years ago[GN] Update build file
Vitaly Buka [Thu, 27 Jun 2019 19:55:22 +0000 (19:55 +0000)]
[GN] Update build file

llvm-svn: 364583

5 years ago[GN] Set exit code to 1 if changes are needed
Vitaly Buka [Thu, 27 Jun 2019 19:55:21 +0000 (19:55 +0000)]
[GN] Set exit code to 1 if changes are needed

llvm-svn: 364582

5 years ago[PowerPC][NFC] Remove unused (and unsupported) fusion feature bits.
Jinsong Ji [Thu, 27 Jun 2019 19:35:11 +0000 (19:35 +0000)]
[PowerPC][NFC] Remove unused (and unsupported) fusion feature bits.

FeatureFusion bits was first introduced in
https://reviews.llvm.org/rL253724. for add/load integer fusion for P8.
The only use of `hasFusion` was https://reviews.llvm.org/rL255319.

However, this was removed later in https://reviews.llvm.org/rL280440.

So, there is NO any reference to fusion in code now.

Leaving it there is misleading and confusing, so remove it for now.
We can alwasy add back if we ever support fusion in the future.

llvm-svn: 364581

5 years agoUse "willreturn" in isGuaranteedToTransferExecutionToSuccessor
Johannes Doerfert [Thu, 27 Jun 2019 19:29:48 +0000 (19:29 +0000)]
Use "willreturn" in isGuaranteedToTransferExecutionToSuccessor

The `willreturn` function attribute guarantees that a function call will
come back to the call site if the call is also known not to throw.
Therefore, this attribute can be used in
`isGuaranteedToTransferExecutionToSuccessor`.

Patch by Hideto Ueno (@uenoku)

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 364580

5 years agoUpdate -analyze -scalar-evolution output for multiple exit loops w/computable exit...
Philip Reames [Thu, 27 Jun 2019 19:22:43 +0000 (19:22 +0000)]
Update -analyze -scalar-evolution output for multiple exit loops w/computable exit values

The previous output was next to useless if *any* exit was not computable.  If we have more than one exit, show the exit count for each so that it's easier to see what's going from with SCEV analysis when debugging.

llvm-svn: 364579

5 years ago[NFC][CodeGen] Add negative test for X u% C == 0 fold (D63391)
Roman Lebedev [Thu, 27 Jun 2019 19:09:51 +0000 (19:09 +0000)]
[NFC][CodeGen] Add negative test for X u% C == 0 fold (D63391)

The fold (D63391) uses multiplicativeInverse(),
but it is not guaranteed to always succeed,
and '100' appears to be one of the problematic values.

llvm-svn: 364578

5 years agoCorrect the file path. NFC.
Michael Liao [Thu, 27 Jun 2019 19:05:46 +0000 (19:05 +0000)]
Correct the file path. NFC.

llvm-svn: 364577

5 years ago[WebAssembly] AsmParser: better atomic inst detection
Wouter van Oortmerssen [Thu, 27 Jun 2019 18:58:26 +0000 (18:58 +0000)]
[WebAssembly] AsmParser: better atomic inst detection

Summary:
Previously missed atomic.notify.

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

Reviewers: aheejin

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

Tags: #llvm

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

llvm-svn: 364576

5 years ago[OPENMP]Generate correctly implicit flags for mapped data.
Alexey Bataev [Thu, 27 Jun 2019 18:53:07 +0000 (18:53 +0000)]
[OPENMP]Generate correctly implicit flags for mapped data.

Implicit flag must not be emitted for explicitly specified firstprivate
variables, but for implicitly captured sizes of the VLAs.

llvm-svn: 364575

5 years agoAdd a missing '__uncvref_t' to the SFINAE constraints for optional's assignment opera...
Marshall Clow [Thu, 27 Jun 2019 18:40:55 +0000 (18:40 +0000)]
Add a missing '__uncvref_t' to the SFINAE constraints for optional's assignment operator. Fixes PR38638. Thanks to Jonathan Wakely for the report

llvm-svn: 364574