platform/upstream/llvm.git
2 years ago[NFC][regalloc] Pull out some AllocationOrder/CostPerUseLimit eviction logic
Mircea Trofin [Tue, 21 Dec 2021 04:03:40 +0000 (20:03 -0800)]
[NFC][regalloc] Pull out some AllocationOrder/CostPerUseLimit eviction logic

We are reusing that logic in the ML implementation.

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

2 years ago[MemoryBuiltin] Add an API for checking if an unused allocation can be removed [NFC]
Philip Reames [Mon, 10 Jan 2022 17:50:01 +0000 (09:50 -0800)]
[MemoryBuiltin] Add an API for checking if an unused allocation can be removed [NFC]

Not all allocation functions are removable if unused.  An example of a non-removable allocation would be a direct call to the replaceable global allocation function in C++.  An example of a removable one - at least according to historical practice - would be malloc.

2 years ago[LowerMatrixIntrinsics] Call getRegisterClassForType before getNumberOfRegisters.
Craig Topper [Mon, 10 Jan 2022 22:42:23 +0000 (14:42 -0800)]
[LowerMatrixIntrinsics] Call getRegisterClassForType before getNumberOfRegisters.

getNumberOfRegisters takes a ClassID as it's argument. It shouldn't be passed a bool. Assuming the bool meant vector or not, we should call getRegisterClassForType first.

Reviewed By: fhahn

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

2 years ago[clang-tidy] Refactor: Extract Class CheckRunner on check_clang_tidy.py
Richard [Sat, 1 Jan 2022 22:17:08 +0000 (15:17 -0700)]
[clang-tidy] Refactor: Extract Class CheckRunner on check_clang_tidy.py

Break up the huge function by extracting a class, storing intermediate
state as class members and breaking up the big function into a group
of class methods all at the same level of abstraction.

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

2 years ago[HIP] Fix device only linking for -fgpu-rdc
Yaxun (Sam) Liu [Fri, 7 Jan 2022 18:33:00 +0000 (13:33 -0500)]
[HIP] Fix device only linking for -fgpu-rdc

Currently when -fgpu-rdc is specified, HIP toolchain always does host linking even
if --cuda-device-only is specified.

This patch fixes that. Only device linking is performed when --cuda-device-only
is specified.

Reviewed by: Artem Belevich

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

2 years ago[lldb] fix memory leak in "GetGDBServerRegisterInfoXMLAndProcess"
Lirong Yuan [Mon, 10 Jan 2022 22:32:15 +0000 (14:32 -0800)]
[lldb] fix memory leak in "GetGDBServerRegisterInfoXMLAndProcess"

While running heap checker on a test that uses LLDB API, the following memory leak is found:

RAW: HeapChecker started...
RAW: Leak check _main_ detected leaks of 34 bytes in 4 objects
RAW: The 2 largest leaks:
RAW: Leak of 17 bytes in 2 objects allocated from:
@ 0x7fb93bd20166 NewHook()
@ 0x7fb929372a73 absl::base_internal::MallocHook::InvokeNewHookSlow()
@ 0x5600d1046093 libc_malloc
@ 0x7fb974529c03 xmlStrdup
@ 0x7fb9744c2a0b xmlGetProp
@ 0x7fb9749d9ed6 lldb_private::XMLNode::GetAttributeValue()
@ 0x7fb979043001 std::u::function::policy_invoker<>::__call_impl<>()
@ 0x7fb9749da06d lldb_private::XMLNode::ForEachChildElement()
@ 0x7fb97903c54d lldb_private::process_gdb_remote::ProcessGDBRemote::GetGDBServerRegisterInfoXMLAndProcess()
@ 0x7fb97902cfe4 lldb_private::process_gdb_remote::ProcessGDBRemote::GetGDBServerRegisterInfo()
@ 0x7fb97902c1d0 lldb_private::process_gdb_remote::ProcessGDBRemote::BuildDynamicRegisterInfo()
@ 0x7fb97902e92a lldb_private::process_gdb_remote::ProcessGDBRemote::SetThreadStopInfo()
@ 0x7fb97902db18 lldb_private::process_gdb_remote::ProcessGDBRemote::DoConnectRemote()
@ 0x7fb97584965e lldb_private::Process::ConnectRemote()
@ 0x7fb975839fa6 lldb_private::Platform::DoConnectProcess()
@ 0x7fb97583a39e lldb_private::Platform::ConnectProcessSynchronous()
@ 0x7fb97545b28b CommandObjectProcessConnect::DoExecute()
@ 0x7fb9755a70c9 lldb_private::CommandObjectParsed::Execute()
@ 0x7fb97559c0e9 lldb_private::CommandInterpreter::HandleCommand()
@ 0x7fb975460145 lldb_private::CommandObjectRegexCommand::DoExecute()
@ 0x7fb9755a72d2 lldb_private::CommandObjectRaw::Execute()
@ 0x7fb97559c0e9 lldb_private::CommandInterpreter::HandleCommand()
@ 0x7fb997a5f22e lldb::SBCommandInterpreter::HandleCommand()
@ 0x7fb997a5ef9b lldb::SBCommandInterpreter::HandleCommand()

This change fixes the memory leaks by freeing memory after it is no
longer in use. Tested with "ninja check-lldb".

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

2 years agoDon't fail if unable to promote loops during unrolling
Tyler Augustine [Mon, 10 Jan 2022 21:42:03 +0000 (21:42 +0000)]
Don't fail if unable to promote loops during unrolling

When the unroll factor is 1, we should only fail "unrolling" when the trip count also is determined to be 1 and it is unable to be promoted.

Reviewed By: bondhugula

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

2 years ago[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <list>
Nikolas Klauser [Mon, 10 Jan 2022 15:31:04 +0000 (16:31 +0100)]
[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <list>

Use `_LIBCPP_DEBUG_ASSERT` in `<list>`

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

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

2 years ago[openmp][amdgpu] Replace unsigned long with uint64_t
Jon Chesterfield [Mon, 10 Jan 2022 22:19:29 +0000 (22:19 +0000)]
[openmp][amdgpu] Replace unsigned long with uint64_t

Some types need to be 64 bit. Unsigned long is a hazard there.

Reviewed By: arsenm

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

2 years ago[libcxx][test] Auto-detect _LIBCPP_HAS_NO_UNICODE for MSVC STL
Casey Carter [Mon, 10 Jan 2022 21:56:22 +0000 (13:56 -0800)]
[libcxx][test] Auto-detect _LIBCPP_HAS_NO_UNICODE for MSVC STL

... by examining `_MSVC_EXECUTION_CHARACTER_SET` in the force-include header.

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

2 years agoFix a missed opportunity to merge stores.
Nadav Rotem [Mon, 10 Jan 2022 20:51:37 +0000 (12:51 -0800)]
Fix a missed opportunity to merge stores.

This commit fixes a missed opportunity in merging consecutive stores.
The code that searches for stores skipped the case of stores that
directly connect to the root. The comment above the implementation lists
this case but the code did not handle it. I found this pattern when
looking into the shared_ptr destructor. GCC generates the right
sequence. Here is a small repo:

    int foo(int* buff) {
        buff[0] = 0;
        int x = buff[1];
        buff[1] = 0;
        return x;
    }

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

2 years ago[llvm] Fix the module build
Jonas Devlieghere [Mon, 10 Jan 2022 21:39:49 +0000 (13:39 -0800)]
[llvm] Fix the module build

Fix the module build after 2c0fb96254fef2509b66d75290fedafd4adede95

2 years ago[doc][cmake] Convert read-me for the common CMake utils to reST
John Ericson [Sat, 8 Jan 2022 06:08:45 +0000 (06:08 +0000)]
[doc][cmake] Convert read-me for the common CMake utils to reST

@phosek mentioned others might want it reST for consistency. As I
personally do not like Markdown at all and just did the "usual GitHub
read-me thing" out of habit, I am more than happy to oblige.

Also fix the typos found in the original.

Reviewed By: phosek, lebedev.ri

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

2 years ago[libc++] Refactor the tests for std::random_device
Louis Dionne [Mon, 10 Jan 2022 21:30:28 +0000 (16:30 -0500)]
[libc++] Refactor the tests for std::random_device

That will make it easier to change the behavior of the arc4random()
based implementation. Note that in particular, the eval.pass.cpp test
used to work with non "/dev/random" based implementations because we'd
throw an exception upon constructing the random_device. This patch makes
the intent of the test clearer.

2 years ago[libunwind][cmake] Create `LIBUNWIND_INSTALL_INCLUDE_DIR` CACHE PATH
John Ericson [Sun, 9 Jan 2022 00:08:15 +0000 (00:08 +0000)]
[libunwind][cmake] Create `LIBUNWIND_INSTALL_INCLUDE_DIR` CACHE PATH

This is created on analogy with the other CACHE PATHs in this package,
and other `*_INSTALL_INCLUDE_DIR` in other packages.

The branching is adjusted to deduplicate some existing code, and
likewise avoid having to define this new variable more than once.

This will be used for D99484.

Reviewed By: #libunwind, compnerd

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

2 years ago[libc++] Alphabetize header #includes. NFCI.
Arthur O'Dwyer [Fri, 7 Jan 2022 14:45:05 +0000 (09:45 -0500)]
[libc++] Alphabetize header #includes. NFCI.

The NFC part of D116809. We still want to enforce this in CI,
but the mechanism for that is still to-be-determined.

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

2 years ago[libcxx] Use Fuchsia-native monotonic clock for std::chrono::steady_clock
Roland McGrath [Tue, 4 Jan 2022 18:25:20 +0000 (10:25 -0800)]
[libcxx] Use Fuchsia-native monotonic clock for std::chrono::steady_clock

Use the zx_clock_get_monotonic system call directly rather than
going through the POSIX clock_gettime function.  The libc function
is a trivial wrapper around the system call, and is not a standard C
function.  Avoiding it reduces the Fuchsia libc ABI surface that
libc++ depends on.

Reviewed By: phosek, ldionne, #libc

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

2 years ago[libc++] Alphabetize CMakeLists.txt and module.modulemap. NFC.
Arthur O'Dwyer [Mon, 10 Jan 2022 18:23:19 +0000 (13:23 -0500)]
[libc++] Alphabetize CMakeLists.txt and module.modulemap. NFC.

The NFC part of D116958. We still want to enforce this in CI,
but the mechanism for that is still to-be-determined.

2 years ago[lldb] Remove LLDB_RECORD_DUMMY_* macros
Jonas Devlieghere [Mon, 10 Jan 2022 20:05:54 +0000 (12:05 -0800)]
[lldb] Remove LLDB_RECORD_DUMMY_* macros

2 years ago[lldb] Remove LLDB_RECORD_CHAR_PTR_* macros
Jonas Devlieghere [Mon, 10 Jan 2022 19:55:50 +0000 (11:55 -0800)]
[lldb] Remove LLDB_RECORD_CHAR_PTR_* macros

2 years ago[NFC][regalloc] Pass RAGreedy to eviction adviser
Mircea Trofin [Wed, 5 Jan 2022 17:22:02 +0000 (09:22 -0800)]
[NFC][regalloc] Pass RAGreedy to eviction adviser

This patch simplifies the interface between RAGreedy and the eviction
adviser by passing the allocator to the adviser, which allows the latter
to extract needed information as needed, rather than requiring it be passed
piecemeal at construction time (which would also complicate later
evolution).

Part of this, the patch also moves ExtraRegInfo back to RAGreedy. We
keep the encapsulation of ExtraRegInfo because it has benefits (e.g.
improved readability by abstracting access to the cascade info) and also
simpler re-initialization at regalloc pass re-entry time (we just flush
the Optional).

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

2 years ago[flang] Fix the documentation on how to build flang
Peter Steinfeld [Tue, 4 Jan 2022 00:13:28 +0000 (16:13 -0800)]
[flang] Fix the documentation on how to build flang

I recently had an email exchange on flang-dev that revealed that the
documentation on how to build flang is incorrect.  This update fixes
that.

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

2 years ago[lldb] Remove lldb-instr
Jonas Devlieghere [Mon, 10 Jan 2022 19:41:31 +0000 (11:41 -0800)]
[lldb] Remove lldb-instr

2 years ago[TSan] Avoid deadlock in test for compiler-rt debug build
Julian Lettner [Mon, 10 Jan 2022 19:15:39 +0000 (11:15 -0800)]
[TSan] Avoid deadlock in test for compiler-rt debug build

rdar://86776155

2 years ago[clang][dataflow] Add transfer functions for assignment
Stanislav Gatev [Tue, 4 Jan 2022 13:47:14 +0000 (13:47 +0000)]
[clang][dataflow] Add transfer functions for assignment

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

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

2 years agoRevert "[CodeGen] Mark fma as const for Android"
Alex Xu (Hello71) [Mon, 10 Jan 2022 17:42:56 +0000 (09:42 -0800)]
Revert "[CodeGen] Mark fma as const for Android"

This code is intended to give a special exception for platforms which set errno in some math functions but not fma. This does not apply to Android, which does not set errno in any math functions (https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/math.h;drc=master;l=59). The correct implementation for Android is to set -fno-math-errno by default, which was done in https://reviews.llvm.org/D51068. Therefore, this special exception is no longer needed for Android. Deleting it slightly reduces code complexity, clang executable size, compile time, and test time.

This reverts fbfba29d74748b8fffd2f7cc654fb4c3659c8f67.

Reviewed By: pirama

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

2 years agoAMDGPU/GlobalISel: Explicitly track d16 for image legalization
Matt Arsenault [Sun, 9 Jan 2022 17:32:15 +0000 (12:32 -0500)]
AMDGPU/GlobalISel: Explicitly track d16 for image legalization

We were trying to guess at the original IR type for image intrinsics
after legalization to figure out if they were d16, but this didn't
work. Explicitly track if this is a d16 operation or not in the
opcode, as is done for the buffer intrinsics.

The OpenCL library is using f32 image writes with a dmask of 15 for
some reason, and this was incorrectly switching them to use d16. Fixes
image failures in the OpenCL conformance test. The equivalent dmask
for loads doesn't even select in either selector.

2 years ago[cmake] Enable users to specify archive creation commands
Alexander Shaposhnikov [Mon, 10 Jan 2022 18:53:31 +0000 (18:53 +0000)]
[cmake] Enable users to specify archive creation commands

This diff enables users to override CMAKE_C_ARCHIVE_CREATE & CMAKE_CXX_ARCHIVE_CREATE
(currently set in HandleLLVMOptions.cmake).

For example, one can specify
cmake -DCMAKE_C_ARCHIVE_CREATE="<CMAKE_AR> TDqc <TARGET> <LINK_FLAGS> <OBJECTS>" \
      -DCMAKE_CXX_ARCHIVE_CREATE="<CMAKE_AR> TDqc <TARGET> <LINK_FLAGS> <OBJECTS>" ...
to make the build create thin archives instead of regular ones.
For a clean run `ninja lld` using thin archives seems to reduce the size
of the build directory from ~14GB to ~8GB

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

2 years agoGlobalISel: Pass DebugLoc to getFunctionLiveInPhysReg
Matt Arsenault [Sun, 9 Jan 2022 15:25:36 +0000 (10:25 -0500)]
GlobalISel: Pass DebugLoc to getFunctionLiveInPhysReg

Fixes crash in assertion about dropping debug info.

2 years ago[clang-tidy] Fix RenamerClangTidyChecks suggesting invalid macro identifiers
Logan Smith [Fri, 7 Jan 2022 18:22:56 +0000 (10:22 -0800)]
[clang-tidy] Fix RenamerClangTidyChecks suggesting invalid macro identifiers

This behavior was fixed for regular identifiers in
9f3edc323a88c1a179a0a5a9dc9a87a2964c0d48, but the same fix was not applied to
macro fixits. This addresses https://github.com/llvm/llvm-project/issues/52895.

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

2 years agoAMDGPU: Avoid null check during addrspacecast lowering
Matt Arsenault [Tue, 28 Dec 2021 15:22:13 +0000 (10:22 -0500)]
AMDGPU: Avoid null check during addrspacecast lowering

If we know the source is a valid object, we do not need to insert a
null check. This misses a lot of opportunities from
metadata/attributes not tracked in codegen.

2 years ago[mlir][NFC] Fully spell mlir typenames in BaseOpWithOffsetSizesAndStrides
Ivan Butygin [Mon, 10 Jan 2022 14:52:41 +0000 (17:52 +0300)]
[mlir][NFC] Fully spell mlir typenames in BaseOpWithOffsetSizesAndStrides

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

2 years ago[lldb] Disable several lldb tests that are flaky on Windows
Stella Stamenova [Mon, 10 Jan 2022 18:21:12 +0000 (10:21 -0800)]
[lldb] Disable several lldb tests that are flaky on Windows

This tests have recently become flaky (flakier?) causing occasional failures in the windows lldb buildbot

2 years ago[flang] Do not lose call in shape inquiry on function reference
Jean Perier [Mon, 10 Jan 2022 18:09:45 +0000 (19:09 +0100)]
[flang] Do not lose call in shape inquiry on function reference

Currently, something like `print *, size(foo(n,m))` was rewritten
to `print *, size(foo_result_symbol)` when foo result is a non constant
shape array. This cannot be processed by lowering or reprocessed by a
Fortran compiler since the syntax is wrong (`foo_result_symbol` is
unknown on the caller side) and the arguments are lost when they might
be required to compute the result shape.

It is not possible (and probably not desired) to make GetShape fail in
general in such case since returning nullopt seems only expected for
scalars or assumed rank (see GetRank usage in lib/Semantics/check-call.cpp),
and returning a vector with nullopt extent may trigger some checks to
believe they are facing an assumed size (like here in intrinsic argument
checks: https://github.com/llvm/llvm-project/blob/196204c72c68a577c72af95d70f18e3550939a5e/flang/lib/Evaluate/intrinsics.cpp#L1530).

Hence, I went for a solution that limits the rewrite change to folding
(where the original expression is returned if the shape depends on a non
constant shape from a call).

I added a non default option to GetShapeHelper that prevents the rewrite
of shape inquiry on calls to descriptor inquiries. At first I wanted to
avoid touching GetShapeHelper, but it would require to re-implement all
its logic to determine if the shape comes from a function call or not
(the expression could be `size(1+foo(n,m))`). So added an alternate
entry point to GetShapeHelper seemed the cleanest solution to me.

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

2 years ago[ELF] Support mixed TLSDESC and TLS GD
Fangrui Song [Mon, 10 Jan 2022 18:03:21 +0000 (10:03 -0800)]
[ELF] Support mixed TLSDESC and TLS GD

We only support both TLSDESC and TLS GD for x86 so this is an x86-specific
problem. If both are used, only one R_X86_64_TLSDESC is produced and TLS GD
accesses will incorrectly reference R_X86_64_TLSDESC. Fix this by introducing
SymbolAux::tlsDescIdx.

Reviewed By: ikudrin

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

2 years ago[SCEV] Sequential/in-order `UMin` expression
Roman Lebedev [Mon, 10 Jan 2022 17:49:41 +0000 (20:49 +0300)]
[SCEV] Sequential/in-order `UMin` expression

As discussed in https://github.com/llvm/llvm-project/issues/53020 / https://reviews.llvm.org/D116692,
SCEV is forbidden from reasoning about 'backedge taken count'
if the branch condition is a poison-safe logical operation,
which is conservatively correct, but is severely limiting.

Instead, we should have a way to express those
poison blocking properties in SCEV expressions.

The proposed semantics is:
```
Sequential/in-order min/max SCEV expressions are non-commutative variants
of commutative min/max SCEV expressions. If none of their operands
are poison, then they are functionally equivalent, otherwise,
if the operand that represents the saturation point* of given expression,
comes before the first poison operand, then the whole expression is not poison,
but is said saturation point.
```
* saturation point - the maximal/minimal possible integer value for the given type

The lowering is straight-forward:
```
compare each operand to the saturation point,
perform sequential in-order logical-or (poison-safe!) ordered reduction
over those checks, and if reduction returned true then return
saturation point else return the naive min/max reduction over the operands
```
https://alive2.llvm.org/ce/z/Q7jxvH (2 ops)
https://alive2.llvm.org/ce/z/QCRrhk (3 ops)
Note that we don't need to check the last operand: https://alive2.llvm.org/ce/z/abvHQS
Note that this is not commutative: https://alive2.llvm.org/ce/z/FK9e97

That allows us to handle the patterns in question.

Reviewed By: nikic, reames

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

2 years ago[libc++] Properly handle specializations of std::is_placeholder.
Arthur O'Dwyer [Thu, 30 Dec 2021 01:45:08 +0000 (20:45 -0500)]
[libc++] Properly handle specializations of std::is_placeholder.

Before this patch, the user needed to specialize both of
`is_placeholder<MyType>` and `is_placeholder<const MyType>`.
After this patch, only the former is needed (although the
latter is harmless if provided).

The new tests don't actually fail unless return type deduction
is used, which is a C++14 feature. Specializing `is_placeholder`
is still allowed in C++11, though.

Fixes #51095.

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

2 years agoMinor style tweaks following fb93659
Philip Reames [Mon, 10 Jan 2022 17:32:23 +0000 (09:32 -0800)]
Minor style tweaks following fb93659

2 years ago[clang][HeaderSearch] Support framework includes in suggestPath...
David Goldman [Mon, 6 Dec 2021 21:33:29 +0000 (16:33 -0500)]
[clang][HeaderSearch] Support framework includes in suggestPath...

Clang will now search through the framework includes to identify
the framework include path to a file, and then suggest a framework
style include spelling for the file.

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

2 years agoRevert "[clang] Remove redundant member initialization (NFC)"
Kazu Hirata [Mon, 10 Jan 2022 17:21:59 +0000 (09:21 -0800)]
Revert "[clang] Remove redundant member initialization (NFC)"

This reverts commit 80e2c587498a7b2bf14dde47a33a058da6e88a9a.

The original patch causes a lot of warnings on gcc like:

  llvm-project/clang/include/clang/Basic/Diagnostic.h:1329:3: warning:
  base class ‘class clang::StreamingDiagnostic’ should be explicitly
  initialized in the copy constructor [-Wextra]

2 years ago[instcombine] Add align return attributes for operator new(..., align_val)
Bryce Wilson [Mon, 10 Jan 2022 17:08:55 +0000 (09:08 -0800)]
[instcombine] Add align return attributes for operator new(..., align_val)

(Split from original patch to separate non-NFC part and add coverage.  I typoed when adding the new test, so this change includes the typo fix to let libfunc recongize the signature.  Didn't figure it was worth another separate commit.)

Differential Revision: https://reviews.llvm.org/D116851 (part 2 of 2)

2 years ago[MemoryBuiltins] Add field for alignment argument [NFC]
Bryce Wilson [Mon, 10 Jan 2022 16:58:44 +0000 (08:58 -0800)]
[MemoryBuiltins] Add field for alignment argument [NFC]

There are a few places where the alignment argument for AlignedAllocLike functions was previously hardcoded. This patch adds an getAllocAlignment function and a change to the MemoryBuiltin table to allow alignment arguments to be found generically.

This will shortly allow alignment inference on operator new's with align_val params and an extension to Attributor's HeapToStack.  The former will follow shortly - I split Bryce's patch for purpose of having the large change be NFC.  The later will be reviewed separately.

Differential Revision: https://reviews.llvm.org/D116851 (part 1 of 2)

2 years ago[RISCV] Use FP ABI on some of the FP tests to reduce the number of CHECK lines. NFC
Craig Topper [Mon, 10 Jan 2022 16:57:38 +0000 (08:57 -0800)]
[RISCV] Use FP ABI on some of the FP tests to reduce the number of CHECK lines. NFC

These tests are interested in the FP instructions being used, not
the conversions needed to pass the arguments/returns in GPRs.

Reviewed By: asb

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

2 years ago[ConstantFolding] Clean up Intrinsics::abs undef handling
Simon Pilgrim [Mon, 10 Jan 2022 17:03:43 +0000 (17:03 +0000)]
[ConstantFolding] Clean up Intrinsics::abs undef handling

Match cttz/ctlz handling by assuming C1 == 0 if C1 != 1 - I've added an assertion as well.

Fixes static analyzer nullptr dereference warnings.

2 years agoRevert "[clangd] Enable expand-auto for decltype(auto)."
Nico Weber [Mon, 10 Jan 2022 17:01:19 +0000 (12:01 -0500)]
Revert "[clangd] Enable expand-auto for decltype(auto)."

This reverts commit 37ec65e1d705f56fe5551de1dfcbac1e071588a2.

Its prerequisite 55d96ac3dc56bdebea854952a724c2a50d96ce19 wsa
reverted in c2293bc17dd09d552c5fdd13ff2b7c5738c5a10a. c2293bc's
patch description claimed that it reverted 37ec65 as well,
but it apparently didn't.

See https://reviews.llvm.org/D116921#3231802

2 years ago[MLIR] Generalize select to arithmetic canonicalization
William S. Moses [Fri, 7 Jan 2022 22:26:38 +0000 (17:26 -0500)]
[MLIR] Generalize select to arithmetic canonicalization

Given a select whose result is an i1, we can eliminate the conditional in the select completely by adding a few arithmetic operations.

Reviewed By: ftynse

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

2 years ago[AMDGPU] Fix an unused variable warning (NFC)
Kazu Hirata [Mon, 10 Jan 2022 16:49:46 +0000 (08:49 -0800)]
[AMDGPU] Fix an unused variable warning (NFC)

This patch fixes:

  llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:2245:12: error:
  unused variable 'Ins' [-Werror,-Wunused-variable]

2 years agoAdd test coverage for D116851
Philip Reames [Mon, 10 Jan 2022 16:38:40 +0000 (08:38 -0800)]
Add test coverage for D116851

2 years ago[instcombine] Infer alignment for aligned_alloc with potentially zero size
Philip Reames [Mon, 10 Jan 2022 16:25:20 +0000 (08:25 -0800)]
[instcombine] Infer alignment for aligned_alloc with potentially zero size

This change removes a previous restriction where we had to prove the allocation performed by aligned_alloc was non-zero in size before using the align parameter to annotate the result.  I believe this was conservatism around the C11 specification of this routine which allowed UB when size was not a multiple of alignment, but if so, it was a partial one at best.  (ex: align 32, size 16  was equally UB, but not restricted)  The spec has since been clarified to require nullptr return, not UB.

A nullptr - the documented return for this function on failure for all cases after UB mentioned above was removed - is trivially aligned for any power of two.  This isn't totally new behavior even for this transform, we'd previously annotate potentially failing allocs (e.g. huge sizes) meaning we were putting align on potentially null pointers anyways.  This change simpy does the same for all failure modes.

2 years ago[libc++] libcxx/utils: s/preambule/preamble/g. NFC.
Arthur O'Dwyer [Mon, 10 Jan 2022 16:26:29 +0000 (11:26 -0500)]
[libc++] libcxx/utils: s/preambule/preamble/g. NFC.

2 years ago[SemaDecl] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Simon Pilgrim [Mon, 10 Jan 2022 16:28:04 +0000 (16:28 +0000)]
[SemaDecl] Use castAs<> instead of getAs<> to avoid dereference of nullptr

This will assert the cast is correct instead of returning nullptr

2 years agoFix unused-variable warnings after d0ee094d6acf72608e927bf2e9ba69c57da59a96.
James Y Knight [Mon, 10 Jan 2022 16:24:20 +0000 (16:24 +0000)]
Fix unused-variable warnings after d0ee094d6acf72608e927bf2e9ba69c57da59a96.

2 years ago[Dexter] Allow DexUnreachable in supplementary .dex files
Jeremy Morse [Mon, 10 Jan 2022 12:11:15 +0000 (12:11 +0000)]
[Dexter] Allow DexUnreachable in supplementary .dex files

DexUnreachable is a useful tool for specifying that lines shouldn't be
stepped on. Right now they have to be placed in the source file; lets allow
them to be placed instead in a detached .dex file, by adding on_line and
line-range keyword arguments to the command.

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

2 years ago[NFC] clang-format the whole ScalarEvolutionExpressions.h
Roman Lebedev [Mon, 10 Jan 2022 16:17:32 +0000 (19:17 +0300)]
[NFC] clang-format the whole ScalarEvolutionExpressions.h

This file has completely wrong formatting,
and modifying it leads to having to fight around that. every time.

This is a pure reformatting, there are *NO* other changes here.

2 years ago[Attributor][FIX] Ensure "IsExact" is false for non-exact accesses
Johannes Doerfert [Mon, 10 Jan 2022 15:53:12 +0000 (09:53 -0600)]
[Attributor][FIX] Ensure "IsExact" is false for non-exact accesses

If we look at potentially interfering accesses we need to ensure the
"IsExact" flag is set appropriately. Accesses that have an "unknown"
size or offset cannot be exact matches and we missed to flag that.

Error and test reported by Serguei N. Dmitriev.

2 years ago[PGOInstrumentation] populateEHOperandBundle - earlyout if !isa<CallBase>
Simon Pilgrim [Mon, 10 Jan 2022 15:34:24 +0000 (15:34 +0000)]
[PGOInstrumentation] populateEHOperandBundle - earlyout if !isa<CallBase>

All paths (that actually do anything) require a successful dyn_cast<CallBase> - so just earlyout if the cast fails

Fixes static analyzer nullptr deference warning

2 years ago[LowerExpectIntrinsic] Use cast<> instead of dyn_cast<> to avoid dereference of nullp...
Simon Pilgrim [Mon, 10 Jan 2022 15:23:49 +0000 (15:23 +0000)]
[LowerExpectIntrinsic] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC

2 years ago[lldb/platform-gdb] Clear cached protocol state upon disconnection
Pavel Labath [Mon, 3 Jan 2022 15:49:58 +0000 (16:49 +0100)]
[lldb/platform-gdb] Clear cached protocol state upon disconnection

Previously we would persist the flags indicating whether the remote side
supports a particular feature across reconnects, which is obviously not
a good idea.

I implement the clearing by nuking (its the only way to be sure :) the
entire GDBRemoteCommunication object in the disconnect operation and
creating a new one upon connection. This allows us to maintain a nice
invariant that the GDBRemoteCommunication object (which is now a
pointer) exists only if it is connected. The downside to that is that a
lot of functions now needs to check the validity of the pointer instead
of blindly accessing the object.

The process communication does not suffer from the same issue because we
always destroy the entire Process object for a relaunch.

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

2 years ago[mlir][Bufferize] Fix incorrect bufferization of rank-reducing tensor ops.
Nicolas Vasilache [Sun, 9 Jan 2022 21:09:24 +0000 (16:09 -0500)]
[mlir][Bufferize] Fix incorrect bufferization of rank-reducing tensor ops.

This revision fixes SubviewOp, InsertSliceOp, ExtractSliceOp construction during bufferization
where not all offset/size/stride operands were properly specified.

A test that exhibited problematic behaviors related to incorrect memref casts is introduced.
Init tensor optimization is disabled in teh testing func bufferize pass.

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

2 years ago[Thumb2] Regenerate test checks (NFC)
Nikita Popov [Mon, 10 Jan 2022 15:12:29 +0000 (16:12 +0100)]
[Thumb2] Regenerate test checks (NFC)

2 years ago[clang][dataflow] Change `transfer` function to update lattice element in place.
Yitzhak Mandelbaum [Fri, 7 Jan 2022 19:39:12 +0000 (19:39 +0000)]
[clang][dataflow] Change `transfer` function to update lattice element in place.

Currently, the transfer function returns a new lattice element, which forces an
unnecessary copy on processing each CFG statement.

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

2 years ago[mlir][linalg][bufferize][NFC] Pass missing BufferizationState objs as const ref
Matthias Springer [Mon, 10 Jan 2022 14:36:46 +0000 (23:36 +0900)]
[mlir][linalg][bufferize][NFC] Pass missing BufferizationState objs as const ref

These should have been updated as part of D116742.

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

2 years ago[mlir][Linalg] Disable init_tensor elimination by default
Nicolas Vasilache [Mon, 10 Jan 2022 14:03:23 +0000 (09:03 -0500)]
[mlir][Linalg] Disable init_tensor elimination by default

init_tensor elimination is arguably a pre-optimization that should be separated from comprehensive bufferization.
In any case it is still experimental and easily results in wrong IR with violated SSA def-use orderings.
Isolate the optimization behind a flag, separate the test cases and add a test case that would results in wrong IR.

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

2 years agoRevert "[AST] Add RParen loc for decltype AutoTypeloc."
Haojian Wu [Mon, 10 Jan 2022 14:09:17 +0000 (15:09 +0100)]
Revert "[AST] Add RParen loc for decltype AutoTypeloc."

This breaks a clang-tidy check, needs to investigate and fix. Revert
them to bring the buildbot back.

This reverts commit 55d96ac3dc56bdebea854952a724c2a50d96ce19 and
37ec65e1d705f56fe5551de1dfcbac1e071588a2

2 years ago[LoopVectorize] Make VPWidenCanonicalIVRecipe::execute work for scalable vectors
David Sherwood [Wed, 3 Nov 2021 17:09:34 +0000 (17:09 +0000)]
[LoopVectorize] Make VPWidenCanonicalIVRecipe::execute work for scalable vectors

The code in VPWidenCanonicalIVRecipe::execute only worked for fixed-width
vectors due to the way we generate the values per lane. This patch changes
the code to use a combination of vector splats and step vectors to get
the same result. This then works for both fixed-width and scalable vectors.

Tests that exercise this code path for scalable vectors have been added here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding.ll

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

2 years ago[SROA] Switch replacement of dead/UB/unreachable ops from undef to poison
Nuno Lopes [Mon, 10 Jan 2022 13:11:44 +0000 (13:11 +0000)]
[SROA] Switch replacement of dead/UB/unreachable ops from undef to poison

SROA has 3 data-structures where it stores sets of instructions that should
be deleted:
 - DeadUsers -> instructions that are UB or have no users
 - DeadOperands -> instructions that are UB or operands of useless phis
 - DeadInsts -> "dead" instructions, including loads of uninitialized memory
with users

The first 2 sets can be RAUW with poison instead of undef. No brainer as UB
can be replaced with poison, and for instructions with no users RAUW is a
NOP.

The 3rd case cannot be currently replaced with poison because the set mixes
the loads of uninit memory. I leave that alone for now.

Another case where we can use poison is in the construction of vectors from
multiple loads. The base vector for the first insertelement is now poison as
it doesn't matter as it is fully overwritten by inserts.

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

2 years ago[CodeGen] Avoid some pointer element type accesses
Nikita Popov [Mon, 10 Jan 2022 13:58:38 +0000 (14:58 +0100)]
[CodeGen] Avoid some pointer element type accesses

Possibly this is sufficient to fix PR53089.

2 years ago[libc++] Refactor the test for join_view's default constructor
Louis Dionne [Wed, 15 Dec 2021 16:35:09 +0000 (11:35 -0500)]
[libc++] Refactor the test for join_view's default constructor

In particular, this removes the need for adding a ad-hoc `operator==`
to forward_iterator.

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

2 years agoUse a sorted array instead of a map to store AttrBuilder string attributes
Serge Guelton [Mon, 3 Jan 2022 18:32:19 +0000 (13:32 -0500)]
Use a sorted array instead of a map to store AttrBuilder string attributes

Using and std::map<SmallString, SmallString> for target dependent attributes is
inefficient: it makes its constructor slightly heavier, and involves extra
allocation for each new string attribute. Storing the attribute key/value as
strings implies extra allocation/copy step.

Use a sorted vector instead. Given the low number of attributes generally
involved, this is cheaper, as showcased by

https://llvm-compile-time-tracker.com/compare.php?from=5de322295f4ade692dc4f1823ae4450ad3c48af2&to=05bc480bf641a9e3b466619af43a2d123ee3f71d&stat=instructions

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

2 years ago[TypeFinder] Support opaque pointers
Nikita Popov [Mon, 10 Jan 2022 09:40:33 +0000 (10:40 +0100)]
[TypeFinder] Support opaque pointers

We need to explicitly visit a number of types, as these are no
longer reachable through the pointer type if opaque pointers are
enabled. This is similar to ValueEnumerator changes that have
been done previously.

2 years agoset __NO_MATH_ERRNO__ if -fno-math-errno
Alex Xu (Hello71) [Mon, 10 Jan 2022 13:44:44 +0000 (08:44 -0500)]
set __NO_MATH_ERRNO__ if -fno-math-errno

This causes modern glibc to unset math_errhandling MATH_ERRNO. gcc 12
also sets some other macros, but most of them are associated with
flags ignored by clang, so without library examples, it is difficult to
determine whether they should be set. I think setting this one macro is
OK for now.

2 years ago[libc++] Add missing `return 0` to main() functions in the tests
Louis Dionne [Mon, 10 Jan 2022 13:37:54 +0000 (08:37 -0500)]
[libc++] Add missing `return 0` to main() functions in the tests

2 years ago[mlir][linalg][bufferize][NFC] Update comments in BufferizableOpInterface
Matthias Springer [Mon, 10 Jan 2022 13:31:49 +0000 (22:31 +0900)]
[mlir][linalg][bufferize][NFC] Update comments in BufferizableOpInterface

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

2 years ago[libc++] Fix link to bug tracker
Louis Dionne [Mon, 10 Jan 2022 13:33:14 +0000 (08:33 -0500)]
[libc++] Fix link to bug tracker

2 years ago[CostModel][X86] Update ROTL/ROTR vXi8/vXi16 costs on AVX512BW targets
Simon Pilgrim [Mon, 10 Jan 2022 12:40:02 +0000 (12:40 +0000)]
[CostModel][X86] Update ROTL/ROTR vXi8/vXi16 costs on AVX512BW targets

Refresh based off recent improvements to codegen and the helper script from D103695

2 years ago[libc++] Fix the documentation and re-enable documentation CI
Louis Dionne [Sun, 9 Jan 2022 19:40:10 +0000 (14:40 -0500)]
[libc++] Fix the documentation and re-enable documentation CI

The documentation CI job is very cheap, so we can afford to keep it
around even with reduced capacity. This commit fixes the documentation
(which had an invalid reference in it) and re-enables that CI step.

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

2 years ago[mlir][linalg][bufferize][NFC] Clean up bufferization entry point
Matthias Springer [Mon, 10 Jan 2022 12:40:05 +0000 (21:40 +0900)]
[mlir][linalg][bufferize][NFC] Clean up bufferization entry point

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

2 years ago[clangd] Enable expand-auto for decltype(auto).
Haojian Wu [Mon, 10 Jan 2022 09:10:41 +0000 (10:10 +0100)]
[clangd] Enable expand-auto for decltype(auto).

Based on https://reviews.llvm.org/D116919.

Fixes https://github.com/clangd/clangd/issues/121

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

2 years ago[llvm-objcopy] Implement the PE-COFF specific --subsystem option
Martin Storsjö [Mon, 3 Jan 2022 13:51:37 +0000 (15:51 +0200)]
[llvm-objcopy] Implement the PE-COFF specific --subsystem option

This implements the parsing of the highly PE-COFF specific option
in ConfigManager.cpp, setting Optional<> values in COFFConfig, which
then are used in COFFObjcopy.

This should fix https://github.com/mstorsjo/llvm-mingw/issues/239.

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

2 years agoAArch64: don't claim to preserve registers used by prologue code
Tim Northover [Tue, 16 Nov 2021 12:26:16 +0000 (12:26 +0000)]
AArch64: don't claim to preserve registers used by prologue code

2 years agoAMDGPU/GlobalISel: Rework legalization for extract/insert vector elt
Petar Avramovic [Mon, 10 Jan 2022 12:14:28 +0000 (13:14 +0100)]
AMDGPU/GlobalISel: Rework legalization for extract/insert vector elt

Use G_MERGE_VALUES and G_UNMERGE_VALUES on vector elements instead of
G_EXTRACT and G_INSERT when doing custom legalization for
G_EXTRACT_VECTOR_ELT and G_INSERT_VECTOR_ELT.
With this approach legalization artifact combiner gets direct access
to all vector elements.

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

2 years ago[SROA] Reduce the number of times a IRBuilder is constructed (NFC).
Florian Hahn [Mon, 10 Jan 2022 12:09:13 +0000 (12:09 +0000)]
[SROA] Reduce the number of times a IRBuilder is constructed (NFC).

This patch reduces the number of times IRBuilders need to be constructed
in SROA.cpp by passing existing ones by reference to the appropriate
places.

2 years ago[AST] Add RParen loc for decltype AutoTypeloc.
Haojian Wu [Fri, 7 Jan 2022 23:12:18 +0000 (00:12 +0100)]
[AST] Add RParen loc for decltype AutoTypeloc.

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

2 years ago[AST] Use recovery-expr to preserve incomplete-type-member-access expression.
Haojian Wu [Fri, 7 Jan 2022 21:55:58 +0000 (22:55 +0100)]
[AST] Use recovery-expr to preserve incomplete-type-member-access expression.

Fixes https://github.com/clangd/clangd/issues/502

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

2 years ago[mlir] address post-commit review for D116759
Alex Zinenko [Mon, 10 Jan 2022 11:40:38 +0000 (12:40 +0100)]
[mlir] address post-commit review for D116759

2 years ago[SCEVExpander] Only create trunc when needed.
Florian Hahn [Mon, 10 Jan 2022 11:31:26 +0000 (11:31 +0000)]
[SCEVExpander] Only create trunc when needed.

9345ab3a4550 updated generateOverflowCheck to skip creating checks that
always evaluate to false. This in turn means that we only need to
create TruncTripCount if it is actually used.

Sink the TruncTripCount creating into ComputeEndCheck, so it is only
created when there's an actual check.

2 years ago[Dexter] Allow tests to specify command line options
Jeremy Morse [Mon, 10 Jan 2022 11:22:51 +0000 (11:22 +0000)]
[Dexter] Allow tests to specify command line options

This patch adds a "DexCommandLine" command, allowing dexter tests to
specify what command line options the test should be started with. I've
also plumbed it through into the debuggers.

This eases the matter of pointing Dexter at larger tests, or controlling
different paths through a single binary from a Dexter test.

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

2 years ago[Clang][AArch64][ARM] PMUv3.4 Option Added
Mubashar Ahmad [Wed, 5 Jan 2022 16:53:59 +0000 (16:53 +0000)]
[Clang][AArch64][ARM] PMUv3.4 Option Added

An option has been added to Clang to enable or disable
the PMU v3.4 architecture extension.

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

2 years ago[clangd] Include fixer for missing functions in C
Sam McCall [Fri, 10 Dec 2021 03:17:50 +0000 (04:17 +0100)]
[clangd] Include fixer for missing functions in C

A function call `unresolved()` in C will generate an implicit declaration
of the missing function and warn `ext_implicit_function_decl` or so.
(Compared to in C++ where we get `err_undeclared_var_use`).
We want to try to resolve these names.

Unfortunately typo correction is disabled in sema for performance
reasons unless this warning is promoted to error.
(We need typo correction for include-fixer.)
It's not clear to me where a switch to force this correction on should
go, include-fixer is kind of a hack. So hack more by telling sema we're
promoting them to error.

Fixes https://github.com/clangd/clangd/issues/937

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

2 years ago[mlir] Don't inline calls from dead SCCs
Alex Zinenko [Mon, 10 Jan 2022 10:39:06 +0000 (11:39 +0100)]
[mlir] Don't inline calls from dead SCCs

During iterative inlining of the functions in a multi-step call chain, the
inliner could add the same call operation several times to the worklist, which
led to use-after-free when this op was considered more than once.

Closes #52887.

Reviewed By: wsmoses

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

2 years agoRevert "[LoopFlatten] Move it to a LoopPassManager"
David Green [Mon, 10 Jan 2022 11:03:49 +0000 (11:03 +0000)]
Revert "[LoopFlatten] Move it to a LoopPassManager"

This commit caused performance regressions due to differences in the
expected code during loop flattening. Reverting it until the fix is
ready, which hopefully wont take too long.

This reverts commit 86825fc2fb363b807569327880c05e4b0b5393ec.

2 years ago[mlir][memref] Tighten verification of memref.reinterpret_cast
Stephan Herhut [Fri, 7 Jan 2022 08:53:14 +0000 (09:53 +0100)]
[mlir][memref] Tighten verification of memref.reinterpret_cast

We allow the omission of a map in memref.reinterpret_cast under the assumption,
that the cast might cast to an identity layout. This change adds verification
that the static knowledge that is present in the reinterpret_cast supports
this assumption.

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

2 years ago[LoopVectorize] Add support for tail folding using scalable vectors
David Sherwood [Tue, 26 Oct 2021 08:55:30 +0000 (09:55 +0100)]
[LoopVectorize] Add support for tail folding using scalable vectors

This patch fixes up an issue with InnerLoopVectorizer::getOrCreateVectorTripCount
whereby we weren't correctly generating the runtime trip count
for scalable vectors when tail-folding.

It also removes some asserts in the tail-folding path for cases when
the VF is not scalable.

In this patch I have only permitted tail-folding to be enabled
explicitly for scalable vectors when the user has specified one
of the following flags:

  -prefer-predicate-over-epilogue=predicate-dont-vectorize
  -prefer-predicate-over-epilogue=predicate-else-scalar-epilogue

For now it's best not to enable tail-folding with scalable vectors for
low trip counts or when optimising for code size, since there has been
no analysis on whether this is worth it.

Various tests have been added here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding.ll
  Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll

The tests cannot be target independent because they require masked
load/store support, i.e. TTI.isLegalMaskedLoad and TTI.isLegalMaskedStore
need to return true.

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

2 years ago[AArch64][SVE] Fold predicate into compare
Cullen Rhodes [Mon, 10 Jan 2022 10:21:52 +0000 (10:21 +0000)]
[AArch64][SVE] Fold predicate into compare

Codegen of added testcase before this patch:

  ptrue   p0.s
  cmpgt   p1.s, p0/z, z0.s, z1.s
  cmpge   p2.s, p0/z, z2.s, z1.s
  and     p0.b, p0/z, p1.b, p2.b
  ret

Patterns originally authored by Will Lovett.

Reviewed By: david-arm

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

2 years ago[mlir][OpenMP] Change the syntax of omp.atomic.read op
Shraiysh Vaishay [Mon, 10 Jan 2022 09:56:20 +0000 (15:26 +0530)]
[mlir][OpenMP] Change the syntax of omp.atomic.read op

This patch changes the syntax of omp.atomic.read to take the address of
destination, instead of having the value in a result. This will allow
using omp.atomic.read operation within an omp.atomic.capture operation
thus making its implementation less complex.

Reviewed By: peixin

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

2 years ago[NFC] Add tests for splats of illegal integer vector types
David Sherwood [Fri, 7 Jan 2022 14:01:29 +0000 (14:01 +0000)]
[NFC] Add tests for splats of illegal integer vector types

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

2 years ago[clangd] Support configuration of inlay hints.
Sam McCall [Thu, 6 Jan 2022 01:01:13 +0000 (02:01 +0100)]
[clangd] Support configuration of inlay hints.

The idea is that the feature will always be advertised at the LSP level, but
depending on config we'll return partial or no responses.

We try to avoid doing the analysis for hints we're not going to return.

Examples of syntax:
```
InlayHints:
  Enabled: No
---
InlayHints:
  ParameterNames: No
---
InlayHints:
  ParameterNames: Yes
  DeducedTypes: Yes
```

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

2 years ago[Parse] Use empty RecoveryExpr when if/while/do/switch conditions fail to parse
Sam McCall [Thu, 11 Nov 2021 14:27:10 +0000 (15:27 +0100)]
[Parse] Use empty RecoveryExpr when if/while/do/switch conditions fail to parse

This allows the body to be parsed.
An special-case that would replace a missing if condition with OpaqueValueExpr
was removed as it's now redundant (unless recovery-expr is disabled).

For loops are not handled at this point, as the parsing is more complicated.

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

2 years ago[SCEVExpander] Only create multiplication if needed.
Florian Hahn [Mon, 10 Jan 2022 08:39:12 +0000 (08:39 +0000)]
[SCEVExpander] Only create multiplication if needed.

9345ab3a4550 updated generateOverflowCheck to skip creating checks that
always evaluate to false. This in turn means that we only need to
compute |Step| * Trip count  if the result of the multiplication is
actually used.

Sink the multiplication into ComputeEndCheck, so it is only created
when there's an actual check.

2 years ago[gn build] Port c0fdc748871f
LLVM GN Syncbot [Mon, 10 Jan 2022 08:36:39 +0000 (08:36 +0000)]
[gn build] Port c0fdc748871f