platform/upstream/llvm.git
3 years ago[InstrProfiling] Support relative CountersPtr for PlatformOther
Jinsong Ji [Wed, 18 Aug 2021 17:20:18 +0000 (17:20 +0000)]
[InstrProfiling] Support relative CountersPtr for PlatformOther

D104556 change the CountersPtr to be relative, however, it did not
update the pointer initialization in  __llvm_profile_register_function,
so the platform (eg:AIX) that use __llvm_profile_register_function is now totaly
broken, any PGO code will SEGV.

This patch update the code to reflect that the Data->CountersPtr is now
relative.

Reviewed By: MaskRay, davidxl

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

3 years ago[RISCV] Insert sext_inreg when type legalizing add/sub/mul with constant LHS.
Craig Topper [Wed, 18 Aug 2021 17:37:00 +0000 (10:37 -0700)]
[RISCV] Insert sext_inreg when type legalizing add/sub/mul with constant LHS.

We already do this for non-constants RHS. This just removes the
special case. I believe the special case may have been needed
because the ANY_EXTEND of a constant used to create zero extended
constants, but we recently changed that to produce sign extended
constants.

D107658 is needed to prevent some regressions.

Reviewed By: luismarques

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

3 years ago[GlobalISel] Add G_ISNAN
Jessica Paquette [Tue, 17 Aug 2021 16:45:23 +0000 (09:45 -0700)]
[GlobalISel] Add G_ISNAN

Add a generic opcode equivalent to the `llvm.isnan` intrinsic +
MachineVerifier support for it.

We need an opcode here because we may want target-specific lowering later on.

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

3 years ago[Polly] Break early when the result is known. NFC.
Michael Kruse [Wed, 18 Aug 2021 17:22:21 +0000 (12:22 -0500)]
[Polly] Break early when the result is known. NFC.

3 years ago[RISCV] Improve constant materialization for stores of i16 or i32 negative constants.
Craig Topper [Wed, 18 Aug 2021 17:23:59 +0000 (10:23 -0700)]
[RISCV] Improve constant materialization for stores of i16 or i32 negative constants.

DAGCombiner::visitStore can clear the upper bits of constants
used by stores. This leads prevents them from being recognized as
sign extended negative values making them more expensive to
materialize.

This patch uses the hasAllNBitUsers method from D107658 to make
a negative constant if none of the users care about the upper bits.

Reviewed By: luismarques

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

3 years ago[RISCV] Teach isel to select ADDW/SUBW/MULW/SLLIW when only the lower 32-bits are...
Craig Topper [Wed, 18 Aug 2021 16:40:57 +0000 (09:40 -0700)]
[RISCV] Teach isel to select ADDW/SUBW/MULW/SLLIW when only the lower 32-bits are used.

We normally select these when the root node is a sext_inreg, but
SimplifyDemandedBits can sometimes bypass the sext_inreg for some
users. This can create situation where sext_inreg+add/sub/mul/shl
is selected to a W instruction, and then the add/sub/mul/shl is
separately selected to a non-W instruction with the same inputs.

This patch tries to detect when it would still be ok to use a W
instruction without the sext_inreg by checking the direct users.
This can allow the W instruction to CSE with one created for a
sext_inreg+add/sub/mul/shl. To minimize complexity and cost of
checking, we make no attempt to determine if the CSE will happen
and just always use a W instruction when we can.

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

3 years ago[X86] avx512bw-intrinsics-upgrade.ll - cleanup whitespace and use nounwind to avoid...
Simon Pilgrim [Wed, 18 Aug 2021 16:53:41 +0000 (17:53 +0100)]
[X86] avx512bw-intrinsics-upgrade.ll - cleanup whitespace and use nounwind to avoid unnecessary cfi tags. NFCI.

3 years ago[RISCV] Add zext.h/zext.w to RISCVTTIImpl::getIntImmCostInst.
Craig Topper [Wed, 18 Aug 2021 16:32:10 +0000 (09:32 -0700)]
[RISCV] Add zext.h/zext.w to RISCVTTIImpl::getIntImmCostInst.

If we have these instructions, we don't need to hoist the immediate
for an AND that would match them.

Reviewed By: luismarques

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

3 years ago[NFC] Cleanup calls to CallBase::getAttribute()
Arthur Eubanks [Wed, 18 Aug 2021 16:37:01 +0000 (09:37 -0700)]
[NFC] Cleanup calls to CallBase::getAttribute()

3 years ago[hwasan] Default -hwasan-use-stack-safety to off.
Florian Mayer [Wed, 18 Aug 2021 09:21:27 +0000 (10:21 +0100)]
[hwasan] Default -hwasan-use-stack-safety to off.

This very occasionally causes to an assertion failure in the compiler.
Turning off until we can get to the bottom of this.

Reviewed By: hctim

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

3 years ago[Bitcode] Remove unused declaration writeGlobalVariableMetadataAttachment (NFC)
Kazu Hirata [Wed, 18 Aug 2021 16:16:05 +0000 (09:16 -0700)]
[Bitcode] Remove unused declaration writeGlobalVariableMetadataAttachment (NFC)

The declaration was introduced without a corresponding definition on
May 31, 2016 in commit cceae7feda8e33194d1a6c5963bd4114bb8d2b36.

3 years ago[Analysis][AArch64] Make fixed-width ordered reductions slightly more expensive
David Sherwood [Wed, 18 Aug 2021 08:40:21 +0000 (09:40 +0100)]
[Analysis][AArch64] Make fixed-width ordered reductions slightly more expensive

For tight loops like this:

  float r = 0;
  for (int i = 0; i < n; i++) {
    r += a[i];
  }

it's better not to vectorise at -O3 using fixed-width ordered reductions
on AArch64 targets. Although the resulting number of instructions in the
generated code ends up being comparable to not vectorising at all, there
may be additional costs on some CPUs, for example perhaps the scheduling
is worse. It makes sense to deter vectorisation in tight loops.

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

3 years ago[OpenMP][NFC] Improve debug message for shared memory
Joseph Huber [Wed, 18 Aug 2021 15:48:15 +0000 (11:48 -0400)]
[OpenMP][NFC] Improve debug message for shared memory

Summary:
Make the debug message for HeapToShared more helpful by showing the
actual call.

3 years ago[libc++] Skip logic for detecting C11 features when using_if_exists is supported
Louis Dionne [Tue, 17 Aug 2021 15:23:48 +0000 (11:23 -0400)]
[libc++] Skip logic for detecting C11 features when using_if_exists is supported

In the future, we'll want to rely exclusively on using_if_exists for this
job, but for now, only rely on it when the compiler supports that attribute.
That removes the possibility for getting the logic wrong.

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

3 years ago[libc++] Split off tests for aligned_alloc & friends into separate test files
Louis Dionne [Wed, 18 Aug 2021 12:31:40 +0000 (08:31 -0400)]
[libc++] Split off tests for aligned_alloc & friends into separate test files

This allows testing the rest of those headers on most platforms, instead
of XFAILing the whole test just because of a few functions.

As a fly-by fix, remove std/utilities/time/date.time/ctime.pass.cpp,
which was a duplicate of std/language.support/support.runtime/ctime.pass.cpp.

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

3 years agoAdd some Function method definitions accidentally removed
Arthur Eubanks [Wed, 18 Aug 2021 15:27:45 +0000 (08:27 -0700)]
Add some Function method definitions accidentally removed

In cc327bd5231126006b4177b8ce0946ce52e2f645.

3 years ago[OpenMP] Change AAKernelInfo to ignore non-kernels
Joseph Huber [Wed, 18 Aug 2021 00:29:54 +0000 (20:29 -0400)]
[OpenMP] Change AAKernelInfo to ignore non-kernels

Currently, AAKernelInfo will fail on an assertion if we attempt to run
it on a kernel without the init / deinit runtime calls. However, this
occurs for global constructors on the device. This will cause OpenMPOpt
to crash whenever global constructors are present. This patch removes
this assertion and just gives up instead.

Reviewed By: jdoerfert

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

3 years ago[Libomptarget] Correctly default to Generic if exec_mode is not present
Joseph Huber [Tue, 17 Aug 2021 23:19:31 +0000 (19:19 -0400)]
[Libomptarget] Correctly default to Generic if exec_mode is not present

Currently, the runtime returns an error when the `exec_mode` global is
not present. The expected behvaiour is that the region will default to
Generic. This prevents global constructors from being called because
they do not contain execution mode globals.

Reviewed By: jdoerfert

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

3 years ago[clang-offload-wrapper] Disabled ELF offload notes embedding by default.
Vyacheslav Zakharin [Wed, 18 Aug 2021 15:18:03 +0000 (08:18 -0700)]
[clang-offload-wrapper] Disabled ELF offload notes embedding by default.

This change-set puts 93d08acaacec951dbb302f77eeae51974985b6b2 functionality
under -add-omp-offload-notes switch that is OFF by default.
CUDA toolchain is not able to handle ELF images with LLVMOMPOFFLOAD
notes for unknown reason (see https://reviews.llvm.org/D99551#2950272).
I disable the ELF notes embedding until the CUDA issue is triaged and resolved.

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

3 years ago[MLIR] Correct linkage of lowered globalop
William S. Moses [Tue, 17 Aug 2021 22:22:04 +0000 (18:22 -0400)]
[MLIR] Correct linkage of lowered globalop

LLVM considers global variables marked as externals to be defined within the module if it is initialized (including to an undef). Other external globals are considered as being defined externally and imported into the current translation unit. Lowering of MLIR Global Ops does not properly propagate undefined initializers, resulting in a global which is expected to be defined within the current TU, not being defined.

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

3 years ago[PowerPC][AIX] llvm-readobj: Convert some errors to warnings.
Maryam Benimmar [Tue, 17 Aug 2021 17:06:30 +0000 (13:06 -0400)]
[PowerPC][AIX] llvm-readobj: Convert some errors to warnings.

Report warnings rather than errors, so that llvm-readobj doesn't bail
out on malformed inputs.

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

3 years ago[mlir][spirv] Add (InBounds)PtrAccessChain ops
Butygin [Sat, 14 Aug 2021 08:57:02 +0000 (11:57 +0300)]
[mlir][spirv] Add (InBounds)PtrAccessChain ops

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

3 years ago[X86] [AMX] Fix the test case failure caused by D107544.
Bing1 Yu [Wed, 18 Aug 2021 05:40:19 +0000 (13:40 +0800)]
[X86] [AMX] Fix the test case failure caused by D107544.

The issue can be duplicated when EXPENSIVE_CHECKS is specified for llvm
build. Thank Simon report this issue at
https://bugs.llvm.org/show_bug.cgi?id=51513. We need return correct
value for the changed IR.

Reviewed By: RKSimon, LuoYuanke

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

3 years ago[gn build] Port 38812f4ac122
LLVM GN Syncbot [Wed, 18 Aug 2021 14:02:48 +0000 (14:02 +0000)]
[gn build] Port 38812f4ac122

3 years ago[libc++] Implement structured binding for std::ranges::subrange.
Arthur O'Dwyer [Fri, 13 Aug 2021 20:20:13 +0000 (16:20 -0400)]
[libc++] Implement structured binding for std::ranges::subrange.

The `get` half of this machinery was already implemented, but the `tuple_size`
and `tuple_element` parts were hiding in [ranges.syn] and therefore missed.

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

3 years ago[libc++] [P1614] Implement std::compare_three_way_result.
Arthur O'Dwyer [Thu, 29 Jul 2021 04:03:01 +0000 (00:03 -0400)]
[libc++] [P1614] Implement std::compare_three_way_result.

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

3 years agoUse a more general test here.
Aaron Ballman [Wed, 18 Aug 2021 13:30:36 +0000 (09:30 -0400)]
Use a more general test here.

The interesting bit about that triple isn't the architecture, it's the
fact that ps4 implies C99 as the standard rather than a newer C mode.
Specify the language standard rather than the triple so the test is a
bit more general.

3 years agoSimplify a .mailmap entry
Nico Weber [Wed, 18 Aug 2021 13:16:16 +0000 (09:16 -0400)]
Simplify a .mailmap entry

The old entry mapped the email address `<compnerd@compnerd.org>` to user name
`Saleem Abdulrasool` and email address `<compnerd@compnerd.org>`. Since the two
addresses are identical, that's a needless detail.

The new entry just maps email address `<compnerd@compnerd.org>` to user name
`Saleem Abdulrasool`.

No behavior change.

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

3 years agoDo not emit diagnostics for invalid unicode characters in preprocessing mode
Corentin Jabot [Wed, 18 Aug 2021 13:10:34 +0000 (09:10 -0400)]
Do not emit diagnostics for invalid unicode characters in preprocessing mode

This amends 4e80636db71a1b6123d15ed1f9eda3979b4292de with a fix for
https://lab.llvm.org/buildbot/#/builders/139/builds/8943

3 years ago[tsan] Disable Trace.MemoryAccessSize on Mac
Alexander Potapenko [Wed, 18 Aug 2021 12:33:14 +0000 (14:33 +0200)]
[tsan] Disable Trace.MemoryAccessSize on Mac

According to comments at https://reviews.llvm.org/D107911,
Trace.MemoryAccessSize fails on Mac buildbots.
Because this test is newly introduced, and is the only user of the code
added in that patch, disable the test on Mac till the problem is
resolved.

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

3 years ago[libc++] Remove workarounds for the lack of deduction guides in C++17
Louis Dionne [Tue, 17 Aug 2021 15:59:07 +0000 (11:59 -0400)]
[libc++] Remove workarounds for the lack of deduction guides in C++17

All supported compilers have supported deduction guides in C++17 for a
while, so this isn't necessary anymore.

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

3 years ago[libc++][NFC] Fix copy-paste errors in tests
Louis Dionne [Wed, 18 Aug 2021 12:54:18 +0000 (08:54 -0400)]
[libc++][NFC] Fix copy-paste errors in tests

The test precision_type.pass.cpp was a duplicate of precision.pass.cpp,
so it is removed. atomic_flag_test.pass.cpp was a duplicate of
atomic_flag_test_and_set.pass.cpp, so instead I wrote a proper
test for it. Those duplicate tests were detected with

     find libcxx ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD

3 years ago[libc++] Convert test-suite workarounds for some C11 features to XFAILs
Louis Dionne [Tue, 17 Aug 2021 15:21:09 +0000 (11:21 -0400)]
[libc++] Convert test-suite workarounds for some C11 features to XFAILs

Instead of trying to sniff out what features are supported by the
library being tested, the way we normally handle these things is with
Lit annotations. This should not be treated differently.

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

3 years ago[NFC][X86][Codegen] Add exhaustive test coverage for PR50971
Roman Lebedev [Wed, 18 Aug 2021 12:02:25 +0000 (15:02 +0300)]
[NFC][X86][Codegen] Add exhaustive test coverage for PR50971

Produced via https://godbolt.org/z/5hEdGY5x3

3 years agoImplement P1949
Corentin Jabot [Wed, 18 Aug 2021 11:33:14 +0000 (07:33 -0400)]
Implement P1949

This adds the Unicode 13 data for XID_Start and XID_Continue.
The definition of valid identifier is changed in all C++ modes
as P1949 (https://wg21.link/p1949) was accepted by WG21 as a defect
report.

3 years ago[Sema] CheckObjCBridgeNSCast - fix dead code warning. NFCI.
Simon Pilgrim [Wed, 18 Aug 2021 10:02:39 +0000 (11:02 +0100)]
[Sema] CheckObjCBridgeNSCast - fix dead code warning. NFCI.

Target is only ever non-null when we find an existing type, so move its declaration inside that case, and remove the dead code where Target was always null.

3 years ago[gn build] Port 45ac5f544181
LLVM GN Syncbot [Wed, 18 Aug 2021 10:43:22 +0000 (10:43 +0000)]
[gn build] Port 45ac5f544181

3 years agoRevert "[ORC-RT][ORC] Introduce ELF/*nix Platform and runtime support."
Lang Hames [Wed, 18 Aug 2021 10:41:12 +0000 (20:41 +1000)]
Revert "[ORC-RT][ORC] Introduce ELF/*nix Platform and runtime support."

This reverts commit e256445bfff12013c3c4ad97da4aa69d25b175b5.

This commit broke some of the bots (see e.g.
https://lab.llvm.org/buildbot/#/builders/112/builds/8599). Reverting while I
investigate.

3 years ago[compiler-rt][fuzzer] Explain why fuzzer-flags test is unsupported on AArch64
David Spickett [Wed, 18 Aug 2021 10:08:17 +0000 (10:08 +0000)]
[compiler-rt][fuzzer] Explain why fuzzer-flags test is unsupported on AArch64

See https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4d1c6335455aeeda9de8a5eb58998f919ea35a1e
for the specific change that fixes the issue.

3 years agoAdding an Nvidia representative to security group
Nikhil Gupta [Wed, 18 Aug 2021 10:05:08 +0000 (12:05 +0200)]
Adding an Nvidia representative to security group

Adding Nikhil Gupta as an Nvidia representative to the llvm security
group.

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

3 years agoPre-commit frem test in PowerPC
Qiu Chaofan [Wed, 18 Aug 2021 09:52:53 +0000 (17:52 +0800)]
Pre-commit frem test in PowerPC

3 years agoFix a typo around 'builtin'
Qiu Chaofan [Wed, 18 Aug 2021 09:42:12 +0000 (17:42 +0800)]
Fix a typo around 'builtin'

3 years ago[OpenCL] C++ for OpenCL version 2021 introduced to command line.
Justas Janickas [Thu, 12 Aug 2021 15:20:11 +0000 (16:20 +0100)]
[OpenCL] C++ for OpenCL version 2021 introduced to command line.

Introduces language standard `lang_openclcpp2021` and allows
`clc++2021` as a version flag for `-cl-std` in command line.
Defines macros related to C++ for OpenCL version 2021.

C++ for OpenCL version 2021 has been proposed in an RFC:
https://lists.llvm.org/pipermail/cfe-dev/2021-August/068593.html

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

3 years agoMark tsan cxa_guard_acquire test as unsupported on Darwin
Azharuddin Mohammed [Wed, 18 Aug 2021 05:45:05 +0000 (22:45 -0700)]
Mark tsan cxa_guard_acquire test as unsupported on Darwin

This test started failing after recent commit `636428c727cd`. Marking it
as unsupported to get the bot back to green until we get it sorted out.

3 years agoAArch64: compare correct type for multi-valued SDNode.
Tim Northover [Wed, 18 Aug 2021 08:26:03 +0000 (09:26 +0100)]
AArch64: compare correct type for multi-valued SDNode.

If Orig produces more than one value (rare) with different types (rarer) then
we need to make sure we check against the one that Orig actually represents,
not just the first type.

Unfortunately because of the combination of things that need to happen I wasn't
able to produce a test.

3 years ago[JILink][ELF] Include binding and visibility values in error messages.
Lang Hames [Wed, 18 Aug 2021 08:03:47 +0000 (18:03 +1000)]
[JILink][ELF] Include binding and visibility values in error messages.

This should make it easier to track down JITLink errors for unrecognized
binding or visibility types, e.g.
https://lab.llvm.org/buildbot#builders/112/builds/8599.

3 years ago[ORC] Remove unused headers.
Lang Hames [Wed, 18 Aug 2021 06:28:21 +0000 (16:28 +1000)]
[ORC] Remove unused headers.

3 years ago[gn build] Port d1ec581ebfca
LLVM GN Syncbot [Wed, 18 Aug 2021 08:10:40 +0000 (08:10 +0000)]
[gn build] Port d1ec581ebfca

3 years ago[clangd] IncludeCleaner as a library: Find all references to symbols in the file
Kirill Bobyrev [Wed, 18 Aug 2021 08:08:08 +0000 (10:08 +0200)]
[clangd] IncludeCleaner as a library: Find all references to symbols in the file

This is the first patch in an ongoing attempt of Include Cleaner: unused/missing
headere diagnostics, an IWYU-like functionality implementation for clangd. The
work is split into (mostly) distinct and parallelizable pieces:

- Finding all referenced locations (this patch).
- Finding all referenced locations of macros.
- Building IncludeGraph and marking headers as unused, used and directly used.
- Making use of the introduced library and add an option to use in clangd.

---

* Adding support for standard library headers (possibly through mapping
  genfiles).

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

Reviewed By: sammccall

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

3 years ago[flang] Add default implementation for SYSTEM_CLOCK
Diana Picus [Mon, 12 Jul 2021 13:45:44 +0000 (13:45 +0000)]
[flang] Add default implementation for SYSTEM_CLOCK

Add an implementation for the runtime functions related to SYSTEM_CLOCK.
As with CPU_TIME, this is based on std::clock(), which should be
available everywhere, but it is highly recommended to add
platform-specific implementations for systems where std::clock() behaves
poorly (e.g. POSIX).

The documentation for std::clock() doesn't specify a maximum value and
in fact wrap around behaviour is non-conforming.  Therefore, this
implementation of SYSTEM_CLOCK is not guaranteed to wrap around either,
and after std::clock reaches its maximum value we will likely just
return failure rather than wrap around. If this happens often on your
system, please add a new platform-specific implementation.

We define COUNT_MAX as either the maximum value that can be stored in
a std::clock_t or in a 64-bit integer (whichever is smaller), and
COUNT_RATE as CLOCKS_PER_SEC. For POSIX systems, the value of
CLOCKS_PER_SEC is hardcoded to 10^6 and irrelevant for the values
returned by std::clock.

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

3 years ago[AArch64][GlobalISel] Add support for selection of s8:fpr = G_UNMERGE <8 x s8>
Amara Emerson [Wed, 18 Aug 2021 07:18:26 +0000 (00:18 -0700)]
[AArch64][GlobalISel] Add support for selection of s8:fpr = G_UNMERGE <8 x s8>

3 years ago[CMake] Fix recompile all .inc files with LLVM_OPTIMIZED_TABLEGEN in Visual Studio.
Daniil Fukalov [Wed, 11 Aug 2021 12:51:43 +0000 (15:51 +0300)]
[CMake] Fix recompile all .inc files with LLVM_OPTIMIZED_TABLEGEN in Visual Studio.

After some moment VS solution generated with LLVM_OPTIMIZED_TABLEGEN started to
generate all .inc files for each build. The reason was it had
"<path to native tablegen>/llvm-tblgen" without .exe as a dependency.

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

3 years agoRevert "Allow rematerialization of virtual reg uses"
Petr Hosek [Wed, 18 Aug 2021 07:12:41 +0000 (00:12 -0700)]
Revert "Allow rematerialization of virtual reg uses"

This reverts commit 877572cc193a470f310eec46a7ce793a6cc97c2f which
introduced PR51516.

3 years ago[InstrProfiling][NFC] Initialize MadeChange variable
Petr Hosek [Wed, 18 Aug 2021 06:31:50 +0000 (23:31 -0700)]
[InstrProfiling][NFC] Initialize MadeChange variable

This addresses an issue introduced in 389dc94d4be7 which triggers
a crash on Windows.

3 years ago[Test][AggressiveInstCombine] Add one more test for shift truncation
Anton Afanasyev [Wed, 18 Aug 2021 06:09:05 +0000 (09:09 +0300)]
[Test][AggressiveInstCombine] Add one more test for shift truncation

Add test for which `OrigBitWidth != SrcBitWidth`
(https://reviews.llvm.org/D108091#2950131)

3 years agoUse installed llvm-lit.py instead of lit.py PR-51072
Yaron Keren [Tue, 17 Aug 2021 17:15:39 +0000 (20:15 +0300)]
Use installed llvm-lit.py instead of lit.py PR-51072

Three tests fail when building and testing LLVM from the Visual C++ environment
since they use the repo version of lit.py that do not have local customization
builtin_parameters = { 'build_mode' : 'Release' }
https://bugs.llvm.org/show_bug.cgi?id=51072

Reviewed By: dyung

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

3 years ago[AMDGPU] Set wait state for meta instructions to zero
Christudasan Devadasan [Tue, 17 Aug 2021 04:26:36 +0000 (00:26 -0400)]
[AMDGPU] Set wait state for meta instructions to zero

It looked more reasonable to set the wait state to
zero for all non-instructions. With that we can avoid
the special handling for them in `getWaitStatesSince`
and `AdvanceCycle`. This NFC patch makes the handling
more generic.

3 years ago[AggressiveInstCombine] Fix unsigned overflow
Anton Afanasyev [Wed, 18 Aug 2021 05:11:54 +0000 (08:11 +0300)]
[AggressiveInstCombine] Fix unsigned overflow

Fix issue reported here: https://reviews.llvm.org/D108091#2950930

3 years ago[gn build] Port e256445bfff1
LLVM GN Syncbot [Wed, 18 Aug 2021 05:02:05 +0000 (05:02 +0000)]
[gn build] Port e256445bfff1

3 years ago[ORC-RT][ORC] Introduce ELF/*nix Platform and runtime support.
Lang Hames [Wed, 18 Aug 2021 00:47:21 +0000 (10:47 +1000)]
[ORC-RT][ORC] Introduce ELF/*nix Platform and runtime support.

This change adds support to ORCv2 and the Orc runtime library for static
initializers, C++ static destructors, and exception handler registration for
ELF-based platforms, at present Linux and FreeBSD on x86_64. It is based on the
MachO platform and runtime support introduced in bb5f97e3ad1.

Patch by Peter Housel. Thanks very much Peter!

Reviewed By: lhames

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

3 years ago[WebAssembly] Autogenerate checks for simd-conversions.ll
Thomas Lively [Wed, 18 Aug 2021 04:35:22 +0000 (21:35 -0700)]
[WebAssembly] Autogenerate checks for simd-conversions.ll

In preparation for adding more tests more simply.

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

3 years ago[NFC][llvm-xray] add a llvm-xray convert option `no-demangle`
Xu Mingjie [Wed, 18 Aug 2021 04:17:09 +0000 (12:17 +0800)]
[NFC][llvm-xray] add a llvm-xray convert option `no-demangle`

When option `--symbolize` is true, llvm-xray convert will demangle function
name on default. This patch adds a llvm-xray convert option `no-demangle` to
determine whether to demangle function name when symbolizing function ids from
the input log.

Reviewed By: MaskRay, smeenai

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

3 years ago[NFC] More get/removeAttribute() cleanup
Arthur Eubanks [Wed, 18 Aug 2021 03:25:16 +0000 (20:25 -0700)]
[NFC] More get/removeAttribute() cleanup

3 years ago[NFC] Cleanup more AttributeList::addAttribute()
Arthur Eubanks [Tue, 17 Aug 2021 01:24:22 +0000 (18:24 -0700)]
[NFC] Cleanup more AttributeList::addAttribute()

3 years ago[NFC] Cleanup attribute methods in Function
Arthur Eubanks [Tue, 17 Aug 2021 00:35:02 +0000 (17:35 -0700)]
[NFC] Cleanup attribute methods in Function

3 years ago[NFC] Migrate some callers away from Function/AttributeLists methods that take an...
Arthur Eubanks [Tue, 17 Aug 2021 00:12:49 +0000 (17:12 -0700)]
[NFC] Migrate some callers away from Function/AttributeLists methods that take an index

These methods can be confusing.

3 years ago[NFC] Replace Function handling of attributes with less confusing calls
Arthur Eubanks [Mon, 16 Aug 2021 23:29:20 +0000 (16:29 -0700)]
[NFC] Replace Function handling of attributes with less confusing calls

To avoid magic constants and confusing indexes.

3 years ago[mlir][ods] Fix packing in OperandOrAttribute
Jacques Pienaar [Wed, 18 Aug 2021 03:55:48 +0000 (20:55 -0700)]
[mlir][ods] Fix packing in OperandOrAttribute

Wrong combiner was used which led to information loss.

3 years ago[CFE][X86] Enable complex _Float16 support
Wang, Pengfei [Wed, 18 Aug 2021 01:06:54 +0000 (09:06 +0800)]
[CFE][X86] Enable complex _Float16 support

Support complex _Float16 on X86 in C/C++ following the latest X86 psABI. (https://gitlab.com/x86-psABIs)

Reviewed By: LuoYuanke

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

3 years ago[clang] enable sanitizers for hexagon
Brian Cain [Mon, 16 Aug 2021 23:59:42 +0000 (16:59 -0700)]
[clang] enable sanitizers for hexagon

3 years ago[compiler-rt] Add hexagon support to profile
Brian Cain [Tue, 17 Aug 2021 19:41:59 +0000 (12:41 -0700)]
[compiler-rt] Add hexagon support to profile

Adds build support for hexagon linux to profile

3 years ago[compiler-rt] Add hexagon support to safestack
Brian Cain [Tue, 17 Aug 2021 19:41:27 +0000 (12:41 -0700)]
[compiler-rt] Add hexagon support to safestack

Adds build support for hexagon linux to safestack.

3 years ago[compiler-rt] Add hexagon support to CFI
Brian Cain [Tue, 17 Aug 2021 19:40:51 +0000 (12:40 -0700)]
[compiler-rt] Add hexagon support to CFI

Adds build support for hexagon linux to cfi.

3 years ago[sanitizer] Add hexagon support to scudo
Brian Cain [Mon, 16 Aug 2021 23:38:09 +0000 (16:38 -0700)]
[sanitizer] Add hexagon support to scudo

Adds build support for hexagon linux to scudo, scudo-standalone

3 years ago[sanitizer] Add hexagon support to ubsan
Brian Cain [Mon, 16 Aug 2021 23:44:57 +0000 (16:44 -0700)]
[sanitizer] Add hexagon support to ubsan

Adds build support for hexagon linux to ubsan.

3 years ago[sanitizer] Add hexagon support to asan
Brian Cain [Mon, 16 Aug 2021 23:33:21 +0000 (16:33 -0700)]
[sanitizer] Add hexagon support to asan

Adds build support for hexagon linux to asan.

3 years ago[sanitizer] Add hexagon support to lsan
Brian Cain [Mon, 16 Aug 2021 23:28:32 +0000 (16:28 -0700)]
[sanitizer] Add hexagon support to lsan

Adds build support for hexagon linux to lsan.

3 years ago[sanitizer] Add hexagon support to sanitizer-common
Brian Cain [Tue, 17 Aug 2021 21:38:38 +0000 (14:38 -0700)]
[sanitizer] Add hexagon support to sanitizer-common

Adds build support for hexagon linux to sanitizer common.

3 years ago[lldb] Include arm64 in affected_by_radar_34562999
Jonas Devlieghere [Wed, 18 Aug 2021 01:30:48 +0000 (18:30 -0700)]
[lldb] Include arm64 in affected_by_radar_34562999

The same issue impacts arm64, both on-device and on Apple Silicon.

3 years ago[lldb] Extend isAArch64 to arm64 and arm64e
Jonas Devlieghere [Wed, 18 Aug 2021 01:05:46 +0000 (18:05 -0700)]
[lldb] Extend isAArch64 to arm64 and arm64e

This fixes TestMemoryTag on Apple Silicon.

3 years ago[CVP] processSwitch: Remove default case when switch cover all possible values.
Jun Ma [Thu, 15 Jul 2021 10:37:40 +0000 (18:37 +0800)]
[CVP] processSwitch: Remove default case when switch cover all possible values.

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

3 years ago[NFC][CVP] Add one switch testcase
Jun Ma [Tue, 10 Aug 2021 06:52:00 +0000 (14:52 +0800)]
[NFC][CVP] Add one switch testcase

3 years ago[RegAlloc] Remove addAllocPriorityToGlobalRanges hook
Qiu Chaofan [Wed, 18 Aug 2021 02:12:19 +0000 (10:12 +0800)]
[RegAlloc] Remove addAllocPriorityToGlobalRanges hook

It was introduced in 1a6dc92 and only enabled on PowerPC/AMDGPU. That
should be enabled for all targets.

Reviewed By: arsenm

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

3 years ago[DAGCombiner] Teach isKnownToBeAPowerOfTwo handle SPLAT_VECTOR
jacquesguan [Wed, 18 Aug 2021 01:48:33 +0000 (09:48 +0800)]
[DAGCombiner] Teach isKnownToBeAPowerOfTwo handle SPLAT_VECTOR

Make DAGCombine turn mul by power of 2 into shl for scalable vector.

Reviewed By: frasercrmck

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

3 years ago[flang][OpenMP] Add semantic check for target nesting
PeixinQiao [Wed, 18 Aug 2021 01:40:52 +0000 (09:40 +0800)]
[flang][OpenMP] Add semantic check for target nesting

This patch implements the following check for TARGET construct:
```
OpenMP Version 5.0 Target construct restriction: If a target update,
target data, target enter data, or target exit data construct is
encountered during execution of a target region, the behavior is
unspecified.
```

Also add one test case for the check.

Reviewed By: kiranchandramohan, clementval

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

3 years ago[X86] AVX512FP16 instructions enabling 3/6
Wang, Pengfei [Wed, 18 Aug 2021 01:03:01 +0000 (09:03 +0800)]
[X86] AVX512FP16 instructions enabling 3/6

Enable FP16 conversion instructions.

Ref.: https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html

Reviewed By: LuoYuanke

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

3 years ago[runtimeunroll] Support multiple exits to latch exit w/epilogue loop
Philip Reames [Wed, 18 Aug 2021 00:50:58 +0000 (17:50 -0700)]
[runtimeunroll] Support multiple exits to latch exit w/epilogue loop

This patch extends the runtime unrolling infrastructure to support unrolling a loop with multiple exiting blocks branching to the same exit block used by the latch. It intentionally does not include a cost model change to enable this functionality unless appropriate force flags are used.

I decided to restrict this to the epilogue case. Given the changes ended up being pretty generic, we may be able to unblock the prolog case too, but I want to do that in a separate change to reduce the amount of code we all have to understand at one time.

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

3 years ago[LLDB][GUI] Add Breakpoints window
Omar Emara [Tue, 17 Aug 2021 23:58:05 +0000 (16:58 -0700)]
[LLDB][GUI] Add Breakpoints window

This patch adds a breakpoints window that lists all breakpoints and
breakpoints locations. The window is implemented as a tree, where the
first level is the breakpoints and the second level is breakpoints
locations.

The tree delegate was hardcoded to only draw when there is a process,
which is not necessary for breakpoints, so the relevant logic was
abstracted in the TreeDelegateShouldDraw method.

Reviewed By: clayborg

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

3 years ago[test] Remove a redundant test line
Philip Reames [Wed, 18 Aug 2021 00:33:12 +0000 (17:33 -0700)]
[test] Remove a redundant test line

This was made redundant when I removed -instcombine from output in 70ffd65c, but I didn't notice.  nikic pointed that out in review of D107381

3 years ago[llvm-profgen] Move profiled binary loading out of PerfReader
wlei [Tue, 17 Aug 2021 22:53:31 +0000 (15:53 -0700)]
[llvm-profgen] Move profiled binary loading out of PerfReader

Change to use unique pointer of profiled binary to unblock asan.

At same time, I realized we can decouple to move the profiled binary loading out of PerfReader, so I made some other related refactors.

Reviewed By: hoy

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

3 years ago[LLDB][GUI] Refactor form drawing using subsurfaces
Omar Emara [Tue, 17 Aug 2021 23:06:46 +0000 (16:06 -0700)]
[LLDB][GUI] Refactor form drawing using subsurfaces

This patch adds a new method SubSurface to the Surface class. The method
returns another surface that is a subset of this surface. This is
important to further abstract away drawing from the ncurses objects. For
instance, fields could previously be drawn on subpads only but can now
be drawn on any surface. This is needed to create the file search
dialogs and similar functionalities.

There is an opportunity to refactor window drawing in general using
surfaces, but we shall consider this separately later.

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

3 years ago[LLDB] Fix off by one logging placeholders in ClangASTSource::layoutRecordType()
Shafik Yaghmour [Tue, 17 Aug 2021 23:29:00 +0000 (16:29 -0700)]
[LLDB] Fix off by one logging placeholders in ClangASTSource::layoutRecordType()

D72391 Added some additional information to the logging but in this case instead of using
placeholder 2 and 3 they used 3 and 4.

3 years ago[Modules] Do not remove failed modules after the control block phase
Ben Barham [Tue, 17 Aug 2021 22:53:40 +0000 (15:53 -0700)]
[Modules] Do not remove failed modules after the control block phase

Reading modules first reads each control block in the chain and then all
AST blocks.

The first phase is intended to find recoverable errors, eg. an out of
date or missing module. If any error occurs during this phase, it is
safe to remove all modules in the chain as no references to them will
exist.

While reading the AST blocks, however, various fields in ASTReader are
updated with references to the module. Removing modules at this point
can cause dangling pointers which can be accessed later. These would be
otherwise harmless, eg. a binary search over `GlobalSLocEntryMap` may
access a failed module that could error, but shouldn't crash. Do not
remove modules in this phase, regardless of failures.

Since this is the case, it also doesn't make sense to return OutOfDate
during this phase, so remove the two cases where this happens.

When they were originally added these checks would return a failure when
the serialized and current path didn't match up. That was updated to an
OutOfDate as it was found to be hit when using VFS and overriding the
umbrella. Later on the path was changed to instead be the name as
written in the module file, resolved using the serialized base
directory. At this point the check is really only comparing the name of
the umbrella and only works for frameworks since those don't include
`Headers/` in the name (which means the resolved path will never exist)

Given all that, it seems safe to ignore this case entirely for now.
This makes the handling of an umbrella header/directory the same as
regular headers, which also don't check for differences in the path
caused by VFS.

Resolves rdar://79329355

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

3 years ago[hwasan] [NFC] pull out helper function.
Florian Mayer [Tue, 3 Aug 2021 10:07:52 +0000 (11:07 +0100)]
[hwasan] [NFC] pull out helper function.

Reviewed By: hctim

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

3 years ago[hwasan] Support malloc in atfork.
Evgenii Stepanov [Sat, 14 Aug 2021 00:09:10 +0000 (17:09 -0700)]
[hwasan] Support malloc in atfork.

Before this change we were locking the StackDepot in the fork()
interceptor. This results in a deadlock when allocator functions are
used in a pthread_atfork() callback.

Instead, set up a pthread_atfork() callback at init that locks/unlocks
both StackDepot and the allocator. Since our callback is set up very
early, the pre-fork callback is executed late, and both post-fork ones
are executed early, which works perfect for us.

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

3 years agoLoopNest Analysis expansion to return instructions that prevent a Loop
Mark Danial [Tue, 17 Aug 2021 22:23:43 +0000 (22:23 +0000)]
LoopNest Analysis expansion to return instructions that prevent a Loop
Nest from being perfect

Expand LoopNestAnalysis to return the full list of instructions that
cause a loop nest to be imperfect. This is useful for other passes to
know if they should continue for in the inner loops.
Added New function getInterveningInstructions
that returns a small vector with the instructions that prevent a loop
for being perfect. Also added a couple of helper functions to reduce
code duplication.

Reviewed By: Whitney

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

3 years ago[flang] Fix the vector version of EOSHIFT with a BOUNDARY argument
Peter Steinfeld [Tue, 17 Aug 2021 21:57:42 +0000 (14:57 -0700)]
[flang] Fix the vector version of EOSHIFT with a BOUNDARY argument

When the vector version of EOSHIFT was called, the BOUNDARY argument was being
ignored.  I fixed that and added a test that would not pass without this fix.

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

3 years ago[libc++abi] Fix possible infinite loop in itanium demangler
Mikhail Borisov [Tue, 17 Aug 2021 22:10:57 +0000 (18:10 -0400)]
[libc++abi] Fix possible infinite loop in itanium demangler

A libfuzzer run has discovered some inputs for which the demangler does
not terminate. When minimized, it looks like this: _Zcv1BIRT_EIS1_E

Deciphered:

_Z
cv    - conversion operator

      * result type
 1B   - "B"
 I    - template args begin
  R   - reference type              <.
   T_ - forward template reference   |  *
 E    - template args end            |  |
                                     |  |
      * parameter type               |  |
 I    - template args begin          |  |
  S1_ - substitution #1              * <'
 E    - template args end

The reason is: template-parameter refs in conversion operator result type
create forward-references, while substitutions are instantly resolved via
back-references. Together these can create a reference loop. It causes an
infinite loop in ReferenceType::collapse().

I see three possible ways to avoid these loops:

1. check if resolving a forward reference creates a loop and reject the
   invalid input (hard to traverse AST at this point)
2. check if a substitution contains a malicious forward reference and
   reject the invalid input (hard to traverse AST at this point;
   substitutions are quite common: may affect performance; hard to
   clearly detect loops at this point)
3. detect loops in ReferenceType::collapse() (cannot reject the input)

This patch implements (3) as seemingly the least-impact change. As a
side effect, such invalid input strings are not rejected and produce
garbage, however there are already similar guards in
`if (Printing) return;` checks.

Fixes https://llvm.org/PR51407

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

3 years ago[libc++abi][NFC] Move PODSmallVector definition to the top of ItaniumDemangle.h
Mikhail Borisov [Tue, 17 Aug 2021 22:06:53 +0000 (18:06 -0400)]
[libc++abi][NFC] Move PODSmallVector definition to the top of ItaniumDemangle.h

This change is needed to clean the non-relevant parts of diff
from https://reviews.llvm.org/D107712

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

3 years ago(NFC) clang-format hwasan/hwasan_linux.cpp
Evgenii Stepanov [Tue, 17 Aug 2021 17:57:25 +0000 (10:57 -0700)]
(NFC) clang-format hwasan/hwasan_linux.cpp

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