platform/upstream/llvm.git
3 years ago[mlir] Add support for generating Attribute classes for ODS
River Riddle [Thu, 4 Mar 2021 00:37:32 +0000 (16:37 -0800)]
[mlir] Add support for generating Attribute classes for ODS

The support for attributes closely maps that of Types (basically 1-1) given that Attributes are defined in exactly the same way as Types. All of the current ODS TypeDef classes get an Attr equivalent. The generation of the attribute classes themselves share the same generator as types.

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

3 years ago[RISCV] Make use of the required features in BuiltinInfo to store that V extension...
Craig Topper [Thu, 4 Mar 2021 00:21:23 +0000 (16:21 -0800)]
[RISCV] Make use of the required features in BuiltinInfo to store that V extension builtins require 'experimental-v'.

Use that to print the diagnostic in SemaChecking instead of
listing all of the builtins in a switch.

With the required features, IR generation will also be able
to error on this. Checking this here allows us to have a RISCV
focused error message.

Reviewed By: HsiangKai

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

3 years ago[IRSymTab] Set FB_used on llvm.compiler.used symbols
Fangrui Song [Thu, 4 Mar 2021 00:22:30 +0000 (16:22 -0800)]
[IRSymTab] Set FB_used on llvm.compiler.used symbols

IR symbol table does not parse inline asm. A symbol only referenced by inline
asm is not in the IR symbol table, so LTO does not know that the definition (in
another translation unit) is referenced and may internalize it, even if that
definition has `__attribute__((used))` (which lowers to `llvm.compiler.used` on
ELF targets since D97446).

```
// cabac.c
__attribute__((used)) const uint8_t ff_h264_cabac_tables[...] = {...};

// h264_cabac.c
  asm("lea ff_h264_cabac_tables(%rip), %0" : ...);
```

`__attribute__((used))` is the recommended way to tell the compiler there may
be inline asm references, so the usage is perfectly fine. This patch
conservatively sets the `FB_used` bit on `llvm.compiler.used` symbols to work
around the IR symbol table limitation. Note: before D97446, Clang never emitted
symbols in the `llvm.compiler.used` list, so this change does not punish any
Clang emitted global object.

Without the patch, `ff_h264_cabac_tables` may be assigned to a non-external
partition and get internalized. Then we will get a linker error because the
`cabac.c` definition is not exposed.

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

3 years ago[AIX] Update default arch on AIX
Steven Wan [Thu, 4 Mar 2021 00:06:37 +0000 (19:06 -0500)]
[AIX] Update default arch on AIX

On AIX, the default arch level should match the minimum supported arch level of the OS version.

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

3 years ago[mlir][pdl][NFC] Rename InputOp to OperandOp
River Riddle [Wed, 3 Mar 2021 23:34:18 +0000 (15:34 -0800)]
[mlir][pdl][NFC] Rename InputOp to OperandOp

This better matches the actual IR concept that is being modeled, and is consistent with how the rest of PDL is structured.

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

3 years ago[mlir][pdl] Add a new !pdl.range<> type
River Riddle [Wed, 3 Mar 2021 23:33:15 +0000 (15:33 -0800)]
[mlir][pdl] Add a new !pdl.range<> type

This type represents a range of positional values. It will be used in followup revisions to add support for variadic constructs to PDL, such as operand and result ranges.

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

3 years ago[LICM][Coroutine] Don't sink stores from loops with coro.suspend instructions
Xun Li [Wed, 3 Mar 2021 23:21:57 +0000 (15:21 -0800)]
[LICM][Coroutine] Don't sink stores from loops with coro.suspend instructions

See pr46990(https://bugs.llvm.org/show_bug.cgi?id=46990). LICM should not sink store instructions to loop exit blocks which cross coro.suspend intrinsics. This breaks semantic of coro.suspend intrinsic which return to caller directly. Also this leads to use-after-free if the coroutine is freed before control returns to the caller in multithread environment.

This patch disable promotion by check whether loop contains coro.suspend intrinsics.
This is a resubmit of D86190.
Disabling LICM for loops with coroutine suspension is a better option not only for correctness purpose but also for performance purpose.
In most cases LICM sinks memory operations. In the case of coroutine, sinking memory operation out of the loop does not improve performance since coroutien needs to get data from the frame anyway. In fact LICM would hurt coroutine performance since it adds more entries to the frame.

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

3 years ago[test] Fix profiling.ll
Fangrui Song [Wed, 3 Mar 2021 23:18:44 +0000 (15:18 -0800)]
[test] Fix profiling.ll

`__llvm_prf_nm` is compressed if zlib is available. In addition, its size may not be that stable.

3 years agoAdd the use of register r for outlined function when register r is live in and define...
Jin Lin [Wed, 3 Mar 2021 20:06:42 +0000 (12:06 -0800)]
Add the use of register r for outlined function when register r is live in and defined later.

The compiler needs to mark register $x0 as live in for the following case.

    $x1 = ADDXri $sp, 16, 0
    BL @spam, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def dead $x0

Reviewed By: paquette

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

3 years agoFix flang build after D97804
River Riddle [Wed, 3 Mar 2021 23:06:42 +0000 (15:06 -0800)]
Fix flang build after D97804

3 years ago[dfsan] Remove hard-coded shadow width in more tests
George Balatsouras [Wed, 3 Mar 2021 20:30:20 +0000 (12:30 -0800)]
[dfsan] Remove hard-coded shadow width in more tests

As a preparation step for fast8 support, we need to update the tests
to pass in both modes. That requires generalizing the shadow width
and remove any hard coded references that assume it's always 2 bytes.

Reviewed By: stephan.yichao.zhao

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

3 years ago[lld-link] Add safe icf mode to lld-link, which does safe icf for all sections.
Zequan Wu [Sat, 27 Feb 2021 00:38:24 +0000 (16:38 -0800)]
[lld-link] Add safe icf mode to lld-link, which does safe icf for all sections.

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

3 years ago[mlir][IR] Refactor the internal implementation of Value
River Riddle [Wed, 3 Mar 2021 22:23:14 +0000 (14:23 -0800)]
[mlir][IR] Refactor the internal implementation of Value

The current implementation of Value involves a pointer int pair with several different kinds of owners, i.e. BlockArgumentImpl*, Operation *, TrailingOpResult*. This design arose from the desire to save memory overhead for operations that have a very small number of results (generally 0-2). There are, unfortunately, many problematic aspects of the current implementation that make Values difficult to work with or just inefficient.

Operation result types are stored as a separate array on the Operation. This is very inefficient for many reasons: we use TupleType for multiple results, which can lead to huge amounts of memory usage if multi-result operations change types frequently(they do). It also means that simple methods like Value::getType/Value::setType now require complex logic to get to the desired type.

Value only has one pointer bit free, severely limiting the ability to use it in things like PointerUnion/PointerIntPair. Given that we store the kind of a Value along with the "owner" pointer, we only leave one bit free for users of Value. This creates situations where we end up nesting PointerUnions to be able to use Value in one.

As noted above, most of the methods in Value need to branch on at least 3 different cases which is both inefficient, possibly error prone, and verbose. The current storage of results also creates problems for utilities like ValueRange/TypeRange, which want to efficiently store base pointers to ranges (of which Operation* isn't really useful as one).

This revision greatly simplifies the implementation of Value by the introduction of a new ValueImpl class. This class contains all of the state shared between all of the various derived value classes; i.e. the use list, the type, and the kind. This shared implementation class provides several large benefits:

* Most of the methods on value are now branchless, and often one-liners.

* The "kind" of the value is now stored in ValueImpl instead of Value
This frees up all of Value's pointer bits, allowing for users to take full advantage of PointerUnion/PointerIntPair/etc. It also allows for storing more operation results as "inline", 6 now instead of 2, freeing up 1 word per new inline result.

* Operation result types are now stored in the result, instead of a side array
This drops the size of zero-result operations by 1 word. It also removes the memory crushing use of TupleType for operations results (which could lead up to hundreds of megabytes of "dead" TupleTypes in the context). This also allowed restructured ValueRange, making it simpler and one word smaller.

This revision does come with two conceptual downsides:
* Operation::getResultTypes no longer returns an ArrayRef<Type>
This conceptually makes some usages slower, as the iterator increment is slightly more complex.
* OpResult::getOwner is slightly more expensive, as it now requires a little bit of arithmetic

From profiling, neither of the conceptual downsides have resulted in any perceivable hit to performance. Given the advantages of the new design, most compiles are slightly faster.

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

3 years ago[lld-macho] Fix test breakage introduced by D97799
Jez Ng [Wed, 3 Mar 2021 22:31:03 +0000 (17:31 -0500)]
[lld-macho] Fix test breakage introduced by D97799

3 years ago[Analysis] simplify propagation of FMF in recurrences; NFC
Sanjay Patel [Wed, 3 Mar 2021 21:53:49 +0000 (16:53 -0500)]
[Analysis] simplify propagation of FMF in recurrences; NFC

This is a mess, but this is hopefully no-functional-change.
The 'Prev' descriptor is only used for min/max recurrences
or when starting a match from a phi, so it should not be a
factor when propagating FMF for fmul/fadd.

The API is confusing (and should be reduced in subsequent steps)
because the "UnsafeAlgebraInst" appears to actually be a placeholder
for a recurrence that does NOT have FMF, but we still want to
treat it as reassociative.

3 years ago[lli] Add JITLink link component after 99a6d003edbe
Stefan Gränitz [Wed, 3 Mar 2021 22:14:21 +0000 (23:14 +0100)]
[lli] Add JITLink link component after 99a6d003edbe

3 years agoFix use of deprecated API
David Blaikie [Wed, 3 Mar 2021 22:07:28 +0000 (14:07 -0800)]
Fix use of deprecated API

3 years ago[libc++] Temporary hack: disable Apple back-deployment testing
Louis Dionne [Wed, 3 Mar 2021 22:01:15 +0000 (17:01 -0500)]
[libc++] Temporary hack: disable Apple back-deployment testing

Apple back-deployment testing is currently failing because Green Dragon
is down. To avoid stalling the whole CI pipeline because of that, I am
temporarily disabling those jobs until Green Dragon is back, or even
better we have found a different way to store those small artifacts.

3 years ago[mlir] Remove incorrect folding for SubTensorInsertOp
MaheshRavishankar [Wed, 3 Mar 2021 21:56:09 +0000 (13:56 -0800)]
[mlir] Remove incorrect folding for SubTensorInsertOp

The SubTensorInsertOp has a requirement that dest type and result
type match. Just folding the tensor.cast operation violates this and
creates verification errors during canonicalization. Also fix other
canonicalization methods that werent inserting casts properly.

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

3 years ago[AArch64] Add implicit uses for operands when expanding BLR_RVMARKER.
Florian Hahn [Wed, 3 Mar 2021 19:44:43 +0000 (19:44 +0000)]
[AArch64] Add implicit uses for operands when expanding BLR_RVMARKER.

Make sure we preserve info about passed arguments as implicit uses, to
make sure later passes still have access to this information.

This fixes a mis-compile where the machine-combiner would pick an
incorrect free register.

3 years agoRevert "hack to unbreak check-llvm on win after D97335" in attempt for actual fix
Stefan Gränitz [Wed, 3 Mar 2021 21:29:43 +0000 (22:29 +0100)]
Revert "hack to unbreak check-llvm on win after D97335" in attempt for actual fix

This reverts commit 900f076113302e26e1939541b546b0075e3e9721 and attempts an actual fix: All failing tests for llvm-jitlink use the `-noexec` flag. The inputs they operate on are not meant for execution on the host system. Looking e.g. at the MachO_test_harness_harnesss.s test, llvm-mc generates input machine code with "x86_64-apple-macosx10.9".

My previous attempt in bbdb4c8c9bcef0e8db751630accc04ad874f54e7 disabled the debug support plugin for Windows targets, but what we would actually want is to disable it on Windows HOSTS.

With the new patch here, I don't do exactly that, but instead follow the approach for the EH frame plugin and include the `-noexec` flag in the condition. It should have the desired effect when it comes to the test suite. It appears a little workaround'ish, but should work reliably for now. I will discuss the issue with Lang and see if we can do better. Thanks @thakis again for the temporary fix.

3 years ago[WebAssembly] Add missing default cases in switch statements
Soumi Manna [Wed, 3 Mar 2021 21:15:23 +0000 (13:15 -0800)]
[WebAssembly] Add missing default cases in switch statements

unsigned variable 'IntNo' has been declared but not been defined inside function
EmitWebAssemblyBuiltinExpr().

static code analysis tool complains about uninitialized variable "IntNo" since
this enters to default branch without setting any intrinsics and calls Function
*Callee = CGM.getIntrinsic(IntNo).

This patch fixes the problem by adding default cases in switch statements.

3 years ago[lld-macho] Require -arch and -platform_version to always be specified
Jez Ng [Wed, 3 Mar 2021 20:52:10 +0000 (15:52 -0500)]
[lld-macho] Require -arch and -platform_version to always be specified

We previously defaulted to x86_64 and an unknown platform, which was fine when
we only supported one arch and did no platform checks, but that will no longer
be true going ahead. Therefore, we should require those flags to be specified
whenever the linker is invoked.

Note that LLD-ELF and ld64 both infer the arch from their input object files,
but the usefulness of that is questionable since clang will always specify these
flags, and most of the time `lld` will be invoked via clang.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho][nfc] Parse more options using getLastArg{Value}
Jez Ng [Wed, 3 Mar 2021 20:52:06 +0000 (15:52 -0500)]
[lld-macho][nfc] Parse more options using getLastArg{Value}

The option-iterating loop should be reserved for options whose command-line
order is important. I think LLD-ELF follows a similar design.

Reviewed By: #lld-macho, smeenai

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

3 years ago[LoopUnrollRuntime] Add option to assume the non latch exit block to be
Whitney Tsang [Wed, 3 Mar 2021 20:41:41 +0000 (20:41 +0000)]
[LoopUnrollRuntime] Add option to assume the non latch exit block to be
predictable.

Reviewed By: Meinersbur, bmahjour

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

3 years ago[Cost]Add tests for boolean and/or reductions, NFC.
Alexey Bataev [Tue, 2 Mar 2021 19:30:52 +0000 (11:30 -0800)]
[Cost]Add tests for boolean and/or reductions, NFC.

Tests with the default costs for boolean and/or reductions.

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

3 years agoAddress review comment from D97219 (follow up to 8051156)
Philip Reames [Wed, 3 Mar 2021 20:20:27 +0000 (12:20 -0800)]
Address review comment from D97219 (follow up to 8051156)

Probably should have done this before landing, but I forgot.

Basic idea is to avoid using the SCEV predicate when it doesn't buy us anything.  Also happens to set us up for handling non-add recurrences in the future if desired.

3 years agoSink routine for replacing a operand bundle to CallBase [NFC]
Philip Reames [Wed, 3 Mar 2021 20:07:00 +0000 (12:07 -0800)]
Sink routine for replacing a operand bundle to CallBase [NFC]

We had equivalent code for both CallInst and InvokeInst, but never cared about the result type.

3 years ago[LSR] Unify scheduling of existing and inserted addrecs
Philip Reames [Wed, 3 Mar 2021 19:49:46 +0000 (11:49 -0800)]
[LSR] Unify scheduling of existing and inserted addrecs

LSR goes to some lengths to schedule IV increments such that %iv and %iv.next never need to overlap. This is fairly fundamental to LSRs cost model. LSR assumes that an addrec can be represented with a single register. If %iv and %iv.next have to overlap, then that assumption does not hold.

The bug - which this patch is fixing - is that LSR only does this scheduling for IVs which it inserts, but it's cost model assumes the same for existing IVs that it reuses. It will rewrite existing IV users such that the no-overlap property holds, but will not actually reschedule said IV increment.

As you can see from the relatively lack of test updates, this doesn't actually impact codegen much. The main reason for doing it is to make a follow up patch series which improves post-increment use and scheduling easier to follow.

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

3 years ago[SystemZ] Reimplement the i8/i16 compare-and-swap logic.
Jonas Paulsson [Sat, 27 Feb 2021 00:55:44 +0000 (18:55 -0600)]
[SystemZ] Reimplement the i8/i16 compare-and-swap logic.

Even though the implementation in emitAtomicCmpSwapW() was correct, it made
Valgrind report an error. Instead of using a RISBG on CmpVal, an LL[CH]R can
be made on the OldVal, and the problem is avoided.

Review: Ulrich Weigand

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

3 years ago[flang] Prohibit MODULE procedures in the global scope
Peter Steinfeld [Wed, 3 Mar 2021 18:52:40 +0000 (10:52 -0800)]
[flang] Prohibit MODULE procedures in the global scope

We were allowing procedures with the MODULE prefix to be declared at the global
scope.  This is prohibited by C1547 and was causing an internal check of the
compiler to fail.

I fixed this by adding a check.  I also added a test that would trigger a crash
without this change.

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

3 years ago[mlir][linalg] Add depthwise_conv_2d_input_nhwc_filter_hwcf to Linalg TC ops.
Hanhan Wang [Wed, 3 Mar 2021 19:46:50 +0000 (11:46 -0800)]
[mlir][linalg] Add depthwise_conv_2d_input_nhwc_filter_hwcf to Linalg TC ops.

Different from the definition in Tensorflow and TOSA, the output is [N,H,W,C,M]. This can make transforms easier in LinAlg because the indexing maps are plain. E.g., to determine if the fill op has dependency between the depthwise conv op, the current pipeline only recognizes the dep if they are all projected affine map.

Reviewed By: asaadaldien

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

3 years ago[AArch64] Move CALL_RVMARKER definition after CALL.
Florian Hahn [Wed, 3 Mar 2021 18:58:05 +0000 (18:58 +0000)]
[AArch64] Move CALL_RVMARKER definition after CALL.

This is a NFC with respect to the generated code. But it fixes a crash
when using -debug, because of the position in the enum CALL_RVMARKER
nodes were treated as memops. That caused a crash when printing
CALL_RVMARKER nodes.

3 years ago[InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF
Fangrui Song [Wed, 3 Mar 2021 19:32:24 +0000 (11:32 -0800)]
[InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF

`__llvm_prf_vnodes` and `__llvm_prf_names` are used by runtime but not
referenced via relocation in the translation unit.

With `-z start-stop-gc` (LLD 13 (D96914); GNU ld 2.37 https://sourceware.org/bugzilla/show_bug.cgi?id=27451),
the linker does not let `__start_/__stop_` references retain their sections.

Place `__llvm_prf_vnodes` and `__llvm_prf_names` in `llvm.used` to make
them retained by the linker.

This patch changes most existing `UsedVars` cases to `CompilerUsedVars`
to reflect the ideal state - if the binary format properly supports
section based GC (dead stripping), `llvm.compiler.used` should be sufficient.

`__llvm_prf_vnodes` and `__llvm_prf_names` are switched to `UsedVars`
since we want them to be unconditionally retained by both compiler and linker.

Behaviors on COFF/Mach-O are not affected.

Reviewed By: davidxl

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

3 years ago[test] Improve PGO tests
Fangrui Song [Wed, 3 Mar 2021 19:29:19 +0000 (11:29 -0800)]
[test] Improve PGO tests

3 years ago[Coverage] Emit gap region between statements if first statements contains terminate...
Zequan Wu [Wed, 3 Mar 2021 04:35:19 +0000 (20:35 -0800)]
[Coverage] Emit gap region between statements if first statements contains terminate statements.

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

3 years ago[clangd] ObjC fixes for semantic highlighting and xref highlights
Sam McCall [Sat, 27 Feb 2021 21:08:07 +0000 (22:08 +0100)]
[clangd] ObjC fixes for semantic highlighting and xref highlights

- highlight references to protocols in class/protocol/extension decls
- support multi-token selector highlights in semantic + xref highlights
  (method calls and declarations only)
- In `@interface I(C)`, I now references the interface and C the category
- highlight uses of interfaces as types
- added semantic highlightings of protocol names (as "interface") and
  category names (as "namespace").
  These are both standard kinds, maybe "extension" will be standardized...
- highlight `auto` as "class" when it resolves to an ObjC pointer
- don't highlight `self` as a variable even though the AST models it as one

Not fixed: uses of protocols in type names (needs some refactoring of
unrelated code first)

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

3 years ago[dfsan] Remove hardcoded shadow width in abilist_aggregate.ll
George Balatsouras [Wed, 3 Mar 2021 01:52:58 +0000 (17:52 -0800)]
[dfsan] Remove hardcoded shadow width in abilist_aggregate.ll

As a preparation step for fast8 support, we need to update the tests
to pass in both modes. That requires generalizing the shadow width
and remove any hard coded references that assume it's always 2 bytes.

Reviewed By: stephan.yichao.zhao

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

3 years ago[CMake] Rename RUNTIMES_BUILD to LLVM_RUNTIMES_BUILD
Petr Hosek [Wed, 3 Mar 2021 08:39:50 +0000 (00:39 -0800)]
[CMake] Rename RUNTIMES_BUILD to LLVM_RUNTIMES_BUILD

This avoid potential conflict with other internal variables.

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

3 years ago[libc++] NFC: Normalize links to bug reports
Louis Dionne [Wed, 3 Mar 2021 18:45:06 +0000 (13:45 -0500)]
[libc++] NFC: Normalize links to bug reports

3 years ago[AMDGPU] Exclude always_inline from max bb threshold
Stanislav Mekhanoshin [Tue, 2 Mar 2021 19:06:30 +0000 (11:06 -0800)]
[AMDGPU] Exclude always_inline from max bb threshold

Honor always_inline attribute when processing -amdgpu-inline-max-bb.
It was lost during the ports of the heuristic. There is no reason
to honor inline hint, but not always inline.

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

3 years agoAdd basic JIT Python Bindings
Mehdi Amini [Tue, 23 Feb 2021 01:56:01 +0000 (01:56 +0000)]
Add basic JIT Python Bindings

This offers the ability to create a JIT and invoke a function by passing
ctypes pointers to the argument and the result.

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

3 years agoAdd C bindings for mlir::ExecutionEngine
Mehdi Amini [Sat, 13 Feb 2021 19:23:06 +0000 (19:23 +0000)]
Add C bindings for mlir::ExecutionEngine

This adds minimalistic bindings for the execution engine, allowing to
invoke the JIT from the C API. This is still quite early and
experimental and shouldn't be considered stable in any way.

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

3 years ago[CSSPGO][llvm-profgen] Continue disassembling after illegal instruction is seen.
Hongtao Yu [Tue, 2 Mar 2021 06:34:30 +0000 (22:34 -0800)]
[CSSPGO][llvm-profgen] Continue disassembling after illegal instruction is seen.

Previously we errored out when disassembling illegal instructions and there would be no profile generated. In fact illegal instructions are not uncommon and we'd better skip them and print "unknown" instead of erroring out. This matches the behavior of llvm-objdump (see disassembleObject in llvm-objdump.cpp).

Reviewed By: wlei, wenlei

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

3 years ago[llvm-cov] Cache file status information
Choongwoo Han [Wed, 3 Mar 2021 17:53:09 +0000 (09:53 -0800)]
[llvm-cov] Cache file status information

Currently, getSourceFile accesses file system to check if two paths are
the same file with a thread lock, which is a huge performance bottleneck
in some cases. Currently, it's accessing file system size(files) * size(files) times.

Thus, cache file status information, which reduces file system access to size(files) times.

When I tested it with two binaries and 16 cpu cores,
it saved over 70% of time.

Binary 1: 56 secs -> 3 secs
Binary 2: 17 hours -> 4 hours

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

3 years ago[XRay][x86_64] Fix CFI directives in assembly trampolines
Elia Geretto [Wed, 3 Mar 2021 18:01:27 +0000 (10:01 -0800)]
[XRay][x86_64] Fix CFI directives in assembly trampolines

This patch modifies the x86_64 XRay trampolines to fix the CFI information
generated by the assembler. One of the main issues in correcting the CFI
directives is the `ALIGNED_CALL_RAX` macro, which makes the CFA dependent on
the alignment of the stack. However, this macro is not really necessary because
some additional assumptions can be made on the alignment of the stack when the
trampolines are called. The code has been written as if the stack is guaranteed
to be 8-bytes aligned; however, it is instead guaranteed to be misaligned by 8
bytes with respect to a 16-bytes alignment. For this reason, always moving the
stack pointer by 8 bytes is sufficient to restore the appropriate alignment.

Trampolines that are called from within a function as a result of the builtins
`__xray_typedevent` and `__xray_customevent` are necessarely called with the
stack properly aligned so, in this case too, `ALIGNED_CALL_RAX` can be
eliminated.

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

Reviewed By: MaskRay

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

3 years ago[libc++] Use generator expression to simplify the CMake code
Louis Dionne [Tue, 23 Feb 2021 23:26:15 +0000 (18:26 -0500)]
[libc++] Use generator expression to simplify the CMake code

A comment was left for when we would require CMake >= 3, which we do now.
I expect this should be a NFC.

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

3 years ago[libc++/abi] Replace uses of _NOEXCEPT in src/ by noexcept
Louis Dionne [Mon, 1 Mar 2021 17:09:45 +0000 (12:09 -0500)]
[libc++/abi] Replace uses of _NOEXCEPT in src/ by noexcept

We always build the libraries in a Standard mode that supports noexcept,
so there's no need to use the _NOEXCEPT macro.

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

3 years ago[mlir][linalg] Delete unused vars if there are shaped-only operands.
Hanhan Wang [Wed, 3 Mar 2021 17:35:54 +0000 (09:35 -0800)]
[mlir][linalg] Delete unused vars if there are shaped-only operands.

Reviewed By: stella.stamenova

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

3 years ago[mlir] Add LinalgInterface method to clone with a given BlockAndValueMapping.
MaheshRavishankar [Wed, 3 Mar 2021 17:24:29 +0000 (09:24 -0800)]
[mlir] Add LinalgInterface method to clone with a given BlockAndValueMapping.

Since Linalg operations have regions by default which are not isolated
from above, add an another method to the interface that will take a
BlockAndValueMapping to remap the values within the region as well.

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

3 years agoFix a build warning from ea7d208
Philip Reames [Wed, 3 Mar 2021 17:16:56 +0000 (09:16 -0800)]
Fix a build warning from ea7d208

3 years ago[basicaa] Rewrite isGEPBaseAtNegativeOffset in terms of index difference [mostly...
Philip Reames [Wed, 3 Mar 2021 16:58:53 +0000 (08:58 -0800)]
[basicaa] Rewrite isGEPBaseAtNegativeOffset in terms of index difference [mostly NFC]

This is almost purely NFC, it just fits more obviously in the flow of the code now that we've standardized on the index different approach.  The non-NFC bit is that because of canceling the VariableOffsets in the subtract, we can now handle the case where both sides involve a common variable offset.  This isn't an "interesting" improvement; it just happens to fall out of the natural code structure.

One subtle point - the placement of this above the BaseAlias check is important in the original code as this can return NoAlias even when we can't find a relation between the bases otherwise.

Also added some enhancement TODOs noticed while understanding the existing code.

Note: This is slightly different than the LGTMed version.  I fixed the "inbounds" issue Nikita noticed with the original code in e6e5ef4 and rebased this to include the same fix.

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

3 years ago[VirtRegRewriter] Insert missing killed flags when tracking subregister liveness
Baptiste Saleil [Wed, 3 Mar 2021 16:57:42 +0000 (11:57 -0500)]
[VirtRegRewriter] Insert missing killed flags when tracking subregister liveness

VirtRegRewriter may sometimes fail to correctly apply the kill flag where necessary,
which causes unecessary code gen on PowerPC. This patch fixes the way masks for
defined lanes are computed and the way mask for used lanes is computed.

Contact albion.fung@ibm.com instead of author for problems related to this commit.

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

3 years ago[basicaa] Fix a latent bug in isGEPBaseAtNegativeOffset
Philip Reames [Wed, 3 Mar 2021 16:43:32 +0000 (08:43 -0800)]
[basicaa] Fix a latent bug in isGEPBaseAtNegativeOffset

This was pointed out in review of D97520 by Nikita, but existed in the original code as well.

The basic issue is that a decomposed GEP expression describes (potentially) more than one getelementptr.  The "inbounds" derived UB which justifies this aliasing rule requires that the entire offset be composed of "inbounds" geps.  Otherwise, as can be seen in the recently added and changes in this patch test, we can end up with a large commulative offset with only a small sub-offset actually being "inbounds".  If that small sub-offset lies within the object, the result was unsound.

We could potentially be fancier here, but for the moment, simply be conservative when any of the GEPs parsed aren't inbounds.

3 years ago[basicaa] Minor indentation fix
Philip Reames [Wed, 3 Mar 2021 16:31:52 +0000 (08:31 -0800)]
[basicaa] Minor indentation fix

3 years ago[pstl] Fix broken policy_traits and clean up unused code
Louis Dionne [Tue, 2 Mar 2021 21:53:07 +0000 (16:53 -0500)]
[pstl] Fix broken policy_traits and clean up unused code

https://llvm.org/PR47602
https://llvm.org/PR47601

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

3 years ago[tests] Add tests for cases brought up during review of D97520
Philip Reames [Wed, 3 Mar 2021 16:30:36 +0000 (08:30 -0800)]
[tests] Add tests for cases brought up during review of D97520

3 years ago[coro async] Allow a coro.suspend.async to specify which argument is the context...
Arnold Schwaighofer [Tue, 23 Feb 2021 18:01:35 +0000 (10:01 -0800)]
[coro async] Allow a coro.suspend.async to specify which argument is the context argument

Before we used the same argument as the entry point. The resume partial
function might want to use a different ABI for its context argument

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

3 years ago[mlir][Shape] Lower cstr_eq to shape_eq + assert
Benjamin Kramer [Mon, 1 Mar 2021 19:41:12 +0000 (20:41 +0100)]
[mlir][Shape] Lower cstr_eq to shape_eq + assert

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

3 years ago[clang-tidy] Deprecate readability-deleted-default check
Nathan James [Wed, 3 Mar 2021 16:01:12 +0000 (16:01 +0000)]
[clang-tidy] Deprecate readability-deleted-default check

... For removal in next release cycle.
The clang warning that does the same thing is enabled by default and typically emits better diagnostics making this check surplus to requirements.

Reviewed By: aaron.ballman

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

3 years ago[clang-query] Fix help text after D91918
Nathan James [Wed, 3 Mar 2021 15:57:49 +0000 (15:57 +0000)]
[clang-query] Fix help text after D91918

After rG5e1801813d93210acae84ff3c68a01512c2df9bc The help command still lists IgnoreImplicitCastsAndParentheses as a valid option.

Reviewed By: aaron.ballman, rsmith

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

3 years ago[X86] Fold scalar_to_vector(x) -> extract_subvector(broadcast(x),0) iff broadcast...
Simon Pilgrim [Wed, 3 Mar 2021 15:30:32 +0000 (15:30 +0000)]
[X86] Fold scalar_to_vector(x) -> extract_subvector(broadcast(x),0) iff broadcast(x) exists

Add handling for reusing an existing broadcast(x) to a wider vector.

3 years ago[AIX][clang][driver] Restrict /usr/lib to internal library search paths
David Tenty [Thu, 25 Feb 2021 04:41:53 +0000 (23:41 -0500)]
[AIX][clang][driver] Restrict /usr/lib to internal library search paths

Adding it to the general filepaths results in it being added to the
linker arguments. The AIX linker always looks in this path anyway
and adds it as a default library path component. Adding this duplicate
explicitly results in duplicate entries in path in the loader section
of executables and messes up tools like CMake that parse the default
library flags.

Reviewed By: ZarkoCA

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

3 years ago[test] Fix apparent typo in clang/test/Driver/std.c
Daniel McIntosh [Wed, 3 Mar 2021 15:29:37 +0000 (10:29 -0500)]
[test] Fix apparent typo in clang/test/Driver/std.c

Currently the test on line 3 is identical to the test on line 1.
Looking at the rest of the file (particularily the use of FOVERRIDE
as the check-prefix), I think it's pretty clear that this line
was supposed to use `-ftrigraphs` instead of `-trigraphs`.

Reviewed By: thakis

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

3 years ago[mlir][Shape] Make shape_eq nary
Benjamin Kramer [Mon, 1 Mar 2021 19:34:17 +0000 (20:34 +0100)]
[mlir][Shape] Make shape_eq nary

This gets rid of a dubious shape_eq %a, %a fold, that folds shape_eq
even if %a is not an Attribute.

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

3 years agoRevert "[InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used...
Nico Weber [Wed, 3 Mar 2021 15:17:31 +0000 (10:17 -0500)]
Revert "[InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF"

This reverts commit 04c3040f417683e7c31b3ee3381a3263106f48c5.
Breaks instrprof-value-merge.c in bootstrap builds.

3 years ago[mlir][Shape] Make cstr_eq more like cstr_broadcastable
Benjamin Kramer [Mon, 1 Mar 2021 19:14:06 +0000 (20:14 +0100)]
[mlir][Shape] Make cstr_eq more like cstr_broadcastable

This includes allowing extents and not just shapes.

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

3 years ago[clang][patch] To solve PR26413, x86 interrupt routines may only call routines with...
Melanie Blower [Tue, 2 Mar 2021 12:58:42 +0000 (07:58 -0500)]
[clang][patch] To solve PR26413, x86 interrupt routines may only call routines with no_saved_reg

Reviewed By: Aaron Ballman

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

3 years agoImplement P2173 for attributes on lambdas
Aaron Ballman [Wed, 3 Mar 2021 15:02:51 +0000 (10:02 -0500)]
Implement P2173 for attributes on lambdas

https://wg21.link/P2173 is making its way through WG21 currently and
has not been formally adopted yet. This feature provides very useful
functionality in that you can specify attributes on the various
function *declarations* generated by a lambda expression, where the
current C++ grammar only allows attributes which apply to the various
function *types* so generated.

This patch implements P2173 on the assumption that it will be adopted
by WG21 with this syntax for C++23.

3 years ago[OpenCL] Prevent adding extension pragma by default.
Anastasia Stulova [Wed, 3 Mar 2021 12:05:38 +0000 (12:05 +0000)]
[OpenCL] Prevent adding extension pragma by default.

This commit refactors extension support to allow
specifying whether pragma is needed or not explicitly.

For backward compatibility pragmas are set to required
for all extensions that were added prior to this but
not for OpenCL 3.0 features.

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

3 years agoRevert "[ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly...
Hans Wennborg [Wed, 3 Mar 2021 14:50:08 +0000 (15:50 +0100)]
Revert "[ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR"

This caused miscompiles of Chromium tests for iOS due clobbering of live
registers. See discussion on the code review for details.

> Background:
>
> This fixes a longstanding problem where llvm breaks ARC's autorelease
> optimization (see the link below) by separating calls from the marker
> instructions or retainRV/claimRV calls. The backend changes are in
> https://reviews.llvm.org/D92569.
>
> https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue
>
> What this patch does to fix the problem:
>
> - The front-end adds operand bundle "clang.arc.attachedcall" to calls,
>   which indicates the call is implicitly followed by a marker
>   instruction and an implicit retainRV/claimRV call that consumes the
>   call result. In addition, it emits a call to
>   @llvm.objc.clang.arc.noop.use, which consumes the call result, to
>   prevent the middle-end passes from changing the return type of the
>   called function. This is currently done only when the target is arm64
>   and the optimization level is higher than -O0.
>
> - ARC optimizer temporarily emits retainRV/claimRV calls after the calls
>   with the operand bundle in the IR and removes the inserted calls after
>   processing the function.
>
> - ARC contract pass emits retainRV/claimRV calls after the call with the
>   operand bundle. It doesn't remove the operand bundle on the call since
>   the backend needs it to emit the marker instruction. The retainRV and
>   claimRV calls are emitted late in the pipeline to prevent optimization
>   passes from transforming the IR in a way that makes it harder for the
>   ARC middle-end passes to figure out the def-use relationship between
>   the call and the retainRV/claimRV calls (which is the cause of
>   PR31925).
>
> - The function inliner removes an autoreleaseRV call in the callee if
>   nothing in the callee prevents it from being paired up with the
>   retainRV/claimRV call in the caller. It then inserts a release call if
>   claimRV is attached to the call since autoreleaseRV+claimRV is
>   equivalent to a release. If it cannot find an autoreleaseRV call, it
>   tries to transfer the operand bundle to a function call in the callee.
>   This is important since the ARC optimizer can remove the autoreleaseRV
>   returning the callee result, which makes it impossible to pair it up
>   with the retainRV/claimRV call in the caller. If that fails, it simply
>   emits a retain call in the IR if retainRV is attached to the call and
>   does nothing if claimRV is attached to it.
>
> - SCCP refrains from replacing the return value of a call with a
>   constant value if the call has the operand bundle. This ensures the
>   call always has at least one user (the call to
>   @llvm.objc.clang.arc.noop.use).
>
> - This patch also fixes a bug in replaceUsesOfNonProtoConstant where
>   multiple operand bundles of the same kind were being added to a call.
>
> Future work:
>
> - Use the operand bundle on x86-64.
>
> - Fix the auto upgrader to convert call+retainRV/claimRV pairs into
>   calls with the operand bundles.
>
> rdar://71443534
>
> Differential Revision: https://reviews.llvm.org/D92808

This reverts commit ed4718eccb12bd42214ca4fb17d196d49561c0c7.

3 years agorevert llvm/include/llvm/Analysis/ObjCARCUtil.h part of 1cc558bd4fa1acd1462226ef4796c...
Hans Wennborg [Wed, 3 Mar 2021 14:50:02 +0000 (15:50 +0100)]
revert llvm/include/llvm/Analysis/ObjCARCUtil.h part of 1cc558bd4fa1acd1462226ef4796c712f80ea8e8

3 years ago[clangd] Make WorkspaceSymbols request work with empty queries
Kadir Cetinkaya [Tue, 2 Mar 2021 15:43:21 +0000 (16:43 +0100)]
[clangd] Make WorkspaceSymbols request work with empty queries

Clangd uses codecompletion limit as the limit for workspacesymbols, so
in theory this should only be an order of magnitude slower than a
codecompletion request with empty identifier (as code completion limits
the available symbols).

This is also what LSP suggests "Clients may send an empty string here to request all symbols.".
Clangd doesn't really fulfill the "all" part of that statement, but we
never do unless user set the index query limit to zero explicitly.

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

3 years ago[AVR] Fix def state of operands
Ayke van Laethem [Sun, 21 Feb 2021 19:23:46 +0000 (20:23 +0100)]
[AVR] Fix def state of operands

Some instructions (especially mov+pop instructions) were setting the
wrong operands. For example, the pop instruction had the register set as
a source operand while it is a destination operand (the value is loaded
into the register).

I have found these issues using the machine verifier and using manual
code inspection.

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

3 years ago[AVR] Fix expansion of NEGW
Ayke van Laethem [Sun, 21 Feb 2021 00:23:02 +0000 (01:23 +0100)]
[AVR] Fix expansion of NEGW

The previous expansion used SBCI, which is incorrect because the NEGW
pseudo instruction accepts a DREGS operand (2xGPR8) and SBCI only allows
LD8 registers. One solution could be to correct the NEGW pseudo
instruction, but another solution is to use a different instruction
(sbc) that does accept a GPR8 register and therefore allows more freedom
to the register allocator.

The output now matches avr-gcc for the following code:

    int foo(int n) {
        return -n;
    }

I've found this issue using the machine instruction verifier: it was
complaining about the wrong register class in NEGWRd.mir.

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

3 years ago[AVR] Add register aliases XL, YH, etc
Ayke van Laethem [Thu, 11 Feb 2021 13:07:53 +0000 (14:07 +0100)]
[AVR] Add register aliases XL, YH, etc

These aliases are sometimes used in assembly code and make the code more
readable. They are supported by avr-gcc too.

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

3 years agoGlobalISel: Add default implementation of assignValueToReg
Matt Arsenault [Tue, 2 Mar 2021 22:40:50 +0000 (17:40 -0500)]
GlobalISel: Add default implementation of assignValueToReg

Refactor insertion of the asserting ops. This enables using them for
AMDGPU.

This code should essentially be the same for every target. Mips, X86
and ARM all have different code there now, but this seems to be an
accident. The assignment functions are called with different types
than they would be in the DAG, so this is all likely an assortment of
hacks to get around that.

3 years agoImprove static_assert/_Static_assert diagnostics
Aaron Ballman [Wed, 3 Mar 2021 13:44:04 +0000 (08:44 -0500)]
Improve static_assert/_Static_assert diagnostics

Our diagnostics relating to static assertions were a bit confused. For
instance, when in MS compatibility mode in C (where we accept
static_assert even without including <assert.h>), we would fail
to warn the user that they were using the wrong spelling (even in
pedantic mode), we were missing a compatibility warning about using
_Static_assert in earlier standards modes, diagnostics for the optional
message were not reflected in C as they were in C++, etc.

3 years ago[AMDGPU] Introduce Strict WQM mode
Piotr Sobczak [Wed, 3 Mar 2021 09:18:28 +0000 (10:18 +0100)]
[AMDGPU] Introduce Strict WQM mode

* Add amdgcn_strict_wqm intrinsic.
* Add a corresponding STRICT_WQM machine instruction.
* The semantic is similar to amdgcn_strict_wwm with a notable difference that not all threads will be forcibly enabled during the computations of the intrinsic's argument, but only all threads in quads that have at least one thread active.
* The difference between amdgc_wqm and amdgcn_strict_wqm, is that in the strict mode an inactive lane will always be enabled irrespective of control flow decisions.

Reviewed By: critson

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

3 years ago[mlir][ODS] Use StringLiteral instead of StringRef when applicable
Vladislav Vinogradov [Thu, 4 Feb 2021 17:12:15 +0000 (17:12 +0000)]
[mlir][ODS] Use StringLiteral instead of StringRef when applicable

Use `StringLiteral` for function return type if it is known to return
constant string literals only.

This will make it visible to API users, that such values can be safely
stored, since they refers to constant data, which will never be deallocated.

`StringRef` is general is not safe to store for a long term,
since it might refer to temporal data allocated in heap.

Add `inline` and `constexpr` methods support to `OpMethod`.

Reviewed By: mehdi_amini

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

3 years ago[mlir][NFC] Use `BaseMemRefType::isValidElementType` in Parser
Vladislav Vinogradov [Sat, 27 Feb 2021 11:08:43 +0000 (14:08 +0300)]
[mlir][NFC] Use `BaseMemRefType::isValidElementType` in Parser

Instead of hard-coded check.

Reviewed By: ftynse, rriddle

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

3 years ago[mlir] Silence -Wglobal-constructors error in CudaRuntimeWrapper.cpp
Christian Sigg [Wed, 3 Mar 2021 12:46:03 +0000 (13:46 +0100)]
[mlir] Silence -Wglobal-constructors error in CudaRuntimeWrapper.cpp

Until I have a better solution with dynamic initialization, to get
the nvidia build bot green again.

3 years ago[lldb][NFC] Delete unused AddressResolverName
Raphael Isemann [Wed, 3 Mar 2021 12:29:51 +0000 (13:29 +0100)]
[lldb][NFC] Delete unused AddressResolverName

That's all just dead code that hasn't been changed in years.

Reviewed By: JDevlieghere

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

3 years ago[mlir] Move cuda tests
Christian Sigg [Wed, 3 Mar 2021 10:24:38 +0000 (11:24 +0100)]
[mlir] Move cuda tests

Move test inputs to test/Integration directory.
Move runtime wrappers to ExecutionEngine.

Reviewed By: mehdi_amini

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

3 years ago[ASTMatchers] Make Param functors variadic
Stephen Kelly [Wed, 13 Jan 2021 03:07:03 +0000 (03:07 +0000)]
[ASTMatchers] Make Param functors variadic

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

3 years ago[clangd] Fix uninit member
Sam McCall [Wed, 3 Mar 2021 10:45:16 +0000 (11:45 +0100)]
[clangd] Fix uninit member

3 years ago[AArch64] Add missing intrinsics for vcls
JinGu Kang [Tue, 2 Mar 2021 09:54:44 +0000 (09:54 +0000)]
[AArch64] Add missing intrinsics for vcls

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

3 years ago[lld][MachO] Silence "enumeral and non-enumeral type" warning from gcc
Mikael Holmen [Wed, 3 Mar 2021 09:17:42 +0000 (10:17 +0100)]
[lld][MachO] Silence "enumeral and non-enumeral type" warning from gcc

gcc complained with

[1110/1140] Building CXX object tools/lld/MachO/CMakeFiles/lldMachO2.dir/SyntheticSections.cpp.o
../../lld/MachO/SyntheticSections.cpp: In function 'int16_t ordinalForDylibSymbol(const lld::macho::DylibSymbol&)':
../../lld/MachO/SyntheticSections.cpp:287:14: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
  286 |   return config->namespaceKind == NamespaceKind::flat || dysym.isDynamicLookup()
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287 |              ? MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  288 |              : dysym.getFile()->ordinal;
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~

3 years ago[lldb] Fix handling of `DW_AT_decl_file` according to D91014 (attempt #2)
Andy Yankovsky [Tue, 2 Mar 2021 13:28:34 +0000 (14:28 +0100)]
[lldb] Fix handling of `DW_AT_decl_file` according to D91014 (attempt #2)

Apply changes from https://reviews.llvm.org/D91014 to other places where DWARF entries are being processed.

Test case is provided by @jankratochvil.
The test is marked to run only on x64 and exclude Windows and Darwin, because the assembly is not OS-independent.

(First attempt https://reviews.llvm.org/D96778 broke the build bots)

Reviewed By: jankratochvil

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

3 years ago[AMDGPU] Rename amdgcn_wwm to amdgcn_strict_wwm
Piotr Sobczak [Tue, 2 Mar 2021 08:38:07 +0000 (09:38 +0100)]
[AMDGPU] Rename amdgcn_wwm to amdgcn_strict_wwm

 * Introduce the new intrinsic amdgcn_strict_wwm
 * Deprecate the old intrinsic amdgcn_wwm

The change is done for consistency as the "strict"
prefix will become an important, distinguishing factor
between amdgcn_wqm and amdgcn_strictwqm in the future.

The "strict" prefix indicates that inactive lanes do not
take part in control flow, specifically an inactive lane
enabled by a strict mode will always be enabled irrespective
of control flow decisions.

The amdgcn_wwm will be removed, but doing so in two steps
gives users time to switch to the new name at their own pace.

Reviewed By: critson

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

3 years ago[AMDGPU] Rename llvm.amdgcn.msaa.load to llvm.amdgcn.msaa.load.x
Carl Ritson [Wed, 3 Mar 2021 08:09:57 +0000 (17:09 +0900)]
[AMDGPU] Rename llvm.amdgcn.msaa.load to llvm.amdgcn.msaa.load.x

While the underlying instruction is called image_msaa_load,
the resource must be x component only.
Rename the intrinsic for clarity.

Reviewed By: foad

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

3 years ago[FileCheck] Do not skip end of line in diagnostics
Thomas Preud'homme [Tue, 15 Dec 2020 00:58:16 +0000 (00:58 +0000)]
[FileCheck] Do not skip end of line in diagnostics

When commit da108b4ed4e6e7267701e76d5fd3b87609c9ab77 introduced
the CHECK-NEXT directive, it added logic to skip to the next line when
printing a diagnostic if the current matching position is at the end of
a line. This was fine while FileCheck did not support regular expression
but since it does now it can be confusing when the pattern to match
starts with the expectation of a newline (e.g. CHECK-NEXT: {{\n}}foo).
It is also inconsistent with the column information in the diagnostic
which does point to the end of line.

This commit removes this logic altogether, such that failure to match
diagnostic for such cases would show the end of line and be consistent
with the column information. The commit also adapts all existing
testcases accordingly.

Note to reviewers: An alternative approach would be to restrict the code
to only skip to the next line if the first character of the pattern is
known not to match a whitespace-like character. This would respect the
original intent but keep the inconsistency in terms of column info and
requires more code. I've only chosen this current approach by laziness
and would be happy to restrict the logic instead.

Reviewed By: jdenny, jhenderson

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

3 years ago[runtimes] Use standalone build only for compiler-rt
Petr Hosek [Fri, 26 Feb 2021 20:52:53 +0000 (12:52 -0800)]
[runtimes] Use standalone build only for compiler-rt

compiler-rt needs to use standalone build because of the assumptions
made by its build, but other runtimes can use non-standalone build.

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

3 years ago[ARM] Ensure undef is propagated to CBZ/CBNZ flags
David Green [Wed, 3 Mar 2021 08:02:58 +0000 (08:02 +0000)]
[ARM] Ensure undef is propagated to CBZ/CBNZ flags

In some rare circumstances we can be using an undef register for a
compare. When folded into a CBZ/CBNZ the undef flags are lost, leading
to machine verifier problems. This propagates the existing flags to the
new instruction.

3 years ago[WebAssembly] Swap operand order of call_indirect in text format
Andy Wingo [Tue, 2 Mar 2021 11:18:16 +0000 (12:18 +0100)]
[WebAssembly] Swap operand order of call_indirect in text format

The WebAssembly text and binary formats have different operand orders
for the "type" and "table" fields of call_indirect (and
return_call_indirect).  In LLVM we use the binary order for the MCInstr,
but when we produce or consume the text format we should use the text
order.  For compilation units targetting WebAssembly 1.0 (without the
reference types feature), we omit the table operand entirely.

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

3 years ago[Polly] Refabricating IsOutermostParallel() from Integer Set Libarary(ISL) to take...
Prateek Pardeshi [Wed, 3 Mar 2021 07:29:35 +0000 (01:29 -0600)]
[Polly] Refabricating IsOutermostParallel() from Integer Set Libarary(ISL) to take the C++ wrapper

Polly use algorithms from the Integer Set Library (isl), which is a library written in C and which is incompatible with the rest of the LLVM  as it is written in C++.

Changes made:
* Refabricating IsOutermostParallel() to take C++ bindings instead of reference-counting in C isl lib.
* Addition of manage_copy() to be used as reference for C objects instead of IsOutermostParallel()

Reviewed By: Meinersbur

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

3 years ago[RISCV] Use RISCVV_BUILTIN for vector intrinsic checking.
Hsiangkai Wang [Wed, 3 Mar 2021 01:41:31 +0000 (09:41 +0800)]
[RISCV] Use RISCVV_BUILTIN for vector intrinsic checking.

There may be other BUILTINs for other extensions. Use RISCVV_BUILTIN for
vector builtin checking.

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

3 years ago[PowerPC] Allow spilling GPR to VSR on AIX
Qiu Chaofan [Wed, 3 Mar 2021 05:32:39 +0000 (13:32 +0800)]
[PowerPC] Allow spilling GPR to VSR on AIX

This patch enables spilling GPR to VSRs instead of stack under AIX ABI.

Reviewed By: nemanjai

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

3 years ago[LegalizeVectorTypes] Improve SplitVecRes_INSERT_SUBVECTOR to handle subvector being...
Craig Topper [Wed, 3 Mar 2021 05:03:36 +0000 (21:03 -0800)]
[LegalizeVectorTypes] Improve SplitVecRes_INSERT_SUBVECTOR to handle subvector being in the high half of the split or not at element 0 of the low half.

This function isn't exercised in lit tests today today according to
the code coverage report. But will be after the tests in D97543 and
D97559.

Posting this patch to help a crash that Fraser hit.

Reviewed By: frasercrmck

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

3 years agoFix the build error caused by D97570
Jianzhou Zhao [Wed, 3 Mar 2021 04:47:00 +0000 (04:47 +0000)]
Fix the build error caused by D97570