platform/upstream/llvm.git
4 years ago[TableGen] Pacify gcc-5.4 more
James Molloy [Mon, 7 Oct 2019 08:23:20 +0000 (08:23 +0000)]
[TableGen] Pacify gcc-5.4 more

Followup to a previous pacification, this performs the same workaround
to the TableGen generated code for tuple automata.

llvm-svn: 373883

4 years agoRevert "[SLP] avoid reduction transform on patterns that the backend can load-combine"
Martin Storsjo [Mon, 7 Oct 2019 08:21:37 +0000 (08:21 +0000)]
Revert "[SLP] avoid reduction transform on patterns that the backend can load-combine"

This reverts SVN r373833, as it caused a failed assert "Non-zero loop
cost expected" on building numerous projects, see PR43582 for details
and reproduction samples.

llvm-svn: 373882

4 years ago[llvm-locstats] Fix a typo in the documentation; NFC
Djordje Todorovic [Mon, 7 Oct 2019 07:31:49 +0000 (07:31 +0000)]
[llvm-locstats] Fix a typo in the documentation; NFC

llvm-svn: 373880

4 years ago[X86] Autogenerate checks in leaFixup32.mir and leaFixup64.mir. NFC
Craig Topper [Mon, 7 Oct 2019 06:50:56 +0000 (06:50 +0000)]
[X86] Autogenerate checks in leaFixup32.mir and leaFixup64.mir. NFC

llvm-svn: 373878

4 years ago[X86] Support LEA64_32r in processInstrForSlow3OpLEA and use INC/DEC when possible.
Craig Topper [Mon, 7 Oct 2019 06:27:55 +0000 (06:27 +0000)]
[X86] Support LEA64_32r in processInstrForSlow3OpLEA and use INC/DEC when possible.

Move the erasing and iterator updating inside to match the
other slow LEA function.

I've adapted code from optTwoAddrLEA and basically rebuilt the
implementation here. We do lose the kill flags now just like
optTwoAddrLEA. This runs late enough in the pipeline that
shouldn't really be a problem.

llvm-svn: 373877

4 years ago[NFC][CGP] Tests for making ICMP_EQ use CR result of ICMP_S(L|G)T dominators
Yi-Hong Lyu [Mon, 7 Oct 2019 05:29:11 +0000 (05:29 +0000)]
[NFC][CGP] Tests for making ICMP_EQ use CR result of ICMP_S(L|G)T dominators

llvm-svn: 373876

4 years ago[c++20] Check for a class-specific operator delete when deleting an
Richard Smith [Mon, 7 Oct 2019 03:14:28 +0000 (03:14 +0000)]
[c++20] Check for a class-specific operator delete when deleting an
object of class type with a virtual destructor.

llvm-svn: 373875

4 years agoFix behavior of __builtin_bit_cast when the From and To types are the
Richard Smith [Mon, 7 Oct 2019 02:45:12 +0000 (02:45 +0000)]
Fix behavior of __builtin_bit_cast when the From and To types are the
same.

We were missing the lvalue-to-rvalue conversion entirely in this case,
and in fact still need the full CK_LValueToRValueBitCast conversion to
perform a load with no TBAA.

llvm-svn: 373874

4 years agogn build: no-op style tweak in sync script
Nico Weber [Mon, 7 Oct 2019 00:37:10 +0000 (00:37 +0000)]
gn build: no-op style tweak in sync script

llvm-svn: 373873

4 years ago[Docs] Removes Subsystem Documentation page
DeForest Richards [Sun, 6 Oct 2019 22:49:22 +0000 (22:49 +0000)]
[Docs] Removes Subsystem Documentation page

Removes Subsystem Documentation page. Also moves existing topics on Subsystem Documentation page to User Guides and Reference pages.

llvm-svn: 373872

4 years ago[X86][AVX] Access a scalar float/double as a free extract from a broadcast load ...
Simon Pilgrim [Sun, 6 Oct 2019 21:11:45 +0000 (21:11 +0000)]
[X86][AVX] Access a scalar float/double as a free extract from a broadcast load (PR43217)

If a fp scalar is loaded and then used as both a scalar and a vector broadcast, perform the load as a broadcast and then extract the scalar for 'free' from the 0th element.

This involved switching the order of the X86ISD::BROADCAST combines so we only convert to X86ISD::BROADCAST_LOAD once all other canonicalizations have been attempted.

Adds a DAGCombinerInfo::recursivelyDeleteUnusedNodes wrapper.

Fixes PR43217

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

llvm-svn: 373871

4 years agoFix signed/unsigned warning. NFCI
Simon Pilgrim [Sun, 6 Oct 2019 19:54:20 +0000 (19:54 +0000)]
Fix signed/unsigned warning. NFCI

llvm-svn: 373870

4 years ago[NFC][PowerPC] Reorganize CRNotPat multiclass patterns in PPCInstrInfo.td
Amy Kwan [Sun, 6 Oct 2019 19:45:53 +0000 (19:45 +0000)]
[NFC][PowerPC] Reorganize CRNotPat multiclass patterns in PPCInstrInfo.td

This is patch aims to group together the `CRNotPat` multi class instantiations
within the `PPCInstrInfo.td` file.

Integer instantiations of the multi class are grouped together into a section,
and the floating point patterns are separated into its own section.

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

llvm-svn: 373869

4 years ago[X86][SSE] Remove resolveTargetShuffleInputs and use getTargetShuffleInputs directly.
Simon Pilgrim [Sun, 6 Oct 2019 19:07:00 +0000 (19:07 +0000)]
[X86][SSE] Remove resolveTargetShuffleInputs and use getTargetShuffleInputs directly.

Move the resolveTargetShuffleInputsAndMask call to after the shuffle mask combine before the undef/zero constant fold instead.

llvm-svn: 373868

4 years ago[X86][SSE] Don't merge known undef/zero elements into target shuffle masks.
Simon Pilgrim [Sun, 6 Oct 2019 19:06:45 +0000 (19:06 +0000)]
[X86][SSE] Don't merge known undef/zero elements into target shuffle masks.

Replaces setTargetShuffleZeroElements with getTargetShuffleAndZeroables which reports the Zeroable elements but doesn't merge them into the decoded target shuffle mask (the merging has been moved up into getTargetShuffleInputs until we can get rid of it entirely).

This is part of the work to fix PR43024 and allow us to use SimplifyDemandedElts to simplify shuffle chains - we need to get to a point where the target shuffle mask isn't adjusted by its source inputs but instead we cache them in a parallel Zeroable mask.

llvm-svn: 373867

4 years agoImplements CWG 1601 in [over.ics.rank/4.2]
Richard Smith [Sun, 6 Oct 2019 18:50:40 +0000 (18:50 +0000)]
Implements CWG 1601 in [over.ics.rank/4.2]

Summary:
The overload resolution for enums with a fixed underlying type has changed in the C++14 standard. This patch implements the new rule.

Patch by Mark de Wever!

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373866

4 years ago[X86] Add custom type legalization for v16i64->v16i8 truncate and v8i64->v8i8 truncat...
Craig Topper [Sun, 6 Oct 2019 18:43:08 +0000 (18:43 +0000)]
[X86] Add custom type legalization for v16i64->v16i8 truncate and v8i64->v8i8 truncate when v8i64 isn't legal

Summary:
The default legalization for v16i64->v16i8 tries to create a multiple stage truncate concatenating after each stage and truncating again. But avx512 implements truncates with multiple uops. So it should be better to truncate all the way to the desired element size and then concatenate the pieces using unpckl instructions. This minimizes the number of 2 uop truncates. The unpcks are all single uop instructions.

I tried to handle this by just custom splitting the v16i64->v16i8 shuffle. And hoped that the DAG combiner would leave the two halves in the state needed to make D68374 do the job for each half. This worked for the first half, but the second half got messed up. So I've implemented custom handling for v8i64->v8i8 when v8i64 needs to be split to produce the VTRUNCs directly.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373864

4 years ago[LegalizeTypes][X86] When splitting a vselect for type legalization, don't split...
Craig Topper [Sun, 6 Oct 2019 18:43:03 +0000 (18:43 +0000)]
[LegalizeTypes][X86] When splitting a vselect for type legalization, don't split a setcc condition if the setcc input is legal and vXi1 conditions are supported

Summary: The VSELECT splitting code tries to split a setcc input as well. But on avx512 where mask registers are well supported it should be better to just split the mask and use a single compare.

Reviewers: RKSimon, spatel, efriedma

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373863

4 years ago[Sema] Avoids an assertion failure when an invalid conversion declaration is used
Richard Smith [Sun, 6 Oct 2019 18:40:59 +0000 (18:40 +0000)]
[Sema] Avoids an assertion failure when an invalid conversion declaration is used

Summary:
When using a user-defined conversion function template with a deduced return type the compiler gives a set of warnings:
```
bug.cc:252:44: error: cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const'
  template <typename... Ts> operator auto()(Ts &&... xs) const;
                                           ^~~~~~~~~~~~~~~~~~~
bug.cc:252:29: error: conversion function cannot convert to a function type
  template <typename... Ts> operator auto()(Ts &&... xs) const;
                            ^
error: pointer to function type cannot have 'const' qualifier
```
after which it triggers an assertion failure. It seems the last error is incorrect and doesn't have any location information. This patch stops the compilation after the second warning.

Fixes bug 31422.

Patch by Mark de Wever!

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: bbannier, cfe-commits

Tags: #clang

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

llvm-svn: 373862

4 years agogn build: make windows build less broken
Nico Weber [Sun, 6 Oct 2019 18:11:53 +0000 (18:11 +0000)]
gn build: make windows build less broken

llvm-svn: 373858

4 years ago[LOOPGUARD] Remove asserts in getLoopGuardBranch
Whitney Tsang [Sun, 6 Oct 2019 16:39:43 +0000 (16:39 +0000)]
[LOOPGUARD] Remove asserts in getLoopGuardBranch
Summary: The assertion in getLoopGuardBranch can be a 'return nullptr'
under if condition.
Authored By: DTharun
Reviewer: Whitney, fhahn
Reviewed By: Whitney, fhahn
Subscribers: fhahn, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D66084

llvm-svn: 373857

4 years ago[Docs] Removes Programming Documentation page
DeForest Richards [Sun, 6 Oct 2019 16:10:11 +0000 (16:10 +0000)]
[Docs] Removes Programming Documentation page

Removes Programming Documentation page. Also moves existing topics on Programming Documentation page to User Guides and Reference pages.

llvm-svn: 373856

4 years ago[X86][SSE] resolveTargetShuffleInputs - call getTargetShuffleInputs instead of using...
Simon Pilgrim [Sun, 6 Oct 2019 15:42:25 +0000 (15:42 +0000)]
[X86][SSE] resolveTargetShuffleInputs - call getTargetShuffleInputs instead of using setTargetShuffleZeroElements directly. NFCI.

llvm-svn: 373855

4 years ago[Docs] Adds new Getting Started/Tutorials page
DeForest Richards [Sun, 6 Oct 2019 15:36:37 +0000 (15:36 +0000)]
[Docs] Adds new Getting Started/Tutorials page

Adds a new page for Getting Started/Tutorials topics. Also updates existing topic categories on the User Guides and Reference pages.

llvm-svn: 373854

4 years agoRevert [DAGCombine] Match more patterns for half word bswap
Sanjay Patel [Sun, 6 Oct 2019 15:27:34 +0000 (15:27 +0000)]
Revert [DAGCombine] Match more patterns for half word bswap

This reverts r373850 (git commit 25ba49824d2d4f2347b4a7cb1623600a76ce9433)

This patch appears to cause multiple codegen regression test failures - http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/10680

llvm-svn: 373853

4 years ago[NFC] Replace 'isDarwin' with 'IsDarwin'
Xiangling Liao [Sun, 6 Oct 2019 14:44:22 +0000 (14:44 +0000)]
[NFC] Replace 'isDarwin' with 'IsDarwin'

Summary: Replace 'isDarwin' with 'IsDarwin' based on LLVM naming convention.

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

llvm-svn: 373852

4 years ago[InstCombine] fold fneg disguised as select+fmul (PR43497)
Sanjay Patel [Sun, 6 Oct 2019 14:15:48 +0000 (14:15 +0000)]
[InstCombine] fold fneg disguised as select+fmul (PR43497)

Extends rL373230 and solves the motivating bug (although in a narrow way):
https://bugs.llvm.org/show_bug.cgi?id=43497

llvm-svn: 373851

4 years ago[DAGCombine] Match more patterns for half word bswap
Amaury Sechet [Sun, 6 Oct 2019 14:14:55 +0000 (14:14 +0000)]
[DAGCombine] Match more patterns for half word bswap

Summary: It ensures that the bswap is generated even when a part of the subtree already matches a bswap transform.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 373850

4 years ago[X86][AVX] combineExtractSubvector - merge duplicate variables. NFCI.
Simon Pilgrim [Sun, 6 Oct 2019 13:25:10 +0000 (13:25 +0000)]
[X86][AVX] combineExtractSubvector - merge duplicate variables. NFCI.

llvm-svn: 373849

4 years ago[InstCombine] add fast-math-flags for better test coverage; NFC
Sanjay Patel [Sun, 6 Oct 2019 13:19:05 +0000 (13:19 +0000)]
[InstCombine] add fast-math-flags for better test coverage; NFC

llvm-svn: 373848

4 years ago[InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)
Sanjay Patel [Sun, 6 Oct 2019 13:08:08 +0000 (13:08 +0000)]
[InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)

https://bugs.llvm.org/show_bug.cgi?id=43501
We can't declare a GEP 'inbounds' in general. But we may salvage that information if
we have known dereferenceable bytes on the source pointer.

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

llvm-svn: 373847

4 years ago[X86][SSE] matchVectorShuffleAsBlend - use Zeroable element mask directly.
Simon Pilgrim [Sun, 6 Oct 2019 12:38:38 +0000 (12:38 +0000)]
[X86][SSE] matchVectorShuffleAsBlend - use Zeroable element mask directly.

We can make use of the Zeroable mask to indicate which elements we can safely set to zero instead of creating a target shuffle mask on the fly.

This allows us to remove createTargetShuffleMask.

This is part of the work to fix PR43024 and allow us to use SimplifyDemandedElts to simplify shuffle chains - we need to get to a point where the target shuffle masks isn't adjusted by its source inputs in setTargetShuffleZeroElements but instead we cache them in a parallel Zeroable mask.

llvm-svn: 373846

4 years ago[X86] Enable AVX512BW for memcmp()
David Zarzycki [Sun, 6 Oct 2019 10:25:52 +0000 (10:25 +0000)]
[X86] Enable AVX512BW for memcmp()

llvm-svn: 373845

4 years ago[clang-format][docs] Fix the Google C++ and Chromium style guide URLs
Paul Hoad [Sun, 6 Oct 2019 09:37:58 +0000 (09:37 +0000)]
[clang-format][docs] Fix the Google C++ and Chromium style guide URLs

Summary: The Google C++ and Chromium style guides are broken in the clang-format docs. This patch updates them.

Reviewers: djasper, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang

Patch by: m4tx

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

llvm-svn: 373844

4 years agoAMDGPU/GlobalISel: Fall back on weird G_EXTRACT offsets
Matt Arsenault [Sun, 6 Oct 2019 01:41:22 +0000 (01:41 +0000)]
AMDGPU/GlobalISel: Fall back on weird G_EXTRACT offsets

llvm-svn: 373842

4 years agoAMDGPU/GlobalISel: RegBankSelect mul24 intrinsics
Matt Arsenault [Sun, 6 Oct 2019 01:37:39 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: RegBankSelect mul24 intrinsics

llvm-svn: 373841

4 years agoAMDGPU/GlobalISel: RegBankSelect DS GWS intrinsics
Matt Arsenault [Sun, 6 Oct 2019 01:37:38 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: RegBankSelect DS GWS intrinsics

llvm-svn: 373840

4 years agoAMDGPU/GlobalISel: Lower G_ATOMIC_CMPXCHG_WITH_SUCCESS
Matt Arsenault [Sun, 6 Oct 2019 01:37:37 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: Lower G_ATOMIC_CMPXCHG_WITH_SUCCESS

llvm-svn: 373839

4 years agoGlobalISel: Partially implement lower for G_EXTRACT
Matt Arsenault [Sun, 6 Oct 2019 01:37:35 +0000 (01:37 +0000)]
GlobalISel: Partially implement lower for G_EXTRACT

Turn into shift and truncate. Doesn't yet handle pointers.

llvm-svn: 373838

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for sendmsg intrinsics
Matt Arsenault [Sun, 6 Oct 2019 01:37:34 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for sendmsg intrinsics

This wasn't updated for the immarg handling change.

llvm-svn: 373837

4 years ago[FastISel] Copy the inline assembly dialect to the INLINEASM instruction.
Craig Topper [Sat, 5 Oct 2019 23:21:17 +0000 (23:21 +0000)]
[FastISel] Copy the inline assembly dialect to the INLINEASM instruction.

Fixes PR43575.

llvm-svn: 373836

4 years ago[X86][AVX] Push sign extensions of comparison bool results through bitops (PR42025)
Simon Pilgrim [Sat, 5 Oct 2019 20:49:34 +0000 (20:49 +0000)]
[X86][AVX] Push sign extensions of comparison bool results through bitops (PR42025)

As discussed on PR42025, with more complex boolean math we can end up with many truncations/extensions of the comparison results through each bitop.

This patch handles the cases introduced in combineBitcastvxi1 by pushing the sign extension through the AND/OR/XOR ops so its just the original SETCC ops that gets extended.

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

llvm-svn: 373834

4 years ago[SLP] avoid reduction transform on patterns that the backend can load-combine
Sanjay Patel [Sat, 5 Oct 2019 18:03:58 +0000 (18:03 +0000)]
[SLP] avoid reduction transform on patterns that the backend can load-combine

I don't see an ideal solution to these 2 related, potentially large, perf regressions:
https://bugs.llvm.org/show_bug.cgi?id=42708
https://bugs.llvm.org/show_bug.cgi?id=43146

We decided that load combining was unsuitable for IR because it could obscure other
optimizations in IR. So we removed the LoadCombiner pass and deferred to the backend.
Therefore, preventing SLP from destroying load combine opportunities requires that it
recognizes patterns that could be combined later, but not do the optimization itself (
it's not a vector combine anyway, so it's probably out-of-scope for SLP).

Here, we add a scalar cost model adjustment with a conservative pattern match and cost
summation for a multi-instruction sequence that can probably be reduced later.
This should prevent SLP from creating a vector reduction unless that sequence is
extremely cheap.

In the x86 tests shown (and discussed in more detail in the bug reports), SDAG combining
will produce a single instruction on these tests like:

  movbe   rax, qword ptr [rdi]

or:

  mov     rax, qword ptr [rdi]

Not some (half) vector monstrosity as we currently do using SLP:

  vpmovzxbq       ymm0, dword ptr [rdi + 1] # ymm0 = mem[0],zero,zero,..
  vpsllvq ymm0, ymm0, ymmword ptr [rip + .LCPI0_0]
  movzx   eax, byte ptr [rdi]
  movzx   ecx, byte ptr [rdi + 5]
  shl     rcx, 40
  movzx   edx, byte ptr [rdi + 6]
  shl     rdx, 48
  or      rdx, rcx
  movzx   ecx, byte ptr [rdi + 7]
  shl     rcx, 56
  or      rcx, rdx
  or      rcx, rax
  vextracti128    xmm1, ymm0, 1
  vpor    xmm0, xmm0, xmm1
  vpshufd xmm1, xmm0, 78          # xmm1 = xmm0[2,3,0,1]
  vpor    xmm0, xmm0, xmm1
  vmovq   rax, xmm0
  or      rax, rcx
  vzeroupper
  ret

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

llvm-svn: 373833

4 years ago[X86] lowerShuffleAsLanePermuteAndRepeatedMask - variable renames. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 16:08:30 +0000 (16:08 +0000)]
[X86] lowerShuffleAsLanePermuteAndRepeatedMask - variable renames. NFCI.

Rename some variables to match lowerShuffleAsRepeatedMaskAndLanePermute - prep work toward adding some equivalent sublane functionality.

llvm-svn: 373832

4 years agoTry to fix sphinx indentation error
Simon Pilgrim [Sat, 5 Oct 2019 16:08:17 +0000 (16:08 +0000)]
Try to fix sphinx indentation error

llvm-svn: 373831

4 years ago[SelectionDAG] Add tests for LKK algorithm
David Bolvansky [Sat, 5 Oct 2019 14:29:25 +0000 (14:29 +0000)]
[SelectionDAG] Add tests for LKK algorithm

Added some tests testing urem and srem operations with a constant divisor.

Patch by TG908 (Tim Gymnich)

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

llvm-svn: 373830

4 years agoRewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:42:14 +0000 (13:42 +0000)]
RewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.

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

llvm-svn: 373829

4 years ago[Diagnostics] Highlight expr's source range for -Wbool-operation
David Bolvansky [Sat, 5 Oct 2019 13:28:15 +0000 (13:28 +0000)]
[Diagnostics] Highlight expr's source range for -Wbool-operation

Warning message looks better; and GCC adds it too.

llvm-svn: 373828

4 years agoSemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:21:08 +0000 (13:21 +0000)]
SemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.

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

llvm-svn: 373827

4 years agoTreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:59 +0000 (13:20 +0000)]
TreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.

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

llvm-svn: 373826

4 years agoRemove redundant !HasDependentValue check. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:51 +0000 (13:20 +0000)]
Remove redundant !HasDependentValue check. NFCI.

Fixes cppcheck warning.

llvm-svn: 373825

4 years agoSemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:42 +0000 (13:20 +0000)]
SemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.

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

llvm-svn: 373824

4 years agoBranchFolding - IsBetterFallthrough - assert non-null pointers. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:30 +0000 (13:20 +0000)]
BranchFolding - IsBetterFallthrough - assert non-null pointers. NFCI.

Silences static analyzer null dereference warnings.

llvm-svn: 373823

4 years ago[clang-format] SpacesInSquareBrackets should affect lambdas with parameters too
Paul Hoad [Sat, 5 Oct 2019 09:55:23 +0000 (09:55 +0000)]
[clang-format] SpacesInSquareBrackets should affect lambdas with parameters too

Summary:
This patch makes the `SpacesInSquareBrackets` setting also apply to C++ lambdas with parameters.

Looking through the revision history, it appears support for only array brackets was added, and lambda brackets were ignored. Therefore, I am inclined to think it was simply an omission, rather than a deliberate choice.

See https://bugs.llvm.org/show_bug.cgi?id=17887 and https://reviews.llvm.org/D4944.

Reviewers: MyDeveloperDay, reuk, owenpan

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Patch by: mitchell-stellar

Tags: #clang-format, #clang

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

llvm-svn: 373821

4 years ago[UnitTests] Try and pacify gcc-5
James Molloy [Sat, 5 Oct 2019 08:57:17 +0000 (08:57 +0000)]
[UnitTests] Try and pacify gcc-5

This looks like a defect in gcc-5 where it chooses a constexpr
constructor from the initializer-list that it considers to be explicit.

I've tried to reproduce but I can't install anything prior to gcc-6 easily
on my system, and that doesn't have the error. So this is speculative
pacification.

Reported by Steven Wan.

llvm-svn: 373820

4 years agoDo not install lit-cpuid
Sylvestre Ledru [Sat, 5 Oct 2019 08:22:40 +0000 (08:22 +0000)]
Do not install lit-cpuid

Summary:
AFAIK, lit-cpuid is used by the tests.
Installing it causes LLVMExports*.cmake files to depend
on this program.
It causes some serious packaging issues as it would means
that llvm-dev depends on lldb.

See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941082
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941306

See also https://bugs.llvm.org/show_bug.cgi?id=43035
for a similar issue caused by
https://reviews.llvm.org/D56606

Reviewers: mgorny

Reviewed By: mgorny

Subscribers: delcypher, lldb-commits

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

llvm-svn: 373819

4 years ago[NFCI] Slightly improve warning message
David Bolvansky [Sat, 5 Oct 2019 08:09:06 +0000 (08:09 +0000)]
[NFCI] Slightly improve warning message

llvm-svn: 373818

4 years ago[Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of...
David Bolvansky [Sat, 5 Oct 2019 08:02:11 +0000 (08:02 +0000)]
[Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of bool in languages without a bool type

Thanks for this advice, Richard Trieu!

llvm-svn: 373817

4 years agoExpose ProvidePositionalOption as a public API
Mehdi Amini [Sat, 5 Oct 2019 01:37:04 +0000 (01:37 +0000)]
Expose ProvidePositionalOption as a public API

The motivation is to reuse the key value parsing logic here to
parse instance specific pass options within the context of MLIR.
The primary functionality exposed is the "," splitting for
arrays and the logic for properly handling duplicate definitions
of a single flag.

Patch by: Parker Schuh <parkers@google.com>

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

llvm-svn: 373815

4 years agoFix a *nasty* miscompile in experimental unordered atomic lowering
Philip Reames [Sat, 5 Oct 2019 00:32:10 +0000 (00:32 +0000)]
Fix a *nasty* miscompile in experimental unordered atomic lowering

This is an omission in rL371441.  Loads which happened to be unordered weren't being added to the PendingLoad set, and thus weren't be ordered w/respect to side effects which followed before the end of the block.

Included test case is how I spotted this.  We had an atomic load being folded into a using instruction after a fence that load was supposed to be ordered with.  I'm sure it showed up a bunch of other ways as well.

Spotted via manual inspecting of assembly differences in a corpus w/and w/o the new experimental mode.  Finding this with testing would have been "unpleasant".

llvm-svn: 373814

4 years ago[Test] Add a test case fo a missed oppurtunity in implicit null checking
Philip Reames [Fri, 4 Oct 2019 23:46:26 +0000 (23:46 +0000)]
[Test] Add a test case fo a missed oppurtunity in implicit null checking

llvm-svn: 373813

4 years ago[RISCV] Added missing ImmLeaf predicates
Ana Pazos [Fri, 4 Oct 2019 23:42:07 +0000 (23:42 +0000)]
[RISCV] Added missing ImmLeaf predicates

simm9_lsb0 and simm12_lsb0 operand types were missing predicates.

llvm-svn: 373812

4 years agoAdd a unittest to verify for assumption cache
Aditya Kumar [Fri, 4 Oct 2019 23:36:59 +0000 (23:36 +0000)]
Add a unittest to verify for assumption cache

Reviewers: vsk, tejohnson

Reviewed By: vsk

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

llvm-svn: 373811

4 years ago[MachO] Reduce indentation further in ParseSymtab (NFC)
Jonas Devlieghere [Fri, 4 Oct 2019 23:09:55 +0000 (23:09 +0000)]
[MachO] Reduce indentation further in ParseSymtab (NFC)

llvm-svn: 373810

4 years ago[libc++] Guard cxx_experimental settings behind LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY
Alex Langford [Fri, 4 Oct 2019 23:08:20 +0000 (23:08 +0000)]
[libc++] Guard cxx_experimental settings behind LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY

If you explicitly set LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY to OFF, your
project will fail to configure because the cxx_experimental target
doesn't exist.

llvm-svn: 373809

4 years ago[libc++] Localize common build flags into a single CMake function
Louis Dionne [Fri, 4 Oct 2019 22:50:23 +0000 (22:50 +0000)]
[libc++] Localize common build flags into a single CMake function

Also, set those flags for the cxx_experimental target. Otherwise,
cxx_experimental doesn't build properly when neither the static nor
the shared library is compiled (yes, that is a weird setup).

llvm-svn: 373808

4 years agoInvalidate assumption cache before outlining.
Aditya Kumar [Fri, 4 Oct 2019 22:46:42 +0000 (22:46 +0000)]
Invalidate assumption cache before outlining.

Subscribers: llvm-commits

Tags: #llvm

Reviewers: compnerd, vsk, sebpop, fhahn, tejohnson

Reviewed by: vsk

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

llvm-svn: 373807

4 years ago[libomptarget][nfc] Update remaining uint32 to use lanemask_t
Jon Chesterfield [Fri, 4 Oct 2019 22:30:28 +0000 (22:30 +0000)]
[libomptarget][nfc] Update remaining uint32 to use lanemask_t

Summary:
[libomptarget][nfc] Update remaining uint32 to use lanemask_t

Update a few functions in the API to use lanemask_t instead of i32. NFC for
nvptx. Also update the ActiveThreads type in DataSharingStateTy.
This removes a lot of #ifdef from the downsteam amdgcn implementation.

Reviewers: ABataev, jdoerfert, grokos, ronlieb, RaviNarayanaswamy

Subscribers: openmp-commits

Tags: #openmp

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

llvm-svn: 373806

4 years agoRevert [CodeGen] Do the Simple Early Return in block-placement pass to optimize the...
Reid Kleckner [Fri, 4 Oct 2019 22:24:21 +0000 (22:24 +0000)]
Revert [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

This reverts r371177 (git commit f879c6875563c0a8cd838f1e13b14dd33558f1f8)

It caused PR43566 by removing empty, address-taken MachineBasicBlocks.
Such blocks may have references from blockaddress or other operands, and
need more consideration to be removed.

See the PR for a test case to use when relanding.

llvm-svn: 373805

4 years ago[test] Run TestLaunchWithShellExpand with /bin/sh on POSIX.
Jonas Devlieghere [Fri, 4 Oct 2019 22:21:35 +0000 (22:21 +0000)]
[test] Run TestLaunchWithShellExpand with /bin/sh on POSIX.

Now that we do shell expansion on POSIX with the user's shel, this test
can potentially fail. This should ensure that we always use /bin/sh.

llvm-svn: 373804

4 years ago[MachO] Move nlist parsing into helper function (NFC)
Jonas Devlieghere [Fri, 4 Oct 2019 22:21:32 +0000 (22:21 +0000)]
[MachO] Move nlist parsing into helper function (NFC)

llvm-svn: 373803

4 years ago[InstCombine] Fold 'icmp eq/ne (?trunc (lshr/ashr %x, bitwidth(x)-1)), 0' -> 'icmp...
Roman Lebedev [Fri, 4 Oct 2019 22:16:22 +0000 (22:16 +0000)]
[InstCombine] Fold 'icmp eq/ne (?trunc (lshr/ashr %x, bitwidth(x)-1)), 0' -> 'icmp sge/slt %x, 0'

We do indeed already get it right in some cases, but only transitively,
with one-use restrictions. Since we only need to produce a single
comparison, it makes sense to match the pattern directly:
  https://rise4fun.com/Alive/kPg

llvm-svn: 373802

4 years ago[InstCombine] Right-shift shift amount reassociation with truncation (PR43564, PR42391)
Roman Lebedev [Fri, 4 Oct 2019 22:16:11 +0000 (22:16 +0000)]
[InstCombine] Right-shift shift amount reassociation with truncation (PR43564, PR42391)

Initially (D65380) i believed that if we have rightshift-trunc-rightshift,
we can't do any folding. But as it usually happens, i was wrong.

https://rise4fun.com/Alive/GEw
https://rise4fun.com/Alive/gN2O

In https://bugs.llvm.org/show_bug.cgi?id=43564 we happen to have
this very sequence, of two right shifts separated by trunc.
And "just" so that happens, we apparently can fold the pattern
if the total shift amount is either 0, or it's equal to the bitwidth
of the innermost widest shift - i.e. if we are left with only the
original sign bit. Which is exactly what is wanted there.

llvm-svn: 373801

4 years ago[NFC][InstCombine] Autogenerate shift.ll test
Roman Lebedev [Fri, 4 Oct 2019 22:15:57 +0000 (22:15 +0000)]
[NFC][InstCombine] Autogenerate shift.ll test

llvm-svn: 373800

4 years ago[NFC][InstCombine] Autogenerate icmp-shr-lt-gt.ll test
Roman Lebedev [Fri, 4 Oct 2019 22:15:49 +0000 (22:15 +0000)]
[NFC][InstCombine] Autogenerate icmp-shr-lt-gt.ll test

llvm-svn: 373799

4 years ago[NFC][InstCombine] Tests for bit test via highest sign-bit extract (w/ trunc) (PR43564)
Roman Lebedev [Fri, 4 Oct 2019 22:15:41 +0000 (22:15 +0000)]
[NFC][InstCombine] Tests for bit test via highest sign-bit extract (w/ trunc) (PR43564)

https://rise4fun.com/Alive/x5IS

llvm-svn: 373798

4 years ago[NFC][InstCombine] Tests for right-shift shift amount reassociation (w/ trunc) (PR435...
Roman Lebedev [Fri, 4 Oct 2019 22:15:32 +0000 (22:15 +0000)]
[NFC][InstCombine] Tests for right-shift shift amount reassociation (w/ trunc) (PR43564, PR42391)

https://rise4fun.com/Alive/GEw

llvm-svn: 373797

4 years agoAdd an off-by-default option to enable testing for gdb pretty printers.
Sterling Augustine [Fri, 4 Oct 2019 22:15:28 +0000 (22:15 +0000)]
Add an off-by-default option to enable testing for gdb pretty printers.

Summary:
The current version of the pretty printers are not python3 compatible,
so turn them off by default until sufficiently improved.

Reviewers: MaskRay, tamur

Subscribers: mgorny, christof, llvm-commits

Tags: #llvm

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

llvm-svn: 373796

4 years ago[debugserver] Don't link against Cocoa, it's not needed.
Davide Italiano [Fri, 4 Oct 2019 21:51:35 +0000 (21:51 +0000)]
[debugserver] Don't link against Cocoa, it's not needed.

<rdar://problem/55916729>

llvm-svn: 373795

4 years ago[lit] Use better name for "test in parallel" concept
Julian Lettner [Fri, 4 Oct 2019 21:40:20 +0000 (21:40 +0000)]
[lit] Use better name for "test in parallel" concept

In the past, lit used threads to run tests in parallel. Today we use
`multiprocessing.Pool`, which uses processes. Let's stay more abstract
and use "worker" everywhere.

Reviewed By: rnk

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

llvm-svn: 373794

4 years agoUse named constant to indicate all lanes, to handle 32 and 64 wide architectures
Jon Chesterfield [Fri, 4 Oct 2019 21:39:22 +0000 (21:39 +0000)]
Use named constant to indicate all lanes, to handle 32 and 64 wide architectures

Summary: Use named constant to indicate all lanes, to handle 32 and 64 wide architectures

Reviewers: ABataev, jdoerfert, grokos, ronlieb

Reviewed By: grokos

Subscribers: ronlieb, openmp-commits

Tags: #openmp

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

llvm-svn: 373793

4 years ago[clang] fix a typo from r372531
Yuanfang Chen [Fri, 4 Oct 2019 21:37:20 +0000 (21:37 +0000)]
[clang] fix a typo from r372531

Reviewers: xbolva00

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373792

4 years ago[MachineOutliner] Disable outlining from noreturn functions
Jessica Paquette [Fri, 4 Oct 2019 21:24:12 +0000 (21:24 +0000)]
[MachineOutliner] Disable outlining from noreturn functions

Outlining from noreturn functions doesn't do the correct thing right now. The
outliner should respect that the caller is marked noreturn. In the event that
we have a noreturn function, and the outlined code is in tail position, the
outliner will not see that the outlined function should be tail called. As a
result, you end up with a regular call containing a return.

Fixing this requires that we check that all candidates live inside noreturn
functions. So, for the sake of correctness, don't outline from noreturn
functions right now.

Add machine-outliner-noreturn.mir to test this.

llvm-svn: 373791

4 years agoExpand on the qfProcessInfo documentation, add examples from
Jason Molenda [Fri, 4 Oct 2019 21:01:52 +0000 (21:01 +0000)]
Expand on the qfProcessInfo documentation, add examples from
lldb-gdb-remote.txt and text explaining the no-criteria mode.

llvm-svn: 373789

4 years ago[InstCombine] add tests for fneg disguised as fmul; NFC
Sanjay Patel [Fri, 4 Oct 2019 20:54:14 +0000 (20:54 +0000)]
[InstCombine] add tests for fneg disguised as fmul; NFC

llvm-svn: 373788

4 years ago[lldb] [testsuite] Mark TestSBCommandReturnObject as failing on Windows
Jan Kratochvil [Fri, 4 Oct 2019 20:49:44 +0000 (20:49 +0000)]
[lldb] [testsuite] Mark TestSBCommandReturnObject as failing on Windows

Filed:
testsuite: TestSBCommandReturnObject: object has no attribute 'dylibPath'
https://bugs.llvm.org/show_bug.cgi?id=43570

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/9530/steps/test/logs/stdio

AttributeError: 'TestSBCommandReturnObject' object has no attribute 'dylibPath'

Fix crash on SBCommandReturnObject & assignment
https://reviews.llvm.org/D67589
  env = {self.dylibPath: self.getLLDBLibraryEnvVal()}

I do not know how to link with liblldb on Windows so marking it as failing on
Windows.

llvm-svn: 373787

4 years ago[clang-tools-extra] [cmake] Link against libclang-cpp whenever possible
Michal Gorny [Fri, 4 Oct 2019 20:30:02 +0000 (20:30 +0000)]
[clang-tools-extra] [cmake] Link against libclang-cpp whenever possible

Use clang_target_link_libraries() in order to support linking against
libclang-cpp instead of static libraries.

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

llvm-svn: 373786

4 years ago[clang] [cmake] Use add_clang_tool() to install all tools
Michal Gorny [Fri, 4 Oct 2019 20:28:59 +0000 (20:28 +0000)]
[clang] [cmake] Use add_clang_tool() to install all tools

Switch clang-check, clang-extdef-mapping and clang-offload-bundler
to use add_clang_tool() rather than add_clang_executable() with a custom
install rule.  This makes them LLVM_DISTRIBUTION_COMPONENTS-friendly.

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

llvm-svn: 373785

4 years ago[NFC] Add { } to silence compiler warning [-Wmissing-braces].
Huihui Zhang [Fri, 4 Oct 2019 20:04:34 +0000 (20:04 +0000)]
[NFC] Add { } to silence compiler warning [-Wmissing-braces].

../llvm-project/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp:355:48: warning: suggest braces around initialization of subobject [-Wmissing-braces]
      return addMappingFromTable<1>(MI, MRI, { 0 }, Table);
                                               ^
                                               {}

llvm-svn: 373784

4 years ago[Host] Return status directly from RunShellCommand
Jonas Devlieghere [Fri, 4 Oct 2019 19:54:45 +0000 (19:54 +0000)]
[Host] Return status directly from RunShellCommand

Thanks for catching this, Pavel!

llvm-svn: 373783

4 years ago[ScheduleDAG] When a node is cloned, add an edge between the nodes.
Eli Friedman [Fri, 4 Oct 2019 19:51:40 +0000 (19:51 +0000)]
[ScheduleDAG] When a node is cloned, add an edge between the nodes.

InstrEmitter's virtual register handling assumes that clones are emitted
after the cloned node.  Make sure this assumption actually holds.

Fixes a "Node emitted out of order - early" assertion on the testcase.

This is probably a very rare case to actually hit in practice; even
without the explicit edge, the scheduler will usually end up scheduling
the nodes in the expected order due to other constraints.

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

llvm-svn: 373782

4 years ago[LLD] [COFF] Always demangle the __imp_ prefix to __declspec(dllimport)
Martin Storsjo [Fri, 4 Oct 2019 19:47:59 +0000 (19:47 +0000)]
[LLD] [COFF] Always demangle the __imp_ prefix to __declspec(dllimport)

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

llvm-svn: 373781

4 years ago[test] Remove another two unnecessary uses of REQUIRES: target-windows. NFC.
Martin Storsjo [Fri, 4 Oct 2019 19:47:48 +0000 (19:47 +0000)]
[test] Remove another two unnecessary uses of REQUIRES: target-windows. NFC.

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

llvm-svn: 373780

4 years ago[JITLink] Silence GCC warnings. NFC.
Martin Storsjo [Fri, 4 Oct 2019 19:47:42 +0000 (19:47 +0000)]
[JITLink] Silence GCC warnings. NFC.

Use parentheses in an expression with mixed && and ||.

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

llvm-svn: 373779

4 years ago[MachO] Add early returns to save some indentation.
Jonas Devlieghere [Fri, 4 Oct 2019 19:37:59 +0000 (19:37 +0000)]
[MachO] Add early returns to save some indentation.

This file really suffered from the Great Reformat. I'm adding a few
early returns to give the deeply nested code some more breathing room.

llvm-svn: 373778

4 years ago[MachO] Reformat before making changes to this file (NFC)
Jonas Devlieghere [Fri, 4 Oct 2019 19:37:52 +0000 (19:37 +0000)]
[MachO] Reformat before making changes to this file (NFC)

llvm-svn: 373777

4 years ago[Host] Don't discard return value from RunShellCommand
Jonas Devlieghere [Fri, 4 Oct 2019 19:37:46 +0000 (19:37 +0000)]
[Host] Don't discard return value from RunShellCommand

The recent change to expand arguments with the user's shell sometimes
caused a timeout and the error was not propagated.

llvm-svn: 373776

4 years ago[lldb] Fix crash on SBCommandReturnObject & assignment
Jan Kratochvil [Fri, 4 Oct 2019 19:32:57 +0000 (19:32 +0000)]
[lldb] Fix crash on SBCommandReturnObject & assignment

I was writing an SB API client and it was crashing on:
bool DoExecute(SBDebugger dbg, char **command, SBCommandReturnObject &result) {
  result = subcommand(dbg, "help");

That is because SBCommandReturnObject &result gets initialized inside LLDB by:
bool DoExecute(Args &command, CommandReturnObject &result) override {
  // std::unique_ptr gets initialized here from `&result`!!!
  SBCommandReturnObject sb_return(&result);
  DoExecute(...);
  sb_return.Release();

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

llvm-svn: 373775

4 years ago[Sema] Split out -Wformat-type-confusion from -Wformat-pedantic
Erik Pilkington [Fri, 4 Oct 2019 19:20:27 +0000 (19:20 +0000)]
[Sema] Split out -Wformat-type-confusion from -Wformat-pedantic

The warnings now in -Wformat-type-confusion don't align with how we interpret
'pedantic' in clang, and don't belong in -pedantic.

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

llvm-svn: 373774

4 years ago[libc++] Make the modules-related flags PUBLIC instead of PRIVATE
Louis Dionne [Fri, 4 Oct 2019 19:10:56 +0000 (19:10 +0000)]
[libc++] Make the modules-related flags PUBLIC instead of PRIVATE

It appears that those need to be propagated to targets that use libc++
as well, otherwise they don't build properly.

llvm-svn: 373773