52796 Commits

Author SHA1 Message Date
Simon Pilgrim
d7464ea5e6 [X86] Regenerate add32ri8.ll 2023-06-18 16:02:59 +01:00
Krzysztof Parzyszek
5ad9adb9b0 [Hexagon] Add missing patterns for boolean [v]selects
Fixes https://github.com/llvm/llvm-project/issues/59663
2023-06-17 17:15:07 -07:00
Krzysztof Parzyszek
833438eef0 [Hexagon] Handle all compares of i1 and vNi1
Fixes https://github.com/llvm/llvm-project/issues/63363
2023-06-17 16:31:21 -07:00
Krzysztof Parzyszek
d1c3ec61d6 [Hexagon] Add missing patterns for truncate to vNi1 2023-06-17 16:31:21 -07:00
Florian Hahn
1797ab36ef
Revert "[LSR] Consider post-inc form when creating extends/truncates."
This reverts commit abfeda5af329b5889db709ff74506e20e0b569e9.
and fe19036e1266d2a90b44725c82b898134906e4c3.

The added assertion triggers during clang bootstrap builds. Revert while
I investigate.
2023-06-17 17:58:41 +01:00
Florian Hahn
fe19036e12
[AMDGPU] Update test after abfeda5af329b58. 2023-06-17 10:15:15 +01:00
Jay Foad
01b512882d [AMDGPU] Generate checks for load-constant tests
Differential Revision: https://reviews.llvm.org/D153139
2023-06-17 06:47:15 +01:00
Weining Lu
c216ce0ef8 [LoongArch] Fix handling of the chain of CSRWR and CSRXCHG nodes
`LoongArchISD::CSRWR` has two results. The first is the result of
`loongarch.csrwr.[wd]` intrinsic and the second is the chain. But
currently the chain is not processed correctly when creating this
node, resulting in the `csrwr` instruction being optimized out when
the result is not used by anyone [1]. `LoongArchISD::CSRXCHG` has
the same issue.

This patch addresses this issue.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/asm/loongarch.h?h=v6.4-rc6#n219

Reviewed By: hev

Differential Revision: https://reviews.llvm.org/D153120
2023-06-17 10:49:18 +08:00
Weining Lu
4a69fd6269 [LoongArch][NFC] Precommit test for D153120 (the fix of CSRWR and CSRXCHG)
Reviewed By: xry111

Differential Revision: https://reviews.llvm.org/D153119
2023-06-17 10:49:17 +08:00
LiaoChunyu
12fee611ca [RISCV] Fold special case (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
Improve D151719.
(xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
https://alive2.llvm.org/ce/z/BZNEia

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D152128
2023-06-17 10:10:20 +08:00
Philip Reames
95697deff3 [RISCV] Make all vector binops use the _TU pseudo form
This continues towards the goal spelled out in https://discourse.llvm.org/t/riscv-transition-in-vector-pseudo-structure-policy-variants/71295. This patch switches all the binary operations (no widen, no narrow, but both int and FP) to use the _TU + implicit_def passthrough form.  Change is mechanical.

This only changes the unmasked variants. Masked variants will still go through doPeepholeMaskedRVV and end up in the unsuffixed/TA form. Fixing that will be a separate change.

Differential Revision: https://reviews.llvm.org/D152940
2023-06-16 16:28:19 -07:00
Nitin John Raj
a986998bad [RISCV] Introduce RISCVISD::VWMACC(U/SU)_VL opcode
Differential Revision: https://reviews.llvm.org/D153057
2023-06-16 16:11:35 -07:00
Krzysztof Parzyszek
77e4c48ede [Hexagon] Generate correct instruction for store i1, ($Rs<<$u2 + $Rt)
Fixes https://github.com/llvm/llvm-project/issues/63359
2023-06-16 15:26:29 -07:00
Matt Arsenault
d9333e360a Revert "AMDGPU: Drop and auto-upgrade llvm.amdgcn.ldexp to llvm.ldexp"
This reverts commit 1159c670d40e3ef302264c681fe7e0268a550874.

Accidentally pushed wrong patch
2023-06-16 18:13:07 -04:00
Matt Arsenault
1159c670d4 AMDGPU: Drop and auto-upgrade llvm.amdgcn.ldexp to llvm.ldexp 2023-06-16 18:06:27 -04:00
Krzysztof Parzyszek
4351060a2f [Hexagon] Properly combine overlapping stores in HVC 2023-06-16 13:29:19 -07:00
Matt Arsenault
b9c6d9e6c3 AMDGPU: Propagate amdgpu-waves-per-eu with attributor
This will do a value range merging down the callgraph, unlike the
current pass which can only propagate values to undecorated functions
from a kernel.

This one is a bit weird due to the interaction with the implied range
from amdgpu-flat-workgroup-size. At the default group range of 1,1024,
the minimum implied bounds is 4 so this ends up introducing the
attribute on undecorated functions. We could probably simplify this by
ignoring it and propagating the raw values. The subtarget interaction
and the interaction with amdgpu-flat-workgroup-size only really clamp
invalid values (plus the lower bound doesn't seem to do anything as
far as I can tell anyway).
2023-06-16 15:04:08 -04:00
Craig Topper
8a403166aa [RISCV] Treat __riscv_vsetvl_*(-1) as vlmax.
We already treat -1 passed to instruction intrinsics as vlmax, this
make vsetvli consistent.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D152954
2023-06-16 09:23:01 -07:00
Jingu Kang
82d330e0e0 [AArch64] Try to convert vector shift operation into vector add operation
The vector shift instructions tend to be worse than ADD/SUB on AArch64 cores
so this patch supports tablegen patterns for below simple transformation.

 x << 1 ==> x + x

Differential Revision: https://reviews.llvm.org/D153049
2023-06-16 17:13:45 +01:00
Amaury Séchet
c8f4ba374b [NFC] Autogenerate CodeGen/ARM/vlddup.ll 2023-06-16 15:35:47 +00:00
Amaury Séchet
ec77747fbd [NFC] Autogenerate CodeGen/ARM/sub-cmp-peephole.ll 2023-06-16 15:14:47 +00:00
Jay Foad
2124759528 [AMDGPU] Regenerate llvm.amdgcn.s.buffer.load checks 2023-06-16 15:21:17 +01:00
Simon Pilgrim
0342aefa32 [GlobalISel][X86] Add handling of scalar G_UADDO/G_USUBO opcodes
This finally allows x86 globalisel to lower addition/subtraction of illegal types without fallback :)
2023-06-16 15:15:27 +01:00
Simon Pilgrim
91afb4b769 [GlobalISel][X86] Add handling of scalar G_USUBE opcodes
Extend the G_UADDE handling to also support G_USUBE
2023-06-16 13:31:50 +01:00
Hans Wennborg
6fa1a2c084 [X86] Fix callee side of receiving byval args on the stack
See the discussion in
https://discourse.llvm.org/t/generic-llvm-ir-windows-x64-argument-passing-issue-in-llvm-11-0-0-and-later/71350

D51842 implemented byval lowering for Win64. D83175 made the call
lowering honor the "from now on treat this as a regular pointer" comment
also when the argument gets passed on the stack. However, it didn't
update the callee side.

Differential revision: https://reviews.llvm.org/D153020
2023-06-16 14:11:21 +02:00
Simon Pilgrim
cad1eefc7d [GlobalISel][X86] Add s8/s16/s64 handling of G_UADDE opcodes 2023-06-16 11:45:43 +01:00
Jay Foad
d065adcb48 [AMDGPU] Regenerate a few checks 2023-06-16 11:39:03 +01:00
Ivan Kosarev
41717fdee1 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 15.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152908
2023-06-16 10:31:35 +01:00
Ivan Kosarev
7a12fbc05f [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 11.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152904
2023-06-16 10:08:32 +01:00
Weining Lu
40241935e9 [LoongArch] Some cleanup and readability improvements to LoongArchISelLowering.cpp, NFC 2023-06-16 16:31:48 +08:00
tianleli
8561283b10 [DAG] Unroll opereand when its type is illegal for ldexp.
Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D152997
2023-06-16 09:44:04 +08:00
Vladislav Dzhidzhoev
06a0ae6524 Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"
Got rid of non-determinism in MetadataLoader.cpp.

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>

Differential Revision: https://reviews.llvm.org/D144004
2023-06-16 00:49:59 +02:00
Craig Topper
354530fe19 [RISCV] Prevent vsetvli insertion from deleting some vsetvli instructions
If the result register is used, it is not safe to delete.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D153076
2023-06-15 15:18:47 -07:00
Simon Pilgrim
29293e6f9d [GlobalISel][X86] Add i128 add/sub test coverage for narrowing on x86_64 triples 2023-06-15 22:40:42 +01:00
Simon Pilgrim
46b8cbbe01 [GlobalIsel][X86] Avoid IMPLICIT_DEF in irregular types for CTTZ/CTLZ legalization tests
IMPLICIT_DEF can lead to some pretty weird G_UNMERGE_VALUES of long lists of s1 values, try to use a real source value instead
2023-06-15 22:28:38 +01:00
Philip Reames
fc9b26440d [RISCV][InsertVSETVLI] Treat vmv.v.i as-if it were vmv.s.x when VL=1, and inactive lanes are undefined
A vmv.v.i/x splats the immediate to all active lanes. For the active lanes, this is the same as vmv.s.x which inserts one scalar into the low lane. If we can ignore all the inactive lanes (because they are known undefined), then the two are semantically equivalent. We already reason about compatible VL/VTYPE combinations for vmv.s.x, apply the same logic to vmv.v.i.

Unlike a vmv.s.x, we do need to be careful not to increase LMUL. A splat instruction is probably linear in LMUL, so restrict this to LMUL1.

Differential Revision: https://reviews.llvm.org/D152845
2023-06-15 14:10:04 -07:00
David Green
eb35786fa2 [ARM] Fix for invalid register in ReplaceConstByVPNOTs
This ensures a removed register does not get reused as we replace constant vpt
values.
2023-06-15 20:46:20 +01:00
Craig Topper
eea865bd4a Recommit "[SelectionDAG][RISCV] Add very basic PromoteIntegerResult/Op support for VP_SIGN/ZERO_EXTEND."
I have fixed an existing DAGCombiner bug that caused the previous assertion failure.
See 7163539466d7e8930416e55dd9fd29891f8239f2.

Original message

We don't have VP_ANY_EXTEND or VP_SIGN_EXTEND_INREG yet so I've
deviated a little from the non-VP lowering.

My goal was to fix the crashes that occurs on these test cases without this patch.

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D152854
2023-06-15 12:03:25 -07:00
Stanislav Mekhanoshin
4b111dd798 [AMDGPU] Fix VOPD dependency checks during combine
Check superreg/subreg defs of an instruction when checking for
dependencies. This may cause some regressions, but better be
safe than sorry. Changed tests are affected because of the
implicit-defs of the superregs.

Differential Revision: https://reviews.llvm.org/D152943
2023-06-15 11:16:33 -07:00
Vladislav Dzhidzhoev
b8ea03a4be Revert "Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)""
This reverts commit fcc3981626821addc6c77b98006d02030b8ceb7f,
since Bitcode-upgrading code doesn't seem to be deterministic.
2023-06-15 19:36:36 +02:00
Alan Zhao
222d73ff7a Revert "[SelectionDAG][RISCV] Add very basic PromoteIntegerResult/Op support for VP_SIGN/ZERO_EXTEND."
This reverts commit 6bf79fb09416b02b3f8589a4998610d70c185dae.

Reason: causes Clang to crash during Chrome debug builds: https://crbug.com/1455144
2023-06-15 10:20:03 -07:00
Matt Arsenault
3928e2d43f AMDGPU: Add baseline test for propagating amdgpu-waves-per-eu 2023-06-15 13:16:25 -04:00
Vladislav Dzhidzhoev
fcc3981626 Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"
Run split-dwarf-local-impor3.ll only on x86_64-linux.
2023-06-15 18:15:16 +02:00
Vladislav Dzhidzhoev
fbdeb8cbc1 Revert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"
This reverts commit d80fdc6fc1a6e717af1bcd7a7313e65de433ba85.
split-dwarf-local-impor3.ll fails because of an issue with
Dwo sections emission on Windows platform.
2023-06-15 18:04:32 +02:00
Krzysztof Parzyszek
0608764d6f [Hexagon] Do not track reserved regs in RDF optimizations 2023-06-15 09:01:04 -07:00
Vladislav Dzhidzhoev
d80fdc6fc1 [DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)
RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Fixed PR51501 (tests from D112337).

1. Reuse of DISubprogram's 'retainedNodes' to track other function-local
   entities together with local variables and labels (this patch cares about
   function-local import while D144006 and D144008 use the same approach for
   local types and static variables). So, effectively this patch moves ownership
   of tracking local import from DICompileUnit's 'imports' field to DISubprogram's
   'retainedNodes' and adjusts DWARF emitter for the new layout. The old layout
   is considered unsupported (DwarfDebug would assert on such debug metadata).

   DICompileUnit's 'imports' field is supposed to track global imported
   declarations as it does before.

   This addresses various FIXMEs and simplifies the next part of the patch.

2. Postpone emission of function-local imported entities from
   `DwarfDebug::endFunctionImpl()` to `DwarfDebug::endModule()`.
   While in `DwarfDebug::endFunctionImpl()` we do not have all the
   information about a parent subprogram or a referring subprogram
   (whether a subprogram inlined or not), so we can't guarantee we emit
   an imported entity correctly and place it in a proper subprogram tree.
   So now, we just gather needed details about the import itself and its
   parent entity (either a Subprogram or a LexicalBlock) during
   processing in `DwarfDebug::endFunctionImpl()`, but all the real work is
   done in `DwarfDebug::endModule()` when we have all the required
   information to make proper emission.

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>

Differential Revision: https://reviews.llvm.org/D144004
2023-06-15 17:17:53 +02:00
Vladislav Dzhidzhoev
77f8f40cd4 Revert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"
This reverts commit ed578f02cf44a52adde16647150e7421f3ef70f3.

Tests llvm/test/DebugInfo/Generic/split-dwarf-local-import*.ll fail
when x86_64 target is not registered.
2023-06-15 16:53:36 +02:00
Vladislav Dzhidzhoev
ed578f02cf [DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)
RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Fixed PR51501 (tests from D112337).

1. Reuse of DISubprogram's 'retainedNodes' to track other function-local
   entities together with local variables and labels (this patch cares about
   function-local import while D144006 and D144008 use the same approach for
   local types and static variables). So, effectively this patch moves ownership
   of tracking local import from DICompileUnit's 'imports' field to DISubprogram's
   'retainedNodes' and adjusts DWARF emitter for the new layout. The old layout
   is considered unsupported (DwarfDebug would assert on such debug metadata).

   DICompileUnit's 'imports' field is supposed to track global imported
   declarations as it does before.

   This addresses various FIXMEs and simplifies the next part of the patch.

2. Postpone emission of function-local imported entities from
   `DwarfDebug::endFunctionImpl()` to `DwarfDebug::endModule()`.
   While in `DwarfDebug::endFunctionImpl()` we do not have all the
   information about a parent subprogram or a referring subprogram
   (whether a subprogram inlined or not), so we can't guarantee we emit
   an imported entity correctly and place it in a proper subprogram tree.
   So now, we just gather needed details about the import itself and its
   parent entity (either a Subprogram or a LexicalBlock) during
   processing in `DwarfDebug::endFunctionImpl()`, but all the real work is
   done in `DwarfDebug::endModule()` when we have all the required
   information to make proper emission.

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>

Differential Revision: https://reviews.llvm.org/D144004
2023-06-15 16:15:39 +02:00
Matt Arsenault
e3547bc21b AMDGPU: Assume llvm.amdgcn.exp2 and log are canonicalizing
This was partially handled for log in SelectionDAG and both were
missed for GlobalISel.
2023-06-15 09:55:15 -04:00
Matt Arsenault
f8cc1b6400 AMDGPU: Delete some stray / dead check prefixes 2023-06-15 09:35:12 -04:00