OSDN Git Service

android-x86/external-llvm.git
5 years ago[InstSimplify] Teach fsub -0.0, (fneg X) ==> X about unary fneg
Cameron McInally [Mon, 20 May 2019 13:13:35 +0000 (13:13 +0000)]
[InstSimplify] Teach fsub -0.0, (fneg X) ==> X about unary fneg

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361151 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoResubmit "[DebugInfo] Update loop metadata for inlined loops"
Orlando Cazalet-Hyams [Mon, 20 May 2019 13:02:30 +0000 (13:02 +0000)]
Resubmit "[DebugInfo] Update loop metadata for inlined loops"

This reverts commit 95805bc425b264805a472232a75ed2ffe58aceda.
I've squashed the test fix into this commit.

[DebugInfo] Update loop metadata for inlined loops

Currently, when a loop is cloned while inlining function (A) into function (B)
the loop metadata is copied and then not modified at all. The loop metadata can
encode the loop's start and end DILocations. Therefore, the new inlined loop in
function (B) may have loop metadata which shows start and end locations residing
in function (A).

This patch ensures loop metadata is updated while inlining so that the start and
end DILocations are given the "inlinedAt" operand. I've also added a regression
test for this.

This fix is required for D60831 because that patch uses loop metadata to
determine the DILocation for the branches of new loop preheaders.

Reviewers: aprantl, dblaikie, anemet

Reviewed By: aprantl

Subscribers: eraman, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361149 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[DebugInfo] Update loop metadata for inlined loops"
Orlando Cazalet-Hyams [Mon, 20 May 2019 11:24:39 +0000 (11:24 +0000)]
Revert "[DebugInfo] Update loop metadata for inlined loops"

This reverts commit 6e8f1a80cd988db8870aff9c3bc2ca7a20e04104.
Reverting patch while investigating build bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361143 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Refactor visitIntrinsicCall so it doesn't return a const char*
Guillaume Chatelet [Mon, 20 May 2019 11:01:30 +0000 (11:01 +0000)]
[NFC] Refactor visitIntrinsicCall so it doesn't return a const char*

Summary: API simplification

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361140 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfoMetadata] Refactor DIExpression::prepend constants (NFC)
Petar Jovanovic [Mon, 20 May 2019 10:35:57 +0000 (10:35 +0000)]
[DebugInfoMetadata] Refactor DIExpression::prepend constants (NFC)

Refactor DIExpression::With* into a flag enum in order to be less
error-prone to use (as discussed on D60866).

Patch by Djordje Todorovic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361137 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE2] Asm: add int halving add/sub (predicated) instructions
Cullen Rhodes [Mon, 20 May 2019 10:35:23 +0000 (10:35 +0000)]
[AArch64][SVE2] Asm: add int halving add/sub (predicated) instructions

Summary:
This patch adds support for the predicated integer halving add/sub
instructions:

    * SHADD, UHADD, SRHADD, URHADD
    * SHSUB, UHSUB, SHSUBR, UHSUBR

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: rovka

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361136 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE2] Asm: add saturating multiply-add interleaved long instructions
Cullen Rhodes [Mon, 20 May 2019 10:29:48 +0000 (10:29 +0000)]
[AArch64][SVE2] Asm: add saturating multiply-add interleaved long instructions

Summary:
Patch adds support for SQDMLALBT and SQDMLSLBT instructions.

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: rovka

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361135 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse llvm::sort. NFC
Fangrui Song [Mon, 20 May 2019 10:18:35 +0000 (10:18 +0000)]
Use llvm::sort. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361134 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMatch types of accumulator and result for llvm.experimental.vector.reduce.fadd/fmul
Sander de Smalen [Mon, 20 May 2019 09:54:06 +0000 (09:54 +0000)]
Match types of accumulator and result for llvm.experimental.vector.reduce.fadd/fmul

The scalar start/accumulator value of the fadd- and fmul reduction
should match the result type of the reduction, as well as the vector
element-type of the input vector. Although this was not explicitly
specified in the LangRef, it was taken for granted in code implementing
the reductions. The patch also fixes the LangRef by adding this
constraint.

Reviewed By: aemerson, nikic

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361133 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Update loop metadata for inlined loops
Orlando Cazalet-Hyams [Mon, 20 May 2019 09:40:44 +0000 (09:40 +0000)]
[DebugInfo] Update loop metadata for inlined loops

Summary:
Currently, when a loop is cloned while inlining function (A) into function (B) the loop metadata is copied and then not modified at all. The loop metadata can encode the loop's start and end DILocations. Therefore, the new inlined loop in function (B) may have loop metadata which shows start and end locations residing in function (A).

This patch ensures loop metadata is updated while inlining so that the start and end DILocations are given the "inlinedAt" operand. I've also added a regression test for this.

This fix is required for D60831 because that patch uses loop metadata to determine the DILocation for the branches of new loop preheaders.

Reviewers: aprantl, dblaikie, anemet

Reviewed By: aprantl

Subscribers: eraman, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361132 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[NFC] Refactor visitIntrinsicCall so it doesn't return a const char*"
Guillaume Chatelet [Mon, 20 May 2019 09:00:12 +0000 (09:00 +0000)]
Revert "[NFC] Refactor visitIntrinsicCall so it doesn't return a const char*"

This reverts commit 706d3cd6388cc3446aab282f3af879862b10cbed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361130 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Refactor visitIntrinsicCall so it doesn't return a const char*
Guillaume Chatelet [Mon, 20 May 2019 08:52:10 +0000 (08:52 +0000)]
[NFC] Refactor visitIntrinsicCall so it doesn't return a const char*

Summary: API simplification

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361129 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] gfx1010 Avoid SMEM WAR hazard for some s_waitcnt values
Carl Ritson [Mon, 20 May 2019 07:20:12 +0000 (07:20 +0000)]
[AMDGPU] gfx1010 Avoid SMEM WAR hazard for some s_waitcnt values

Summary:
Avoid introducing hazard mitigation when lgkmcnt is reduced to 0.
Clarify code comments to explain assumptions made for this hazard
mitigation.  Expand and correct test cases to cover variants of
s_waitcnt.

Reviewers: nhaehnle, rampitec

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

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361124 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r361117
Nico Weber [Mon, 20 May 2019 00:51:16 +0000 (00:51 +0000)]
gn build: Merge r361117

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361121 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstSimplify] fold fcmp (maxnum, X, C1), C2
Sanjay Patel [Sun, 19 May 2019 14:26:39 +0000 (14:26 +0000)]
[InstSimplify] fold fcmp (maxnum, X, C1), C2

This is the sibling transform for rL360899 (D61691):

  maxnum(X, GreaterC) == C --> false
  maxnum(X, GreaterC) <= C --> false
  maxnum(X, GreaterC) <  C --> false
  maxnum(X, GreaterC) >= C --> true
  maxnum(X, GreaterC) >  C --> true
  maxnum(X, GreaterC) != C --> true

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361118 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLP] Refactoring of EdgeInfo and UserTreeIdx in buildTree_rec().
Dinar Temirbulatov [Sun, 19 May 2019 01:30:41 +0000 (01:30 +0000)]
[SLP] Refactoring of EdgeInfo and UserTreeIdx in buildTree_rec().

This is a follow-up refactoring patch after the introduction of usable TreeEntry pointers in D61706.
The EdgeInfo struct can now use a TreeEntry pointer instead of an index in VectorizableTree.

Committed on behalf of @vporpo (Vasileios Porpodas)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361110 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove combineShift function. Just dispatch directly to the handler for each...
Craig Topper [Sun, 19 May 2019 01:01:46 +0000 (01:01 +0000)]
[X86] Remove combineShift function. Just dispatch directly to the handler for each flavor from the main switch. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361108 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CommandLine] Reduce size of Option class
Don Hinton [Sat, 18 May 2019 20:46:35 +0000 (20:46 +0000)]
[CommandLine] Reduce size of Option class

Summary:
Reduce size of Option class from 184 bytes to 136 bytes by
placing more member variables in Bit Field (16 bytes), and
reducing the initial sizes of Categories and Subs to 1 (32 bytes).

Saves about 48k for bin/opt.

Reviewed By: beanz

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361107 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][AArch64] Autogenerate fcopysign.ll test
Roman Lebedev [Sat, 18 May 2019 20:24:40 +0000 (20:24 +0000)]
[NFC][AArch64] Autogenerate fcopysign.ll test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361106 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][AArch64] Autogenerate bitfield-insert.ll, selectcc-to-shiftand.ll tests
Roman Lebedev [Sat, 18 May 2019 17:42:06 +0000 (17:42 +0000)]
[NFC][AArch64] Autogenerate bitfield-insert.ll, selectcc-to-shiftand.ll tests

Investigating bit-extract (ubfx) pattern with shifted mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361105 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AVR] Fix 'symbol_relocations.s' MC test
Dylan McKay [Sat, 18 May 2019 16:38:48 +0000 (16:38 +0000)]
[AVR] Fix 'symbol_relocations.s' MC test

This was broken in r360143, when the 'rela.' prefix was stripped from
section names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361104 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGVN: Handle addrspacecast
Matt Arsenault [Sat, 18 May 2019 14:36:06 +0000 (14:36 +0000)]
GVN: Handle addrspacecast

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361103 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][AArch64] Add some ubfx tests with immediates
Roman Lebedev [Sat, 18 May 2019 13:49:44 +0000 (13:49 +0000)]
[NFC][AArch64] Add some ubfx tests with immediates

Shows the regression in D62100

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361102 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUpdateTestChecks: fix AMDGPU handling
Roman Lebedev [Sat, 18 May 2019 13:00:03 +0000 (13:00 +0000)]
UpdateTestChecks: fix AMDGPU handling

Summary:
Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner,
this test changes, but makes `update_llc_test_checks.py` unhappy.

**Many** AMDGPU tests specify `-march`, not `-mtriple`, which results in `update_llc_test_checks.py`
defaulting to x86 asm function detection heuristics, which don't work here.
I propose to fix this by adding an infrastructure to map from `-march` to `-mtriple`,
in the UpdateTestChecks tooling.

Reviewers: RKSimon, MaskRay, arsenm

Reviewed By: arsenm

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

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361101 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUpdateTestChecks: arm64-eabi handlind
Roman Lebedev [Sat, 18 May 2019 12:59:56 +0000 (12:59 +0000)]
UpdateTestChecks: arm64-eabi handlind

Summary:
Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner,
this test changes, but makes `update_llc_test_checks.py` unhappy

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361100 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI.
Simon Pilgrim [Sat, 18 May 2019 11:31:48 +0000 (11:31 +0000)]
MemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI.

Fix scan-build uninitialized warning and assert the final diff isn't null.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361095 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Fix some RST errors.
Lang Hames [Sat, 18 May 2019 03:23:18 +0000 (03:23 +0000)]
[docs] Fix some RST errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361092 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUpdate llvm-nm -s to use a multi-var option
Michael Trent [Sat, 18 May 2019 03:17:27 +0000 (03:17 +0000)]
Update llvm-nm -s to use a multi-var option

Summary:
Previously llvm-nm relied on a positional parameter to read two values
into the SegSect list. This worked, but required the "-s" paramater and
its arguments to be the last elements on the command-line.

The CommandLine library now supports mutli-var parameters, so it can
naturally deal with "-s" expecting two arguments, and now the input file
can appear anywhere (within reason) in the command line invocation. E.g.

    llvm-nm -s __TEXT __text /bin/ls
    llvm-nm /bin/ls -s __TEXT __text

rdar://27284011

Reviewers: lhames, pete

Reviewed By: pete

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361091 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs][ORC] Start work on an ORC design doc. Very much a work in progress.
Lang Hames [Sat, 18 May 2019 03:08:49 +0000 (03:08 +0000)]
[docs][ORC] Start work on an ORC design doc. Very much a work in progress.

This initial version describes some of the high level design goals and basic
symbol lookup rules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361089 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Implement s64->s64 [SU]ITOFP
Matt Arsenault [Fri, 17 May 2019 23:05:18 +0000 (23:05 +0000)]
AMDGPU/GlobalISel: Implement s64->s64 [SU]ITOFP

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361082 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Implement lower for S64->S32 [SU]ITOFP
Matt Arsenault [Fri, 17 May 2019 23:05:13 +0000 (23:05 +0000)]
GlobalISel: Implement lower for S64->S32 [SU]ITOFP

This is ported from the custom AMDGPU DAG implementation. I think this
is a better default expansion than what the DAG currently uses, at
least if the target has CTLZ.

This implements the signed version in terms of the unsigned
conversion, which is implemented with bit operations. SelectionDAG has
several other implementations that should eventually be ported
depending on what instructions are legal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361081 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll
Cameron McInally [Fri, 17 May 2019 21:10:11 +0000 (21:10 +0000)]
[NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361076 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agobuild: use clang-cl for runtimes when targeting Windows
Saleem Abdulrasool [Fri, 17 May 2019 20:09:06 +0000 (20:09 +0000)]
build: use clang-cl for runtimes when targeting Windows

When targeting Windows and building a runtime (subproject) prefer to use
`clang-cl` rather than the `clang` driver.  This allows us to cross-compile
runtimes for the Windows environment from Linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361072 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Remove expected failure of builtin-location.C test
Sam Clegg [Fri, 17 May 2019 19:55:17 +0000 (19:55 +0000)]
[WebAssembly] Remove expected failure of builtin-location.C test

This seems to have been fixed by https://reviews.llvm.org/D61956

Yay

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361071 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r360993
Nico Weber [Fri, 17 May 2019 18:37:46 +0000 (18:37 +0000)]
gn build: Merge r360993

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361062 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Define integer min/max instructions
Matt Arsenault [Fri, 17 May 2019 18:36:31 +0000 (18:36 +0000)]
GlobalISel: Define integer min/max instructions

Doesn't attempt to emit them for anything yet, but some legalizations
I want to port use them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361061 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][InstSimplify] Precommit new unary fneg test
Cameron McInally [Fri, 17 May 2019 18:34:35 +0000 (18:34 +0000)]
[NFC][InstSimplify] Precommit new unary fneg test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361060 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"
Nico Weber [Fri, 17 May 2019 18:31:24 +0000 (18:31 +0000)]
Revert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"

It fails to build on some bots.

Also revert follow-up r361055.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361059 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] move bitcast after insertelement-with-bitcasted-operands
Sanjay Patel [Fri, 17 May 2019 18:06:12 +0000 (18:06 +0000)]
[InstCombine] move bitcast after insertelement-with-bitcasted-operands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361058 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][InstSImplify] Fix flip-flopped comments and test names
Cameron McInally [Fri, 17 May 2019 17:59:17 +0000 (17:59 +0000)]
[NFC][InstSImplify] Fix flip-flopped comments and test names

In test/Transforms/InstSimplify/floating-point-arithmetic.ll

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361057 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Fold movmsk(not(x)) -> not(movmsk)
Simon Pilgrim [Fri, 17 May 2019 17:56:25 +0000 (17:56 +0000)]
[X86][SSE] Fold movmsk(not(x)) -> not(movmsk)

Helps to improve folding of comparisons with movmsk results.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361056 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r361033
Nico Weber [Fri, 17 May 2019 17:36:06 +0000 (17:36 +0000)]
gn build: Merge r361033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361055 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r360991
Nico Weber [Fri, 17 May 2019 17:32:00 +0000 (17:32 +0000)]
gn build: Merge r360991

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361053 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Match all-of bool scalar reductions into a bitcast/movmsk + cmp.
Simon Pilgrim [Fri, 17 May 2019 17:25:55 +0000 (17:25 +0000)]
[X86][SSE] Match all-of bool scalar reductions into a bitcast/movmsk + cmp.

Same as what we do for vector reductions in combineHorizontalPredicateResult, use movmsk+cmp for scalar (and(extract(x,0),extract(x,1)) reduction patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361052 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for insertelement with bitcasted operands; NFC
Sanjay Patel [Fri, 17 May 2019 17:23:13 +0000 (17:23 +0000)]
[InstCombine] add tests for insertelement with bitcasted operands; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361051 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstSimplify] Add unary fneg to `fsub 0.0, (fneg X) ==> X` transform
Cameron McInally [Fri, 17 May 2019 16:47:00 +0000 (16:47 +0000)]
[InstSimplify] Add unary fneg to `fsub 0.0, (fneg X) ==> X` transform

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361047 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Corrected parsing of NAME:VALUE modifiers
Dmitry Preobrazhensky [Fri, 17 May 2019 16:04:17 +0000 (16:04 +0000)]
[AMDGPU][MC] Corrected parsing of NAME:VALUE modifiers

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

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361045 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] visitShiftByConstant(): drop bogus signbit check
Roman Lebedev [Fri, 17 May 2019 15:52:58 +0000 (15:52 +0000)]
[DAGCombiner] visitShiftByConstant(): drop bogus signbit check

Summary:
That check claims that the transform is illegal otherwise.
That isn't true:
1. For `ISD::ADD`, we only process `ISD::SHL` outer shift => sign bit does not matter
   https://rise4fun.com/Alive/K4A
2. For `ISD::AND`, there is no restriction on constants:
   https://rise4fun.com/Alive/Wy3
3. For `ISD::OR`, there is no restriction on constants:
   https://rise4fun.com/Alive/GOH
3. For `ISD::XOR`, there is no restriction on constants:
   https://rise4fun.com/Alive/ml6

So, why is it there then?

This changes the testcase that was touched by @spatel in rL347478,
but i'm not sure that test tests anything particular?

Reviewers: RKSimon, spatel, craig.topper, jojo, rengolin

Reviewed By: spatel

Subscribers: javed.absar, llvm-commits, spatel

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361044 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] canShiftBinOpWithConstantRHS(): drop bogus signbit check
Roman Lebedev [Fri, 17 May 2019 15:52:49 +0000 (15:52 +0000)]
[InstCombine] canShiftBinOpWithConstantRHS(): drop bogus signbit check

Summary:
In D61918 i was looking at dropping it in DAGCombiner `visitShiftByConstant()`,
but as @craig.topper pointed out, it was copied from here.

That check claims that the transform is illegal otherwise.
That isn't true:
1. For `ISD::ADD`, we only process `ISD::SHL` outer shift => sign bit does not matter
   https://rise4fun.com/Alive/K4A
2. For `ISD::AND`, there is no restriction on constants:
   https://rise4fun.com/Alive/Wy3
3. For `ISD::OR`, there is no restriction on constants:
   https://rise4fun.com/Alive/GOH
3. For `ISD::XOR`, there is no restriction on constants:
   https://rise4fun.com/Alive/ml6

So, why is it there then?
As far as i can tell, it dates all the way back to original check-in rL7793.
I think we should just drop it.

Reviewers: spatel, craig.topper, efriedma, majnemer

Reviewed By: spatel

Subscribers: llvm-commits, craig.topper

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361043 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Enabled labels with s_call_b64 and s_cbranch_i_fork
Dmitry Preobrazhensky [Fri, 17 May 2019 14:57:04 +0000 (14:57 +0000)]
[AMDGPU][MC] Enabled labels with s_call_b64 and s_cbranch_i_fork

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

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361040 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] Remove LowerCTTZ's AVX1 custom vector handling.
Simon Pilgrim [Fri, 17 May 2019 14:37:19 +0000 (14:37 +0000)]
[X86][AVX] Remove LowerCTTZ's AVX1 custom vector handling.

We can now rely on generic expansion to handle this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361038 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] isNOT - add extract_subvector(xor X, -1) -> extract_subvector(X) fold.
Simon Pilgrim [Fri, 17 May 2019 14:04:56 +0000 (14:04 +0000)]
[X86][AVX] isNOT - add extract_subvector(xor X, -1) -> extract_subvector(X) fold.

Prep work for the removal of the remaining x86 CTTZ vector lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361035 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Enabled expressions for most operands which accept integer values
Dmitry Preobrazhensky [Fri, 17 May 2019 13:17:48 +0000 (13:17 +0000)]
[AMDGPU][MC] Enabled expressions for most operands which accept integer values

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

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361031 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Fix unused variable warnings in release builds
Matt Arsenault [Fri, 17 May 2019 12:59:27 +0000 (12:59 +0000)]
AMDGPU: Fix unused variable warnings in release builds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361030 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Legalize G_FCEIL
Matt Arsenault [Fri, 17 May 2019 12:20:05 +0000 (12:20 +0000)]
AMDGPU/GlobalISel: Legalize G_FCEIL

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361028 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Legalize G_INTRINSIC_TRUNC
Matt Arsenault [Fri, 17 May 2019 12:20:01 +0000 (12:20 +0000)]
AMDGPU/GlobalISel: Legalize G_INTRINSIC_TRUNC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361027 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Legalize G_FRINT
Matt Arsenault [Fri, 17 May 2019 12:19:57 +0000 (12:19 +0000)]
AMDGPU/GlobalISel: Legalize G_FRINT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361026 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Legalize G_FCOPYSIGN
Matt Arsenault [Fri, 17 May 2019 12:19:52 +0000 (12:19 +0000)]
AMDGPU/GlobalISel: Legalize G_FCOPYSIGN

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361025 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MergeICmps][NFC] Add more debug.
Clement Courbet [Fri, 17 May 2019 12:07:51 +0000 (12:07 +0000)]
[MergeICmps][NFC] Add more debug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361024 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: RegBankSelect for llvm.amdgcn.s.buffer.load
Matt Arsenault [Fri, 17 May 2019 12:02:34 +0000 (12:02 +0000)]
AMDGPU/GlobalISel: RegBankSelect for llvm.amdgcn.s.buffer.load

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361023 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Use subreg index instead of extra unmerge
Matt Arsenault [Fri, 17 May 2019 12:02:31 +0000 (12:02 +0000)]
AMDGPU/GlobalISel: Use subreg index instead of extra unmerge

This saves instructions and extra steps, but I'm not sure about
introducing subregister indexes at this point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361022 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Use waterfall loop for buffer_load
Matt Arsenault [Fri, 17 May 2019 12:02:27 +0000 (12:02 +0000)]
AMDGPU/GlobalISel: Use waterfall loop for buffer_load

This adds support for more complex waterfall loops that need to handle
operands > 32-bits, and multiple operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361021 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Fix missing version of customFor
Matt Arsenault [Fri, 17 May 2019 11:49:41 +0000 (11:49 +0000)]
GlobalISel: Fix missing version of customFor

Add the list of pairs analagous, like legalFor and customFor has.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361020 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Add fp<->int casts to MachineIRBuilder
Matt Arsenault [Fri, 17 May 2019 11:49:39 +0000 (11:49 +0000)]
GlobalISel: Add fp<->int casts to MachineIRBuilder

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361019 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Add MIRBuilder wrappers for bitcount instructions
Matt Arsenault [Fri, 17 May 2019 11:49:35 +0000 (11:49 +0000)]
GlobalISel: Add MIRBuilder wrappers for bitcount instructions

Various expansions use these.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361018 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Pull out IsNOT helper. NFCI.
Simon Pilgrim [Fri, 17 May 2019 10:37:08 +0000 (10:37 +0000)]
[X86] Pull out IsNOT helper. NFCI.

Return the input value for the NOT pattern: (xor X, -1) -> X

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361012 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRe-land r360859: "[MergeICmps] Simplify the code."
Clement Courbet [Fri, 17 May 2019 09:43:45 +0000 (09:43 +0000)]
Re-land r360859: "[MergeICmps] Simplify  the code."

With a fix for PR41917: The predecessor list was changing under our feet.

-  for (BasicBlock *Pred : predecessors(EntryBlock_)) {
+  while (!pred_empty(EntryBlock_)) {
+    BasicBlock* const Pred = *pred_begin(EntryBlock_);

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361009 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] detect WaW hazards when moving/merging load/store instructions
Rhys Perry [Fri, 17 May 2019 09:32:23 +0000 (09:32 +0000)]
[AMDGPU] detect WaW hazards when moving/merging load/store instructions

Summary:
    In order to combine memory operations efficiently, the load/store
    optimizer might move some instructions around. It's usually safe
    to move instructions down past the merged instruction because the
    pass checks if memory operations can be re-ordered.

    Though, the current logic doesn't handle Write-after-Write hazards.

    This fixes a reflection issue with Monster Hunter World and DXVK.

    v2: - rebased on top of master
        - clean up the test case
        - handle WaW hazards correctly

    Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=40130

Original patch by Samuel Pitoiset.

Reviewers: tpr, arsenm, nhaehnle

Reviewed By: nhaehnle

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361008 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE2] Asm: add saturating multiply-add long instructions
Cullen Rhodes [Fri, 17 May 2019 09:29:43 +0000 (09:29 +0000)]
[AArch64][SVE2] Asm: add saturating multiply-add long instructions

Summary:
Patch adds support for indexed and unpredicated vectors forms of the
following instructions:

    * SQDMLALB, SQDMLALT, SQDMLSLB, SQDMLSLT

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361005 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE2] Asm: add integer multiply-add long instructions
Cullen Rhodes [Fri, 17 May 2019 09:19:41 +0000 (09:19 +0000)]
[AArch64][SVE2] Asm: add integer multiply-add long instructions

Summary:
Patch adds support for indexed and unpredicated vectors forms of the
following instructions:

    * SMLALB, SMLALT, UMLALB, UMLALT, SMLSLB, SMLSLT, UMLSLB, UMLSLT

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: rovka

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361003 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE2] Asm: add integer multiply long instructions
Cullen Rhodes [Fri, 17 May 2019 09:04:44 +0000 (09:04 +0000)]
[AArch64][SVE2] Asm: add integer multiply long instructions

Summary:
Patch adds support for indexed and unpredicated vectors forms of the
following instructions:

    * SMULLB, SMULLT, UMULLB, UMULLT, SQDMULLB, SQDMULLT

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: rovka

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361002 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MergeICmps] Add test from PR41917.
Clement Courbet [Fri, 17 May 2019 08:52:25 +0000 (08:52 +0000)]
[MergeICmps] Add test from PR41917.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361001 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Bugpoint] Only run plugins tests if plugins are enabled
Petr Hosek [Fri, 17 May 2019 06:41:04 +0000 (06:41 +0000)]
[Bugpoint] Only run plugins tests if plugins are enabled

This is a followup to r360991 which applies the same logic to LLVM.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360993 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add FeatureFastScalarShiftMasks and FeatureFastVectorShiftMasks to the ignore...
Craig Topper [Fri, 17 May 2019 06:40:21 +0000 (06:40 +0000)]
[X86] Add FeatureFastScalarShiftMasks and FeatureFastVectorShiftMasks to the ignore list for inlining compatibility.

These are tuning flags and won't cause any codegen issue if we inline a function
with a different value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360992 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Analysis] Only run plugins tests if plugins are actually enabled
Petr Hosek [Fri, 17 May 2019 06:07:37 +0000 (06:07 +0000)]
[Analysis] Only run plugins tests if plugins are actually enabled

When plugins aren't enabled, don't try to run plugins tests. Don't
enable plugins unconditionally based on the platform, instead check
if LLVM shared library is actually being built which may not be the
case for every host configuration, even if the host itself supports
plugins.

This addresses test failures introduced by r360891/D59464.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360991 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Support .reloc *, R_PPC{,64}_NONE, *
Fangrui Song [Fri, 17 May 2019 06:04:11 +0000 (06:04 +0000)]
[PowerPC] Support .reloc *, R_PPC{,64}_NONE, *

This can be used to create references among sections. When --gc-sections
is used, the referenced section will be retained if the origin section
is retained.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360990 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Fix -Wsign-compare on 32-bit -DLLVM_ENABLE_ASSERTIONS=on builds
Fangrui Song [Fri, 17 May 2019 05:53:39 +0000 (05:53 +0000)]
[GlobalISel] Fix -Wsign-compare on 32-bit -DLLVM_ENABLE_ASSERTIONS=on builds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360989 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MC][PowerPC] Clean up PPCAsmBackend
Fangrui Song [Fri, 17 May 2019 05:44:26 +0000 (05:44 +0000)]
[MC][PowerPC] Clean up PPCAsmBackend

Replace the member variable Target with Triple
Use Triple instead of TheTarget.getName() to dispatch on 32-bit/64-bit.
Delete redundant parameters

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360986 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ELF] Implement Dependent Libraries Feature
Ben Dunbobbin [Fri, 17 May 2019 03:44:15 +0000 (03:44 +0000)]
[ELF] Implement Dependent Libraries Feature

This patch implements a limited form of autolinking primarily designed to allow
either the --dependent-library compiler option, or "comment lib" pragmas (
https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=vs-2017) in
C/C++ e.g. #pragma comment(lib, "foo"), to cause an ELF linker to automatically
add the specified library to the link when processing the input file generated
by the compiler.

Currently this extension is unique to LLVM and LLD. However, care has been taken
to design this feature so that it could be supported by other ELF linkers.

The design goals were to provide:

- A simple linking model for developers to reason about.
- The ability to to override autolinking from the linker command line.
- Source code compatibility, where possible, with "comment lib" pragmas in other
  environments (MSVC in particular).

Dependent library support is implemented differently for ELF platforms than on
the other platforms. Primarily this difference is that on ELF we pass the
dependent library specifiers directly to the linker without manipulating them.
This is in contrast to other platforms where they are mapped to a specific
linker option by the compiler. This difference is a result of the greater
variety of ELF linkers and the fact that ELF linkers tend to handle libraries in
a more complicated fashion than on other platforms. This forces us to defer
handling the specifiers to the linker.

In order to achieve a level of source code compatibility with other platforms
we have restricted this feature to work with libraries that meet the following
"reasonable" requirements:

1. There are no competing defined symbols in a given set of libraries, or
   if they exist, the program owner doesn't care which is linked to their
   program.
2. There may be circular dependencies between libraries.

The binary representation is a mergeable string section (SHF_MERGE,
SHF_STRINGS), called .deplibs, with custom type SHT_LLVM_DEPENDENT_LIBRARIES
(0x6fff4c04). The compiler forms this section by concatenating the arguments of
the "comment lib" pragmas and --dependent-library options in the order they are
encountered. Partial (-r, -Ur) links are handled by concatenating .deplibs
sections with the normal mergeable string section rules. As an example, #pragma
comment(lib, "foo") would result in:

.section ".deplibs","MS",@llvm_dependent_libraries,1
         .asciz "foo"

For LTO, equivalent information to the contents of a the .deplibs section can be
retrieved by the LLD for bitcode input files.

LLD processes the dependent library specifiers in the following way:

1. Dependent libraries which are found from the specifiers in .deplibs sections
   of relocatable object files are added when the linker decides to include that
   file (which could itself be in a library) in the link. Dependent libraries
   behave as if they were appended to the command line after all other options. As
   a consequence the set of dependent libraries are searched last to resolve
   symbols.
2. It is an error if a file cannot be found for a given specifier.
3. Any command line options in effect at the end of the command line parsing apply
   to the dependent libraries, e.g. --whole-archive.
4. The linker tries to add a library or relocatable object file from each of the
   strings in a .deplibs section by; first, handling the string as if it was
   specified on the command line; second, by looking for the string in each of the
   library search paths in turn; third, by looking for a lib<string>.a or
   lib<string>.so (depending on the current mode of the linker) in each of the
   library search paths.
5. A new command line option --no-dependent-libraries tells LLD to ignore the
   dependent libraries.

Rationale for the above points:

1. Adding the dependent libraries last makes the process simple to understand
   from a developers perspective. All linkers are able to implement this scheme.
2. Error-ing for libraries that are not found seems like better behavior than
   failing the link during symbol resolution.
3. It seems useful for the user to be able to apply command line options which
   will affect all of the dependent libraries. There is a potential problem of
   surprise for developers, who might not realize that these options would apply
   to these "invisible" input files; however, despite the potential for surprise,
   this is easy for developers to reason about and gives developers the control
   that they may require.
4. This algorithm takes into account all of the different ways that ELF linkers
   find input files. The different search methods are tried by the linker in most
   obvious to least obvious order.
5. I considered adding finer grained control over which dependent libraries were
   ignored (e.g. MSVC has /nodefaultlib:<library>); however, I concluded that this
   is not necessary: if finer control is required developers can fall back to using
   the command line directly.

RFC thread: http://lists.llvm.org/pipermail/llvm-dev/2019-March/131004.html.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360984 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Support .reloc *, R_{386,X86_64}_NONE, *
Fangrui Song [Fri, 17 May 2019 03:25:39 +0000 (03:25 +0000)]
[X86] Support .reloc *, R_{386,X86_64}_NONE, *

This can be used to create references among sections. When --gc-sections
is used, the referenced section will be retained if the origin section
is retained.

See R_MIPS_NONE (D13659), R_ARM_NONE (D61992), R_AARCH64_NONE (D61973) for similar changes.

Reviewed By: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360983 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Support .reloc *, R_AARCH64_NONE, *
Fangrui Song [Fri, 17 May 2019 03:05:07 +0000 (03:05 +0000)]
[AArch64] Support .reloc *, R_AARCH64_NONE, *

Summary:
This can be used to create references among sections. When --gc-sections
is used, the referenced section will be retained if the origin section
is retained.

Reviewed By: peter.smith

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360981 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Support .reloc *, R_ARM_NONE, *
Fangrui Song [Fri, 17 May 2019 02:51:54 +0000 (02:51 +0000)]
[ARM] Support .reloc *, R_ARM_NONE, *

R_ARM_NONE can be used to create references among sections. When
--gc-sections is used, the referenced section will be retained if the
origin section is retained.

Add a generic MCFixupKind FK_NONE as this kind of no-op relocation is
ubiquitous on ELF and COFF, and probably available on many other binary
formats. See D62014.

Reviewed By: peter.smith

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360980 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LFTR] Strengthen assertions in genLoopLimit [NFCI]
Philip Reames [Fri, 17 May 2019 02:18:03 +0000 (02:18 +0000)]
[LFTR] Strengthen assertions in genLoopLimit [NFCI]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360978 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IndVars] Don't reimplement Loop::isLoopInvariant [NFC]
Philip Reames [Fri, 17 May 2019 02:09:03 +0000 (02:09 +0000)]
[IndVars] Don't reimplement Loop::isLoopInvariant [NFC]

Using dominance vs a set membership check is indistinguishable from a compile time perspective, and the two queries return equivelent results.  Simplify code by using the existing function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360976 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LFTR] Factor out a helper function for readability purpose [NFC]
Philip Reames [Fri, 17 May 2019 01:39:58 +0000 (01:39 +0000)]
[LFTR] Factor out a helper function for readability purpose [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360972 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeMetrics] Don't let extends of i1 be free.
Jonas Paulsson [Fri, 17 May 2019 01:26:35 +0000 (01:26 +0000)]
[CodeMetrics]  Don't let extends of i1 be free.

getUserCost() currently returns TCC_Free for any extend of a compare (i1)
result. It seems this is only true in a limited number of cases where for
example two compares are chained. Even in those types of cases it seems
unlikely that they are generally free, while they may be in some cases.

This patch therefore removes this special handling of cast of i1. No tests
are failing because of this.

If some target want the old behavior, it could override getUserCost().

Review: Hal Finkel, Chandler Carruth, Evgeny Astigeevich, Simon Pilgrim,
        Ulrich Weigand
https://reviews.llvm.org/D54742/new/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360970 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix broken test case.
Richard Trieu [Fri, 17 May 2019 01:17:32 +0000 (01:17 +0000)]
Fix broken test case.

EXPECT_EQ takes two arguments, not a single expression that evaluates to bool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360969 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoClarify comments on helpers used by LFTR [NFC]
Philip Reames [Fri, 17 May 2019 01:12:02 +0000 (01:12 +0000)]
Clarify comments on helpers used by LFTR [NFC]

I'm slowly wrapping my head around this code, and am making comment improvements where I can.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360968 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SystemZ] Bugfix in SystemZTargetLowering::combineIntDIVREM()
Jonas Paulsson [Fri, 17 May 2019 00:50:35 +0000 (00:50 +0000)]
[SystemZ]  Bugfix in SystemZTargetLowering::combineIntDIVREM()

Make sure to not unroll a vector division/remainder (with a constant splat
divisor) after type legalization, since the scalar type may then be illegal.

Review: Ulrich Weigand
https://reviews.llvm.org/D62036

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360965 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r360859: "Reland r360771 "[MergeICmps] Simplify the code.""
Nico Weber [Fri, 17 May 2019 00:43:53 +0000 (00:43 +0000)]
Revert r360859: "Reland r360771 "[MergeICmps] Simplify the code.""

It caused PR41917.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360963 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoConvert PointerUnion to a variadic template.
Richard Smith [Fri, 17 May 2019 00:39:38 +0000 (00:39 +0000)]
Convert PointerUnion to a variadic template.

Summary:
Rather than duplicating code between PointerUnion, PointerUnion3, and
PointerUnion4 (and missing things from the latter cases, such as some of the
DenseMap support and operator==), convert PointerUnion to a variadic template
that can be used as a union of any number of pointers.

(This doesn't support PointerUnion<> right now. Adding a special case for that
would be possible, and perhaps even useful in some situations, but it doesn't
seem worthwhile until we have a concrete use case.)

Reviewers: dblaikie

Subscribers: dexonsmith, kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360962 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Consolidate more lftr tests
Philip Reames [Fri, 17 May 2019 00:19:28 +0000 (00:19 +0000)]
[Tests] Consolidate more lftr tests

These are all of the ones involving the same data layout string.  Remainder take a bit more consideration, but at least everything can be auto-updated now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360961 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AsmParser] Add mnemonics missed in r360954.
David L. Jones [Fri, 17 May 2019 00:19:20 +0000 (00:19 +0000)]
[X86][AsmParser] Add mnemonics missed in r360954.

These are valid Jcc, but aren't based on the EFLAGS condition codes (Intel 64
and IA-32 Architetcures Software Developer's Manual Vol. 1, Appendix B). These
are covered in clang/test, but not llvm/test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360960 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoHWASan exception support.
Evgeniy Stepanov [Thu, 16 May 2019 23:54:41 +0000 (23:54 +0000)]
HWASan exception support.

Summary:
Adds a call to __hwasan_handle_vfork(SP) at each landingpad entry.

Reusing __hwasan_handle_vfork instead of introducing a new runtime call
in order to be ABI-compatible with old runtime library.

Reviewers: pcc

Subscribers: kubamracek, hiraditya, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360959 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Expand basic lftr coverage
Philip Reames [Thu, 16 May 2019 23:41:28 +0000 (23:41 +0000)]
[Tests] Expand basic lftr coverage

Newly written tests to cover the simple cases.  We don't appear to have broad coverage of this transform anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360957 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AsmParser] Ignore "short" even harder in Intel syntax ASM.
David L. Jones [Thu, 16 May 2019 23:27:07 +0000 (23:27 +0000)]
[X86][AsmParser] Ignore "short" even harder in Intel syntax ASM.

In Intel syntax, it's not uncommon to see a "short" modifier on Jcc conditional
jumps, which indicates the offset should be a "short jump" (8-bit immediate
offset from EIP, -128 to +127). This patch expands to all recognized Jcc
condition codes, and removes the inline restriction.

Clang already ignores "jmp short" in inline assembly. However, only "jmp" and a
couple of Jcc are actually checked, and only inline (i.e., not when using the
integrated assembler for asm sources). A quick search through asm-containing
libraries at hand shows a pretty broad range of Jcc conditions spelled with
"short."

GAS ignores the "short" modifier, and instead uses an encoding based on the
given immediate. MS inline seems to do the same, and I suspect MASM does, too.
NASM will yield an error if presented with an out-of-range immediate value.

Example of GCC 9.1 and MSVC v19.20, "jmp short" with offsets that do and do not
fit within 8 bits: https://gcc.godbolt.org/z/aFZmjY

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360954 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AsmParser] Rename "ConditionCode" variable to "ConditionPredicate".
David L. Jones [Thu, 16 May 2019 23:27:05 +0000 (23:27 +0000)]
[X86][AsmParser] Rename "ConditionCode" variable to "ConditionPredicate".

This better matches the verbiage in Intel documentation, and should help avoid
confusion between these two different kinds of values, both of which are parsed
from mnemonics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360953 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Deduplicate symbol lowering logic, NFC
Reid Kleckner [Thu, 16 May 2019 23:15:26 +0000 (23:15 +0000)]
[X86] Deduplicate symbol lowering logic, NFC

Summary:
This refactors four pieces of code that create SDNodes for references to
symbols:
- normal global address lowering (LEA, MOV, etc)
- callee global address lowering (CALL)
- external symbol address lowering (LEA, MOV, etc)
- external symbol address lowering (CALL)

Each of these pieces of code need to:
- classify the reference
- lower the symbol
- emit a RIP wrapper if needed
- emit a load if needed
- add offsets if needed

I think handling them all in one place will make the code easier to
maintain in the future.

Reviewers: craig.topper, RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360952 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoEmit global variables as S_CONSTANT records for codeview debug info.
Amy Huang [Thu, 16 May 2019 22:28:52 +0000 (22:28 +0000)]
Emit global variables as S_CONSTANT records for codeview debug info.

Summary:
This emits S_CONSTANT records for global variables.
Currently this emits records for the global variables already being tracked in the
LLVM IR metadata, which are just constant global variables; we'll also want S_CONSTANTs
for static data members and enums.

Related to https://bugs.llvm.org/show_bug.cgi?id=41615

Reviewers: rnk

Subscribers: aprantl, hiraditya, llvm-commits, thakis

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360948 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Fixed de-optimization of legalize subvector extract
Tim Renouf [Thu, 16 May 2019 21:49:06 +0000 (21:49 +0000)]
[CodeGen] Fixed de-optimization of legalize subvector extract

The recent introduction of v3i32 etc as an MVT, and its use in AMDGPU
3-dword memory instructions, caused a de-optimization problem for code
with such a load that then bitcasts via vector of i8, because v12i8 is
not an MVT so it legalizes the bitcast by widening it.

This commit adds the ability to widen a bitcast using extract_subvector
on the result, so the value does not need to go via memory.

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

Change-Id: Ie4abb7760547e54a2445961992eafc78e80d4b64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360942 91177308-0d34-0410-b5e6-96231b3b80d8