platform/upstream/llvm.git
21 months ago[CodeGen] Using ZExt for extractelement indices.
Peter Rong [Tue, 30 Aug 2022 21:55:59 +0000 (14:55 -0700)]
[CodeGen] Using ZExt for extractelement indices.

In https://github.com/llvm/llvm-project/issues/57452, we found that IRTranslator is translating `i1 true` into `i32 -1`.
This is because IRTranslator uses SExt for indices.

In this fix, we change the expected behavior of extractelement's index, moving from SExt to ZExt.
This change includes both documentation, SelectionDAG and IRTranslator.
We also included a test for AMDGPU, updated tests for AArch64, Mips, PowerPC, RISCV, VE, WebAssembly and X86

This patch fixes issue #57452.

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

21 months ago[libc++] Improve error message for invalid allocators
Nikolas Klauser [Wed, 12 Oct 2022 18:24:04 +0000 (20:24 +0200)]
[libc++] Improve error message for invalid allocators

Reviewed By: ldionne, #libc

Spies: libcxx-commits, rupprecht

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

21 months ago[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}
Kazu Hirata [Sat, 15 Oct 2022 22:06:37 +0000 (15:06 -0700)]
[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}

This patch introduces:

  StringRef::starts_with
  StringRef::starts_with_insensitive
  StringRef::ends_with
  StringRef::ends_with_insensitive

to be more compatible with std::string and std::string_view.

I'm planning to deprecate the existing functions in favor of the new
ones.

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

21 months ago[clangd] Use std::decay_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 21:59:23 +0000 (14:59 -0700)]
[clangd] Use std::decay_t (NFC)

21 months ago[Vectorize] Use std::conditional_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 21:52:25 +0000 (14:52 -0700)]
[Vectorize] Use std::conditional_t (NFC)

21 months ago[ADT] Simplify getAsInteger and consumeInteger (NFC)
Kazu Hirata [Sat, 15 Oct 2022 21:08:01 +0000 (14:08 -0700)]
[ADT] Simplify getAsInteger and consumeInteger (NFC)

This patch replaces the std::enable_if_t trick with a "constexpr if"
so that the resulting code looks more like "normal" C++ code.

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

21 months ago[Driver] Remove legacy cc1 alias -mlink-cuda-bitcode
Fangrui Song [Sat, 15 Oct 2022 21:02:13 +0000 (14:02 -0700)]
[Driver] Remove legacy cc1 alias -mlink-cuda-bitcode

r340193 added -mlink-builtin-bitcode as the canonical spelling.

21 months ago[ConstraintElim] Support unsigned decomposition of mul/shl nuw..const
Florian Hahn [Sat, 15 Oct 2022 20:28:07 +0000 (21:28 +0100)]
[ConstraintElim] Support unsigned decomposition of mul/shl nuw..const

Support decomposition for `mul/shl nuw` with constant operand for unsigned
queries. Those expressions should not wrap in the unsigned sense and can
be added directly to the unsigned system.

21 months ago[clang] Track the templated entity in type substitution.
Matheus Izvekov [Sun, 14 Aug 2022 11:48:18 +0000 (13:48 +0200)]
[clang] Track the templated entity in type substitution.

This is a change to how we represent type subsitution in the AST.
Instead of only storing the replaced type, we track the templated
entity we are substituting, plus an index.
We modify MLTAL to track the templated entity at each level.

Otherwise, it's much more expensive to go from the template parameter back
to the templated entity, and not possible to do in some cases, as when
we instantiate outer templates, parameters might still reference the
original entity.

This also allows us to very cheaply lookup the templated entity we saw in
the naming context and find the corresponding argument it was replaced
from, such as for implementing template specialization resugaring.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D131858

21 months ago[clang] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:50:34 +0000 (12:50 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/Sema/SemaLambda.cpp:922:39: warning: suggest parentheses
  around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[clang] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:48:23 +0000 (12:48 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/Basic/SourceManager.cpp:2131:72: warning: suggest
  parentheses around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[Object] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:43:12 +0000 (12:43 -0700)]
[Object] Fix a warning

This patch fixes:

  llvm/lib/Object/XCOFFObjectFile.cpp:1001:20: warning: suggest
  parentheses around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[mlir] Fix warnings
Kazu Hirata [Sat, 15 Oct 2022 19:40:02 +0000 (12:40 -0700)]
[mlir] Fix warnings

This patch fixes:

  mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp:171:30:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

  mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp:283:30:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

21 months ago[lldb] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:32:20 +0000 (12:32 -0700)]
[lldb] Fix a warning

This patch fixes:

  lldb/source/Commands/CommandObjectThread.cpp:66:61: warning:
  comparison of unsigned expression in ‘< 0’ is always false
  [-Wtype-limits]

21 months ago[llvm-reduce] Fix a warning
Kazu Hirata [Sat, 15 Oct 2022 19:28:11 +0000 (12:28 -0700)]
[llvm-reduce] Fix a warning

This patch fixes:

  llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp:96:21: warning:
  unused variable ‘Op’ [-Wunused-variable]

21 months ago[llvm] Remove redundaunt typename (NFC)
Kazu Hirata [Sat, 15 Oct 2022 19:11:59 +0000 (12:11 -0700)]
[llvm] Remove redundaunt typename (NFC)

21 months ago[mlir] Use std::underlying_type_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 19:11:58 +0000 (12:11 -0700)]
[mlir] Use std::underlying_type_t (NFC)

21 months ago[lldb] Use std::underlying_type_t (NFC)
Kazu Hirata [Sat, 15 Oct 2022 19:11:56 +0000 (12:11 -0700)]
[lldb] Use std::underlying_type_t (NFC)

21 months ago[ConstraintElim] Support signed decomposition of `add nsw`.
Florian Hahn [Sat, 15 Oct 2022 17:34:02 +0000 (18:34 +0100)]
[ConstraintElim] Support signed decomposition of `add nsw`.

Add support decomposition for `add nsw` for signed queries.
`add nsw` won't wrap and can be directly added to the signed
system.

21 months ago[Mips] Regenerate unalignedload.ll
Simon Pilgrim [Sat, 15 Oct 2022 17:29:54 +0000 (18:29 +0100)]
[Mips] Regenerate unalignedload.ll

21 months ago[Mips] Regenerate return-struct.ll
Simon Pilgrim [Sat, 15 Oct 2022 17:21:45 +0000 (18:21 +0100)]
[Mips] Regenerate return-struct.ll

21 months ago[Mips] Regenerate load-store-left-right.ll
Simon Pilgrim [Sat, 15 Oct 2022 17:20:26 +0000 (18:20 +0100)]
[Mips] Regenerate load-store-left-right.ll

21 months ago[libc][cleanup] Docs clean up
Jeff Bailey [Sat, 15 Oct 2022 12:44:02 +0000 (12:44 +0000)]
[libc][cleanup] Docs clean up

 * Make consistent heading names
 * Factor out |check| into an include for reuse
 * Use it everywhere (No more YES or UTF-8)
 * Remove unneeded summary from pages. People know why they're there.
 * Ensure source location headers everywhere.

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

21 months ago[clang] Fix func-attr.c test
Yi Kong [Sat, 15 Oct 2022 14:10:53 +0000 (23:10 +0900)]
[clang] Fix func-attr.c test

The test was introduced by 84a9ec2ff1ee. The check is over-specific and
is broken on the Android buildbot. Fixed by relaxing the variable name
check.

21 months ago[LoongArch] Fix wrong VariantKind for MO_GOT_PC_{HI/LO} flags
wanglei [Sat, 15 Oct 2022 09:44:40 +0000 (17:44 +0800)]
[LoongArch] Fix wrong VariantKind for MO_GOT_PC_{HI/LO} flags

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

21 months ago[mlir][vector] Add a name prefix to tablegen for IteratorType in Vector dialect.
Oleg Shyshkov [Sat, 15 Oct 2022 07:01:29 +0000 (07:01 +0000)]
[mlir][vector] Add a name prefix to tablegen for IteratorType in Vector dialect.

Otherwise there is a risk of a name collision with IteratorType attributes in other dialect.

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

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. This fixes the problem
introduced by 0fb2aeef5310eaba2915b30810464a744a80da15

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

21 months ago[objcopy][MachO] Clean up Section ctors, NFC
Alexander Shaposhnikov [Fri, 14 Oct 2022 22:37:35 +0000 (22:37 +0000)]
[objcopy][MachO] Clean up Section ctors, NFC

21 months ago[mlir:ODS] Disambiguate getContext call for the rare case of the op having an input...
Benjamin Kramer [Fri, 14 Oct 2022 23:56:01 +0000 (01:56 +0200)]
[mlir:ODS] Disambiguate getContext call for the rare case of the op having an input called context

21 months ago[VE] Change the way to lower select
Kazushi (Jam) Marukawa [Thu, 13 Oct 2022 14:11:48 +0000 (23:11 +0900)]
[VE] Change the way to lower select

Change to use VEISD::CMOV in combineSelect for better optimization.
Support VEISD::CMOV in combineTRUNCATE also to optimize trancate.
Merge functions to handle condition codes to VE.h.  And add basic
CMOV patterns to VEInstrInfo.td.  Update regression tests also.

Reviewed By: efocht

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

21 months ago[Hexagon] Clean up leftover instructions in HvxIdioms
Krzysztof Parzyszek [Fri, 14 Oct 2022 23:42:42 +0000 (16:42 -0700)]
[Hexagon] Clean up leftover instructions in HvxIdioms

Quick and dirty fix, because this is causing one builder to fail.

21 months ago[mlir][llvm] NoSideEffect -> Pure (NFC)
Jeff Niu [Fri, 14 Oct 2022 23:29:12 +0000 (16:29 -0700)]
[mlir][llvm] NoSideEffect -> Pure (NFC)

21 months ago[mlir][llvm] Add `llvm.intr.is.fpclass`
Jeff Niu [Fri, 14 Oct 2022 16:00:01 +0000 (09:00 -0700)]
[mlir][llvm] Add `llvm.intr.is.fpclass`

This intrinsic allows testing for inf, nan, etc. on floating point
values.

Reviewed By: rriddle

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

21 months ago[mlir][vector] Add distribution for extract from 0d vector
Thomas Raoux [Fri, 14 Oct 2022 23:04:24 +0000 (23:04 +0000)]
[mlir][vector] Add distribution for extract from 0d vector

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

21 months ago[mlir:ODS] Generate unwrapped operation attribute setters
River Riddle [Thu, 13 Oct 2022 01:01:03 +0000 (18:01 -0700)]
[mlir:ODS] Generate unwrapped operation attribute setters

This allows for setting an attribute using the underlying C++ type,
which is generally much nicer to interact with than the attribute type.

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

21 months ago[lldb][Breakpoint] Fix setting breakpoints on templates by basename
Michael Buch [Thu, 13 Oct 2022 21:20:23 +0000 (22:20 +0100)]
[lldb][Breakpoint] Fix setting breakpoints on templates by basename

This patch fixes a regression with setting breakpoints on template
functions by name. E.g.,:
```
$ cat main.cpp
template<typename T>
struct Foo {
  template<typename U>
  void func() {}
};

int main() {
  Foo<int> f;
  f.func<double>();
}

(lldb) br se -n func
```

This has regressed since `3339000e0bda696c2e29173d15958c0a4978a143`
where we started using the `CPlusPlusNameParser` for getting the
basename of the function symbol and match it exactly against
the name in the breakpoint command. The parser will include template
parameters in the basename, so the exact match will always fail

**Testing**

* Added API tests
* Added unit-tests

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

21 months ago[github] Fix minor lint warnings (NFC)
Keith Smiley [Sun, 9 Oct 2022 05:34:34 +0000 (22:34 -0700)]
[github] Fix minor lint warnings (NFC)

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

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