platform/upstream/llvm.git
5 years ago[OpenCL] Improve destructor support in C++ for OpenCL
Marco Antognini [Mon, 22 Jul 2019 09:39:13 +0000 (09:39 +0000)]
[OpenCL] Improve destructor support in C++ for OpenCL

This re-applies r366422 with a fix for Bug PR42665 and a new regression
test.

llvm-svn: 366670

5 years ago[IPRA][ARM] Make use of the "returned" parameter attribute
Oliver Stannard [Mon, 22 Jul 2019 08:44:36 +0000 (08:44 +0000)]
[IPRA][ARM] Make use of the "returned" parameter attribute

ARM has code to recognise uses of the "returned" function parameter
attribute which guarantee that the value passed to the function in r0
will be returned in r0 unmodified. IPRA replaces the regmask on call
instructions, so needs to be told about this to avoid reverting the
optimisation.

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

llvm-svn: 366669

5 years ago[llvm-readobj] - Stop using precompiled objects in file-headers.test
George Rimar [Mon, 22 Jul 2019 08:10:02 +0000 (08:10 +0000)]
[llvm-readobj] - Stop using precompiled objects in file-headers.test

This converts all sub-tests except one to YAML instead of precompiled inputs.

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

llvm-svn: 366668

5 years ago[AMDGPU] Save some work when an atomic op has no uses
Jay Foad [Mon, 22 Jul 2019 07:19:44 +0000 (07:19 +0000)]
[AMDGPU] Save some work when an atomic op has no uses

Summary:
In the atomic optimizer, save doing a bunch of work and generating a
bunch of dead IR in the fairly common case where the result of an
atomic op (i.e. the value that was in memory before the atomic op was
performed) is not used. NFC.

Reviewers: arsenm, dstuttard, tpr

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 366667

5 years ago[PowerPC][NFC] Precommit a test case where ppc-mi-peepholes miscompiles extswsli
Kai Luo [Mon, 22 Jul 2019 05:32:20 +0000 (05:32 +0000)]
[PowerPC][NFC] Precommit a test case where ppc-mi-peepholes miscompiles extswsli

Added a test case to show codegen differences.

llvm-svn: 366666

5 years ago[Loop Peeling] Fix the handling of branch weights of peeled off branches.
Serguei Katkov [Mon, 22 Jul 2019 05:15:34 +0000 (05:15 +0000)]
[Loop Peeling] Fix the handling of branch weights of peeled off branches.

Current algorithm to update branch weights of latch block and its copies is
based on the assumption that number of peeling iterations is approximately equal
to trip count.

However it is not correct. According to profitability check in one case we can decide to peel
in case it helps to reduce the number of phi nodes. In this case the number of peeled iteration
can be less then estimated trip count.

This patch introduces another way to set the branch weights to peeled of branches.
Let F is a weight of the edge from latch to header.
Let E is a weight of the edge from latch to exit.
F/(F+E) is a probability to go to loop and E/(F+E) is a probability to go to exit.
Then, Estimated TripCount = F / E.
For I-th (counting from 0) peeled off iteration we set the the weights for
the peeled latch as (TC - I, 1). It gives us reasonable distribution,
The probability to go to exit 1/(TC-I) increases. At the same time
the estimated trip count of remaining loop reduces by I.

As a result after peeling off N iteration the weights will be
(F - N * E, E) and trip count of loop becomes
F / E - N or TC - N.

The idea is taken from the review of the patch D63918 proposed by Philip.

Reviewers: reames, mkuper, iajbar, fhahn
Reviewed By: reames
Subscribers: hiraditya, zzheng, llvm-commits
Differential Revision: https://reviews.llvm.org/D64235

llvm-svn: 366665

5 years ago[utils] Clean up UpdateTestChecks/common.py
Fangrui Song [Mon, 22 Jul 2019 04:59:01 +0000 (04:59 +0000)]
[utils] Clean up UpdateTestChecks/common.py

llvm-svn: 366664

5 years ago[analyzer] Fix -Wunused-function in NDEBUG builds with #ifdef LLVM_DUMP_METHOD
Fangrui Song [Mon, 22 Jul 2019 04:14:09 +0000 (04:14 +0000)]
[analyzer] Fix -Wunused-function in NDEBUG builds with #ifdef LLVM_DUMP_METHOD

llvm-svn: 366663

5 years ago[InstCombine] Add foldAndOfICmps test cases inspired by PR42691.
Craig Topper [Mon, 22 Jul 2019 02:43:43 +0000 (02:43 +0000)]
[InstCombine] Add foldAndOfICmps test cases inspired by PR42691.

icmp ne %x, INT_MIN can be treated similarly to icmp sgt %x, INT_MIN.
icmp ne %x, INT_MAX can be treated similarly to icmp slt %x, INT_MAX.
icmp ne %x, UINT_MAX can be treated similarly to icmp ult %x, UINT_MAX.

We already treat icmp ne %x, 0 similarly to icmp ugt %x, 0

llvm-svn: 366662

5 years ago[PowerPC][NFC] Precomit test case for upcoming patch
Nemanja Ivanovic [Sun, 21 Jul 2019 21:03:45 +0000 (21:03 +0000)]
[PowerPC][NFC] Precomit test case for upcoming patch

Just committing a test case for an upcoming patch so that the review can show
only the codegen differences.

llvm-svn: 366661

5 years ago[X86] SimplifyDemandedVectorEltsForTargetNode - Move SUBV_BROADCAST narrowing handlin...
Simon Pilgrim [Sun, 21 Jul 2019 19:04:44 +0000 (19:04 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode - Move SUBV_BROADCAST narrowing handling. NFCI.

Move the narrowing of SUBV_BROADCAST to where we handle all the other opcodes.

llvm-svn: 366660

5 years ago[PowerPC][NFC] Regenerate test using script
Nemanja Ivanovic [Sun, 21 Jul 2019 18:42:29 +0000 (18:42 +0000)]
[PowerPC][NFC] Regenerate test using script

This test case ended up as a hybrid of generated checks and manually inserted
checks. Regenerate using script to make it consistent.

llvm-svn: 366659

5 years ago[InstCombine] Update comment I missed in r366649. NFC
Craig Topper [Sun, 21 Jul 2019 16:15:03 +0000 (16:15 +0000)]
[InstCombine] Update comment I missed in r366649. NFC

llvm-svn: 366658

5 years ago[SmallBitVector] Fix bug in find_next_unset for small types with indices >=32
Simon Pilgrim [Sun, 21 Jul 2019 16:06:26 +0000 (16:06 +0000)]
[SmallBitVector] Fix bug in find_next_unset for small types with indices >=32

We were creating a bitmask from a shift of unsigned instead of uintptr_t, meaning we couldn't create masks for indices above 31.

Noticed due to a MSVC analyzer warning.

llvm-svn: 366657

5 years ago[GISel]: Attach missing range metadata while translating G_LOADs
Aditya Nandakumar [Sun, 21 Jul 2019 14:07:54 +0000 (14:07 +0000)]
[GISel]: Attach missing range metadata while translating G_LOADs

https://reviews.llvm.org/D65048

Attach range information to G_LOAD when only defining one register.

reviewed by: arsenm

llvm-svn: 366656

5 years ago[ARM] Move MVE VPT block tests into the Thumb2 directory. NFC
David Green [Sun, 21 Jul 2019 13:09:19 +0000 (13:09 +0000)]
[ARM] Move MVE VPT block tests into the Thumb2 directory. NFC

llvm-svn: 366655

5 years ago[lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor
Raphael Isemann [Sun, 21 Jul 2019 10:31:13 +0000 (10:31 +0000)]
[lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor

Summary:
We assume in LLDB that every type comes from an ASTContext with an associated ClangASTContext.
However the types inside the ClangModuleDeclVendor don't have a ClangASTContext so we end up
crashing whenever we create a CompilerType for one of these types.

Simplest way to trigger this bug is to just look up NSObject from a module:
   (lldb) expr @import Foundation
   (lldb) type lookup NSObject
   Assertion failed: (m_type_system != nullptr), function CompilerType, file /Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 39.

This patch just creates a ClangASTContext for the ASTContext used by ClangModuleDeclVendor.

Reviewers: davide, shafik

Reviewed By: davide

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 366653

5 years ago[NFC][InstCombine] Add a few extra srem-by-power-of-two tests - extra uses
Roman Lebedev [Sun, 21 Jul 2019 09:05:49 +0000 (09:05 +0000)]
[NFC][InstCombine] Add a few extra srem-by-power-of-two tests - extra uses

llvm-svn: 366652

5 years ago[NativePDB] Make GetOrCreateDeclForUid return an lldb CompilerDecl
Nathan Lanza [Sun, 21 Jul 2019 07:46:18 +0000 (07:46 +0000)]
[NativePDB] Make GetOrCreateDeclForUid return an lldb CompilerDecl

We intend to make PdbAstBuilder abstract and implement
PdbAstBuilderClang along with any other languages that wish to use
PDBs. Thus, change GetOrCreateDeclForUid from returning a clang decl
to a lldb_private::CompilerDecl.

llvm-svn: 366650

5 years ago[InstCombine] Remove insertRangeTest code that handles the equality case.
Craig Topper [Sun, 21 Jul 2019 06:43:38 +0000 (06:43 +0000)]
[InstCombine] Remove insertRangeTest code that handles the equality case.

For equality, the function called getTrue/getFalse with the VT
of the comparison input. But getTrue/getFalse need the boolean VT.
So if this code ever executed, it would assert.

I believe these cases are removed by InstSimplify so we don't get here.

So this patch just fixes up an assert to exclude the equality
possibility and removes the broken code.

llvm-svn: 366649

5 years ago[InstCombine] Don't use AddOne/SubOne to see if two APInts are 1 apart. Use APInt...
Craig Topper [Sun, 21 Jul 2019 05:26:05 +0000 (05:26 +0000)]
[InstCombine] Don't use AddOne/SubOne to see if two APInts are 1 apart. Use APInt operations instead. NFCI

AddOne/SubOne create new Constant objects. That seems heavy for
comparing ConstantInts which wrap APInts. Just do the math on
on the APInts and compare them.

llvm-svn: 366648

5 years ago[lldb] Fix buildbot build fail caused by r366645
Yuanfang Chen [Sun, 21 Jul 2019 00:07:39 +0000 (00:07 +0000)]
[lldb] Fix buildbot build fail caused by r366645

llvm-svn: 366647

5 years agogn build: Merge r366622
Nico Weber [Sun, 21 Jul 2019 00:03:55 +0000 (00:03 +0000)]
gn build: Merge r366622

llvm-svn: 366646

5 years ago[Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'
Yuanfang Chen [Sat, 20 Jul 2019 22:50:50 +0000 (22:50 +0000)]
[Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'
with '-mframe-pointer'

After D56351 and D64294, frame pointer handling is migrated to tri-state
(all, non-leaf, none) in clang driver and on the function attribute.
This patch makes the frame pointer handling cc1 option tri-state.

Reviewers: chandlerc, rnk, t.p.northover, MaskRay

Reviewed By: MaskRay

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

llvm-svn: 366645

5 years ago[ELF] Support explicitly overriding relocation model in LTO
Petr Hosek [Sat, 20 Jul 2019 21:59:47 +0000 (21:59 +0000)]
[ELF] Support explicitly overriding relocation model in LTO

lld currently selects the relocation model automatically depending on
the link flags specified, but in some cases it'd be useful to allow
explicitly overriding the relocation model using a flag.

llvm-svn: 366644

5 years ago[NFC][InstCombine] Autogenerate a few tests
Roman Lebedev [Sat, 20 Jul 2019 21:34:00 +0000 (21:34 +0000)]
[NFC][InstCombine] Autogenerate a few tests

llvm-svn: 366643

5 years ago[NFC][InstCombine] Add srem-by-signbit tests - still can fold to bittest
Roman Lebedev [Sat, 20 Jul 2019 21:33:50 +0000 (21:33 +0000)]
[NFC][InstCombine] Add srem-by-signbit tests - still can fold to bittest

https://rise4fun.com/Alive/IIeS

llvm-svn: 366642

5 years ago[NFC][Codegen][X86][AArch64] Add "(x s% C) == 0" tests
Roman Lebedev [Sat, 20 Jul 2019 19:25:44 +0000 (19:25 +0000)]
[NFC][Codegen][X86][AArch64] Add "(x s% C) == 0" tests

Much like with `urem`, the same optimization (albeit with slightly
different algorithm) applies for the signed case, too.

I'm simply copying the test coverage from `urem` case for now,
i believe it should be (close to?) sufficient.

llvm-svn: 366640

5 years agobuild: allow the user to specify `llvm-tblgen`
Saleem Abdulrasool [Sat, 20 Jul 2019 17:59:08 +0000 (17:59 +0000)]
build: allow the user to specify `llvm-tblgen`

This follows the same pattern as Clang and permits the user to specify
the tablegen to use via `-DLLVM_TABLEGEN=`.  This allows for
cross-compiling LLDB for a foreign target (e.g. Windows ARM64 on Windows
X64).  The LLVM dependency for LLDB in that case must be a Windows ARM64
build which cannot cross-compile llvm-tblgen due to the way that Visual
Studio works.  Instead, permit the user to have a separate tablegen
build which can be used during the build.

llvm-svn: 366639

5 years agoFix asan infinite loop on undefined symbol
Serge Guelton [Sat, 20 Jul 2019 17:44:30 +0000 (17:44 +0000)]
Fix asan infinite loop on undefined symbol

Fix llvm#39641

Recommit of r366413

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

> llvm-svn: 366632

llvm-svn: 366638

5 years ago[Codegen][SelectionDAG] X u% C == 0 fold: non-splat vector improvements
Roman Lebedev [Sat, 20 Jul 2019 16:33:15 +0000 (16:33 +0000)]
[Codegen][SelectionDAG] X u% C == 0 fold: non-splat vector improvements

Summary:
Four things here:
1. Generalize the fold to handle non-splat divisors. Reasonably trivial.
2. Unban power-of-two divisors. I don't see any reason why they should
   be illegal.
   * There is no ban in Hacker's Delight
   * I think the ban came from the same bug that caused the miscompile
      in the base patch - in `floor((2^W - 1) / D)` we were dividing by
      `D0` instead of `D`, and we **were** ensuring that `D0` is not `1`,
      which made sense.
3. Unban `1` divisors. I no longer believe Hacker's Delight actually says
   that the fold is invalid for `D = 0`. Further considerations:
   * We know that
     * `(X u% 1) == 0`  can be constant-folded to `1`,
     * `(X u% 1) != 0`  can be constant-folded to `0`,
   *  Also, we know that
     * `X u<= -1` can be constant-folded to `1`,
     * `X u>  -1` can be constant-folded to `0`,
   * https://godbolt.org/z/7jnZJX https://rise4fun.com/Alive/oF6p
   * We know will end up with the following:
       `(setule/setugt (rotr (mul N, P), K), Q)`
   * Therefore, for given new DAG nodes and comparison predicates
     (`ule`/`ugt`), we will still produce the correct answer if:
     `Q` is a all-ones constant; and both `P` and `K` are *anything*
     other than `undef`.
   * The fold will indeed produce `Q = all-ones`.
4. Try to re-splat the `P` and `K` vectors - we don't care about
   their values for the lanes where divisor was `1`.

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

Reviewed By: RKSimon

Subscribers: hiraditya, javed.absar, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 366637

5 years ago[X86][SSE] Use PSADBW to improve vXi8 sum reduction (PR42674)
Simon Pilgrim [Sat, 20 Jul 2019 15:20:11 +0000 (15:20 +0000)]
[X86][SSE] Use PSADBW to improve vXi8 sum reduction (PR42674)

As detailed on PR42674, we can reduce a vXi8 down until we have the final <8 x i8>, and then use PSADBW with zero, to sum those values. We then extract the bottom i8, discarding any overflow from the upper bits of the i16 result.

llvm-svn: 366636

5 years agoFix cppcheck reduce scope variable warnings. NFCI
Simon Pilgrim [Sat, 20 Jul 2019 13:01:16 +0000 (13:01 +0000)]
Fix cppcheck reduce scope variable warnings. NFCI

Move a couple of variables inside the block where they are actually needed.

llvm-svn: 366635

5 years agoRevert "Fix asan infinite loop on undefined symbol"
Serge Guelton [Sat, 20 Jul 2019 13:00:12 +0000 (13:00 +0000)]
Revert "Fix asan infinite loop on undefined symbol"

This reverts commit cbd28cd05bb11e9d76d71c6cc2d38d89dbb1fe1a.

Buildbot fail: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/22434/steps/64-bit%20check-asan-dynamic/

llvm-svn: 366634

5 years ago[Local] Zap blockaddress without users in ConstantFoldTerminator.
Florian Hahn [Sat, 20 Jul 2019 12:25:47 +0000 (12:25 +0000)]
[Local] Zap blockaddress without users in ConstantFoldTerminator.

If the blockaddress is not destoryed, the destination block will still
be marked as having its address taken, limiting further transformations.

I think there are other places where the dead blockaddress constants are kept
around, I'll look into that as follow up.

Reviewers: craig.topper, brzycki, davide

Reviewed By: brzycki, davide

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

llvm-svn: 366633

5 years agoFix asan infinite loop on undefined symbol
Serge Guelton [Sat, 20 Jul 2019 12:01:18 +0000 (12:01 +0000)]
Fix asan infinite loop on undefined symbol

Fix llvm#39641

Recommit of r366413

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

llvm-svn: 366632

5 years ago[CMake] Align debugserver with lldb-server on Darwin
Stefan Granitz [Sat, 20 Jul 2019 11:18:31 +0000 (11:18 +0000)]
[CMake] Align debugserver with lldb-server on Darwin

Summary: Make debugserver a tool like lldb-server, so it can be included/excluded via `LLDB_TOOL_DEBUGSERVER_BUILD`. This replaces the old `LLDB_NO_DEBUGSERVER` flag. Doing the same for darwin-debug while I am here.

Reviewers: xiaobai, JDevlieghere, davide

Reviewed By: xiaobai, JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 366631

5 years ago[c++20] P1161R3: a[b,c] is deprecated.
Richard Smith [Sat, 20 Jul 2019 09:32:27 +0000 (09:32 +0000)]
[c++20] P1161R3: a[b,c] is deprecated.

llvm-svn: 366630

5 years agoMark P1301R4 in C++2a as being SVN instead.
Aaron Ballman [Sat, 20 Jul 2019 08:57:08 +0000 (08:57 +0000)]
Mark P1301R4 in C++2a as being SVN instead.

llvm-svn: 366629

5 years agoWe support P1301R4 in C++2a as of r366626.
Aaron Ballman [Sat, 20 Jul 2019 08:24:56 +0000 (08:24 +0000)]
We support P1301R4 in C++2a as of r366626.

llvm-svn: 366628

5 years ago[cxx_status] Update status page for WG21 Cologne meeting motions.
Richard Smith [Sat, 20 Jul 2019 08:20:54 +0000 (08:20 +0000)]
[cxx_status] Update status page for WG21 Cologne meeting motions.

Note that many of the paper links will be dead until the post-meeting
mailing is released.

llvm-svn: 366627

5 years agoImplement P1301R4, which allows specifying an optional message on the [[nodiscard...
Aaron Ballman [Sat, 20 Jul 2019 07:56:34 +0000 (07:56 +0000)]
Implement P1301R4, which allows specifying an optional message on the [[nodiscard]] attribute.

This also bumps the attribute feature test value and introduces the notion of a C++2a extension warning.

llvm-svn: 366626

5 years ago[GlobalISel][AArch64] Contract trivial same-size cross-bank copies into G_STOREs
Jessica Paquette [Sat, 20 Jul 2019 01:55:35 +0000 (01:55 +0000)]
[GlobalISel][AArch64] Contract trivial same-size cross-bank copies into G_STOREs

Sometimes, you can end up with cross-bank copies between same-sized GPRs and
FPRs, which feed into G_STOREs. When these copies feed only into stores, they
aren't necessary; we can just store using the original register bank.

This provides some minor code size savings for some floating point SPEC
benchmarks. (Around 0.2% for 453.povray and 450.soplex)

This issue doesn't seem to show up due to regbankselect or anything similar. So,
this patch introduces an early select function, `contractCrossBankCopyIntoStore`
which performs the contraction when possible. The selector then continues
normally and selects the correct store opcode, eliminating needless copies
along the way.

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

llvm-svn: 366625

5 years ago[WebAssembly] Compute and export TLS block alignment
Guanzhong Chen [Fri, 19 Jul 2019 23:34:16 +0000 (23:34 +0000)]
[WebAssembly] Compute and export TLS block alignment

Summary:
Add immutable WASM global `__tls_align` which stores the alignment
requirements of the TLS segment.

Add `__builtin_wasm_tls_align()` intrinsic to get this alignment in Clang.

The expected usage has now changed to:

    __wasm_init_tls(memalign(__builtin_wasm_tls_align(),
                             __builtin_wasm_tls_size()));

Reviewers: tlively, aheejin, sbc100, sunfish, alexcrichton

Reviewed By: tlively

Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 366624

5 years ago[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1
Teresa Johnson [Fri, 19 Jul 2019 23:02:58 +0000 (23:02 +0000)]
[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1

Summary:
Regular LTO modules do not need LTO Unit splitting, only ThinLTO does
(they must be consistently split into regular and Thin units for
optimizations such as whole program devirtualization and lower type
tests). In order to avoid spurious errors from LTO when combining with
split ThinLTO modules, always set this flag for regular LTO modules.

Reviewers: pcc

Subscribers: mehdi_amini, Prazek, inglorion, steven_wu, dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 366623

5 years agoRe-commit: r366610 and r366612: Expand pseudo-components before embedding in llvm...
Daniel Sanders [Fri, 19 Jul 2019 22:46:47 +0000 (22:46 +0000)]
Re-commit: r366610 and r366612: Expand pseudo-components before embedding in llvm-config

There were two main problems:
* The 'nativecodegen' pseudo-component was unconditionally adding
  ${native_tgt}CodeGen even though it conditionally added ${native_tgt}Info and
  ${native_tgt}Desc. This has been fixed by making ${native_tgt}CodeGen
  conditional too
* The 'all' pseudo-component was causing library names like LLVMLLVMDemangle as
  the expansion was to a library name and not a component. There doesn't seem to
  be a list of available components anywhere so this has been fixed by moving the
  expansion of 'all' back where it was before. This manifested in different ways
  on different builders but it was the same root cause

llvm-svn: 366622

5 years agoAMDGPU/GlobalISel: Legalize GEP for other 32-bit address spaces
Matt Arsenault [Fri, 19 Jul 2019 22:28:44 +0000 (22:28 +0000)]
AMDGPU/GlobalISel: Legalize GEP for other 32-bit address spaces

llvm-svn: 366621

5 years ago[NFC] Remove unused variable
Denis Bakhvalov [Fri, 19 Jul 2019 21:59:42 +0000 (21:59 +0000)]
[NFC] Remove unused variable

Change-Id: I5aee24dcdf6eebfbf788e52be22463387f23d927
llvm-svn: 366620

5 years ago[AMDGPU] Autogenerate register sequences in tuples
Stanislav Mekhanoshin [Fri, 19 Jul 2019 21:43:42 +0000 (21:43 +0000)]
[AMDGPU] Autogenerate register sequences in tuples

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

llvm-svn: 366619

5 years agoRevert "Fix asan infinite loop on undefined symbol"
Matthew Voss [Fri, 19 Jul 2019 21:41:07 +0000 (21:41 +0000)]
Revert "Fix asan infinite loop on undefined symbol"

This reverts commit 8e46275488ca453a24964cb26be0736172ad1db8.

This was failing on sanitizer-x86_64-linux and our internal CI.

llvm-svn: 366618

5 years agoDisallow most calling convention attributes on PS4
Sunil Srivastava [Fri, 19 Jul 2019 21:38:34 +0000 (21:38 +0000)]
Disallow most calling convention attributes on PS4

PS4 now only allows "cdecl", and its equivalent on PS4, "sysv_abi".

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

llvm-svn: 366617

5 years ago[AMDGPU] Fixed occupancy calculation for gfx10
Stanislav Mekhanoshin [Fri, 19 Jul 2019 21:29:51 +0000 (21:29 +0000)]
[AMDGPU] Fixed occupancy calculation for gfx10

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

llvm-svn: 366616

5 years agoRevert r366610 and r366612: Expand pseudo-components before embedding in llvm-config
Daniel Sanders [Fri, 19 Jul 2019 21:11:05 +0000 (21:11 +0000)]
Revert r366610 and r366612: Expand pseudo-components before embedding in llvm-config

Some targets are missing LLVMDemangle, one is adding the LLVM prefix twice, and two
are hitting the very error this patch fixes for my target. Reverting while I work
through the reports.

llvm-svn: 366615

5 years ago[InstCombine] Fix copy/paste mistake in the test cases I added for PR42691. NFC
Craig Topper [Fri, 19 Jul 2019 21:09:21 +0000 (21:09 +0000)]
[InstCombine] Fix copy/paste mistake in the test cases I added for PR42691. NFC

llvm-svn: 366614

5 years agoAMDGPU: Avoid custom predicates for stores with glue
Matt Arsenault [Fri, 19 Jul 2019 21:01:30 +0000 (21:01 +0000)]
AMDGPU: Avoid custom predicates for stores with glue

llvm-svn: 366613

5 years agoFix a latent bug discovered by r366610: nativecodegen includes X86CodeGen when X86...
Daniel Sanders [Fri, 19 Jul 2019 20:58:11 +0000 (20:58 +0000)]
Fix a latent bug discovered by r366610: nativecodegen includes X86CodeGen when X86 is not compiled

I believe this to have been a latent bug as the same expansion checks for the
existence of ${native_tgt}Info and ${native_tgt}Desc and only adds them if
they were compiled but unconditionally adds ${native_tgt}CodeGen.

This should fix llvm-clang-x86_64-win-fast which builds ARM only on an X86 host and similar builders.

llvm-svn: 366612

5 years ago[InstCombine] Add test cases for PR42691. NFC
Craig Topper [Fri, 19 Jul 2019 20:48:52 +0000 (20:48 +0000)]
[InstCombine] Add test cases for PR42691. NFC

llvm-svn: 366611

5 years agoExpand pseudo-components before embedding in llvm-config
Daniel Sanders [Fri, 19 Jul 2019 20:38:05 +0000 (20:38 +0000)]
Expand pseudo-components before embedding in llvm-config

Summary:
If you use pseudo-targets like AllTargetsCodeGens in LLVM_DYLIB_COMPONENTS
then a test will fail because `./bin/llvm-config --shared-mode` can't
handle these targets. We can fix this by expanding them before embedding
the string into llvm-config

Reviewers: bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 366610

5 years agoAMDGPU: Redefine setcc condition PatLeafs
Matt Arsenault [Fri, 19 Jul 2019 20:24:40 +0000 (20:24 +0000)]
AMDGPU: Redefine setcc condition PatLeafs

Avoid using custom code predicates.

llvm-svn: 366609

5 years agoAMDGPU: Don't rely on m0 being -1 for GWS offsets
Matt Arsenault [Fri, 19 Jul 2019 20:01:24 +0000 (20:01 +0000)]
AMDGPU: Don't rely on m0 being -1 for GWS offsets

This only works if the high bits of m0 are also 0, so m0 would have to
be set to 0xffff.

llvm-svn: 366608

5 years agoAMDGPU: Force s_waitcnt after GWS instructions
Matt Arsenault [Fri, 19 Jul 2019 19:47:30 +0000 (19:47 +0000)]
AMDGPU: Force s_waitcnt after GWS instructions

This is apparently required to be the immediately following
instruction, so force it into a bundle with a waitcnt.

llvm-svn: 366607

5 years ago[libc++] Mark libcpp_deallocate.sh.cpp as UNSUPPORTED instead of XFAIL on AppleClang 9
Louis Dionne [Fri, 19 Jul 2019 19:41:40 +0000 (19:41 +0000)]
[libc++] Mark libcpp_deallocate.sh.cpp as UNSUPPORTED instead of XFAIL on AppleClang 9

Some minor versions of AppleClang 9 appear not to fail the test. It's
such a mess that the only sane thing to do is to mark the test as
UNSUPPORTED.

llvm-svn: 366606

5 years agoLiveIntervals: Fix handleMove asserting on BUNDLE
Matt Arsenault [Fri, 19 Jul 2019 19:32:00 +0000 (19:32 +0000)]
LiveIntervals: Fix handleMove asserting on BUNDLE

The top-level BUNDLE instruction should behave as an ordinary
instruction. It is supposed to have all relevant registers as implicit
operands. Moving it should work as any other instruction. I believe
the assert intended to avoid moving instructions inside bundles.

llvm-svn: 366605

5 years agoRevert "[libc++] Integrate the PSTL into libc++"
Louis Dionne [Fri, 19 Jul 2019 18:52:46 +0000 (18:52 +0000)]
Revert "[libc++] Integrate the PSTL into libc++"

This reverts r366593, which caused unforeseen breakage on the build bots.
I'm reverting until the problems have been figured out and fixed.

llvm-svn: 366603

5 years ago[AMDGPU] Add test case on crashing of `si-lower-sgpr-spills` pass
Michael Liao [Fri, 19 Jul 2019 18:50:53 +0000 (18:50 +0000)]
[AMDGPU] Add test case on crashing of `si-lower-sgpr-spills` pass

Reviewers: arsenm

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

Tags: #llvm

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

llvm-svn: 366602

5 years ago[libc++] Allow passing additional CMake arguments in macOS trunk CI script
Louis Dionne [Fri, 19 Jul 2019 18:47:00 +0000 (18:47 +0000)]
[libc++] Allow passing additional CMake arguments in macOS trunk CI script

llvm-svn: 366601

5 years agoRevert "Use the MachineBasicBlock symbol for a callbr target"
Nick Desaulniers [Fri, 19 Jul 2019 18:18:02 +0000 (18:18 +0000)]
Revert "Use the MachineBasicBlock symbol for a callbr target"

This reverts commit r366523/ccbffefccaff42b0d094c9ef0f49fc3e8c8456ea.

Two regressions were immediately reported:
- https://github.com/ClangBuiltLinux/linux/issues/614
- https://github.com/ClangBuiltLinux/linux/issues/615

Reported-by: nathanchance
llvm-svn: 366600

5 years ago[RISCV] Disable tests failing on buildbots.
Matt Morehouse [Fri, 19 Jul 2019 18:05:12 +0000 (18:05 +0000)]
[RISCV] Disable tests failing on buildbots.

r366399 enabled a couple tests that are failing on a few buildbots.

llvm-svn: 366599

5 years ago[AMDGPU] Allow register tuples to set asm names
Stanislav Mekhanoshin [Fri, 19 Jul 2019 18:05:01 +0000 (18:05 +0000)]
[AMDGPU] Allow register tuples to set asm names

This change reverts most of the previous register name generation.
The real problem is that RegisterTuple does not generate asm names.
Added optional operand to RegisterTuple. This way we can simplify
register name access and dramatically reduce the size of static
tables for the backend.

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

llvm-svn: 366598

5 years agoAMDGPU/GlobalISel: Fix MMO flags for kernel argument loads
Matt Arsenault [Fri, 19 Jul 2019 17:52:56 +0000 (17:52 +0000)]
AMDGPU/GlobalISel: Fix MMO flags for kernel argument loads

The DAG lowering sets dereferencable and invariant, not nontemporal.

llvm-svn: 366597

5 years agoGlobalISel: Add GINodeEquiv for fcopysign
Matt Arsenault [Fri, 19 Jul 2019 17:32:19 +0000 (17:32 +0000)]
GlobalISel: Add GINodeEquiv for fcopysign

I don't need this at the moment, but it should be here.

llvm-svn: 366596

5 years ago[llvm-lipo] Remove trailing whitespace. NFC
Shoaib Meenai [Fri, 19 Jul 2019 17:19:57 +0000 (17:19 +0000)]
[llvm-lipo] Remove trailing whitespace. NFC

llvm-svn: 366595

5 years ago[libc++] Use _EnableIf instead of std::enable_if in deduction guides for map and set
Louis Dionne [Fri, 19 Jul 2019 17:13:39 +0000 (17:13 +0000)]
[libc++] Use _EnableIf instead of std::enable_if in deduction guides for map and set

llvm-svn: 366594

5 years ago[libc++] Integrate the PSTL into libc++
Louis Dionne [Fri, 19 Jul 2019 17:02:42 +0000 (17:02 +0000)]
[libc++] Integrate the PSTL into libc++

Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

Reviewers: rodgert, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

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

llvm-svn: 366593

5 years ago[Format/ObjC] Avoid breaking between unary operators and operands
Ben Hamilton [Fri, 19 Jul 2019 16:50:24 +0000 (16:50 +0000)]
[Format/ObjC] Avoid breaking between unary operators and operands

Summary:
Test Plan:
  New tests added. Ran tests with:
  % ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
  Confirmed tests failed before change and passed after change.

Reviewers: krasimir, djasper, sammccall, klimek

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

Tags: #clang

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

llvm-svn: 366592

5 years agoAMDGPU: Add some function return test cases
Matt Arsenault [Fri, 19 Jul 2019 16:45:48 +0000 (16:45 +0000)]
AMDGPU: Add some function return test cases

llvm-svn: 366591

5 years ago[lldb][NFC] Cleanup mentions and code related to lldb-mi
Raphael Isemann [Fri, 19 Jul 2019 15:55:23 +0000 (15:55 +0000)]
[lldb][NFC] Cleanup mentions and code related to lldb-mi

Summary: lldb-mi has been removed, but there are still a bunch of references in the code base. This patch removes all of them.

Reviewers: JDevlieghere, jfb

Reviewed By: JDevlieghere

Subscribers: dexonsmith, ki.stfu, mgorny, abidh, jfb, lldb-commits

Tags: #lldb

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

llvm-svn: 366590

5 years ago[AMDGPU] Regenerate test file for upcoming patch. NFCI.
Simon Pilgrim [Fri, 19 Jul 2019 15:43:56 +0000 (15:43 +0000)]
[AMDGPU] Regenerate test file for upcoming patch. NFCI.

llvm-svn: 366589

5 years agoFix asan infinite loop on undefined symbol
Serge Guelton [Fri, 19 Jul 2019 15:20:36 +0000 (15:20 +0000)]
Fix asan infinite loop on undefined symbol

Fix llvm#39641

Recommit of r366413

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

llvm-svn: 366588

5 years ago[libunwind][ARM] Fix loading FP registers on big-endian targets
Mikhail Maltsev [Fri, 19 Jul 2019 15:20:32 +0000 (15:20 +0000)]
[libunwind][ARM] Fix loading FP registers on big-endian targets

Summary:
The function Unwind-EHABI.cpp:_Unwind_VRS_Pop loads the saved values of
64-bit FP registers as two 32-bit words because they might not be
8-byte aligned. Combining these words into a 64-bit value has to be
done differently on big-endian platforms.

Reviewers: ostannard, john.brawn, dmgreen

Reviewed By: ostannard

Subscribers: kristof.beyls, christof, libcxx-commits

Tags: #libc

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

llvm-svn: 366587

5 years agoAMDGPU: Attempt to fix bot error
Matt Arsenault [Fri, 19 Jul 2019 14:56:24 +0000 (14:56 +0000)]
AMDGPU: Attempt to fix bot error

Manually remove file name from check line, since it somehow ends
up being different on an msvc bot.

llvm-svn: 366586

5 years agoAMDGPU/GlobalISel: Selection for fminnum/fmaxnum
Matt Arsenault [Fri, 19 Jul 2019 14:42:40 +0000 (14:42 +0000)]
AMDGPU/GlobalISel: Selection for fminnum/fmaxnum

v2f16 case doesn't work yet because the VOP3P complex patterns haven't
been ported yet.

llvm-svn: 366585

5 years agoAMDGPU/GlobalISel: Support arguments with multiple registers
Matt Arsenault [Fri, 19 Jul 2019 14:29:30 +0000 (14:29 +0000)]
AMDGPU/GlobalISel: Support arguments with multiple registers

Handles structs used directly in argument lists.

llvm-svn: 366584

5 years agoAMDGPU/GlobalISel: Rewrite lowerFormalArguments
Matt Arsenault [Fri, 19 Jul 2019 14:15:18 +0000 (14:15 +0000)]
AMDGPU/GlobalISel: Rewrite lowerFormalArguments

This should now handle everything except structs passed as multiple
registers.

I think most of the packing logic should be handled by
handleAssignments, but I'm unclear on what the contract is for
multiple registers. This is copying how x86 handles this.

This does change the behavior of the test_sgpr_alignment0 amdgpu_vs
test. I don't think shader arguments should try to follow the
alignment, and registers need to be repacked. I also don't think it
matters, since I think the pointers are packed to the beginning of the
argument list anyway.

llvm-svn: 366582

5 years agoSupport Linux signal return trampolines in frame initialization
Joseph Tremoulet [Fri, 19 Jul 2019 14:05:55 +0000 (14:05 +0000)]
Support Linux signal return trampolines in frame initialization

Summary:
Add __kernel_rt_sigreturn to the list of trap handlers for Linux (it's
used as such on aarch64 at least), and __restore_rt as well (used on
x86_64).

Skip decrement-and-recompute for trap handlers in
InitializeNonZerothFrame, as signal dispatch may point the child frame's
return address to the start of the return trampoline.

Parse the 'S' flag for signal handlers from eh_frame augmentation, and
propagate it to the unwind plan.

Reviewers: labath, jankratochvil, compnerd, jfb, jasonmolenda

Reviewed By: jasonmolenda

Subscribers: clayborg, MaskRay, wuzish, nemanjai, kbarton, jrtc27, atanasyan, jsji, javed.absar, kristof.beyls, lldb-commits

Tags: #lldb

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

llvm-svn: 366580

5 years ago[libc++] Add missing %link_flags to .sh.cpp test
Louis Dionne [Fri, 19 Jul 2019 14:01:48 +0000 (14:01 +0000)]
[libc++] Add missing %link_flags to .sh.cpp test

Without the link flags, the test always fails on Linux. For some reason,
however, it works on Darwin -- which is why it wasn't caught at first.

llvm-svn: 366579

5 years agoAMDGPU: Decompose all values to 32-bit pieces for calling conventions
Matt Arsenault [Fri, 19 Jul 2019 13:57:44 +0000 (13:57 +0000)]
AMDGPU: Decompose all values to 32-bit pieces for calling conventions

This is the more natural lowering, and presents more opportunities to
reduce 64-bit ops to 32-bit.

This should also help avoid issues graphics shaders have had with
64-bit values, and simplify argument lowering in globalisel.

llvm-svn: 366578

5 years ago[clangd] Provide a way to publish highlightings in non-racy manner
Ilya Biryukov [Fri, 19 Jul 2019 13:51:01 +0000 (13:51 +0000)]
[clangd] Provide a way to publish highlightings in non-racy manner

Summary:
By exposing a callback that can guard code publishing results of
'onMainAST' callback in the same manner we guard diagnostics.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: javed.absar, MaskRay, jkorous, arphaman, kadircet, hokein, jvikstrom, cfe-commits

Tags: #clang

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

llvm-svn: 366577

5 years agogn build: Set +x on symlink_or_copy.py
Nico Weber [Fri, 19 Jul 2019 13:40:54 +0000 (13:40 +0000)]
gn build: Set +x on symlink_or_copy.py

llvm-svn: 366576

5 years ago[clangd] Disable background-index on lit-tests by default
Kadir Cetinkaya [Fri, 19 Jul 2019 13:40:30 +0000 (13:40 +0000)]
[clangd] Disable background-index on lit-tests by default

Summary:
Since background-index can perform disk writes, we don't want to turn
it on tests that won't clear it.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 366575

5 years agoDAG: Handle dbg_value for arguments split into multiple subregs
Matt Arsenault [Fri, 19 Jul 2019 13:36:46 +0000 (13:36 +0000)]
DAG: Handle dbg_value for arguments split into multiple subregs

This was handled previously for arguments split due to not fitting in
an MVT. This was dropping the register for argument registers split
due to TLI::getRegisterTypeForCallingConv.

llvm-svn: 366574

5 years agolld-link: Demangle symbols from archives in diagnostics
Nico Weber [Fri, 19 Jul 2019 13:29:10 +0000 (13:29 +0000)]
lld-link: Demangle symbols from archives in diagnostics

Also add test coverage for thin archives (which are the only way I could
come up with to test at least some of the diagnostic changes).

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

llvm-svn: 366573

5 years ago[NFC] include cstdint/string prior to using uint8_t/string
Than McIntosh [Fri, 19 Jul 2019 13:13:54 +0000 (13:13 +0000)]
[NFC] include cstdint/string prior to using uint8_t/string

Summary: include proper header prior to use of uint8_t typedef
and std::string.

Subscribers: llvm-commits

Reviewers: cherry

Tags: #llvm

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

llvm-svn: 366572

5 years ago[AMDGPU][MC] Corrected parsing of branch offsets
Dmitry Preobrazhensky [Fri, 19 Jul 2019 13:12:47 +0000 (13:12 +0000)]
[AMDGPU][MC] Corrected parsing of branch offsets

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

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 366571

5 years ago[MachineCSE][MachinePRE] Avoid hoisting code from code regions into hot BBs.
Kai Luo [Fri, 19 Jul 2019 12:58:16 +0000 (12:58 +0000)]
[MachineCSE][MachinePRE] Avoid hoisting code from code regions into hot BBs.

Summary:
Current PRE hoists common computations into
CMBB = DT->findNearestCommonDominator(MBB, MBB1).
However, if CMBB is in a hot loop body, we might get performance
degradation.

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

llvm-svn: 366570

5 years ago[X86] for split stack, not save/restore nested arg if unused
Than McIntosh [Fri, 19 Jul 2019 12:54:44 +0000 (12:54 +0000)]
[X86] for split stack, not save/restore nested arg if unused

Summary:
For split-stack, if the nested argument (i.e. R10) is not used, no need to save/restore it in the prologue.

Reviewers: thanm

Reviewed By: thanm

Subscribers: mstorsjo, llvm-commits

Tags: #llvm

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

llvm-svn: 366569

5 years ago[Clangd] Fixed ExtractVariable test
Shaurya Gupta [Fri, 19 Jul 2019 12:11:04 +0000 (12:11 +0000)]
[Clangd] Fixed ExtractVariable test

llvm-svn: 366568

5 years ago[libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string
Louis Dionne [Fri, 19 Jul 2019 11:52:55 +0000 (11:52 +0000)]
[libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string

Summary:
This is effectively a revert of r344616, which was a partial fix for
PR38964 (compilation of <string> with GCC in C++03 mode). However, that
configuration is explicitly not supported anymore and that partial fix
breaks compilation with Clang when per-TU insulation is provided.

PR42676
rdar://52899715

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 366567

5 years ago[Clangd] Fixed SelectionTree bug for macros
Shaurya Gupta [Fri, 19 Jul 2019 11:41:02 +0000 (11:41 +0000)]
[Clangd] Fixed SelectionTree bug for macros

Summary:
Fixed SelectionTree bug for macros
- Fixed SelectionTree claimRange for macros and template instantiations
- Fixed SelectionTree unit tests
- Changed a breaking test in TweakTests

Reviewers: sammccall, kadircet

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

Tags: #clang

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

llvm-svn: 366566

5 years ago[NFC][InstCombine] Tests for 'rem' formation from sub-of-mul-by-'div' (PR42673)
Roman Lebedev [Fri, 19 Jul 2019 11:29:18 +0000 (11:29 +0000)]
[NFC][InstCombine] Tests for 'rem' formation from sub-of-mul-by-'div' (PR42673)

https://rise4fun.com/Alive/8Rp
https://bugs.llvm.org/show_bug.cgi?id=42673

llvm-svn: 366565