platform/upstream/llvm.git
2 years ago[RISCV] Add support for vp.fptosi where the result is a mask type.
Craig Topper [Tue, 5 Apr 2022 16:18:45 +0000 (09:18 -0700)]
[RISCV] Add support for vp.fptosi where the result is a mask type.

We can do this conversion by converting the same sized integer type, then compare the result with 0. The conversion is undefined if the converted FP value doesn't fit in an i1.

Reviewed By: frasercrmck

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

2 years ago[X86] fmaddsub/fmsubadd combines - add NOFMA target for reference
Simon Pilgrim [Tue, 5 Apr 2022 16:47:37 +0000 (17:47 +0100)]
[X86] fmaddsub/fmsubadd combines - add NOFMA target for reference

2 years ago[lldb] Improve documentation for some of the platform functions
Jonas Devlieghere [Tue, 5 Apr 2022 16:41:10 +0000 (09:41 -0700)]
[lldb] Improve documentation for some of the platform functions

Improve the documentation for the platform functions that take a process
host architecture as input.

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

2 years agoFix a mistyping introduced with the new container command.
Jim Ingham [Tue, 5 Apr 2022 16:40:11 +0000 (09:40 -0700)]
Fix a mistyping introduced with the new container command.

I also added a call to help in the test which was crashing before
the test, and not after.

2 years agoRevert "[Scudo] enabling anonymous named pages on Linux 5.17 and onwards."
Alex Brachet [Tue, 5 Apr 2022 16:38:49 +0000 (16:38 +0000)]
Revert "[Scudo] enabling anonymous named pages on Linux 5.17 and onwards."

This reverts commit 619499252307c520fd840a5f3c79ffa00eaf2264.

2 years ago[lldb] Fix undefined behavior: left shift of negative value
Jonas Devlieghere [Tue, 5 Apr 2022 16:35:46 +0000 (09:35 -0700)]
[lldb] Fix undefined behavior: left shift of negative value

Fix undefined behavior in AppleObjCRuntimeV2 where we were left shifting
a signed value. This also removes redundant casts of unobfuscated to
uint64_t which it already is.

rdar://91242879

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

2 years ago[x86] Fix infinite loop inside DAG combiner with lzcnt feature.
Pierre Gousseau [Tue, 5 Apr 2022 16:30:25 +0000 (17:30 +0100)]
[x86] Fix infinite loop inside DAG combiner with lzcnt feature.

The issue affects targets supporting fast-lzcnt such as btver2.
This removes extraneous zext/trunc node insertions to fix the infinite
loop.
This fixes Issue https://github.com/llvm/llvm-project/issues/54694

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

Reviewed By: RKSimon, spatel, lebedev.ri

2 years ago[lldb][intelpt] Remove `IntelPTInstruction` and move methods to `DecodedThread`
Alisamar Husain [Sun, 3 Apr 2022 09:52:21 +0000 (15:22 +0530)]
[lldb][intelpt] Remove `IntelPTInstruction` and move methods to `DecodedThread`

This is to reduce the size of the trace further and has appreciable results.

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

2 years ago[SVE] Extend support for folding select + masked gathers
Matt Devereau [Fri, 1 Apr 2022 03:57:04 +0000 (03:57 +0000)]
[SVE] Extend support for folding select + masked gathers

Extend the work done in D106376 to include masked gathers

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

2 years agoFix the test after D123031
Kirill Bobyrev [Tue, 5 Apr 2022 16:20:57 +0000 (18:20 +0200)]
Fix the test after D123031

2 years ago[MIPS] selectAddrFrameIndexOffset - use cast<> instead of dyn_cast<> to avoid derefer...
Simon Pilgrim [Tue, 5 Apr 2022 16:20:25 +0000 (17:20 +0100)]
[MIPS] selectAddrFrameIndexOffset - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is used immediately below, so assert the cast is correct instead of returning nullptr

2 years ago[libc++] add global variable template std::views::empty
Hui Xie [Tue, 5 Apr 2022 16:17:02 +0000 (18:17 +0200)]
[libc++] add global variable template std::views::empty

[libc++] add global variable template std::views::empty
Note it is neither a range adaptor, nor a CPO. It is simplify a global variable template.

Reviewed By: #libc, Mordante

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

2 years ago[MLIR] Check for static shape before bare pointer conversion
Lorenzo Chelini [Mon, 4 Apr 2022 13:22:30 +0000 (15:22 +0200)]
[MLIR] Check for static shape before bare pointer conversion

Originally in the returnOp conversion, the result type was changing to bare
pointer if the type was a memref. This is incorrect as conversion to bare
pointer can only be done if the memref has static shape, strides and offset.

Reviewed By: ftynse

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

2 years ago[libc++][test] Adds an cpp20_output_iterator.
Mark de Wever [Sat, 19 Mar 2022 16:37:15 +0000 (17:37 +0100)]
[libc++][test] Adds an cpp20_output_iterator.

This iterator is used to test code that only needs to satisfy the
output_iterator concept. Follow-up changes will use this iterator in
older language Standards.

Reviewed By: ldionne, #libc, philnik, var-const

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

2 years ago[flang] Fix fir.embox codegen with constant interior shape
Jean Perier [Tue, 5 Apr 2022 15:26:53 +0000 (17:26 +0200)]
[flang] Fix fir.embox codegen with constant interior shape

Fix https://github.com/flang-compiler/f18-llvm-project/issues/1416.

The `constRows` variable was being decremented too soon, causing the
last constant interior dimension extent being used to multiply the GEP
offset. This lead to wrong address computation and caused segfaults.

Note: also upstream fir.embox tests that can be upstreamed.

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

2 years ago[flang] Set lower bounds of array section fir.embox to one
Jean Perier [Tue, 5 Apr 2022 15:25:34 +0000 (17:25 +0200)]
[flang] Set lower bounds of array section fir.embox to one

Do not use the shift of a fir.embox to set lower bounds if there is
a fir.slice operand. This matches Fortran semantics where lower bounds
of array sections are ones.
Note that in case there is a fir.slice, the array shift may be provided
because it is used to calculate the origin/base address of an array slice.

Add a TODO for substring codegen since I noticed it was not upstreamed
yet and would cause some program to silently compile incorrectly.

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

2 years ago[clang-offload-bundler] add -input/-output options
Yaxun (Sam) Liu [Tue, 5 Apr 2022 14:44:13 +0000 (10:44 -0400)]
[clang-offload-bundler] add -input/-output options

Currently, clang-offload-bundler has -inputs and -outputs options that accept
values with comma as the delimiter. This causes issues with file paths
containing commas, which are valid file paths on Linux.

This add two new options -input and -output, which accept one single file,
and allow multiple instances. This allows arbitrary file paths. The old
-inputs and -outputs options will be kept for backward compatibility, but
are not allowed to be used with -input and -output options for simplicity.
In the future, -inputs and -outputs options will be phasing out.

RFC: https://discourse.llvm.org/t/rfc-adding-input-and-output-options-to-clang-offload-bundler/60049

Patch by: Siu Chi Chan

Reviewed by: Yaxun Liu

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

2 years agoReland "[clangd] IncludeCleaner: Add support for IWYU pragma private"
Kirill Bobyrev [Tue, 5 Apr 2022 14:54:52 +0000 (16:54 +0200)]
Reland "[clangd] IncludeCleaner: Add support for IWYU pragma private"

This lands 4cb38bfe76b7ef157485338623c931d04d17b958 again.

2 years ago[libc++] Tidy up tests for deduction guides and other compile-time failing properties...
Louis Dionne [Mon, 4 Apr 2022 17:35:41 +0000 (13:35 -0400)]
[libc++] Tidy up tests for deduction guides and other compile-time failing properties in std::string

Instead of using `.fail.cpp` tests, use `.verify.cpp` to check for the
exact reason of the failure. In the case of deduction guides, use SFINAE
based tests instead since that is our preferred way of testing those.

Finally, ensure that we actually run the test in `iter_alloc_deduction.pass.cpp`,
since we were not running anything before.

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

2 years ago[ValueTracking] Handle non-pow2 align assume bundle (PR53693)
Nikita Popov [Tue, 5 Apr 2022 14:48:40 +0000 (16:48 +0200)]
[ValueTracking] Handle non-pow2 align assume bundle (PR53693)

https://reviews.llvm.org/D119414 clarified that this is legal IR,
so handle it gracefully. (We could aggressively use the fact that
the pointer must be a null pointer in that case, but I'm not
bothering with that.)

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

2 years ago[X86] Regenerate test checks (NFC)
Nikita Popov [Tue, 5 Apr 2022 14:33:40 +0000 (16:33 +0200)]
[X86] Regenerate test checks (NFC)

2 years ago[clangd] Use stable keys for CanonicalIncludes mappings
Kirill Bobyrev [Tue, 5 Apr 2022 14:24:24 +0000 (16:24 +0200)]
[clangd] Use stable keys for CanonicalIncludes mappings

This patch switches CanonicalInclude mappings to use `llvm::sys::fs::UniqueID` for a stable file representation because the `FileEntry::getName()` results turn out to be changing throughout the lifetime of a program (exposed in D120306). This patch makes it possible for D120306 to be re-landed and increases overall stability.

Reviewed By: sammccall

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

2 years ago[libc++] Silence new deprecation warnings for C functions in tests
Louis Dionne [Tue, 5 Apr 2022 14:26:32 +0000 (10:26 -0400)]
[libc++] Silence new deprecation warnings for C functions in tests

2 years ago[clang][dataflow] Support integral casts
Yitzhak Mandelbaum [Mon, 4 Apr 2022 15:31:52 +0000 (15:31 +0000)]
[clang][dataflow] Support integral casts

Adds support for implicit casts `CK_IntegralCast` and `CK_IntegralToBoolean`.

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

2 years ago[clang] Document p1703 not needed
Nathan Sidwell [Tue, 5 Apr 2022 12:01:02 +0000 (05:01 -0700)]
[clang] Document p1703 not needed

We list p1703 as unimplemented, but it is subsumed by p1857.

Reviewed By: tbaeder

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

2 years agoAdding new tests to demonstrate code patterns with multiple or/and which can be combi...
Biplob Mishra [Tue, 5 Apr 2022 13:16:52 +0000 (14:16 +0100)]
Adding new tests to demonstrate code patterns with multiple or/and which can be combined with a single mask

2 years ago[gn build] (semi-automatically) Port 4661a65f4bea
Nico Weber [Tue, 5 Apr 2022 12:58:49 +0000 (08:58 -0400)]
[gn build] (semi-automatically) Port 4661a65f4bea

...and follow-up 970ae8376e53.

2 years ago[iwyu] Fix some header include regression
serge-sans-paille [Tue, 5 Apr 2022 13:01:06 +0000 (15:01 +0200)]
[iwyu] Fix some header include regression

Running iwyu-diff from https://github.com/serge-sans-paille/preprocessor-utils
makes it possible to quickly spot regression in unused includes. This patch
contains the few regressions since the last header cleanup.

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

2 years ago[BOLT] Fix plt relocations symbol match
Vladislav Khmelevsky [Sun, 3 Apr 2022 16:11:31 +0000 (19:11 +0300)]
[BOLT] Fix plt relocations symbol match

The bfd linker adds the symbol versioning string to the symbol name in symtab.
Skip the versioning part in order to find the registered PLT function.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

2 years ago[clang][AArc64][SVE] Add support for comparison operators on SVE types
David Truby [Thu, 24 Mar 2022 14:51:39 +0000 (14:51 +0000)]
[clang][AArc64][SVE] Add support for comparison operators on SVE types

Comparison operators on SVE types return a signed integer vector
of the same width as the incoming SVE type. This matches the existing
behaviour for NEON types.

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

2 years ago[Hexagon] Fix out of range shift warning. NFC.
Simon Pilgrim [Tue, 5 Apr 2022 12:29:11 +0000 (13:29 +0100)]
[Hexagon] Fix out of range shift warning. NFC.

2 years agorev16 instruction is being generated for a half word byte swap on a 32-bit input...
Biplob Mishra [Tue, 5 Apr 2022 12:43:02 +0000 (13:43 +0100)]
rev16 instruction is being generated for a half word byte swap on a 32-bit input as a bswap+rotr. This is not true for a 64-bit input.

This patch implements the rev16 instruction for a AArch64 backend for a half word byte swap on a 64-bit input.

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

2 years ago[bazel] Try to fix the build after 4661a65f4b
Benjamin Kramer [Tue, 5 Apr 2022 12:40:52 +0000 (14:40 +0200)]
[bazel] Try to fix the build after 4661a65f4b

2 years agoReverting changes to correct the commit message
Biplob Mishra [Tue, 5 Apr 2022 12:38:14 +0000 (13:38 +0100)]
Reverting changes to correct the commit message

2 years ago[AArch64] Set maximum VF with shouldMaximizeVectorBandwidth
Jingu Kang [Tue, 5 Apr 2022 12:16:10 +0000 (13:16 +0100)]
[AArch64] Set maximum VF with shouldMaximizeVectorBandwidth

Set the maximum VF of AArch64 with 128 / the size of smallest type in loop.

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

2 years agoIn fast-math mode, when unsafe math optimizations are enabled, the
Zahira Ammarguellat [Sun, 3 Apr 2022 11:28:15 +0000 (04:28 -0700)]
In fast-math mode, when unsafe math optimizations are enabled, the
compiler is allowed to use optimizations that allow reassociation and
transformations that don’t guaranty accuracy.
For example (x+y)+z is transformed into x+(y+z) . Although
mathematically equivalent, these two expressions may not lead to the
same final result due to errors of summation.
Or x/x is transformed into 1.0 but x could be 0.0, INF or NaN. And so
this transformation also may not lead to the same final result.
Setting the eval method 'ffp-eval-method' or via '#pragma clang fp
eval_method' in this mode, doesn’t have any effect.
This patch adds code to warn the user of this.

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

2 years ago[ARM][AArch64] Optimize pattern for converting a half word byte swap in a 64-bit...
Biplob Mishra [Tue, 5 Apr 2022 11:06:17 +0000 (12:06 +0100)]
[ARM][AArch64] Optimize pattern for converting a half word byte swap in a 64-bit input to a rev16 instruction. Differential Revision: https://reviews.llvm.org/D122643

2 years ago[Tests] Use %clang_cc1 instead of %clang -cc1 in codegen tests (NFC)
Nikita Popov [Tue, 5 Apr 2022 11:21:44 +0000 (13:21 +0200)]
[Tests] Use %clang_cc1 instead of %clang -cc1 in codegen tests (NFC)

2 years ago[Test] Use cc1 interface in more tests (NFC)
Nikita Popov [Tue, 5 Apr 2022 10:46:45 +0000 (12:46 +0200)]
[Test] Use cc1 interface in more tests (NFC)

There doesn't seem to be any particular reason why these tests use
the driver interface rather than the cc1 interface, which is
typically used in CodeGen tests.

2 years ago[LV] Add vector.body block to parent loop during skeleton creation.
Florian Hahn [Tue, 5 Apr 2022 10:43:56 +0000 (11:43 +0100)]
[LV] Add vector.body block to parent loop during skeleton creation.

When creating induction resume values, SCEV queries may rely on
LoopInfo. Make sure vector.body gets added to the loop of the pre-header
during skeleton construction.

%vector.body will be moved to the vector preheader during VPlan
execution.

Fixes #54745.

2 years ago[clang][extract-api] Undefining macros should not result in a crash
Daniel Grumberg [Mon, 4 Apr 2022 17:53:51 +0000 (18:53 +0100)]
[clang][extract-api] Undefining macros should not result in a crash

This fixes the situation where a undefining a not previously defined
macro resulted in a crash. Before trying to remove a definition from
PendingMacros we first check to see if the macro did indeed have a
previous definition.

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

2 years agoNew regression test against expandMemCpyAsLoop utility
Evgeniy Brevnov [Wed, 26 Jan 2022 13:29:08 +0000 (20:29 +0700)]
New regression test against expandMemCpyAsLoop utility

Unit test for functionality going to be added by D118441

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

2 years ago[InstCombine] Add PR22303 test case
Simon Pilgrim [Tue, 5 Apr 2022 10:08:31 +0000 (11:08 +0100)]
[InstCombine] Add PR22303 test case

2 years ago[Docs] Update opaque pointers docs (NFC)
Nikita Popov [Tue, 5 Apr 2022 10:09:10 +0000 (12:09 +0200)]
[Docs] Update opaque pointers docs (NFC)

Point people to the cc1 instead of the mllvm flag, as the mllvm
flag will stop working for clang usage at some point.

Update transition state to mention that support in Clang/LLVM is
complete, and only the default switch is pending.

2 years ago[AArch64] Make PMMIR_EL1 read-only.
Simon Tatham [Tue, 5 Apr 2022 10:09:51 +0000 (11:09 +0100)]
[AArch64] Make PMMIR_EL1 read-only.

The Arm architecture reference manual (ARM DDI 0487H.a section
D13.5.12) lists every field in the register as RO, and does not list
an MSR instruction that writes it. So we should be defining it as an
ROSysReg, not an RWSysReg.

Reviewed By: vhscampos

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

2 years ago[Test] Use cc1 instead of mllvm -opaque-pointers option (NFC)
Nikita Popov [Tue, 5 Apr 2022 10:04:48 +0000 (12:04 +0200)]
[Test] Use cc1 instead of mllvm -opaque-pointers option (NFC)

2 years ago[LLVMContext] Replace enableOpaquePointers() with setOpaquePointers()
Nikita Popov [Tue, 5 Apr 2022 09:36:06 +0000 (11:36 +0200)]
[LLVMContext] Replace enableOpaquePointers() with setOpaquePointers()

This allows both explicitly enabling and explicitly disabling
opaque pointers, in anticipation of the default switching at some
point.

This also slightly changes the rules by allowing calls if either
the opaque pointer mode has not yet been set (explicitly or
implicitly) or if the value remains unchanged.

2 years agoRemove libc++ test from clang lib.
Benjamin Kramer [Tue, 5 Apr 2022 09:33:55 +0000 (11:33 +0200)]
Remove libc++ test from clang lib.

This was added in 3ba8548c8e04bb301c4243887362c54bfbd4af8b

2 years ago[CodeGen] Avoid unnecessary ConstantExpr cast
Nikita Popov [Tue, 5 Apr 2022 09:18:33 +0000 (11:18 +0200)]
[CodeGen] Avoid unnecessary ConstantExpr cast

With opaque pointers, this is not necessarily a ConstantExpr. And
we don't need one here either, just Constant is sufficient.

2 years ago[mlir] Update BUILD.bazel.
Alexander Belyaev [Tue, 5 Apr 2022 09:25:29 +0000 (11:25 +0200)]
[mlir] Update BUILD.bazel.

2 years agoRemove top-level using directives from Transforms/IPO headers
Pavel Labath [Tue, 15 Mar 2022 13:20:44 +0000 (14:20 +0100)]
Remove top-level using directives from Transforms/IPO headers

These directives pollute the namespace of all files which include the
header.

2 years ago[lldb] Avoid duplicate vdso modules when opening core files
Pavel Labath [Tue, 29 Mar 2022 08:47:32 +0000 (10:47 +0200)]
[lldb] Avoid duplicate vdso modules when opening core files

When opening core files (and also in some other situations) we could end
up with two vdso modules. This could happen because the vdso module is
very special, and over the years, we have accumulated various ways to
load it.

In D10800, we added one mechanism for loading it, which took the form of
a generic load-from-memory capability. Unfortunately loading an elf file
from memory is not possible (because the loader never loads the entire
file), and our attempts to do so were causing crashes. So, in D34352, we
partially reverted D10800 and implemented a custom mechanism specific to
the vdso.

Unfortunately, enough of D10800 remained such that, under the right
circumstances, it could end up loading a second (non-functional) copy of
the vdso module. This happened when the process plugin did not support
the extended MemoryRegionInfo query (added in D22219, to workaround a
different bug), which meant that the loader plugin was not able to
recognise that the linux-vdso.so.1 module (this is how the loader calls
it) is in fact the same as the [vdso] module (the name used in
/proc/$PID/maps) we loaded before. This typically happened in a core
file, as they don't store this kind of information.

This patch fixes the issue by completing the revert of D10800 -- the
memory loading code is removed completely. It also reduces the scope of
the hackaround introduced in D22219 -- it isn't completely sound and is
only relevant for fairly old (but still supported) versions of android.

I added the memory loading logic to the wasm dynamic loader, which has
since appeared and is relying on this feature (it even has a test). As
far as I can tell loading wasm modules from memory is possible and
reliable. MachO memory loading is not affected by this patch, as it uses
a completely different code path.

Since the scenarios/patches I described came without test cases, I have
created two new gdb-client tests cases for them. They're not
particularly readable, but right now, this is the best way we can
simulate the behavior (bugs) of a particular dynamic linker.

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

2 years ago[lldb/linux] Handle main thread exits
Pavel Labath [Wed, 30 Mar 2022 09:40:34 +0000 (11:40 +0200)]
[lldb/linux] Handle main thread exits

This patch handles the situation where the main thread exits (through
the SYS_exit syscall). In this case, the process as a whole continues
running until all of the other threads exit, or one of them issues an
exit_group syscall.

The patch consists of two changes:
- a moderate redesign of the handling of thread exit (WIFEXITED) events.
  Previously, we were removing (forgetting) a thread once we received
  the WIFEXITED (or WIFSIGNALED) event. This was problematic for the
  main thread, since the main thread WIFEXITED event (which is better thought
  of as a process-wide event) gets reported only after the entire process
  exits. This resulted in deadlocks, where we were waiting for the
  process to stop (because we still considered the main thread "live").

  This patch changes the logic such that the main thread is removed as
  soon as its PTRACE_EVENT_EXIT (the pre-exit) event is received. At
  this point we can consider the thread gone (for most purposes). As a
  corrolary, I needed to add special logic to catch process-wide exit
  events in the cases where we don't have the main thread around.

- The second part of the patch is the removal of the assumptions that
  the main thread is always available. This generally meant replacing
  the uses of GetThreadByID(process_id) with GetCurrentThread() in
  various process-wide operations (such as memory reads).

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

2 years ago[lldb] Move host platform implementations into the base class
Pavel Labath [Fri, 1 Apr 2022 12:38:55 +0000 (14:38 +0200)]
[lldb] Move host platform implementations into the base class

About half of our host platform code was implemented in the Platform
class, while the rest was it RemoteAwarePlatform. Most of the time, this
did not matter, as nearly all our platforms are also
RemoteAwarePlatforms. It makes a difference for PlatformQemu, which
descends directly from the base class (as it is local-only).

This patch moves all host code paths into the base class, and marks
PlatformQemu as a "host" platform so it can make use of them (it sounds
slightly strange, but that is consistent with what the apple simulator
platforms are doing). Not all of the host implementations make sense for
this platform, but it can always override those that don't.

I add some basic tests using the platform file apis to exercise this
functionality.

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

2 years ago[gn build] Port 3ba8548c8e04
LLVM GN Syncbot [Tue, 5 Apr 2022 09:06:48 +0000 (09:06 +0000)]
[gn build] Port 3ba8548c8e04

2 years ago[libc++][ranges] Implement ranges::transform
Nikolas Klauser [Tue, 5 Apr 2022 09:05:36 +0000 (11:05 +0200)]
[libc++][ranges] Implement ranges::transform

Reviewed By: ldionne, var-const, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[Scudo] enabling anonymous named pages on Linux 5.17 and onwards.
David Carlier [Tue, 5 Apr 2022 08:46:02 +0000 (09:46 +0100)]
[Scudo] enabling anonymous named pages on Linux 5.17 and onwards.

Reviewers: vitalybuka

Reviewed-By: vitalybuka
Differential Revision: https://reviews.llvm.org/D122962

2 years ago[mlir][ods] Add description to Attr and ensure doc generation
Alex Zinenko [Mon, 4 Apr 2022 12:24:54 +0000 (14:24 +0200)]
[mlir][ods] Add description to Attr and ensure doc generation

Add the description textual field to the Attr ODS class to mirror an
identical field in the Type ODS class. Add support for generating
documentation for attribute constraints defined using this field. This
ensures mlir-tblgen produces at least some documentation for dialects
that only define attribute constraints, such as DLTI.

Reviewed By: rriddle

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

2 years ago[gn build] Port 0320115c16fc
LLVM GN Syncbot [Tue, 5 Apr 2022 08:34:08 +0000 (08:34 +0000)]
[gn build] Port 0320115c16fc

2 years ago[LibCalls] Respect TLI.getExtAttrForI32Param() in inferLibFuncAttributes().
Jonas Paulsson [Tue, 5 Apr 2022 07:55:43 +0000 (09:55 +0200)]
[LibCalls] Respect TLI.getExtAttrForI32Param() in inferLibFuncAttributes().

getExtAttrForI32Param() is the method to be used for determining the type of
extension attribute (if any) that is to be added for a signed/unsigned
argument.

Previously, the SExt attribute was always added to the i32 ldexp* argument as
it was expected to be ignored by targets not needing it. This patch now
changes this so that it is only added for the targets that need it in the
first place.

Putchar() argument is now also extended as required by the target (SystemZ in
the test), to fix the issue below. Many more libcalls will be handled
similarly in a following patch.

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

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

Review: Eli Friedman

2 years ago[flang][cmake] Make CMake copy "omp_lib.h" into the build directory
Andrzej Warzynski [Fri, 18 Mar 2022 16:20:56 +0000 (16:20 +0000)]
[flang][cmake] Make CMake copy "omp_lib.h" into the build directory

Any header or module file in the Flang source directory is of no use to
the compiler unless it is copied into the build directory. Indeed, all
compiler search paths are relative to the compiler executable (flang-new
in our case). Hence, "omp_lib.h" should be copied into the build
directory alongside other compiler-provided files that can be "included"
(header files) or "used" (module files).

For now, "omp_lib.h" is copied into "<build-dir>/include/flang/OpenMP".
We may decide to change this in future. For example, Clang copies a
bunch of runtime headers into “<build-dir>/lib/clang/<version-number>”.
We could also consider using a similar header from a different
sub-project.

Flang's driver search path is updated accordingly. A rule for
"installing" the "omp_lib.h" header is _yet to be added_ (we will also
need to determine the suitable location for this).

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

2 years agoApply clang-tidy fixes for readability-redundant-control-flow in FuncToLLVM.cpp ...
Mehdi Amini [Sun, 3 Apr 2022 22:17:39 +0000 (22:17 +0000)]
Apply clang-tidy fixes for readability-redundant-control-flow in FuncToLLVM.cpp (NFC)

2 years ago[OpaquePtrs][Clang] Add -opaque-pointers/-no-opaque-pointers cc1 options
Nikita Popov [Mon, 4 Apr 2022 14:58:42 +0000 (16:58 +0200)]
[OpaquePtrs][Clang] Add -opaque-pointers/-no-opaque-pointers cc1 options

This adds cc1 options for enabling and disabling opaque pointers
on the clang side. This is not super useful now (because
-mllvm -opaque-pointers and -Xclang -opaque-pointers have the same
visible effect) but will be important once opaque pointers are
enabled by default in clang. In that case, it will only be
possible to disable them using the cc1 -no-opaque-pointers option.

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

2 years ago[mlir] Update mlir/BUILD.bazel.
Alexander Belyaev [Tue, 5 Apr 2022 08:14:28 +0000 (10:14 +0200)]
[mlir] Update mlir/BUILD.bazel.

2 years agoRevert "[CodeGen] Async unwind - add a pass to fix CFI information"
Muhammad Omair Javaid [Tue, 5 Apr 2022 08:09:42 +0000 (13:09 +0500)]
Revert "[CodeGen] Async unwind - add a pass to fix CFI information"

This reverts commit 980c3e6dd223a8e628367144b8180117950bb364.

This commit had failing tests with clang crashing across various
AArch64/Linux buildots.

https://lab.llvm.org/buildbot/#/builders/179/builds/3346

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

2 years ago[mlir] Rewrite canonicalization of collapse(expand) and expand(collapse).
Alexander Belyaev [Fri, 1 Apr 2022 15:24:14 +0000 (17:24 +0200)]
[mlir] Rewrite canonicalization of collapse(expand) and expand(collapse).

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

2 years ago[mlir] Fix 1 ClangTidyPerformance finding (NFC)
Adrian Kuegel [Tue, 5 Apr 2022 07:28:42 +0000 (09:28 +0200)]
[mlir] Fix 1 ClangTidyPerformance finding (NFC)

2 years ago[CodeGen][NFC] Hoist budget check out of loop
Max Kazantsev [Tue, 5 Apr 2022 07:10:00 +0000 (14:10 +0700)]
[CodeGen][NFC] Hoist budget check out of loop

Less computations & early exit if we know for sure that the limit will be exceeded.

2 years agoAn attempt to fix problem with building
Evgeniy Brevnov [Tue, 5 Apr 2022 07:09:55 +0000 (14:09 +0700)]
An attempt to fix problem with building
Transforms/Utils/MemTransferLowerTest

2 years agoRevert rG5adc94bb8a23eb819f6ca80e722f5b0e6e41401d "New regression test against expand...
Simon Pilgrim [Tue, 5 Apr 2022 07:11:21 +0000 (08:11 +0100)]
Revert rG5adc94bb8a23eb819f6ca80e722f5b0e6e41401d "New regression test against expandMemCpyAsLoop utility"

This was causing link errors on buildbots (and locally)

2 years ago[lldb][gui] make 'step out' step out of the selected frame
Luboš Luňák [Sun, 3 Apr 2022 18:19:10 +0000 (20:19 +0200)]
[lldb][gui] make 'step out' step out of the selected frame

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

2 years ago[lldb][gui] use just '#2' instead of 'frame #2' in the threads/frame view
Luboš Luňák [Sun, 3 Apr 2022 13:25:10 +0000 (15:25 +0200)]
[lldb][gui] use just '#2' instead of 'frame #2' in the threads/frame view

Since the threads/frame view is taking only a small part on the right side
of the screen, only a part of the function name of each frame is visible.
It seems rather wasteful to spell out 'frame' there when it's obvious
that it is a frame, it's better to use the space for more of the function
name.

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

2 years ago[lldb][gui] do not show the help window on first gui startup
Luboš Luňák [Thu, 30 Jul 2020 15:24:39 +0000 (17:24 +0200)]
[lldb][gui] do not show the help window on first gui startup

It's rather annoying if it's there after every startup,
and that 'Help (F6)' at the top should be enough to help people
who don't know.

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

2 years ago[BOLT][test] Fix AArch64 test
Maksim Panchenko [Tue, 5 Apr 2022 06:20:32 +0000 (23:20 -0700)]
[BOLT][test] Fix AArch64 test

Remove header dependency from cross-platform test.

Reviewed By: yota9

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

2 years agoNew regression test against expandMemCpyAsLoop utility
Evgeniy Brevnov [Wed, 26 Jan 2022 13:29:08 +0000 (20:29 +0700)]
New regression test against expandMemCpyAsLoop utility

Unit test for functionality going to be added by D118441

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

2 years ago[M68k] Adopt VarLenCodeEmitter for move instructions
Min-Yih Hsu [Sat, 18 Dec 2021 12:09:19 +0000 (20:09 +0800)]
[M68k] Adopt VarLenCodeEmitter for move instructions

The `move` instruction has one of the most complicate sets of variants, so
we're refactoring it first before finishing up rest of the data
instructions in a separate patch.

Note that since we're introducing more `move` variants, the codegen
actually got improved in terms of code size.

2 years ago[BOLT][test] Enable cross-target testing
Maksim Panchenko [Tue, 5 Apr 2022 05:30:18 +0000 (22:30 -0700)]
[BOLT][test] Enable cross-target testing

Check for supported target architecture instead of the host arch when
deciding to execute non-runtime tests.

Reviewed By: Amir

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

2 years ago[BOLT][test] Fix X86 cross-platform tests
Maksim Panchenko [Tue, 5 Apr 2022 01:01:10 +0000 (18:01 -0700)]
[BOLT][test] Fix X86 cross-platform tests

Use target-specific flags for building X86 non-runnable tests.

Reviewed By: Amir

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

2 years ago[RISCV] Remove redundant enabling of IAS for Clang, NFC
Brad Smith [Tue, 5 Apr 2022 03:38:18 +0000 (23:38 -0400)]
[RISCV] Remove redundant enabling of IAS for Clang, NFC

Generic_GCC::IsIntegratedAssemblerDefault() already takes care of RISCV.

Reviewed By: kito-cheng, MaskRay

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

2 years ago[X86] Improve x86-partial-reduction to support abs intrinsic
Wei Xiao [Wed, 30 Mar 2022 15:27:17 +0000 (23:27 +0800)]
[X86] Improve x86-partial-reduction to support abs intrinsic

Current implementation only recognizes absolute operation implemented by
select instruction. This patch adds support for abs intrinsic.

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

2 years ago[mlir][sparse] Factoring out `finalizeSegment` and (generic) `appendIndex`
wren romano [Mon, 4 Apr 2022 23:37:38 +0000 (16:37 -0700)]
[mlir][sparse] Factoring out `finalizeSegment` and (generic) `appendIndex`

This change introduces two new methods: `finalizeSegment` and `appendIndex`; and removes three old methods: `endDim`, `appendCurrentPointer`, `appendIndex`.  The two new methods better encapsulate their algorithms, thus allowing to remove repetitious code in several other places.

Depends On D122435

Reviewed By: aartbik

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

2 years ago[modules] Merge ObjC interface ivars with anonymous types.
Volodymyr Sapsai [Sat, 29 Jan 2022 01:08:21 +0000 (17:08 -0800)]
[modules] Merge ObjC interface ivars with anonymous types.

Without the fix ivars with anonymous types can trigger errors like

> error: 'TestClass::structIvar' from module 'Target' is not present in definition of 'TestClass' provided earlier
> [...]
> note: declaration of 'structIvar' does not match

It happens because types of ivars from different modules are considered
to be different. And it is caused by not merging anonymous `TagDecl`
from different modules.

To fix that I've changed `serialization::needsAnonymousDeclarationNumber`
to handle anonymous `TagDecl` inside `ObjCInterfaceDecl`. But that's not
sufficient as C code inside `ObjCInterfaceDecl` doesn't use interface
decl as a decl context but switches to its parent (TranslationUnit in
most cases).  I'm changing that to make `ObjCContainerDecl` the lexical
decl context but keeping the semantic decl context intact.

Test "check-dup-decls-inside-objc.m" doesn't reflect a change in
functionality but captures the existing behavior to prevent regressions.

rdar://85563013

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

2 years ago[docs] Add Loop Opt WG meeting ics.
Michael Kruse [Tue, 5 Apr 2022 01:06:37 +0000 (20:06 -0500)]
[docs] Add Loop Opt WG meeting ics.

Add ics file for biweekly loop optimization meeting.

Reviewed By: #loopoptwg, bmahjour

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

2 years agoRevert "[MLIR][Presburger] IntegerPolyhedron: add support for symbolic integer lexmin"
Arjun P [Mon, 4 Apr 2022 23:31:17 +0000 (00:31 +0100)]
Revert "[MLIR][Presburger] IntegerPolyhedron: add support for symbolic integer lexmin"

This reverts commit da92f92621e28a56fe8ad79d82eb60e436bf1d39.

2 years ago[MLIR][Presburger] IntegerPolyhedron: add support for symbolic integer lexmin
Arjun P [Mon, 4 Apr 2022 22:31:28 +0000 (23:31 +0100)]
[MLIR][Presburger] IntegerPolyhedron: add support for symbolic integer lexmin

Add support for computing the symbolic integer lexmin of a polyhedron.
This finds, for every assignment to the symbols, the lexicographically
minimum value attained by the dimensions. For example, the symbolic lexmin
of the set

`(x, y)[a, b, c] : (a <= x, b <= x, x <= c)`

can be written as

```
x = a if b <= a, a <= c
x = b if a <  b, b <= c
```

This also finds the set of assignments to the symbols that make the lexmin unbounded.

Reviewed By: Groverkss

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

2 years ago[AArch64] Alter mull buildvectors(ext(..)) combine to work on shuffles
David Green [Mon, 4 Apr 2022 22:07:47 +0000 (23:07 +0100)]
[AArch64] Alter mull buildvectors(ext(..)) combine to work on shuffles

D120018 altered this combine to work on buildvectors as opposed to
shuffle dup's. This works well for dups and other things that are
expanded into buildvectors. Some shuffles are legal though, and stay as
vector_shuffle through lowering. This expands the transform to also
handle shuffles, so that we can turn mul(shuffle(sext into
mul(sext(shuffle and more readily make smull/umull instructions. This
can come up from the SLP vectorizer adding shuffles that are costed from
extends.

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

2 years ago[AArch64] Add some tests for mul(shuffle(ext. NFC
David Green [Mon, 4 Apr 2022 21:51:45 +0000 (22:51 +0100)]
[AArch64] Add some tests for mul(shuffle(ext. NFC

2 years ago[libc++] Implement tests for private headers using the new generator
Louis Dionne [Fri, 25 Mar 2022 21:38:04 +0000 (17:38 -0400)]
[libc++] Implement tests for private headers using the new generator

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

2 years ago[mlir] Add MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID to SerializeToCubinPass
River Riddle [Mon, 4 Apr 2022 21:28:10 +0000 (14:28 -0700)]
[mlir] Add MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID to SerializeToCubinPass

This pass is defined in an anonymous namespace and requires an explicit TypeID

2 years ago[mlir][spirv] Check nullptr before usage to fix crash
Lei Zhang [Mon, 4 Apr 2022 21:19:44 +0000 (17:19 -0400)]
[mlir][spirv] Check nullptr before usage to fix crash

Reviewed By: mravishankar, hanchung

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

2 years agoAdd DumpBinaryEscaped method to JSONGenerator, avoid extra copy
Jason Molenda [Mon, 4 Apr 2022 21:11:21 +0000 (14:11 -0700)]
Add DumpBinaryEscaped method to JSONGenerator, avoid extra copy

All uses of JSONGenerator in debugserver would create a JSON text
dump of the object collection, then copy that string into a
binary-escaped string, then send it up to the lldb side or
make a compressed version and send that.

This adds a DumpBinaryEscaped method to JSONGenerator which
does the gdb remote serial protocol binary escaping directly,
and removes the need to pass over the string and have an
additional copy in memory.

Differential Revision: https://reviews.llvm.org/D122882
rdar://91117456

2 years ago[BOLT][NFC] Use X86 mnemonic checks
Amir Ayupov [Mon, 4 Apr 2022 21:04:39 +0000 (14:04 -0700)]
[BOLT][NFC] Use X86 mnemonic checks

Remove switches in X86MCPlusBuilder.cpp, use mnemonic checks instead

Reviewed By: rafauler

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

2 years ago[mlir] Rework the implementation of TypeID
River Riddle [Thu, 31 Mar 2022 00:00:37 +0000 (17:00 -0700)]
[mlir] Rework the implementation of TypeID

This commit restructures how TypeID is implemented to ideally avoid
the current problems related to shared libraries. This is done by changing
the "implicit" fallback path to use the name of the type, instead of using
a static template variable (which breaks shared libraries). The major downside to this
is that it adds some additional initialization costs for the implicit path. Given the
use of type names for uniqueness in the fallback, we also no longer allow types
defined in anonymous namespaces to have an implicit TypeID. To simplify defining
an ID for these classes, a new `MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID` macro
was added to allow for explicitly defining a TypeID directly on an internal class.

To help identify when types are using the fallback, `-debug-only=typeid` can be
used to log which types are using implicit ids.

This change generally only requires changes to the test passes, which are all defined
in anonymous namespaces, and thus can't use the fallback any longer.

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

2 years ago[libcxx] Stop recommending setting LIBCXX_HAS_WIN32_THREAD_API in the MinGW builds
Martin Storsjö [Wed, 23 Mar 2022 13:47:49 +0000 (15:47 +0200)]
[libcxx] Stop recommending setting LIBCXX_HAS_WIN32_THREAD_API in the MinGW builds

Since a8d15a926689c126c4d316788786e0160cfc1d5d / D110975, this is
the default, even if winpthread headers are available, so we don't
need to cargo cult setting this option in all builds.

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

2 years agoRequire C99 for more tests; NFC intended
Aaron Ballman [Mon, 4 Apr 2022 19:57:25 +0000 (15:57 -0400)]
Require C99 for more tests; NFC intended

This augments 5d90004874c7b040cd43597826aabb34757d25ab which got all of
the -verify lines, but accidentally missed all of the -verify= ones.

2 years ago[mlir][sparse] Simplifying code in expInsert
wren romano [Fri, 1 Apr 2022 19:51:39 +0000 (12:51 -0700)]
[mlir][sparse] Simplifying code in expInsert

Just some minor cleanup

Reviewed By: aartbik

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

2 years ago[tosa] Add option to disable tosa.apply_scale lowering in TosaToStandard
Rob Suderman [Mon, 4 Apr 2022 19:22:09 +0000 (12:22 -0700)]
[tosa] Add option to disable tosa.apply_scale lowering in TosaToStandard

Apply scale should be optionally disabled when lowering via TosaToStandard.
In most cases it should persist until the lowering to specific backend.

Reviewed By: jpienaar

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

2 years ago[clangd] Remove trivial uses of FileEntry::getName
Sam McCall [Mon, 4 Apr 2022 18:52:46 +0000 (20:52 +0200)]
[clangd] Remove trivial uses of FileEntry::getName

It's deprecated; migrate to FileEntryRef::getName where it doesn't matter.
Also change one subtle case of implicit FileEntry::getName to be explicit.

After this patch, all the remaining FileEntry::getName calls are subtle
cases where we may be relying on exactly which filename variant is returned
(for indexing, IWYU directive handling, etc).

2 years ago[X86] Add XOR(X, MIN_SIGNED_VALUE) -> ADD(X, MIN_SIGNED_VALUE) isel patterns (PR52267)
Simon Pilgrim [Mon, 4 Apr 2022 18:47:06 +0000 (19:47 +0100)]
[X86] Add XOR(X, MIN_SIGNED_VALUE) -> ADD(X, MIN_SIGNED_VALUE) isel patterns (PR52267)

Improve chances of folding to LEA patterns

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

2 years ago[mlir][capi] Fix leak in test
Daniel Resnick [Mon, 4 Apr 2022 18:26:13 +0000 (12:26 -0600)]
[mlir][capi] Fix leak in test