platform/upstream/llvm.git
2 years ago[libc++] Use unsigned char in basic_string::__short again
Nikolas Klauser [Sat, 11 Jun 2022 21:43:00 +0000 (23:43 +0200)]
[libc++] Use unsigned char in basic_string::__short again

D125496 changed the string layout on windows. Change `__is_long_` and `__size_` back to using `unsigned char` to fix the issue.

Reviewed By: Mordante, #libc

Spies: jloser, libcxx-commits, ayzhao

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

2 years agofix test expected output (fixes arm buildbot failure) [NFC]
Nuno Lopes [Sun, 12 Jun 2022 18:29:00 +0000 (19:29 +0100)]
fix test expected output (fixes arm buildbot failure) [NFC]

2 years ago[DAG] Enable ISD::FSHL/R SimplifyMultipleUseDemandedBits handling inside SimplifyDema...
Simon Pilgrim [Sun, 12 Jun 2022 17:56:24 +0000 (18:56 +0100)]
[DAG] Enable ISD::FSHL/R SimplifyMultipleUseDemandedBits handling inside SimplifyDemandedBits

This patch allows SimplifyDemandedBits to call SimplifyMultipleUseDemandedBits in cases where the source operand has other uses, enabling us to peek through the shifted value if we don't demand all the bits/elts.

This helps with several of the regressions from D125836

2 years ago[clang][CodeGen] Switch a few placeholders from UndefValue to PoisonValue
Nuno Lopes [Sun, 12 Jun 2022 18:03:47 +0000 (19:03 +0100)]
[clang][CodeGen] Switch a few placeholders from UndefValue to PoisonValue
This change is cosmetic, as these are dummy values that are not observable, but it
gets us closer to removing undef.
NFC

2 years ago[RISCV] Move some methods out of RISCVInstrInfo and into RISCV namespace.
Craig Topper [Sun, 12 Jun 2022 17:38:29 +0000 (10:38 -0700)]
[RISCV] Move some methods out of RISCVInstrInfo and into RISCV namespace.

These methods don't access any state from RISCVInstrInfo. Make them
free functions in the RISCV namespace.

Reviewed By: frasercrmck

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

2 years ago[IR] Call DenseMap::erase directly (NFC)
Kazu Hirata [Sun, 12 Jun 2022 17:47:06 +0000 (10:47 -0700)]
[IR] Call DenseMap::erase directly (NFC)

We can erase an item in DenseMap without checking its membership first.

2 years ago[clang] Use any_of and none_of (NFC)
Kazu Hirata [Sun, 12 Jun 2022 17:17:12 +0000 (10:17 -0700)]
[clang] Use any_of and none_of (NFC)

2 years ago[SimplifyCFG,EarlyCSE] Update 2 tests to not branch on undef (NFC).
Florian Hahn [Sun, 12 Jun 2022 17:03:26 +0000 (18:03 +0100)]
[SimplifyCFG,EarlyCSE] Update 2 tests to not branch on undef (NFC).

2 years ago[LV] Update test to use GEP so it is not dead.
Florian Hahn [Sun, 12 Jun 2022 15:57:47 +0000 (16:57 +0100)]
[LV] Update test to use GEP so it is not dead.

The test should use the GEP for the store, so it is not dead.

2 years agoRevert "[X86][RFC] Enable `_Float16` type support on X86 following the psABI"
Mehdi Amini [Sun, 12 Jun 2022 15:14:37 +0000 (15:14 +0000)]
Revert "[X86][RFC] Enable `_Float16` type support on X86 following the psABI"

This reverts commit 2d2da259c8726fd5c974c01122a9689981a12196.

This breaks MLIR integration test (JIT crashing), reverting in the
meantime.

2 years agoRevert "[MC] Omit DWARF unwind info if compact unwind is present where eligible"
Jez Ng [Sun, 12 Jun 2022 14:46:49 +0000 (10:46 -0400)]
Revert "[MC] Omit DWARF unwind info if compact unwind is present where eligible"

This reverts commit ef501bf85d8c869248e51371f0e74bcec0e7b229.

2 years ago[X86] combineConcatVectorOps - add support for concatenation of VSELECT/BLENDV nodes...
Simon Pilgrim [Sun, 12 Jun 2022 14:40:24 +0000 (15:40 +0100)]
[X86] combineConcatVectorOps - add support for concatenation of VSELECT/BLENDV nodes (REAPPLIED)

If the LHS/RHS selection operands can be cheaply concatenated back together then replace 2 x 128-bit selection nodes with 1 x 256-bit node

Addresses the regression introduced in the bug fix from rGd5af6a38082b39ae520a328e44dc29ebcb036bb2

REAPPLIED with for bug identified in rGea8fb3b60196

2 years ago[X86] Add regression test for rGea8fb3b60196
Simon Pilgrim [Sun, 12 Jun 2022 14:27:11 +0000 (15:27 +0100)]
[X86] Add regression test for rGea8fb3b60196

Reduced from test case reported by @srj for the concatenation of VSELECT/BLENDV nodes

2 years ago[NFC] Remove 'br i1 undef' from SROA tests
Nuno Lopes [Sun, 12 Jun 2022 14:29:59 +0000 (15:29 +0100)]
[NFC] Remove 'br i1 undef' from SROA tests

2 years agoFix endian conversion of sub-byte types
Ulrich Weigand [Sun, 12 Jun 2022 14:03:30 +0000 (16:03 +0200)]
Fix endian conversion of sub-byte types

When convertEndianOfCharForBEmachine is called with elementBitWidth
smaller than CHAR_BIT, the default case is invoked, but this does
nothing at all and leaves the output array unchanged.

Fix DenseIntOrFPElementsAttr::convertEndianOfArrayRefForBEmachine
by not calling convertEndianOfCharForBEmachine in this case, and
instead simply copying the input to the output (for sub-byte types,
endian conversion is in fact a no-op).

Reviewed By: rriddle

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

2 years ago[MC] Omit DWARF unwind info if compact unwind is present where eligible
Jez Ng [Sun, 12 Jun 2022 14:03:56 +0000 (10:03 -0400)]
[MC] Omit DWARF unwind info if compact unwind is present where eligible

Previously, omitting unnecessary DWARF unwinds was only done in two
cases:
* For Darwin + aarch64, if no DWARF unwind info is needed for all the
  functions in a TU, then the `__eh_frame` section would be omitted
  entirely. If any one function needed DWARF unwind, then MC would emit
  DWARF unwind entries for all the functions in the TU.
* For watchOS, MC would omit DWARF unwind on a per-function basis, as
  long as compact unwind was available for that function.

This diff makes it so that we omit DWARF unwind on a per-function basis
for Darwin + aarch64 as well. In addition, we introduce the flag
`--emit-dwarf-unwind=` which can toggle between `always`,
`no-compact-unwind` (only emit DWARF when CU cannot be emitted for a
given function), and the target platform `default`.  `no-compact-unwind`
is particularly useful for newer x86_64 platforms: we don't want to omit
DWARF unwind for x86_64 in general due to possible backwards compat
issues, but we should make it possible for people to opt into this
behavior if they are only targeting newer platforms.

**Motivation:** I'm working on adding support for `__eh_frame` to LLD,
but I'm concerned that we would suffer a perf hit. Processing compact
unwind is already expensive, and that's a simpler format than EH frames.
Given that MC currently produces one EH frame entry for every compact
unwind entry, I don't think processing them will be cheap. I tried to do
something clever on LLD's end to drop the unnecessary EH frames at parse
time, but this made the code significantly more complex. So I'm looking
at fixing this at the MC level instead.

**Addendum:** It turns out that there was a latent bug in the X86
backend when `OmitDwarfIfHaveCompactUnwind` is naively enabled, which is
not too surprising given that this combination has not been heretofore
used.

For functions that have unwind info that cannot be encoded with CU, MC
would end up dropping both the compact unwind entry (OK; existing
behavior) as well as the DWARF entries (not OK).  This diff fixes things
so that we emit the DWARF entry, as well as a CU entry with encoding
`UNWIND_X86_MODE_DWARF` -- this basically tells the unwinder to look for
the DWARF entry. I'm not 100% sure the `UNWIND_X86_MODE_DWARF` CU entry
is necessary, this was the simplest fix. ld64 seems to be able to handle
both the absence and presence of this CU entry. Ultimately ld64 (and
LLD) will synthesize `UNWIND_X86_MODE_DWARF` if it is absent, so there
is no impact to the final binary size.

Reviewed By: davide, lhames

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

2 years ago[docs][clang] Fix a broken link on the APINotes doc
Yuki Okushi [Sat, 28 May 2022 16:59:56 +0000 (01:59 +0900)]
[docs][clang] Fix a broken link on the APINotes doc

This patch replaces a link with a GitHub one.

Fixes llvm#55748

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

2 years ago[DAG] visitSRL - pull out ShiftVT. NFC.
Simon Pilgrim [Sun, 12 Jun 2022 13:02:23 +0000 (14:02 +0100)]
[DAG] visitSRL - pull out ShiftVT. NFC.

2 years ago[AArch64] Look through bitcast when looking for extract_high subvector
David Green [Sun, 12 Jun 2022 09:59:09 +0000 (10:59 +0100)]
[AArch64] Look through bitcast when looking for extract_high subvector

Since D61806, DAGCombiner has folded subvector_extract(bitcast(..)) to
bitcast(subvector_extract(..)), which would place a bitcast between a
subvector_extract and the operation that could be converted to a high
neon instruction (like smull2). This adds better matching for the
subvector_extract, through the tablegen extract_high PatFrags to
optionally skip the bitcast under little ending, still matchings an
extract of the high half of the input vector.

I didn't update the extract_high of a duplicate patterns, as the
ComplexPattern need names operands. I did add a extract_high_dup_v8i16
PatFrag to abstract away the common code, which can be extended in a
future patch.

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

2 years ago[X86][RFC] Enable `_Float16` type support on X86 following the psABI
Phoebe Wang [Sat, 11 Jun 2022 15:19:25 +0000 (23:19 +0800)]
[X86][RFC] Enable `_Float16` type support on X86 following the psABI

GCC and Clang/LLVM will support `_Float16` on X86 in C/C++, following
the latest X86 psABI. (https://gitlab.com/x86-psABIs)

_Float16 arithmetic will be performed using native half-precision. If
native arithmetic instructions are not available, it will be performed
at a higher precision (currently always float) and then truncated down
to _Float16 immediately after each single arithmetic operation.

Reviewed By: LuoYuanke

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

2 years agoRevert "[lit] Passthrough CLANG_MODULE_CACHE_PATH env var"
Alex Brachet [Sun, 12 Jun 2022 03:01:08 +0000 (03:01 +0000)]
Revert "[lit] Passthrough CLANG_MODULE_CACHE_PATH env var"

This reverts commit 6466c9abf3674bade1f6ee859f24ebc7aaf9cd88.

2 years ago[LoongArch] clang-format some code in LoongArchISelLowering.cpp. NFC
Weining Lu [Sun, 12 Jun 2022 02:41:56 +0000 (10:41 +0800)]
[LoongArch] clang-format some code in LoongArchISelLowering.cpp. NFC

2 years ago[LoongArch] Remove unnecessary `static` keyword as `const` has internal linkage. NFC
Weining Lu [Sun, 12 Jun 2022 02:03:04 +0000 (10:03 +0800)]
[LoongArch] Remove unnecessary `static` keyword as `const` has internal linkage. NFC

See https://reviews.llvm.org/D127199#inline-1222815

2 years agoAutogenerate sve-fixed-length-frame-offests-crash.ll . NFC
Amaury Séchet [Sun, 12 Jun 2022 01:54:10 +0000 (01:54 +0000)]
Autogenerate sve-fixed-length-frame-offests-crash.ll . NFC

2 years agoAutogenerate sve-fixed-length-bitselect.ll . NFC
Amaury Séchet [Sun, 12 Jun 2022 01:50:41 +0000 (01:50 +0000)]
Autogenerate sve-fixed-length-bitselect.ll . NFC

2 years ago[Clang][VE][NFC] Fix a comment
Kazushi (Jam) Marukawa [Sun, 12 Jun 2022 01:26:55 +0000 (10:26 +0900)]
[Clang][VE][NFC] Fix a comment

2 years ago[lld-macho] Add support for -w
Keith Smiley [Sat, 11 Jun 2022 07:10:48 +0000 (00:10 -0700)]
[lld-macho] Add support for -w

This flag suppresses warnings produced by the linker. In ld64 this has
an interesting interaction with -fatal_warnings, it silences the
warnings but the link still fails. Instead of doing that here we still
print the warning and eagerly fail the link in case both are passed,
this seems more reasonable so users can understand why the link fails.

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

2 years ago[libc++][test] Add tuple trivial destructor test
Joe Loser [Sun, 12 Jun 2022 00:11:04 +0000 (18:11 -0600)]
[libc++][test] Add tuple trivial destructor test

There is only compile-time tests in `dtor.pass.cpp`, so it could be made a
`dtor.compile.pass.cpp`. Instead, add a runtime test for testing the trivial
destructor behavior for `tuple`.

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

2 years agofix comment typo to cycle bots
Nico Weber [Sat, 11 Jun 2022 22:55:40 +0000 (18:55 -0400)]
fix comment typo to cycle bots

2 years ago[VPlan] Remove dead OrigLoop argument from removeDeadRecipes (NFC).
Florian Hahn [Sat, 11 Jun 2022 22:33:04 +0000 (23:33 +0100)]
[VPlan] Remove dead OrigLoop argument from removeDeadRecipes (NFC).

The use of the argument has been remove a while ago. Remove the dead
argument.

2 years ago[InstCombine] Remove unnecessary UB from some tests.
Florian Hahn [Sat, 11 Jun 2022 22:22:48 +0000 (23:22 +0100)]
[InstCombine] Remove unnecessary UB from some tests.

2 years ago[lit] Passthrough CLANG_MODULE_CACHE_PATH env var
Alex Brachet [Sat, 11 Jun 2022 21:04:02 +0000 (21:04 +0000)]
[lit] Passthrough CLANG_MODULE_CACHE_PATH env var

This environment variable can be set to control module
caching. It disables caching by setting the variable
empty. As such, it needs to be handled differently
from other environment variables here which are
assumed to not be empty.

2 years ago[DAG] visitVECTOR_SHUFFLE - fold splat(insert_vector_elt()) and splat(scalar_to_vecto...
Simon Pilgrim [Sat, 11 Jun 2022 20:06:37 +0000 (21:06 +0100)]
[DAG] visitVECTOR_SHUFFLE - fold splat(insert_vector_elt()) and splat(scalar_to_vector()) to build_vector splats

Addresses a number of regressions identified in D127115

2 years ago[libc++][test] Refactor SmallBasicString uses in range.lazy.split tests
Joe Loser [Sun, 29 May 2022 01:08:25 +0000 (19:08 -0600)]
[libc++][test] Refactor SmallBasicString uses in range.lazy.split tests

The tests for `std::ranges::lazy_split_view` heavily use a wrapper class around
`std::string` because `std::string` was not `constexpr` until recently. Where
possible, remove the wrapper class and extra functionality no longer needed.
Remove `libcxx/test/std/ranges/range.adaptors/range.lazy.split/small_string.h`
and inline its one use remaining in
`libcxx/test/std/ranges/range.adaptors/range.lazy.split/general.pass.cpp`.

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

2 years ago[clang-tidy][docs] Remove an unintentional paragraph break
Dmitri Gribenko [Fri, 10 Jun 2022 23:43:27 +0000 (01:43 +0200)]
[clang-tidy][docs] Remove an unintentional paragraph break

2 years ago[clang-tidy][docs] Use std::optional instead of absl::optional in examples
Dmitri Gribenko [Fri, 10 Jun 2022 23:41:10 +0000 (01:41 +0200)]
[clang-tidy][docs] Use std::optional instead of absl::optional in examples

The standard type is vastly more popular than the Abseil polyfill, so it
makes more sense to use it in documentation, even though the checker
actually understands both (and that fact is documented already).

2 years ago[BOLT][NFC] Move printDebugInfo out of BC::printInstruction
Amir Ayupov [Sat, 11 Jun 2022 18:58:10 +0000 (11:58 -0700)]
[BOLT][NFC] Move printDebugInfo out of BC::printInstruction

Simplify `BinaryContext::printInstruction`.

Reviewed By: ayermolo

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

2 years ago[llvm] Use contains (NFC)
Kazu Hirata [Sat, 11 Jun 2022 18:46:16 +0000 (11:46 -0700)]
[llvm] Use contains (NFC)

2 years ago[X86][AVX512] Retain pmuldq broadcast loads on 32-bit targets
Simon Pilgrim [Sat, 11 Jun 2022 18:29:56 +0000 (19:29 +0100)]
[X86][AVX512] Retain pmuldq broadcast loads on 32-bit targets

Don't demand just the lower 32-bits on 32-bit AVX512 targets to preserve 64-bit broadcast loads patterns

2 years ago[X86][AVX512] Add tests showing failure to retain pmuldq broadcast loads on 32-bit...
Simon Pilgrim [Sat, 11 Jun 2022 17:48:26 +0000 (18:48 +0100)]
[X86][AVX512] Add tests showing failure to retain pmuldq broadcast loads on 32-bit targets

Noticed while investigating the build vector issues on D127115

2 years ago[DAG] visitINSERT_VECTOR_ELT - add <1 x ???> insert_vector_elt(v0,extract_vector_elt...
Simon Pilgrim [Sat, 11 Jun 2022 14:54:54 +0000 (15:54 +0100)]
[DAG] visitINSERT_VECTOR_ELT - add <1 x ???> insert_vector_elt(v0,extract_vector_elt(v1,0),0) special case handling

Check if we're just replacing one v1x?? vector with another

2 years agoUse getValueOr (NFC)
Kazu Hirata [Sat, 11 Jun 2022 18:24:57 +0000 (11:24 -0700)]
Use getValueOr (NFC)

2 years agoUse isa instead of dyn_cast (NFC)
Kazu Hirata [Sat, 11 Jun 2022 18:15:52 +0000 (11:15 -0700)]
Use isa instead of dyn_cast (NFC)

2 years ago[lldb][bindings] Implement __repr__ instead of __str__
Dave Lee [Thu, 9 Jun 2022 15:37:02 +0000 (08:37 -0700)]
[lldb][bindings] Implement __repr__ instead of __str__

When using the `script` Python repl, SB objects are printed in a way that gives
the user no information. The simplest example is:

```
(lldb) script lldb.debugger
<lldb.SBDebugger; proxy of <Swig Object of type 'lldb::SBDebugger *' at 0x1097a5de0> >
```

This output comes from the Python repl printing the `repr()` of an object.

None of the SB classes implement `__repr__`, and all print like the above.
However, many (most?, all?) SB classes implement `__str__`. Because they
implement `__str__`, a more detailed output can be had by `print`ing the
object, for example:

```
(lldb) script print(lldb.debugger)
Debugger (instance: "debugger_1", id: 1)
```

For convenience, this change switches all SB classes that implement to
`__str__` to instead implement `__repr__`. **The result is that `str()` and
`repr()` will produce the same output**. This is because `str` calls `__repr__`
for classes that have  no `__str__` method.

The benefit being that when writing a `script` invocation, you don't need to
remember to wrap in `print()`. If that isn't enough motivation, consider the
case where your Python expression results in a list of SB objects, in that case
you'd have to `map` or use a list comprehension like `[str(x) for x in <expr>]`
in order to see the details of the objects in the list.

For reference, the docs for `repr` say:

> repr(object)
>   Return a string containing a printable representation of an object. For
>   many types, this function makes an attempt to return a string that would
>   yield an object with the same value when passed to eval(); otherwise, the
>   representation is a string enclosed in angle brackets that contains the
>   name of the type of the object together with additional information often
>   including the name and address of the object. A class can control what this
>   function returns for its instances by defining a __repr__() method.

and the docs for `__repr__` say:

> object.__repr__(self)
>   Called by the repr() built-in function to compute the “official” string
>   representation of an object. If at all possible, this should look like a
>   valid Python expression that could be used to recreate an object with the
>   same value (given an appropriate environment). If this is not possible, a
>   string of the form <...some useful description...> should be returned. The
>   return value must be a string object. If a class defines __repr__() but not
>   __str__(), then __repr__() is also used when an “informal” string
>   representation of instances of that class is required.
>
>   This is typically used for debugging, so it is important that the
>   representation is information-rich and unambiguous.

Even if it were convenient to construct Python expressions for SB classes so
that they could be `eval`'d, however for typical lldb usage, I can't think of a
motivating reason to do so. As it stands, the only action the docs say to do,
that this change doesn't do, is wrap the `repr` string in `<>` angle brackets.

An alternative implementation is to change lldb's python repl to apply `str()`
to the top level result. While this would work well in the case of a single SB
object, it doesn't work for a list of SB objects, since `str([x])` uses `repr`
to convert each list element to a string.

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

2 years ago[mlir:MultiOpDriver] Add operands to worklist should be checked
Chia-hung Duan [Sat, 11 Jun 2022 15:56:21 +0000 (15:56 +0000)]
[mlir:MultiOpDriver] Add operands to worklist should be checked

Operand's defining op may not be valid for adding to the worklist under
stict mode

Reviewed By: rriddle

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

2 years ago[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound...
Craig Topper [Sat, 11 Jun 2022 15:28:41 +0000 (08:28 -0700)]
[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals

This had previously been fixed, but was lost 4 years ago when __extension__
was removed from many intrinsic macros.

Refixes PR32491.

2 years ago[Clang][Doc][SafeStack] Fix deadlink (NFC)
ksyx [Sat, 11 Jun 2022 14:59:51 +0000 (10:59 -0400)]
[Clang][Doc][SafeStack] Fix deadlink (NFC)

2 years ago[DAG] visitINSERT_VECTOR_ELT - fold insert_vector_elt(scalar_to_vector(x),v,i) -...
Simon Pilgrim [Sat, 11 Jun 2022 14:29:18 +0000 (15:29 +0100)]
[DAG] visitINSERT_VECTOR_ELT - fold insert_vector_elt(scalar_to_vector(x),v,i) -> build_vector()

Allow scalar_to_vector nodes to be used for the start of a build_vector creation

2 years ago[libc++][NFC] Update ranges algorithms status page
Nikolas Klauser [Sat, 11 Jun 2022 14:20:47 +0000 (16:20 +0200)]
[libc++][NFC] Update ranges algorithms status page

2 years ago[PowerPC] Regenerate pre-inc-disable.ll checks
Simon Pilgrim [Sat, 11 Jun 2022 14:12:45 +0000 (15:12 +0100)]
[PowerPC] Regenerate pre-inc-disable.ll checks

2 years ago[X86] Replace X32 check prefix with X86
Simon Pilgrim [Sat, 11 Jun 2022 13:30:27 +0000 (14:30 +0100)]
[X86] Replace X32 check prefix with X86

We try to use X32 only for gnux32 triple cases

2 years ago[libc++][format] Implement format-string.
Mark de Wever [Sat, 2 Oct 2021 10:38:46 +0000 (12:38 +0200)]
[libc++][format] Implement format-string.

Implements the compile-time checking of the formatting arguments.

Completes:
- P2216 std::format improvements

Reviewed By: #libc, ldionne

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

2 years ago[AArch64] Generate FADDP from shuffled fadd
David Green [Sat, 11 Jun 2022 13:16:37 +0000 (14:16 +0100)]
[AArch64] Generate FADDP from shuffled fadd

As a follow up to D126686, this does the same fold for floating point
add and shuffle. In this case it is limited to reassoc either x[0]+x[1]
or x[1]+x[0] for both result[0] and results[1].

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

2 years ago[AArch64] Add extra faddp codegen tests. NFC
David Green [Sat, 11 Jun 2022 11:57:48 +0000 (12:57 +0100)]
[AArch64] Add extra faddp codegen tests. NFC

2 years ago[DAG] visitINSERT_VECTOR_ELT - refactor BUILD_VECTOR insertion to remove early-out...
Simon Pilgrim [Sat, 11 Jun 2022 11:01:13 +0000 (12:01 +0100)]
[DAG] visitINSERT_VECTOR_ELT - refactor BUILD_VECTOR insertion to remove early-out. NFCI.

Remove the early-out cases so we can more easily add additional folds in the future.

2 years ago[SelectionDAG] Remove invalid TypeSize conversion from WidenVecOp_BITCAST.
Paul Walker [Mon, 6 Jun 2022 03:07:52 +0000 (04:07 +0100)]
[SelectionDAG] Remove invalid TypeSize conversion from WidenVecOp_BITCAST.

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

2 years ago[clang][docs] Fix typo in code-block declaration
Simon Pilgrim [Sat, 11 Jun 2022 08:28:38 +0000 (09:28 +0100)]
[clang][docs] Fix typo in code-block declaration

2 years ago[X86] combineTargetShuffle - break if-else chain. NFC.
Simon Pilgrim [Thu, 9 Jun 2022 21:18:23 +0000 (22:18 +0100)]
[X86] combineTargetShuffle - break if-else chain. NFC.

(style) Both cases always continue.

2 years ago[X86] emitOrXorXorTree - break if-else chain. NFC.
Simon Pilgrim [Thu, 9 Jun 2022 21:15:08 +0000 (22:15 +0100)]
[X86] emitOrXorXorTree - break if-else chain. NFC.

(style) Both cases always return.

2 years ago[clang-format] Fix a bug in RemoveBracesLLVM
owenca [Fri, 10 Jun 2022 20:01:27 +0000 (13:01 -0700)]
[clang-format] Fix a bug in RemoveBracesLLVM

Remove the braces of an else block only if the r_brace of the block
is followed by an if.

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

2 years ago[NFC][clang] Fix typo
Sheng [Sat, 11 Jun 2022 07:59:05 +0000 (15:59 +0800)]
[NFC][clang] Fix typo

Change 'otuer' to 'outer'.

2 years ago[github] format and refactor GitHub workflows
Mohammed Keyvanzadeh [Mon, 9 May 2022 01:02:26 +0000 (05:32 +0430)]
[github] format and refactor GitHub workflows

Format and refactor the GitHub workflow for consistency.

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

2 years ago[Scalar] Use llvm::append_range (NFC)
Kazu Hirata [Sat, 11 Jun 2022 06:09:01 +0000 (23:09 -0700)]
[Scalar] Use llvm::append_range (NFC)

2 years ago[CodeGen] Use llvm::erase_value (NFC)
Kazu Hirata [Sat, 11 Jun 2022 05:59:48 +0000 (22:59 -0700)]
[CodeGen] Use llvm::erase_value (NFC)

2 years ago[ProfileData] Use llvm::erase_if (NFC)
Kazu Hirata [Sat, 11 Jun 2022 05:51:30 +0000 (22:51 -0700)]
[ProfileData] Use llvm::erase_if (NFC)

2 years ago[MC] De-capitalize SwitchSection. NFC
Fangrui Song [Sat, 11 Jun 2022 05:50:55 +0000 (22:50 -0700)]
[MC] De-capitalize SwitchSection. NFC

Add SwitchSection to return switchSection. The API will be removed soon.

2 years ago[clang] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Sat, 11 Jun 2022 05:45:26 +0000 (22:45 -0700)]
[clang] Construct SmallVector with iterator ranges (NFC)

2 years ago[clang] Convert for_each to range-based for loops (NFC)
Kazu Hirata [Sat, 11 Jun 2022 05:39:45 +0000 (22:39 -0700)]
[clang] Convert for_each to range-based for loops (NFC)

2 years ago[libc] Add pthread_detach and thrd_detach.
Siva Chandra Reddy [Sat, 4 Jun 2022 14:33:49 +0000 (14:33 +0000)]
[libc] Add pthread_detach and thrd_detach.

Tests for pthread_detach and thrd_detach have not been added. Instead, a
test for the underlying implementation has been added as it makes use of
an internal wait method to synchronize with detached threads.

Reviewed By: lntue, michaelrj

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

2 years ago[PowerPC] Add tests to reflect cfence on float point types. NFC.
Kai Luo [Sat, 11 Jun 2022 04:10:21 +0000 (12:10 +0800)]
[PowerPC] Add tests to reflect cfence on float point types. NFC.

2 years ago[SanitizerCoverage][test] Remove br i1 undef to avoid UB
Fangrui Song [Sat, 11 Jun 2022 03:40:34 +0000 (20:40 -0700)]
[SanitizerCoverage][test] Remove br i1 undef to avoid UB

2 years ago[GlobalOpt][test] Remove br i1 undef
Fangrui Song [Sat, 11 Jun 2022 03:36:22 +0000 (20:36 -0700)]
[GlobalOpt][test] Remove br i1 undef

2 years ago[NFC] Move flang OpenMP semantic tests under one single directory
PeixinQiao [Sat, 11 Jun 2022 02:46:42 +0000 (10:46 +0800)]
[NFC] Move flang OpenMP semantic tests under one single directory

To be consistent with OpenACC and will find the tests in one single
directory for OpenMP.

Reviewed By: kiranchandramohan

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

2 years ago[TableGen] const char *const x => const char x[]
Fangrui Song [Sat, 11 Jun 2022 02:13:59 +0000 (19:13 -0700)]
[TableGen] const char *const x => const char x[]

2 years ago[Bitcode] Don't use UINT_MAX for missing SanitizerMetadata
Vitaly Buka [Sat, 11 Jun 2022 01:20:55 +0000 (18:20 -0700)]
[Bitcode] Don't use UINT_MAX for missing SanitizerMetadata

Looks like comment on D126100 was unnoticed.

2 years ago[libc] Implement double precision FMA for targets without FMA instructions.
Tue Ly [Sun, 8 May 2022 22:27:34 +0000 (18:27 -0400)]
[libc] Implement double precision FMA for targets without FMA instructions.

Implement double precision FMA (Fused Multiply-Add) for targets without
FMA instructions using __uint128_t to store the intermediate results.

Reviewed By: michaelrj, sivachandra

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

2 years ago[MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals
Arjun P [Fri, 10 Jun 2022 01:53:46 +0000 (21:53 -0400)]
[MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals

Reviewed By: Groverkss

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

2 years ago[BOLT][TEST] Use double dash flags in tests
Maksim Panchenko [Fri, 10 Jun 2022 21:10:58 +0000 (14:10 -0700)]
[BOLT][TEST] Use double dash flags in tests

Replace a single dash with a double dash for options that have more
than a single letter.

llvm-bolt-wrapper.py has special treatment for output options such as
"-o" and "-w" causing issues when a single dash is used, e.g. for
"-write-dwp". The wrapper can be fixed as well, but using a double dash
has other advantages as well.

Reviewed By: rafauler

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

2 years ago[libc] add EXP_MAT_MASK to x87 long double
Michael Jones [Fri, 10 Jun 2022 23:09:18 +0000 (16:09 -0700)]
[libc] add EXP_MAT_MASK to x87 long double

A previous patch added the constant EXP_MANT_MASK to the FloatProperties
for other types of long double. This patch adds it to the special 80-bit
x87 long double.

Reviewed By: lntue

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

2 years ago[mlgo] Update FunctionPropertyCache after invalidating analyses
Mircea Trofin [Fri, 10 Jun 2022 02:17:21 +0000 (19:17 -0700)]
[mlgo] Update FunctionPropertyCache after invalidating analyses

The update depends on LoopInfo, so we need that refreshed first, not
after.

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

2 years ago[BOLT] Mark fragments related to split jump table as non-simple
Huan Nguyen [Fri, 10 Jun 2022 22:48:13 +0000 (15:48 -0700)]
[BOLT] Mark fragments related to split jump table as non-simple

Mark fragments related to split jump table as non-simple.

A function could be splitted into hot and cold fragments. A split jump table is
challenging for correctly reconstructing control flow graphs, so it was marked
as ignored. This update marks those fragments as non-simple, allowing them
to be printed and partial control flow graph construction.

Test Plan:
```
llvm-lit -a tools/bolt/test/X86/split-func-icf.s
```
This test has two functions (main, main2), each has a jump table target to the
same cold portion main2.cold.1(*2). We try to print out only this cold portion.
If it is ignored, it cannot be printed. If it is non-simple, it can be printed. We
verify that it can be printed.

Reviewed By: Amir

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

2 years ago[mlir][vulkan] Add missing '<>' in test IRs to fix test
Lei Zhang [Fri, 10 Jun 2022 22:08:50 +0000 (18:08 -0400)]
[mlir][vulkan] Add missing '<>'  in test IRs to fix test

2 years ago[mlir][spirv] Unify aliases of different bitwidth scalar types
Lei Zhang [Fri, 10 Jun 2022 22:01:31 +0000 (18:01 -0400)]
[mlir][spirv] Unify aliases of different bitwidth scalar types

This commit extends the UnifyAliasedResourcePass to handle scalar
types of different bitwidths. It requires to get the smaller bitwidth
resource as the canonical resource so that we can avoid subcomponent
load/store. Instead we load/store multiple smaller bitwidth ones.

Reviewed By: hanchung

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

2 years ago[scan-build-py] Fix exception on shutdown with sarif-html output format
Anders Waldenborg [Fri, 3 Jun 2022 08:28:22 +0000 (10:28 +0200)]
[scan-build-py] Fix exception on shutdown with sarif-html output format

When running scan-build-py's analyze-build script with output format set
to sarif & html it wants to print a message on how to look at the
defects mentioning the directory name twice.

But the path argument was only given once to the logging function,
causing "TypeError: not enough arguments for format string" exception.

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

2 years ago[libc++] Use the same implementation of invoke for C++03 and C++11
Nikolas Klauser [Fri, 10 Jun 2022 11:38:11 +0000 (13:38 +0200)]
[libc++] Use the same implementation of invoke for C++03 and C++11

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years agoRevert "[Attributor] Ensure to use the proper liveness AA"
Mitch Phillips [Fri, 10 Jun 2022 20:56:29 +0000 (13:56 -0700)]
Revert "[Attributor] Ensure to use the proper liveness AA"

This reverts commit a3273c0c06003b9e5f53a856844fee42a17e6b7b.

Reason: Broke the ASan buildbots with a memory leak. See
https://reviews.llvm.org/rG94841c713fdd2bce3276015d1e946d414bb74ee8 for
more information.

2 years ago[InstCombine] switch synthetic unreachable to use undef instead of poison (NFC)
Nuno Lopes [Fri, 10 Jun 2022 20:54:09 +0000 (21:54 +0100)]
[InstCombine] switch synthetic unreachable to use undef instead of poison (NFC)

2 years ago[lldb/crashlog] Show help when the command is called without any argument
Med Ismail Bennani [Wed, 8 Jun 2022 23:21:24 +0000 (16:21 -0700)]
[lldb/crashlog] Show help when the command is called without any argument

This patch changes the `crashlog` command behavior to print the help
message if no argument was provided with the command.

rdar://94576026

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[mlir][py-bindings] Fix include issue introduced by D127352
agostini01 [Fri, 10 Jun 2022 20:42:16 +0000 (20:42 +0000)]
[mlir][py-bindings] Fix include issue introduced by D127352

Using:
      -DMLIR_ENABLE_BINDINGS_PYTHON=ON

Resulted in a failed build due to changes implemented by
https://reviews.llvm.org/D127352

This updates the include line

Reviewed By: Mogball

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

2 years ago[libc++] Granularize <iterator> includes
Nikolas Klauser [Fri, 10 Jun 2022 17:53:10 +0000 (19:53 +0200)]
[libc++] Granularize <iterator> includes

Reviewed By: ldionne, #libc

Spies: libcxx-commits, wenlei

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

2 years ago[libc++] Simplify type_traits and use more builtins
Nikolas Klauser [Fri, 10 Jun 2022 09:38:04 +0000 (11:38 +0200)]
[libc++] Simplify type_traits and use more builtins

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years agoFix interaction of CFI instructions with MachineOutliner.
Eli Friedman [Fri, 10 Jun 2022 20:37:49 +0000 (13:37 -0700)]
Fix interaction of CFI instructions with MachineOutliner.

1. When checking if a candidate contains a CFI instruction, actually
iterate over all of the instructions, instead of stopping halfway
through.
2. Make sure copied CFI directives refer to the correct instruction.

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

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

2 years ago[Lex] Fix `fixits` for typo-corrections of preprocessing directives within skipped...
Argyrios Kyrtzidis [Tue, 7 Jun 2022 20:35:17 +0000 (13:35 -0700)]
[Lex] Fix `fixits` for typo-corrections of preprocessing directives within skipped blocks

The `EndLoc` parameter was always unset so no fixit was emitted. But it is also unnecessary for determining the range so we can remove it.

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

2 years ago[RISCV] Refine costs for i1 reductions
Philip Reames [Fri, 10 Jun 2022 20:21:52 +0000 (13:21 -0700)]
[RISCV] Refine costs for i1 reductions

Our actual lowering for i1 reductions uses ctpop combined with possibly a vector negate and possibly a logic op afterwards. I believe ctpop to be low cost on all reasonable hardware.

The default costing implementation here was returning quite inconsistent costs. and/or were returning very high costs (because we seem to think moving into scalar registers is very expensive?) and others were returning lower but still too high (because of the assumed tree reduce strategy). While we should probably improve the generic costing strategy for i1 vectors, let's start by fixing the immediate problem.

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

2 years ago[RISCV] Implement isElementTypeLegalForScalableVector TTI hook
Philip Reames [Fri, 10 Jun 2022 20:15:11 +0000 (13:15 -0700)]
[RISCV] Implement isElementTypeLegalForScalableVector TTI hook

This brings us into alignment with AArch64, and in the process fixes a compiler crash bug in uniform store handling in the vectorizer.

Before the recent invalid cost bailout work, this would have also avoided crashes on invalid costs in some cases. I honestly think the vectorizer should gracefully bailout on uniform stores it can't use a scatter for, but it doesn't, so lets take the path of least resistance here. It's also possible that there are other vectorizer bugs AArch64 isn't seeing because of this hook; we don't want to be finding them either.

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

2 years ago[PS4/PS5] Don't inherit base class alignment
Paul Robinson [Fri, 10 Jun 2022 20:02:17 +0000 (13:02 -0700)]
[PS4/PS5] Don't inherit base class alignment

2 years ago[RISCV] Minor test improvements for scalable scatter/gather tests added in 275b2e524
Philip Reames [Fri, 10 Jun 2022 20:13:43 +0000 (13:13 -0700)]
[RISCV] Minor test improvements for scalable scatter/gather tests added in 275b2e524

2 years ago[libc][Obvious] Change all __builtin_clz* calls to clz in builtin_wrappers.h.
Tue Ly [Fri, 10 Jun 2022 20:00:13 +0000 (16:00 -0400)]
[libc][Obvious] Change all __builtin_clz* calls to clz in builtin_wrappers.h.

2 years ago[RISCV] Don't require loop simplify form in RISCVGatherScatterLowering.
Craig Topper [Fri, 10 Jun 2022 19:51:01 +0000 (12:51 -0700)]
[RISCV] Don't require loop simplify form in RISCVGatherScatterLowering.

We need a preheader and a single latch, but we don't need a dedicated
exit.

Reviewed By: reames

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

2 years ago[RISCV] Add test case showing failure to convert gather/scatter to strided load/store...
Craig Topper [Fri, 10 Jun 2022 19:50:52 +0000 (12:50 -0700)]
[RISCV] Add test case showing failure to convert gather/scatter to strided load/store. NFC

Our optimization pass checks for loop simplify form, before doing
the transform. The loops here aren't in loop simplify form because
the exit block has two predecessors.

Reviewed By: reames

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