platform/upstream/llvm.git
21 months ago[github] Update pip deps (NFC)
Keith Smiley [Sun, 9 Oct 2022 05:33:23 +0000 (22:33 -0700)]
[github] Update pip deps (NFC)

Minor dep updates identified in https://github.com/llvm/llvm-project/issues/57907

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

21 months ago[Hexagon] Report if changes were made in HvxIdioms pass
Krzysztof Parzyszek [Fri, 14 Oct 2022 22:44:24 +0000 (15:44 -0700)]
[Hexagon] Report if changes were made in HvxIdioms pass

This should fix
```
Pass modifies its input and doesn't report it: Hexagon Vector Combine
Pass modifies its input and doesn't report it UNREACHABLE executed at
[...hecks-debian/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1436!
```

21 months ago[llvm-objdump/mac] Add new function starts print mode
Keith Smiley [Sat, 5 Feb 2022 02:07:12 +0000 (18:07 -0800)]
[llvm-objdump/mac] Add new function starts print mode

This updates the `--function-starts` argument to now accept 3 different
modes, `addrs` for just printing the addresses of the function starts
(previous behavior), `names` for just printing the names of the function
starts, and `both` to print them both side by side.

In general if you're debugging function starts issues it's useful to see
the symbol name alongside the address. This also mirrors Apple's
`dyldinfo -function_starts` command which prints both.

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

21 months ago[llvm-objcopy][MachO] Add support for LC_DYLIB_CODE_SIGN_DRS
Keith Smiley [Fri, 14 Oct 2022 20:40:20 +0000 (13:40 -0700)]
[llvm-objcopy][MachO] Add support for LC_DYLIB_CODE_SIGN_DRS

This allows binaries containing the LC_DYLIB_CODE_SIGN_DRS to be
objcopy'd and stripped.

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

21 months ago[lldb][NFCish] Move DWARFDebugInfoEntry::GetQualifiedName() into DWARFASTParserClang
Arthur Eubanks [Thu, 4 Aug 2022 00:09:40 +0000 (17:09 -0700)]
[lldb][NFCish] Move DWARFDebugInfoEntry::GetQualifiedName() into DWARFASTParserClang

In D134378, we'll need the clang AST to be able to construct the qualified in some cases.

This makes logging in one place slightly less informative.

Reviewed By: dblaikie, Michael137

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

21 months agoRevert "[PGO] Make emitted symbols hidden"
Zequan Wu [Fri, 14 Oct 2022 22:22:26 +0000 (15:22 -0700)]
Revert "[PGO] Make emitted symbols hidden"

This reverts commit ecac223b0e4b05a65cf918f90824380db6b9ce64.

The commit causes instrprof-darwin-dead-strip.c to fail on mac.

21 months ago[Hexagon] Recognize idioms for fixed-point vector multiplication
Krzysztof Parzyszek [Wed, 28 Sep 2022 14:57:08 +0000 (07:57 -0700)]
[Hexagon] Recognize idioms for fixed-point vector multiplication

Recognize Q.15*Q.15 and Q.31*Q.31, with and without rounding.

21 months ago[clang-doc] Add typedef/using information.
Brett Wilson [Fri, 14 Oct 2022 21:28:43 +0000 (14:28 -0700)]
[clang-doc] Add typedef/using information.

Read typedef and "using" type alias declarations and serialize into the
internal structures. Emit this information in the YAML output. The HTML
and MD generators are unchanged.

Separate out the logic to create the parent namespace or record object
and insert the newly created child into it. This logic was previously
duplicated for every "info" type and is now shared.

To help this, a struct containing the child vectors was separated out so
children can be added generically and without having too many templates.

A small change was made to populateParentNamespaces() to allow using
types that aren't themselves DeclContexts (typedefs are the first
example of this).

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

21 months ago[RISCV] Merge rv32 and rv64 fixed vector stepvector tests
Philip Reames [Fri, 14 Oct 2022 21:53:51 +0000 (14:53 -0700)]
[RISCV] Merge rv32 and rv64 fixed vector stepvector tests

21 months ago[clang][Sema] Use size of char in bits for void types
Bill Wendling [Fri, 14 Oct 2022 21:20:54 +0000 (14:20 -0700)]
[clang][Sema] Use size of char in bits for void types

The extension that allows for pointer arithmetic on 'void' types treats
the 'void' as a 'char'. We should use the 'char' size in bits instead of
1 (the number of bytes) to allow warning when pointer arithmetic would
go out of bounds.

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

21 months agoReapply [AArch64] Fix aligning the stack after calling __chkstk
Martin Storsjö [Tue, 11 Oct 2022 12:20:59 +0000 (15:20 +0300)]
Reapply [AArch64] Fix aligning the stack after calling __chkstk

Whenever a call to __chkstk was made, the frame lowering previously
omitted the aligning (as NumBytes was reset to zero before doing
alignment).

This fixes https://github.com/llvm/llvm-project/issues/56182.

The initial version of this produced invalid code for small
functions with no local stack allocations, if those functions
were marked with the "stackrealign" attribute. If building
with -mstack-alignment=16 (which otherwise mostly would be a
no-op), this attribute is added on the main function.

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

21 months ago[Hexagon] Fix isTypeForHVX for vector predicates
Krzysztof Parzyszek [Mon, 10 Oct 2022 22:53:10 +0000 (15:53 -0700)]
[Hexagon] Fix isTypeForHVX for vector predicates

HexagonSubtarget::isTypeFixHVX would stop breaking the type up when it
reached 64 bits in width. HVX vector predicates can be shorter than that,
for example <32 x i1> would have a bitwidth of 32, and it's still a valid
HVX type.

21 months ago[mlir][sparse] Reorganize tests for the sparse_tensor.convert operator.
bixia1 [Thu, 13 Oct 2022 21:43:07 +0000 (14:43 -0700)]
[mlir][sparse] Reorganize tests for the sparse_tensor.convert operator.

Rename conversion_sparse2dense.mlir and conversion_sparse2sparse.mlir to
convert_sparse2dense.mlir/sparse2sparse.mlir.

Add convert_dense2sparse.mlir. Move the sparse_tensor.convert operator tests
out of conversion.mlir.

Reviewed By: aartbik

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

21 months ago[clang][macho] Add support for -darwin-target-variant-sdk-version in cc1as
Daniel Rodríguez Troitiño [Tue, 11 Oct 2022 23:38:39 +0000 (16:38 -0700)]
[clang][macho] Add support for -darwin-target-variant-sdk-version in cc1as

D121868 provided support for -darwin-target-variant-triple, but the
support for -darwin-target-variant-sdk-version was still missing for
cc1as. These changes build upon the previous and provides such support.

- Extracted the common code to handle -darwin-target-variant-triple and
  -darwin-target-variant-sdk-version in the Darwin toolchain to a method
  that can be used for both the cc1 and the cc1as job construction.
  cc1as does not support some of the parameters that were provided to
  cc1, so the same code cannot be used for both.
- Invoke that new common code when constructing a cc1as invocation.
- Parse the new -darwin-target-variant-sdk-version in the cc1as driver.
  Apply its value to the MCObjectFileInfo to generate the right values
  in the object files.
- Includes two new tests that check that cc1as uses the provided values
  in -darwin-target-variant-sdk and that the Clang driver creates the
  jobs with the correct arguments.

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

21 months ago[llvm-cov] Allow branch coverage to be skipped when exporting for LCOV
Alan Phipps [Fri, 14 Oct 2022 21:08:34 +0000 (16:08 -0500)]
[llvm-cov] Allow branch coverage to be skipped when exporting for LCOV

This small patch adds a '--skip-branches' option to the llvm-cov export
options. This option allows branch coverage information to be skipped from the
exported LCOV directives if it's not needed. For now, this only works when
exporting LCOV (which is noted in the option description), but it can be
extended for JSON later if it makes sense.

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

21 months ago[Hexagon] Lower funnel shifts for HVX
Krzysztof Parzyszek [Mon, 10 Oct 2022 22:52:38 +0000 (15:52 -0700)]
[Hexagon] Lower funnel shifts for HVX

HVX v62+ has bidirectional shifts, which do not mask the shift amount to
the bit width. Instead, the shift amount is sign-extended from the log(BW)
bit value, and a negative value causes a shift in the other direction.
For the shift amount being -log(BW), this reversed shift will shift all
bits out, inserting 0s or sign bits depending on the type and direction.

21 months ago[Loop] Move block and loop dispo invalidation to makeLoopInvariant.
Florian Hahn [Fri, 14 Oct 2022 20:58:14 +0000 (21:58 +0100)]
[Loop] Move block and loop dispo invalidation to makeLoopInvariant.

makeLoopInvariant may recursively move its operands to make them
invariant, before moving the passed in instruction. Those recursively
moved instructions are currently missed when invalidating block and loop
dispositions.

To address this, move the invalidation code to Loop::makeLoopInvariant.

Fixes #58314.

Reviewed By: nikic

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

21 months agoRevert "Remove sign comparaison warning in APFixedPointTest.cpp"
Tyker [Fri, 14 Oct 2022 20:40:12 +0000 (13:40 -0700)]
Revert "Remove sign comparaison warning in APFixedPointTest.cpp"

has already been fixed

This reverts commit 1a60a35769bcb2554a4527048b13cf75ad4022d6.

21 months agoRemove sign comparaison warning in APFixedPointTest.cpp
Tyker [Fri, 14 Oct 2022 20:38:29 +0000 (13:38 -0700)]
Remove sign comparaison warning in APFixedPointTest.cpp

21 months ago[lto] Do not try to internalize symbols with escaped name
serge-sans-paille [Thu, 13 Oct 2022 08:26:41 +0000 (10:26 +0200)]
[lto] Do not try to internalize symbols with escaped name

Because of LLVM mangling escape sequence (through '\01' prefix), it is possible
for a single symbols two have two different IR representations.

For instance, consider @symbol and @"\01_symbol". On OSX, because of the system
mangling rules, these two IR names point are converted in the same final symbol
upon linkage.

LTO doesn't model this behavior, which may result in symbols being incorrectly
internalized (if all reference use the escaping sequence while the definition
doesn't).

The proper approach is probably to use the mangled name to compute GUID to
avoid the dual representation, but we can also avoid discarding symbols that are
bound to two different IR names. This is an approximation, but it's less
intrusive on the codebase.

Fix #57864

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

21 months ago[ConstraintElimination] Move logic for replacing ssub overflow users (NFC)
Zain Jaffal [Fri, 14 Oct 2022 13:11:38 +0000 (14:11 +0100)]
[ConstraintElimination] Move logic for replacing ssub overflow users (NFC)

Reviewed By: fhahn

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

21 months agoRevert "[scudo] Manage free blocks in BatchGroup."
Kamau Bridgeman [Fri, 14 Oct 2022 20:11:57 +0000 (15:11 -0500)]
Revert "[scudo] Manage free blocks in BatchGroup."

This reverts commit cf9d7f55d3bec7640fa8b2f8ec1d9c1268233caa.

21 months agoRevert "[scudo] Support partial page releasing"
Kamau Bridgeman [Fri, 14 Oct 2022 20:11:44 +0000 (15:11 -0500)]
Revert "[scudo] Support partial page releasing"

This reverts commit 9c26f51f5e178ac0fda98419e3a61d205d3b58b1.

21 months agoRevert "[scudo] Fix implicitly narrow casting (NFC)"
Kamau Bridgeman [Fri, 14 Oct 2022 20:11:34 +0000 (15:11 -0500)]
Revert "[scudo] Fix implicitly narrow casting (NFC)"

This reverts commit fd7c7ad4fe0138314b922ea0db1691d5a679cc75.

21 months ago[clang][dataflow][NFC] Fix reachability warning.
Yitzhak Mandelbaum [Fri, 14 Oct 2022 18:33:02 +0000 (18:33 +0000)]
[clang][dataflow][NFC] Fix reachability warning.

Some compilers can't determine that all cases of the switch return (or are
unreachable) and warn about control reaching end of non-void
function. Explicitly mark with `llvm_unreachable`.

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

21 months agoItanium ABI: Pack non-pod members of packed types
David Blaikie [Thu, 13 Oct 2022 20:44:21 +0000 (20:44 +0000)]
Itanium ABI: Pack non-pod members of packed types

Seems there's a narrow case - where a packed type doesn't pack its base
subobjects (only fields), but when packing a field of the derived type,
GCC does pack the resulting total object - effectively packing the base
subobject.

So ensure that this non-pod type (owing to it having a base class) that
is packed, gets packed when placed in /another/ type that is also
packed.

This is a (smallish?) ABI fix to a regression introduced by D117616 -
but that regression/ABI break hasn't been released in LLVM as-yet (it's
been reverted on the release branch from the last two LLVM releases - I
probably should've just reverted the whole patch while we hashed out
this and other issues) so this change isn't itself an ABI break, as far
as LLVM releases are concerned (for folks releasing their own copies of
LLVM from ToT/without the LLVM release branch, and didn't opt into the
clang-abi-compat 14 or below (soon to be 15 or below, I guess I should
say) then this would be an ABI break against clang from the last 9
months or so)

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

21 months agoRevert "[libc] New version of the mem* framework"
Sterling Augustine [Fri, 14 Oct 2022 18:17:46 +0000 (11:17 -0700)]
Revert "[libc] New version of the mem* framework"

This reverts commit https://reviews.llvm.org/D135134 (b3f1d58a131eb546aaf1ac165c77ccb89c40d758)

That revision appears to have broken Arm memcpy in some subtle
ways. Am communicating with the original author to get a
good reproduction.

21 months ago[AArch64] Support SETCCCARRY lowering
Filipp Zhinkin [Wed, 5 Oct 2022 19:09:09 +0000 (22:09 +0300)]
[AArch64] Support SETCCCARRY lowering

Support SETCCCARRY lowering to SBCS instruction.

Related issue: https://github.com/llvm/llvm-project/issues/44629

Reviewed By: efriedma

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

21 months ago[lld][nfc] Remove lld::demangle() (partial revert of D116279)
Jez Ng [Fri, 14 Oct 2022 19:28:19 +0000 (15:28 -0400)]
[lld][nfc] Remove lld::demangle() (partial revert of D116279)

{D116279}, in addition to adding support for other demanglers, also
factored out some of the demangling logic. However, I don't think the
abstraction really carries its weight -- after {D135942}, only the ELF
and WASM backends call it with anything other than a non-constant
`shouldDemangle` argument. The COFF and Mach-O backends were already
doing the should-demangle check before calling `demangle()`.

Reviewed By: MaskRay, #lld-macho

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

21 months ago[lld-macho][nfc] lld/Common's `demangle()` is redundant for Mach-O
Jez Ng [Fri, 14 Oct 2022 19:28:15 +0000 (15:28 -0400)]
[lld-macho][nfc] lld/Common's `demangle()` is redundant for Mach-O

The only thing that the Common implementation does is a check for
`config->demangle`, but {D135189} added that check to
`maybeDemangleSymbol`, so there's no need to go through `Common`...

Reviewed By: MaskRay

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

21 months ago[Flang] Adjust preprocessing to build modules correctly
Peter Steinfeld [Wed, 12 Oct 2022 19:41:51 +0000 (12:41 -0700)]
[Flang] Adjust preprocessing to build modules correctly

Several module files in .../llvm-project/flang/module check for the
existence of the macro "__x86_64__" to conditionally compile Fortran
code.  Unfortunately, this macro was not being defined anywhere.  This
patch fixes that for compilations targeting 64 bit x86 machines.

I made the following changes --
  -- Removed the test for 32 bit X86 targets.  The rest of the compiler and
  runtime do not support X86 32 bits.
  -- Added predefined macros to define "__x86_64__"  and "__x86__64" to
  be 1 when the target architecture is 64 bit x86 and the "-cpp" option
  is on the command line.
  -- Changed the cmake file for creating the Fortran module files to use the
  "-cpp" option so that the macro "__x86_64__" will be defined when building
  the module files.
  -- Added a test.

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

21 months ago[Transforms/ObjCARC] Fix non-deterministic output of `ObjCARCOptPass`
Argyrios Kyrtzidis [Thu, 6 Oct 2022 17:02:19 +0000 (10:02 -0700)]
[Transforms/ObjCARC] Fix non-deterministic output of `ObjCARCOptPass`

`ProvenanceAnalysis::related()` was assuming that the order of parameters for `relatedCheck()` was not affecting
the result but this was not the case when both parameters were `PHINode`s.
Due to this assumption `ProvenanceAnalysis::related()` was ordering the parameters based on pointer value which resulted in
non-deterministic behavior.

To address this change `relatedPHI()` so that it gives the same result independent of the parameter order.

rdar://100325456

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

21 months agoFix a -Wsign-compare warning
Nico Weber [Fri, 14 Oct 2022 19:19:14 +0000 (15:19 -0400)]
Fix a -Wsign-compare warning

21 months ago[lld-macho][nfc] define command UNWIND_MODE_MASK for convenience and rewrite mode...
Vy Nguyen [Thu, 6 Oct 2022 13:08:00 +0000 (09:08 -0400)]
[lld-macho][nfc] define command UNWIND_MODE_MASK for convenience and rewrite mode-mask checking logic for clarity

The previous form is currently "harmless" and happened to work but may not in the future:

Consider the struct: (for x86-64, but same issue can be said for the ARM/64 families):

```
UNWIND_X86_64_MODE_MASK                    = 0x0F000000,
UNWIND_X86_64_MODE_RBP_FRAME               = 0x01000000,
UNWIND_X86_64_MODE_STACK_IMMD              = 0x02000000,
UNWIND_X86_64_MODE_STACK_IND               = 0x03000000,
UNWIND_X86_64_MODE_DWARF                   = 0x04000000,
```

Previously, we were doing: `(encoding & MODE_DWARF) == MODE_DWARF`

As soon as a new `UNWIND_X86_64_MODE_FOO = 0x05000000` is defined, then the check above would always return true for encoding=MODE_FOO (because `(0b0101 & 0b0100) == 0b0100` )

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

21 months ago[RISCV] Rename ReadVIALUCV->ReadVICALUV to match WriteVICALUV. NFC
Craig Topper [Fri, 14 Oct 2022 19:11:50 +0000 (12:11 -0700)]
[RISCV] Rename ReadVIALUCV->ReadVICALUV to match WriteVICALUV. NFC

21 months ago[Hexagon] Use IRBuilderBase in function parameters
Krzysztof Parzyszek [Mon, 10 Oct 2022 23:03:04 +0000 (16:03 -0700)]
[Hexagon] Use IRBuilderBase in function parameters

This will allow using builders with different folders.

21 months ago[bazel] Port 911d2dc (LLVMFrontendHLSL)
Benjamin Kramer [Fri, 14 Oct 2022 19:06:57 +0000 (21:06 +0200)]
[bazel] Port 911d2dc (LLVMFrontendHLSL)

21 months ago[gn build] port 0cfa50154a47eb
Nico Weber [Fri, 14 Oct 2022 19:07:56 +0000 (15:07 -0400)]
[gn build] port 0cfa50154a47eb

21 months ago[gn build] Remove unused tablegen.gni imports
Nico Weber [Fri, 14 Oct 2022 19:02:05 +0000 (15:02 -0400)]
[gn build] Remove unused tablegen.gni imports

Found via

    for f in $(rg -l tablegen.gni llvm/utils/gn); do
        if ! rg -q 'tablegen\(' $f; then
            echo $f
        fi
    done

after seeing it randomly in one of the files.

21 months ago[Hexagon] Introduce PS_vsplat[ir][bhw] pseudo instructions
Krzysztof Parzyszek [Thu, 13 Oct 2022 22:10:59 +0000 (15:10 -0700)]
[Hexagon] Introduce PS_vsplat[ir][bhw] pseudo instructions

HVX v60 only has splats that take a 32-bit word as input, while v62+
has splats that take 8- or 16-bit value. This makes writing output
patterns that need to use a splat annoying, because the entire output
pattern needs to be replicated for various versions of HVX.
To avoid this, the patterns will always use the pseudos, and then the
pseudos will be handled using a post-ISel hook.

21 months ago[mlir][MemRef] Add a extract_strided_metadata(extract_strided_metadata) pattern
Quentin Colombet [Wed, 12 Oct 2022 21:16:22 +0000 (21:16 +0000)]
[mlir][MemRef] Add a extract_strided_metadata(extract_strided_metadata) pattern

This pattern will be useful to get cleaner code when lowering view like
operations.

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

21 months ago[LLDB] Only run lldb-server Shell tests if it gets built
Alex Langford [Wed, 12 Oct 2022 23:01:07 +0000 (16:01 -0700)]
[LLDB] Only run lldb-server Shell tests if it gets built

It's easy enough to disable the lldb-server build. The lldb-server unit
tests already have logic to disable them if we don't build, so this just
makes it even.

Reviewed By: DavidSpickett

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

21 months ago[gn build] port 911d2dc230 (LLVMFrontendHLSL)
Nico Weber [Fri, 14 Oct 2022 18:59:28 +0000 (14:59 -0400)]
[gn build] port 911d2dc230 (LLVMFrontendHLSL)

21 months ago[scudo] Fix implicitly narrow casting (NFC)
Chia-hung Duan [Fri, 14 Oct 2022 06:36:47 +0000 (06:36 +0000)]
[scudo] Fix implicitly narrow casting (NFC)

u16 may be promoted to int by arithmetic type conversion. Do an explicit
cast to avoid certain compiler's warning.

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

21 months ago[LV] Simplify register usage code and avoid double map lookups. NFC
Craig Topper [Fri, 14 Oct 2022 18:46:42 +0000 (11:46 -0700)]
[LV] Simplify register usage code and avoid double map lookups. NFC

Instead of checking whether a map entry exists to decide if we should
initialize it or add to it, we can rely on the map entry being constructed
and initialized to 0 before the addition happens.

For the std::max case, I've made a reference to the map entry to
avoid looking it up twice.

Reviewed By: reames

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

21 months ago[NFC][mlir][MemRef] Make use of InferTypeOpInterface
Quentin Colombet [Tue, 11 Oct 2022 20:53:25 +0000 (20:53 +0000)]
[NFC][mlir][MemRef] Make use of InferTypeOpInterface

The `InferTypeOpInterface` generates builders for things it can infer
the types.
Thanks to that interface we can:
- Eliminate a builder for DimOp, and
- Describe how to infer the result types of `extract_strided_metadata`
  from its source, and get a simpler builder as a result

NFC

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

21 months ago[X86] Use unsigned int for return type of __get_cpuid_max.
Craig Topper [Fri, 14 Oct 2022 18:37:28 +0000 (11:37 -0700)]
[X86] Use unsigned int for return type of __get_cpuid_max.

It looks like gcc's header already uses unsigned int and we should
match.

Fixes PR58359.

Reviewed By: RKSimon

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

21 months ago[NFC] [HLSL] Move common metadata to LLVMFrontend
Chris Bieneman [Fri, 14 Oct 2022 18:33:25 +0000 (13:33 -0500)]
[NFC] [HLSL] Move common metadata to LLVMFrontend

This change pulls some code from the DirectX backend into a new
LLVMFrontendHLSL library to share utility data structures between the
HLSL code generation in Clang and the backend in LLVM.

This is a small refactoring as a first start to get code into the
right structure and get the library built and dependencies correct.

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

Reviewed By: python3kgae

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

21 months ago[RISCV] Correct RISCVTTIImpl::getRegUsageForType for vectors of pointers.
Craig Topper [Fri, 14 Oct 2022 18:30:48 +0000 (11:30 -0700)]
[RISCV] Correct RISCVTTIImpl::getRegUsageForType for vectors of pointers.

getPrimitiveSizeInBits returns 0 for pointers, we need to query
the size via DataLayout instead.

Reviewed By: reames

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

21 months ago[gn build] port 6ce872724877
Nico Weber [Fri, 14 Oct 2022 18:33:24 +0000 (14:33 -0400)]
[gn build] port 6ce872724877

21 months ago[DX] Add pass to pretty-print DXIL metadata in asm
Chris Bieneman [Thu, 13 Oct 2022 18:35:55 +0000 (13:35 -0500)]
[DX] Add pass to pretty-print DXIL metadata in asm

When DXC prints IR output it adds a bunch of IR comments in a header
that describe the DXIL metadata in a more human-readable format. This
pass will serve that purpose for LLVM by printing out ahead of the IR
printer.

Reviewed By: python3kgae

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

21 months ago[PowerPC] Fix parameters for __builtin_crypto_vsbox
Stefan Pintilie [Fri, 14 Oct 2022 14:51:06 +0000 (09:51 -0500)]
[PowerPC] Fix parameters for __builtin_crypto_vsbox

The documentation specifies that the input and ouput for the builtin
__builtin_crypto_vsbox should be vector unsigned char.

This patch fixes this type for the builtin.

Reviewed By: amyk

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

21 months ago[SimplifyCFG] Add tests for simpilfycfg, switch to lookup table with i2 types; NFC
chenglin.bi [Fri, 14 Oct 2022 18:24:46 +0000 (02:24 +0800)]
[SimplifyCFG] Add tests for simpilfycfg, switch to lookup table with i2 types; NFC

21 months ago[BranchRelaxation] Fix test for duplicate branch instruction
Anshil Gandhi [Fri, 14 Oct 2022 17:56:07 +0000 (11:56 -0600)]
[BranchRelaxation] Fix test for duplicate branch instruction

This patch is a follow up for D134557, inserting a check
for a duplicate unconditional branch to fall through.

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

21 months ago[Attributes] Improve writing `ExprArgument` value.
Volodymyr Sapsai [Fri, 14 Oct 2022 02:22:11 +0000 (19:22 -0700)]
[Attributes] Improve writing `ExprArgument` value.

Instead of dumping `Expr*` memory address, output `Expr` representation.

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

21 months ago[lldb] Start from end of previous substr when checking ordered substrs
Arthur Eubanks [Wed, 12 Oct 2022 23:07:44 +0000 (16:07 -0700)]
[lldb] Start from end of previous substr when checking ordered substrs

I'm trying to add a test which tests that the same substr occurs twice in a row, but it matches even if only one of the substr occurs.

This found a bug in concurrent_base.py.

Reviewed By: DavidSpickett

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

21 months ago[ADT] Fix Incorrect rounding for APFixedPoint::getIntPart
Tyker [Mon, 10 Oct 2022 08:35:47 +0000 (10:35 +0200)]
[ADT] Fix Incorrect rounding for APFixedPoint::getIntPart

21 months ago[AArch64]Change printVectorList to print SVE vector range
Caroline Concatto [Thu, 13 Oct 2022 18:26:14 +0000 (19:26 +0100)]
[AArch64]Change printVectorList to print SVE vector range

This patch has the prefered disassembly changed for SVE vector list.
For instance, instead of printing this assembly:
  ld4d { z1.d, z2.d, z3.d, z4.d }, p0/z, [x0]
it will print this:
  ld4d { z1.d-z4.d }, p0/z, [x0]

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

21 months ago[clang-dataflow][NFC] Mark test analysis classes as `final`.
Yitzhak Mandelbaum [Thu, 13 Oct 2022 22:36:35 +0000 (22:36 +0000)]
[clang-dataflow][NFC] Mark test analysis classes as `final`.

Change from marking individual methods as `final` to marking the whole class.

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

21 months ago[ARM] Fix for MVE i128 vector icmp costs.
David Green [Fri, 14 Oct 2022 17:49:25 +0000 (18:49 +0100)]
[ARM] Fix for MVE i128 vector icmp costs.

We were hitting an assert as the legalied type needn't be a vector.

Fixes #58364

21 months ago[AArch64-SVE]: Force generating code compatible to streaming mode.
Hassnaa Hamdi [Wed, 7 Sep 2022 00:56:55 +0000 (00:56 +0000)]
[AArch64-SVE]: Force generating code compatible to streaming mode.

Add a compile-time flag for enabling streaming mode.
When streaming mode is enabled, lower basic loads and stores of fixed-width vectors;
to generate code that is compatible to streaming mode.

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

21 months ago[clang][dataflow] Add support for a Top value in boolean formulas.
Yitzhak Mandelbaum [Thu, 6 Oct 2022 17:56:41 +0000 (17:56 +0000)]
[clang][dataflow] Add support for a Top value in boolean formulas.

Currently, our boolean formulas (`BoolValue`) don't form a lattice, since they
have no Top element. This patch adds such an element, thereby "completing" the
built-in model of bools to be a proper semi-lattice. It still has infinite
height, which is its own problem, but that can be solved separately, through
widening and the like.

Patch 1 for Issue #56931.

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

21 months ago[CodeGen][ObjC] Call synthesized copy constructor/assignment operator
Akira Hatanaka [Fri, 14 Oct 2022 17:40:24 +0000 (10:40 -0700)]
[CodeGen][ObjC] Call synthesized copy constructor/assignment operator
functions in getter/setter functions of non-trivial C struct properties

This fixes a bug where the getter/setter functions were doing a trivial
copy instead of calling the synthesized functions that copy non-trivial
C struct types.

This fixes https://github.com/llvm/llvm-project/issues/56680.

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

21 months agoFix llvm/lib/ObjCopy, llvm/llvm-ifs: c++20 compatibility
Angelo Matni [Fri, 14 Oct 2022 17:28:46 +0000 (10:28 -0700)]
Fix llvm/lib/ObjCopy, llvm/llvm-ifs: c++20 compatibility

Cleanup: avoid referring to `std::vector<T>` members when `T` is incomplete.

This is [not legal](https://timsong-cpp.github.io/cppwp/n4868/vector#overview-4)
according to the C++ standard, and causes build errors in particular in C++20
mode. Fix it by defining the vector's type before using the vector.

Reviewed By: saugustine, MaskRay

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

21 months ago[DAGCombiner] Fix crash for the merge stores with different value type
chenglin.bi [Fri, 14 Oct 2022 17:16:19 +0000 (01:16 +0800)]
[DAGCombiner] Fix crash for the merge stores with different value type

The crash case comes from #58350. It have two stores, one store is type f32 and the other is v1f32.
When we try to merge these two stores on v1f32, the memVT is vector type so the old code will use ISD::EXTRACT_SUBVECTOR for type f32 also then compiler crash.
So this patch insert a build_vector for f32 store to generate v1f32 also when memVT is v1f32.

Reviewed By: RKSimon

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

21 months ago[mlir] Update Values to use new casting infra
Nick Kreeger [Fri, 14 Oct 2022 16:56:35 +0000 (11:56 -0500)]
[mlir] Update Values to use new casting infra

This allows for using the llvm namespace cast methods instead of the ones on the Value class. The Value class method are kept for now, but we'll want to remove these eventually (with a really long lead time).

Related change: https://reviews.llvm.org/D134327

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

21 months ago[NFC] Fix typo in DAGCombiner
Nicola Lancellotti [Fri, 14 Oct 2022 16:29:49 +0000 (17:29 +0100)]
[NFC] Fix typo in DAGCombiner

21 months ago[AMDGPU][MC][GFX8+] Correct v_cndmask modifiers
Dmitry Preobrazhensky [Fri, 14 Oct 2022 16:36:29 +0000 (19:36 +0300)]
[AMDGPU][MC][GFX8+] Correct v_cndmask modifiers

Correct v_cndmask_b32 to support abs/neg modifiers in dpp/sdwa/e64 variants.
Correct v_cndmask_b16 for proper disassembly of abs/neg modifiers in e64_dpp variants.

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

21 months ago[mlir][ods] Fix substitutions for op custom string literals
Jeff Niu [Thu, 13 Oct 2022 03:03:54 +0000 (20:03 -0700)]
[mlir][ods] Fix substitutions for op custom string literals

The context and builder did not receive the correct substitutes in the
printers. Also, the tests were incorrect (d'oh!)

Reviewed By: rriddle

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

21 months ago[libc] Add implementation of the POSIX getcwd function.
Siva Chandra Reddy [Thu, 13 Oct 2022 07:43:05 +0000 (07:43 +0000)]
[libc] Add implementation of the POSIX getcwd function.

Reviewed By: michaelrj

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

21 months ago[flang][nfc] Rename `AddOtherOptions` as `ForwardOptions`
Andrzej Warzynski [Fri, 14 Oct 2022 16:12:44 +0000 (16:12 +0000)]
[flang][nfc] Rename `AddOtherOptions` as `ForwardOptions`

The updated name better reflects what this hook is intended for.

Reviewed By: tarunprabhu

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

21 months ago[clang-tidy] Use std::underlying_type_t (NFC)
Kazu Hirata [Fri, 14 Oct 2022 16:10:09 +0000 (09:10 -0700)]
[clang-tidy] Use std::underlying_type_t (NFC)

21 months ago[ConstraintElim] Add test cases for shl and mul.
Florian Hahn [Fri, 14 Oct 2022 15:59:13 +0000 (16:59 +0100)]
[ConstraintElim] Add test cases for shl and mul.

21 months agoAdd missing include to fix the modules build
Adrian Prantl [Fri, 14 Oct 2022 15:51:34 +0000 (08:51 -0700)]
Add missing include to fix the modules build

21 months ago[flang] Fix a warning
Kazu Hirata [Fri, 14 Oct 2022 15:51:37 +0000 (08:51 -0700)]
[flang] Fix a warning

This patch fixes:

  flang/lib/Lower/ConvertExpr.cpp:2733:14: error: variable
  'callNumResults' set but not used
  [-Werror,-Wunused-but-set-variable]

21 months ago[mlir][memref] Add initial Wide Int Emulation pass and patterns
Jakub Kuderski [Fri, 14 Oct 2022 15:36:47 +0000 (11:36 -0400)]
[mlir][memref] Add initial Wide Int Emulation pass and patterns

Add a new pass and conversions to emulate wide integer operations over memrefs.
The emulation is implemented on top of the existing pass to emulate wide integer arith ops.

Improve naming in the arith pass to avoid potential name clashes.

Reviewed By: antiagainst

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

21 months ago[clang] Fix a warning
Kazu Hirata [Fri, 14 Oct 2022 15:36:59 +0000 (08:36 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/CodeGen/CGCall.cpp:1867:64: error: '&&' within '||'
  [-Werror,-Wlogical-op-parentheses]

21 months ago[AArch64] Make ACLE intrinsics always available part1
Daniel Kiss [Fri, 14 Oct 2022 15:21:17 +0000 (17:21 +0200)]
[AArch64] Make ACLE intrinsics always available part1

A given arch feature might enabled by a pragma or a function attribute so in this cases would be nice to use intrinsics.
Today GCC offers the intrinsics without the march flag[1].
PR[2] for ACLE to clarify the intention and remove the need for -march flag for a given intrinsics.

This is going to be more useful when D127812 lands.

[1] https://godbolt.org/z/bxcMhav3z
[2] https://github.com/ARM-software/acle/pull/214

Reviewed By: dmgreen

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

21 months ago[PowerPC][NFC] Pre-commit case for lowering vector shuffles to xxsplti32dx (64 bit)
Amy Kwan [Fri, 14 Oct 2022 15:15:04 +0000 (10:15 -0500)]
[PowerPC][NFC] Pre-commit case for lowering vector shuffles to xxsplti32dx (64 bit)

This patch adds a test case for lowering vector shuffles to xxsplti32dx in
preparation for D135024. The test case added in this patch only adds the
64-bit CHECKs, as the 32-bit CHECKs cannot be generated (in which D135024
aims to fix).

21 months ago[SaveAndRestore] Upgrade this to support non-copyable types.
Chris Lattner [Fri, 14 Oct 2022 05:01:14 +0000 (22:01 -0700)]
[SaveAndRestore] Upgrade this to support non-copyable types.

This adds a constructor and upgrades the dtor to work with
move-only types.

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

21 months agoRemove redundant option -menable-unsafe-fp-math.
Zahira Ammarguellat [Mon, 3 Oct 2022 19:15:48 +0000 (15:15 -0400)]
Remove redundant option -menable-unsafe-fp-math.

There are currently two options that are used to tell the compiler to perform
unsafe floating-point optimizations:
'-ffast-math' and '-funsafe-math-optimizations'.

'-ffast-math' is enabled by default. It automatically enables the driver option
'-menable-unsafe-fp-math'.
Below is a table illustrating the special operations enabled automatically by
'-ffast-math', '-funsafe-math-optimizations' and '-menable-unsafe-fp-math'
respectively.

Special Operations -ffast-math -funsafe-math-optimizations -menable-unsafe-fp-math
MathErrno        0          1                     1
FiniteMathOnly         1           0                          0
AllowFPReassoc        1           1                          1
NoSignedZero        1                 1                          1
AllowRecip             1                 1                          1
ApproxFunc             1                 1                          1
RoundingMath        0                 0                          0
UnsafeFPMath        1                 0                          1
FPContract        fast          on                     on

'-ffast-math' enables '-fno-math-errno', '-ffinite-math-only',
'-funsafe-math-optimzations' and sets 'FpContract' to 'fast'. The driver option
'-menable-unsafe-fp-math' enables the same special options than
'-funsafe-math-optimizations'. This is redundant.
We propose to remove the driver option '-menable-unsafe-fp-math' and use
instead, the setting of the special operations to set the function attribute
'unsafe-fp-math'. This attribute will be enabled only if those special
operations are enabled and if 'FPContract' is either 'fast' or set to the
default value.

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

21 months ago[cmake] Remove LLVM_INCLUDE_GO_TESTS variable
Nikita Popov [Fri, 14 Oct 2022 14:32:22 +0000 (16:32 +0200)]
[cmake] Remove LLVM_INCLUDE_GO_TESTS variable

As pointed out by thakis in https://reviews.llvm.org/D135436#3858463,
this variable can be dropped now that the Go bindings have been
removed.

21 months ago[C2x] Implement support for nullptr and nullptr_t
Aaron Ballman [Fri, 14 Oct 2022 14:04:34 +0000 (10:04 -0400)]
[C2x] Implement support for nullptr and nullptr_t

This introduces support for nullptr and nullptr_t in C2x mode. The
proposal accepted by WG14 is:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm

Note, there are quite a few incompatibilities with the C++ feature in
some of the edge cases of this feature. Therefore, there are some FIXME
comments in tests for testing behavior that might change after WG14 has
resolved national body comments (a process we've not yet started). So
this implementation might change slightly depending on the resolution
of comments. This is called out explicitly in the release notes as
well.

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

21 months ago[Libomptarget] Fix missing semicolon in exports
Joseph Huber [Fri, 14 Oct 2022 14:02:42 +0000 (09:02 -0500)]
[Libomptarget] Fix missing semicolon in exports

21 months ago[Libomptarget] Don't use full names for exported plugin symbols
Joseph Huber [Fri, 14 Oct 2022 13:39:04 +0000 (08:39 -0500)]
[Libomptarget] Don't use full names for exported plugin symbols

Summary:
This patch changes the `exports` file to export all `__tgt_rtl`
functions. This is a better option as not each plugin implements all of
these functions, furthermore any new functions added will be
automatically included.

21 months ago[AArch64][SME] Add support for arm_locally_streaming functions.
Sander de Smalen [Fri, 14 Oct 2022 08:51:13 +0000 (08:51 +0000)]
[AArch64][SME] Add support for arm_locally_streaming functions.

Functions with `aarch64_sme_pstatesm_body` will emit a SMSTART at the start
of the function, and a SMSTOP at the end of the function, such that all
operations use the right value for vscale.

Because the placement of these nodes is critically important (i.e. no
vscale-dependent operations should be done before SMSTART has been issued),
we require glueing the CopyFromReg to the Entry node such that we can
insert the SMSTART as part of that glued chain.

More details about the SME attributes and design can be found
in D131562.

Reviewed By: aemerson

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

21 months ago[libc] New version of the mem* framework
Guillaume Chatelet [Fri, 14 Oct 2022 13:46:27 +0000 (13:46 +0000)]
[libc] New version of the mem* framework

    This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

    Codegen can be checked here https://godbolt.org/z/chf1Y6eGM

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

21 months ago[OpenMP] Extend the lit test for uses_allocators in target region
Animesh Kumar [Fri, 14 Oct 2022 11:06:03 +0000 (16:36 +0530)]
[OpenMP] Extend the lit test for uses_allocators in target region

This patch improves the LIT tests on the following :

1. The test on `uses_allocators` clause in the `target` region by
adding the respective CHECK lines. Allocator `omp_thread_mem_alloc`
is also added in the test.
2. The `defaultmap` clause wasn't being tested for the variable-
category `scalar` and the implicit-behavior `tofrom` with respect
to the OpenMP default version.

These improvements are inspired from SOLLVE tests.
SOLLVE repo: https://github.com/SOLLVE/sollve_vv

Reviewed By: jdoerfert

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

21 months ago[AArch64] Select to CCMN when the CCMP's second operator is negative constant
chenglin.bi [Fri, 14 Oct 2022 13:40:55 +0000 (21:40 +0800)]
[AArch64] Select to CCMN when the CCMP's second operator is negative constant

CCMP/CCMN's second operator support const from 0 to 31. When the CCMP's second operator is in the range [-31, -1] we can replace it with CCMN to avoid extra mov.

Fix: #57034

Reviewed By: efriedma

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

21 months agoRevert "[libc] New version of the mem* framework"
Guillaume Chatelet [Fri, 14 Oct 2022 13:21:52 +0000 (13:21 +0000)]
Revert "[libc] New version of the mem* framework"

This reverts commit 9721687835a7df5da0c9482cf684c11b8ba97f75.

21 months agoRevert "[libc] Fix embedded version of bcmp / memcmp"
Guillaume Chatelet [Fri, 14 Oct 2022 13:21:19 +0000 (13:21 +0000)]
Revert "[libc] Fix embedded version of bcmp / memcmp"

This reverts commit 7c9b8fa6d2d921569a1ebeb4816edb7b05a37cdd.

21 months ago[libc] Fix embedded version of bcmp / memcmp
Guillaume Chatelet [Fri, 14 Oct 2022 13:09:28 +0000 (13:09 +0000)]
[libc] Fix embedded version of bcmp / memcmp

21 months ago[lld/ELF] Convert undef-spell-corrector.s test to split-file
Nico Weber [Thu, 13 Oct 2022 14:55:24 +0000 (10:55 -0400)]
[lld/ELF] Convert undef-spell-corrector.s test to split-file

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

21 months agoFix the ExtractAPI tests
Aaron Ballman [Fri, 14 Oct 2022 12:57:01 +0000 (08:57 -0400)]
Fix the ExtractAPI tests

This should address the issues found by:
https://lab.llvm.org/buildbot/#/builders/139/builds/29568
https://lab.llvm.org/buildbot/#/builders/109/builds/48658

21 months agoAdd f16 type support in math.erf op.
Prashant Kumar [Wed, 12 Oct 2022 12:41:16 +0000 (12:41 +0000)]
Add f16 type support in math.erf op.

f16 type support was missing in the math.erf op.

Reviewed By: ezhulenev

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

21 months ago[libc] New version of the mem* framework
Guillaume Chatelet [Fri, 14 Oct 2022 12:42:34 +0000 (12:42 +0000)]
[libc] New version of the mem* framework

This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

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

21 months ago[clang][Interp] Implement while and do-while loops
Timm Bäder [Fri, 7 Oct 2022 09:37:12 +0000 (11:37 +0200)]
[clang][Interp] Implement while and do-while loops

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

21 months ago[clang][Interp][NFC] Remove unused parameter from emitConst()
Timm Bäder [Fri, 7 Oct 2022 06:12:05 +0000 (08:12 +0200)]
[clang][Interp][NFC] Remove unused parameter from emitConst()

21 months ago[clang][Interp][NFC] Add some tests for invalid array access
Timm Bäder [Mon, 10 Oct 2022 10:58:47 +0000 (12:58 +0200)]
[clang][Interp][NFC] Add some tests for invalid array access

21 months agoSpeculatively fix the lldb test bots
Aaron Ballman [Fri, 14 Oct 2022 12:36:04 +0000 (08:36 -0400)]
Speculatively fix the lldb test bots

This should fix the issue found by:
https://lab.llvm.org/buildbot/#/builders/68/builds/41100