]> granicus.if.org Git - llvm/log
llvm
5 years ago[DWARF] Add a unit test for DWARFUnit::getLength().
Igor Kudrin [Tue, 10 Sep 2019 09:03:24 +0000 (09:03 +0000)]
[DWARF] Add a unit test for DWARFUnit::getLength().

This is a follow-up of rL369529, where the return value of
DWARFUnit::getLength() was changed from uint32_t to uint64_t.
The test checks that a unit header with Length > 4G can be successfully
parsed and the value of the Length field is not truncated.

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

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

5 years ago[Alignment] Use Align for TargetLowering::MinStackArgumentAlignment
Guillaume Chatelet [Tue, 10 Sep 2019 09:01:18 +0000 (09:01 +0000)]
[Alignment] Use Align for TargetLowering::MinStackArgumentAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: sdardis, nemanjai, hiraditya, kbarton, jrtc27, MaskRay, atanasyan, jsji, llvm-commits

Tags: #llvm

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

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

5 years ago[LegalizeTypes] Teach SoftenFloatOp_SELECT_CC to handle operand 2 or 3 being softened.
Craig Topper [Tue, 10 Sep 2019 07:56:02 +0000 (07:56 +0000)]
[LegalizeTypes] Teach SoftenFloatOp_SELECT_CC to handle operand 2 or 3 being softened.

This can only happen on X86 when fp128 is a legal type, but we
go through softening to generate libcalls. This causes fp128 to
be softened to fp128 instead of an integer type. This can be
removed if D67128 lands.

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

5 years agogn build: Merge r371488
Nico Weber [Tue, 10 Sep 2019 06:31:59 +0000 (06:31 +0000)]
gn build: Merge r371488

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

5 years agoRevert "clang-misexpect: Profile Guided Validation of Performance Annotations in...
Petr Hosek [Tue, 10 Sep 2019 06:25:13 +0000 (06:25 +0000)]
Revert "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"

This reverts commit r371484: this broke sanitizer-x86_64-linux-fast bot.

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

5 years ago[X86] Add broadcast load unfolding support for VCMPPS/PD.
Craig Topper [Tue, 10 Sep 2019 05:49:53 +0000 (05:49 +0000)]
[X86] Add broadcast load unfolding support for VCMPPS/PD.

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

5 years ago[X86] Add broadcast load unfold tests for VCMPPS/PD.
Craig Topper [Tue, 10 Sep 2019 05:49:48 +0000 (05:49 +0000)]
[X86] Add broadcast load unfold tests for VCMPPS/PD.

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

5 years agogn build: Merge r371484
Nico Weber [Tue, 10 Sep 2019 03:18:25 +0000 (03:18 +0000)]
gn build: Merge r371484

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

5 years agoclang-misexpect: Profile Guided Validation of Performance Annotations in LLVM
Petr Hosek [Tue, 10 Sep 2019 03:11:39 +0000 (03:11 +0000)]
clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM

This patch contains the basic functionality for reporting potentially
incorrect usage of __builtin_expect() by comparing the developer's
annotation against a collected PGO profile. A more detailed proposal and
discussion appears on the CFE-dev mailing list
(http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a
prototype of the initial frontend changes appear here in D65300

We revised the work in D65300 by moving the misexpect check into the
LLVM backend, and adding support for IR and sampling based profiles, in
addition to frontend instrumentation.

We add new misexpect metadata tags to those instructions directly
influenced by the llvm.expect intrinsic (branch, switch, and select)
when lowering the intrinsics. The misexpect metadata contains
information about the expected target of the intrinsic so that we can
check against the correct PGO counter when emitting diagnostics, and the
compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight.
We use these branch weight values to determine when to emit the
diagnostic to the user.

A future patch should address the comment at the top of
LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and
UnlikelyBranchWeight values into a shared space that can be accessed
outside of the LowerExpectIntrinsic pass. Once that is done, the
misexpect metadata can be updated to be smaller.

In the long term, it is possible to reconstruct portions of the
misexpect metadata from the existing profile data. However, we have
avoided this to keep the code simple, and because some kind of metadata
tag will be required to identify which branch/switch/select instructions
are influenced by the use of llvm.expect

Patch By: paulkirth
Differential Revision: https://reviews.llvm.org/D66324

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

5 years ago[PowerPC][NFC] Update test assertions using update_llc_test_checks.py
Kai Luo [Tue, 10 Sep 2019 02:28:24 +0000 (02:28 +0000)]
[PowerPC][NFC] Update test assertions using update_llc_test_checks.py

Summary:
This patch is made due to https://reviews.llvm.org/rL371289 where typo
fixes failed.

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

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

5 years agoRevert [git-llvm] Do not reinvent `@{upstream}`
Mehdi Amini [Tue, 10 Sep 2019 01:26:36 +0000 (01:26 +0000)]
Revert [git-llvm] Do not reinvent `@{upstream}`

This reverts r371290 (git commit 7faffd544b16f851a632d6b8f93e3c8485ff34bb)

The change wasnt NFC and broke some users' workflow. Reverting while figuring
out the best alternative to move forward.

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

5 years agogn build: Merge r371466
Nico Weber [Tue, 10 Sep 2019 01:11:30 +0000 (01:11 +0000)]
gn build: Merge r371466

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

5 years agogn build: (manually) merge r371429
Nico Weber [Tue, 10 Sep 2019 00:48:20 +0000 (00:48 +0000)]
gn build: (manually) merge r371429

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

5 years ago[llvm][ADT][NFC] Add test for makeArrayRef(std::array)
Jan Korous [Tue, 10 Sep 2019 00:29:35 +0000 (00:29 +0000)]
[llvm][ADT][NFC] Add test for makeArrayRef(std::array)

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

5 years agoRemove some unnecessary REQUIRES: shell lines
Reid Kleckner [Tue, 10 Sep 2019 00:06:52 +0000 (00:06 +0000)]
Remove some unnecessary REQUIRES: shell lines

This means these tests will run on Windows. Replace one with
UNSUPPORTED: system-windows.

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

5 years agoAMDGPU/GlobalISel: Fix insert point when lowering fminnum/fmaxnum
Matt Arsenault [Mon, 9 Sep 2019 23:30:11 +0000 (23:30 +0000)]
AMDGPU/GlobalISel: Fix insert point when lowering fminnum/fmaxnum

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

5 years agoFix incorrect demangling of call operator of lambda with explicit
Richard Smith [Mon, 9 Sep 2019 23:07:25 +0000 (23:07 +0000)]
Fix incorrect demangling of call operator of lambda with explicit
template parameters due to registering template parameters twice.

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

5 years agoAMDGPU/GlobalISel: Rename MIRBuilder to B. NFC
Austin Kerbow [Mon, 9 Sep 2019 23:06:13 +0000 (23:06 +0000)]
AMDGPU/GlobalISel: Rename MIRBuilder to B. NFC

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[Windows] Replace TrapUnreachable with an int3 insertion pass
Reid Kleckner [Mon, 9 Sep 2019 23:04:25 +0000 (23:04 +0000)]
[Windows] Replace TrapUnreachable with an int3 insertion pass

This is an alternative to D66980, which was reverted. Instead of
inserting a pseudo instruction that optionally expands to nothing, add a
pass that inserts int3 when appropriate after basic block layout.

Reviewers: hans

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

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

5 years ago[GlobalISel]: Fix a bug where we could dereference None
Aditya Nandakumar [Mon, 9 Sep 2019 22:51:41 +0000 (22:51 +0000)]
[GlobalISel]: Fix a bug where we could dereference None

getConstantVRegVal returns None when dealing with constants > 64 bits.
Don't assume we always have a value in GISelKnownBits.

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

5 years agoSimplify demangler rule for lambda-expressions to match discussion on
Richard Smith [Mon, 9 Sep 2019 22:26:04 +0000 (22:26 +0000)]
Simplify demangler rule for lambda-expressions to match discussion on
cxx-abi list.

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

5 years agoLangRef: mention MSan's problem with speculative conditional branches.
Evgeniy Stepanov [Mon, 9 Sep 2019 22:24:57 +0000 (22:24 +0000)]
LangRef: mention MSan's problem with speculative conditional branches.

Summary:
This short blurb aims to disallow optimizations like we had to revert
(under MSan) in
  https://reviews.llvm.org/D21165
  https://bugs.llvm.org/show_bug.cgi?id=28054
  https://reviews.llvm.org/D67205

Reviewers: vitalybuka, efriedma

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[Tests] Fix a typo in a test
Philip Reames [Mon, 9 Sep 2019 21:33:59 +0000 (21:33 +0000)]
[Tests] Fix a typo in a test

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

5 years ago[Tests] Precommit test case for D67372
Philip Reames [Mon, 9 Sep 2019 21:32:16 +0000 (21:32 +0000)]
[Tests] Precommit test case for D67372

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

5 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 9 Sep 2019 21:30:11 +0000 (21:30 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

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

5 years ago[LoopVectorize] Leverage speculation safety to avoid masked.loads
Philip Reames [Mon, 9 Sep 2019 20:54:13 +0000 (20:54 +0000)]
[LoopVectorize] Leverage speculation safety to avoid masked.loads

If we're vectorizing a load in a predicated block, check to see if the load can be speculated rather than predicated.  This allows us to generate a normal vector load instead of a masked.load.

To do so, we must prove that all bytes accessed on any iteration of the original loop are dereferenceable, and that all loads (across all iterations) are properly aligned.  This is equivelent to proving that hoisting the load into the loop header in the original scalar loop is safe.

Note: There are a couple of code motion todos in the code.  My intention is to wait about a day - to be sure this sticks - and then perform the NFC motion without furthe review.

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

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

5 years ago[Tests] Add anyextend tests for unordered atomics
Philip Reames [Mon, 9 Sep 2019 20:26:52 +0000 (20:26 +0000)]
[Tests] Add anyextend tests for unordered atomics

Motivated by work on changing our representation of unordered atomics in SelectionDAG, but as an aside, all our lowerings for O3 are terrible.  Even the ones which ignore the atomicity.

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

5 years agoRelax opcode checks in test to check for only a number instead of a specific number.
Douglas Yung [Mon, 9 Sep 2019 20:12:29 +0000 (20:12 +0000)]
Relax opcode checks in test to check for only a number instead of a specific number.

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

5 years ago[SDAG] Add a isSimple cover functon to MemSDNode, just as we have in IR/MI [NFC]
Philip Reames [Mon, 9 Sep 2019 20:06:19 +0000 (20:06 +0000)]
[SDAG] Add a isSimple cover functon to MemSDNode, just as we have in IR/MI [NFC]

Uses are in reviews D66322 and D66318.  Submitted separately to control rebuild times.

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

5 years ago[Remarks] Fix warning for uint8_t < 0 comparison
Francis Visoiu Mistrih [Mon, 9 Sep 2019 19:47:25 +0000 (19:47 +0000)]
[Remarks] Fix warning for uint8_t < 0 comparison

http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/19109/steps/build-stage1-compiler/logs/stdio

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

5 years agoIntroduce infrastructure for an incremental port of SelectionDAG atomic load/store...
Philip Reames [Mon, 9 Sep 2019 19:23:22 +0000 (19:23 +0000)]
Introduce infrastructure for an incremental port of SelectionDAG atomic load/store handling

This is the first patch in a large sequence. The eventual goal is to have unordered atomic loads and stores - and possibly ordered atomics as well - handled through the normal ISEL codepaths for loads and stores. Today, there handled w/instances of AtomicSDNodes. The result of which is that all transforms need to be duplicated to work for unordered atomics. The benefit of the current design is that it's harder to introduce a silent miscompile by adding an transform which forgets about atomicity.  See the thread on llvm-dev titled "FYI: proposed changes to atomic load/store in SelectionDAG" for further context.

Note that this patch is NFC unless the experimental flag is set.

The basic strategy I plan on taking is:

    introduce infrastructure and a flag for testing (this patch)
    Audit uses of isVolatile, and apply isAtomic conservatively*
    piecemeal conservative* update generic code and x86 backedge code in individual reviews w/tests for cases which didn't check volatile, but can be found with inspection
    flip the flag at the end (with minimal diffs)
    Work through todo list identified in (2) and (3) exposing performance ops

(*) The "conservative" bit here is aimed at minimizing the number of diffs involved in (4). Ideally, there'd be none. In practice, getting it down to something reviewable by a human is the actual goal. Note that there are (currently) no paths which produce LoadSDNode or StoreSDNode with atomic MMOs, so we don't need to worry about preserving any behaviour there.

We've taken a very similar strategy twice before with success - once at IR level, and once at the MI level (post ISEL).

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

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

5 years agoAMDGPU/GlobalISel: Legalize G_BUILD_VECTOR v2s16
Matt Arsenault [Mon, 9 Sep 2019 18:57:51 +0000 (18:57 +0000)]
AMDGPU/GlobalISel: Legalize G_BUILD_VECTOR v2s16

Handle it the same way as G_BUILD_VECTOR_TRUNC. Arguably only
G_BUILD_VECTOR_TRUNC should be legal for this, but G_BUILD_VECTOR will
probably be more convenient in most cases.

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

5 years agoAMDGPU: Make VReg_1 size be 1
Matt Arsenault [Mon, 9 Sep 2019 18:43:29 +0000 (18:43 +0000)]
AMDGPU: Make VReg_1 size be 1

This was getting chosen as the preferred 32-bit register class based
on how TableGen selects subregister classes.

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

5 years agoAMDGPU/GlobalISel: Select llvm.amdgcn.class
Matt Arsenault [Mon, 9 Sep 2019 18:29:45 +0000 (18:29 +0000)]
AMDGPU/GlobalISel: Select llvm.amdgcn.class

Also fixes missing SubtargetPredicate on f16 class instructions.

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

5 years agoAMDGPU/GlobalISel: Select fmed3
Matt Arsenault [Mon, 9 Sep 2019 18:29:37 +0000 (18:29 +0000)]
AMDGPU/GlobalISel: Select fmed3

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

5 years ago[IfConversion] Correctly handle cases where analyzeBranch fails.
Eli Friedman [Mon, 9 Sep 2019 18:29:27 +0000 (18:29 +0000)]
[IfConversion] Correctly handle cases where analyzeBranch fails.

If analyzeBranch fails, on some targets, the out parameters point to
some blocks in the function. But we can't use that information, so make
sure to clear it out.  (In some places in IfConversion, we assume that
any block with a TrueBB is analyzable.)

The change to the testcase makes it trigger a bug on builds without this
fix: IfConvertDiamond tries to perform a followup "merge" operation,
which isn't legal, and we somehow end up with a branch to a deleted MBB.
I'm not sure how this doesn't crash the compiler.

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

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

5 years ago[x86] add test for false dependency with minsize (PR43239); NFC
Sanjay Patel [Mon, 9 Sep 2019 18:14:10 +0000 (18:14 +0000)]
[x86] add test for false dependency with minsize (PR43239); NFC

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

5 years agoAMDGPU: Use PatFrags to allow selecting custom nodes or intrinsics
Matt Arsenault [Mon, 9 Sep 2019 18:10:31 +0000 (18:10 +0000)]
AMDGPU: Use PatFrags to allow selecting custom nodes or intrinsics

This enables GlobalISel to handle various intrinsics. The custom node
pattern will be ignored, and the intrinsic will work. This will also
allow SelectionDAG to directly select the intrinsics, but as they are
all custom lowered to the nodes, this ends up leaving dead code in the
table.

Eventually either GlobalISel should add the equivalent of custom nodes
equivalent, or intrinsics should be directly used. These each have
different tradeoffs.

There are a few more to handle, but these are easy to handle
ones. Some others fail for other reasons.

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

5 years ago[SelectionDAG] Remove ISD::FP_ROUND_INREG
Craig Topper [Mon, 9 Sep 2019 17:54:44 +0000 (17:54 +0000)]
[SelectionDAG] Remove ISD::FP_ROUND_INREG

I don't think anything in tree creates this node. So all of this
code appears to be dead.

Code coverage agrees
http://lab.llvm.org:8080/coverage/coverage-reports/llvm/coverage/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp.html

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

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

5 years ago[X86] Allow _MM_FROUND_CUR_DIRECTION and _MM_FROUND_NO_EXC to be used together on...
Craig Topper [Mon, 9 Sep 2019 17:48:05 +0000 (17:48 +0000)]
[X86] Allow _MM_FROUND_CUR_DIRECTION and _MM_FROUND_NO_EXC to be used together on instructions that only support SAE and not embedded rounding.

Current for SAE instructions we only allow _MM_FROUND_CUR_DIRECTION(bit 2) or _MM_FROUND_NO_EXC(bit 3) to be used as the immediate passed to the inrinsics. But these instructions don't perform rounding so _MM_FROUND_CUR_DIRECTION is just sort of a default placeholder when you don't want to suppress exceptions. Using _MM_FROUND_NO_EXC by itself is really bit equivalent to (_MM_FROUND_NO_EXC | _MM_FROUND_TO_NEAREST_INT) since _MM_FROUND_TO_NEAREST_INT is 0. Since we aren't rounding on these instructions we should also accept (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC) as equivalent to (_MM_FROUND_NO_EXC). icc allows this, but gcc does not.

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

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

5 years ago[Remarks] Add parser for bitstream remarks
Francis Visoiu Mistrih [Mon, 9 Sep 2019 17:43:50 +0000 (17:43 +0000)]
[Remarks] Add parser for bitstream remarks

The bitstream remark serializer landed in r367372.

This adds a bitstream remark parser that parser bitstream remark files
to llvm::remarks::Remark objects through the RemarkParser interface.

A few interesting things to point out:

* There are parsing helpers to parse the different types of blocks
* The main parsing helper allows us to parse remark metadata and open an
external file containing the encoded remarks
* This adds a dependency from the Remarks library to the BitstreamReader
library
* The testing strategy is to create a remark entry through YAML, parse
it, serialize it to bitstream, parse that back and compare the objects.
* There are close to no tests for malformed bitstream remarks, due to
the lack of textual format for the bitstream format.
* This adds a new C API for parsing bitstream remarks:
LLVMRemarkParserCreateBitstream.
* This bumps the REMARKS_API_VERSION to 1.

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

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

5 years ago[mips] Fix decoding of microMIPS JALX instruction
Simon Atanasyan [Mon, 9 Sep 2019 17:28:45 +0000 (17:28 +0000)]
[mips] Fix decoding of microMIPS JALX instruction

microMIPS jump and link exchange instruction stores a target in a
26-bits field. Despite other microMIPS JAL instructions these bits
are target address shifted right 2 bits [1]. The patch fixes the
JALX instruction decoding and uses 2-bit shift.

[1] MIPS Architecture for Programmers Volume II-B: The microMIPS32 Instruction Set

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

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

5 years agoAMDGPU: Move MnemonicAlias out of instruction def hierarchy
Matt Arsenault [Mon, 9 Sep 2019 17:25:35 +0000 (17:25 +0000)]
AMDGPU: Move MnemonicAlias out of instruction def hierarchy

Unfortunately MnemonicAlias defines a "Predicates" field just like an
instruction or pattern, with a somewhat different interpretation.

This ends up overriding the intended Predicates set by
PredicateControl on the pseudoinstruction defintions with an empty
list. This allowed incorrectly selecting instructions that should have
been rejected due to the SubtargetPredicate from patterns on the
instruction definition.

This does remove the divergent predicate from the 64-bit shift
patterns, which were already not used for the 32-bit shift, so I'm not
sure what the point was. This also removes a second, redundant copy of
the 64-bit divergent patterns.

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

5 years ago[SLP] add test for over-vectorization (PR33958); NFC
Sanjay Patel [Mon, 9 Sep 2019 17:16:03 +0000 (17:16 +0000)]
[SLP] add test for over-vectorization (PR33958); NFC

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

5 years ago[GlobalISel][AArch64] Handle tail calls with non-void return types
Jessica Paquette [Mon, 9 Sep 2019 17:15:56 +0000 (17:15 +0000)]
[GlobalISel][AArch64] Handle tail calls with non-void return types

Just return once you emit the call, which is exactly what SelectionDAG does in
this situation.

Update call-translator-tail-call.ll.

Also update dllimport.ll to show that we tail call here in GISel again. Add
-verify-machineinstrs to the GISel line too, to defend against verifier
failures.

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

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

5 years agoAMDGPU/GlobalISel: Implement LDS G_GLOBAL_VALUE
Matt Arsenault [Mon, 9 Sep 2019 17:13:44 +0000 (17:13 +0000)]
AMDGPU/GlobalISel: Implement LDS G_GLOBAL_VALUE

Handle the simple case that lowers to a constant.

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

5 years agoAMDGPU/GlobalISel: Legalize G_BUILD_VECTOR_TRUNC
Matt Arsenault [Mon, 9 Sep 2019 17:04:18 +0000 (17:04 +0000)]
AMDGPU/GlobalISel: Legalize G_BUILD_VECTOR_TRUNC

Treat this as legal on gfx9 since it can use S_PACK_* instructions for
this.

This isn't used by anything yet. The same will probably apply to
16-bit G_BUILD_VECTOR without the trunc.

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

5 years agoRevert "[MachineCopyPropagation] Remove redundant copies after TailDup via machine-cp"
Dmitri Gribenko [Mon, 9 Sep 2019 16:46:45 +0000 (16:46 +0000)]
Revert "[MachineCopyPropagation] Remove redundant copies after TailDup via machine-cp"

This reverts commit 371359. I'm suspecting a miscompile, I posted a
reproducer to https://reviews.llvm.org/D65267.

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

5 years ago[yaml2obj] Simplify p_filesz/p_memsz computing
Fangrui Song [Mon, 9 Sep 2019 16:45:17 +0000 (16:45 +0000)]
[yaml2obj] Simplify p_filesz/p_memsz computing

This fixes a bug as well. When "FileSize:" (p_filesz) is specified and
different from the actual value, the following code probably should not
use PHeader.p_filesz:

  if (SHeader->sh_offset == PHeader.p_offset + PHeader.p_filesz)
    PHeader.p_memsz += SHeader->sh_size;

Reviewed By: jhenderson

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

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

5 years ago[ARM] Fix loads and stores for predicate vectors
David Green [Mon, 9 Sep 2019 16:35:49 +0000 (16:35 +0000)]
[ARM] Fix loads and stores for predicate vectors

These predicate vectors can usually be loaded and stored with a single
instruction, a VSTR_P0. However this instruction will store the entire P0
predicate, 16 bits, zeroextended to 32bits. Each lane of the the
v4i1/v8i1/v16i1 representing 4/2/1 bits.

As far as I understand, when llvm says "store this v4i1", it really does need
to store 4 bits (or 8, that being the size of a byte, with this bottom 4 as the
interesting bits). For example a bitcast from a v8i1 to a i8 is defined as a
store followed by a load, which is how the code is expanded.

So this instead lowers the v4i1/v8i1 load/store through some shuffles to get
the bits into the correct positions. This, as you might imagine, is not as
efficient as a single instruction. But I believe it is needed for correctness.
v16i1 equally should not load/store 32bits, only storing the 16bits of data.
Stack loads/stores are still using the VSTR_P0 (as can be seen by the test not
changing). This is fine as they are self-consistent, it is only "externally
observable loads/stores" (from our point of view) that need to be corrected.

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

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

5 years agoAMDGPU/GlobalISel: Select atomic loads
Matt Arsenault [Mon, 9 Sep 2019 16:18:07 +0000 (16:18 +0000)]
AMDGPU/GlobalISel: Select atomic loads

A new check for an explicitly atomic MMO is needed to avoid
incorrectly matching pattern for non-atomic loads

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

5 years agoAMDGPU/GlobalISel: Fix RegBankSelect for unaligned, uniform constant loads
Matt Arsenault [Mon, 9 Sep 2019 16:06:37 +0000 (16:06 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for unaligned, uniform constant loads

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

5 years agoFix typo in comment noticed in D60295. NFCI.
Simon Pilgrim [Mon, 9 Sep 2019 16:05:59 +0000 (16:05 +0000)]
Fix typo in comment noticed in D60295. NFCI.

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

5 years agoAMDGPU/GlobalISel: Fix regbankselect for uniform extloads
Matt Arsenault [Mon, 9 Sep 2019 16:03:45 +0000 (16:03 +0000)]
AMDGPU/GlobalISel: Fix regbankselect for uniform extloads

There are no scalar extloads.

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

5 years agoAMDGPU: Remove code address space predicates
Matt Arsenault [Mon, 9 Sep 2019 16:02:07 +0000 (16:02 +0000)]
AMDGPU: Remove code address space predicates

Fixes 8-byte, 8-byte aligned LDS loads. 16-byte case still broken due
to not be reported as legal.

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

5 years agoAMDGPU/GlobalISel: Select G_PTR_MASK
Matt Arsenault [Mon, 9 Sep 2019 15:46:13 +0000 (15:46 +0000)]
AMDGPU/GlobalISel: Select G_PTR_MASK

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

5 years agoAMDGPU/GlobalISel: Fix reg bank for uniform LDS loads
Matt Arsenault [Mon, 9 Sep 2019 15:44:16 +0000 (15:44 +0000)]
AMDGPU/GlobalISel: Fix reg bank for uniform LDS loads

The pointer is always a VGPR. Also fix hardcoding the pointer size to
64.

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

5 years agoAMDGPU/GlobalISel: Use known bits for selection
Matt Arsenault [Mon, 9 Sep 2019 15:39:32 +0000 (15:39 +0000)]
AMDGPU/GlobalISel: Use known bits for selection

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

5 years agoAMDGPU/GlobalISel: Legalize wavefrontsize intrinsic
Matt Arsenault [Mon, 9 Sep 2019 15:20:49 +0000 (15:20 +0000)]
AMDGPU/GlobalISel: Legalize wavefrontsize intrinsic

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

5 years agoAMDGPU/GlobalISel: Try generated matcher before add/sub code
Matt Arsenault [Mon, 9 Sep 2019 15:20:44 +0000 (15:20 +0000)]
AMDGPU/GlobalISel: Try generated matcher before add/sub code

This will allow optimization patterns which fold adds away to work.

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

5 years ago[ARM] Remove some spurious MVE reduction instructions.
Simon Tatham [Mon, 9 Sep 2019 15:17:26 +0000 (15:17 +0000)]
[ARM] Remove some spurious MVE reduction instructions.

The family of 'dual-accumulating' vector multiply-add instructions
(VMLADAV, VMLALDAV and VRMLALDAVH) can all operate on both signed and
unsigned integer types, and they all have an 'exchange' variant (with
an X in the name) that modifies which pairs of vector lanes in the two
inputs are multiplied together. But there's a clause in the spec that
says that the X variants //don't// operate on unsigned integer types,
only signed. You can have X, or unsigned, or neither, but not both.

We didn't notice that clause when we implemented the MC support for
these instructions, so LLVM believes that things like VMLADAVX.U8 do
exist, contradicting the spec. Here I fix that by conditioning them
out in Tablegen.

In order to do that, I've reversed the nesting order of the Tablegen
multiclasses for those instructions. Previously, the innermost
multiclass generated the X and not-X variants, and the one outside
that generated the A and not-A variants. Now X is done by the outer
multiclass, which allows me to bypass that one when I only want the
two not-X variants.

Changing the multiclass nesting order also changes the names of the
instruction ids unless I make a special effort not to. I decided that
while I was changing them anyway I'd make them look nicer; so now the
instructions have names like MVE_VMLADAVs32 or MVE_VMLADAVaxs32,
instead of cumbersome _noacc_noexch suffixes.

The corresponding multiply-subtract instructions are unaffected. Those
don't accept unsigned types at all, either in the spec or in LLVM.

Reviewers: ostannard, dmgreen

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

Tags: #llvm

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

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

5 years agoAMDGPU/GlobalISel: Remove dead patterns
Matt Arsenault [Mon, 9 Sep 2019 15:06:06 +0000 (15:06 +0000)]
AMDGPU/GlobalISel: Remove dead patterns

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

5 years ago[NFC][InstCombine] Fixup test i added in rL371352.
Roman Lebedev [Mon, 9 Sep 2019 14:27:39 +0000 (14:27 +0000)]
[NFC][InstCombine] Fixup test i added in rL371352.

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

5 years ago[DFAPacketizer] Reapply: Track resources for packetized instructions
James Molloy [Mon, 9 Sep 2019 13:17:55 +0000 (13:17 +0000)]
[DFAPacketizer] Reapply: Track resources for packetized instructions

Reapply with fix to reduce resources required by the compiler - use
unsigned[2] instead of std::pair. This causes clang and gcc to compile
the generated file multiple times faster, and hopefully will reduce
the resource requirements on Visual Studio also. This fix is a little
ugly but it's clearly the same issue the previous author of
DFAPacketizer faced (the previous tables use unsigned[2] rather uglily
too).

This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
resources were allocated to the packetized instructions.

This is particularly important for targets that do their own bundle packing - it's not
sufficient to know simply that instructions can share a packet; which slots are used is
also required for encoding.

This extends the emitter to emit a side-table containing resource usage diffs for each
state transition. The packetizer maintains a set of all possible resource states in its
current state. After packetization is complete, all remaining resource states are
possible packetization strategies.

The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
(most uses of the packetizer like MachinePipeliner don't care and don't need the extra
maintained state).

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

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

5 years ago[Inliner][NFC] Make test less brittle.
Clement Courbet [Mon, 9 Sep 2019 13:08:16 +0000 (13:08 +0000)]
[Inliner][NFC] Make test less brittle.

Summary:
This tests inlining size thresholds, but relies on the output of running
the full O2 pipeline, making it brittle against changes in unrelated
passes.

Only run the inlining pass and set thresholds on the test RUN line
instead.

Found while investigating D60318.

Reviewers: RKSimon, qcolombet

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[ARM][MVE] VCTP instruction selection
Sam Parker [Mon, 9 Sep 2019 12:54:47 +0000 (12:54 +0000)]
[ARM][MVE] VCTP instruction selection

Add codegen support for vctp{8,16,32}.

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

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

5 years agoRevert rL371198 from llvm/trunk: [DFAPacketizer] Track resources for packetized instr...
Simon Pilgrim [Mon, 9 Sep 2019 12:33:22 +0000 (12:33 +0000)]
Revert rL371198 from llvm/trunk: [DFAPacketizer] Track resources for packetized instructions

This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
resources were allocated to the packetized instructions.

This is particularly important for targets that do their own bundle packing - it's not
sufficient to know simply that instructions can share a packet; which slots are used is
also required for encoding.

This extends the emitter to emit a side-table containing resource usage diffs for each
state transition. The packetizer maintains a set of all possible resource states in its
current state. After packetization is complete, all remaining resource states are
possible packetization strategies.

The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
(most uses of the packetizer like MachinePipeliner don't care and don't need the extra
maintained state).

Differential Revision: https://reviews.llvm.org/D66936
........
Reverted as this is causing "compiler out of heap space" errors on MSVC 2017/19 NDEBUG builds

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

5 years ago[AArch64][SVE] Implement abs and neg intrinsics
Cullen Rhodes [Mon, 9 Sep 2019 11:21:14 +0000 (11:21 +0000)]
[AArch64][SVE] Implement abs and neg intrinsics

Summary:
This patch implements two arithmetic intrinsics:

      * int_aarch64_sve_abs
      * int_aarch64_sve_neg

testing the support for scalable vector types in intrinsics added in D65930.

Reviewed By: greened

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

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

5 years ago[ARM] Prevent generating NEON stack accesses under MVE.
David Green [Mon, 9 Sep 2019 10:46:25 +0000 (10:46 +0000)]
[ARM] Prevent generating NEON stack accesses under MVE.

We should not be generating Neon stack loads/stores even for these large
registers.

No test here because my understanding is we will only generate these QQPR regs
for intrinsics and VLDn's. The tests will follow once those are available.

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

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

5 years agoGlobalISel: fix unused warnings in release builds.
Tim Northover [Mon, 9 Sep 2019 10:36:58 +0000 (10:36 +0000)]
GlobalISel: fix unused warnings in release builds.

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

5 years agoGlobalISel: add combiner to form indexed loads.
Tim Northover [Mon, 9 Sep 2019 10:04:23 +0000 (10:04 +0000)]
GlobalISel: add combiner to form indexed loads.

Loosely based on DAGCombiner version, but this part is slightly simpler in
GlobalIsel because all address calculation is performed by G_GEP. That makes
the inc/dec distinction moot so there's just pre/post to think about.

No targets can handle it yet so testing is via a special flag that overrides
target hooks.

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

5 years ago[yaml2obj] - Fix BB after r371380
George Rimar [Mon, 9 Sep 2019 09:55:56 +0000 (09:55 +0000)]
[yaml2obj] - Fix BB after r371380

Just a fix for an input file name.

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

5 years ago[lib/ObjectYAML] - Improve and cleanup error reporting in ELFState<ELFT> class.
George Rimar [Mon, 9 Sep 2019 09:43:03 +0000 (09:43 +0000)]
[lib/ObjectYAML] - Improve and cleanup error reporting in ELFState<ELFT> class.

The aim of this patch is to refactor how we handle and report error.

I suggest to use the same approach we use in LLD: delayed error reporting.
For that I introduced 'HasError' flag which triggers when we report an error.
Now we do not exit instantly on any error. The benefits are:

1) There are no more 'exit(1)' calls in the library code.
2) Code was simplified significantly in a few places.
3) It is now possible to print multiple errors instead of only one.

Also, I changed the messages to be lower case and removed a full stop.

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

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

5 years ago[ARM][MVE] Decoding of uqrshl and sqrshl accepts unpredictable encodings
Oliver Stannard [Mon, 9 Sep 2019 08:50:28 +0000 (08:50 +0000)]
[ARM][MVE] Decoding of uqrshl and sqrshl accepts unpredictable encodings

Specify the Unpredictable bits, and return softfails when appropriate.

Patch by Mark Murray!

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

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

5 years ago[ARM][ParallelDSP] Fix for sext input
Sam Parker [Mon, 9 Sep 2019 08:39:14 +0000 (08:39 +0000)]
[ARM][ParallelDSP] Fix for sext input

The incoming accumulator value can be discovered through a sext, in
which case there will be a mismatch between the input and the result.
So sign extend the accumulator input if we're performing a 64-bit mac.

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

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

5 years ago[SystemZ] NFC: use clearRegisterDeads() in SystemZElimCompare.cpp
Jonas Paulsson [Mon, 9 Sep 2019 07:58:57 +0000 (07:58 +0000)]
[SystemZ]  NFC: use clearRegisterDeads() in SystemZElimCompare.cpp

This is simpler than using findRegisterDefOperandIdx() + setIsDead().

Review: Ulrich Weigand.

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

5 years ago[X86] Add broadcast load unfolding support for vpcmpeq/vpcmpgt/vpcmp/vpcmpu.
Craig Topper [Mon, 9 Sep 2019 07:46:11 +0000 (07:46 +0000)]
[X86] Add broadcast load unfolding support for vpcmpeq/vpcmpgt/vpcmp/vpcmpu.

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

5 years ago[X86] Add broadcast load unfolding tests for vpcmpeq/vpcmpgt/vpcmp/vpcmpu.
Craig Topper [Mon, 9 Sep 2019 07:46:07 +0000 (07:46 +0000)]
[X86] Add broadcast load unfolding tests for vpcmpeq/vpcmpgt/vpcmp/vpcmpu.

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

5 years ago[X86] Add broadcast load unfold support for smin/umin/smax/umax.
Craig Topper [Mon, 9 Sep 2019 06:32:24 +0000 (06:32 +0000)]
[X86] Add broadcast load unfold support for smin/umin/smax/umax.

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

5 years ago[X86] Add broadcast load unfolding tests for smin/umin/smax/smin.
Craig Topper [Mon, 9 Sep 2019 06:32:20 +0000 (06:32 +0000)]
[X86] Add broadcast load unfolding tests for smin/umin/smax/smin.

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

5 years agoAMDGPU: Remove pointless wrapper nodes for init.exec intrinsics
Matt Arsenault [Mon, 9 Sep 2019 05:49:52 +0000 (05:49 +0000)]
AMDGPU: Remove pointless wrapper nodes for init.exec intrinsics

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

5 years ago[X86] Add broadcast load unfolding support for VMAXPS/PD and VMINPS/PD.
Craig Topper [Mon, 9 Sep 2019 04:25:01 +0000 (04:25 +0000)]
[X86] Add broadcast load unfolding support for VMAXPS/PD and VMINPS/PD.

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

5 years ago[X86] Add broadcast load unfolding tests for vmaxps/pd and vminps/pd
Craig Topper [Mon, 9 Sep 2019 04:24:57 +0000 (04:24 +0000)]
[X86] Add broadcast load unfolding tests for vmaxps/pd and vminps/pd

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

5 years ago[X86] Add fp128 test cases for ceil/floor/trunc/nearbyint/rint/round libcalls.
Craig Topper [Mon, 9 Sep 2019 02:44:46 +0000 (02:44 +0000)]
[X86] Add fp128 test cases for ceil/floor/trunc/nearbyint/rint/round libcalls.

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

5 years ago[MachineCopyPropagation] Remove redundant copies after TailDup via machine-cp
Kai Luo [Mon, 9 Sep 2019 02:32:42 +0000 (02:32 +0000)]
[MachineCopyPropagation] Remove redundant copies after TailDup via machine-cp

Summary:
After tailduplication, we have redundant copies. We can remove these
copies in machine-cp if it's safe to, i.e.
```
$reg0 = OP ...
... <<< No read or clobber of $reg0 and $reg1
$reg1 = COPY $reg0 <<< $reg0 is killed
...
<RET>
```
will be transformed to
```
$reg1 = OP ...
...
<RET>
```

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

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

5 years ago[X86] Add test cases for fptoui/fptosi/sitofp/uitofp between fp128 and i128.
Craig Topper [Mon, 9 Sep 2019 01:35:04 +0000 (01:35 +0000)]
[X86] Add test cases for fptoui/fptosi/sitofp/uitofp between fp128 and i128.

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

5 years ago[X86] Use xorps to create fp128 +0.0 constants.
Craig Topper [Mon, 9 Sep 2019 01:35:00 +0000 (01:35 +0000)]
[X86] Use xorps to create fp128 +0.0 constants.

This matches what we do for f32/f64. gcc also does this for fp128.

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

5 years ago[X86] Add avx and avx512f RUN lines to fp128-cast.ll
Craig Topper [Mon, 9 Sep 2019 01:34:55 +0000 (01:34 +0000)]
[X86] Add avx and avx512f RUN lines to fp128-cast.ll

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

5 years agoRelax opcode checks in test to check for only a number instead of a specific number.
Douglas Yung [Mon, 9 Sep 2019 01:21:33 +0000 (01:21 +0000)]
Relax opcode checks in test to check for only a number instead of a specific number.

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

5 years ago[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - add faux shuffle support.
Simon Pilgrim [Sun, 8 Sep 2019 21:38:33 +0000 (21:38 +0000)]
[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - add faux shuffle support.

This patch decodes target and faux shuffles with getTargetShuffleInputs - a reduced version of resolveTargetShuffleInputs that doesn't resolve SM_SentinelZero cases, so we can correctly remove zero vectors if they aren't demanded.

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

5 years ago[InstCombine][NFC] Some tests for usub overflow+nonzero check improvement (PR43251)
Roman Lebedev [Sun, 8 Sep 2019 21:30:34 +0000 (21:30 +0000)]
[InstCombine][NFC] Some tests for usub overflow+nonzero check improvement (PR43251)

https://rise4fun.com/Alive/kHq

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

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

5 years ago[X86] Add a hack to combineVSelectWithAllOnesOrZeros to turn selects with two zero...
Craig Topper [Sun, 8 Sep 2019 20:56:09 +0000 (20:56 +0000)]
[X86] Add a hack to combineVSelectWithAllOnesOrZeros to turn selects with two zero/undef vector inputs into an all zeroes vector.

If the two zero vectors have undefs in different places they
won't get combined by simplifySelect.

This fixes a regression from an earlier commit.

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

5 years ago[X86] Remove call to getZeroVector from materializeVectorConstant. Add isel patterns...
Craig Topper [Sun, 8 Sep 2019 20:56:05 +0000 (20:56 +0000)]
[X86] Remove call to getZeroVector from materializeVectorConstant. Add isel patterns for zero vectors with all types.

The change to avx512-vec-cmp.ll is a regression, but should be
easy to fix. It occurs because the getZeroVector call was
canonicalizing both sides to the same node, then SimplifySelect
was able to simplify it. But since only called getZeroVector
on some VTs this isn't a robust way to combine this.

The change to vector-shuffle-combining-ssse3.ll is more
instructions, but removes a constant pool load so its unclear
if its a regression or not.

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

5 years ago[InstSimplify] simplifyUnsignedRangeCheck(): if we know that X != 0, handle more...
Roman Lebedev [Sun, 8 Sep 2019 20:14:15 +0000 (20:14 +0000)]
[InstSimplify] simplifyUnsignedRangeCheck(): if we know that X != 0, handle more cases (PR43246)

Summary:
This is motivated by D67122 sanitizer check enhancement.
That patch seemingly worsens `-fsanitize=pointer-overflow`
overhead from 25% to 50%, which strongly implies missing folds.

In this particular case, given
```
char* test(char& base, unsigned long offset) {
  return &base + offset;
}
```
it will end up producing something like
https://godbolt.org/z/LK5-iH
which after optimizations reduces down to roughly
```
define i1 @t0(i8* nonnull %base, i64 %offset) {
  %base_int = ptrtoint i8* %base to i64
  %adjusted = add i64 %base_int, %offset
  %non_null_after_adjustment = icmp ne i64 %adjusted, 0
  %no_overflow_during_adjustment = icmp uge i64 %adjusted, %base_int
  %res = and i1 %non_null_after_adjustment, %no_overflow_during_adjustment
  ret i1 %res
}
```
Without D67122 there was no `%non_null_after_adjustment`,
and in this particular case we can get rid of the overhead:

Here we add some offset to a non-null pointer,
and check that the result does not overflow and is not a null pointer.
But since the base pointer is already non-null, and we check for overflow,
that overflow check will already catch the null pointer,
so the separate null check is redundant and can be dropped.

Alive proofs:
https://rise4fun.com/Alive/WRzq

There are more patterns of "unsigned-add-with-overflow", they are not handled here,
but this is the main pattern, that we currently consider canonical,
so it makes sense to handle it.

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

Reviewers: spatel, nikic, vsk

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits, reames

Tags: #llvm

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

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

5 years ago[InstCombine] add tests for icmp with srem operand; NFC
Sanjay Patel [Sun, 8 Sep 2019 19:48:47 +0000 (19:48 +0000)]
[InstCombine] add tests for icmp with srem operand; NFC

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

5 years ago[X86] X86DAGToDAGISel::combineIncDecVector(): call getSplatBuildVector() manually
Roman Lebedev [Sun, 8 Sep 2019 19:36:13 +0000 (19:36 +0000)]
[X86] X86DAGToDAGISel::combineIncDecVector(): call getSplatBuildVector() manually

As reported in post-commit review of r370327,
there is some case where the code crashes.

As discussed with Craig Topper, the problem is that getConstant()
internally calls getSplatBuildVector(), so we don't insert
the constant itself.

If we do that manually we're good.

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

5 years ago[X86] Use DAG.getConstant instead of getZeroVector in combinePMULDQ.
Craig Topper [Sun, 8 Sep 2019 19:24:42 +0000 (19:24 +0000)]
[X86] Use DAG.getConstant instead of getZeroVector in combinePMULDQ.

getZeroVector canonicalizes the type to vXi32, but that's a
legalization action. We should use the most correct type if
possible.

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

5 years ago[DAGCombiner][X86][ARM] Teach visitMULO to fold multiplies with 0 to 0 and no carry.
Craig Topper [Sun, 8 Sep 2019 19:24:39 +0000 (19:24 +0000)]
[DAGCombiner][X86][ARM] Teach visitMULO to fold multiplies with 0 to 0 and no carry.

I modified the ARM test to use two inputs instead of 0 so the
test hopefully still tests what was intended.

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

5 years ago[X86] Teach materializeVectorConstant to not call getZeroVector/getOnesVector on...
Craig Topper [Sun, 8 Sep 2019 19:24:29 +0000 (19:24 +0000)]
[X86] Teach materializeVectorConstant to not call getZeroVector/getOnesVector on the types we already have isel patterns for.

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

5 years ago[InstCombine] fold extract+insert into identity shuffle
Sanjay Patel [Sun, 8 Sep 2019 19:03:01 +0000 (19:03 +0000)]
[InstCombine] fold extract+insert into identity shuffle

This is similar to the existing fold for splats added with:
rL365379

If we can adjust the shuffle mask to include another element
in an identity mask (if it changes vector length, that's an
extract/insert subvector operation in the backend), then that
can eliminate extractelement/insertelement pairs in IR.

All targets are expected to lower shuffles with identity masks
efficiently.

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