platform/upstream/llvm.git
22 months ago[SCCP] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:30:34 +0000 (16:30 +0100)]
[SCCP] Convert test to opaque pointers (NFC)

22 months agoFix the LLVM sphinx build
Aaron Ballman [Wed, 4 Jan 2023 15:29:43 +0000 (10:29 -0500)]
Fix the LLVM sphinx build

This should address the issue found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/30330

22 months agoCoroFrame: Put escaped variables with multiple lifetimes on coroutine frame
Matthias Braun [Fri, 16 Dec 2022 15:21:41 +0000 (07:21 -0800)]
CoroFrame: Put escaped variables with multiple lifetimes on coroutine frame

The llvm.lifetime.start intrinsic guarantees that the address for a
given alloca is always the same. So variables with escaped addresses
reaching reaching a lifetime start/end block before and after a suspend
must be placed onto the coroutine frame even if the variable itself
is not alive across the suspend point.

This computes a new `LoopKill` flag in the suspend crossing data flow
anaysis to catch the case where a lifetime marker can reach itself
via suspend-crossing path.

This fixes https://llvm.org/PR52501

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

22 months ago[SimpleLoopUnswitch] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:28:13 +0000 (16:28 +0100)]
[SimpleLoopUnswitch] Convert tests to opaque pointers (NFC)

22 months ago[SimplifyCFG] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:27:23 +0000 (16:27 +0100)]
[SimplifyCFG] Convert some tests to opaque pointers (NFC)

22 months ago[libc][NFC] Remove unused variable
Guillaume Chatelet [Wed, 4 Jan 2023 15:25:48 +0000 (15:25 +0000)]
[libc][NFC] Remove unused variable

22 months ago[TypePromotion] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:26:13 +0000 (16:26 +0100)]
[TypePromotion] Convert tests to opaque pointers (NFC)

22 months ago[Annotation2Metadata] Support opaque pointers
Nikita Popov [Wed, 4 Jan 2023 15:21:56 +0000 (16:21 +0100)]
[Annotation2Metadata] Support opaque pointers

Strip pointer casts instead of matching specific constant
expressions.

22 months ago[UnifyLoopExits] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 4 Jan 2023 15:13:56 +0000 (16:13 +0100)]
[UnifyLoopExits] Convert test to opaque pointers (NFC)

22 months ago[WebAssembly] Replace LOAD_SPLAT with SPLAT_VECTOR
Luke Lau [Mon, 12 Dec 2022 19:53:27 +0000 (19:53 +0000)]
[WebAssembly] Replace LOAD_SPLAT with SPLAT_VECTOR

Splats were selected by matching on uses of `build_vector` with
identical elements, but a while back a target independent node for
vector splatting was added.
This removes the WebAssembly specific LOAD_SPLAT intrinsic, and instead
makes SPLAT_VECTOR legal and adds patterns for splat loads.

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

22 months ago[Driver] Convert test to check 'target=...'
Paul Robinson [Wed, 4 Jan 2023 14:41:59 +0000 (06:41 -0800)]
[Driver] Convert test to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

22 months ago[ConstraintElim] Add option to limit number of rows tracked in system.
Florian Hahn [Wed, 4 Jan 2023 13:59:22 +0000 (13:59 +0000)]
[ConstraintElim] Add option to limit number of rows tracked in system.

Once the constraint system grows too large in terms of number of rows,
queries can become very slow. This patch adds a new option to limit the
number of rows tracked.

The python script below can be used to generate worst-case IR with a
chain of conditional branches with N branches.

With this limit, we get the following runtimes:
* python3 generate.py 100:   0.1s
* python3 generate.py 1000:  2s
* python3 generate.py 10000: 4s

Without the limit, the case with 1000 chained conditions takes 20+
seconds.

generate.py:
    import sys

    N = int(sys.argv[1])

    args = []
    checks = []

    for i in range(0, N):
        args.append('i32 %l{}'.format(i))
        checks.append("""
    bb{0}:
      %c{0} = icmp uge i32 %l{0}, 100
      br i1 %c{0}, label %bb{1}, label %exit
    """.format(i, i+1))

    print("""
    define i1 @foo({0}) {{
    {1}

    bb{2}:
      %c{2} = icmp uge i32 %l0, 100
      ret i1 %c{2}

    exit:
      ret i1 false
    }}
    """.format(' ,'.join(args), '\n'.join(checks), N))

Reviewed By: nikic

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

22 months ago[MC] Consistently use MCInstrDesc::getImplicitUses and getImplicitDefs. NFC.
Jay Foad [Wed, 4 Jan 2023 13:15:09 +0000 (13:15 +0000)]
[MC] Consistently use MCInstrDesc::getImplicitUses and getImplicitDefs. NFC.

22 months ago[AArch64] Alter arm_neon_sve_bridge.h to be target-based, not preprocessor based.
David Green [Wed, 4 Jan 2023 13:09:26 +0000 (13:09 +0000)]
[AArch64] Alter arm_neon_sve_bridge.h to be target-based, not preprocessor based.

Similar to D131064, this alters the arm_neon_sve_bridge.h header to use
target-based intrinsics that give an error if used in a function that
does not have the sve features, but are not preprocessed out. This
header is simpler than the arm_sve.h and other headers, not including
any tablegen'd content. The main change is altering the builtin
definitions from using BUILTIN to TARGET_BUILTIN.

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

22 months agoMachineIRBuilder.h: Fix typo. NFC
Diana Picus [Wed, 4 Jan 2023 13:07:35 +0000 (14:07 +0100)]
MachineIRBuilder.h: Fix typo. NFC

22 months ago[JITLink][RISCV] Add R_RISCV_RVC_BRANCH and R_RISCV_RVC_JUMP
Jonas Hahnfeld [Sun, 1 Jan 2023 22:08:18 +0000 (23:08 +0100)]
[JITLink][RISCV] Add R_RISCV_RVC_BRANCH and R_RISCV_RVC_JUMP

These are the compressed equivalents of the relocations R_RISCV_BRANCH
and R_RISCV_JAL with slightly more complex immediate handling.

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

22 months ago[clangd] Disable backend-releated filelist compiler options.
Haojian Wu [Wed, 4 Jan 2023 09:42:24 +0000 (10:42 +0100)]
[clangd] Disable backend-releated filelist compiler options.

These options doesn't affect the AST generation, and clang will crash
(CreateOrDie in ASTContext) immedidately when the provided file are not existed.

Disable them in clangd to make clangd more robust.

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

22 months ago[NFC] Add x86 triple to lower-offset-expression.ll
Pavel Kopyl [Wed, 4 Jan 2023 11:56:24 +0000 (14:56 +0300)]
[NFC] Add x86 triple to lower-offset-expression.ll

This prevents failing the test on targets other than X86 that are set
as default when X86 one is also supported.

22 months ago[NVPTX] Replace PTX's ManagedStringPool with StringSaver
Luke Drummond [Tue, 20 Dec 2022 00:57:54 +0000 (00:57 +0000)]
[NVPTX] Replace PTX's ManagedStringPool with StringSaver

In use ManagedStringPool caused a lot of heap allocations. At least one
for every register name lookup in NVPTXTargetRegisterInfo and one for
every symbol lookup in the target machine and isel lowering. There
already exists an llvm/Support string interning-class that has better
memory performance. Use LLVM's and delete ManagedStringPool which was
unique to PTX

llc Binary Size (.text only; bss and data were unchanged):
  MinsizeRel:
    Before: 31219884
    After: 31219796
  Release:
    Before: 42961872
    After: 42960656

Total heap allocations by the NVPTX string saving code running
check-llvm-codegen-nvptx

Total bytes allocated:
  Before: 2431825
  After: 2288151

(All numbers on x86-64-linux-gnu / gcc-12 / lld14)

I didn't see obvious time differences when running the tests.

Reviewers: tra, avasonic
Differential Revision: https://reviews.llvm.org/D140704

22 months ago[runtimes] Only depend on builtins for same target
Shoaib Meenai [Tue, 13 Dec 2022 05:51:14 +0000 (21:51 -0800)]
[runtimes] Only depend on builtins for same target

We don't need to have built all the builtins before building the
runtimes for a particular target, only the builtins for that target.
While I'm here, rename the variable that stores the builtins dep to
something less generic than `deps`, to minimize the chances of
accidentally using a variable with the same name from an outer scope.

Reviewed By: phosek

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

22 months ago[AAPointerInfo] fix assertion at the pass-through use of a pointer
Sameer Sahasrabuddhe [Tue, 3 Jan 2023 05:55:14 +0000 (11:25 +0530)]
[AAPointerInfo] fix assertion at the pass-through use of a pointer

HandlePassthroughUser may sometimes create a new entry for the OffsetInfo of a
user in the OffsetInfoMap. This can invalidate outstanding references into the
map, including the one which needs to be copied into the new entry. This
produces invalid offset info that can trigger assertions.

Fixed this by not using references at this point. The bug was originally
introduced in commit ID 0dc0a441323d41b4860668f38d290579e0de130c.

Reviewed By: ronlieb

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

22 months ago[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.
David Green [Wed, 4 Jan 2023 11:22:20 +0000 (11:22 +0000)]
[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.

This patch makes SVE intrinsics more useable by gating them on the
target, not by ifdef preprocessor macros. See #56480. This alters the
SVEEmitter for arm_sve.h to remove the #ifdef guards and instead use
TARGET_BUILTIN with the correct features so that the existing "'func'
needs target feature sve" error will be generated when sve is not
present.

The ArchGuard containing defines in the SVEEmitter are changed to
TargetGuard containing target features. In the arm_neon.h emitter there
are both existing ArchGuard ifdefs mixed with new TargetGuard target
feature guards, so the name is change in the SVE too for consistency.
The few functions that are present in arm_sve.h (as opposed to builtin
aliases) have __attribute__((target("sve"))) added. Some of the tests
needed to be rejigged a little, as well as updating the error message,
as the error now happens at a later point.

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

22 months ago[ConstraintElim] Remove legacy pass implementation.
Florian Hahn [Wed, 4 Jan 2023 11:21:12 +0000 (11:21 +0000)]
[ConstraintElim] Remove legacy pass implementation.

The pass is exclusively used with the new pass manager now, so remove
the legacy PM implementation.

22 months ago[mlir] Add `test-convergence` option to Canonicalizer tests
Matthias Springer [Wed, 4 Jan 2023 10:39:41 +0000 (11:39 +0100)]
[mlir] Add `test-convergence` option to Canonicalizer tests

This new option is set to `false` by default. It should  be set only in Canonicalizer tests to detect faulty canonicalization patterns. I.e., patterns that prevent the canonicalizer from converging. The canonicalizer should always convergence on such small unit tests that we have in `canonicalize.mlir`.

Two faulty canonicalization patterns were detected and fixed with this change.

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

22 months ago[NFC] let FunctionDecl::isReservedGlobalPlacementOperator return false when the funct...
Chuanqi Xu [Wed, 4 Jan 2023 10:57:33 +0000 (18:57 +0800)]
[NFC] let FunctionDecl::isReservedGlobalPlacementOperator return false when the function decl is not allocation functions

Currently `FunctionDecl::isReservedGlobalPlacementOperator` will crash
if the function is not an allocation/deallocation function, which is
surprising. Also, its semantics is not consistent with
isReplaceableGlobalAllocationFunction, which will return false if the
function is not an allocation/deallocation function.

This patch make FunctionDecl::isReservedGlobalPlacementOperator not
crash if the function is not an allocation/deallocation function, which
is consistent with isReplaceableGlobalAllocationFunction too.

22 months ago[llvm-exegesis] Allow building llvm_exegesis_tests on builtkite
Guillaume Chatelet [Wed, 4 Jan 2023 10:42:43 +0000 (10:42 +0000)]
[llvm-exegesis] Allow building llvm_exegesis_tests on builtkite

22 months ago[gn build] Port ba874483137d
LLVM GN Syncbot [Wed, 4 Jan 2023 10:40:23 +0000 (10:40 +0000)]
[gn build] Port ba874483137d

22 months ago[llvm-exegesis] Remove functional test from unit tests
Guillaume Chatelet [Tue, 3 Jan 2023 16:17:30 +0000 (16:17 +0000)]
[llvm-exegesis] Remove functional test from unit tests

As discussed offline, let's remove this one as it's hard to test on the build bots.

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

22 months ago[mlir][llvm] Support importing magic globals
Christian Ulmann [Wed, 4 Jan 2023 10:16:11 +0000 (11:16 +0100)]
[mlir][llvm] Support importing magic globals

This commit adds support for importing the magic globals "global_ctors"
and "global_dtors" from LLVM IR to the LLVM IR dialect. The import
fails when these globals have a non-null data pointer, as this can
currently not be represented in the corresponding MLIR operations.

Reviewed By: gysit

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

22 months ago[mlir][affine][NFC] Extract core functionality of `canonicalizeMinMaxOp`
Matthias Springer [Wed, 4 Jan 2023 09:56:43 +0000 (10:56 +0100)]
[mlir][affine][NFC] Extract core functionality of `canonicalizeMinMaxOp`

Move code from SCF to Affine: Add a new helper function `simplifyConstrainedMinMaxOp` to Affine/Analysis/Utils.h. `canonicalizeMinMaxOp` was originally designed for loop peeling, but it is not SCF-specific and can be used to simplify any affine.min/max ops.

Various functions in SCF/Transforms are simplified by dropping unnecessary parameters.

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

22 months ago[mlir] Allow overriding AbstractDenseDataFlowAnalysis::visitOperation
Tom Eccles [Fri, 23 Dec 2022 21:03:14 +0000 (21:03 +0000)]
[mlir] Allow overriding AbstractDenseDataFlowAnalysis::visitOperation

AbstractDenseDataFlowAnalysis::visitOperation controls how the dataflow
analysis proceeds around control flow. In particular, conservative
assumptions are made about call operations which can prevent some
analysis from succeeding.

The motivating case for this change is https://reviews.llvm.org/D140415,
for which it is correct and necessary for the lattice to be preserved
after call operations.

Some renaming was necessary to avoid confusion with
DenseDataFlowAnalysis::visitOperation.
AbstractDenseDataFlowAnalysis::visitRegionBranchOperation and
DenseDataFlowAnalysis::visitOperationImpl are also made protected
to allow implementation of AbstractDenseDataFlowAnalysis::visitOperation,
although I did not need these to be virtual.

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

22 months ago[InstCombine] add more tests into select-factorize; NFC
chenglin.bi [Wed, 4 Jan 2023 09:49:40 +0000 (17:49 +0800)]
[InstCombine] add more tests into select-factorize; NFC

22 months ago[clang-tidy] Don't emit misc-unused-using-decl warnings for header files.
Haojian Wu [Mon, 2 Jan 2023 11:04:49 +0000 (12:04 +0100)]
[clang-tidy] Don't emit misc-unused-using-decl warnings for header files.

Using decls in header files are special, usually as part of the
public API, the check should not emit warnings on these.

The check already detects unused using-decls which are in the current main
file, but if the main file happens to be a header file, we still
emit warnings, this patch suppresses that.

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

22 months ago[Instcombine] Regenerate tests for logical-select; NFC
chenglin.bi [Wed, 4 Jan 2023 08:31:42 +0000 (16:31 +0800)]
[Instcombine] Regenerate tests for logical-select; NFC

22 months ago[libcxx] Fix build with GLIBC
Vitaly Buka [Wed, 4 Jan 2023 03:30:43 +0000 (19:30 -0800)]
[libcxx] Fix build with GLIBC

Reviewed By: #libc, philnik

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

22 months agoMove from llvm::makeArrayRef to ArrayRef deduction guides
serge-sans-paille [Wed, 4 Jan 2023 07:14:42 +0000 (08:14 +0100)]
Move from llvm::makeArrayRef to ArrayRef deduction guides

Since we're now requiring C++17, Let's get rid of makeXXX functions like
makeArrayRef, and use deduction guides instead.

This is a first step: Introduce the deduction guide. Following steps
will be a) use them and b) deprecate makeArrayRef.

Apart from codebase modernization, there isn't much benefit from that
move, but I can still mention that it would slightly (probably
negligibly) decrease the number of symbols / debug info, as deduction
guides don't generate new code.

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

22 months ago[VP][RISCV] Add vp.ctlz/cttz and RISC-V support.
Yeting Kuo [Tue, 20 Dec 2022 05:24:01 +0000 (13:24 +0800)]
[VP][RISCV] Add vp.ctlz/cttz and RISC-V support.

The patch also adds expandVPCTLZ and expandVPCTTZ to expand vp.ctlz/cttz nodes
and the cost model of vp.ctlz/cttz.

Reviewed By: craig.topper

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

22 months ago[LoongArch] Add intrinsics for MOVFCSR2GR and MOVGR2FCSR instructions
Xiaodong Liu [Wed, 4 Jan 2023 06:10:43 +0000 (14:10 +0800)]
[LoongArch] Add intrinsics for MOVFCSR2GR and MOVGR2FCSR instructions

Instruction formats:
`movgr2fcsr fcsr, rj`
`movfcsr2gr rd, fcsr`
MOVGR2FCSR modifies the value of the software writable field
corresponding to the FCSR (floating-point control and status
register) `fcsr` according to the value of the lower 32 bits of
the GR (general purpose register) `rj`.
MOVFCSR2GR sign extends the 32-bit value of the FCSR `fcsr`
and writes it into the GR `rd`.

Add "i32 @llvm.loongarch.movfcsr2gr(i32)" intrinsic for MOVFCSR2GR
instruction. The argument is FCSR register number. The return value
is the value in the FCSR.
Add "void @llvm.loongarch.movgr2fcsr(i32, i32)" intrinsic for MOVGR2FCSR
instruction. The first argument is the FCSR number, the second argument
is the value in GR.

Reviewed By: SixWeining, xen0n

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

22 months ago[NFC] Autogenerate test/Transforms/InstCombine/fls.ll
Amaury Séchet [Wed, 4 Jan 2023 02:05:30 +0000 (02:05 +0000)]
[NFC] Autogenerate test/Transforms/InstCombine/fls.ll

22 months ago[BOLT][CMake] Add merge-fdata to bolt component
Amir Ayupov [Wed, 4 Jan 2023 01:39:55 +0000 (17:39 -0800)]
[BOLT][CMake] Add merge-fdata to bolt component

Build and install `merge-fdata` tool as part of `bolt` component:
```
$ ninja bolt
# builds llvm-bolt, perf2bolt and merge-fdata

$ cmake --install . --component bolt --prefix $HOME/test-install-bolt
-- Install configuration: "Release"
-- Install configuration: "Release"
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_instr.a
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_hugify.a
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_instr_osx.a
-- Installing: /home/aaupov/test-install-bolt/bin/llvm-bolt
-- Installing: /home/aaupov/test-install-bolt/bin/perf2bolt
-- Installing: /home/aaupov/test-install-bolt/bin/llvm-boltdiff
-- Installing: /home/aaupov/test-install-bolt/bin/merge-fdata
```

Fixes #57249.

Reviewed By: #bolt, rafauler

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

22 months ago[BOLT][Docs] Add Sphinx documentation
Amir Ayupov [Wed, 4 Jan 2023 01:38:52 +0000 (17:38 -0800)]
[BOLT][Docs] Add Sphinx documentation

Add stub Sphinx documentation, with configuration copy-pasted from lld and
index page converted from bolt/README.md.

Reviewed By: #bolt, rafauler

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

22 months ago[BOLT][NFC] Use llvm::reverse
Amir Ayupov [Wed, 4 Jan 2023 01:31:44 +0000 (17:31 -0800)]
[BOLT][NFC] Use llvm::reverse

Use llvm::reverse instead of `for (auto I = rbegin(), E = rend(); I != E; ++I)`

Reviewed By: #bolt, rafauler

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

22 months agoCodeGen: Clean up some tests with broken "strictfp" attribute
Matt Arsenault [Mon, 19 Dec 2022 16:23:27 +0000 (11:23 -0500)]
CodeGen: Clean up some tests with broken "strictfp" attribute

22 months ago[OpenMP][AMDGPU][NFC] Improve error message for errors
Johannes Doerfert [Wed, 28 Dec 2022 06:05:44 +0000 (22:05 -0800)]
[OpenMP][AMDGPU][NFC] Improve error message for errors

22 months ago[OpenMP][JIT][FIX] Create the default O0 pipeline for -O0
Johannes Doerfert [Wed, 28 Dec 2022 06:03:52 +0000 (22:03 -0800)]
[OpenMP][JIT][FIX] Create the default O0 pipeline for -O0

22 months ago[OpenMP] Unify "exec_mode" query code and default to SPMD
Johannes Doerfert [Wed, 28 Dec 2022 04:43:10 +0000 (20:43 -0800)]
[OpenMP] Unify "exec_mode" query code and default to SPMD

Defaulting to Generic mode doesn't make much sense as the kernel needs
to be prepared for it. SPMD mode is the "native" execution, e.g., for
"bare" kernels. It also is the execution method for constructors and
destructors (as we might otherwise throw an extra warp onto them).

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

22 months agoclang: Don't emit "frame-pointer"="none"
Matt Arsenault [Wed, 7 Dec 2022 18:20:39 +0000 (13:20 -0500)]
clang: Don't emit "frame-pointer"="none"

This is the default behavior and cuts down on attribute spam.
Probably should also do something to consolidate the option spellings;
printing and parsing it is repeated in at least 3 different places.

In the OpenMP tests, I had to manually delete some metadata check
lines update_cc_test_checks was inserting that included the local
build revision.

22 months ago[SelectionDAG][GlobalISel] Move even divisor optimization for division by constant...
Craig Topper [Wed, 4 Jan 2023 00:25:08 +0000 (16:25 -0800)]
[SelectionDAG][GlobalISel] Move even divisor optimization for division by constant into UnsignedDivideUsingMagic implementation. NFC

I've added a bool to UnsignedDivideUsingMagic so we can continue
testing it in the unit test with and without this optimization in
the unit test.

This is a step towards supporting "uncooperative" odd divisors.
See https://ridiculousfish.com/blog/posts/labor-of-division-episode-iii.html

Reviewed By: lebedev.ri

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

22 months ago[AMDGPU][NFC] DWARF extensions minor update
Tony Tye [Sat, 24 Dec 2022 01:04:30 +0000 (01:04 +0000)]
[AMDGPU][NFC] DWARF extensions minor update

1. Minor editorial corrections.
2. Allow different call frames to be associated with different target
   architectures in a single thread.

Reviewed By: scott.linder

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

22 months ago[ELF] Improve --obj-path tests
Fangrui Song [Tue, 3 Jan 2023 23:48:17 +0000 (15:48 -0800)]
[ELF] Improve --obj-path tests

Combine two ThinLTO --obj-path tests and improve checks.
Add a --obj-path test for regular LTO.

22 months ago[ELF] Simplify --thinlto-index-only tests
Fangrui Song [Tue, 3 Jan 2023 23:06:43 +0000 (15:06 -0800)]
[ELF] Simplify --thinlto-index-only tests

22 months ago[AMDGPU] Fix useDeprecatedPositionallyEncodedOperands errors.
James Y Knight [Fri, 16 Dec 2022 18:48:39 +0000 (13:48 -0500)]
[AMDGPU] Fix useDeprecatedPositionallyEncodedOperands errors.

This is a follow-on to https://reviews.llvm.org/D134073.

The errors in the R600 half were fixed previously in
https://reviews.llvm.org/D134078. Originally, I thought that the fixes
to the AMDGPU half would be tricky, but upon taking another look,
there were only a couple minor issues that needed fixing:

1. Previously, buffer load instructions (`BUFFER_LOAD_*_LDS_*`) were
populating the `vdata` field in the instruction from the `swz`
operand. This was incorrect, but harmless, as when the LDS option is
set, the instruction does not use the vdata field.

2. The `BUFFER_STORE_LDS_DWORD_gfx90a` instruction was populating
`acc` from the `swz` operand, because `acc` was set to `?`. (I believe
that the intent here was to leave the instruction bit as an "unknown
value", but you can't do that except by setting the bits on `Inst`
directly). Also harmless, for the same reason.

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

22 months ago[RISCV][InsertVSETVLI] Split out demanded property for zero/non-zero of VL
Philip Reames [Tue, 3 Jan 2023 22:34:28 +0000 (14:34 -0800)]
[RISCV][InsertVSETVLI] Split out demanded property for zero/non-zero of VL

The scalar move instructions (vmv.s.x, and fvmv.s.f) depend solely on whether the VL is 0 or non-zero. By tracking the fact we only demand the zeroness and not the whole VL value, we can allow changing VL over a scalar move. This helps to eliminate vsetvli toggles.

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

22 months ago[flang] Control flow graph issues
V Donaldson [Tue, 3 Jan 2023 18:31:30 +0000 (10:31 -0800)]
[flang] Control flow graph issues

Address several issues involving control flow graph generation and
structured code ops.

 - Fix a problem with constructs nested inside unstructured selection
   constructs. This is a general problem involving branches that are
   implied rather than explicit. It is addressed in the generic genFIR
   "wrapper" function that calls individual statement-specific genFIR calls.

 - The previous fix requires some compensating changes in IF and DO
   construct code lowering.

 - Streamline the code to generate explicit DO loop variable updates.

 - Fix a problem with the individual detailed genFIR calls made in the
   genFIR(SelectTypeConstruct) call.

 - Modify control flow graph generation to support the insertion of
   deallocation and finalization code when lowering most END <construct>
   statements.

22 months ago[BOLT] Check no-LBR samples in mayHaveProfileData
Amir Ayupov [Thu, 22 Dec 2022 00:31:26 +0000 (16:31 -0800)]
[BOLT] Check no-LBR samples in mayHaveProfileData

No-LBR mode wasn't tested and slipped when mayHaveProfileData was added for
Lite mode. This enables processing of profiles collected without LBR and
converted with `perf2bolt -nl` option.

Test Plan:
bin/llvm-lit -a tools/bolt/test/X86/nolbr.s
https://github.com/rafaelauler/bolt-tests/pull/20

Reviewed By: #bolt, rafauler

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

22 months ago[mlir][tosa] Add broadcasting case for tosa.resize to linalg implementation
Rob Suderman [Tue, 3 Jan 2023 22:14:43 +0000 (14:14 -0800)]
[mlir][tosa] Add broadcasting case for tosa.resize to linalg implementation

When lowering tosa.resize it is possible there is an unary input dimension.
Lowering to a new tosa.resize and explicit broadcast simplifies the
tosa.resize operation to avoid recomputing the identical broadcasted values.

This change reworks the broadcast optimization reuse the tosa.resize generic
implementation.

Reviewed By: jpienaar

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

22 months ago[ValueTracking] Improve ComputeNumSignBits to handle Trunc
Owen Anderson [Sat, 31 Dec 2022 06:12:20 +0000 (23:12 -0700)]
[ValueTracking] Improve ComputeNumSignBits to handle Trunc

Reviewed By: nikic

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

22 months ago[RISCV] Minor type fix [nfc]
Philip Reames [Tue, 3 Jan 2023 22:22:38 +0000 (14:22 -0800)]
[RISCV] Minor type fix [nfc]

22 months ago[RISCV][InsertVSETVLI] Rewrite scalar insert forward rule in terms of demanded fields
Philip Reames [Tue, 3 Jan 2023 22:17:33 +0000 (14:17 -0800)]
[RISCV][InsertVSETVLI] Rewrite scalar insert forward rule in terms of demanded fields

This is mostly geared at consolidating logic into one form to reduce code duplication, but also has the effect of being a slight generalization. Since these operations aren't masked, we can ignore the mask policy bit when deciding on compatibility. The previous code was overly strict in checking that both policy bits matched.

Note: There's a slight difference from the reviewed version.  The reviewed version was based on a local revision which included the isCompatible change to only check AVL if VL is used.  I apparently never landed that change, and while functional, the functional change isn't visible without this one.  I chose to role the extra change into this patch.

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

22 months ago[gn build] Port a455c91601a8
LLVM GN Syncbot [Tue, 3 Jan 2023 22:08:13 +0000 (22:08 +0000)]
[gn build] Port a455c91601a8

22 months agollvm-reduce: Add reduction for invokes
Matt Arsenault [Mon, 2 Jan 2023 02:29:20 +0000 (21:29 -0500)]
llvm-reduce: Add reduction for invokes

Main thing I was unsure about was to whether try to delete the now
dead landing blocks, or leave that for the unreachable block reduction.

Personality function is not reduced, but that should be a separate
reduction on the function.

Fixes #58815

22 months agollvm-reduce: Fix invalid reductions for exceptions, tokens and swifterror
Matt Arsenault [Sun, 1 Jan 2023 23:07:07 +0000 (18:07 -0500)]
llvm-reduce: Fix invalid reductions for exceptions, tokens and swifterror

Copies the same special cases that bugpoint uses. Technically the
token condition is stricter than what the verifier enforces.

Part 1 of #58815

22 months agollvm-reduce: Speculative fix for windows build bot
Matt Arsenault [Tue, 3 Jan 2023 21:59:32 +0000 (16:59 -0500)]
llvm-reduce: Speculative fix for windows build bot

I'm guessing grep wasn't matching the backtick in the message for some
reason.

22 months agollvm-reduce: Remove leftover comment
Matt Arsenault [Tue, 3 Jan 2023 21:44:37 +0000 (16:44 -0500)]
llvm-reduce: Remove leftover comment

22 months ago[clang][dataflow] Fix bug in optional-checker's handling of nullopt constructor.
Yitzhak Mandelbaum [Tue, 3 Jan 2023 20:50:01 +0000 (20:50 +0000)]
[clang][dataflow] Fix bug in optional-checker's handling of nullopt constructor.

Currently, the checker only recognizes the nullopt constructor when it is called
without sugar, resulting in a crash in the (rare) case where it has been wrapped
in sugar. This relaxes the constraint by checking the constructor decl directly
(which always contains the same, desugared form) rather than the construct
expression (where the spelling depends on the context).

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

22 months ago[RISCV][InsertVSETVLI] Add debug output capability to DemandedFields [nfc]
Philip Reames [Tue, 3 Jan 2023 21:56:23 +0000 (13:56 -0800)]
[RISCV][InsertVSETVLI] Add debug output capability to DemandedFields [nfc]

22 months ago[OpenMP] Solve potential VERSION script error w/ OMPT symbols
JP Lehr [Thu, 22 Dec 2022 23:28:19 +0000 (18:28 -0500)]
[OpenMP] Solve potential VERSION script error w/ OMPT symbols

The patch adds the symbols if OMPT_SUPPORT is not defined.
Github issue: https://github.com/llvm/llvm-project/issues/59660

Reviewed By: jhuber6

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

22 months agoOpenMPOpt: Fix null dereference on missing declaration cache
Matt Arsenault [Sun, 1 Jan 2023 15:34:56 +0000 (10:34 -0500)]
OpenMPOpt: Fix null dereference on missing declaration cache

Found by llvm-reduce fuzzing.

22 months agoOpenMPOpt: Fix using wrong address space for alloca
Matt Arsenault [Sun, 1 Jan 2023 19:27:15 +0000 (14:27 -0500)]
OpenMPOpt: Fix using wrong address space for alloca

Using the function's address space makes no sense. Copied from the
existing test, with more addrspace variation. Could just replace the
existing one with this version if it's redundant.

22 months ago[test] Fix #if
Fangrui Song [Tue, 3 Jan 2023 21:18:46 +0000 (13:18 -0800)]
[test] Fix #if

22 months ago[dfsan] Support Linux AArch64
Fangrui Song [Tue, 3 Jan 2023 21:17:39 +0000 (13:17 -0800)]
[dfsan] Support Linux AArch64

compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake:ALL_DFSAN_SUPPORTED_ARCH
allows AArch64 but currently the instrumentation will crash.

Port Linux AArch64 memory mappings from msan but use
SizeClassAllocator64 for a slightly more efficient allocator (used by
asan/lsan). Change dfsan/lit.cfg.py to allow Linux aarch64. All tests
should pass.

* dfsan/origin_invalid.c uses x86_64 assembly. Just make it x86_64 specific.
* dfsan/interceptors.c our mallinfo interceptor takes an argument
  instead of returning a struct. This does not work on AArch64 which
  uses different registers for the two function types. Disable AArch64
  as msan/Linux/mallinfo.cpp does.

Reviewed By: #sanitizers, vitalybuka

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

22 months ago[Attributor][FIX] Treat undef as zero offset in AAPointerInfoFloating
Johannes Doerfert [Thu, 22 Dec 2022 01:03:35 +0000 (17:03 -0800)]
[Attributor][FIX] Treat undef as zero offset in AAPointerInfoFloating

22 months agollvm-reduce: Refine missing argument behavior
Matt Arsenault [Fri, 9 Dec 2022 16:02:49 +0000 (11:02 -0500)]
llvm-reduce: Refine missing argument behavior

We required the test and input arguments for --print-delta-passes
which is unhelpful. Also, start printing the help output if no
arguments were supplied.

It looks like there's more sophisticated ways to accomplish this with
the opt library, but it was less work to manually emit these errors.

22 months agollvm-reduce: Don't remove strictfp
Matt Arsenault [Tue, 3 Jan 2023 13:00:03 +0000 (08:00 -0500)]
llvm-reduce: Don't remove strictfp

The verifier should fail if constrained intrinsics are used in
functions with strictfp, but that patch hasn't been pushed yet.

Ideally we would be able to analyze the function body to see if any
constrained intrinsics were used, but we seem to be missing a utility
function to check for any constrained ops.

22 months agollvm-reduce: Avoid invalid attribute reduction on optnone functions
Matt Arsenault [Mon, 2 Jan 2023 15:55:59 +0000 (10:55 -0500)]
llvm-reduce: Avoid invalid attribute reduction on optnone functions

We have this ridiculous restriction that optnone requires noinline,
so the pair needs to be removed if we want to remove noinline.

22 months agoRecommit "[M68k] Regenerate divide-by-constant.ll. NFC"
Craig Topper [Tue, 3 Jan 2023 20:24:14 +0000 (12:24 -0800)]
Recommit "[M68k] Regenerate divide-by-constant.ll. NFC"

Division algorithm was improved in D140750.

Fixes #59802.

22 months agoRevert "[M68k] Regenerate divide-by-constant.ll. NFC"
Craig Topper [Tue, 3 Jan 2023 20:23:53 +0000 (12:23 -0800)]
Revert "[M68k] Regenerate divide-by-constant.ll. NFC"

This reverts commit 0277f849c36ab6fe122b4fa1ae739e82869b5613.

I pasted the wrong bug number.

22 months ago[M68k] Regenerate divide-by-constant.ll. NFC
Craig Topper [Tue, 3 Jan 2023 20:17:46 +0000 (12:17 -0800)]
[M68k] Regenerate divide-by-constant.ll. NFC

Division algorithm was improved by D140750.

Fixes #59791.

22 months ago[OpenMP][2/2] Make device functions have hidden visibility
Johannes Doerfert [Wed, 28 Dec 2022 19:19:27 +0000 (11:19 -0800)]
[OpenMP][2/2]  Make device functions have hidden visibility

Similar to https://reviews.llvm.org/D136111, this time for class
methods.

D136111 summary:

In OpenMP target offloading an in other offloading languages, we
maintain a difference between device functions and kernel functions.
Kernel functions must be visible to the host and act as the entry point
to the target device. Device functions however cannot be called directly
by the host and must be called by a kernel function. Currently, we make
all definitions on the device protected by default. Because device
functions cannot be called or used by the host they should have hidden
visibility. This allows for the definitions to be better optimized via
LTO or other passes.

This patch marks every device class methods in the AST as having hidden
visibility. The kernel function is generated later at code-gen and we
set its visibility explicitly so it should not be affected. This
prevents the user from overriding the visibility, but since the user
can't do anything with these symbols anyway there is no point exporting
them right now.

22 months ago[Clang] Fix a crash when encountering an ill-formed delimited UCN.
Corentin Jabot [Mon, 12 Dec 2022 23:26:13 +0000 (00:26 +0100)]
[Clang] Fix a crash when encountering an ill-formed delimited UCN.

\u<DIGIT>{...} was incorrectly parsed as a valid UCN instead
of emitting a diagnostic, causing an assertion failure.

Reviewed By: tahonermann

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

22 months ago[mlir][tosa] Fix out-of-boundaries iteration for tosa-to-linalg
a.puschin [Tue, 3 Jan 2023 19:37:59 +0000 (11:37 -0800)]
[mlir][tosa] Fix out-of-boundaries iteration for tosa-to-linalg

When the number of elements of two shapes are not equal, a Reshape operation cannot be used to transfer one into another

Function findIntermediateShape(...) can cause out-of-boundaries operator[] call if the abovementioned condition strikes

The test-case I used now causes no error as its root-cause was an issue in Tosa dialect with padded Conv2D operations lowering which is already solved in commit 69c984b6

Reviewed By: rsuderman

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

22 months ago[SLP][AArch64] Incorrectly estimated intrinsic as a function call.
Dinar Temirbulatov [Tue, 3 Jan 2023 19:45:24 +0000 (19:45 +0000)]
[SLP][AArch64] Incorrectly estimated intrinsic as a function call.

We incorrectly assume intrinsic as a function call and it prevents us from
the opportunity to vectorize. On Aarch64 Cortex-A53 we think that
llvm.fmuladd.f64 is a function call which is wrong.

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

22 months ago[mlir][tosa] Fix tosa.transpose_conv2d decompositions for new version
Rob Suderman [Tue, 3 Jan 2023 19:21:25 +0000 (11:21 -0800)]
[mlir][tosa] Fix tosa.transpose_conv2d decompositions for new version

The decomposition was no longer correct for transpose_conv2d to conv2d
after the updated TOSA specification. Specifically the behavior for
padding was changed to refer to padding the tranpsose_conv2d instead
of referencing the conv applied to the inverse transform.

Test was validated using the TOSA conformance tests.

Reviewed By: NatashaKnk

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

22 months ago[Sanitizers] Fix procmap tests for apple arm64
Blue Gaston [Thu, 22 Dec 2022 19:06:59 +0000 (14:06 -0500)]
[Sanitizers] Fix procmap tests for apple arm64

As part of effort to enable sanitizer common unit tests on arm64 apple devices.
Add kModuleArchARM64 as expected Arch

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

22 months ago[llvm-profdata] Remove unnecessary file size check
William Huang [Wed, 28 Dec 2022 21:26:16 +0000 (21:26 +0000)]
[llvm-profdata] Remove unnecessary file size check

Unsure why profile reader checks profile size to be less than 4 GB. This breaks builds using a very large profile.
The limit is not seen anywhere else, so I am not sure why is it there in the first place.

Reviewed By: davidxl

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

22 months ago[mlir][tosa] Canonicalize tosa.transpose to tosa.reshape
Rob Suderman [Tue, 3 Jan 2023 19:06:04 +0000 (11:06 -0800)]
[mlir][tosa] Canonicalize tosa.transpose to tosa.reshape

Added tosa.transpose canonicalization for case where a tosa.transpose is
equivalent to a tosa.reshape. This occurs when the permutation does not
permutate non-unary dimensions.

Reviewed By: NatashaKnk

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

22 months ago[mlir][python] Expose fp8 types with pybind.
Qiao Zhang [Tue, 3 Jan 2023 19:06:30 +0000 (19:06 +0000)]
[mlir][python] Expose fp8 types with pybind.

Expose fp8 types with pybind.

Reviewed By: stellaraccident

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

22 months ago[WebAssembly][NFC] Add test case for {u,s}itofp on SIMD types
Luke Lau [Tue, 3 Jan 2023 19:06:14 +0000 (19:06 +0000)]
[WebAssembly][NFC] Add test case for {u,s}itofp on SIMD types

These test cases should be updated in a following patch once fixed
Part of https://github.com/llvm/llvm-project/issues/57182

22 months ago[clangd] show underlying type in type hint for `decltype(expr)`
v1nh1shungry [Tue, 3 Jan 2023 08:12:39 +0000 (03:12 -0500)]
[clangd] show underlying type in type hint for `decltype(expr)`

Reviewed By: nridge

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

22 months ago[mlir][shape] Fix overridden arguments and fit to 80 col (NFC)
Jacques Pienaar [Tue, 3 Jan 2023 18:55:07 +0000 (10:55 -0800)]
[mlir][shape] Fix overridden arguments and fit to 80 col (NFC)

Noticed one of the ops had its arguments overridden (two consecutive let
statements) so fixed that and then went through fitting to file to 80
col/making document paragraphs more consistent.

22 months ago[DX] Improve parse error messages
Chris Bieneman [Tue, 3 Jan 2023 18:32:58 +0000 (12:32 -0600)]
[DX] Improve parse error messages

This change refactors the parte parsing logic to operate on StringRefs
of the part data rather than starting from an offset and splicing down.
It also improves some of the error reporting around part layout.

Specifically, this code now reports a distinct error if there isn't
enough data in the buffer to store the part size and it reports an
error if the parts overlap.

Reviewed By: bob80905

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

22 months agoApply clang-tidy fixes for readability-identifier-naming in TestBackwardDataFlowAnaly...
Mehdi Amini [Thu, 22 Dec 2022 22:30:51 +0000 (22:30 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TestBackwardDataFlowAnalysis.cpp (NFC)

22 months agoApply clang-tidy fixes for llvm-qualified-auto in TestBackwardDataFlowAnalysis.cpp...
Mehdi Amini [Thu, 22 Dec 2022 22:30:16 +0000 (22:30 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in TestBackwardDataFlowAnalysis.cpp (NFC)

22 months ago[RISCV] Remove some non-Zfh instructions from rv64zfh-invalid.s. NFC
Craig Topper [Tue, 3 Jan 2023 18:46:26 +0000 (10:46 -0800)]
[RISCV] Remove some non-Zfh instructions from rv64zfh-invalid.s. NFC

22 months agoFix initializer name.
Doru Bercea [Tue, 3 Jan 2023 18:19:59 +0000 (12:19 -0600)]
Fix initializer name.

22 months ago[clang][dataflow] Treat unions as structs.
Dani Ferreira Franco Moura [Fri, 30 Dec 2022 14:09:40 +0000 (14:09 +0000)]
[clang][dataflow] Treat unions as structs.

This is a straightfoward way to handle unions in dataflow analysis. Without this change, nullability verification crashes on files that contain unions.

Reviewed By: gribozavr2, ymandel

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

22 months ago[YAML] Support serializing MutableArrayRef
Chris Bieneman [Tue, 20 Dec 2022 20:09:42 +0000 (14:09 -0600)]
[YAML] Support serializing MutableArrayRef

While the YAML format itself doesn't support fixed-sized arrays, some
of the data structures we encode in and out of YAML (specifically in
ObjectYAML) are actually fixed-sized arrays which we end up expressing
as resizable arrays.

Enabling the YAML tooling to support reading and writing from
fixed-sized arrays using MutableArrayRef can simplify some of the error
reporting and use logic for cases where the sizes of arrays are defined
by the target format.

Note: my SFINAE-foo isn't the best, so if there is a cleaner way to
implement the traits please advise.

Reviewed By: MaskRay

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

22 months agoRevert "[libomptarget][plugin-nextgen] fix for [TypePromotion] NewPM support."
Ron Lieberman [Tue, 3 Jan 2023 18:26:39 +0000 (12:26 -0600)]
Revert "[libomptarget][plugin-nextgen] fix for  [TypePromotion] NewPM support."

This reverts commit 135f6a1ee8b20bb392ebad2fa5aef78e3a30ddb4.

22 months ago[libc][NFC] Remove a constexpr marking to fix GCC build.
Siva Chandra Reddy [Tue, 3 Jan 2023 18:00:57 +0000 (18:00 +0000)]
[libc][NFC] Remove a constexpr marking to fix GCC build.

22 months ago[SLP]Fix crash on casting non-instruction extractelement.
Alexey Bataev [Tue, 3 Jan 2023 16:44:51 +0000 (08:44 -0800)]
[SLP]Fix crash on casting non-instruction extractelement.

Need to check if the extractelement operation is an extraction before
trying to move it around the buildblocks to avoid crash on cast.