platform/upstream/llvm.git
3 years ago[LoopDeletion] Support selects when symbolically evaluating 1st iteration
Max Kazantsev [Sat, 9 Oct 2021 07:47:44 +0000 (14:47 +0700)]
[LoopDeletion] Support selects when symbolically evaluating 1st iteration

Adds support for selects for which we know value on the 1st iteration.

Differential Revision: https://reviews.llvm.org/D104111
Reviewed By: nikic

3 years ago[Test] Add commit justifying revert of D110922
Max Kazantsev [Sat, 9 Oct 2021 07:32:46 +0000 (14:32 +0700)]
[Test] Add commit justifying revert of D110922

Test by Arthur Eubanks!

3 years ago[Orc] Support atexit in Orc(JITLink)
luxufan [Sat, 9 Oct 2021 00:36:41 +0000 (08:36 +0800)]
[Orc] Support atexit in Orc(JITLink)

There is a bug reported at https://bugs.llvm.org/show_bug.cgi?id=48938

After looking through the glibc, I found the `atexit(f)` is the same as `__cxa_atexit(f, NULL, NULL)`. In orc runtime, we identify different JITDylib by their dso_handle value, so that a NULL dso_handle is invalid. So in this patch, I added a `PlatformJDDSOHandle` to ELFNixRuntimeState, and functions which are registered by atexit will be registered at PlatformJD.

Reviewed By: lhames

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

3 years ago[BitcodeReader] fix a logic error in vector type element validation
william woodruff [Sat, 9 Oct 2021 03:29:45 +0000 (08:59 +0530)]
[BitcodeReader] fix a logic error in vector type element validation

The current code checks whether the vector's element type is a valid structure element type, rather than a valid vector element type. The two have separate implementations and but only accept very slightly different sets of types, which is probably why this wasn't caught before.

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

3 years ago[OpenBSD] Use cortex-a8 as default CPU for ARMv7
Brad Smith [Sat, 9 Oct 2021 03:56:52 +0000 (23:56 -0400)]
[OpenBSD] Use cortex-a8 as default CPU for ARMv7

3 years ago[CFE][Codegen][In-progress] Remove CodeGenFunction::InitTempAlloca()
hsmahesha [Sat, 9 Oct 2021 03:52:59 +0000 (09:22 +0530)]
[CFE][Codegen][In-progress] Remove CodeGenFunction::InitTempAlloca()

CodeGenFunction::InitTempAlloca() inits the static alloca within the
entry block which may *not* necessarily be correct always.

For example, the current instruction insertion point (pointed by the
instruction builder) could be a program point which is hit multiple
times during the program execution, and it is expected that the static
alloca is initialized every time the program point is hit.

Hence remove CodeGenFunction::InitTempAlloca(), and initialize the
static alloca where the instruction insertion point is at the moment.

This patch, as a starting attempt, removes the calls to
CodeGenFunction::InitTempAlloca() which do not have any side effect on
the lit tests.

Reviewed By: rjmccall

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

3 years ago[Polly] Fix test case fixing the colon.
Michael Kruse [Sat, 9 Oct 2021 03:42:27 +0000 (22:42 -0500)]
[Polly] Fix test case fixing the colon.

Commit 573531fb1f529b1413b789fa9eee11c7b41ac83d fixed the colon at the
end of a CHECK line (was a semicolon by mistake). With the check
enabled, it turned out that it was failing. Check for the correct
content.

Also add the missing colon to the next CHECK line.

3 years agoRevert a LIT typo fix in a RUN line
Qiu Chaofan [Sat, 9 Oct 2021 03:26:01 +0000 (11:26 +0800)]
Revert a LIT typo fix in a RUN line

Commit 573531f changes the behavior of the test, revert it back.

3 years agoDisable mlir/test/mlir-cpu-runner/async-group.mlir with ASAN
Mehdi Amini [Sat, 9 Oct 2021 03:01:42 +0000 (03:01 +0000)]
Disable mlir/test/mlir-cpu-runner/async-group.mlir with ASAN

This test is crashing 9 out of 10 runs in CI, but I can't reproduce
locally right now. Disabling to get the CI back to green and avoid
backsliding with more ASAN issues that would go unnoticed.

3 years agoDon't update the vptr at the start of the destructor of a final class.
Richard Smith [Sat, 9 Oct 2021 02:06:22 +0000 (19:06 -0700)]
Don't update the vptr at the start of the destructor of a final class.

In this case, we know statically that we're destroying the most-derived
class, so the vptr must already point to the current class and never
needs to be updated.

3 years ago[Clang] Enable _Complex __ibm128 type
Qiu Chaofan [Sat, 9 Oct 2021 02:48:44 +0000 (10:48 +0800)]
[Clang] Enable _Complex __ibm128 type

fae0dfa implemented the new __ibm128 type, this patch enables its
complex form.

Reviewed By: rjmccall

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

3 years ago[NFC] [Clang] Use global enum for explicit float mode
Qiu Chaofan [Sat, 9 Oct 2021 02:39:10 +0000 (10:39 +0800)]
[NFC] [Clang] Use global enum for explicit float mode

Currently, there're multiple float types that can be represented by
__attribute__((mode(xx))). It's parsed, and then a corresponding type is
created if available.

This refactor moves the enum for mode into a global enum class visible
to ASTContext.

Reviewed By: aaron.ballman, erichkeane

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

3 years ago[OpenMP] Add RTL function for getting number of threads in block.
Joseph Huber [Sat, 9 Oct 2021 00:08:28 +0000 (20:08 -0400)]
[OpenMP] Add RTL function for getting number of threads in block.

This patch adds support for the
`__kmpc_get_hardware_num_threads_in_block` function that returns the
number of threads. This was missing in the new runtime and was used by
the AMDGPU plugin which prevented it from using the new runtime. This
patchs also unified the interface for getting the thread numbers in the
frontend.

Originally authored by jdoerfert.

Reviewed By: JonChesterfield

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

3 years ago[APFloat] Set size of PPCDoubleDouble to 128
Qiu Chaofan [Sat, 9 Oct 2021 02:12:10 +0000 (10:12 +0800)]
[APFloat] Set size of PPCDoubleDouble to 128

566690b0 uses size information in float semantics, but PPCDoubleDouble
left them empty.

As follow-up, we can consider remove PPCDoubleDoubleLegacy and fill
other fields in the future.

Reviewed By: foad

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

3 years agoFix typo of colon to semicolon in lit tests
Qiu Chaofan [Sat, 9 Oct 2021 02:01:27 +0000 (10:01 +0800)]
Fix typo of colon to semicolon in lit tests

3 years ago[OpenMP] Avoid calling `isSPMDMode` during RT initialization
Joseph Huber [Sat, 9 Oct 2021 01:52:54 +0000 (21:52 -0400)]
[OpenMP] Avoid calling `isSPMDMode` during RT initialization

Until we hit the first barrier we should not call `mapping::isSPMDMode`
with all threads. Instead, we now have (and use during initialization) a
`mapping::isMainThreadInGenericMode` overload that takes the known
SPMD-mode state and one that queries it.

Reviewed By: tianshilei1992

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

3 years agoPR51079: Treat thread_local variables with an incomplete class type as
Richard Smith [Sat, 9 Oct 2021 01:38:30 +0000 (18:38 -0700)]
PR51079: Treat thread_local variables with an incomplete class type as
being not trivially destructible when determining if we can skip calling
their thread wrapper function.

3 years ago[Polly] Add greedy fusion algorithm.
Michael Kruse [Sat, 9 Oct 2021 00:49:40 +0000 (19:49 -0500)]
[Polly] Add greedy fusion algorithm.

When the option -polly-loopfusion-greedy is set, the ScheduleOptimizer
tries to aggressively fuse any band it can and does not violate any
dependences.

As part if the implementation, the functionalty for copying a band
into an new schedule was extracted out of the ScheduleTreeRewriter.

3 years ago[LICM] Use Align instead of int
Arthur Eubanks [Sat, 9 Oct 2021 01:26:15 +0000 (18:26 -0700)]
[LICM] Use Align instead of int

3 years agoRemove unnecessary StringRef convesion in llvm-config
John Ericson [Thu, 7 Oct 2021 15:39:01 +0000 (11:39 -0400)]
Remove unnecessary StringRef convesion in llvm-config

We have a string litteral (via CPP) used to construct `StringRef`, which
is used to construct a `SmallString`. Just construct the latter
directly.

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

3 years agoAdd no_instrument_function attribute to Objective C methods as well
Aditya Kumar [Fri, 8 Oct 2021 23:28:15 +0000 (16:28 -0700)]
Add no_instrument_function attribute to Objective C methods as well

There are functions where we do not want function instrumentation which is why we have `__attribute__((no_instrument_function))`. Extending this functionality to disable instrumentation for Objective-C methods as well. Objective C methods like `+load` run premain and having instrumentation on them causes runtime errors depending on the implementation of `__cyg_profile_func_enter` etc. functions

Reviewed By: rjmccall, aaron.ballman

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

3 years agoRevert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""
Leonard Chan [Sat, 9 Oct 2021 00:43:23 +0000 (17:43 -0700)]
Revert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""

This reverts commit 1dba6b37bdc70210f75a480eff3715ebe1f1d8be.

Reverting because the ClangReplInterpreterExceptionTests test fails on
our builders with this patch.

3 years ago[LangRef] Fix a typo in DISubrange section
Yuanfang Chen [Fri, 8 Oct 2021 23:46:03 +0000 (16:46 -0700)]
[LangRef] Fix a typo in DISubrange section

3 years agoMake more places that use alignment use uint64_t
Arthur Eubanks [Fri, 8 Oct 2021 23:34:22 +0000 (16:34 -0700)]
Make more places that use alignment use uint64_t

Followup to D110451.

3 years ago[libc++][spaceship] Implement std::tuple::operator<=>
Kent Ross [Fri, 8 Oct 2021 21:54:28 +0000 (14:54 -0700)]
[libc++][spaceship] Implement std::tuple::operator<=>

Implement parts of P1614, including three-way comparison for tuples, and expand testing.

Reviewed By: ldionne, Mordante, #libc

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

3 years agoFix TargetRegistry shlib build, clang edition
Reid Kleckner [Fri, 8 Oct 2021 22:43:43 +0000 (15:43 -0700)]
Fix TargetRegistry shlib build, clang edition

3 years ago[InlineCost] model calls to llvm.is.constant* more carefully
Nick Desaulniers [Fri, 8 Oct 2021 22:17:54 +0000 (15:17 -0700)]
[InlineCost] model calls to llvm.is.constant* more carefully

llvm.is.constant* intrinsics are evaluated to 0 or 1 integral values.

A common use case for llvm.is.constant comes from the higher level
__builtin_constant_p. A common usage pattern of __builtin_constant_p in
the Linux kernel is:

    void foo (int bar) {
      if (__builtin_constant_p(bar)) {
        // lots of code that will fold away to a constant.
      } else {
        // a little bit of code, usually a libcall.
      }
    }

A minor issue in InlineCost calculations is when `bar` is _not_ Constant
and still will not be after inlining, we don't discount the true branch
and the inline cost of `foo` ends up being the cost of both branches
together, rather than just the false branch.

This leads to code like the above where inlining will not help prove bar
Constant, but it still would be beneficial to inline foo, because the
"true" branch is irrelevant from a cost perspective.

For example, IPSCCP can sink a passed constant argument to foo:

    const int x = 42;
    void bar (void) { foo(x); }

This improves our inlining decisions, and fixes a few head scratching
cases were the disassembly shows a relatively small `foo` not inlined
into a lone caller.

We could further improve this modeling by tracking whether the argument
to llvm.is.constant* is a parameter of the function, and if inlining
would allow that parameter to become Constant. This idea is noted in a
FIXME comment.

Link: https://github.com/ClangBuiltLinux/linux/issues/1302
Reviewed By: kazu

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

3 years ago[ADT] Mark IntervalMap::overlaps const
Vedant Kumar [Fri, 8 Oct 2021 22:00:02 +0000 (15:00 -0700)]
[ADT] Mark IntervalMap::overlaps const

This allows the overlaps() predicate to be used on a const IntervalMap.
Tested by building ADTTests, llc, and lldb-test.

3 years agoFix shlib builds for all lib/Target/*/TargetInfo libs
Reid Kleckner [Fri, 8 Oct 2021 22:18:58 +0000 (15:18 -0700)]
Fix shlib builds for all lib/Target/*/TargetInfo libs

They all must depend on MC now that the target registry is in MC.
Also fix llvm-cxxdump

3 years agoFix shared library build after TargetRegistry move
Reid Kleckner [Fri, 8 Oct 2021 22:06:03 +0000 (15:06 -0700)]
Fix shared library build after TargetRegistry move

3 years agoMove TargetRegistry.(h|cpp) from Support to MC
Reid Kleckner [Fri, 8 Oct 2021 17:48:15 +0000 (10:48 -0700)]
Move TargetRegistry.(h|cpp) from Support to MC

This moves the registry higher in the LLVM library dependency stack.
Every client of the target registry needs to link against MC anyway to
actually use the target, so we might as well move this out of Support.

This allows us to ensure that Support doesn't have includes from MC/*.

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

3 years ago[Driver][test] Fix undefined-libs.cpp when CLANG_DEFAULT_UNWINDLIB is libunwind
Fangrui Song [Fri, 8 Oct 2021 21:40:22 +0000 (14:40 -0700)]
[Driver][test] Fix undefined-libs.cpp when CLANG_DEFAULT_UNWINDLIB is libunwind

3 years ago[NFC][sanitizer] Add const to ChainedOriginDepotNode methods
Vitaly Buka [Fri, 8 Oct 2021 21:26:25 +0000 (14:26 -0700)]
[NFC][sanitizer] Add const to ChainedOriginDepotNode methods

3 years ago[NFC][sanitizer] Remove includes from header
Vitaly Buka [Fri, 8 Oct 2021 21:13:15 +0000 (14:13 -0700)]
[NFC][sanitizer] Remove includes from header

3 years agoFix unintended fall-through.
Richard Smith [Fri, 8 Oct 2021 21:24:03 +0000 (14:24 -0700)]
Fix unintended fall-through.

Unfortunately I've not found a way to exercise this code that doesn't
crash elsewhere yet, due to unrelated bugs in how Sema incorrectly
instantiates lambdas in function template signatures.

3 years ago[AArch64] Emit CFI instruction for updating x18 when using ShadowCallStack with excep...
Leonard Chan [Fri, 8 Oct 2021 21:20:26 +0000 (14:20 -0700)]
[AArch64] Emit CFI instruction for updating x18 when using ShadowCallStack with exception unwinding

PR45875 notes an instance where exception handling crashes on aarch64-fuchsia
where SCS is enabled by default. The underlying issue seems to be that within libunwind,
various _Unwind_* functions, the x18 register is not updated if a function is marked
with nounwind. This removes the check for nounwind and emits the CFI instruction that updates x18.

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

3 years ago[LoopFlatten] Mark inner loop as deleted
Nikita Popov [Thu, 7 Oct 2021 19:41:30 +0000 (21:41 +0200)]
[LoopFlatten] Mark inner loop as deleted

If a loop is flattened, the inner loop is removed and the LPM
should be informed of this fact, so it can invalidate associated
analyses. To support this, we relax an assertion in LPMUpdater to
allow invalidating non-top-level loops when running in LoopNestMode,
as the pass does not know how exactly it will get scheduled.

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

3 years ago[NFC][sanitizer] Parametrize PersistentAllocator with type
Vitaly Buka [Fri, 8 Oct 2021 21:05:29 +0000 (14:05 -0700)]
[NFC][sanitizer] Parametrize PersistentAllocator with type

3 years ago[libc++] Implement P1394r4 for span: range constructor
Joe Loser [Fri, 8 Oct 2021 20:57:44 +0000 (16:57 -0400)]
[libc++] Implement P1394r4 for span: range constructor

Implement https://wg21.link/p1394 which allows span to be constructible
from any contiguous forwarding-range that has a compatible element type.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51443

Reviewed By: ldionne, Quuxplusone, #libc

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

3 years agoX86Vector: relax checks in rsqrt's integration test
Emilio Cota [Fri, 8 Oct 2021 20:28:04 +0000 (13:28 -0700)]
X86Vector: relax checks in rsqrt's integration test

Instead of hard-coding results for both Intel and AMD, let's relax
the checks to simplify the test while supporting both implementations.
Note that:
- If a new hardware implementation comes up in the future, it is likely
  to pass the relaxed tests, i.e. no future maintenance burden for us.
- If something terribly wrong happens (e.g. instead of rsqrt we
  execute 1/sqrt), the tests will probably catch it, since the relaxed
  tests expect low precision (e.g. rsqrt(1) != 1.0).

Reviewed By: aartbik

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

3 years agoPR52073: Fix equivalence computation for lambda-expressions.
Richard Smith [Fri, 8 Oct 2021 20:39:49 +0000 (13:39 -0700)]
PR52073: Fix equivalence computation for lambda-expressions.

Distinct lambda expressions are always considered non-equivalent, so two
token-for-token identical function declarations whose signatures involve
lambda-expressions declare distinct functions.

3 years ago[flang] Fix capitalization of "ishft"
Peter Steinfeld [Fri, 8 Oct 2021 18:26:32 +0000 (11:26 -0700)]
[flang] Fix capitalization of "ishft"

We weren't recognizing the ISHFT intrinsic because the code had
incorrectly capitalized it.

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

3 years agoRevert "[ORC] Move SimpleRemoteEPCServer::Dispatcher into OrcShared."
Lang Hames [Fri, 8 Oct 2021 20:01:31 +0000 (13:01 -0700)]
Revert "[ORC] Move SimpleRemoteEPCServer::Dispatcher into OrcShared."

This reverts commit dfd74db9813b0c7c64038c303726ba43f335e07a.

SimpleRemoteEPC should share dispatch with the ExecutionSession, rather than
having two different dispatch systems on the controller side.
SimpleRemoteEPCServer::Dispatch doesn't need to be shared.

3 years ago[ORC] Remove a stale comment.
Lang Hames [Fri, 8 Oct 2021 19:44:01 +0000 (12:44 -0700)]
[ORC] Remove a stale comment.

SimpleRemoteEPCServer Service shutdown (c965fde7c234a) takes care of this.

3 years ago[NFC][sanitizer] Move ChainedOriginDepotNode into cpp file
Vitaly Buka [Fri, 8 Oct 2021 20:41:57 +0000 (13:41 -0700)]
[NFC][sanitizer] Move ChainedOriginDepotNode into cpp file

3 years ago[NFC][sanitizer] Remove sanitizer_persistent_allocator.cpp
Vitaly Buka [Fri, 8 Oct 2021 17:19:24 +0000 (10:19 -0700)]
[NFC][sanitizer] Remove sanitizer_persistent_allocator.cpp

We need to make it a template

3 years ago[NFC] Update vec_extract builtin signatures to take signed int.
Amy Kwan [Fri, 8 Oct 2021 17:52:01 +0000 (12:52 -0500)]
[NFC] Update vec_extract builtin signatures to take signed int.

This patch updates the vec_extract builtins to take a signed int as the second
parameter, as defined by the Power Vector Intrinsics Programming Reference.
This patch is NFC and all existing tests pass.

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

3 years ago[test] Fixup builtin-assume-aligned.c
Arthur Eubanks [Fri, 8 Oct 2021 19:36:40 +0000 (12:36 -0700)]
[test] Fixup builtin-assume-aligned.c

__builtin_assume_aligned's second parameter is size_t, which may be 32 bits.
We can't pass 2^32 when that happens. Update tests accordingly.

Example broken bot due to D111250:
https://lab.llvm.org/buildbot/#/builders/171/builds/4531

3 years ago[DenseMapInfo] Move hash_code implementation to Hashing.h (NFC)
Nikita Popov [Thu, 7 Oct 2021 21:26:45 +0000 (23:26 +0200)]
[DenseMapInfo] Move hash_code implementation to Hashing.h (NFC)

This moves the DenseMapInfo implementation for hash_code into
Hashing.h, removing the need to include Hashing.h (and thus <string>)
in DenseMapInfo.h. This follows the general convention of declaring
DenseMapInfo for types that we own in the respective header. The
remaining implementations in DenseMapInfo.h are all for types we
do not own.

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

3 years ago[Libomptarget] Add an external interface to dynamic shared memory
Joseph Huber [Fri, 1 Oct 2021 18:37:02 +0000 (14:37 -0400)]
[Libomptarget] Add an external interface to dynamic shared memory

This patch adds an external interface to access the dynamic shared
memory buffer in the device runtime. The function introduced is
``llvm_omp_get_dynamic_shared``. This includes a host-side
definition that only returns a null pointer so that it can be used when
host-fallback is enabled without crashing. Support for dynamic shared
memory was also ported to the old device runtime.

Reviewed By: JonChesterfield

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

3 years ago[DFSan] Fix warning: getArgsFunctionType defined but not used
Andrew Browne [Fri, 8 Oct 2021 18:49:20 +0000 (11:49 -0700)]
[DFSan] Fix warning: getArgsFunctionType defined but not used

Warning introduced in 61ec2148c5a68d870356d6348309e94a2267a1a4

3 years agoMore followup type changes after 05392466
Arthur Eubanks [Wed, 6 Oct 2021 22:23:32 +0000 (15:23 -0700)]
More followup type changes after 05392466

3 years ago[lldb/Plugins] Replace platform-specific macro with LLVM_PRETTY_FUNCTION (NFC)
Med Ismail Bennani [Fri, 8 Oct 2021 18:48:02 +0000 (18:48 +0000)]
[lldb/Plugins] Replace platform-specific macro with LLVM_PRETTY_FUNCTION (NFC)

This patch refactors Scripted Process and Scripted Thread related
classes to use LLVM_PRETTY_FUNCTION instead of the compiler macro.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[clang] Set max allowed alignment to 2^32
Arthur Eubanks [Wed, 6 Oct 2021 18:20:44 +0000 (11:20 -0700)]
[clang] Set max allowed alignment to 2^32

Followup to D110451 which set LLVM's max allowed alignment to 2^32.

Reviewed By: hans

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

3 years agoAdd missing include after dfd74db9
Arthur Eubanks [Fri, 8 Oct 2021 18:41:53 +0000 (11:41 -0700)]
Add missing include after dfd74db9

3 years ago[NFC] Make some includes explicit
Nikita Popov [Thu, 7 Oct 2021 21:26:45 +0000 (23:26 +0200)]
[NFC] Make some includes explicit

Avoid relying on a number of indirect includes that currently
happen through the Hashing.h header in DenseMapInfo.h.

3 years ago[ORC] Move SimpleRemoteEPCServer::Dispatcher into OrcShared.
Lang Hames [Fri, 8 Oct 2021 05:04:48 +0000 (22:04 -0700)]
[ORC] Move SimpleRemoteEPCServer::Dispatcher into OrcShared.

Renames SimpleRemoteEPCServer::Dispatcher to SimpleRemoteEPCDispatcher and
moves it into OrcShared. SimpleRemoteEPCServer::ThreadDispatcher is similarly
moved and renamed to DynamicThreadPoolSimpleRemoteEPCDispatcher.

This will allow these classes to be reused by SimpleRemoteEPC on the controller
side of the connection.

3 years ago[clang] Option control afn flag
Masoud Ataei [Fri, 8 Oct 2021 18:26:14 +0000 (14:26 -0400)]
[clang] Option control afn flag

Clang option to set/unset afn fast-math flag.

 Differential: https://reviews.llvm.org/D106191
 Reviewd with: aaron.ballman, erichkeane, and others

3 years ago[GlobalISel] Improve G_UMHULH -> LSHR combine to accept non-uniform constant vectors.
Amara Emerson [Fri, 8 Oct 2021 18:05:09 +0000 (11:05 -0700)]
[GlobalISel] Improve G_UMHULH -> LSHR combine to accept non-uniform constant vectors.

3 years ago[libc++][doc] Update paper status.
Mark de Wever [Tue, 5 Oct 2021 16:18:16 +0000 (18:18 +0200)]
[libc++][doc] Update paper status.

Update the status with the approved papers and LWG-issues in the October 2021 plenary.

Reviewed By: #libc, ldionne

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

3 years ago[DFSan] Remove -dfsan-args-abi support in favor of TLS.
Andrew Browne [Mon, 4 Oct 2021 20:31:18 +0000 (13:31 -0700)]
[DFSan] Remove -dfsan-args-abi support in favor of TLS.

ArgsABI was originally added in https://reviews.llvm.org/D965

Current benchmarking does not show a significant difference.
There is no need to maintain both ABIs.

Reviewed By: pcc

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

3 years ago[RegisterScavenging] Use a Twine in a call to report_fatal_error instead of going...
Craig Topper [Fri, 8 Oct 2021 17:56:23 +0000 (10:56 -0700)]
[RegisterScavenging] Use a Twine in a call to report_fatal_error instead of going from std::string to c_str. NFC

The std::string was built on the line above. Might as well just
build it as a Twine in the call.

3 years agoRevert "[IR] Remove arg_operands and getNumArgOperands (NFC)"
Kazu Hirata [Fri, 8 Oct 2021 18:01:56 +0000 (11:01 -0700)]
Revert "[IR] Remove arg_operands and getNumArgOperands (NFC)"

This reverts commit b2ee408dde374d6a27a34746fd7c7b5bab97ea89.

3 years ago[IPT] Add a statistic to track instructions scanned to answer queries
Philip Reames [Fri, 8 Oct 2021 17:49:54 +0000 (10:49 -0700)]
[IPT] Add a statistic to track instructions scanned to answer queries

I'm planning some changes to the invalidation mechanism here, and having a concrete mechanism to track progress is key.

3 years agoAdd a statistic to track number of times we rebuild instruction ordering
Philip Reames [Fri, 8 Oct 2021 17:45:01 +0000 (10:45 -0700)]
Add a statistic to track number of times we rebuild instruction ordering

The goal here is to assist some future tuning work both on instruction ordering invalidation, and on some client code which uses it.

3 years agoRevert "Recommit "[LoopPeel] Peel loops with deoptimizing exits""
Arthur Eubanks [Fri, 8 Oct 2021 17:50:06 +0000 (10:50 -0700)]
Revert "Recommit "[LoopPeel] Peel loops with deoptimizing exits""

This reverts commit d68b59f3ebb253ee7119a25a71c51cf19b73e030.

This is causing crashes, see D110922 for details.

3 years ago[test] Use host platform specific error message substitution
Abhina Sreeskantharajan [Fri, 8 Oct 2021 17:52:13 +0000 (13:52 -0400)]
[test] Use host platform specific error message substitution

This patch modifies the testcase to use error substitution so it will pass on all platforms.

Reviewed By: fanbo-meng, muiez

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

3 years agoUpdate polly for removal of CallInst::arg_operands/getNumArgOperands
Reid Kleckner [Fri, 8 Oct 2021 17:45:30 +0000 (10:45 -0700)]
Update polly for removal of CallInst::arg_operands/getNumArgOperands

Fixes polly build

3 years ago[AST Matchers] Update dump_ast_matchers.py to query only class index page.
James King [Fri, 8 Oct 2021 17:44:55 +0000 (17:44 +0000)]
[AST Matchers] Update dump_ast_matchers.py to query only class index page.

It may be possible to avoid relying on accessing many individual class pages,
by instead scanning the class index page at
https://clang.llvm.org/doxygen/classes.html. This updates the script to do so,
and includes updates to `LibASTMatchersReference.html` generated by the
modified script.

Reviewed By: aaron.ballman, sammccall

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

3 years agoAdd `TypeLoc`-related matchers.
James King [Fri, 8 Oct 2021 17:42:06 +0000 (17:42 +0000)]
Add `TypeLoc`-related matchers.

Contributes several matchers that involve `TypeLoc`s. These matchers are (in alphabetical order):

- elaboratedTypeLoc
- hasAnyTemplateArgumentLoc
- hasNamedTypeLoc
- hasPointeeLoc
- hasReferentLoc
- hasReturnTypeLoc
- hasTemplateArgumentLoc
- hasUnqualifiedLoc
- pointerTypeLoc
- qualifiedTypeLoc
- referenceTypeLoc
- templateSpecializationTypeLoc

Reviewed By: ymandel, aaron.ballman

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

3 years agoRevert "[clang] Fix absolute file paths with -fdebug-prefix-map"
Keith Smiley [Fri, 8 Oct 2021 17:38:13 +0000 (10:38 -0700)]
Revert "[clang] Fix absolute file paths with -fdebug-prefix-map"

This reverts commit a23a5967932292b82e9a7e4b37817d1b3f5be5ec.

This broke a windows test https://buildkite.com/llvm-project/premerge-checks/builds/59492#7dad207c-6cbe-40ad-95e4-c48b47fe2527

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

3 years ago[libcxx] Fix a missed case needing "system header" markings for init_priority(100)
Martin Storsjö [Thu, 7 Oct 2021 07:00:46 +0000 (10:00 +0300)]
[libcxx] Fix a missed case needing "system header" markings for init_priority(100)

This was missed in D95972 / 7c49052b170f76f19be64a5572d31ad8f5df4e61,
as this codepath isn't exercised by CI yet.

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

3 years ago[clang] Fix absolute file paths with -fdebug-prefix-map
Keith Smiley [Thu, 7 Oct 2021 20:25:21 +0000 (13:25 -0700)]
[clang] Fix absolute file paths with -fdebug-prefix-map

Previously if you passed an absolute path to clang, where only part of
the path to the file was remapped, it would result in the file's DIFile
being stored with a duplicate path, for example:

```
!DIFile(filename: "./ios/Sources/bar.c", directory: "./ios/Sources")
```

This change handles absolute paths, specifically in the case they are
remapped to something relative, and uses the dirname for the directory,
and basename for the filename.

This also adds a test verifying this behavior for more standard uses as
well.

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

3 years ago[IPT] Narrow scope of removeInstruction invalidation [NFC]
Philip Reames [Fri, 8 Oct 2021 17:32:36 +0000 (10:32 -0700)]
[IPT] Narrow scope of removeInstruction invalidation [NFC]

We only need to invalidate if the instruction being removed is the cached "first special instruction".  If the instruction is before that one, it can't (by assumption) be special.  If it is after that one, it wasn't the first.

3 years ago[sanitizer] Use one #if instead of 3 nested #if after D111185
Fangrui Song [Fri, 8 Oct 2021 17:31:57 +0000 (10:31 -0700)]
[sanitizer] Use one #if instead of 3 nested #if after D111185

3 years ago[clang-format-diff] Fix missing formatting for zero length git diff lines
Zequan Wu [Wed, 6 Oct 2021 21:18:12 +0000 (14:18 -0700)]
[clang-format-diff] Fix missing formatting for zero length git diff lines

If we only delete lines that are outer block statements (if, while, etc),
clang-format-diff.py can't format the statements inside the block statements.

An example to repro:
1. Delete the if statment at line 118 in llvm/lib/CodeGen/Analysis.cpp.
2. Run `git diff -U0 --no-color HEAD^ | clang/tools/clang-format/clang-format-diff.py -i -p1`

It fails to format the statement after if.

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

3 years agoReland [sanitizer] Support Intel CET
H.J. Lu [Fri, 10 Sep 2021 13:24:36 +0000 (06:24 -0700)]
Reland [sanitizer] Support Intel CET

1. Include <cet.h> in sanitizer_common/sanitizer_asm.h, if it exists, to
mark Intel CET support when Intel CET is enabled.
2. Define _CET_ENDBR as empty if it isn't defined.
3. Add _CET_ENDBR to function entries in assembly codes so that ENDBR
instruction will be generated when Intel CET is enabled.

Reviewed By: MaskRay

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

3 years ago[Support] Define sys::getHostCPUName for RISC-V
Andreas Schwab [Fri, 8 Oct 2021 17:08:39 +0000 (10:08 -0700)]
[Support] Define sys::getHostCPUName for RISC-V

The RISCV target doesn't define a "generic" cpu, only "generic-rv32" and
"generic-rv64".  Define sys::getHostCPUName for RISC-V that returns the
correct cpu for the host.

Reviewed By: craig.topper, MaskRay

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

3 years agoAdd iterator range variants of isGuaranteedToTransferExecutionToSuccessor [mostly...
Philip Reames [Fri, 8 Oct 2021 15:58:03 +0000 (08:58 -0700)]
Add iterator range variants of isGuaranteedToTransferExecutionToSuccessor [mostly-nfc]

This factors out utilities for scanning a bounded block of instructions since we have this code repeated in a bunch of places.  The change to InlineFunction isn't strictly NFC as the limit mechanism there didn't handle debug instructions correctly.

3 years ago[Dexter] Add option to pass a Visual Studio solution instead of a binary
Stephen Tozer [Fri, 8 Oct 2021 16:39:51 +0000 (17:39 +0100)]
[Dexter] Add option to pass a Visual Studio solution instead of a binary

This patch allows a visual studio solution file to be passed directly
into Dexter, instead of using a pre-built binary and a small internal
solution file with template arguments. This is primarily to allow
launching an application that has specific launch configuration
requirements, without needing all the details of this configuration to
be built directly into Dexter or adding a config file that simply
duplicates existing settings in the VS solution.

Reviewed By: Orlando

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

3 years ago[lldb] Fix windows build failure due to undefined macro
Med Ismail Bennani [Fri, 8 Oct 2021 16:24:41 +0000 (18:24 +0200)]
[lldb] Fix windows build failure due to undefined macro

This should fix a build failure on Windows caused by the macro
__PRETTY_FUNCTION__ not being defined.

https://lab.llvm.org/buildbot/#/builders/83/builds/10836

https://reviews.llvm.org/D107585

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[AIX] Disable tests failing due to missing DWARF sections
Jake Egan [Fri, 8 Oct 2021 16:06:25 +0000 (12:06 -0400)]
[AIX] Disable tests failing due to missing DWARF sections

The following tests are failing due to missing DWARF sections. This patch sets these tests as XFAIL/DISABLED on AIX until a more permanent solution is implemented.

Reviewed By: shchenz

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

3 years ago[AIX] Disable tests failing due to lack of .loc and .file directive support
Jake Egan [Fri, 8 Oct 2021 15:54:33 +0000 (11:54 -0400)]
[AIX] Disable tests failing due to lack of .loc and .file directive support

The following tests explicitly check for .loc and .file directives, which is not currently supported. Disable these tests on AIX for now.

Reviewed By: shchenz

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

3 years agoFix parsing of hex-format index dense tensor attributes.
Stella Laurenzo [Fri, 8 Oct 2021 15:39:28 +0000 (15:39 +0000)]
Fix parsing of hex-format index dense tensor attributes.

TensorLiteralParser::getHexAttr does a isIntOrIndexOrFloat check and properly handles index elements, but TensorLiteralParser::getAttr that calls into it has a mismatched check. This just makes the checks match so that index element attrs can parse when of type tensor.

Reviewed By: rriddle

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

3 years ago[libc++] Improve atomic_fetch_(add|sub).*.
Mark de Wever [Wed, 9 Jun 2021 18:26:34 +0000 (20:26 +0200)]
[libc++] Improve atomic_fetch_(add|sub).*.

While looking at the review comments in D103765 there was an oddity in
the tests for the following functions:
- atomic_fetch_add
- atomic_fetch_add_explicit
- atomic_fetch_sub
- atomic_fetch_sub_explicit

Libc++ allows usage of
`atomic_fetch_add<int>(atomic<int*>*, atomic<int*>::difference_type);`
MSVC and GCC reject this code: https://godbolt.org/z/9d8WzohbE

This makes the atomic `fetch(add|sub).*` Standard conforming and removes the non-conforming extensions.

Fixes PR47908

Reviewed By: ldionne, #libc

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

3 years ago[IR] Remove arg_operands and getNumArgOperands (NFC)
Kazu Hirata [Fri, 8 Oct 2021 15:26:22 +0000 (08:26 -0700)]
[IR] Remove arg_operands and getNumArgOperands (NFC)

The last uses were removed on Oct 7, 2021 in commit
80e39366ee403ac420f2087883550398e5fbf968.

This is a relanding of c72722f45ef1aa6d78e1e6fee07ab6bd86980da8.

3 years ago[InstCombine] add shift of bool test with extra use; NFC
Sanjay Patel [Fri, 8 Oct 2021 15:19:01 +0000 (11:19 -0400)]
[InstCombine] add shift of bool test with extra use; NFC

3 years ago[InstCombine] add tests for (i32 X s>> 31) & Y; NFC
Sanjay Patel [Fri, 8 Oct 2021 13:34:15 +0000 (09:34 -0400)]
[InstCombine] add tests for (i32 X s>> 31) & Y; NFC

Also regenerate some check lines to more accurately show
current transforms via name changes.

3 years ago[OpenMP][NVPTX] Fix an error in configuring #teams and #threads
Shilei Tian [Fri, 8 Oct 2021 15:07:31 +0000 (11:07 -0400)]
[OpenMP][NVPTX] Fix an error in configuring #teams and #threads

It must be a copy mistake.

Reviewed By: ye-luo

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

3 years ago[libc++] Remove the ad-hoc "unified standalone" build
Louis Dionne [Thu, 7 Oct 2021 20:07:59 +0000 (16:07 -0400)]
[libc++] Remove the ad-hoc "unified standalone" build

It is not used anywhere anymore since we're using the new runtimes build
in <monorepo>/runtimes now, so we can remove all traces of this build.

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

3 years agoRevert "[SelectionDAG] Remove PromoteIntOp_EXTRACT_SUBVECTOR."
Bradley Smith [Fri, 8 Oct 2021 14:38:35 +0000 (14:38 +0000)]
Revert "[SelectionDAG] Remove PromoteIntOp_EXTRACT_SUBVECTOR."

This reverts commit 3e8d2008f74245e9e1ca60bc97e4e619b0d42c6c.

The code removed in this commit is actually required for extracting
fixed types from illegal scalable types, hence this commit causes
assertion failures in such extracts.

3 years ago[flang][driver] Fix erroneous `&`
Andrzej Warzynski [Fri, 8 Oct 2021 09:41:02 +0000 (09:41 +0000)]
[flang][driver] Fix erroneous `&`

As pointed out by Valentin Clement in PR [1], we should be using `&&`
instead of `&`.

[1] https://github.com/flang-compiler/f18-llvm-project/pull/1113#discussion_r724321121

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

3 years ago[libc] Add rep;movsb as an accelerator under x86
Guillaume Chatelet [Fri, 8 Oct 2021 14:31:55 +0000 (14:31 +0000)]
[libc] Add rep;movsb as an accelerator under x86

3 years ago[libc] ifdef guard element architecture implementations
Guillaume Chatelet [Fri, 8 Oct 2021 14:25:08 +0000 (14:25 +0000)]
[libc] ifdef guard element architecture implementations

3 years ago[NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c
Freddy Ye [Fri, 8 Oct 2021 13:54:18 +0000 (21:54 +0800)]
[NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

Reviewed By: DavidSpickett

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

3 years ago[AIX][ZOS] Excluding merge-objc-interface.m from Tests
Qiongsi Wu [Fri, 8 Oct 2021 13:58:32 +0000 (13:58 +0000)]
[AIX][ZOS] Excluding merge-objc-interface.m from Tests

Objective C is not supported on AIX or ZOS. This patch excludes the newly added `clang/test/Modules/merge-objc-interface.m` (added by https://reviews.llvm.org/D110280) from AIX and ZOS testing.

Many existing tests are already disabled by https://reviews.llvm.org/D109060.

Reviewed By: jsji

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

3 years agoRevert "[libc] Add rep;movsb as an accelerator under x86"
Guillaume Chatelet [Fri, 8 Oct 2021 13:44:37 +0000 (13:44 +0000)]
Revert "[libc] Add rep;movsb as an accelerator under x86"

This reverts commit 1c7160300db124468ef4a26ec55ad3d6e6527a69.

3 years ago[libc] Add rep;movsb as an accelerator under x86
Guillaume Chatelet [Fri, 8 Oct 2021 13:34:02 +0000 (13:34 +0000)]
[libc] Add rep;movsb as an accelerator under x86

3 years ago[AMDGPU] Set number vgprs used in PS shaders based on input registers actually used
David Stuttard [Thu, 15 Apr 2021 20:00:22 +0000 (21:00 +0100)]
[AMDGPU] Set number vgprs used in PS shaders based on input registers actually used

For PS shaders we can use the input SPI_PS_INPUT_ENA and SPI_PS_INPUT_ADDR
registers

Calculate the number of VGPR registers used as input VGPRs based on these
registers rather than the arguments passed in (this conservatively always
allocates the maximum).

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

Change-Id: Idf7c060cbbd5f7e3300102c55ecee3c07f209de6

3 years ago[lldb/test] Disable TestScriptedProcess.py unless Darwin
Med Ismail Bennani [Fri, 8 Oct 2021 13:19:54 +0000 (15:19 +0200)]
[lldb/test] Disable TestScriptedProcess.py unless Darwin

This patch disables TestScriptedProcess.py on Linux and Windows while I
investigate the OS specific failure:

http://lab.llvm.org:8011/#/builders/68/builds/19793

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>