platform/upstream/llvm.git
3 years agoReland "[llvm] llvm-tapi-diff"
Sam Powell [Wed, 9 Jun 2021 17:29:29 +0000 (10:29 -0700)]
Reland "[llvm] llvm-tapi-diff"

This is relanding commit d1d36f7ad2ae82bea8a6fcc40d6c42a72e21f096 .
This patch additionally addresses failures found in buildbots & post review comments.

This patch introduces a new tool, llvm-tapi-diff, that compares and returns the diff of two TBD files.

Reviewed By: ributzka, JDevlieghere

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

3 years ago[ms] [llvm-ml] Fix parity errors in error handling for INCLUDE directive
Eric Astor [Wed, 9 Jun 2021 17:34:18 +0000 (13:34 -0400)]
[ms] [llvm-ml] Fix parity errors in error handling for INCLUDE directive

Also adds basic testing for "include" directive.

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

3 years agoRevert "Do not generate calls to the 128-bit function __multi3() on 32-bit ARM"
Nico Weber [Wed, 9 Jun 2021 17:21:05 +0000 (13:21 -0400)]
Revert "Do not generate calls to the 128-bit function __multi3() on 32-bit ARM"

This reverts commit 64e9aa33020d68a98c30bf05362ffc1c1778890c.
Breaks check-llvm everywhere, see https://reviews.llvm.org/D103906

3 years ago[libc++] Fix libc++ build with assertions enabled
Louis Dionne [Wed, 9 Jun 2021 13:41:27 +0000 (09:41 -0400)]
[libc++] Fix libc++ build with assertions enabled

This fixes http://llvm.org/PR50534. This is another take on D103960
which is less disruptive.

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

3 years ago[lldb] Use C++11 default member initializers
Jonas Devlieghere [Wed, 9 Jun 2021 16:25:29 +0000 (09:25 -0700)]
[lldb] Use C++11 default member initializers

This converts a default constructor's member initializers into C++11
default member initializers. This patch was automatically generated with
clang-tidy and the modernize-use-default-member-init check.

$ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-default-member-init' -fix

This is a mass-refactoring patch and this commit will be added to
.git-blame-ignore-revs.

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

3 years ago[mlir][gpu][NFC] Simplify conversion of MMA type to NVVM
thomasraoux [Tue, 8 Jun 2021 05:25:30 +0000 (22:25 -0700)]
[mlir][gpu][NFC] Simplify conversion of MMA type to NVVM

Consolidate the type conversion in a single function to make it simpler
to use. This allow to re-use the type conversion for up coming ops.

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

3 years ago[SCEV] Keep common NUW flags when inlining Add operands.
Florian Hahn [Wed, 9 Jun 2021 10:06:21 +0000 (11:06 +0100)]
[SCEV] Keep common NUW flags when inlining Add operands.

Currently, NoWrapFlags are dropped if we inline operands of SCEVAddExpr
operands. As a consequence, we always drop flags when building
expressions like `getAddExpr(A, getAddExpr(B, C, NUW), NUW)`.

We should be able to retain NUW flags common among all inlined
SCEVAddExpr and the original flags.

Reviewed By: nikic, mkazantsev

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

3 years agoFix typo in Toy tutorial Ch1
Pavel Krajcevski [Wed, 9 Jun 2021 16:07:56 +0000 (16:07 +0000)]
Fix typo in Toy tutorial Ch1

This aligns the website with the actual test case in the repo.

Reviewed By: mehdi_amini

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

3 years agoclang/darwin: use response files with ld64
Keith Smiley [Tue, 8 Jun 2021 23:40:30 +0000 (16:40 -0700)]
clang/darwin: use response files with ld64

This crasher was fixed with Xcode 13.0 beta 1 / ld64 705. This is an
updated revert of https://reviews.llvm.org/D92357

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

3 years ago[mlir] fix a crash if the dialect is missing a data layout interface
Alex Zinenko [Wed, 9 Jun 2021 09:51:04 +0000 (11:51 +0200)]
[mlir] fix a crash if the dialect is missing a data layout interface

The top-level verifier of data layout specifications delegates verification of
entries with identifier keys to the dialect of the identifier prefix. This flow
was missing a check whether the dialect actually implements the relevant
interface.

Reviewed By: gysit

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

3 years ago[libcxx][ci] enables assertions for runtimes-build
Christopher Di Bella [Tue, 8 Jun 2021 00:09:36 +0000 (00:09 +0000)]
[libcxx][ci] enables assertions for runtimes-build

This will catch nasty Clang bugs like
https://bugs.llvm.org/show_bug.cgi?id=50592 before we merge stuff into
libc++ main.

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

3 years ago[InstCombine] add tests for casts-around-ctlz; NFC
Sanjay Patel [Wed, 9 Jun 2021 15:16:51 +0000 (11:16 -0400)]
[InstCombine] add tests for casts-around-ctlz; NFC

Baseline for D103788

3 years agoDo not generate calls to the 128-bit function __multi3() on 32-bit ARM
Koutheir Attouchi [Wed, 9 Jun 2021 15:02:14 +0000 (16:02 +0100)]
Do not generate calls to the 128-bit function __multi3() on 32-bit ARM

The function __multi3() is undefined on 32-bit ARM, so a call to it
should never be emitted. Instead, plain instructions need to be
generated to perform 128-bit multiplications.

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

3 years ago[mlir][ArmSVE] Add basic load/store operations
Javier Setoain [Wed, 2 Jun 2021 16:31:58 +0000 (17:31 +0100)]
[mlir][ArmSVE] Add basic load/store operations

ArmSVE-specific memory operations are needed to generate end-to-end
code for as long as MLIR core doesn't support scalable vectors. This
instructions will be eventually unnecessary, for now they're required
for more complex testing.

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

3 years agoRevert "[OpenMP] libomp: implement OpenMP 5.1 inoutset task dependence type"
AndreyChurbanov [Wed, 9 Jun 2021 14:35:50 +0000 (17:35 +0300)]
Revert "[OpenMP] libomp: implement OpenMP 5.1 inoutset task dependence type"

This reverts commit a1f550e052543f75acac9089b760cbc61729131f.

Revert in order to fix backwards compatibility breakage
caused by type size change for task dependence flag.

3 years ago[SROA] Avoid splitting loads/stores with irregular type
LemonBoy [Wed, 9 Jun 2021 14:35:18 +0000 (16:35 +0200)]
[SROA] Avoid splitting loads/stores with irregular type

Upon encountering loads/stores on types whose size is not a multiple of 8 bits the SROA pass would either trip an assertion or use logic that was not meant to work with such irregularly-sized types.

Reviewed By: aeubanks

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

3 years ago[mlir][openacc][NFC] move index in processDataOperands
Valentin Clement [Wed, 9 Jun 2021 14:28:07 +0000 (10:28 -0400)]
[mlir][openacc][NFC] move index in processDataOperands

Move the index variable used to track variables inside of the specific
processDataOperands functions.

Reviewed By: kiranchandramohan

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

3 years ago[X86] Check destination element type before forming VTRUNCS/VTRUNCUS in combineTrunca...
Craig Topper [Wed, 9 Jun 2021 14:08:16 +0000 (07:08 -0700)]
[X86] Check destination element type before forming VTRUNCS/VTRUNCUS in combineTruncateWithSat.

Fixes crash reported here https://reviews.llvm.org/D73607

Using a store to keep the trunc intact. Returning v16i24 would
cause the trunc to be optimized away in SelectionDAGBuilder.

Reviewed By: RKSimon

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

3 years ago[SDAG] fix miscompile from merging stores of different sizes
Sanjay Patel [Wed, 9 Jun 2021 13:44:58 +0000 (09:44 -0400)]
[SDAG] fix miscompile from merging stores of different sizes

As shown in:
https://llvm.org/PR50623
...and the similar tests here, we were not accounting for
store merging of different sizes that do not cover the
entire range of the wide value to be stored.

This is the easy fix: just make sure that all of the
original stores are the same size, so when we calculate
the wide width, it's a simple N * M check.

This still allows all of the motivating optimizations from:
D86420 / 54a5dd485c4d
D87112 / 7a06b166b1af

We could enhance this code to track individual bytes and
allow merging multiple sizes.

3 years agoSanitizers.h - remove MathExtras.h include dependency
Simon Pilgrim [Wed, 9 Jun 2021 13:37:56 +0000 (14:37 +0100)]
Sanitizers.h - remove MathExtras.h include dependency

The MathExtras.h header is included purely for the countPopulation() method - by moving this into Sanitizers.cpp we can remove the use of this costly header.

We only ever use isPowerOf2() / countPopulation() inside asserts so this shouldn't have any performance effects on production code.

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

3 years ago[ARM] Fix Machine Outliner LDRD/STRD handling in Thumb mode.
Yvan Roux [Wed, 9 Jun 2021 13:30:50 +0000 (15:30 +0200)]
[ARM] Fix Machine Outliner LDRD/STRD handling in Thumb mode.

This is a fix for PR50481

Immediate values for AddrModeT2_i8s4 are already scaled in MCinst operand.
This patch changes the number of bits and scale factor to reflect that
state when checking stack offset status. AddrModeT2_i7s[2|4] also have
this particularity but since MVE instructions are not outlined, just move
these cases to the unhandled ones.

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

3 years ago[TableGen] Fix ProfileFoldOpInit so that parameters are named consistently [NFC]
Paul C. Anagnostopoulos [Mon, 7 Jun 2021 15:56:26 +0000 (11:56 -0400)]
[TableGen] Fix ProfileFoldOpInit so that parameters are named consistently [NFC]

See https://bugs.llvm.org/show_bug.cgi?id=50595

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

3 years ago[x86] add tests for store merging miscompile (PR50623); NFC
Sanjay Patel [Wed, 9 Jun 2021 12:57:38 +0000 (08:57 -0400)]
[x86] add tests for store merging miscompile (PR50623); NFC

3 years ago[OpenCL] Add OpenCL builtin test generator
Sven van Haastregt [Wed, 9 Jun 2021 11:43:50 +0000 (12:43 +0100)]
[OpenCL] Add OpenCL builtin test generator

Add a new clang-tblgen flag `-gen-clang-opencl-builtin-tests` that
generates a .cl file containing calls to every builtin function
defined in the .td input.

This patch does not add any use of the new flag yet, so the only way
to obtain a generated test file is through a manual invocation of
clang-tblgen.  A test making use of this emitter will be added in a
followup commit.

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

3 years ago[X86][SLM] Adjust XMM non-PMULLD throughput costs to half rate.
Simon Pilgrim [Wed, 9 Jun 2021 12:31:52 +0000 (13:31 +0100)]
[X86][SLM] Adjust XMM non-PMULLD throughput costs to half rate.

Match what's reported in the costs table, Agner's tables and the Intel AOM

3 years ago[X86][SSE] Regenerate slow-pmulld.ll test checks
Simon Pilgrim [Wed, 9 Jun 2021 11:23:13 +0000 (12:23 +0100)]
[X86][SSE] Regenerate slow-pmulld.ll test checks

3 years ago[clang] p1099 using-enum feature macro & web page
Nathan Sidwell [Fri, 7 May 2021 19:46:39 +0000 (12:46 -0700)]
[clang] p1099 using-enum feature macro & web page

This completes the series implementing p1099, by adding the feature
macro and updating the web page.

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

3 years ago[clang-cl] Parse /await:strict, new in MSVC 16.10
Hans Wennborg [Wed, 9 Jun 2021 12:26:54 +0000 (14:26 +0200)]
[clang-cl] Parse /await:strict, new in MSVC 16.10

3 years ago[SLP]Improve gathering of scalar elements.
Alexey Bataev [Tue, 1 Jun 2021 13:21:18 +0000 (06:21 -0700)]
[SLP]Improve gathering of scalar elements.

1. Better sorting of scalars to be gathered. Trying to insert
   constants/arguments/instructions-out-of-loop at first and only then
   the instructions which are inside the loop. It improves hoisting of
   invariant insertelements instructions.
2. Better detection of shuffle candidates in gathering function.
3. The cost of insertelement for constants is 0.

Part of D57059.

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

3 years ago[Test] Add more elaborate case of symbolic execution of 1-iteration loop
Max Kazantsev [Wed, 9 Jun 2021 12:07:50 +0000 (19:07 +0700)]
[Test] Add more elaborate case of symbolic execution of 1-iteration loop

3 years ago[mlir] Expose a function to populate tensor constant bufferization patterns
Benjamin Kramer [Mon, 7 Jun 2021 19:57:55 +0000 (21:57 +0200)]
[mlir] Expose a function to populate tensor constant bufferization patterns

This makes it easier to use it from other bufferization passes.

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

3 years ago[OpenMP][Tools] Fix Archer handling of task dependencies
Joachim Protze [Sat, 21 Nov 2020 23:23:35 +0000 (00:23 +0100)]
[OpenMP][Tools] Fix Archer handling of task dependencies

The current handling of dependencies in Archer has two flaws:

- annotation of dependency synchronization is not limited to sibling tasks
- annotation of in/out dependencies is based on the assumption, that dependency
  variables will rarely be byte-sized variables.

This patch introduces a map in the generating task to manage the dependency
variables for the child tasks. The map is only accesses from the generating
task, so no locking is necessary. This also limits the dependency-based
synchronization to sibling tasks.
This patch also introduces proper handling for new dependency types such as
mutexinoutset and inoutset.

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

3 years ago[OpenMP][Tools] Cleanup memory pool used in Archer
Joachim Protze [Thu, 19 Nov 2020 22:27:43 +0000 (23:27 +0100)]
[OpenMP][Tools] Cleanup memory pool used in Archer

The main motivation for reusing objects is that it helps to avoid creating and
leaking synchronization clocks in TSan. The reused object will reuse the
synchronization clock in TSan.

Before, new and delete operators were overloaded to get and return memory for
the object from/to the object pool.
This patch replaces the operator overloading with explicit static New/Delete
functions.

Objects for parallel regions and implicit tasks will always be recruited and
returned to the thread-local object pool. Only for explicit task, there is a
chance that an other thread completes the task and will free the object. This
patch optimizes the thread-local New/Delete calls by avoiding locks and only
lock if the pool is empty. Remote threads return the object into a separate
queue.

The chunk size for allocations is now decided based on page size. The objects
will also be aligned to cache lines avoiding false sharing.

This is the first patch in a series to provide better tasking support.

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

3 years ago[OpenMP][Tools] Fix Archer for MACOS
Joachim Protze [Sat, 21 Nov 2020 23:08:39 +0000 (00:08 +0100)]
[OpenMP][Tools] Fix Archer for MACOS

Archer uses weak symbol overloads of TSan functions to enable loading the tool
even if the application is not built with TSan. For MACOS the tool collects
the function pointer at runtime.
When adding the function entry/exit markers, we missed to add the functions
in the MACOS codepath.
This patch also replaces the repeated function lookup by a single initial
function lookup and fixes the disabling logic in RunningOnValgrind.

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

3 years ago[AArch64LoadStoreOptimizer] Generate more STPs by renaming registers earlier
Meera Nakrani [Wed, 2 Jun 2021 14:17:08 +0000 (14:17 +0000)]
[AArch64LoadStoreOptimizer] Generate more STPs by renaming registers earlier

Our initial motivating case was memcpy's with alignments > 16. The
loads/stores, to which small memcpy's expand, are kept together in
several places so that we get a sequence like this for a 64 bit copy:
LD w0
LD w1
ST w0
ST w1
The load/store optimiser can generate a LDP/STP w0, w1 from this because
the registers read/written are consecutive. In our case however, the
sequence is optimised during ISel, resulting in:
LD w0
ST w0
LD w0
ST w0
This instruction reordering allows reuse of registers. Since the registers
are no longer consecutive (i.e. they are the same), it inhibits LDP/STP
creation. The approach here is to perform renaming:
LD w0
ST w0
LD w1
ST w1
to enable the folding of the stores into a STP. We do not yet generate
the LDP due to a limitation in the renaming implementation, but plan to
look at that in a follow-up so that we fully support this case. While
this was initially motivated by certain memcpy's, this is a general
approach and thus is beneficial for other cases too, as can be seen
in some test changes.

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

3 years ago[ValueTypes][RISCV] Cap RVV fixed-length vectors by size
Fraser Cormack [Mon, 7 Jun 2021 07:39:22 +0000 (08:39 +0100)]
[ValueTypes][RISCV] Cap RVV fixed-length vectors by size

This patch changes RVV's policy for its supported list of fixed-length
vector types by capping by vector size rather than element count. Now
all 1024-byte vectors (of supported element types) are supported, rather
than all 256-element vectors.

This is a more natural fit for the architecture, and allows us to, for
example, improve the support for vector bitcasts.

This change necessitated the adding of some new simple types to avoid
"regressing" on the number of currently-supported vectors. We round out
the 1024-byte types by adding `v512i8`, `v1024i8`, `v512i16` and
`v512f16`.

Reviewed By: craig.topper

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

3 years agoCorrect the behavior of va_arg checking in C++
Aaron Ballman [Wed, 9 Jun 2021 11:15:15 +0000 (07:15 -0400)]
Correct the behavior of va_arg checking in C++

Clang checks whether the type given to va_arg will automatically cause
undefined behavior, but this check was issuing false positives for
enumerations in C++. The issue turned out to be because
typesAreCompatible() in C++ checks whether the types are *the same*, so
this uses custom logic if the type compatibility check fails.

This issue was found by a user on code like:

typedef enum {
  CURLINFO_NONE,
  CURLINFO_EFFECTIVE_URL,
  CURLINFO_LASTONE = 60
} CURLINFO;

...

__builtin_va_arg(list, CURLINFO); // false positive warning

Given that C++ defers to C for the rules around va_arg, the behavior
should be the same in both C and C++ and not diagnose because int and
CURLINFO are "compatible enough" types for va_arg.

3 years ago[clang] NFC: rename SK_CastDerivedToBaseRValue to SK_CastDerivedToBasePRValue
Matheus Izvekov [Tue, 8 Jun 2021 23:00:48 +0000 (01:00 +0200)]
[clang] NFC: rename SK_CastDerivedToBaseRValue to SK_CastDerivedToBasePRValue

This is a follow up to the "rvalue-to-prvalue" rename at D103720.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Depends on D103720

Reviewed By: rsmith

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

3 years agoRevert "[SROA] Avoid splitting loads/stores with irregular type"
Nico Weber [Wed, 9 Jun 2021 10:32:58 +0000 (06:32 -0400)]
Revert "[SROA] Avoid splitting loads/stores with irregular type"

This reverts commit 905f4eb537c118783969fded19e96fe6504c2956.
Breaks check-llvm on most (all?) bots, see https://reviews.llvm.org/D99435

3 years ago[clang] NFC: Rename rvalue to prvalue
Matheus Izvekov [Fri, 4 Jun 2021 21:15:23 +0000 (23:15 +0200)]
[clang] NFC: Rename rvalue to prvalue

This renames the expression value categories from rvalue to prvalue,
keeping nomenclature consistent with C++11 onwards.

C++ has the most complicated taxonomy here, and every other language
only uses a subset of it, so it's less confusing to use the C++ names
consistently, and mentally remap to the C names when working on that
context (prvalue -> rvalue, no xvalues, etc).

Renames:
* VK_RValue -> VK_PRValue
* Expr::isRValue -> Expr::isPRValue
* SK_QualificationConversionRValue -> SK_QualificationConversionPRValue
* JSON AST Dumper Expression nodes value category: "rvalue" -> "prvalue"

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith

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

3 years agoJSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper...
Simon Pilgrim [Wed, 9 Jun 2021 10:09:19 +0000 (11:09 +0100)]
JSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper. NFCI

Pulled out of D103888 - use the underlying SmallString version directly

3 years agoInterp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI
Simon Pilgrim [Wed, 9 Jun 2021 10:06:23 +0000 (11:06 +0100)]
Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI

Pulled out of D103888 - use the underlying SmallString version directly

3 years ago[SROA] Avoid splitting loads/stores with irregular type
LemonBoy [Wed, 9 Jun 2021 09:47:17 +0000 (11:47 +0200)]
[SROA] Avoid splitting loads/stores with irregular type

Upon encountering loads/stores on types whose size is not a multiple of 8 bits the SROA pass would either trip an assertion or use logic that was not meant to work with such irregularly-sized types.

Reviewed By: aeubanks

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

3 years ago[docs] Fix load instructions in chapter 7 of the tutorial
Jim Lin [Wed, 9 Jun 2021 09:36:17 +0000 (17:36 +0800)]
[docs] Fix load instructions in chapter 7 of the tutorial

Loads in the first half of the chapter are missing the type argument.

Patched By: klao (Mihaly Barasz)

Reviewed By: Jim

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

3 years ago[JITLink][MachO] Handle muliple symbols at same offset when splitting C-strings.
Lang Hames [Wed, 9 Jun 2021 08:56:30 +0000 (18:56 +1000)]
[JITLink][MachO] Handle muliple symbols at same offset when splitting C-strings.

The C-string section splitting support added in f9649d123db triggered an assert
("Duplicate canonical symbol at address") when multiple symbols were defined at
the the same offset within a C-string block (this triggered on arm64, where we
always add a block start symbol). The bug was caused by a failure to update the
record of the last canonical symbol address. The fix was to maintain this record
correctly, and move the auto-generation of the block-start symbol above the
handling for symbols defined in the object itself so that all symbols
(auto-generated and defined) are processed in address order.

3 years ago[LTO] Support new PM in ThinLTOCodeGenerator.
Florian Hahn [Wed, 9 Jun 2021 08:22:35 +0000 (09:22 +0100)]
[LTO] Support new PM in ThinLTOCodeGenerator.

This patch adds initial support for using the new pass manager when
doing ThinLTO via libLTO.

Reviewed By: steven_wu

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

3 years ago[mlir][ArmSVE] Add basic mask generation operations
Javier Setoain [Thu, 22 Apr 2021 08:29:02 +0000 (09:29 +0100)]
[mlir][ArmSVE] Add basic mask generation operations

These `arm_sve.cmp` functions are needed to generate scalable vector
masks as long as scalable vectors are not part of the standard types.
Once in standard, these can be removed and `std.cmp` can be used
instead.

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

3 years ago[RISCV] Fix failing RVV MC tests
Fraser Cormack [Wed, 9 Jun 2021 08:45:05 +0000 (09:45 +0100)]
[RISCV] Fix failing RVV MC tests

I believe these failures were introduced by D103790's changes to the
VType formatting found in vsetvli/vsetivli instructions.

3 years ago[compiler-rt] Mark symbolize_stack_fp test unsupported on Arm Thumb
David Spickett [Wed, 2 Jun 2021 11:06:15 +0000 (11:06 +0000)]
[compiler-rt] Mark symbolize_stack_fp test unsupported on Arm Thumb

The new test `symbolize_stack_fp.cpp` added in
https://reviews.llvm.org/D102046 assumes that
we can fall back to the fast unwinder.

This is not the case for Thumb and the test is currently
failing on our v7 thumb bot:
https://lab.llvm.org/buildbot/#/builders/26/builds/2096

Skip the test if we're building for a Thumb target.

Reviewed By: MaskRay

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

3 years ago[ValueTypes] Add missing enum names for MVTs
Fraser Cormack [Tue, 8 Jun 2021 10:21:31 +0000 (11:21 +0100)]
[ValueTypes] Add missing enum names for MVTs

These types are (presumably) never used in the generated TableGen files.
The `default` switch case silences any compiler warnings for these
missing types so it's easy to miss.

Reviewed By: craig.topper

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

3 years ago[LoopBoundSplit] Ignore phi node which is not scevable
Jingu Kang [Tue, 8 Jun 2021 17:24:38 +0000 (18:24 +0100)]
[LoopBoundSplit] Ignore phi node which is not scevable

There was a bug in LoopBoundSplit. The pass should ignore phi node which is not
scevable.

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

3 years agoRevert "[lldb] Set return status to failed when adding a command error"
David Spickett [Wed, 9 Jun 2021 08:41:59 +0000 (09:41 +0100)]
Revert "[lldb] Set return status to failed when adding a command error"

This reverts commit e05b03cf4f45ac5ee63c59a3464e7d484884645c.

While I investigate a register test failure:
http://green.lab.llvm.org/green/blue/organizations/jenkins/lldb-cmake/detail/lldb-cmake/32693/pipeline/

3 years agoRevert "[llvm] Sync DebugInfo.h with DebugInfoFlags.def"
Jan Kratochvil [Wed, 9 Jun 2021 08:39:42 +0000 (10:39 +0200)]
Revert "[llvm] Sync DebugInfo.h with DebugInfoFlags.def"

This reverts commit 093750dd0be6b0729f8e817766c3d5849545e10c.

It broke buildbots, goint to investigate it more.

3 years ago[flang] Define the API for CPU_TIME
Diana Picus [Mon, 7 Jun 2021 11:48:32 +0000 (11:48 +0000)]
[flang] Define the API for CPU_TIME

CPU_TIME takes a single real scalar INTENT(OUT) argument. We can
therefore return a double and let lowering handle casting that to the
precision used for the default real kind.

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

3 years ago[ScalarEvolution] Add test for preserving add overflow flags.
Florian Hahn [Wed, 9 Jun 2021 08:01:33 +0000 (09:01 +0100)]
[ScalarEvolution] Add test for preserving add overflow flags.

3 years ago[RISCV] Support CONCAT_VECTORS on scalable masks
Fraser Cormack [Tue, 8 Jun 2021 13:55:31 +0000 (14:55 +0100)]
[RISCV] Support CONCAT_VECTORS on scalable masks

This patch is a simple fix which registers CONCAT_VECTORS as
custom-lowered for scalable mask vectors. This follows the pattern of
all other scalable-vector types, as the default expansion of
CONCAT_VECTORS cannot handle scalable types, and even if it did it'd go
through the stack and generate worse code.

Reviewed By: craig.topper

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

3 years ago[llvm] Sync DebugInfo.h with DebugInfoFlags.def
Jan Kratochvil [Wed, 9 Jun 2021 08:11:23 +0000 (10:11 +0200)]
[llvm] Sync DebugInfo.h with DebugInfoFlags.def

Command to see the differences:
  diff -u <(sed -n 's#^HANDLE_DI_FLAG *([^,]*, *\([^()]*\)) *\(//.*\)\?$#\1#p' <llvm/include/llvm/IR/DebugInfoFlags.def | grep -vw Largest) <(sed -n 's#^ *LLVMDIFlag\([^ ]*\) *= (\?[0-9].*$#\1#p' <llvm/include/llvm-c/DebugInfo.h)

OCaml binding is more seriously out of sync but I have not tried to sync it.

Reviewed By: aprantl

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

3 years ago[MLIR] Make DictionaryAttr::getAs take name as && reference
Fabian Schuiki [Wed, 9 Jun 2021 08:03:18 +0000 (10:03 +0200)]
[MLIR] Make DictionaryAttr::getAs take name as && reference

As a follow-up to the discussion in https://reviews.llvm.org/D103822,
make the templated `DictionaryAttr::getAs` take the name by `&&`
reference and properly forward the argument to the underlying `get`.

3 years agoPrevent generation of dependency on _cxa_guard for static initialization
serge-sans-paille [Fri, 14 May 2021 09:45:10 +0000 (11:45 +0200)]
Prevent generation of dependency on _cxa_guard for static initialization

This fixes an issue introduced by https://reviews.llvm.org/D70662

Function-scope static initialization are guarded in C++, so we should probably
not use it because it introduces a dependency on __cxa_guard* symbols.
In the context of clang, libasan is linked statically, and it currently needs to
the odd situation where compiling C code with clang and asan requires -lstdc++

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

3 years ago Fix the 4203-Buildbot failure in LLVM Buildbot on llvm-clang-win-x-aarch64
Esme-Yi [Wed, 9 Jun 2021 07:23:51 +0000 (07:23 +0000)]
Fix the 4203-Buildbot failure in LLVM Buildbot on llvm-clang-win-x-aarch64

    Failure in llvm/test/tools/llvm-objdump/XCOFF/section-headers.test:

    SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
                 in position 24-25: truncated \xXX escape

3 years ago[NFC] Reformat MachineValueType
Guillaume Chatelet [Tue, 8 Jun 2021 12:50:34 +0000 (12:50 +0000)]
[NFC] Reformat MachineValueType

This is a follow up patch based on https://reviews.llvm.org/D103251#2804016.

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

3 years ago[Docs] Fix incorrect return type for example code
Jim Lin [Wed, 9 Jun 2021 07:19:43 +0000 (15:19 +0800)]
[Docs] Fix incorrect return type for example code

3 years ago[mlir][linalg] Prepare fusion on tensors for scalar operands.
Tobias Gysi [Wed, 9 Jun 2021 06:31:53 +0000 (06:31 +0000)]
[mlir][linalg] Prepare fusion on tensors for scalar operands.

Adapt fusion on tensors to support structured ops taking scalar operands.

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

3 years ago[CMake] Don't use libc++ by default on Windows yet
Petr Hosek [Wed, 9 Jun 2021 05:44:53 +0000 (22:44 -0700)]
[CMake] Don't use libc++ by default on Windows yet

libc++ has issues when used with -fno-exceptions and vcruntime,
don't use it on Windows by default until we address those issues.

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

3 years ago[PowerPC] Make sure the first probe is full size or is the last probe when stack...
Kai Luo [Wed, 9 Jun 2021 06:24:14 +0000 (06:24 +0000)]
[PowerPC] Make sure the first probe is full size or is the last probe when stack is realigned

When `-fstack-clash-protection` is enabled and stack has to be realigned, some parts of redzone is written prior the probe, so probe might overwrite content already written in redzone. To avoid it, we have to make sure the first probe is at full probe size or is the last probe so that we can skip redzone.

It also fixes violation of ABI under PPC where `r1` isn't updated atomically.

This fixes https://bugs.llvm.org/show_bug.cgi?id=49903.

Reviewed By: jsji

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

3 years ago[mlir] Fix body-less async.execute printing
Christian Sigg [Fri, 4 Jun 2021 11:52:34 +0000 (13:52 +0200)]
[mlir] Fix body-less async.execute printing

Reviewed By: ezhulenev

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

3 years agoRemove white space in llvm-objdump/XCOFF/section-headers.test
Esme-Yi [Wed, 9 Jun 2021 05:35:52 +0000 (05:35 +0000)]
Remove white space in llvm-objdump/XCOFF/section-headers.test

3 years agoFix LIT test failure encountered on AIX
Chris Bowler [Tue, 8 Jun 2021 21:46:47 +0000 (17:46 -0400)]
Fix LIT test failure encountered on AIX

```
fatal error: error in backend: getLangStandardForKind() on unspecified kind
```

Clang :: Modules/preprocess-module.cpp
Clang :: Modules/no-module-map.cpp
Clang :: Modules/preprocess-build-diamond.m
Clang :: Modules/preprocess-decluse.cpp
Clang :: Modules/string_names.cpp

Fix to prior commit f38eff777e46f42884d82815d0b39766520ac2bf, D103707

3 years agoAdd Twine support for std::string_view.
Sterling Augustine [Tue, 8 Jun 2021 23:57:26 +0000 (16:57 -0700)]
Add Twine support for std::string_view.

With Twine now ubiquitous after rG92a79dbe91413f685ab19295fc7a6297dbd6c824,
it needs support for string_view when building clang with newer C++ standards.

This is similar to how StringRef is handled.

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

3 years ago[RISCV][NFC] Add a single space after comma for VType
Jim Lin [Tue, 8 Jun 2021 07:40:56 +0000 (15:40 +0800)]
[RISCV][NFC] Add a single space after comma for VType

In most of cases, it has a single space after comma in assembly operands.

Reviewed By: craig.topper

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

3 years ago[NFC][XCOFF] Use yaml2obj in llvm-objdump/XCOFF/section-headers.test instead of binar...
Esme-Yi [Wed, 9 Jun 2021 03:11:33 +0000 (03:11 +0000)]
[NFC][XCOFF] Use yaml2obj in llvm-objdump/XCOFF/section-headers.test instead of binary files.

Summary: This a minor patch to refactor the test file,
llvm-objdump/XCOFF/section-headers.test, to use yaml2obj
for this testing rather than a canned binary.

Reviewed By: jhenderson

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

3 years ago[PowerPC][Dwarf] Assign MMA register's dwarf register number to negative value
Kai Luo [Wed, 9 Jun 2021 02:22:48 +0000 (02:22 +0000)]
[PowerPC][Dwarf] Assign MMA register's dwarf register number to negative value

According to ELF V2 ABI, `0` should be the dwarf number of `r0`. Currently MMA's register also uses `0` as its dwarf number, this confuses `RegisterInfoEmitter` and generates wrong dwarf -> llvm mapping.
```
extern const MCRegisterInfo::DwarfLLVMRegPair PPCDwarfFlavour1Dwarf2L[] = {
  { 0U, PPC::VSRp31 },
```
This leads to wrong cfi output in https://reviews.llvm.org/D100290.

Reviewed By: jsji

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

3 years agoReland "[AMDGPU] Add gfx1013 target"
Brendon Cahoon [Tue, 8 Jun 2021 20:54:42 +0000 (16:54 -0400)]
Reland "[AMDGPU] Add gfx1013 target"

This reverts commit 211e584fa2a4c032e4d573e7cdbffd622aad0a8f.

Fixed a use-after-free error that caused the sanitizers to fail.

3 years agoORTRT: Add tests for string_view equality and inequality operators
David Blaikie [Wed, 9 Jun 2021 00:53:24 +0000 (17:53 -0700)]
ORTRT: Add tests for string_view equality and inequality operators

3 years agoAdd a couple of missing includes
David Blaikie [Wed, 9 Jun 2021 00:53:14 +0000 (17:53 -0700)]
Add a couple of missing includes

3 years agoRename compiler-rt/lib/orc/endian.h to endianness.h to avoid conflict with system...
David Blaikie [Wed, 9 Jun 2021 00:52:06 +0000 (17:52 -0700)]
Rename compiler-rt/lib/orc/endian.h to endianness.h to avoid conflict with system headers

3 years agoRevert "Add a static assertions for custom Op<> to not defined data members (NFC)"
Mehdi Amini [Wed, 9 Jun 2021 00:46:02 +0000 (00:46 +0000)]
Revert "Add a static assertions for custom Op<> to not defined data members (NFC)"

This reverts commit c0edcec630eb26e12d66dae2f0e1fbf5258cb6ac.

The windows bot was broken by this change.

3 years agoAdd llvm_unreacheable to silence warning "not all control paths return a value" ...
Mehdi Amini [Wed, 9 Jun 2021 00:42:21 +0000 (00:42 +0000)]
Add llvm_unreacheable to silence warning "not all control paths return a value" (NFC)

3 years ago[OpenMP] Add an information flag for device data transfers
Joseph Huber [Tue, 8 Jun 2021 20:43:59 +0000 (16:43 -0400)]
[OpenMP] Add an information flag for device data transfers

This patch adds an information flag that indicated when data is being copied to
and from the device. This will be helpful for finding redundant or unnecessary
data transfers in applications.

Reviewed By: jdoerfert, grokos

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

3 years ago[JITLink][MachO] Split C-string literal sections on null-terminators.
Lang Hames [Tue, 8 Jun 2021 23:01:35 +0000 (09:01 +1000)]
[JITLink][MachO] Split C-string literal sections on null-terminators.

MachO C-string literal sections should be split on null-terminator boundaries,
rather than the usual symbol boundaries. This patch updates
MachOLinkGraphBuilder to do that.

3 years ago[libc][NFC][Obvious] Compare against size_t values in ArrayRef tests.
Siva Chandra Reddy [Wed, 9 Jun 2021 00:14:05 +0000 (00:14 +0000)]
[libc][NFC][Obvious] Compare against size_t values in ArrayRef tests.

Different platforms treat size_t differently so we should compare sizes
of ArrayRef objects with size_t values (instead of the current unsigned
long values.)

3 years ago[libc] Add a macro to include/exclude subprocess tests.
Siva Chandra Reddy [Tue, 8 Jun 2021 23:30:21 +0000 (23:30 +0000)]
[libc] Add a macro to include/exclude subprocess tests.

This is useful when bringing up LLVM libc on a new OS on which we do not
yet have the subprocess related helper functions.

3 years ago[libc][NFC] Use add_library instead of add_llvm_library for a few libraries.
Siva Chandra Reddy [Tue, 8 Jun 2021 23:04:11 +0000 (23:04 +0000)]
[libc][NFC] Use add_library instead of add_llvm_library for a few libraries.

These libraries do not depend on LLVM libraries anymore so they do not
have to be added using add_llvm_library.

3 years ago[mlir][tosa] Temporarily support 2D and 3D tensor types in matmul
Suraj Sudhir [Tue, 8 Jun 2021 22:58:06 +0000 (15:58 -0700)]
[mlir][tosa] Temporarily support 2D and 3D tensor types in matmul

Temporarily support 2D and 3D while the TOSA Matmul op is updated to support batched operations.

Reviewed By: rsuderman

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

3 years ago[NFC] In the future, all intrinsics defined for compatibility with the XL
Quinn Pham [Tue, 8 Jun 2021 22:55:53 +0000 (17:55 -0500)]
[NFC] In the future, all intrinsics defined for compatibility with the XL
compiler will be placed in this collection.

This patch has no functional changes.

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

3 years agoLTO: Export functions referenced by non-canonical CFI jump tables
Sami Tolvanen [Tue, 8 Jun 2021 21:57:32 +0000 (14:57 -0700)]
LTO: Export functions referenced by non-canonical CFI jump tables

LowerTypeTests pass adds functions with a non-canonical jump table
to cfiFunctionDecls instead of cfiFunctionDefs. As the jump table
is in the regular LTO object, these functions will also need to be
exported. This change fixes the non-canonical jump table case and
adds a test similar to the existing one for canonical jump tables.

Reviewed By: pcc

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

3 years agoRevert "Revert "[LoopNest] Fix Wdeprecated-copy warnings""
Whitney Tsang [Tue, 8 Jun 2021 21:47:56 +0000 (21:47 +0000)]
Revert "Revert "[LoopNest] Fix Wdeprecated-copy warnings""

This reverts commit 07ef5805abe5d4576eb5528eab63e75505bfd0bd.

The broke of the sanitizer-windows bot:
https://lab.llvm.org/buildbot/#/builders/127/builds/12064
is not caused by the original commit.

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

3 years ago[Polly][Isl] Removing nullptr constructor from C++ bindings. NFC.
patacca [Tue, 8 Jun 2021 21:45:34 +0000 (23:45 +0200)]
[Polly][Isl] Removing nullptr constructor from C++ bindings. NFC.

[Polly][Isl] Removing nullptr constructor from C++ bindings. NFC.

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.

Changes made:
 - Removed `std::nullptr_t` constructor from all the classes in the isl C++ bindings.
 - `isl-noexceptions.h` has been generated by this https://github.com/patacca/isl/commit/a7e00bea38f251a4bcf5c2c6ce5fa7ee5f661528

Reviewed By: Meinersbur

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

3 years agoUpdate and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtim...
Kevin Athey [Tue, 8 Jun 2021 19:45:48 +0000 (12:45 -0700)]
Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).

In addition:
  - optionally add global flag to capture compile intent for UAR:
    __asan_detect_use_after_return_always.
    The global is a SANITIZER_WEAK_ATTRIBUTE.

for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

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

3 years ago[SystemZ] Return true from convertSetCCLogicToBitwiseLogic for scalar integer.
Jonas Paulsson [Tue, 1 Jun 2021 16:38:00 +0000 (11:38 -0500)]
[SystemZ] Return true from convertSetCCLogicToBitwiseLogic for scalar integer.

Review: Ulrich Weigand

3 years ago[LLDB][NFC] Remove parameter names from forward declarations from hand written expres...
Shafik Yaghmour [Tue, 8 Jun 2021 21:02:55 +0000 (14:02 -0700)]
[LLDB][NFC] Remove parameter names from forward declarations from hand written expressions used in heap.py

heap.py has a lot of large hand written expressions and each name in the
expression will be looked up by clang during expression parsing. For
function parameters this will be in Sema::ActOnParamDeclarator(...) in order to
catch redeclarations of parameters. The names are not needed and we have seen
some rare cases where since we don't have symbols we end up in
SymbolContext::FindBestGlobalDataSymbol(...) which may conflict with other global
symbols.

There may be a way to make this lookup smarter to avoid these cases but it is
not clear how well tested this path is and how much work it would be to fix it.
So we will go with this fix while we investigate more.

Ref: rdar://78265641

3 years ago[InstCombine] fix nsz (fast-math) propagation from fneg-of-select
Sanjay Patel [Tue, 8 Jun 2021 20:45:29 +0000 (16:45 -0400)]
[InstCombine] fix nsz (fast-math) propagation from fneg-of-select

As discussed in the post-commit comments for:
3cdd05e519dd

It seems to be safe to propagate all flags from the final fneg
except for 'nsz' to the new select:
https://alive2.llvm.org/ce/z/J_APDc

nsz has unique FMF semantics: it is not poison, it is only
"insignificant" in the calculation according to the LangRef.

3 years ago[InstCombine] add FMF tests for fneg-of-select; NFC
Sanjay Patel [Tue, 8 Jun 2021 20:06:10 +0000 (16:06 -0400)]
[InstCombine] add FMF tests for fneg-of-select; NFC

As noted in the post-commit comments for 3cdd05e519d,
we need to be more careful about FMF propagation.

3 years ago[scudo] Add Scudo support for Trusty OS
Daniel Michael [Mon, 7 Jun 2021 16:10:46 +0000 (09:10 -0700)]
[scudo] Add Scudo support for Trusty OS

trusty.cpp and trusty.h define Trusty implementations of map and other
platform-specific functions. In addition to adding Trusty configurations
in allocator_config.h and size_class_map.h, MapSizeIncrement and
PrimaryEnableRandomOffset are added as configurable options in
allocator_config.h.
Background on Trusty: https://source.android.com/security/trusty

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

3 years ago[lldb] Don't print script output twice in HandleCommand
Jonas Devlieghere [Tue, 8 Jun 2021 17:46:43 +0000 (10:46 -0700)]
[lldb] Don't print script output twice in HandleCommand

When executing a script command in HandleCommand(s) we currently print
its output twice
You can see this issue in action when adding a breakpoint command:

(lldb) b main
Breakpoint 1: where = main.out`main + 13 at main.cpp:2:3, address = 0x0000000100003fad
(lldb) break command add 1 -o "script print(\"Hey!\")"
(lldb) r
Process 76041 launched: '/tmp/main.out' (x86_64)
Hey!
(lldb)  script print("Hey!")
Hey!
Process 76041 stopped

The issue is caused by HandleCommands using a temporary
CommandReturnObject and one of the commands (`script` in this case)
setting an immediate output stream. This causes the result to be printed
twice: once directly to the immediate output stream and once when
printing the result of HandleCommands.

This patch fixes the issue by introducing a new option to suppress
immediate output for temporary CommandReturnObjects.

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

3 years ago[DSE] Add another multiblock loop DSE test. NFC
David Green [Tue, 8 Jun 2021 20:54:59 +0000 (21:54 +0100)]
[DSE] Add another multiblock loop DSE test. NFC

As reported in D100464, the stores in these loops should not be removed.

3 years ago[libc++] NFC: Rewrite the documentation for the debug mode
Louis Dionne [Tue, 8 Jun 2021 20:32:53 +0000 (16:32 -0400)]
[libc++] NFC: Rewrite the documentation for the debug mode

3 years agoRevert "[LoopNest] Fix Wdeprecated-copy warnings"
Whitney Tsang [Tue, 8 Jun 2021 20:44:57 +0000 (20:44 +0000)]
Revert "[LoopNest] Fix Wdeprecated-copy warnings"

This reverts commit dee1f0cb348b0a56375d9b563fb4d6918c431ed1.

It appears that this change broke the sanitizer-windows bot:
https://lab.llvm.org/buildbot/#/builders/127/builds/12064

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

3 years ago[CMake][Fuchsia] Disable vcruntime for first stage as well
Petr Hosek [Tue, 8 Jun 2021 20:40:30 +0000 (13:40 -0700)]
[CMake][Fuchsia] Disable vcruntime for first stage as well

Using vcruntime is breaking libc++ headers so don't use it.

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

3 years ago[SystemZ] Return true from isMaskAndCmp0FoldingBeneficial().
Jonas Paulsson [Fri, 28 May 2021 22:08:51 +0000 (00:08 +0200)]
[SystemZ] Return true from isMaskAndCmp0FoldingBeneficial().

Return true if the mask is a constant uint of 2 bytes, in which case TMLL is
available.

Review: Ulrich Weigand