platform/upstream/llvm.git
14 months ago[LV] Re-use existing broadcast value for live-ins.
Florian Hahn [Mon, 24 Jul 2023 10:50:46 +0000 (11:50 +0100)]
[LV] Re-use existing broadcast value for live-ins.

When requesting a vector value for a live-in, we can re-use the
broadcast of the live-in of part 0 for parts > 0.

14 months ago[InstCombine] Add test for infinite combine loop (NFC)
Nikita Popov [Mon, 24 Jul 2023 10:43:52 +0000 (12:43 +0200)]
[InstCombine] Add test for infinite combine loop (NFC)

Guard against the issue reported at
https://reviews.llvm.org/rG086ee99564af#1230303.

14 months ago[OPENMP][NFC] Editing OpenMP support page
Sandeep Kosuri [Mon, 24 Jul 2023 10:33:19 +0000 (05:33 -0500)]
[OPENMP][NFC] Editing OpenMP support page

14 months ago[clang][ASTDumper] Remove redundant dump of BlockDecl's ParmVarDecl
dingfei [Mon, 24 Jul 2023 10:38:42 +0000 (18:38 +0800)]
[clang][ASTDumper] Remove redundant dump of BlockDecl's ParmVarDecl

ParmVarDecl of BlockDecl is unnecessarily dumped twice.
Remove this duplication as other FunctionDecls.

Fixes https://github.com/llvm/llvm-project/issues/64005 (#2)

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

14 months ago[X86] combineConcatVectorOps - add concat(psadbw(x,y),psadbw(z,w)) -> psadbw(concat...
Simon Pilgrim [Mon, 24 Jul 2023 10:27:02 +0000 (11:27 +0100)]
[X86] combineConcatVectorOps - add concat(psadbw(x,y),psadbw(z,w)) -> psadbw(concat(x,z),concat(y,w)) handling

14 months ago[X86] Add reduce_add(ctpop(x)) 'count all bits in a vector' tests
Simon Pilgrim [Mon, 24 Jul 2023 10:13:56 +0000 (11:13 +0100)]
[X86] Add reduce_add(ctpop(x)) 'count all bits in a vector' tests

Also add some basic buildvector variants: build_vector(reduce_add(ctpop(x0)), reduce_add(ctpop(x1)), ...)

14 months ago[Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl
dingfei [Mon, 24 Jul 2023 10:31:01 +0000 (18:31 +0800)]
[Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl

BlockDecl should be invalidated because of its invalid ParmVarDecl.

Fixes #1 of https://github.com/llvm/llvm-project/issues/64005

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

14 months ago[mlir][gpu] Improving Cubin Serialization with ptxas Compiler
Guray Ozen [Mon, 24 Jul 2023 07:40:38 +0000 (09:40 +0200)]
[mlir][gpu] Improving Cubin Serialization with ptxas Compiler

This work improves how we compile the generated PTX code using the `ptxas` compiler. Currently, we rely on the driver's jit API to compile the PTX code. However, this approach has some limitations. It doesn't always produce the same binary output as the ptxas compiler, leading to potential inconsistencies in the generated Cubin files.

This work introduces a significant improvement by directly utilizing the ptxas compiler for PTX compilation. By doing so, we can achieve more consistent and reliable results in generating cubin files. Key Benefits:
- Using the Ptxas compiler directly ensures that the cubin files generated during the build process remain consistent with CUDA compilation using `nvcc` or `clang`.
- Another advantage of this work is that it allows developers to experiment with different ptxas compilers without the need to change the compiler. Performance among ptxas compiler versions are vary, therefore, one can easily try different ptxas compilers.

Reviewed By: nicolasvasilache

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

14 months ago[Sema][ObjC] Invalidate BlockDecl with invalid return expr & its parent BlockExpr
dingfei [Mon, 24 Jul 2023 10:21:14 +0000 (18:21 +0800)]
[Sema][ObjC] Invalidate BlockDecl with invalid return expr & its parent BlockExpr

Invalidate BlockDecl with implicit return type, in case any of the return value exprs is invalid.
Propagating the error info up by replacing BlockExpr with a RecoveryExpr.

The idea of this fix is given by @hokein(Haojian Wu)

Fix https://github.com/llvm/llvm-project/issues/63863.

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

14 months ago[test][TableGen] Reenable pattern-parsing.td with reverse_iteration
pvanhout [Mon, 24 Jul 2023 10:22:26 +0000 (12:22 +0200)]
[test][TableGen] Reenable pattern-parsing.td with reverse_iteration

D155821 should have fixed this.

14 months ago[Mips] Fix argument lowering for illegal vector types (PR63608)
Nikita Popov [Tue, 4 Jul 2023 11:06:20 +0000 (13:06 +0200)]
[Mips] Fix argument lowering for illegal vector types (PR63608)

The Mips MSA ABI requires that legal vector types are passed in
scalar registers in packed representation. E.g. a type like v16i8
would be passed as two i64 registers.

The implementation attempts to do the same for illegal vectors with
non-power-of-two element counts or non-power-of-two element types.
However, the SDAG argument lowering code doesn't support this, and
it is not easy to extend it to support this (we would have to deal
with situations like passing v7i18 as two i64 values).

This patch instead opts to restrict the special argument lowering
to only vectors with power-of-two elements and round element types.
Everything else is lowered naively, that is by passing each element
in promoted registers.

Fixes https://github.com/llvm/llvm-project/issues/63608.

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

14 months ago[CodeGen] Add machine verification to some tests
Jay Foad [Mon, 24 Jul 2023 09:57:37 +0000 (10:57 +0100)]
[CodeGen] Add machine verification to some tests

This is to catch errors in an upcoming patch.

14 months ago[NFC][ValueTracking]: Remove redundant computeKnownBits call for LoadInst in isKnownN...
Dhruv Chawla [Fri, 21 Jul 2023 14:17:02 +0000 (19:47 +0530)]
[NFC][ValueTracking]: Remove redundant computeKnownBits call for LoadInst in isKnownNonZero

For load instructions, computeKnownBits only checks the range metadata.
This check is already present in isKnownNonZero, so there is no need to
fall through to computeKnownBits.

This change gives a speed improvement of 0.12-0.18%:
https://llvm-compile-time-tracker.com/compare.php?from=3c6ed559e5274307995586c1499a2c8e4e0276a0&to=78b462d8c4ae079638b728c6446da5999c4ee9f8&stat=instructions:u

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

14 months ago[RISCV] Set Fast flag for unaligned memory accesses
Luke Lau [Mon, 24 Jul 2023 09:58:22 +0000 (10:58 +0100)]
[RISCV] Set Fast flag for unaligned memory accesses

The +unaligned-scalar-mem and +unaligned-vector-mem features were added in
D126085 and D149375 respectively to allow subtargets to indicate that
they supported misaligned loads/stores with "sufficient" performance.
This is separate from whether or not the target actually supports
misaligned accesses, which could be determined from Zicclsm.

This patch enables the Fast flag under the assumption that any subtarget
that declares support for +unaligned-*-mem will want to opt into
optimisations that take advantage of misaligned scalar accesses, such as
store merging.

Reviewed By: reames

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

14 months ago[NFC][analyzer] Enable implicit destructor for cfg-lifetime tests
Tomasz Kamiński [Mon, 24 Jul 2023 09:02:44 +0000 (11:02 +0200)]
[NFC][analyzer] Enable implicit destructor for cfg-lifetime tests

This enables `cfg-temporary-dtors`, `cfg-rich-constructors`, and
`cfg-implicit-dtors` (defaults for CSA) for CFGLifetime test,
making int consistent with `cfg-scopes` test.
Before the fixes implemented in https://reviews.llvm.org/D153273,
this flags were incompatible.

Reviewed By: xazax.hun

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

14 months ago[LoongArch] Implement isZextFree
WANG Rui [Mon, 24 Jul 2023 09:47:09 +0000 (17:47 +0800)]
[LoongArch] Implement isZextFree

This returns true for 8-bit and 16-bit loads, allowing ld.bu/ld.hu to be selected and avoiding unnecessary masks.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n

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

14 months ago[LoongArch] Add test case showing suboptimal codegen when loading unsigned char/short
WANG Rui [Mon, 24 Jul 2023 09:47:08 +0000 (17:47 +0800)]
[LoongArch] Add test case showing suboptimal codegen when loading unsigned char/short

Implementing isZextFree will allow ld.bu or ld.hu to be selected rather than ld.b+mask and ld.h+mask.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n

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

14 months ago[LoongArch] Implement isLegalICmpImmediate
WANG Rui [Mon, 24 Jul 2023 09:35:03 +0000 (17:35 +0800)]
[LoongArch] Implement isLegalICmpImmediate

This causes a trivial improvement in the legalicmpimm.ll test case.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n

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

14 months ago[LoongArch][NFC] Add tests for (X & -256) == 256 -> (X >> 8) == 1
WANG Rui [Mon, 24 Jul 2023 09:35:02 +0000 (17:35 +0800)]
[LoongArch][NFC] Add tests for (X & -256) == 256 -> (X >> 8) == 1

Add tests for (X & -256) == 256 -> (X >> 8) == 1.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: xen0n

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

14 months ago[clangd] InlayHints.cpp - fix MSVC "not all control paths return a value" warning...
Simon Pilgrim [Mon, 24 Jul 2023 09:37:03 +0000 (10:37 +0100)]
[clangd] InlayHints.cpp - fix MSVC "not all control paths return a value" warning. NFC.

14 months ago[include_cleaner] IncludeSpeller.cpp - fix MSVC "not all control paths return a value...
Simon Pilgrim [Mon, 24 Jul 2023 09:34:40 +0000 (10:34 +0100)]
[include_cleaner] IncludeSpeller.cpp - fix MSVC "not all control paths return a value" warning. NFC.

14 months ago[JITLink] ppc64.h - fix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Mon, 24 Jul 2023 09:33:28 +0000 (10:33 +0100)]
[JITLink] ppc64.h - fix MSVC "not all control paths return a value" warning. NFC.

14 months ago[clang][docs] Attempt to fix warning when building ReleaseNotes
Alex Bradbury [Mon, 24 Jul 2023 09:36:42 +0000 (10:36 +0100)]
[clang][docs] Attempt to fix warning when building ReleaseNotes

I believe my previous patch, 17a58b3ca7ec18585e9ea8ed8b39d72fe36fb6cb
introduced a warning here.

14 months ago[clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions...
Alex Bradbury [Mon, 24 Jul 2023 09:22:38 +0000 (10:22 +0100)]
[clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions in C++

As reported in <https://github.com/llvm/llvm-project/issues/58929>,
Clang's handling of empty structs in the case of small structs that may
be eligible to be passed using the hard FP calling convention doesn't
match g++. In general, C++ record fields are never empty unless
[[no_unique_address]] is used, but the RISC-V FP ABI overrides this.

After this patch, fields of structs that contain empty records will be
ignored, even in C++, when considering eligibility for the FP calling
convention ('flattening'). See also the relevant psABI issue
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/358> which
seeks to clarify the documentation.

Fixes https://github.com/llvm/llvm-project/issues/58929

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

14 months ago[LoongArch] Implement isLegalAddImmediate
WANG Rui [Mon, 24 Jul 2023 09:16:03 +0000 (17:16 +0800)]
[LoongArch] Implement isLegalAddImmediate

This brings a trivial improvement in the and-add-lsr.ll test case.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n

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

14 months ago[LoongArch] Add tests for (and (add x, c1), (lshr y, c2))
WANG Rui [Mon, 24 Jul 2023 09:03:32 +0000 (17:03 +0800)]
[LoongArch] Add tests for (and (add x, c1), (lshr y, c2))

Add tests for (and (add x, c1), (lshr y, c2)).

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: SixWeining, xen0n

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

14 months ago[analyzer] Fix crash in GenericTaintChecker when propagatig taint to AllocaRegion
Tomasz Kamiński [Mon, 24 Jul 2023 07:23:01 +0000 (09:23 +0200)]
[analyzer] Fix crash in GenericTaintChecker when propagatig taint to AllocaRegion

The `GenericTaintChecker` checker was crashing, when the taint
was propagated to `AllocaRegion` region in following code:
```
  int x;
  void* p = alloca(10);
  mempcy(p, &x, sizeof(x));
```
This crash was caused by the fact that determining type of
`AllocaRegion` returns a null `QualType`.

This patch makes `AllocaRegion` expose its type as `void`,
making them consistent with results of `malloc` or `new`
that produce `SymRegion` with `void*` symbol.

Reviewed By: steakhal, xazax.hun

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

14 months ago[DAGCombine] Canonicalize operands for visitANDLike
WANG Rui [Mon, 24 Jul 2023 05:24:07 +0000 (13:24 +0800)]
[DAGCombine] Canonicalize operands for visitANDLike

During the construction of SelectionDAG, there are no explicit canonicalization rules to adjust the order of operands for AND nodes.  This may prevent the optimization in DAGCombiner::visitANDLike from being triggered. This patch canonicalizes the operands before matches, which can be observed to improve optimization on the RISC-V target architecture.

Canonicalize:
```
and(x, add) -> and(add, x)
```

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: RKSimon

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

14 months ago[RISCV] Add tests for (and (add x, c1), (lshr y, c2))
WANG Rui [Mon, 24 Jul 2023 05:23:57 +0000 (13:23 +0800)]
[RISCV] Add tests for (and (add x, c1), (lshr y, c2))

Add tests for (and (add x, c1), (lshr y, c2)).

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: craig.topper

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

14 months ago[AArch64][SME] Use `fmov` instead of NEON `movi` for FP value.
Sander de Smalen [Mon, 24 Jul 2023 08:04:15 +0000 (08:04 +0000)]
[AArch64][SME] Use `fmov` instead of NEON `movi` for FP value.

NEON `movi` is not valid in Streaming SVE mode, so use an `fmov`
instruction instead for zero-initializing a FP value.

Reviewed By: hassnaa-arm

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

14 months agoRevert "[NFC] Add checks for self-assignment."
Michael Platings [Mon, 24 Jul 2023 08:35:19 +0000 (09:35 +0100)]
Revert "[NFC] Add checks for self-assignment."

This reverts commit 8ac137acefc01caf636db5f95eb0977c97def1ba.

The code does not compile.

14 months ago[TableGen][GlobalISel] Fix warning when casting to `void *`
pvanhout [Mon, 24 Jul 2023 08:28:39 +0000 (10:28 +0200)]
[TableGen][GlobalISel] Fix warning when casting to `void *`

14 months ago[NFC] Add checks for self-assignment.
Sindhu Chittireddy [Thu, 20 Jul 2023 03:15:47 +0000 (20:15 -0700)]
[NFC] Add checks for self-assignment.

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

14 months ago[clang][CodeGen] Introduce `-frecord-command-line` for MachO
Antonio Frighetto [Mon, 24 Jul 2023 07:23:31 +0000 (09:23 +0200)]
[clang][CodeGen] Introduce `-frecord-command-line` for MachO

Allow clang driver command-line recording when
targeting MachO object files as well.

Reviewed-by: sgraenitz
Differential Revision: https://reviews.llvm.org/D155716

14 months ago[TableGen][GlobalISel] Guarantee stable iteration order for stop-after-parse
pvanhout [Thu, 20 Jul 2023 12:24:12 +0000 (14:24 +0200)]
[TableGen][GlobalISel] Guarantee stable iteration order for stop-after-parse

Builds on top of 6de2735c2428 to fix remaining issues with iteration order in the MatchTable Combiner backend.
See D155789 as well.

Reviewed By: MaskRay

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

14 months ago[ConstraintElim] Add facts implied by MinMaxIntrinsic
Yingwei Zheng [Mon, 24 Jul 2023 07:03:34 +0000 (15:03 +0800)]
[ConstraintElim] Add facts implied by MinMaxIntrinsic

Fixes https://github.com/llvm/llvm-project/issues/63896 and https://github.com/rust-lang/rust/issues/113757.
This patch adds facts implied by llvm.smin/smax/umin/umax intrinsics.

Reviewed By: fhahn

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

14 months ago[clang-tidy] Add bugprone-empty-catch check
Piotr Zegar [Sun, 23 Jul 2023 19:22:42 +0000 (19:22 +0000)]
[clang-tidy] Add bugprone-empty-catch check

Detects and suggests addressing issues with empty catch statements.

Reviewed By: xgupta

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

14 months ago[analyzer][docs] Add CSA release notes
Balazs Benics [Mon, 24 Jul 2023 06:26:54 +0000 (08:26 +0200)]
[analyzer][docs] Add CSA release notes

We'll soon branch off, and start releasing clang-17.
Here is a patch, adjusting the release notes for what we achieved since
the last release.

I used this command to inspect the interesting commits:
```
git log --oneline llvmorg-16.0.0..llvm/main \
  clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | \
  grep -v NFC | grep -v -i revert
```

This filters in CSA directories and filters out NFC and revert commits.

Given that in the release-notes, we usually don't put links to commits,
I'll remove them from this patch as well. I just put them there to make
it easier to review for you.

I tried to group the changes into meaningful chunks, and dropped some of
the uninteresting commits.
I've also dropped the commits that were backported to clang-16.

Check out how it looks, and propose changes like usual.

---

FYI the `ninja docs-clang-html` produces the html docs, including the `ReleaseNotes`.
And the produced artifact will be at `build/tools/clang/docs/html/ReleaseNotes.html`.

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

14 months ago[RISCV] Add Zicond RUN lines to xaluo.ll. NFC
Craig Topper [Mon, 24 Jul 2023 05:42:36 +0000 (22:42 -0700)]
[RISCV] Add Zicond RUN lines to xaluo.ll. NFC

A couple of these tests show a need for computeKnownBits support
for Zicond.

14 months ago[JITLink][PowerPC] Correct handling of R_PPC64_REL24_NOTOC
Kai Luo [Mon, 24 Jul 2023 06:00:20 +0000 (14:00 +0800)]
[JITLink][PowerPC] Correct handling of R_PPC64_REL24_NOTOC

According to the ELFv2 ABI

> This relocation type is used to specify a function call where the TOC pointer is not initialized. It is similar to R_PPC64_REL24 in that it specifies a symbol to be resolved. If the symbol resolves to a function that requires a TOC pointer (as determined by st_other bits) then a link editor must arrange for the call to be via the global entry point of the called function. Any stub code must not rely on a valid TOC base address in r2.

This patch fixes handling of `R_PPC64_REL24_NOTOC` by using the same stub code sequence as lld.

Reviewed By: lhames

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

14 months ago[ConstraintElim] Add test cases from PR63896. NFC.
Yingwei Zheng [Mon, 24 Jul 2023 05:57:00 +0000 (13:57 +0800)]
[ConstraintElim] Add test cases from PR63896. NFC.

This patch adds some test cases from https://github.com/llvm/llvm-project/issues/63896.

Reviewed By: fhahn

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

14 months ago[RISCV] Remove unused check prefixes for tests. NFC
Jim Lin [Mon, 24 Jul 2023 04:29:07 +0000 (12:29 +0800)]
[RISCV] Remove unused check prefixes for tests. NFC

Also remove the warning line for that these prefixes are unused.

Reviewed By: craig.topper

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

14 months ago[RISCV] Support register allocation for GHC when f/d is not specified in the architecture
eopXD [Fri, 21 Jul 2023 03:59:34 +0000 (20:59 -0700)]
[RISCV] Support register allocation for GHC when f/d is not specified in the architecture

This patch supports register allocation for floating-point types when
`zfinx` and `zdinx` is specified in the architecture for the GHC
calling convention.

Reviewed By: craig.topper

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

14 months ago[LoongArch] Add definition for LVZ/LBT instructions
wanglei [Mon, 24 Jul 2023 03:40:29 +0000 (11:40 +0800)]
[LoongArch] Add definition for LVZ/LBT instructions

This patch defines the `LVZ` and `LBT` extension instructions, which
provide enough definitions for llvm-mc and llvm-objdump to correctly
handle these instructions.

It also defines the `SCR` (Scratchpad Register) register class, which
are used by the `LBT` extension instructions.

Reviewed By: SixWeining, xen0n

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

14 months ago[mlir] Enable converting properties during C create
Jacques Pienaar [Mon, 24 Jul 2023 04:40:12 +0000 (21:40 -0700)]
[mlir] Enable converting properties during C create

This enables querying properties passed as attributes during
construction time. In particular needed for type inference where the
Operation has not been created at this point. This allows Python
construction of operations whose type inference depends on properties.

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

14 months ago[XCOFF] Write source language ID and CPU version ID into C_FILE symbol.
esmeyi [Mon, 24 Jul 2023 04:35:24 +0000 (00:35 -0400)]
[XCOFF] Write source language ID and CPU version ID into C_FILE symbol.

Summary: The source language ID and CPU version ID are required by debuggers on AIX. AIX's system assembler determines the source language ID based on the source file's name suffix, and the behavior in this patch is consistent with it.

Reviewed By: shchenz

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

14 months ago[mlir][py] Reuse more of CAPI build time inference.
Jacques Pienaar [Mon, 24 Jul 2023 04:26:52 +0000 (21:26 -0700)]
[mlir][py] Reuse more of CAPI build time inference.

This reduces code generated for type inference and instead reuses
facilities CAPI side that performed same role.

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

14 months ago[AMDGPU] Add llvm.amdgcn.wave.reduce.umin/umax Intrinsic.
Pravin Jagtap [Mon, 24 Jul 2023 04:05:42 +0000 (00:05 -0400)]
[AMDGPU] Add llvm.amdgcn.wave.reduce.umin/umax Intrinsic.

When input to intrinsic is uniform value, reduced value is
same as input whereas if input value is divergent we need
to iterate over all active lanes of WaveFront to perform
the reduction.

The control flow for a `loop` has been set up, which
iterates over `only` active lanes to perform reduction.

Introduced WAVE_REDUCE_UMIN_PSEUDO_U32 and
WAVE_REDUCE_UMAX_PSEUDO_U32 Pseudos which
are lowered Post-ISel (in `EmitInstrWithCustomInserter `).

Reviewed By: arsenm, #amdgpu

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

14 months ago[RISCV] Adjust definition order in RISCVInstrInfoZvk.td to be the same with other...
Jim Lin [Mon, 24 Jul 2023 02:33:40 +0000 (10:33 +0800)]
[RISCV] Adjust definition order in RISCVInstrInfoZvk.td to be the same with other td file

The definition order is operand/SDNode, instruction class template,
instruction, pseudo instruciton, codegen patterns, ....

14 months ago[AArch64][GlobalISel] Remove unused variable 'v2s8' in AArch64LegalizerInfo.cpp ...
Jie Fu [Mon, 24 Jul 2023 03:33:02 +0000 (11:33 +0800)]
[AArch64][GlobalISel] Remove unused variable 'v2s8' in AArch64LegalizerInfo.cpp (NFC)

/Users/jiefu/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:53:13: error: unused variable 'v2s8' [-Werror,-Wunused-variable]
  const LLT v2s8 = LLT::fixed_vector(2, 8);
            ^
1 error generated.

14 months agoRevert commits for kernel environment
Shilei Tian [Mon, 24 Jul 2023 03:30:45 +0000 (23:30 -0400)]
Revert commits for kernel environment

This reverts commits for kernel environments as they causes issues in AMD BB.

14 months ago[AArch64][GlobalISel] Legalize <2 x s8> and <4 x s8> for G_BUILD_VECTOR
Zhongyunde [Mon, 24 Jul 2023 03:25:07 +0000 (11:25 +0800)]
[AArch64][GlobalISel] Legalize <2 x s8> and <4 x s8> for G_BUILD_VECTOR

Refer to commit ccffc27, the remaining types <2 x s8> and <4 x s8> should
also be promoted to <2 x s32> and <4 x s16>.

Fixes https://github.com/llvm/llvm-project/issues/58274

Reviewed By: aemerson, tschuett, paquette, dmgreen
Differential Revision: https://reviews.llvm.org/D153394

14 months ago[CMake] Disable GCC -Wnonnull
Farid Zakaria [Mon, 24 Jul 2023 03:19:42 +0000 (20:19 -0700)]
[CMake] Disable GCC -Wnonnull

I noticed during the build that GCC would emit a ton of nonnull
warnings.

Example:
```
/usr/local/google/home/fmzakari/code/github.com/llvm/llvm-project/clang/include/clang/AST/ExternalASTSource.h:378:54: warning: ‘this’ pointer is null [-Wnonnull]
  378 |       Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1));
      |                                        ~~~~~~~~~~~~~~^~~~~~~~~~
```

Reviewed By: MaskRay, rsmith

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

14 months ago[sanitizer] use the right type for sizeof for interceptor hook
Wu, Yingcong [Mon, 24 Jul 2023 03:12:39 +0000 (20:12 -0700)]
[sanitizer] use the right type for sizeof for interceptor hook

`PRE_READ` is called with a pointer and the size of the object
the pointer points to. But there is one line of code not calling
`PRE_READ` correctly(likely missing a dereference).
This patch fixes the problem.

Reviewed By: MaskRay

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

14 months ago[RISCV] Add codegen for Zfbfmin instructions
Jun Sha (Joshua) [Mon, 24 Jul 2023 02:37:58 +0000 (10:37 +0800)]
[RISCV] Add codegen for Zfbfmin instructions

The implementation in https://reviews.llvm.org/D151313 is done for the circumstance without Zfbfmin. This patch adds codegen support for the 6 instructions provided in Zfbfmin extension.

Reviewed By: craig.topper

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

14 months ago[X86] Remove SHA512 from Graniterapids in backend.
Freddy Ye [Mon, 24 Jul 2023 01:30:00 +0000 (01:30 +0000)]
[X86] Remove SHA512 from Graniterapids in backend.

Frontend didn't and this feature.

14 months agoReapply: [MemCpyOpt] implement single BB stack-move optimization which unify the...
khei4 [Sat, 22 Jul 2023 05:25:32 +0000 (14:25 +0900)]
Reapply: [MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas""

This reverts commit c9d419c1df72b0160e374f8d0b9f30508b3b98a7.
Differential Revision: https://reviews.llvm.org/D153453

14 months ago[LLVM] Remove the module dump introduced mistakenly
Shilei Tian [Sun, 23 Jul 2023 22:55:41 +0000 (18:55 -0400)]
[LLVM] Remove the module dump introduced mistakenly

14 months ago[MLIR][OpenMP] Remove local_unnamed_addr from check line
Shilei Tian [Sun, 23 Jul 2023 22:51:02 +0000 (18:51 -0400)]
[MLIR][OpenMP] Remove local_unnamed_addr from check line

14 months ago[MLIR][OpenMP] Fix wrong check lines in mlir/test/Target/LLVMIR/omptarget-region...
Shilei Tian [Sun, 23 Jul 2023 22:45:44 +0000 (18:45 -0400)]
[MLIR][OpenMP] Fix wrong check lines in mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir

14 months ago[OpenMP] Introduce kernel environment
Shilei Tian [Sun, 23 Jul 2023 22:35:38 +0000 (18:35 -0400)]
[OpenMP] Introduce kernel environment

This patch introduces per kernel environment. Previously, flags such as execution mode are set through global variables with name like `__kernel_name_exec_mode`. They are accessible on the host by reading the corresponding global variable, but not from the device. Besides, some assumptions, such as no nested parallelism, are not per kernel basis, preventing us applying per kernel optimization in the device runtime.

This is a combination and refinement of patch series D116908, D116909, and D116910.

Depend on D155886.

Reviewed By: jdoerfert

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

14 months ago[X86] Fix a typo of Broadwell after D74918. NFC
Fangrui Song [Sun, 23 Jul 2023 22:15:05 +0000 (15:15 -0700)]
[X86] Fix a typo of Broadwell after D74918. NFC

Close #64053

14 months agoReleaseNotes: add lld/ELF notes
Fangrui Song [Sun, 23 Jul 2023 22:06:33 +0000 (15:06 -0700)]
ReleaseNotes: add lld/ELF notes

14 months ago[OpenMP][Plugin] Update the global address calculation
Shilei Tian [Sun, 23 Jul 2023 21:40:52 +0000 (17:40 -0400)]
[OpenMP][Plugin] Update the global address calculation

Current global address caculation doesn't work for AMDGPU in some cases (https://reviews.llvm.org/D142569#4506212).
The root cause is the `sh_addr` is not substracted when caculating the address.

Reviewed By: jdoerfert

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

14 months ago[mlir][docs][nfc] Fix markdown link
Andrzej Warzynski [Sun, 23 Jul 2023 21:05:47 +0000 (23:05 +0200)]
[mlir][docs][nfc] Fix markdown link

14 months ago[clang-tidy] performance-* checks: Also allow allow member expressions to be used...
Shivam Gupta [Sun, 23 Jul 2023 18:11:39 +0000 (23:41 +0530)]
[clang-tidy] performance-* checks: Also allow allow member expressions to be used in a const manner.

Until now when determining all the const uses of a VarDecl we only considered
how the variable itself was used. This change extends checking for const usages
of the type's members as well.

This increases the number of true positives for various performance checks that
share the same const usage analysis.

Path by Felix Berger

Reviewed By: njames93, PiotrZSL

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

14 months ago[AArch64] Lower fcvtl2 (fpext) via tablegen patterns.
David Green [Sun, 23 Jul 2023 18:17:11 +0000 (19:17 +0100)]
[AArch64] Lower fcvtl2 (fpext) via tablegen patterns.

This patch does two things. First it removes the tryHighFPExt DAG2DAG method
used to select fcvtl2 instructions, using tablegen patterns through
SelectExtractHigh instead. This essentially undoes D71515, in a way that should
hopefully avoid any regressions. The second is that a GI equivalent of
SelectExtractHigh is added in selectExtractHigh, from G_UNMERGE_VALUES. The
end result is that GlobalISel (and some constrained fpext) can now make use of
the fcvtl2 instructions, saving an extra dup/ext.

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

14 months agoRevert "[clang-tidy] Add bugprone-empty-catch check"
Piotr Zegar [Sun, 23 Jul 2023 18:12:47 +0000 (18:12 +0000)]
Revert "[clang-tidy] Add bugprone-empty-catch check"

CI failed on "ubuntu-fast" due to disabled exceptions.

This reverts commit f256fee5343033bf8a31aee06a80f3e982b76f82.

14 months ago[gn build] Port f256fee53430
LLVM GN Syncbot [Sun, 23 Jul 2023 18:04:35 +0000 (18:04 +0000)]
[gn build] Port f256fee53430

14 months ago[clang-tidy] Add bugprone-empty-catch check
Piotr Zegar [Sun, 23 Jul 2023 18:02:03 +0000 (18:02 +0000)]
[clang-tidy] Add bugprone-empty-catch check

Detects and suggests addressing issues with empty catch statements.

Reviewed By: xgupta

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

14 months ago[X86] IsEligibleForTailCallOptimization - use for-range loops where possible. NFCI.
Simon Pilgrim [Sun, 23 Jul 2023 17:41:12 +0000 (18:41 +0100)]
[X86] IsEligibleForTailCallOptimization - use for-range loops where possible. NFCI.

14 months ago[InstCombine] Fix bug in canonicalization of Pow2 Tests (From: D152673)
Noah Goldstein [Sun, 23 Jul 2023 16:26:20 +0000 (11:26 -0500)]
[InstCombine] Fix bug in canonicalization of Pow2 Tests (From: D152673)

D152673 Incorrectly didn't account for operand position in the `icmp`,
i.e it treated `icmp uge x, y` the same as `icmp uge y, x` which is
incorrect:
https://reviews.llvm.org/rG142f7448e770f25b774b058a7eab1f107c4daad9

The fix takes operand position into account. The new tests
exhaustively cover all operand positions for `ule`, `uge`, `ult`,
`ugt` (the set of predicates) and all transform verify with the new
commit.

Reviewed By: nikic

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

14 months ago[AArch64][GISel] Additional FPExt vector lowering
David Green [Sun, 23 Jul 2023 15:58:13 +0000 (16:58 +0100)]
[AArch64][GISel] Additional FPExt vector lowering

Similar to D155311, this adds lowering for more vector cases for FPExt

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

14 months ago[BOLT] Fix jump table issue for split functions
Maksim Panchenko [Sat, 22 Jul 2023 02:14:26 +0000 (19:14 -0700)]
[BOLT] Fix jump table issue for split functions

A jump table in a split function may contain an entry matching a start
address of another fragment of the function. While converting addresses
to labels, we used to ignore such entries resulting in underpopulated
jump table. Change that, so we always create one label per address.

Reviewed By: Amir

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

14 months ago[LSR] Use poison instead of undef as placeholder [NFC]
Nuno Lopes [Sun, 23 Jul 2023 14:57:21 +0000 (15:57 +0100)]
[LSR] Use poison instead of undef as placeholder [NFC]
This value is patcher afterwards, and only used temporarily during dbg info construction

14 months ago[X86] getIntImmCostInst - avoid repeating getNumOperands() in for-loop (style). NFC.
Simon Pilgrim [Sun, 23 Jul 2023 14:49:22 +0000 (15:49 +0100)]
[X86] getIntImmCostInst - avoid repeating getNumOperands() in for-loop (style). NFC.

14 months ago[X86] getIntImmCostInst - silence static analyzer overflow warning. NFCI.
Simon Pilgrim [Sun, 23 Jul 2023 14:45:10 +0000 (15:45 +0100)]
[X86] getIntImmCostInst - silence static analyzer overflow warning. NFCI.

Use the divideCeil uint64_t return type directly

14 months ago[Scalarizer] Fold -1 mask in shufflevector to poison instead of undef
Nuno Lopes [Sun, 23 Jul 2023 14:02:23 +0000 (15:02 +0100)]
[Scalarizer] Fold -1 mask in shufflevector to poison instead of undef
Per latest LangRef

14 months ago[clang-tidy][clang-tidy-diff.py] Change shebang from python to python3
Shivam Gupta [Sun, 23 Jul 2023 13:53:32 +0000 (19:23 +0530)]
[clang-tidy][clang-tidy-diff.py] Change shebang from python to python3

14 months ago[X86][FP16] Split v32f16 shuffle when feature BWI is off
Phoebe Wang [Sun, 23 Jul 2023 12:29:54 +0000 (20:29 +0800)]
[X86][FP16] Split v32f16 shuffle when feature BWI is off

Found this problem when investigating #63017

Reviewed By: RKSimon

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

14 months ago[clang-tidy][NFC] Fix links to fuchsia codding standard
Piotr Zegar [Sun, 23 Jul 2023 12:29:18 +0000 (12:29 +0000)]
[clang-tidy][NFC] Fix links to fuchsia codding standard

Correct links to fuchsia codding standard in
documentation for fuchsia-* checks.

Partially fixes: #62334

14 months ago[X86] lowerRegToMasks - rename masklen -> MaskLenVT. NFC.
Simon Pilgrim [Sun, 23 Jul 2023 11:21:39 +0000 (12:21 +0100)]
[X86] lowerRegToMasks - rename masklen -> MaskLenVT. NFC.

Fixes style warning

14 months ago[InstCombine] Regenerate test checks (NFC)
Antonio Frighetto [Sun, 23 Jul 2023 11:25:14 +0000 (11:25 +0000)]
[InstCombine] Regenerate test checks (NFC)

14 months ago[InstCombine] Do not assume scalar types in `select`/`zext`
Antonio Frighetto [Sun, 23 Jul 2023 10:52:47 +0000 (10:52 +0000)]
[InstCombine] Do not assume scalar types in `select`/`zext`

Do not assume scalar types when folding binops of `select`
operations and `zext`/`sext` of their condition.

Reported-by: Benjins, dyung
Proofs: https://alive2.llvm.org/ce/z/GmDLns

14 months ago[X86] X86ISelLowering.cpp - fix some mixed case SDLoc variable names. NFC.
Simon Pilgrim [Sun, 23 Jul 2023 10:53:35 +0000 (11:53 +0100)]
[X86] X86ISelLowering.cpp - fix some mixed case SDLoc variable names. NFC.

Consistently use SDLoc DL

14 months agoAdd missing 'namespace X86' closing comment to appease static analyser. NFC.
Simon Pilgrim [Sun, 23 Jul 2023 10:11:57 +0000 (11:11 +0100)]
Add missing 'namespace X86' closing comment to appease static analyser. NFC.

14 months ago[X86] LowerFunnelShift - manually expand funnel shifts by splat constant patterns.
Simon Pilgrim [Sat, 22 Jul 2023 21:12:49 +0000 (22:12 +0100)]
[X86] LowerFunnelShift - manually expand funnel shifts by splat constant patterns.

Followup to af32e51a43fb4343f - where the undef funnel shift amounts (during widening from v2i32 -> v4i32) were being constant folded to 0 when the shift amounts are created during expansion, losing the splat'd shift amounts.

14 months ago[X86] Add basic test coverage for funnels shifts of sub-128-bit vector types
Simon Pilgrim [Sat, 22 Jul 2023 17:47:11 +0000 (18:47 +0100)]
[X86] Add basic test coverage for funnels shifts of sub-128-bit vector types

14 months ago[Clang][NFC] Restore changelog entry incorrectly removed by 02bb2beeef
Corentin Jabot [Sun, 23 Jul 2023 09:09:43 +0000 (11:09 +0200)]
[Clang][NFC] Restore changelog entry incorrectly removed by 02bb2beeef

14 months ago[clang] Fix diagnostics for defaulted, implicitly deleted 'operator=='.
Amirreza Ashouri [Sun, 23 Jul 2023 08:40:48 +0000 (10:40 +0200)]
[clang] Fix diagnostics for defaulted, implicitly deleted 'operator=='.

https://godbolt.org/z/cMKE3o1aG

According to the issue https://github.com/llvm/llvm-project/issues/63960 , compiler falsely complains that no viable `operator<=>` was found while we are actually looking for a `operator==`.
This bug has been fixed through adding a check of the `OverloadedOperatorKind` type's object, `OO`, to see if it is `OO_EqualEqual` in addition to `OO_ExclaimEqual`.

Reviewed By: #clang-language-wg, cor3ntin

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

14 months ago[clang][Interp][NFC] Fix two small code style problems
Timm Bäder [Sat, 22 Jul 2023 11:29:54 +0000 (13:29 +0200)]
[clang][Interp][NFC] Fix two small code style problems

14 months ago[clang][Interp][NFC] Fix InterpStack::dump() for empty stacks
Timm Bäder [Sat, 22 Jul 2023 11:08:55 +0000 (13:08 +0200)]
[clang][Interp][NFC] Fix InterpStack::dump() for empty stacks

14 months ago[clang][Interp][NFC] Clean up getOrCreateDummy()
Timm Bäder [Sun, 23 Jul 2023 05:21:37 +0000 (07:21 +0200)]
[clang][Interp][NFC] Clean up getOrCreateDummy()

14 months ago[clang][Interp][NFC] Use existing local variable
Timm Bäder [Sun, 23 Jul 2023 05:20:19 +0000 (07:20 +0200)]
[clang][Interp][NFC] Use existing local variable

Instead of calling getSubExpr() again.

14 months ago[PowerPC/SPE] powerpcspe load and store instruction has
Kishan Parmar [Sun, 23 Jul 2023 07:54:35 +0000 (13:24 +0530)]
[PowerPC/SPE] powerpcspe load and store instruction has
8-bit offset instead of 16-bit unlike other load/store instructions.
so if stack grows any further than 8-bit, create one emergency slot
for spilling.

14 months ago[unittest] Fix HighlighterTest.cpp after D151683
Fangrui Song [Sun, 23 Jul 2023 01:30:02 +0000 (18:30 -0700)]
[unittest] Fix HighlighterTest.cpp after D151683

:: is now parsed as tok::coloncolon even in C mode.

14 months ago[PowerPC] Reorder setMaxAtomicSizeInBitsSupported(). NFC
Brad Smith [Sun, 23 Jul 2023 00:01:27 +0000 (20:01 -0400)]
[PowerPC] Reorder setMaxAtomicSizeInBitsSupported(). NFC

Reorder setMaxAtomicSizeInBitsSupported() in numerical and more logical order.

Reviewed By: MaskRay

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

14 months ago[Support] Change StringMap hash function from xxHash64 to xxh3_64bits
Fangrui Song [Sat, 22 Jul 2023 23:50:47 +0000 (16:50 -0700)]
[Support] Change StringMap hash function from xxHash64 to xxh3_64bits

Similar to D142862.

xxh3 is significantly faster than xxh64. Switch to xxh3, as we did for
for lld and llvm-dwarfutil to increase performance (D154813 D155675).
While I think StringMap is not a bottleneck for most applications, it
seems good to eliminate the slower xxh64.
In addition, according to Erik Desjardins, an artificial benchmark of
Rust with very large constant strings improves by ~3% locally.

I have fixed all found issues (~20) separately, but one is remaining:

* ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s has a
  failure due to StringMap iteration order. It now passes
  with LLVM_ENABLE_REVERSE_ITERATION=on while failing with
  LLVM_ENABLE_REVERSE_ITERATION=off.

Reviewed By: erikdesjardins

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

14 months ago[gdb-remote] Sort entries in QEnvironment*
Fangrui Song [Sat, 22 Jul 2023 23:45:32 +0000 (16:45 -0700)]
[gdb-remote] Sort entries in QEnvironment*

Similar to ae316ac66ffff430997e342772fc4629c1acece0 for
QEMU_(UN)SET_ENV.
The iteration order of StringMap is not guaranteed to be deterministic.
Sort the entries to give deterministic packets for the tests added by
D108018.

14 months ago[test] Fix compiler_version.f90 for -DLLVM_APPEND_VC_REV=OFF builds after D152572
Fangrui Song [Sat, 22 Jul 2023 23:06:29 +0000 (16:06 -0700)]
[test] Fix compiler_version.f90 for -DLLVM_APPEND_VC_REV=OFF builds after D152572

Checking the patch version is too strict. Just check major and minor
versions as in clang/test/Driver/immediate-options.c.