Commit Graph

448670 Commits

Author SHA1 Message Date
Slava Zakharin
b3d8639f35 [mlir][llvmir] Fixed MDNode uniquing during TBAA translation.
In the process of creating the MDNodes for the TBAA tag operations
we used to produce incomplete MDNodes like:
```
  @__tbaa::@tbaa_tag_4 => !{!null, !null, i64 0}
  @__tbaa::@tbaa_tag_7 => !{!null, !null, i64 0}
```
This caused the two tags to map to the same incomplete MDNode due to uniquing.
To prevent this, we have to use temporary MDNodes instead of !null's.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D141726
2023-01-16 12:38:31 -08:00
Hendrik Greving
37c750a5fd [mlir:LLVM] Fix minor bug, missing cconv translation
Fixes translating the calling convention to LLVM-IR, possibly missed
by https://reviews.llvm.org/D126161, and adds a test.
2023-01-16 12:18:28 -08:00
Lei Huang
ee559b21b9 [P10] Fix the implementation for BRH
Fixes the patterns for the brh instruction to include a clrldi when emitted.

Reviewed By: amyk

Differential Revision: https://reviews.llvm.org/D141697
2023-01-16 13:53:43 -06:00
Ram-NK
ee7188c8b2 [LoopInterchange] Correcting the profitability check
Before D135808, There would be endless loop interchange posibility (no
proper priority was there in profitability check. Any profitable check
may leads to loop-interchange). With this patch, there  is no endless
interchange (priority in profitable check is defined. Order of decision
is 'Cache cost' check, 'InstrOrderCost', 'Vectorization'). Corrected the
dependency checking inside isProfitableForVectorization(), corrected the
checking of bad order loops in isProfitablePerInstrOrderCost().

Reviewed By: Meinersbur, bmahjour, #loopoptwg

Differential Revision: https://reviews.llvm.org/D135808
2023-01-16 14:36:06 -05:00
Alex Zinenko
3f2f83ef41 [mlir] accept values with result numbers in gpu.launch_func
The parser of gpu.launch_func was incorrectly rejecting SSA values with
result numbers (`%0#0`) in the list of function arguments by using the
`parseArgument` function intended for region argument declarations, not
operands. Fix this by directly parsing comma-separated operands and
types.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D141851
2023-01-16 19:26:42 +00:00
Joseph Huber
9954516ffb [nvptx-arch] Dynamically load the CUDA runtime if not found during the build
Much like the changes in D141859, this patch allows the `nvptx-arch`
tool to be built and provided with every distrubition of LLVM / Clang.
This will make it more reliable for our toolchains to depend on. The
changes here configure a version that dynamically loads CUDA if it was
not found at build time.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D141861
2023-01-16 13:13:47 -06:00
Joseph Huber
f6ace23172 [amdgpu-arch] Dynamically load the HSA runtime if not found during the build
We use the `amdgpu-arch` tool to query the installed GPUs at runtime.
One problem is that this tool is currently not build if the person
building the LLVM binary does not have the HSA runtime on their system.
This means that if someone built and distrubted an installation of LLVM
without HSA, then the user will not be able to use it even if they have
it on their system.

This patch makes us build this tool unconditionally and adds extra logic
to dynamically load HSA if it's present.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D141859
2023-01-16 13:13:45 -06:00
Kelvin Li
a8be1a3dd3 [flang][NFC] Fix typo in Cray pointee error message 2023-01-16 14:09:01 -05:00
David Green
72290a359a [AArch64] Add tests for forming abd from wrap flags and min/max. NFC 2023-01-16 18:55:10 +00:00
Simon Pilgrim
cf47a8d383 Silence signed/unsigned comparison warnings. NFC. 2023-01-16 18:52:04 +00:00
Nikolas Klauser
dc21ce4404 [libc++] Remove <type_traits> includes from <atomic> and <ratio>
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D141799
2023-01-16 19:38:33 +01:00
Mahesh Ravishankar
9db7d4edd8 [mlir][TilingInterface] Add an option to tile and fuse to yield replacement for the fused producer.
This patch adds an option to the method that fuses a producer with a
tiled consumer, to also yield from the tiled loops a value that can be
used to replace the original producer. This is only valid if it can be
assertained that the slice of the producer computed within each
iteration of the tiled loop nest does not compute slices of the
producer redundantly. The analysis to derive this is very involved. So
this is left to the caller to assertain.  A test is added that mimics
the `scf::tileConsumerAndFuseProducersGreedilyUsingSCFForOp`, but also
yields the values of all fused producers. This can be used as a
reference for how a caller could use this functionality.

Differential Revision: https://reviews.llvm.org/D141028
2023-01-16 18:30:13 +00:00
Simon Pilgrim
f4f8f9f185 [Thumb2][MVE] Recognise shuffle truncation patterns suitable for ARMISD::MVETRUNC
I'm helping with the remaining regressions on D127115, and one of my candidate fixes caused some regressions with MVE interleaved shuffles due to poor handling of 'truncation' style shuffle masks (0,2,4,6,...).

This patch attempts to use the ARMISD::MVETRUNC node to handle these cases, based off existing code in LowerTruncate.

It handles both (0,2,4,6,...) and (1,3,5,7,....) 'top' style patterns (assuming no endian problems). I shift down the 'top' patterns - a basic search of ARM docs suggests MVE has some top/bottom truncation/narrowing instructions but I don't seem to be able to get them to be used.

Differential Revision: https://reviews.llvm.org/D141791
2023-01-16 17:59:45 +00:00
Sanjay Patel
dedc58da49 [InstCombine] canonicalize a signum (spaceship) that ends in add
(A s>> (BW - 1)) + (zext (A s> 0)) --> (A s>> (BW - 1)) | (zext (A != 0))

https://alive2.llvm.org/ce/z/V-nM8N

This is not the form that we currently match as m_Signum(),
but I'm not sure if one is better than the other, so there's
a follow-up patch needed either way.

For this patch, it should be better for analysis to use a
not-null test and bitwise logic rather than >0 with add.
Codegen doesn't seem significantly different on any targets
that I looked at.

Also note that none of these variants is shown in issue #60012 -
those generally include at least one 'select', so that's likely
where these patterns will end up.
2023-01-16 12:47:21 -05:00
Sanjay Patel
625e666d0e [InstCombine] add tests for signum (spaceship) variant; NFC 2023-01-16 12:47:20 -05:00
Matt Kulukundis
caf393da18 Fix format for case in .proto files
Fix format for `case` in .proto files

Reviewed By: krasimir, echristo

Differential Revision: https://reviews.llvm.org/D141547
2023-01-16 17:43:50 +00:00
serge-sans-paille
c512eda38e [lld][COFF] Provide unwinding information for Chunk injected by /delayloaded
For each symbol in a /delayloaded library, lld injects a small piece of
code to handle the symbol lazy loading. This code doesn't have unwind
information, which may be troublesome.

Provide these information for AMD64.

Thanks to Yannis Juglaret <yjuglaret@mozilla.com> for contributing the
unwinding info and for his support while crafting this patch.

Fix #59639

Differential Revision: https://reviews.llvm.org/D141691
2023-01-16 18:39:21 +01:00
Michael Buch
48e862d06d [libcxx] Add missing includes
This fixes the remaining errors when building the llvm-project
with `LLVM_ENABLE_MODULES=ON` (and `LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY=ON`,
which currently is the LLVM default).

Previously this would fail in the `CXX_SUPPORTS_MODULES` check.

Differential Revision: https://reviews.llvm.org/D141833
2023-01-16 17:26:47 +00:00
David Green
0f422215ac [AArch64] Move default extensions from clang Driver to TargetParser
The default extensions would be better added in the TargetParser, not by
the driver. This removes the addition of +i8mm and +bf16 features in the
driver as they are already added in 8.6/9.1 architectures. AEK_MOPS and
AEK_HBC have been added to 8.8/9.3 architectures to replace the need for
+hbc and +mops features.

Differential Revision: https://reviews.llvm.org/D141518
2023-01-16 16:58:18 +00:00
Frank (Fang) Gao
688d6507c7 [mlir][vector] Add scalable vectors support to OuterProductOp
This will probably be the first in a series of patches that tries to
enable code generation for ARM SME (extension of SVE).

Since SME's core operation is the outer product instruction, I figured
that it would probably be a good idea to enable the outer product
operation to properly accept and generate scalable vectors.

Reviewed By: dcaballe

Differential Revision: https://reviews.llvm.org/D138718
2023-01-16 11:49:11 -05:00
Prabhdeep Singh Soni
3e38fdf686 Revert "[mlir][vector] Add scalable vectors support to OuterProductOp"
This reverts commit be4c5ad54c.

This patch did not include the test case.
2023-01-16 11:47:06 -05:00
Mehdi Amini
4e01532450 Check for FunctionOpInterface when looking up a parent function in GPU lowering
This makes it more robust when expanding code in other function than
func.func, like spv.func for example.

Fixes #60072
2023-01-16 16:40:11 +00:00
Ivan Kosarev
ce1aae4d54 [AMDGPU][AsmParser][NFC] Refine defining single-bit custom operands.
Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D141301
2023-01-16 16:11:59 +00:00
Felipe de Azevedo Piovezan
f2d301fe82 Revert "[codegen] Store address of indirect arguments on the stack"
This reverts commit 7e4447a17d.
2023-01-16 13:05:22 -03:00
Nikita Popov
9f1521b6da [Support] Fix incorrect assertion in backref compilation
These should be == rather than !=.
2023-01-16 16:56:33 +01:00
Nikita Popov
bc367dde85 [Support] Fix REDEBUG compilation 2023-01-16 16:56:32 +01:00
Benjamin Maxwell
cd8cac438d [DebugInfo] Add CIE::getAugmentationData() and FDE::getCIEPointer()
Public getters are provided for other similar members of both the CIE
and FDE, these fields are also displayed by the llvm-drawfdump tool,
so it seems like not exposing them was likely an oversight.

These are needed for tools based on LLVM that need access to all the
parsed DWARF data.

Differential Revision: https://reviews.llvm.org/D141475
2023-01-16 15:38:14 +00:00
Matthias Springer
fefe655baa [mlir][NFC] GreedyPatternRewriteDriver: Consistent return values
All `apply...` functions now return a LogicalResult indicating whether the iterative process converged or not.

Differential Revision: https://reviews.llvm.org/D141845
2023-01-16 16:30:12 +01:00
Matthias Springer
6e5021b8dc [mlir][NFC] GreedyPatternRewriteDriver: Remove overridden eraseOp
It is not necessary to override `eraseOp`, we can use the existing `notifyOperationRemoved`.

Differential Revision: https://reviews.llvm.org/D141844
2023-01-16 16:18:53 +01:00
Mehdi Amini
5ab0894fd5 Explicitly more Error when returning it (NFC)
This is an attempt to fix a build failure:

llvm/lib/Object/ELFObjectFile.cpp:300:12: error: call to deleted constructor of 'llvm::Error'
    return E;
2023-01-16 15:07:46 +00:00
Francesco Petrogalli
730c7a45f5 [docs] Expand example on stand-alone builds.
1. Make explicit that the folder where to build a subproject in stand-alone mode can not be the same folder where LLVM was build.
2. Add a cut 'n paste example for building stand-alone `clang`.

Differential Revision: https://reviews.llvm.org/D141825
2023-01-16 16:02:06 +01:00
Freddy Ye
db711f79ef [X86] Prefer fpext(splat(X)) to splat(fpext(x)).
This patch is to fix regression of D122875. X86 has fpext instructions
supporting rmb form, which takes advantage of fpext(fplat(X)) than
splat(fpext(X)).

Reviewed By: RKSimon, skan

Differential Revision: https://reviews.llvm.org/D141657
2023-01-16 22:48:30 +08:00
Luo, Yuanke
659e1b7bb0 [X86] Add more test case for folding select on vXi1 2023-01-16 22:25:59 +08:00
Guillaume Chatelet
135f23d67b Deprecate MemIntrinsicBase::getDestAlignment() and MemTransferBase::getSourceAlignment()
Differential Revision: https://reviews.llvm.org/D141840
2023-01-16 14:22:03 +00:00
Felipe de Azevedo Piovezan
7e4447a17d [codegen] Store address of indirect arguments on the stack
With codegen prior to this patch, truly indirect arguments -- i.e.
those that are not `byval` -- can have their debug information lost even
at O0. Because indirect arguments are passed by pointer, and this
pointer is likely placed in a register as per the function call ABI,
debug information is lost as soon as the register gets clobbered.

This patch solves the issue by storing the address of the parameter on
the stack, using a similar strategy employed when C++ references are
passed. In other words, this patch changes codegen from:

```
define @foo(ptr %arg) {
   call void @llvm.dbg.declare(%arg, [...], metadata !DIExpression())
```

To:

```
define @foo(ptr %arg) {
   %ptr_storage = alloca ptr
   store ptr %arg, ptr %ptr_storage
   call void @llvm.dbg.declare(%ptr_storage, [...], metadata !DIExpression(DW_OP_deref))
```

Some common cases where this may happen with C or C++ function calls:
  1. "Big enough" trivial structures passed by value under the ARM ABI.
  2. Structures that are non-trivial for the purposes of call (as per
  the Itanium ABI) when passed by value.

A few tests were matching the wrong alloca (matching against the new
alloca, instead of the old one), so they were updated to either match
both allocas or include a `,` right after the alloca type, to prevent
matching against a pointer type.

Differential Revision: https://reviews.llvm.org/D141381
2023-01-16 11:14:55 -03:00
Elena Lepilkina
537cdf92c4 [llvm-objdump][RISCV] Use new common method to parse ARCH RISCV attribute
Differential Revision: https://reviews.llvm.org/D139553
2023-01-16 16:57:55 +03:00
Ed Maste
2b91dbae65 [libc++] allow redefined macro in non_trivial_copy_move_ABI test
__config defines _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
on FreeBSD, which conflicts with a command-line definition used by the
non_trivial_copy_move_ABI test.

Add -Wno-macro-redefined to ADDITIONAL_COMPILE_FLAGS in this test.

Reviewed By: philnik

Differential Revision: https://reviews.llvm.org/D141774
2023-01-16 08:49:13 -05:00
Alexey Lapshin
2216ee4909 This patch allows llvm-dwarfutil to utilize accelerator tables
generation code from DWARFLinker. It adds command line option:

--build-accelerator [none,DWARF]
                        Build accelerator tables(default: none)
  =none - Do not build accelerators
  =DWARF - Build accelerator tables according to the resulting DWARF version
       DWARFv4: .debug_pubnames and .debug_pubtypes
       DWARFv5: .debug_names

Differential Revision: https://reviews.llvm.org/D139638
2023-01-16 14:42:30 +01:00
Sergei Barannikov
8a0e0c2260 [NFC] Use llvm::enumerate in llvm/unittests/Object
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D141788
2023-01-16 15:59:31 +03:00
Guillaume Chatelet
cb37cf6161 [NFC] Remove dead code 2023-01-16 12:57:13 +00:00
Guillaume Chatelet
80bb57fd99 Deprecate Argument::getParamAlignment() 2023-01-16 12:44:10 +00:00
Florian Hahn
a6549718d9 [LoopUnroll] Don't update DT for changeToUnreachable.
There is no need to update the DT here, because there must be a unique
latch. Hence if the latch is not exiting it must directly branch back
to the original loop header and does not dominate any nodes.

Skipping a DT update here simplifies D141487.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D141810
2023-01-16 12:25:34 +00:00
Haojian Wu
75cb138911 [bazel] Another blank-line format fix for the utils/bazel/configure.bzl, NFC 2023-01-16 13:14:15 +01:00
Sergey Kachkov
868abc471d Revert "[GVN] Refactor handling of pointer-select in GVN pass"
This reverts commit fc7cdaa373.
2023-01-16 15:13:17 +03:00
Zain Jaffal
32d72bdc32 [AArch64] Add tests for dotreduce to check for wider vectors.
Currently we only reduce vector.reduce.add to sdot if the vectors are either <8 x i8> or <16 x i8>.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D141692
2023-01-16 12:05:15 +00:00
Max Kazantsev
82cee24e3d [JumpThreading] Preserve profile metadata during select unfolding, take 2
Jump threading can replace select and unconditional branch with
conditional branch, but when doing so loses profile information.

This destructive transform can eventually lead to a performance
degradation due to folding of branches in
shouldFoldCondBranchesToCommonDestination as branch probabilities
are no longer known.

The first version was reverted due to assert caused by i32 overflow,
fixed in this version.

Patch by Roman Paukner!

Differential Revision: https://reviews.llvm.org/D138132
Reviewed By: mkazantsev
2023-01-16 19:04:23 +07:00
Haojian Wu
45ab848f53 [bazel] Fix the format of utils/bazel/configure.bzl, NFC 2023-01-16 12:58:25 +01:00
Kerry McLaughlin
6387d38966 [AArch64][SME] Add an instruction mapping for SME pseudos
Adds an instruction mapping to SMEInstrFormats which matches SME
pseudos with the real instructions they are transformed to.
A new flag is also added to AArch64Inst (SMEMatrixType), which is
used to indicate the base register required when emitting many
of the SME instructions.

This reduces the number of pseudos handled by the switch statement
in EmitInstrWithCustomInserter.

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D136856
2023-01-16 11:52:44 +00:00
Jolanta Jensen
1506839485 [NFC] Fixed a typo in clang help docs
Fixed minor typo in clang help docs.

Differential Revision: https://reviews.llvm.org/D141507
2023-01-16 11:50:58 +00:00
Sven van Haastregt
a60b8f4681 [OpenCL] Allow undefining header-only features
`opencl-c-base.h` always defines 5 particular feature macros for
SPIR-V, making it impossible to disable those features.

To allow disabling any of those features, let the header recognize
`__undef_<feature>` macros.  The user can then pass the
`-D__undef_<feature>` flag on the command line to disable a specific
feature.  The __undef macro could potentially also be set from
`-cl-ext=-feature`, but for now only change the header and only
provide __undef macros for the 5 features that are always enabled in
`opencl-c-base.h`.

Differential Revision: https://reviews.llvm.org/D141297
2023-01-16 11:32:12 +00:00