Commit Graph

431783 Commits

Author SHA1 Message Date
Simon Pilgrim b651fdff79 [DAG] matchRotateSub - ensure the (pre-extended) shift amount is wide enough for the amount mask (PR56859)
matchRotateSub is given shift amounts that will already have stripped any/zero-extend nodes from - so make sure those values are wide enough to take a mask.
2022-08-02 11:38:52 +01:00
Adrian Kuegel b395c0f0cd [mlir] Update comment now that DenseArrayAttr has Tensor type. 2022-08-02 12:31:22 +02:00
Andrzej Warzynski b13448c56c [flang][docs][nfc] Refine FlangOptionsDocs.td
Currently, FlangOptionsDocs.td doesn't specify `ExcludedFlags` which
means that in the generated documentation file we expose flags that:
  * we don't necessarily won't to advertise to our users (e.g. hidden flags), or
  * are not supported altogether (e.g. CL options).
This patch defines `ExcludeFlags` to fix that. The definition of
`ExcludeFlags` was copied from Clang so that LLVM frontends have
consistent documentation.

It might be a bit counter-intuitive that IncludeFlags alone is not
sufficient here. However, the current logic in ClangOptionDocEmitter.cpp
will parse IncludeFlags and print all options that contains one of the
included flags, as well as their aliases. So, for example, for -fopenmp
(which is a supported Flang option), one would also get /fopenmp (i.e.
CL mode equivalent for -fopenmp). By adding ExcludeFlags, we make sure
that such aliases are excluded.

I've also taken the liberty and moved FlangOptionsDocs.td. Originally it
was located in Flang's "flang/include" directory, but there shouldn't be
any implementation/documentation files there. Instead, I'm moving it to
the "flang/docs" directory.

Differential Revision: https://reviews.llvm.org/D130558
2022-08-02 10:04:17 +00:00
Dawid Jurczak 78650b7861 [NFC] Remove some boilerplate from SmallVector header
In SmallVector header we use couple of times exactly same enable_if,
in this change we de-duplicate it and declare only once.

Extracted from: https://reviews.llvm.org/D129990

Differential Revision: https://reviews.llvm.org/D130779
2022-08-02 11:45:55 +02:00
Stephan Herhut 09ca1c0656 [mlir] Use EXPECT_DEBUG_DEATH in unit test
This allows the tests to also pass when compiled in opt mode.
2022-08-02 11:16:26 +02:00
David Sherwood 4ef9cb6c17 [AArch64][LoopVectorize] Disable tail-folding for SVE when loop has interleaved accesses
If we have interleave groups in the loop we want to vectorise then
we should fall back on normal vectorisation with a scalar epilogue. In
such cases when tail-folding is enabled we'll almost certainly go on to
create vplans with very high costs for all vector VFs and fall back on
VF=1 anyway. This is likely to be worse than if we'd just used an
unpredicated vector loop in the first place.

Once the vectoriser has proper support for analysing all the costs
for each combination of VF and vectorisation style, then we should
be able to remove this.

Added an extra test here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding-option.ll

Differential Revision: https://reviews.llvm.org/D128342
2022-08-02 09:52:33 +01:00
Alex Bradbury 5ad59c9e59 [RISCV][NFCI] Set TransientStackAlignment and rely on it rather than RVV-specific logic on RVV-less functions
* TargetFrameLowering has a TransientStackAlignment field that "returns
  the number of bytes to which the stack pointer must be aligned at all
  times, even between calls.
  * As explained in the [RISC-V calling
    convention](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc),
    the stack pointer must remain fully aligned throughout execution for
    compliant code. This is important for embedded targets that might avoid
    realigning the stack pointer for interrupt service routines. Systems
    running full OSes may always realign the stack anyway.
* TransientStackAlignment is used in estimateStackSize in
  MachineFrameInfo and in PEI::calculateFrameObjectOffsets.
  * estimateStackSize is only used in the RISC-V backend for scavenging
    slots. It may be possible to craft a function where the difference
    is observable, but it wouldn't be a meaningful test.
  * calculateFrameObjectOffsets makes use of TransientStackAlignment,
    but then sets the stack alignment to the max of that alignment and
    MaxAlign, which is unconditionally set to 16 in
    RISCVFrameLowering::processFunctionBeforeFrameFinalized
  * I've changed this logic to only set MaxAlign if there are RVV frame
    objects. There should be no functional change here for either RVV
    targets (MaxAlign is set as before) or non-RVV targets
    (TransientStackAlign is now 16 anyway).

Differential Revision: https://reviews.llvm.org/D130068
2022-08-02 09:46:06 +01:00
Tim Northover b586dc21a7 Outliner: add "target-cpu" feature from source function to outlined
The CPU is used to determine which inline asm instructions are allowed, so
needs to be copied across in case the outlined function contains any.
2022-08-02 09:33:29 +01:00
wanglian e208bab55f [RISCV][NFC] Use defined variable instead some code.
Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D130687
2022-08-02 16:26:33 +08:00
Martin Storsjö 3f25ad335b [OpenMP] Fix warnings about unused expressions when OMPT_LOOP_DISPATCH is a no-op. NFC.
This fixes warnings like these:

../runtime/src/kmp_dispatch.cpp:2159:24: warning: left operand of comma operator has no effect [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                       ^~~~~
../runtime/src/kmp_dispatch.cpp:2159:31: warning: left operand of comma operator has no effect [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                              ^~~~~
../runtime/src/kmp_dispatch.cpp:2159:46: warning: left operand of comma operator has no effect [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                                     ~~~~~~~ ^~
../runtime/src/kmp_dispatch.cpp:2159:50: warning: expression result unused [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                                                 ^~~~~~
2022-08-02 11:16:23 +03:00
Tom Stellard e0a3964aff workflows: Fix error when searching for backport reviewers 2022-08-02 01:09:02 -07:00
jacquesguan e38af7ba95 [LV] Refactor getExtendedAddReductionCost to support other extended reduction more than Add.
Now the API getExtendedAddReductionCost is used to determine the cost of extended Add reduction with optional Mul. For Arm, it could cover the cases. But for other target, for example: RISCV, they support other kinds of extended recution, such as FAdd.

This patch does the following changes:
1, Split getExtendedAddReductionCost into 2 new API: getExtendedReductionCost which handles the extended reduction with addtional input of Opcode; getMulAccReductionCost which handle the MLA cases the getExtendedAddReductionCost.
2, Refactor getReductionPatternCost, add some contraint condition to make sure the getMulAccReductionCost should only handle the reuction of Add + Mul.

Differential Revision: https://reviews.llvm.org/D130868
2022-08-02 16:02:38 +08:00
Martin Storsjö 112499f35f [mlir] Fix calling the native mlir-tblgen tool when cross compiling flang
When the mlir-tblgen tool is set up, the `MLIR_TABLEGEN_EXE` variable
is set, which either points to the mlir-tblgen tool built in the current
cmake build, or points to one built in a nested cmake build (if cross
conpiling, or if building with e.g. `LLVM_OPTIMIZED_TABLEGEN`.

The `MLIR_TABLEGEN_EXE` variable is only set within the scope of the
mlir/CMakeLists.txt file, so it's unavailable in sibling level projects
such as flang.

Set the `MLIR_TABLEGEN_EXE` and the `MLIR_TABLEGEN_TARGET` variables
as global, so that flang can use them properly without guessing.

Differential Revision: https://reviews.llvm.org/D130350
2022-08-02 10:58:24 +03:00
Martin Storsjö 46b5ab15cd [flang] Don't try to run the newly built flang-new when cross compiling
If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was
cross compiled and thus can't be executed on the build system, and thus
can't be used for generating module files.

Differential Revision: https://reviews.llvm.org/D130349
2022-08-02 10:57:57 +03:00
Martin Storsjö b7c5683fac [lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC. 2022-08-02 10:57:33 +03:00
Martin Storsjö 7f24fd26a8 [OpenMP] Only include CMAKE_DL_LIBS on unix platforms
CMAKE_DL_LIBS is documented as "Name of library containing dlopen
and dlclose".

On Windows platforms, there's no system provided dlopen/dlclose, but
it can be argued that if you really intend to call dlopen/dlclose,
you're going to be using a third party compat library like
https://github.com/dlfcn-win32/dlfcn-win32, and CMAKE_DL_LIBS should
expand to its name.

This has been argued upstream in CMake in
https://gitlab.kitware.com/cmake/cmake/-/issues/17600 and
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1642, that
CMAKE_DL_LIBS should expand to "dl" on mingw platforms.

The merge request wasn't merged though, as it caused some amount of
breakage, but in practice, Fedora still carries a custom CMake patch
with the same effect.

Thus, this patch fixes cross compiling OpenMP for mingw targets
on Fedora with their custom-patched CMake.

Differential Revision: https://reviews.llvm.org/D130892
2022-08-02 10:56:30 +03:00
Fangrui Song afb785f511 [Driver] Remove Separate form for XRay options
Supporting something like `-fxray-instruction-threshold= 1` is not intended.
2022-08-02 00:47:37 -07:00
Nikita Popov 62e4ee2def [LangRef] Fix typo in GEP docs
Introduced in D130356, reported here:
https://reviews.llvm.org/rG7ac7ec820296#inline-7690
2022-08-02 09:30:17 +02:00
Adrian Kuegel 6c66b089bc [mlir][Bazel] Fix typo in file name. 2022-08-02 09:27:20 +02:00
Adrian Kuegel b0cfbda04e [mlir][Bazel] Add missing dependency. 2022-08-02 09:23:03 +02:00
Adrian Kuegel 9183d40313 [mlir][Bazel] Add yet another missing dependency. 2022-08-02 09:15:43 +02:00
Adrian Kuegel 0b41c610f6 [mlir][Bazel] Add missing dependency. 2022-08-02 09:10:18 +02:00
Adrian Kuegel e031dea5be [mlir][Bazel] Update bazel build after 14d79afeae
Differential Revision: https://reviews.llvm.org/D130965
2022-08-02 09:03:27 +02:00
Purva-Chaudhari 168d4e2945 Handles failing driver tests of clang
Added support for incremental mode 8 and 28 ie. `frontend::EmitBC:` and `frontend::PrintPreprocessedInput:`
Added supporting clang tests to test in clang-repl mode

Reviewed By: v.g.vassilev

Differential Revision: https://reviews.llvm.org/D125946
2022-08-02 12:29:26 +05:30
Adrian Kuegel 78ad3e4cb5 [mlir][Bazel] Remove reference to deleted header. 2022-08-02 08:34:48 +02:00
Fangrui Song dde41c6c56 [ELF] --reproduce: strip directories for --print-archive-stats= and --why-extract=
Similar to -o and -Map.
2022-08-01 22:06:46 -07:00
Emmmer 768e59d959 [LLDB][RISCV] Add riscv register enums
According to [RISC-V ISA Spec](https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf) and [riscv-v-spec](https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#3-vector-extension-programmers-model)

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D130899
2022-08-02 11:55:33 +08:00
Konstantin Varlamov c64c3d31c4 [libc++][ranges][NFC] Fix a few links on the Ranges status page. 2022-08-01 20:43:59 -07:00
Chuanqi Xu 6d10733d44 [C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header
units. This results that we couldn't compile a Hello World Example with
Header Units. This patch tries to fix this.

Reviewed By: iains

Differential Revision: https://reviews.llvm.org/D130871
2022-08-02 11:24:46 +08:00
jacquesguan f1033a3f47 [mlir][Math] Add constant folder for TanOp.
This patch adds constant folder for TanOp which only supports single and double precision floating-point.

Differential Revision: https://reviews.llvm.org/D130873
2022-08-02 11:20:53 +08:00
Chuanqi Xu 39cfde2366 Revert "[C++20] [Modules] Handle initializer for Header Units"
This reverts commit db6152ad66.

This commit fails in ppc64. Since we want to backport it to 15.x. So
revert it now to keep the patch complete.
2022-08-02 11:09:38 +08:00
Fangrui Song 29f852a151 [Driver] Remove deprecated -fsanitize-coverage-{black,white}list= 2022-08-01 19:39:25 -07:00
Fangrui Song 0bb3aafbd5 [docs] Regenerate clang/docs/ClangCommandLineReference.rst
Also update -ftime-trace='s help to fix a recommonmark error.
2022-08-01 19:31:25 -07:00
Chuanqi Xu db6152ad66 [C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header
units. This results that we couldn't compile a Hello World Example with
Header Units. This patch tries to fix this.

Reviewed By: iains

Differential Revision: https://reviews.llvm.org/D130871
2022-08-02 10:27:02 +08:00
Jeff Niu ff52ad796c [mlir] Change DenseArrayAttr to TensorType
Previously, DenseArrayAttr used VectorType for its shaped type.
VectorType is problematic for arrays because it doesn't support zero
dimensions, meaning that an empty array would have `vector<i32>` as its
type. ElementsAttr would think that an empty dense array is size 1, not
0. This patch switches over to TensorType, which does support zero
dimensions.

Fixes #56860

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D130921
2022-08-01 22:17:28 -04:00
Fangrui Song 7a4902a0cc [sancov] Remove deprecated -blacklist after D113514 2022-08-01 19:00:43 -07:00
Siva Chandra Reddy 658c84e415 [libc] Add GNU extension functions pthread_setname_np and pthread_getname_np.
Reviewed By: michaelrj, lntue

Differential Revision: https://reviews.llvm.org/D130872
2022-08-02 01:57:03 +00:00
Fangrui Song 1c52b4f798 [llvm-cov] Remove deprecated -name-whitelist after D112816 2022-08-01 18:53:20 -07:00
Alex Brachet 9bf6eccae1 [clang] Only run test on x86 2022-08-02 00:56:05 +00:00
Sotiris Apostolakis 995b61cdac [SelectOpti] Auto-disable other cmov optis when the new select-opti pass is enabled
Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D129817
2022-08-02 00:19:59 +00:00
Craig Topper c2d0685286 [RISCV] Simplify test case from D130931. NFC 2022-08-01 16:50:56 -07:00
Sunho Kim 5680ef870f [IntelJITEvents] Add missing include.
Fixes compilation error.

Differential Revision: https://reviews.llvm.org/D130898
2022-08-02 08:45:14 +09:00
Manish Gupta 14d79afeae [mlir][NVGPU] nvgpu.mmasync on F32 through TF32
Adds optional attribute to support tensor cores on F32 datatype by lowering to `mma.sync` with TF32 operands. Since, TF32 is not a native datatype in LLVM we are adding `tf32Enabled` as an attribute to allow the IR to be aware of `MmaSyncOp` datatype. Additionally, this patch adds placeholders for nvgpu-to-nvgpu transformation targeting higher precision tf32x3.

For mma.sync on f32 input using tensor cores there are two possibilites:
(a) tf32   (1 `mma.sync` per warp-level matrix-multiply-accumulate)
(b) tf32x3 (3 `mma.sync` per warp-level matrix-multiply-accumulate)

Typically, tf32 tensor core acceleration comes at a cost of accuracy from missing precision bits. While f32 has 23 precision bits, tf32 has only 10 precision bits. tf32x3 aims to recover the precision bits by splitting each operand into two tf32 values and issue three `mma.sync` tensor core operations.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D130294
2022-08-01 23:23:27 +00:00
Martin Sebor bcef4d238d [InstCombine] Correct strtol folding with nonnull endptr
Reflect in the pointer's offset the length of the leading part
of the consumed string preceding the first converted digit.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D130912
2022-08-01 16:47:05 -06:00
Ben Langmuir 98cf745a03 [clang] Only modify FileEntryRef names that are externally remapped
As progress towards having FileEntryRef contain the requested name of
the file, this commit narrows the "remap" hack to only apply to paths
that were remapped to an external contents path by a VFS. That was
always the original intent of this code, and the fact it was making
relative paths absolute was an unintended side effect.

Differential Revision: https://reviews.llvm.org/D130935
2022-08-01 15:45:51 -07:00
Craig Topper da5b1bf5bb [RISCV] Teach RISCVMergeBaseOffset to merge %lo/%pcrel_lo into load/store after folding arithmetic.
It's possible we have:
lui  a0, %hi(sym)
addi a0, %lo(sym)
addi a0, <offset1>
lw a0, <offset2>(a0)

We want to arrive at
lui a0, %hi(sym+offset1+offset2)
lw a0, %lo(sym+offset1+offset2)

We currently fail to do this because we only consider loads/stores
if we didn't find any arithmetic.

This patch splits arithmetic folding and load/store folding into
two separate phases. The load/store folding can no longer assume
the offset in hi/lo is 0 so we must combine the offsets. I've applied
the same simm32 limit that we applied in the arithmetic folding.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D130931
2022-08-01 15:33:21 -07:00
Ilia Diachkov b25b507c77 [SPIRV] use tablegen to create SPIRVBaseInfo*
The patch replaces SPIRVBaseInfo.* previously created using macros by
the tablegen approach. There are many small changes in other files due to
differences in namespaces. Also, functions in SPIRVUtils are moved to
the llvm namespace.

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

Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
2022-08-02 01:57:23 +03:00
Alex Brachet 6b3fa58fde [clang] Make test agnostic to file seperator character 2022-08-01 22:12:04 +00:00
Alex Brachet 71f2d5c2d1 [clang] Re-enable test after marking it XFAIL
This test had to be disabled because ps4 targets don't support
-fuse-ld. Preferably, this should just be unsupported for ps4
targets. However no such lit feature exists so I have just gone
ahead and set the target explicitly. Moreover, this needs
to create a terminal link step, either an executable or shared
object to get the link error. With the change to the explicit
target I've had to also add -nostartfiles -nostdlib so that
clang doesn't pull crt files into the link which may not be
present. Again, this would likely be solved if this test
was unsupported for the one platform that disables -fuse-ld
2022-08-01 22:09:13 +00:00
River Riddle 40abd7ea64 [mlir] Remove OpaqueElementsAttr
This attribute is technical debt from the early stages of MLIR, before
ElementsAttr was an interface and when it was more difficult for
dialects to define their own types of attributes. At present it isn't
used at all in tree (aside from being convenient for eliding other
ElementsAttr), and has had little to no evolution in the past three years.

Differential Revision: https://reviews.llvm.org/D129917
2022-08-01 15:00:54 -07:00