platform/upstream/llvm.git
12 months ago[RISCV] Adjust memcpy lowering test coverage w/V
Philip Reames [Mon, 24 Jul 2023 19:30:25 +0000 (12:30 -0700)]
[RISCV] Adjust memcpy lowering test coverage w/V

This is fixing a mistake in 4f4f49137.

12 months agoRevert "Update ODS variadic segments "magic" attributes to use native Properties"
Mehdi Amini [Mon, 24 Jul 2023 19:27:01 +0000 (12:27 -0700)]
Revert "Update ODS variadic segments "magic" attributes to use native Properties"

This reverts commit 20b93abca6516bbb23689c3777536fea04e46e14.

One python test is broken, WIP.

12 months ago[Driver][test] Remove XRay/lit.local.cfg
Fangrui Song [Mon, 24 Jul 2023 19:27:14 +0000 (12:27 -0700)]
[Driver][test] Remove XRay/lit.local.cfg

This was needed when XRay/* tests relied on the default target triple.
Now that we set a default target triple for every test we can remove
this customization.

This cleanup is intrigued by D156090.

12 months ago[RISCV] Add memcpy lowering test coverage with and without V
Philip Reames [Mon, 24 Jul 2023 19:18:04 +0000 (12:18 -0700)]
[RISCV] Add memcpy lowering test coverage with and without V

12 months ago[gn build] Port 0882c70df222
LLVM GN Syncbot [Mon, 24 Jul 2023 19:02:32 +0000 (19:02 +0000)]
[gn build] Port 0882c70df222

12 months ago[TextAPI] Introduce SymbolSet
Cyndy Ishida [Mon, 24 Jul 2023 18:55:01 +0000 (11:55 -0700)]
[TextAPI] Introduce SymbolSet

SymbolSet is a structure that acts as a simple container class for exported symbols that
belong to a library interface. It allows tapi to decouple the globals
from the other library attributes. It's uniqued by symbol name and `kind`, which all contain their assigned target triples.

Reviewed By: zixuw

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

12 months ago[llvm-objdump] [NFC] Add missing REQUIRES to arm64ec.yaml.
Jacek Caban [Mon, 24 Jul 2023 18:55:49 +0000 (20:55 +0200)]
[llvm-objdump] [NFC] Add missing REQUIRES to arm64ec.yaml.

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

12 months agoRecognize ARM64EC binaries in COFFObjectFile::getMachine.
Jacek Caban [Wed, 12 Apr 2023 19:18:37 +0000 (21:18 +0200)]
Recognize ARM64EC binaries in COFFObjectFile::getMachine.

ARM64EC/ARM64X binaries use ARM64 or AMD64 machine types, but provide
additional CHPE metadata that may be used to distinguish them from
pure ARM64/AMD64 binaries.

Reviewed By: jhenderson, MaskRay, mstorsjo
Differential Revision: https://reviews.llvm.org/D149091

12 months ago[yaml2obj] Add support for load config section data.
Jacek Caban [Fri, 28 Apr 2023 12:35:38 +0000 (14:35 +0200)]
[yaml2obj] Add support for load config section data.

Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D149440

12 months agoUpdate ODS variadic segments "magic" attributes to use native Properties
Mehdi Amini [Fri, 21 Jul 2023 05:51:35 +0000 (22:51 -0700)]
Update ODS variadic segments "magic" attributes to use native Properties

The operand_segment_sizes and result_segment_sizes Attributes are now inlined
in the operation as native propertie. We continue to support building an
Attribute on the fly for `getAttr("operand_segment_sizes")` and setting the
property from an attribute with `setAttr("operand_segment_sizes", attr)`.

A new bytecode version is introduced to support backward compatibility and
backdeployments.

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

12 months ago[NFC][libc++] Update comments to reflect changes in ASan
Advenam Tacet [Mon, 24 Jul 2023 17:57:22 +0000 (19:57 +0200)]
[NFC][libc++] Update comments to reflect changes in ASan

ASan capabilities were extended, but some comments were not updated and describe old behavior. This commit updates outdated comments, which I found.
Mentioned changes are:
- All allocators in containers (`std::vector` and `std::deque`; D146815 D136765) are supported, but it's possible to turn off annotations for a specific allocator (D145628).
- Buffers don't have to be aligned (D132522).

Reviewed By: #libc, philnik

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

12 months ago[OpenMP] Add a few release notes
Joseph Huber [Mon, 24 Jul 2023 18:25:53 +0000 (13:25 -0500)]
[OpenMP] Add a few release notes

Summary:
Release notes

12 months agoAdd Adrian and David as owners for debug info
Reid Kleckner [Mon, 24 Jul 2023 17:17:35 +0000 (10:17 -0700)]
Add Adrian and David as owners for debug info

Reviewed By: aprantl, probinson

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

12 months ago[flang] Add PowerPC vec_abs, vec_nmadd, vec_msub and vec_sel intrinsics
Kelvin Li [Tue, 11 Jul 2023 03:13:34 +0000 (23:13 -0400)]
[flang] Add PowerPC vec_abs, vec_nmadd, vec_msub and vec_sel intrinsics

Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>
Differential Revision: https://reviews.llvm.org/D154985

12 months ago[LAA] Make MaxSafeDepDistBytes private in LoopAccessAnalysis. NFC
Michael Maitland [Sat, 22 Jul 2023 21:02:23 +0000 (14:02 -0700)]
[LAA] Make MaxSafeDepDistBytes private in LoopAccessAnalysis. NFC

Any users of LoopAccessAnalysis should use MaxSafeVectorWidthInBits.

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

12 months ago[DWARF] Make sure file entry for artificial functions has an MD5 checksum
Paul Robinson [Fri, 21 Jul 2023 20:34:41 +0000 (13:34 -0700)]
[DWARF] Make sure file entry for artificial functions has an MD5 checksum

The DIFile cache was keyed on a string pointer instead of string content,
which was causing misses and resulted in an entry without a checksum.
In DWARF v5 if any checksum is missing, we can't write any to the output
file, so this had consequences.

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

Differential revision: https://reviews.llvm.org/D155991

12 months ago[Headers][doc] Add misc non-AVX2 intrinsic descriptions
Paul Robinson [Thu, 20 Jul 2023 15:56:39 +0000 (08:56 -0700)]
[Headers][doc] Add misc non-AVX2 intrinsic descriptions

Adds descriptions for adxintrin.h, bmi2intrin.h, clflushoptintrin.h,
clzerointrin.h, rdseedintrin.h, and xsavecintrin.h.

Differential revision: https://reviews.llvm.org/D155859

12 months ago[lldb][NFCI] Add some missing SB class forward declarations
Alex Langford [Tue, 18 Jul 2023 22:36:15 +0000 (15:36 -0700)]
[lldb][NFCI] Add some missing SB class forward declarations

I noticed these were missing.

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

12 months ago[Clang] Reject programs declaring namespace std to be inline
Po-yao Chang [Mon, 24 Jul 2023 17:30:23 +0000 (01:30 +0800)]
[Clang] Reject programs declaring namespace std to be inline

Fixes #64041

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

12 months agoRevert "[mlir][gpu] Fallback to JIT compilation" "[mlir][gpu] Increase default SM...
Mehdi Amini [Mon, 24 Jul 2023 17:20:02 +0000 (10:20 -0700)]
Revert "[mlir][gpu] Fallback to JIT compilation" "[mlir][gpu] Increase default SM version from 35 to 50" and  "[mlir][gpu] Improving Cubin Serialization with ptxas Compiler"

This reverts commit 2e0e00ed841951e358a85a871647be9b3a622f51
and reverts commit a6eb40692c795a9cc29266779ceca2e304141114
and reverts commit 585cbe3f639783bf0307b47504acbd205f135310.

15 tests are broken on the mlir-nvidia buildbot:

'cuModuleLoadData(&module, data)' failed with 'CUDA_ERROR_INVALID_SOURCE'
'cuModuleGetFunction(&function, module, name)' failed with 'CUDA_ERROR_INVALID_HANDLE'
'cuLaunchKernel(function, gridX, gridY, gridZ, blockX, blockY, blockZ, smem, stream, params, extra)' failed with 'CUDA_ERROR_INVALID_HANDLE'
'cuModuleUnload(module)' failed with 'CUDA_ERROR_INVALID_HANDLE'

12 months ago[bazel][mlir] Port 0f446adf678212b6daedebc5eb1bd2849b1efad1
Benjamin Kramer [Mon, 24 Jul 2023 17:21:18 +0000 (19:21 +0200)]
[bazel][mlir] Port 0f446adf678212b6daedebc5eb1bd2849b1efad1

12 months ago[bazel] Turn off layering_check for //llvm/unittests:target_aarch64_tests
Benjamin Kramer [Mon, 24 Jul 2023 17:15:26 +0000 (19:15 +0200)]
[bazel] Turn off layering_check for //llvm/unittests:target_aarch64_tests

llvm/unittests/Target/AArch64/AArch64SVESchedPseudoTest.cpp:38:10: error: module @llvm-project//llvm/unittests:target_aarch64_tests does not depend on a module exporting 'AArch64GenInstrInfo.inc'

Test was added in 57329ca94630742ce3b0f6b239b263d757a9eb4a

12 months ago[flang][hlfir] Fixed KindMapping for HLFIR intrinsics lowering.
Slava Zakharin [Mon, 24 Jul 2023 16:22:38 +0000 (09:22 -0700)]
[flang][hlfir] Fixed KindMapping for HLFIR intrinsics lowering.

hlfir.count lowering was using incorrect default integer kind
by ignoring the kind specified in the ModuleOp.

Reviewed By: tblah

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

12 months ago[flang][hlfir] Inherit constant length for the result of hlfir.transpose.
Slava Zakharin [Mon, 24 Jul 2023 16:22:13 +0000 (09:22 -0700)]
[flang][hlfir] Inherit constant length for the result of hlfir.transpose.

Character length may be unknown for the type of Fortran::evaluate::FunctionRef
expression, but we can try to propagate it from the argument of
TRANSPOSE if it is known constant. Alternatively, we could relax
hlfir.transpose verification (i.e. allow character types mismatch
for the argument and the result).

Depends on D155912

Reviewed By: tblah

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

12 months ago[Driver][test] Clean up some xray tests
Fangrui Song [Mon, 24 Jul 2023 17:05:34 +0000 (10:05 -0700)]
[Driver][test] Clean up some xray tests

Add explicit --target= so that the tests run on all targets, not some
that support XRay, similar to commit e1051414a16e970c2e36c2ab7dfe2b17353c4751.
For option testing, we often use a placeholder architecture (e.g., x86_64).

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

12 months ago[clang-tidy][NFC] Improve release notes
Piotr Zegar [Mon, 24 Jul 2023 16:53:11 +0000 (16:53 +0000)]
[clang-tidy][NFC] Improve release notes

Fix formating, merge few entrys.

12 months ago[gn build] Port 7c36b416b6b1
LLVM GN Syncbot [Mon, 24 Jul 2023 16:49:12 +0000 (16:49 +0000)]
[gn build] Port 7c36b416b6b1

12 months ago[SLP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D154891
Fangrui Song [Mon, 24 Jul 2023 16:47:49 +0000 (09:47 -0700)]
[SLP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D154891

12 months ago[mlir] Convert `ub.poison` to `llvm.poison`
Ivan Butygin [Fri, 21 Jul 2023 12:16:41 +0000 (14:16 +0200)]
[mlir] Convert `ub.poison` to `llvm.poison`

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

12 months ago[clang] Fix specialization of non-templated member classes of class templates
Podchishchaeva, Mariya [Mon, 24 Jul 2023 16:28:09 +0000 (09:28 -0700)]
[clang] Fix specialization of non-templated member classes of class templates

Explicit specialization doesn't increase depth of template parameters,
so need to be careful when gathering template parameters for
instantiation.
For the case:
```
template<typename T>
struct X {
  struct impl;
};

template <>
struct X<int>::impl {
    template<int ct>
    int f() { return ct; };
};
```
instantiation of `f` used to crash because type template parameter
`int` of explicit specialization was taken into account, but non-type
template parameter `ct` had zero depth and index so wrong parameter
ended up inside of a wrong handler.

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

Reviewed By: aaron.ballman, shafik

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

12 months ago[flang][openacc] Keep original array size in reduction init region with slice
Valentin Clement [Mon, 24 Jul 2023 16:34:00 +0000 (09:34 -0700)]
[flang][openacc] Keep original array size in reduction init region with slice

Keep the original array size when materializing the private copy.

Depends on D155882

Reviewed By: razvanlupusoru

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

12 months ago[flang][openacc] Update materialization recipe for private copy in reduction init...
Valentin Clement [Mon, 24 Jul 2023 16:33:09 +0000 (09:33 -0700)]
[flang][openacc] Update materialization recipe for private copy in reduction init region

Update the code generated in the init region to materialize the private
copy.

Reviewed By: razvanlupusoru

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

12 months ago[SLP]Check scalars before trying scheduling.
Alexey Bataev [Mon, 10 Jul 2023 20:49:26 +0000 (13:49 -0700)]
[SLP]Check scalars before trying scheduling.

Need to check the scalars if they can be vectorized before trying to
schedule them. It may save compile time and improve vectorization on
large functions/basic blocks.

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

12 months ago[clang-format] Insert namespace comments with leading spaces
Owen Pan [Sun, 23 Jul 2023 20:45:22 +0000 (13:45 -0700)]
[clang-format] Insert namespace comments with leading spaces

Insert missing namespace comments with SpacesBeforeTrailingComments
leading spaces.

Fixes #64051.

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

12 months agoRegisterCoaleser: Fix empty subrange verifier error
Matt Arsenault [Tue, 27 Jun 2023 14:16:23 +0000 (10:16 -0400)]
RegisterCoaleser: Fix empty subrange verifier error

In this example an implicit def had live-out undef subrange
defs. After coalescing with the def from a previous block, the
undef-defed lanes are no longer live out of the block in the new
interval. An empty subrange was tenatively created for these lanes,
but it must be deleted.

12 months agoRegisterCoalescer: Fix verifier error on redef of subregister for live out implicit_defs
Matt Arsenault [Wed, 21 Jun 2023 12:36:22 +0000 (08:36 -0400)]
RegisterCoalescer: Fix verifier error on redef of subregister for live out implicit_defs

A live out implicit_def wasn't deleted, but the subranges weren't
correctly updated. The main range was correct but the def
corresponding to the initial main range def instruction was missing
from the lanes redefined in another block.

The written lanes are not quite the same as the valid lanes in the
case of an implicit_def.

Fixes verifier error in blender. There is an additional verifier in
some of the testcase variants where an empty subrange remains.

12 months ago[Clang] Fix consteval propagation for aggregates and defaulted constructors
Corentin Jabot [Mon, 10 Jul 2023 06:54:15 +0000 (08:54 +0200)]
[Clang] Fix consteval propagation for aggregates and defaulted constructors

This patch does a few things:

* Fix aggregate initialization.
  When an aggregate has an initializer that is immediate-escalating,
  the context in which it is used automatically becomes an immediate function.
  The wording does that by rpretending an aggregate initialization is itself
  an invocation which is not really how clang works, so my previous attempt
  was... wrong.

* Fix initialization of defaulted constructors with immediate escalating
  default member initializers.
  The wording was silent about that case and I did not handled it fully
  https://cplusplus.github.io/CWG/issues/2760.html

* Fix diagnostics
  In some cases clang would produce additional and unhelpful
  diagnostics by listing the invalid references to consteval
  function that appear in immediate escalating functions

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

Reviewed By: aaron.ballman, #clang-language-wg, Fznamznon

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

12 months ago[llvm-jitlink] Don't return immediately in -noexec mode, just skip execution.
Lang Hames [Mon, 24 Jul 2023 00:56:49 +0000 (17:56 -0700)]
[llvm-jitlink] Don't return immediately in -noexec mode, just skip execution.

Skipping execution rather than bailing out early means that:
1. Explicit teardown of JIT'd code will happen at the same point (via the call
   to ExecutionSession::endSession) regardless of whether -noexec is used.
2. The -show-times option will work with -noexec.

12 months ago[llvm-jitlink] Move statistics code into a separate file.
Lang Hames [Thu, 20 Jul 2023 16:32:38 +0000 (09:32 -0700)]
[llvm-jitlink] Move statistics code into a separate file.

Further isolates statistics gathering / reporting code from the rest of llvm-jitlink.

12 months ago[RISCV] Remove combineCmpOp and associated code. NFCI
Craig Topper [Mon, 24 Jul 2023 16:05:43 +0000 (09:05 -0700)]
[RISCV] Remove combineCmpOp and associated code. NFCI

This code was originally added in D134277. This transform is now
available in target independent DAG combine after D153502.

Reviewed By: asb

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

12 months agoRevert "[clang][RISCV] Fix ABI handling of empty structs with hard FP calling convent...
Alex Bradbury [Mon, 24 Jul 2023 15:58:21 +0000 (16:58 +0100)]
Revert "[clang][RISCV] Fix ABI handling of empty structs with hard FP calling conventions in C++"

This reverts commit 17a58b3ca7ec18585e9ea8ed8b39d72fe36fb6cb and the
minor documentation fix 569e99a471f618b7fdf045d5e96f21d3e3a7f898.

An issue was reported in https://reviews.llvm.org/D142327#inline-1510301
so reverting until it can be investigated and fixed.

12 months agoAMDGPU: Implement combineRepeatedFPDivisors
Matt Arsenault [Sun, 2 Jul 2023 00:28:48 +0000 (20:28 -0400)]
AMDGPU: Implement combineRepeatedFPDivisors

12 months ago[NVPTX] Expand select_cc on bfloat16 type
Yuanqiang Liu [Mon, 24 Jul 2023 15:00:34 +0000 (17:00 +0200)]
[NVPTX] Expand select_cc on bfloat16 type

Expand select_cc on bfloat16 and bfloat16v2 type.

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

12 months ago[ConstantFolding] Avoid use of ConstantExpr::getOr() (NFC)
Nikita Popov [Mon, 24 Jul 2023 14:57:57 +0000 (16:57 +0200)]
[ConstantFolding] Avoid use of ConstantExpr::getOr() (NFC)

Constant folding cannot fail here, because we're really working
on plain integers. It might be better to make all of this work
on APInts instead of Constants.

12 months ago[AArch64] Ignore instructions not supported by CPU in AArch64SVESchedPseudoTest
Sander de Smalen [Mon, 24 Jul 2023 14:47:19 +0000 (14:47 +0000)]
[AArch64] Ignore instructions not supported by CPU in AArch64SVESchedPseudoTest

When adding new Pseudos for instructions that are not supported
by the CPU for which the scheduler model is being tested, the test fails
if these pseudos are not covered by the regex's in the scheduling model.

Rather than failing, this test should check that the CPU supports the
original instruction modelled by the pseudo. If not, the pseudo is
not relevant to the scheduling model being tested.

Reviewed By: dmgreen

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

12 months ago[InstCombine] Avoid uses of ConstantExpr::getOr()
Nikita Popov [Mon, 24 Jul 2023 14:45:32 +0000 (16:45 +0200)]
[InstCombine] Avoid uses of ConstantExpr::getOr()

Replace these with IRBuilder uses, as we don't (from a type
perspective) care about Constant results.

Switch the predicate to m_ImmConstant() instead of isa<Constant>
to guarantee that these do get folded away and our assumptions
about simplifications hold true.

12 months ago[RISCV] Add CZERO_EQZ/CZERO_NEZ to ComputeNumSignBitsForTargetNode.
Craig Topper [Mon, 24 Jul 2023 14:43:01 +0000 (07:43 -0700)]
[RISCV] Add CZERO_EQZ/CZERO_NEZ to ComputeNumSignBitsForTargetNode.

Reviewed By: wangpc

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

12 months ago[RISCV] Add test case for D156082 to condops.ll
Craig Topper [Mon, 24 Jul 2023 14:42:45 +0000 (07:42 -0700)]
[RISCV] Add test case for D156082 to condops.ll

This test is copied from select-cc.ll. It wasn't worth adding
Zicond RUN lines to that file.

Reviewed By: asb, wangpc

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

12 months ago[RISCV] Add CZERO_EQZ/CZERO_NEZ to computeKnownBitsForTargetNode.
Craig Topper [Mon, 24 Jul 2023 14:18:22 +0000 (07:18 -0700)]
[RISCV] Add CZERO_EQZ/CZERO_NEZ to computeKnownBitsForTargetNode.

Reviewed By: wangpc

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

12 months ago[Clang][AArch64] svldr_vnum/svstr_vnum should use cntsb iso vscale for the offset
Sander de Smalen [Mon, 24 Jul 2023 13:57:12 +0000 (13:57 +0000)]
[Clang][AArch64] svldr_vnum/svstr_vnum should use cntsb iso vscale for the offset

The specification for LDR/STR says that:

  The ZA array vector is selected by the sum of the vector select register
  and immediate offset, modulo the number of bytes in a Streaming SVE
  vector. [..] This instruction does not require the PE to be in Streaming
  SVE mode

When the instruction is used outside of streaming mode, 'vscale' will result
in the wrong value being used for the offset because LLVM's code-generator
will emit the non-streaming 'RDVL/ADDVL' instead of the 'RDSVL/ADDSVL'
instructions which are used to get the Streaming-SVE vector length.

Reviewed By: bryanpkc

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

12 months ago[MLIR][Linalg] Move AggregatedOpInterface in linalg namespace (NFC)
Lorenzo Chelini [Mon, 24 Jul 2023 09:01:36 +0000 (11:01 +0200)]
[MLIR][Linalg] Move AggregatedOpInterface in linalg namespace (NFC)

For now, the interface is specific to linalg only.

Reviewed By: qcolombet

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

12 months ago[AMDGPU] Fix llvm.amdgcn.wave.reduce.umax/umin MIR tests
Pravin Jagtap [Mon, 24 Jul 2023 14:19:36 +0000 (10:19 -0400)]
[AMDGPU] Fix llvm.amdgcn.wave.reduce.umax/umin MIR tests

Fixes the MIR tests reported in https://lab.llvm.org/buildbot/#/builders/16/builds/51955

Reviewed By: arsenm

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

12 months ago[X86] fpclamptosat.ll - add nounwind to get rid of cfi noise
Simon Pilgrim [Mon, 24 Jul 2023 14:11:15 +0000 (15:11 +0100)]
[X86] fpclamptosat.ll - add nounwind to get rid of cfi noise

Helps cleanup D150372

12 months ago[mlir][Transform] Allow printing inside matchers
Quinn Dawkins [Sun, 23 Jul 2023 21:02:14 +0000 (17:02 -0400)]
[mlir][Transform] Allow printing inside matchers

Enables printf style debugging of matchers through `transform.print`
within the body of a matcher.

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

12 months ago[AArch64] Add vselect(fmin/fmax) SVE patterns
David Green [Mon, 24 Jul 2023 13:55:38 +0000 (14:55 +0100)]
[AArch64] Add vselect(fmin/fmax) SVE patterns

For both minnum/maxnum and minimum/maximum, this adds tablegen patterns for
vselect(fmin/fmax), creating a predicate fminnm/fmaxnm/fmin/fmax nodes.

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

12 months ago[AArch64] Extra testing for vselect(fmin/max patterns. NFC
David Green [Fri, 21 Jul 2023 07:50:27 +0000 (08:50 +0100)]
[AArch64] Extra testing for vselect(fmin/max patterns. NFC

See D155872.

12 months ago[X86] combineConcatVectorOps - add concat(ctpop)/concat(ctlz)/concat(cttz) handling
Simon Pilgrim [Mon, 24 Jul 2023 13:50:10 +0000 (14:50 +0100)]
[X86] combineConcatVectorOps - add concat(ctpop)/concat(ctlz)/concat(cttz) handling

12 months ago[X86] Add some basic concat(ctpop)/concat(ctlz)/concat(cttz) widening tests
Simon Pilgrim [Mon, 24 Jul 2023 13:41:26 +0000 (14:41 +0100)]
[X86] Add some basic concat(ctpop)/concat(ctlz)/concat(cttz) widening tests

12 months ago[Remark] Overload `<<` for Remark, RemarkType and RemarkLocation.
Zain Jaffal [Mon, 24 Jul 2023 13:46:48 +0000 (14:46 +0100)]
[Remark] Overload `<<` for Remark, RemarkType and RemarkLocation.

Represent different remark concepts as strings by overloading the `<<`
operator.

Reviewed By: thegameg

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

12 months ago[clang][dataflow] Fix build failure due to -Wunused-variable in DataflowEnvironment...
Jie Fu [Mon, 24 Jul 2023 13:35:52 +0000 (21:35 +0800)]
[clang][dataflow] Fix build failure due to -Wunused-variable in DataflowEnvironment.cpp (NFC)

/data/llvm-project/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:125:11: error: unused variable 'StructVal2' [-Werror,-Wunused-variable]
    auto *StructVal2 = cast<StructValue>(&Val2);
          ^
1 error generated.

12 months ago[OpenMP] Make the nested parallelism global hidden
Joseph Huber [Mon, 24 Jul 2023 13:28:16 +0000 (08:28 -0500)]
[OpenMP] Make the nested parallelism global hidden

Summary:
These will probably be removed with the kernel environment, but they
should have hidden visibliity so they can be optimized out.

12 months ago[GlobalISel] Fix GIM_CheckIsSameOperandIgnoreCopies
pvanhout [Mon, 24 Jul 2023 13:18:06 +0000 (15:18 +0200)]
[GlobalISel] Fix GIM_CheckIsSameOperandIgnoreCopies

If the MI had more than one def it incorrectly returrned true.

Reviewed By: arsenm

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

12 months ago[lldb] Remove Windows XFAIL for TestDollarInVariable.py
David Spickett [Mon, 24 Jul 2023 13:23:30 +0000 (13:23 +0000)]
[lldb] Remove Windows XFAIL for TestDollarInVariable.py

Since 5d66f9fd8e97c05a5dba317d3ad2566e61ead1ff this test has
been upassing on Linaro's Windows on Arm lldb bot:
https://lab.llvm.org/buildbot/#/builders/219/builds/4320

I can't explain exactly how that happened, but I do see a bunch
of QEnvironment packets going by in that test. It is very likely
that the order would have been different on Windows.

Indeed, when it was xfailed back in df9051e7cfda5519f4584cda22e9ef2006517e94
the reason was not known either.

12 months ago[clang][dataflow] Remove checks that test for consistency between `StructValue` and...
Martin Braenne [Thu, 20 Jul 2023 11:12:58 +0000 (11:12 +0000)]
[clang][dataflow] Remove checks that test for consistency between `StructValue` and `AggregateStorageLocation`.

Now that the redundancy between these two classes has been eliminated, these
checks aren't needed any more.

Reviewed By: ymandel, xazax.hun

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

12 months ago[clang][dataflow] Eliminate duplication between `AggregateStorageLocation` and `Struc...
Martin Braenne [Thu, 20 Jul 2023 11:12:39 +0000 (11:12 +0000)]
[clang][dataflow] Eliminate duplication between `AggregateStorageLocation` and `StructValue`.

After this change, `StructValue` is just a wrapper for an `AggregateStorageLocation`. For the wider context, see https://discourse.llvm.org/t/70086.

## How to review

- Start by looking at the comments added / changed in Value.h, StorageLocation.h,
  and DataflowEnvironment.h. This will give you a good overview of the semantic
  changes.

- Look at the corresponding .cpp files that implement the semantic changes.

- Transfer.cpp, TypeErasedDataflowAnalysis.cpp, and RecordOps.cpp show how the
  core of the framework is affected by the semantic changes.

- UncheckedOptionalAccessModel.cpp shows how this complex model is affected by
  the changes.

- Many of the changes in the rest of the patch are mechanical in nature.

Reviewed By: ymandel, xazax.hun

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

12 months ago[LAA] Add assertion to check both Start and End are invariant (NFC).
Florian Hahn [Mon, 24 Jul 2023 13:17:17 +0000 (15:17 +0200)]
[LAA] Add assertion to check both Start and End are invariant (NFC).

Add extra assert to check invariant of RuntimePointerChecking::insert to
guard against subtle changes when extending the scope of LAA.

12 months ago[llvm][nvptx] Add sm_90a
Guray Ozen [Thu, 20 Jul 2023 15:28:51 +0000 (17:28 +0200)]
[llvm][nvptx] Add sm_90a

This works adds `sm_90a` as nvptx target. `sm_90a` is required to generate  wgmma and setmaxnreg instructions.

Here is information about "a" prefix in PTX document:
Target architectures with suffix “a”, such as sm_90a, include architecture-accelerated features that are supported on the specified architecture only, hence such targets do not follow the onion layer model. Therefore, PTX code generated for such targets cannot be run on later generation devices. Architecture-accelerated features can only be used with targets that support these features.

Reviewed By: tra

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

12 months ago[mlir][gpu] Increase default SM version from 35 to 50
Guray Ozen [Mon, 24 Jul 2023 10:51:22 +0000 (12:51 +0200)]
[mlir][gpu] Increase default SM version from 35 to 50

Current SM version is 35 but it is deprecated long time ago. D155563 introduced ptxas compilations, using sm_35 causes failures in builtbot. This change increase default SM version to 50.

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

12 months ago[mlir][gpu] Fallback to JIT compilation
Guray Ozen [Mon, 24 Jul 2023 10:45:04 +0000 (12:45 +0200)]
[mlir][gpu] Fallback to JIT compilation

Recent change introduces compilation with ptxas compiler. The change is important to be able to different versions of ptxas compiler without changing the compiler.

It causes some failures in builtbot. This change adds fallback mechanism to JIt compilation that is original path.

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

12 months ago[SystemZ][z/OS] Add OpenFlags to CreateMissingDirectories path when creating temp...
Tony Tao [Mon, 24 Jul 2023 13:02:59 +0000 (09:02 -0400)]
[SystemZ][z/OS] Add OpenFlags to CreateMissingDirectories path when creating temp files

Additional patch to https://reviews.llvm.org/D103806 to add the same flags in the path where the CreateMissingDirectories booleans is set to true.

Reviewed By: abhina.sreeskantharajan

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

12 months ago[X86] combineConcatVectorOps - add basic concat(unpack(x,y),unpack(z,w)) -> unpack...
Simon Pilgrim [Mon, 24 Jul 2023 12:49:45 +0000 (13:49 +0100)]
[X86] combineConcatVectorOps - add basic concat(unpack(x,y),unpack(z,w)) -> unpack(concat(x,z),concat(y,w)) handling

Very limited support as we don't want to interfere with build_vector patterns

12 months ago[NFC][clang] Fix static analyzer concerns
Podchishchaeva, Mariya [Mon, 24 Jul 2023 12:31:47 +0000 (05:31 -0700)]
[NFC][clang] Fix static analyzer concerns

HeaderIncludesCallback and HeaderIncludesJSONCallback classes may own
resources and free them in the destructor. However they don't have copy
user-written constructors/assignment operators, so an attempt to copy a
HeaderIncludesCallback object will use compiler-generated copy
constructor which will only do dummy copy and afterwards there will be
use-after-free issues.

Reviewed By: aaron.ballman, tahonermann

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

12 months agoRevert "[Sema] Fix handling of functions that hide classes"
John Brawn [Mon, 24 Jul 2023 12:29:22 +0000 (13:29 +0100)]
Revert "[Sema] Fix handling of functions that hide classes"

This reverts commit dfca88341794eec88c5009a93c569172fff62635.

Causes clang/test/Modules/stress1.cpp to fail.

12 months ago[NFC][clang] Fix static analyzer concerns
Podchishchaeva, Mariya [Mon, 24 Jul 2023 12:15:40 +0000 (05:15 -0700)]
[NFC][clang] Fix static analyzer concerns

OMPTransformDirectiveScopeRAII doesn't have user-written copy
constructor/assignment operator but it frees memory in the destructor.
Delete these members since doesn't seem that OMPTransformDirectiveScopeRAII
objects are intended for copy.

Reviewed By: tahonermann, ABataev

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

12 months ago[Sema] Fix handling of functions that hide classes
John Brawn [Wed, 28 Jun 2023 09:31:38 +0000 (10:31 +0100)]
[Sema] Fix handling of functions that hide classes

When a function is declared in the same scope as a class with the same
name then the function hides that class. Currently this is done by a
single check after the main loop in LookupResult::resolveKind, but
this can give the wrong result when we have a using declaration in
multiple namespace scopes in two different ways:

 * When the using declaration is hidden in one namespace but not the
   other we can end up considering only the hidden one when deciding
   if the result is ambiguous, causing an incorrect "not ambiguous"
   result.

 * When two classes with the same name in different namespace scopes
   are both hidden by using declarations this can result in
   incorrectly deciding the result is ambiguous. There's currently a
   comment saying this is expected, but I don't think that's correct.

Solve this by checking each Decl to see if it's hidden by some other
Decl in the same scope. This means we have to delay removing anything
from Decls until after the main loop, in case a Decl is hidden by
another that is removed due to being non-unique.

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

12 months ago[AArch64] NFC: Move fadda tests to separate file.
Sander de Smalen [Fri, 14 Jul 2023 08:45:10 +0000 (09:45 +0100)]
[AArch64] NFC: Move fadda tests to separate file.

We want to test the fadda tests with 'streaming-compatible' flags,
such that we can ensure no 'fadda' (not valid in streaming mode) is
generated.

12 months ago[AArch64][SME] NFC: Pass target feature on RUN line, instead of function attribute.
Sander de Smalen [Thu, 13 Jul 2023 09:45:22 +0000 (10:45 +0100)]
[AArch64][SME] NFC: Pass target feature on RUN line, instead of function attribute.

This is anticipating adding new RUN lines testing for +sme, alongside +sve/+sve2.

12 months ago[NVPTX] Fix lack of `.noreturn` on certain functions for aliases
Joseph Huber [Sat, 22 Jul 2023 02:30:36 +0000 (21:30 -0500)]
[NVPTX] Fix lack of `.noreturn` on certain functions for aliases

Forgot to include this special handling on the declaration of the alias
function.

Reviewed By: tra

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

12 months agoFix the Clang sphinx build
Aaron Ballman [Mon, 24 Jul 2023 11:32:48 +0000 (07:32 -0400)]
Fix the Clang sphinx build

This addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/92/builds/47783

12 months ago[InstCombine] Transform bitwise (A >> C - 1, zext(icmp)) -> zext (bitwise(A < 0,...
XChy [Mon, 24 Jul 2023 11:04:32 +0000 (13:04 +0200)]
[InstCombine] Transform bitwise (A >> C - 1, zext(icmp)) -> zext (bitwise(A < 0, icmp))

This extends foldCastedBitwiseLogic to handle the similar cases.
I have recently submitted a patch to implement a single fold like:

(A > 0) | (A < 0) -> zext (A != 0)

But it is not general enough, and some problems like
a < b & a >= b - 1 happen again.

So I generalize this fold by matching the pattern
bitwise(A >> C - 1, zext(icmp)), and replace A >> C - 1 with
zext(A < 0) here. (C is the scalar size bits of the type of A.)

Then we get bitwise(zext(A < 0), zext(icmp)), this will be folded
by original code in foldCastedBitwiseLogic, into
zext(bitwise(A < 0, icmp)). And finally, any related icmp fold will
be automatically implemented because bitwise(icmp,icmp) had been
implemented.

The proof of the correctness is obvious, because the folds below
were previously proved and implemented.
  A >> C - 1 -> zext(A < 0)
  bitwise(zext(A), zext(B)) -> zext(bitwise(A, B))
And the fold of this patch is the combination of folds above.

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

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

12 months ago[InstCombine] Add tests for bitwise (A >> C - 1, zext(icmp)) -> zext (bitwise(A<0...
XChy [Mon, 24 Jul 2023 11:02:40 +0000 (13:02 +0200)]
[InstCombine] Add tests for bitwise (A >> C - 1, zext(icmp)) -> zext (bitwise(A<0, icmp)) fold (NFC)

Tests for an upcoming bitwise (A >> C - 1, zext(icmp)) ->
zext (bitwise(A<0, icmp)) fold.

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

12 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.

12 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.

12 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

12 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

12 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

12 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)), ...)

12 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

12 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

12 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

12 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.

12 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

12 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.

12 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

12 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

12 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

12 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

12 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

12 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

12 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