Commit Graph

2116 Commits

Author SHA1 Message Date
Matt Arsenault
2d90299c79 AMDGPU: Preserve undef flag when expanding SI_IF
Fixes undefined value verifier error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355426 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 18:38:00 +00:00
Carl Ritson
dfa4156319 [AMDGPU] Fix DPP operand order in atomic optimizer
Summary:
Ensure order of operands in DPP atomic optimizer final WWM step is appropriate for sub instructions.

Change-Id: I631d050e1c00a3b4bc7c11a90437064403c4cf30

Reviewers: sheredom, tpr

Reviewed By: sheredom

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

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355394 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 12:21:44 +00:00
David Stuttard
624049efdc [AMDGPU] Omit KILL instructions from hazard recognizer
Summary:
In some cases the KILL was causing a hazard to be introduced as these were
scheduled into hazard slots, but don't result in an instruction.

KILL shouldn't be considered for hazard recognition.

Change-Id: Ib6d2a2160f8c94cd0ce611ab198c7e4f46aeffcf

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

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355384 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 10:25:16 +00:00
Xing GUO
b6c0a18fa7 [Codegen] fix typos in test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355264 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-02 08:03:59 +00:00
Stanislav Mekhanoshin
ee6155481c [AMDGPU] Mark ds instructions as meybeAtomic
These were not recognized as potential atomics by memory legalizer.
The test was working not because legalizer did a right thing, but
because it has skipped all these instructions. When I have fixed
DS desciption test started to fail because region address has
changed from 4 to 2 a while ago.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355179 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 07:59:17 +00:00
Tom Stellard
44c4c1d525 AMDGPU/GlobalISel: Implement select for G_INSERT
Re-commit r344310.

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355159 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 00:50:26 +00:00
Tom Stellard
568bf88e60 AMDGPU/GlobalISel: Implement select for G_EXTRACT
Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355156 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 23:37:48 +00:00
Matt Arsenault
62a80b42c1 AMDGPU/GlobalISel: Add regbankselect test for phis
Add baseline for future fixes. These mostly show how this is broken
and producing illegal situations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355057 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 00:52:36 +00:00
Matt Arsenault
df3568d8a9 AMDGPU: Enable function calls by default
Fixes some crashes on illegal call situations which are unfortunately
still valid IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355051 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 00:40:32 +00:00
Matt Arsenault
8460fe06bb AMDGPU: Fix crashes in invalid call cases
We have to at least tolerate calls to kernels, possibly with a
mismatched calling convention on the callsite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355049 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 00:28:44 +00:00
Matt Arsenault
2d429b1091 GlobalISel: Implement fewerElementsVector for phi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355048 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 00:16:32 +00:00
Matt Arsenault
0d2ad48b33 GlobalISel: Implement moreElementsVector for phi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355047 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-28 00:01:05 +00:00
Philip Reames
9faff7e6c7 Seperate volatility and atomicity/ordering in SelectionDAG
At the moment, we mark every atomic memory access as being also volatile. This is unnecessarily conservative and prohibits many legal transforms (DCE, folding, etc..).

This patch removes MOVolatile from the MachineMemOperands of atomic, but not volatile, instructions. This should be strictly NFC after a series of previous patches which have gone in to ensure backend code is conservative about handling of isAtomic MMOs. Once it's in and baked for a bit, we'll start working through removing unnecessary bailouts one by one. We applied this same strategy to the middle end a few years ago, with good success.

To make sure this patch itself is NFC, it is build on top of a series of other patches which adjust code to (for the moment) be as conservative for an atomic access as for a volatile access and build up a test corpus (mostly in test/CodeGen/X86/atomics-unordered.ll)..

Previously landed

    D57593 Fix a bug in the definition of isUnordered on MachineMemOperand
    D57596 [CodeGen] Be conservative about atomic accesses as for volatile
    D57802 Be conservative about unordered accesses for the moment
    rL353959: [Tests] First batch of cornercase tests for unordered atomics.
    rL353966: [Tests] RMW folding tests w/unordered atomic operations.
    rL353972: [Tests] More unordered atomic lowering tests.
    rL353989: [SelectionDAG] Inline a single use helper function, and remove last non-MMO interface
    rL354740: [Hexagon, SystemZ] Be super conservative about atomics
    rL354800: [Lanai] Be super conservative about atomics
    rL354845: [ARM] Be super conservative about atomics

Attention Out of Tree Backend Owners: This patch may break you. If it does, you can use the TLI getMMOFlags hook to restore the MOVolatile to any instruction you need to. (See llvm-dev thread titled "PSA: Changes to how atomics are handled in backends" started Feb 27, 2019.)

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355025 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 20:20:08 +00:00
Dmitry Preobrazhensky
ea85a46c1e [AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions s_set_gpr_idx_on and s_set_gpr_idx_mode
See bug 39331: https://bugs.llvm.org/show_bug.cgi?id=39331

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354969 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 13:12:12 +00:00
Stanislav Mekhanoshin
1a46c551c7 [AMDGPU] Fixed hang during DAG combine
SITargetLowering::reassociateScalarOps() does not touch constants
so that DAGCombiner::ReassociateOps() does not revert the combine.
However a global address is not a ConstantSDNode.

Switched to the method used by DAGCombiner::ReassociateOps() itself
to detect constants.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354926 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 20:56:25 +00:00
Simon Pilgrim
cbe9dfdbe8 [AMDGPU] Regenerate bswap/bitreverse tests.
Make codegen changes more obvious in D58017

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354863 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 11:01:08 +00:00
Stanislav Mekhanoshin
c677f945b9 [AMDGPU] Added target to mir test. NFC.
Test was used without -mcpu, although tested instructions
not available on all ASICs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354830 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 22:59:55 +00:00
Matt Arsenault
0ceeb16422 RegBankSelect: Handle slightly more complex value mappings
Try to use concat_vectors. Also remove unnecessary assert on
pointers. Fixes asserting for <4 x s16> operations and 64-bit pointers
for AMDGPU.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354828 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 22:24:13 +00:00
Matt Arsenault
453c7ee1c9 AMDGPU/GlobalISel: Fix bit ops for non-power-of-2 sizes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354825 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 21:32:48 +00:00
Matt Arsenault
da91f4c26a AMDGPU/GlobalISel: Clamp max implicit_def elements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354818 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 20:46:06 +00:00
Roman Tereshin
5157eeb1c1 [LowerSwitch][AMDGPU] Do not handle impossible values
This patch adds LazyValueInfo to LowerSwitch to compute the range of the
value being switched over and reduce the size of the tree LowerSwitch
builds to lower a switch.

Reviewed By: arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354670 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-22 14:33:46 +00:00
Matt Arsenault
0410b9ebcc AMDGPU: Remove debugger related subtarget features
As far as I know these aren't needed anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354634 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 23:27:46 +00:00
Mandeep Singh Grang
cc4adc5b1a [llvm] Fix typo: 's/ ot / to /' [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354614 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 20:04:20 +00:00
Matt Arsenault
f237196b1b AMDGPU/GlobalISel: Make phis legal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354592 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 15:48:13 +00:00
Matt Arsenault
4c14549b42 AMDGPU/GlobalISel: Fix bit count ops for non-power-of-2 types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354587 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 15:22:20 +00:00
Stanislav Mekhanoshin
37bcd272bb [AMDGPU] fix commuted case of sub combine
Differential Revision: https://reviews.llvm.org/D58481

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354543 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 02:58:00 +00:00
Tom Stellard
21d7b5a1d6 AMDGPU/GlobalISel: Move SMRD selection logic to TableGen
Reviewers: arsenm

Reviewed By: arsenm

Subscribers: volkan, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354516 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-20 21:02:37 +00:00
Matt Arsenault
1b59f4c380 GlobalISel: Fix fewerElementsVector for ctlz with different result type
Also complete the set of related operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354480 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-20 16:42:52 +00:00
Matt Arsenault
7e1a65dad5 GlobalISel: Implement moreElementsVector for g_insert results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354477 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-20 16:11:22 +00:00
Matt Arsenault
379689ce0c GlobalISel: Implement moreElementsVector for select
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354354 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-19 17:03:09 +00:00
Matt Arsenault
406dc2a0d5 GlobalISel: Implement moreElementsVector for G_EXTRACT source
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354348 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-19 16:44:22 +00:00
Matt Arsenault
47f8b7cd25 GlobalISel: Implement moreElementsVector for bit ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354345 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-19 16:30:19 +00:00
Changpeng Fang
1e3c4790ab AMDGPU: Use MachineInstr::mayAlias to replace areMemAccessesTriviallyDisjoint in LoadStoreOptimizer pass.
Summary:
  This is to fix a memory dependence bug in LoadStoreOptimizer.

Reviewers:
  arsenm, rampitec

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354295 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18 23:00:26 +00:00
Matt Arsenault
b1b624d08a GlobalISel: Implement widenScalar for g_extract scalar results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354293 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18 22:39:27 +00:00
Matt Arsenault
57078b6e3a Try to organize MachineVerifier tests
The Verifier is separate from the MachineVerifier, so move it to a
different directory. Some other verifier tests were scattered in
target codegen tests as well (although I'm sure I missed some). Work
towards using a more consistent naming scheme to make it clearer where
the gaps still are for generic instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354138 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-15 15:24:31 +00:00
Konstantin Zhuravlyov
1d02248c5f AMDGPU: Set ABI version to 1 for code object v3
Differential Revision: https://reviews.llvm.org/D57811


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354085 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 23:56:04 +00:00
Matt Arsenault
217f03f322 AMDGPU/GlobalISel: Fix RegBankSelect for GEP.
This is basically a pointer typed add, so shouldn't be any different.
This was assuming everything was an SGPR, which is not true.

Also cleanup legality for GEP. I don't seem to be seeing the problem
the hack marking s64 as a legal pointer type the comment mentions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354067 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 22:24:28 +00:00
Stanislav Mekhanoshin
2f5fd7e3bd [AMDGPU] Ressociate 'add (add x, y), z' to use SALU
Reassociate adds to collect scalar operands in a single
instruction when possible. That will result in a scalar
add followed by vector instead of two vector adds, thus
better utilizing SALU.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354066 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 22:11:25 +00:00
Matt Arsenault
9b6003fe19 AMDGPU/GlobalISel: Handle split for 64-bit VALU select
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354065 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 21:58:12 +00:00
David Stenberg
ac705e8410 [DebugInfo] Stop changing labels for register-described parameter DBG_VALUEs
Summary:
This is a follow-up to D57510. This patch stops DebugHandlerBase from
changing the starting label for the first non-overlapping,
register-described parameter DBG_VALUEs to the beginning of the
function. That code did not consider what defined the registers, which
could result in the ranges for the debug values starting before their
defining instructions. We currently do not emit debug values for
constant values directly at the start of the function, so this code is
still useful for such values, but my intention is to remove the code
from DebugHandlerBase completely when we get there. One reason for
removing it is that the code violates the history map's ranges, which I
think can make it quite confusing when troubleshooting.

In D57510, PrologEpilogInserter was amended so that parameter DBG_VALUEs
now are kept at the start of the entry block, even after emission of
prologue code. That was done to reduce the degradation of debug
completeness from this patch. PR40638 is another example, where the
lexical-scope trimming that LDV does, in combination with scheduling,
results in instructions after the prologue being left without locations.
There might be other cases where the DBG_VALUEs are pushed further down,
for which the DebugHandlerBase code may be helpful, but as it now quite
often result in incorrect locations, even after the prologue, it seems
better to remove that code, and try to work our way up with accurate
locations.

In the long run we should maybe not aim to provide accurate locations
inside the prologue. Some single location descriptions, at least those
referring to stack values, generate inaccurate values inside the
epilogue, so we maybe should not aim to achieve accuracy for location
lists. However, it seems that we now emit line number programs that can
result in GDB and LLDB stopping inside the prologue when doing line
number stepping into functions. See PR40188 for more information.

A summary of some of the changed test cases is available in PR40188#c2.

Reviewers: aprantl, dblaikie, rnk, jmorse

Reviewed By: aprantl

Subscribers: jdoerfert, jholewinski, jvesely, javed.absar, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353928 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-13 09:34:07 +00:00
Matt Arsenault
d135f2406f AMDGPU/GlobalISel: Add more insert/extract testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353848 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 15:04:03 +00:00
Matt Arsenault
bb8d9165a4 AMDGPU/GlobalISel: Only make f16 constants legal on f16 targets
We could deal with it, but there's no real point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353845 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 14:54:55 +00:00
Matt Arsenault
45f5ca3e2d GlobalISel: Verify G_EXTRACT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353759 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 22:12:43 +00:00
Matt Arsenault
f3f4691605 GlobalISel: Implement moreElementsVector for implicit_def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353754 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 22:00:39 +00:00
Matt Arsenault
c0665d4bcd GlobalISel: Add G_FCANONICALIZE instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353719 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 17:05:20 +00:00
Valery Pykhtin
14478b44a8 [AMDGPU] fix atomic_optimizations_buffer.ll test after DPP combiner was enabled by default.
Related commits: rL353691, rL353703.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353717 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 16:28:42 +00:00
Neil Henning
4fee3cff4d [AMDGPU] Fix DPP sequence in atomic optimizer.
This commit fixes the DPP sequence in the atomic optimizer (which was
previously missing the row_shr:3 step), and works around a read_register
exec bug by using a ballot instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353703 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 14:44:14 +00:00
Stanislav Mekhanoshin
469309ae52 [AMDGPU] Split idot4/8 signed and unsigned tests. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353593 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09 01:02:28 +00:00
Matt Arsenault
4390f003b3 AMDGPU/GlobalISel: Fix broken tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353559 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 19:59:39 +00:00
Matt Arsenault
163f2c349f AMDGPU: Remove GCN features and predicates
These are no longer necessary since the R600 tablegen files are split
out now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353548 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 19:18:01 +00:00