platform/upstream/llvm.git
3 years agoRevert "[ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()"
Zequan Wu [Tue, 16 Mar 2021 21:36:21 +0000 (14:36 -0700)]
Revert "[ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()"

That commit caused chromium build to crash: https://bugs.chromium.org/p/chromium/issues/detail?id=1188885

This reverts commit edf7004851519464f86b0f641da4d6c9506decb1.

3 years ago[Polly][CodeGen] Allow nesting of BandAttr mark without loop.
Michael Kruse [Tue, 16 Mar 2021 20:59:59 +0000 (15:59 -0500)]
[Polly][CodeGen] Allow nesting of BandAttr mark without loop.

BandAttr markers are added as parents of schedule tree bands. These also
appear as markers its equivalent AST, but a band does not necessarily
corresponds to a loop in this. Iterations may be peeled or the loop
being unrolled (e.g. if it has just one iteration). In such cases it may
happend that there is not loop between a BandAttr marker and the marker
for a loop nested in the former parent band/loop.

Handle the situation by giving priority to the inner marker over the
outer.

Fixes the polly-x86_64-linux-test-suite buildbot.

3 years ago[SLP] separate min/max matching from its instruction-level implementation; NFC
Sanjay Patel [Tue, 16 Mar 2021 20:42:25 +0000 (16:42 -0400)]
[SLP] separate min/max matching from its instruction-level implementation; NFC

The motivation is to handle integer min/max reductions independently
of whether they are in the current cmp+sel form or the planned intrinsic
form.

We assumed that min/max included a select instruction, but we can
decouple that implementation detail by checking the instructions
themselves rather than relying on the recurrence (reduction) type.

3 years ago[RISCV] Make empty name symbols SF_FormatSpecific so that llvm-symbolizer ignores...
Fangrui Song [Tue, 16 Mar 2021 21:12:18 +0000 (14:12 -0700)]
[RISCV] Make empty name symbols SF_FormatSpecific so that llvm-symbolizer ignores them for symbolization

On RISC-V, clang emits empty name symbols used for label differences. (In GCC the symbols are typically `.L0`)
After D95916, the empty name symbols can show up in llvm-symbolizer's symbolization output.
They have no names and thus not useful. Set `SF_FormatSpecific` so that llvm-symbolizer will ignore them.

`SF_FormatSpecific` is also used in LTO but that case should not matter.

Corresponding addr2line problem: https://sourceware.org/bugzilla/show_bug.cgi?id=27585

Reviewed By: luismarques

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

3 years ago[sanitizer][NFC] Remove InternalScopedString::size()
Vitaly Buka [Tue, 16 Mar 2021 11:03:45 +0000 (04:03 -0700)]
[sanitizer][NFC] Remove InternalScopedString::size()

size() is inconsistent with length().
In most size() use cases we can replace InternalScopedString with
InternalMmapVector.

Remove non-constant data() to avoid direct manipulations of internal
buffer. append() should be enought to modify InternalScopedString.

3 years ago[AsmParser][SystemZ][z/OS] Reland "Introduce HLASM Comment Syntax"
Anirudh Prasad [Tue, 16 Mar 2021 21:11:14 +0000 (17:11 -0400)]
[AsmParser][SystemZ][z/OS] Reland "Introduce HLASM Comment Syntax"

- Previously, https://reviews.llvm.org/D97703 was [[ https://reviews.llvm.org/D98543 | reverted ]] as it broke when building the unit tests when shared libs on.
- This patch reverts the "revert" and makes two minor changes
- The first is it also links in the MCParser lib when building the unittest. This should resolve the issue when building with with shared libs on and off
- The second renames the name of the unit test from `SystemZAsmLexer` to `SystemZAsmLexerTests` since the convention for unittest binaries is to suffix the name of the unit test with "Tests"

Reviewed By: Kai

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

3 years ago[AArch64] Parse "rng" feature flag in .arch directive
Roland McGrath [Sat, 13 Mar 2021 00:08:42 +0000 (16:08 -0800)]
[AArch64] Parse "rng" feature flag in .arch directive

Reviewed By: phosek

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

3 years ago[InstCombine] Avoid Bitcast-GEP fusion for pointers directly from allocation functions
Mohammad Hadi Jooybar [Tue, 16 Mar 2021 20:28:25 +0000 (16:28 -0400)]
[InstCombine] Avoid Bitcast-GEP fusion for pointers directly from allocation functions

Elimination of bitcasts with void pointer arguments results in GEPs with pure byte indexes. These GEPs do not preserve struct/array information and interrupt phi address translation in later pipeline stages.

Here is the original motivation for this patch:

```
#include<stdio.h>
#include<malloc.h>

typedef struct __Node{

  double f;
  struct __Node *next;

} Node;

void foo () {
  Node *a = (Node*) malloc (sizeof(Node));
  a->next = NULL;
  a->f = 11.5f;

  Node *ptr = a;
  double sum = 0.0f;
  while (ptr) {
    sum += ptr->f;
    ptr = ptr->next;
  }
  printf("%f\n", sum);
}
```
By explicit assignment  `a->next = NULL`, we can infer the length of the link list is `1`. In this case we can eliminate while loop traversal entirely. This elimination is supposed to be performed by GVN/MemoryDependencyAnalysis/PhiTranslation .

The final IR before this patch:

```
define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
entry:
  %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16) #2
  %next = getelementptr inbounds i8, i8* %call, i64 8
  %0 = bitcast i8* %next to %struct.__Node**
  store %struct.__Node* null, %struct.__Node** %0, align 8, !tbaa !2
  %f = bitcast i8* %call to double*
  store double 1.150000e+01, double* %f, align 8, !tbaa !8
  %tobool12 = icmp eq i8* %call, null
  br i1 %tobool12, label %while.end, label %while.body.lr.ph

while.body.lr.ph:                                 ; preds = %entry
  %1 = bitcast i8* %call to %struct.__Node*
  br label %while.body

while.body:                                       ; preds = %while.body.lr.ph, %while.body
  %sum.014 = phi double [ 0.000000e+00, %while.body.lr.ph ], [ %add, %while.body ]
  %ptr.013 = phi %struct.__Node* [ %1, %while.body.lr.ph ], [ %3, %while.body ]
  %f1 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 0
  %2 = load double, double* %f1, align 8, !tbaa !8
  %add = fadd contract double %sum.014, %2
  %next2 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 1
  %3 = load %struct.__Node*, %struct.__Node** %next2, align 8, !tbaa !2
  %tobool = icmp eq %struct.__Node* %3, null
  br i1 %tobool, label %while.end, label %while.body

while.end:                                        ; preds = %while.body, %entry
  %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %while.body ]
  %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %sum.0.lcssa)
  ret void
}
```

Final IR after this patch:
```
; Function Attrs: nofree nounwind
define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
while.end:
  %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.150000e+01)
  ret void
}
```

IR before GVN before this patch:
```
define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
entry:
  %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16) #2
  %next = getelementptr inbounds i8, i8* %call, i64 8
  %0 = bitcast i8* %next to %struct.__Node**
  store %struct.__Node* null, %struct.__Node** %0, align 8, !tbaa !2
  %f = bitcast i8* %call to double*
  store double 1.150000e+01, double* %f, align 8, !tbaa !8
  %tobool12 = icmp eq i8* %call, null
  br i1 %tobool12, label %while.end, label %while.body.lr.ph

while.body.lr.ph:                                 ; preds = %entry
  %1 = bitcast i8* %call to %struct.__Node*
  br label %while.body

while.body:                                       ; preds = %while.body.lr.ph, %while.body
  %sum.014 = phi double [ 0.000000e+00, %while.body.lr.ph ], [ %add, %while.body ]
  %ptr.013 = phi %struct.__Node* [ %1, %while.body.lr.ph ], [ %3, %while.body ]
  %f1 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 0
  %2 = load double, double* %f1, align 8, !tbaa !8
  %add = fadd contract double %sum.014, %2
  %next2 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 1
  %3 = load %struct.__Node*, %struct.__Node** %next2, align 8, !tbaa !2
  %tobool = icmp eq %struct.__Node* %3, null
  br i1 %tobool, label %while.end.loopexit, label %while.body

while.end.loopexit:                               ; preds = %while.body
  %add.lcssa = phi double [ %add, %while.body ]
  br label %while.end

while.end:                                        ; preds = %while.end.loopexit, %entry
  %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %while.end.loopexit ]
  %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %sum.0.lcssa)
  ret void
}
```
IR before GVN after this patch:
```
define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
entry:
  %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16) #2
  %0 = bitcast i8* %call to %struct.__Node*
  %next = getelementptr inbounds %struct.__Node, %struct.__Node* %0, i64 0, i32 1
  store %struct.__Node* null, %struct.__Node** %next, align 8, !tbaa !2
  %f = getelementptr inbounds %struct.__Node, %struct.__Node* %0, i64 0, i32 0
  store double 1.150000e+01, double* %f, align 8, !tbaa !8
  %tobool12 = icmp eq i8* %call, null
  br i1 %tobool12, label %while.end, label %while.body.preheader

while.body.preheader:                             ; preds = %entry
  br label %while.body

while.body:                                       ; preds = %while.body.preheader, %while.body
  %sum.014 = phi double [ %add, %while.body ], [ 0.000000e+00, %while.body.preheader ]
  %ptr.013 = phi %struct.__Node* [ %2, %while.body ], [ %0, %while.body.preheader ]
  %f1 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 0
  %1 = load double, double* %f1, align 8, !tbaa !8
  %add = fadd contract double %sum.014, %1
  %next2 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 1
  %2 = load %struct.__Node*, %struct.__Node** %next2, align 8, !tbaa !2
  %tobool = icmp eq %struct.__Node* %2, null
  br i1 %tobool, label %while.end.loopexit, label %while.body

while.end.loopexit:                               ; preds = %while.body
  %add.lcssa = phi double [ %add, %while.body ]
  br label %while.end

while.end:                                        ; preds = %while.end.loopexit, %entry
  %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %while.end.loopexit ]
  %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %sum.0.lcssa)
  ret void
}
```

The phi translation fails before this patch and it prevents GVN to remove the loop. The reason for this failure is in InstCombine. When the Instruction combining pass decides to convert:
```
 %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16)
  %0 = bitcast i8* %call to %struct.__Node*
  %next = getelementptr inbounds %struct.__Node, %struct.__Node* %0, i64 0, i32 1
  store %struct.__Node* null, %struct.__Node** %next
```
to
```
%call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16)
  %next = getelementptr inbounds i8, i8* %call, i64 8
  %0 = bitcast i8* %next to %struct.__Node**
  store %struct.__Node* null, %struct.__Node** %0

```

GEP instructions with pure byte indexes (e.g. `getelementptr inbounds i8, i8* %call, i64 8`) are obstacles for address translation. address translation is looking for structural similarity between GEPs and these GEPs usually do not match since they have different structure.

This change will cause couple of failures in LLVM-tests. However, in all cases we need to change expected result by the test. I will update those tests as soon as I get green light on this patch.

Reviewed By: nikic

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

3 years ago[M68k] Add more specific operand classes
Ricky Taylor [Tue, 16 Mar 2021 20:35:06 +0000 (13:35 -0700)]
[M68k] Add more specific operand classes

This change adds an operand class for each addressing mode, which can then
be used as part of the assembler to match instructions.

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

3 years ago[M68k] Fixed incorrect `extract-section` command substitution
Min-Yih Hsu [Mon, 15 Mar 2021 20:47:10 +0000 (13:47 -0700)]
[M68k] Fixed incorrect `extract-section` command substitution

Fix Bug 49485 (https://bugs.llvm.org/show_bug.cgi?id=49485). Which was
caused by incorrect invocation of `extract-section.py` on Windows.
Replacing it with more general python script invocation.

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

3 years ago[compiler-rt] Use try_compile_only to check for __ARM_FP
Martin Storsjö [Thu, 11 Mar 2021 20:14:45 +0000 (22:14 +0200)]
[compiler-rt] Use try_compile_only to check for __ARM_FP

This fixes detection when linking isn't supported (i.e. while building
builtins the first time).

Since 8368e4d54c459fe173d76277f17c632478e91add, after setting
CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY, this isn't strictly
needed, but is good for correctness anyway (and in case that commit
ends up reverted).

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

3 years ago[mlir][PDL] Add support for variadic operands and results in the PDL byte code
River Riddle [Tue, 16 Mar 2021 20:12:01 +0000 (13:12 -0700)]
[mlir][PDL] Add support for variadic operands and results in the PDL byte code

Supporting ranges in the byte code requires additional complexity, given that a range can't be easily representable as an opaque void *, as is possible with the existing bytecode value types (Attribute, Type, Value, etc.). To enable representing a range with void *, an auxillary storage is used for the actual range itself, with the pointer being passed around in the normal byte code memory. For type ranges, a TypeRange is stored. For value ranges, a ValueRange is stored. The above problem represents a majority of the complexity involved in this revision, the rest is adapting/adding byte code operations to support the changes made to the PDL interpreter in the parent revision.

After this revision, PDL will have initial end-to-end support for variadic operands/results.

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

3 years ago[mlir][PDL] Add support for variadic operands and results in the PDL Interpreter
River Riddle [Tue, 16 Mar 2021 20:11:50 +0000 (13:11 -0700)]
[mlir][PDL] Add support for variadic operands and results in the PDL Interpreter

This revision extends the PDL Interpreter dialect to add support for variadic operands and results, with ranges of these values represented via the recently added !pdl.range type. To support this extension, three new operations have been added that closely match the single variant:
* pdl_interp.check_types : Compare a range of types with a known range.
* pdl_interp.create_types : Create a constant range of types.
* pdl_interp.get_operands : Get a range of operands from an operation.
* pdl_interp.get_results : Get a range of results from an operation.
* pdl_interp.switch_types : Switch on a range of types.

This revision handles adding support in the interpreter dialect and the conversion from PDL to PDLInterp. Support for variadic operands and results in the bytecode will be added in a followup revision.

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

3 years ago[mlir][PDL] Add support for variadic operands and results in PDL
River Riddle [Tue, 16 Mar 2021 20:11:34 +0000 (13:11 -0700)]
[mlir][PDL] Add support for variadic operands and results in PDL

This revision extends the PDL dialect to add support for variadic operands and results, with ranges of these values represented via the recently added !pdl.range type. To support this extension, three new operations have been added that closely match the single variant:
* pdl.operands : Define a range of input operands.
* pdl.results : Extract a result group from an operation.
* pdl.types : Define a handle to a range of types.

Support for these in the pdl interpreter dialect and byte code will be added in followup revisions.

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

3 years ago[mlir][pdl] Remove CreateNativeOp in favor of a more general ApplyNativeRewriteOp.
River Riddle [Tue, 16 Mar 2021 20:11:22 +0000 (13:11 -0700)]
[mlir][pdl] Remove CreateNativeOp in favor of a more general ApplyNativeRewriteOp.

This has a numerous amount of benefits, given the overly clunky nature of CreateNativeOp:
* Users can now call into arbitrary rewrite functions from inside of PDL, allowing for more natural interleaving of PDL/C++ and enabling for more of the pattern to be in PDL.
* Removes the need for an additional set of C++ functions/registry/etc. The new ApplyNativeRewriteOp will use the same PDLRewriteFunction as the existing RewriteOp. This reduces the API surface area exposed to users.

This revision also introduces a new PDLResultList class. This class is used to provide results of native rewrite functions back to PDL. We introduce a new class instead of using a SmallVector to simplify the work necessary for variadics, given that ranges will require some changes to the structure of PDLValue.

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

3 years ago[mlir][pdl] Restructure how results are represented.
River Riddle [Tue, 16 Mar 2021 20:11:07 +0000 (13:11 -0700)]
[mlir][pdl] Restructure how results are represented.

Up until now, results have been represented as additional results to a pdl.operation. This is fairly clunky, as it mismatches the representation of the rest of the IR constructs(e.g. pdl.operand) and also isn't a viable representation for operations returned by pdl.create_native. This representation also creates much more difficult problems when factoring in support for variadic result groups, optional results, etc. To resolve some of these problems, and simplify adding support for variable length results, this revision extracts the representation for results out of pdl.operation in the form of a new `pdl.result` operation. This operation returns the result of an operation at a given index, e.g.:

```
%root = pdl.operation ...
%result = pdl.result 0 of %root
```

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

3 years ago[sanitizers] [windows] Use InternalMmapVector instead of silencing -Wframe-larger...
Martin Storsjö [Fri, 26 Feb 2021 22:31:18 +0000 (00:31 +0200)]
[sanitizers] [windows] Use InternalMmapVector instead of silencing -Wframe-larger-than

Also use this in ReadBinaryName which currently is producing
warnings.

Keep pragmas for silencing warnings in sanitizer_unwind_win.cpp,
as that can be called more frequently.

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

3 years ago[rs4gc] Simplify code by cloning existing instructions when inserting base chain...
Philip Reames [Tue, 16 Mar 2021 20:00:23 +0000 (13:00 -0700)]
[rs4gc] Simplify code by cloning existing instructions when inserting base chain [NFC]

Previously we created a new node, then filled in the pieces. Now, we clone the existing node, then change the respective fields. The only change in handling is with phis since we have to handle multiple incoming edges from the same block a bit differently.

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

3 years ago[rs4gc] don't force a conflict for a canonical broadcast
Philip Reames [Tue, 16 Mar 2021 19:57:54 +0000 (12:57 -0700)]
[rs4gc] don't force a conflict for a canonical broadcast

A broadcast is a shufflevector where only one input is used. Because of the way we handle constants (undef is a constant), the canonical shuffle sees a meet of (some value) and (nullptr). Given this, every broadcast gets treated as a conflict and a new base pointer computation is added.

The other way to tackle this would be to change constant handling specifically for undefs, but this seems easier.

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

3 years agoscudo: Allow TBI to be disabled on Linux with a macro.
Peter Collingbourne [Tue, 16 Mar 2021 18:46:31 +0000 (11:46 -0700)]
scudo: Allow TBI to be disabled on Linux with a macro.

Android's native bridge (i.e. AArch64 emulator) doesn't support TBI so
we need a way to disable TBI on Linux when targeting the native bridge.

This can also be used to test the no-TBI code path on Linux (currently
only used on Fuchsia), or make Scudo compatible with very old
(pre-commit d50240a5f6ceaf690a77b0fccb17be51cfa151c2 from June 2013)
Linux kernels that do not enable TBI.

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

3 years ago[rs4gc] don't duplicate existing values which are provably base pointers
Philip Reames [Tue, 16 Mar 2021 19:47:57 +0000 (12:47 -0700)]
[rs4gc] don't duplicate existing values which are provably base pointers

RS4GC needs to rewrite the IR to ensure that every relocated pointer has an associated base pointer. The existing code isn't particularly smart about avoiding duplication of existing IR when it turns out the original pointer we were asked to materialize a base pointer for is itself a base pointer.

This patch adds a stage to the algorithm which prunes nodes proven (with a simple forward dataflow fixed point) to be base pointers from the list of nodes considered for duplication. This does require changing some of the later invariants slightly, that's probably the riskiest part of the change.

Differential Revision: D98122

3 years agoRevert "[regalloc] Ensure Query::collectInterferringVregs is called before interval...
Nikita Popov [Tue, 16 Mar 2021 19:41:26 +0000 (20:41 +0100)]
Revert "[regalloc] Ensure Query::collectInterferringVregs is called before interval iteration"

This reverts commit d40b4911bd9aca0573752e065f29ddd9aff280e1.

This causes a large compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=0aa637b2037d882ddf7861284169abf63f524677&to=d40b4911bd9aca0573752e065f29ddd9aff280e1&stat=instructions

3 years ago[MemCpyOpt] Add missing MemorySSAWrapperPass dependency macro
Liam Keegan [Tue, 16 Mar 2021 19:30:00 +0000 (20:30 +0100)]
[MemCpyOpt] Add missing MemorySSAWrapperPass dependency macro

Add MemorySSAWrapperPass as a dependency to MemCpyOptLegacyPass,
since MemCpyOpt now uses MemorySSA by default.

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

3 years ago[regalloc] Ensure Query::collectInterferringVregs is called before interval iteration
Mircea Trofin [Tue, 9 Mar 2021 04:55:53 +0000 (20:55 -0800)]
[regalloc] Ensure Query::collectInterferringVregs is called before interval iteration

The main part of the patch is the change in RegAllocGreedy.cpp: Q.collectInterferringVregs()
needs to be called before iterating the interfering live ranges.

The rest of the patch offers support that is the case: instead of  clearing the query's
InterferingVRegs field, we invalidate it. The clearing happens when the live reg matrix
is invalidated (existing triggering mechanism).

Without the change in RegAllocGreedy.cpp, the compiler ices.

This patch should make it more easily discoverable by developers that
collectInterferringVregs needs to be called before iterating.

I will follow up with a subsequent patch to improve the usability and maintainability of Query.

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

3 years ago[libc++] Improve src/filesystem's formatting of paths.
Arthur O'Dwyer [Sat, 6 Mar 2021 01:13:35 +0000 (20:13 -0500)]
[libc++] Improve src/filesystem's formatting of paths.

This is my attempt to merge D98077 (bugfix the format strings for
Windows paths, which use wchar_t not char)
and D96986 (replace C++ variadic templates with C-style varargs so that
`__attribute__((format(printf)))` can be applied, for better safety)
and D98065 (remove an unused function overload).

The one intentional functional change here is in `__create_what`.
It now prints path1 and path2 in square-brackets _and_ double-quotes,
rather than just square-brackets. Prior to this patch, it would
print either path double-quoted if-and-only-if it was the empty
string. Now the double-quotes are always present. I doubt anybody's
code is relying on the current format, right?

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

3 years agoAdd ConstantDataVector::getRaw() to create a constant data vector from raw data.
Nick Lewycky [Tue, 9 Mar 2021 23:37:04 +0000 (15:37 -0800)]
Add ConstantDataVector::getRaw() to create a constant data vector from raw data.

This parallels ConstantDataArray::getRaw() and can be used with ConstantDataSequential::getRawDataValues() in the base class for both types.

Update BuildConstantData{Array,Vector} tests to test the getRaw API. Also removes its unused Module.

In passing, update some comments to include the support for half and bfloat. Update tests to include testing for bfloat.

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

3 years agoFix for memory leak reported by Valgrind
Maksym Wezdecki [Tue, 16 Mar 2021 17:58:30 +0000 (10:58 -0700)]
Fix for memory leak reported by Valgrind

If llvm so lib is dlopened and dlclosed several times, then memory leak can be observed, reported by Valgrind.

This patch fixes the issue.

Reviewed By: lattner, dblaikie

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

3 years ago[gvn] CSE gc.relocates based on meaning, not spelling (try 2)
Philip Reames [Tue, 16 Mar 2021 17:52:01 +0000 (10:52 -0700)]
[gvn] CSE gc.relocates based on meaning, not spelling (try 2)

This was (partially) reverted in cfe8f8e0 because the conversion from readonly to readnone in Intrinsics.td exposed a couple of problems.  This change has been reworked to not need that change (via some explicit checks in client code).  This is being done to address the original optimization issue and simplify the testing of the readonly changes.  I'm working on that piece under 49607.

Original commit message follows:

The last two operands to a gc.relocate represent indices into the associated gc.statepoint's gc bundle list. (Effectively, gc.relocates are projections from the gc.statepoints multiple return values.)

We can use this to recognize when two gc.relocates are equivalent (and can be CSEd), even when the indices are non-equal. This is particular useful when considering a chain of multiple statepoints as it lets us eliminate all duplicate gc.relocates in a single pass.

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

3 years ago[VPlan] Remove PredInst2Recipe, use VP operands instead. (NFC)
Florian Hahn [Tue, 16 Mar 2021 11:42:08 +0000 (11:42 +0000)]
[VPlan] Remove PredInst2Recipe, use VP operands instead. (NFC)

Instead of maintaining a separate map from predicated instructions to
recipes, we can instead directly look at the VP operands. If the operand
comes from a predicated instruction, the operand will be a
VPPredInstPHIRecipe with a VPReplicateRecipe as its operand.

3 years ago[Utils] Support lit-like substitutions in update_cc_test_checks
Giorgis Georgakoudis [Tue, 16 Mar 2021 14:41:39 +0000 (07:41 -0700)]
[Utils] Support lit-like substitutions in update_cc_test_checks

Reviewed By: jdoerfert

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

3 years ago[Docs] Mention linking to reviews page when committing
Vaivaswatha Nagaraj [Tue, 16 Mar 2021 11:12:30 +0000 (16:42 +0530)]
[Docs] Mention linking to reviews page when committing

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

3 years ago[mlir][amx] reformatted examples
Aart Bik [Tue, 16 Mar 2021 16:43:42 +0000 (09:43 -0700)]
[mlir][amx] reformatted examples

Examples were missing the underscore of the actual ops format.

Reviewed By: ftynse

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

3 years ago[llvm-nm] Add --format=just-symbols and make --just-symbol-name its alias
Fangrui Song [Tue, 16 Mar 2021 17:07:01 +0000 (10:07 -0700)]
[llvm-nm] Add --format=just-symbols and make --just-symbol-name its alias

https://sourceware.org/bugzilla/show_bug.cgi?id=27487 binutils will have
--format=just-symbols/-j as well.

Arbitrarily prefer `-j` to `--format=sysv`. Previously `--format=sysv -j` prints
in the sysv format while `-j` takes precedence over other formats.

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

3 years agoSupport !heapallocsite attachments in StripDebugInfo().
Adrian Prantl [Mon, 15 Mar 2021 23:23:31 +0000 (16:23 -0700)]
Support !heapallocsite attachments in StripDebugInfo().

They point into the DIType type system, so they need to be stripped as well.

rdar://75341300

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

3 years agoSupport !heapallocsite attachments in stripNonLineTableDebugInfo().
Adrian Prantl [Mon, 15 Mar 2021 23:16:36 +0000 (16:16 -0700)]
Support !heapallocsite attachments in stripNonLineTableDebugInfo().

They point into the DIType type system, so they need to be stripped as well.

rdar://75341300

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

3 years ago[RISCV] Support clang -fpatchable-function-entry && GNU function attribute 'patchable...
Fangrui Song [Tue, 16 Mar 2021 17:02:35 +0000 (10:02 -0700)]
[RISCV] Support clang -fpatchable-function-entry && GNU function attribute 'patchable_function_entry'

Similar to D72215 (AArch64) and D72220 (x86).

```
% clang -target riscv32 -march=rv64g -c -fpatchable-function-entry=2 a.c && llvm-objdump -dr a.o
...
0000000000000000 <main>:
       0: 13 00 00 00   nop
       4: 13 00 00 00   nop

% clang -target riscv32 -march=rv64gc -c -fpatchable-function-entry=2 a.c && llvm-objdump -dr a.o
...
00000002 <main>:
       2: 01 00         nop
       4: 01 00         nop
```

Recently the mainline kernel started to use -fpatchable-function-entry=8 for riscv (https://git.kernel.org/linus/afc76b8b80112189b6f11e67e19cf58301944814).

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

3 years ago[InstSimplify] Restrict a GEP transform to avoid provenance changes
Simonas Kazlauskas [Tue, 16 Mar 2021 00:04:42 +0000 (02:04 +0200)]
[InstSimplify] Restrict a GEP transform to avoid provenance changes

This is a follow-up to D98588, and fixes the inline `FIXME` about a GEP-related simplification not
preserving the provenance.

https://alive2.llvm.org/ce/z/qbQoAY

Additional tests were added in {rGf125f28afdb59eba29d2491dac0dfc0a7bf1b60b}

Depends on D98672

Reviewed By: lebedev.ri

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

3 years agoTweak spelling of system-windows UNSUPPORTED line
Jeremy Morse [Tue, 16 Mar 2021 16:50:49 +0000 (16:50 +0000)]
Tweak spelling of system-windows UNSUPPORTED line

3 years ago[libcxx][type_traits] add tests for is_signed and is_unsigned
Tomas Matheson [Tue, 23 Feb 2021 14:05:55 +0000 (14:05 +0000)]
[libcxx][type_traits] add tests for is_signed and is_unsigned

In previous versions of clang, __is_signed and __is_unsigned builtins did not
correspond to is_signed and is_unsigned behaviour for enums.  The builtins were
fixed in D67897 and D98104.

* Disable the fast path of is_unsigned for clang versions < 13

* Add more tests for is_signed, is_unsigned and is_arithmetic

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

3 years ago[OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall
Luke Drummond [Tue, 16 Mar 2021 13:28:06 +0000 (13:28 +0000)]
[OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

`CodeGenFunction::EmitRuntimeCall` automatically sets the right calling
convention for the callee so we can avoid setting it ourselves.

As requested in https://reviews.llvm.org/D98411

Reviewed by: anastasia
Differential Revision: https://reviews.llvm.org/D98705

3 years ago[LoopVectorize] add FP induction test with minimal FMF; NFC
Sanjay Patel [Tue, 16 Mar 2021 13:42:25 +0000 (09:42 -0400)]
[LoopVectorize] add FP induction test with minimal FMF; NFC

3 years ago[MemDepAnalysis] Remove redundant comment.
Thomas Preud'homme [Tue, 16 Mar 2021 15:49:16 +0000 (15:49 +0000)]
[MemDepAnalysis] Remove redundant comment.

Exact same comment is found 2 lines above.

3 years ago[mlir][amx] blocked tilezero integration test
Aart Bik [Tue, 16 Mar 2021 04:18:52 +0000 (21:18 -0700)]
[mlir][amx] blocked tilezero integration test

This adds a new integration test. However, it also
adapts to a recent memref.XXX change for existing tests

Reviewed By: ftynse

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

3 years ago[OCaml] Add missing TypeKinds, Opcode, and AtomicRMWBinOps
Josh Berdine [Fri, 12 Mar 2021 22:50:21 +0000 (22:50 +0000)]
[OCaml] Add missing TypeKinds, Opcode, and AtomicRMWBinOps

There are several enum values that have been added to LLVM-C that are
missing from the OCaml bindings. The types defined in
bindings/ocaml/llvm/llvm.ml should be in sync with the corresponding
enum definitions in include/llvm-c/Core.h. The enum values are passed
from C to OCaml unmodified, and clients of the OCaml bindings
interpret them as tags of the corresponding OCaml types. So the only
changes needed are to add the missing constructors to the type
definitions, and to change the name of the maximum opcode in an
assertion.

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

3 years ago[AArch64][SVE] Fold vector ZExt/SExt into gather loads where possible
Joe Ellis [Thu, 4 Mar 2021 09:06:49 +0000 (09:06 +0000)]
[AArch64][SVE] Fold vector ZExt/SExt into gather loads where possible

This commit folds sxtw'd or uxtw'd offsets into gather loads where
possible with a DAGCombine optimization.

As an example, the following code:

     1 #include <arm_sve.h>
     2
     3 svuint64_t func(svbool_t pred, const int32_t *base, svint64_t offsets) {
     4   return svld1sw_gather_s64offset_u64(
     5     pred, base, svextw_s64_x(pred, offsets)
     6   );
     7 }

would previously lower to the following assembly:

    sxtw z0.d, p0/m, z0.d
    ld1sw { z0.d }, p0/z, [x0, z0.d]
    ret

but now lowers to:

    ld1sw   { z0.d }, p0/z, [x0, z0.d, sxtw]
    ret

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

3 years ago[SCEV][NFC] Move check up the stack
Max Kazantsev [Tue, 16 Mar 2021 14:27:25 +0000 (21:27 +0700)]
[SCEV][NFC] Move check up the stack

One of (and primary) callers of isBasicBlockEntryGuardedByCond is
isKnownPredicateAt, which makes isKnownPredicate check before it.
It already makes non-recursive check inside. So, on this execution
path this check is made twice. The only other caller is
isLoopEntryGuardedByCond. Moving the check there should save some
compile time.

3 years ago[RISCV] Look through copies when trying to find an implicit def in addVSetVL.
Craig Topper [Tue, 16 Mar 2021 14:49:24 +0000 (07:49 -0700)]
[RISCV] Look through copies when trying to find an implicit def in addVSetVL.

The InstrEmitter can sometimes insert a copy after an IMPLICIT_DEF
before connecting it to the vector instruction. This occurs when
constrainRegClass reduces to a class with less than 4 registers.
I believe LMUL8 on masked instructions triggers this since the
result can only use the v8, v16, or v24 register group as the mask
is using v0.

Reviewed By: frasercrmck

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

3 years ago[lit testing] Mark reorder.py as unavailable on Windows
David Zarzycki [Tue, 16 Mar 2021 14:52:11 +0000 (10:52 -0400)]
[lit testing] Mark reorder.py as unavailable on Windows

The test file has embedded slashes. This is fine for normal users that
are just recording and reordering paths, but not great when the trace
data is committed back to a repository that should work on both Unix and
Windows.

3 years ago[AArch64][SVEIntrinsicOpts] Factor out redundant SVE mul/fmul intrinsics
Joe Ellis [Mon, 8 Mar 2021 12:52:40 +0000 (12:52 +0000)]
[AArch64][SVEIntrinsicOpts] Factor out redundant SVE mul/fmul intrinsics

This commit implements an IR-level optimization to eliminate idempotent
SVE mul/fmul intrinsic calls. Currently, the following patterns are
captured:

    fmul  pg  (dup_x  1.0)  V  =>  V
    mul   pg  (dup_x  1)    V  =>  V

    fmul  pg  V  (dup_x  1.0)  =>  V
    mul   pg  V  (dup_x  1)    =>  V

    fmul  pg  V  (dup  v  pg  1.0)  =>  V
    mul   pg  V  (dup  v  pg  1)    =>  V

The result of this commit is that code such as:

    1  #include <arm_sve.h>
    2
    3  svfloat64_t foo(svfloat64_t a) {
    4    svbool_t t = svptrue_b64();
    5    svfloat64_t b = svdup_f64(1.0);
    6    return svmul_m(t, a, b);
    7  }

will lower to a nop.

This commit does not capture all possibilities; only the simple cases
described above. There is still room for further optimisation.

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

3 years ago[RISCV] Improve i32 UADDSAT/USUBSAT on RV64.
Craig Topper [Tue, 16 Mar 2021 07:29:42 +0000 (00:29 -0700)]
[RISCV] Improve i32 UADDSAT/USUBSAT on RV64.

The default promotion uses zero extends that become shifts. We
cam use sign extend instead which is better for RISCV.

I've used two different implementations based on whether we
have minu/maxu instructions.

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

3 years agoCorrect Doxygen syntax for inline code
Aaron Puchert [Tue, 16 Mar 2021 14:17:43 +0000 (15:17 +0100)]
Correct Doxygen syntax for inline code

There is no syntax like {@code ...} in Doxygen, @code is a block command
that ends with @endcode, and generally these are not enclosed in braces.
The correct syntax for inline code snippets is @c <code>.

Reviewed By: aaron.ballman

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

3 years ago[gn build] Port 9a5af541ee05
LLVM GN Syncbot [Tue, 16 Mar 2021 14:03:53 +0000 (14:03 +0000)]
[gn build] Port 9a5af541ee05

3 years ago[clang-tidy] Remove readability-deleted-default
Nathan James [Tue, 16 Mar 2021 14:03:29 +0000 (14:03 +0000)]
[clang-tidy] Remove readability-deleted-default

The deprecation notice was cherrypicked to the release branch in https://github.com/llvm/llvm-project/commit/f8b32989241cca87a8690c8cc404f06ce1f90e4c so its safe to remove this for the 13.X release cycle.

Reviewed By: aaron.ballman

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

3 years ago[Polly][Unroll] Fix unroll_double test.
Michael Kruse [Tue, 16 Mar 2021 13:50:37 +0000 (08:50 -0500)]
[Polly][Unroll] Fix unroll_double test.

We enumerated the cross product Domain x Scatter, but sorted only be the
scatter key. In case there are are multiple statement instances per
scatter value, the order between statement instances of the same loop
iteration was undefined.

Propertly enumerate and sort only by the scatter value, and group the
domains using the scatter dimension again.

Thanks to Leonard Chan for the report.

3 years ago[OpenMP] Add runtime interface for OpenMP 5.1 error directive
Hansang Bae [Thu, 11 Mar 2021 17:24:29 +0000 (11:24 -0600)]
[OpenMP] Add runtime interface for OpenMP 5.1 error directive

The proposed new interface is for supporting `at(execution)` clause in the
error directive.

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

3 years ago[X86][SSE] canonicalizeShuffleWithBinOps - add PERMILPS/PERMILPD + PERMPD/PERMQ ...
Simon Pilgrim [Tue, 16 Mar 2021 12:31:39 +0000 (12:31 +0000)]
[X86][SSE] canonicalizeShuffleWithBinOps - add PERMILPS/PERMILPD + PERMPD/PERMQ + INSERTPS handling.

Bail if the INSERTPS would introduce zeros across the binop.

3 years ago[AMDGPU, NFC] Refactor FP/BP spill index code in emitPrologue/emitEpilogue
RamNalamothu [Tue, 16 Mar 2021 11:06:24 +0000 (16:36 +0530)]
[AMDGPU, NFC] Refactor FP/BP spill index code in emitPrologue/emitEpilogue

Reviewed By: scott.linder

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

3 years ago[InstSimplify] Match PtrToInt more directly in a GEP transform (NFC)
Simonas Kazlauskas [Sun, 14 Mar 2021 20:54:18 +0000 (22:54 +0200)]
[InstSimplify] Match PtrToInt more directly in a GEP transform (NFC)

In preparation for D98611, the upcoming change will need to apply additional checks to `P` and `V`,
and so this refactor paves the way for adding additional checks in a less awkward way.

Reviewed By: lebedev.ri

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

3 years ago[lit testing] Fix Windows reliability?
David Zarzycki [Tue, 16 Mar 2021 13:11:01 +0000 (09:11 -0400)]
[lit testing] Fix Windows reliability?

3 years ago[Test] Add test with loops guarded by trivial conditions
Max Kazantsev [Tue, 16 Mar 2021 12:46:36 +0000 (19:46 +0700)]
[Test] Add test with loops guarded by trivial conditions

3 years ago[Test] Update auto-generated checks
Max Kazantsev [Tue, 16 Mar 2021 12:38:57 +0000 (19:38 +0700)]
[Test] Update auto-generated checks

3 years ago[clangd] Add basic monitoring info request for remote index server
Kirill Bobyrev [Tue, 16 Mar 2021 12:37:48 +0000 (13:37 +0100)]
[clangd] Add basic monitoring info request for remote index server

This allows requesting information about the server uptime and start time. This is the first patch in a series of monitoring changes, hence it's not immediately useful. Next step is propagating the index freshness information and then probably loading metadata into the index server.

The way to test new behaviour through command line:

```
$ grpc_cli call localhost:50051 Monitor/MonitoringInfo ''
connecting to localhost:50051
uptime_seconds: 42
index_age_seconds: 609568
Rpc succeeded with OK status
```

Reviewed By: kadircet

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

3 years ago[NFC] Use SmallString instead of std::string for the AttrBuilder
serge-sans-paille [Mon, 8 Mar 2021 16:46:35 +0000 (17:46 +0100)]
[NFC] Use SmallString instead of std::string for the AttrBuilder

This avoids a few unnecessary conversion from StringRef to std::string, and a
bunch of extra allocation thanks to the SmallString.

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

3 years ago[mlir] NFC - Expose GlobalCreator so it can be reused.
Nicolas Vasilache [Tue, 16 Mar 2021 12:05:12 +0000 (12:05 +0000)]
[mlir] NFC - Expose GlobalCreator so it can be reused.

3 years ago[llvm-exegesis testing] Workaround unreliable test
David Zarzycki [Tue, 16 Mar 2021 11:57:31 +0000 (07:57 -0400)]
[llvm-exegesis testing] Workaround unreliable test

Picking an instruction at random is not perfectly reliable.

3 years ago[clangd] Introduce pullDiags endpoint
Kadir Cetinkaya [Mon, 15 Mar 2021 09:18:12 +0000 (10:18 +0100)]
[clangd] Introduce pullDiags endpoint

Implement initial support for pull-based diagnostics in ClangdServer.
This is planned for LSP 3.17, and initial proposal is in
https://github.com/microsoft/vscode-languageserver-node/blob/d15eb0671e0947d14e3548d13754104ee13aa56d/protocol/src/common/proposed.diagnostic.ts#L111.

We chose to serve the requests only when clangd has a fresh preamble
available. In case of a stale preamble we just drop the request on the
floor.

This patch doesn't plumb this to LSP layer yet, as pullDiags is still a
proposal with only an implementation in vscode.

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

3 years ago[NFC] Replace loop by idiomatic llvm::find_if
serge-sans-paille [Tue, 16 Mar 2021 11:48:25 +0000 (12:48 +0100)]
[NFC] Replace loop by idiomatic llvm::find_if

3 years ago[CodeCompletion] Avoid spurious signature help for init-list args
Sam McCall [Fri, 12 Mar 2021 11:00:54 +0000 (12:00 +0100)]
[CodeCompletion] Avoid spurious signature help for init-list args

Somewhat surprisingly, signature help is emitted as a side-effect of
computing the expected type of a function argument.
The reason is that both actions require enumerating the possible
function signatures and running partial overload resolution, and doing
this twice would be wasteful and complicated.

Change #1: document this, it's subtle :-)

However, sometimes we need to compute the expected type without having
reached the code completion cursor yet - in particular to allow
completion of designators.
eb4ab3358cd4dc834a761191b5531b38114f7b13 did this but introduced a
regression - it emits signature help in the wrong location as a side-effect.

Change #2: only emit signature help if the code completion cursor was reached.

Currently there is PP.isCodeCompletionReached(), but we can't use it
because it's set *after* running code completion.
It'd be nice to set this implicitly when the completion token is lexed,
but ConsumeCodeCompletionToken() makes this complicated.

Change #3: call cutOffParsing() *first* when seeing a completion token.

After this, the fact that the Sema::Produce*SignatureHelp() functions
are even more confusing, as they only sometimes do that.
I don't want to rename them in this patch as it's another large
mechanical change, but we should soon.

Change #4: prepare to rename ProduceSignatureHelp() to GuessArgumentType() etc.

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

3 years ago[TableGen/GlobalISel] Emit MI_predicate custom code for PatFrags (not only PatFrag)
Bjorn Pettersson [Fri, 12 Mar 2021 11:24:43 +0000 (12:24 +0100)]
[TableGen/GlobalISel] Emit MI_predicate custom code for PatFrags (not only PatFrag)

When GlobalISelEmitter::emitCxxPredicateFns emitted code for MI
predicates it used "PatFrag" when searching for definitions. With
this patch it will search for all "PatFrags" instead. Since PatFrag
derives from PatFrags the difference is that we now include all
definitions using PatFrags directly as well. Thus making it possible
to use GISelPredicateCode together with a PatFrags definition.

It might be noted that the matcher code was emitted also for PatFrags
in the past. But then one ended up with errors since the custom code
in testMIPredicate_MI was missing.

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

3 years ago[SLP] improve readability in reduction logic; NFC
Sanjay Patel [Tue, 16 Mar 2021 10:53:08 +0000 (06:53 -0400)]
[SLP] improve readability in reduction logic; NFC

We had 2 different and ambiguously-named 'I' variables.

3 years ago[clangd] Add `limit` extension on completion and workspace-symbols
Sam McCall [Tue, 2 Mar 2021 21:16:29 +0000 (22:16 +0100)]
[clangd] Add `limit` extension on completion and workspace-symbols

This overrides the --limit-results command-line flag, and is not constrained
by it.
See https://github.com/clangd/clangd/issues/707

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

3 years ago[clangd] Turn off implicit cancellation based on client capabilities
Sam McCall [Thu, 11 Mar 2021 12:43:59 +0000 (13:43 +0100)]
[clangd] Turn off implicit cancellation based on client capabilities

Capability is in upcoming 3.17: https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/

(This is also useful for C++ embedders)

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

3 years ago[test] Make sure the test program in GetErrcMessages.cmake exits normally.
Markus Böck [Tue, 16 Mar 2021 11:13:31 +0000 (12:13 +0100)]
[test] Make sure the test program in GetErrcMessages.cmake exits normally.

If for some reason the test program does not exit normally it'd currently lead to a false positive and it's stdout output being assigned to the output variable.

Instead, check the test program exited normally before assigning the process output to the out variable.

Follow up on rGaf2796c76d2ff4b73165ed47959afd35a769beee
Fixes an issue discovered post commit in https://reviews.llvm.org/D98278

3 years ago[clangd] Reject renames to non-identifier characters
Sam McCall [Thu, 11 Mar 2021 12:56:24 +0000 (13:56 +0100)]
[clangd] Reject renames to non-identifier characters

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

3 years ago[CodeCompletion] Don't track preferred types if code completion is disabled.
Sam McCall [Thu, 11 Mar 2021 23:01:25 +0000 (00:01 +0100)]
[CodeCompletion] Don't track preferred types if code completion is disabled.

Some of this work isn't quite trivial.

(As requested in D96058)

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

3 years ago[sanitizer][NFC] Don't inherit InternalMmapVector
Vitaly Buka [Tue, 16 Mar 2021 10:55:29 +0000 (03:55 -0700)]
[sanitizer][NFC] Don't inherit InternalMmapVector

3 years ago[AMDGPU][MC] Disabled lds_direct for GFX90a
Dmitry Preobrazhensky [Tue, 16 Mar 2021 10:51:03 +0000 (13:51 +0300)]
[AMDGPU][MC] Disabled lds_direct for GFX90a

Fixed bug 49382.

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

3 years ago[test][NFC] Minor formatting and comment adjustments in GetErrcMessages.cmake
Markus Böck [Tue, 16 Mar 2021 10:05:48 +0000 (11:05 +0100)]
[test][NFC] Minor formatting and comment adjustments in GetErrcMessages.cmake

These changes address post-commit review comments discussed in https://reviews.llvm.org/D98278

3 years ago[mlir]: Add canonicalization for dim of 1D alloc of size rank.
Adrian Kuegel [Wed, 3 Mar 2021 08:47:24 +0000 (09:47 +0100)]
[mlir]: Add canonicalization for dim of 1D alloc of size rank.

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

3 years ago[flang] Save AllocateObject and PointerObject analyzed expression
Jean Perier [Tue, 16 Mar 2021 08:47:35 +0000 (09:47 +0100)]
[flang] Save AllocateObject and PointerObject analyzed expression

`parser::AllocateObject` and `parser::PointerObject` can be represented
as typed expressions once analyzed. This simplifies the work for parse-tree
consumers that work with typed expressions to deal with allocatable and
pointer objects such as lowering.

This change also makes it easier to add typedExpr in the future by
automatically handling nodes that have this member when possible.

Changes:

- Add a `mutable TypedExpr typedExpr` field to `parser::PointerObject` and `parser::AllocateObject`.
- Add a `parser::HasTypedExpr<T>` helper to better share code relating to typedExpr in the parse tree.
- Add hooks in `semantics::ExprChecker` for AllocateObject and PointerObject nodes, and use
  ExprOrVariable on it to analyze and set the tyedExpr field during
  expression analysis. This required adding overloads for `AssumedTypeDummy`.
- Update check-nullify.cpp and check-deallocate.cpp to not re-analyze the StructureComponent but to
  use the typedExpr field instead.
- Update dump/unparse to use HasTypedExpr and use the typedExpr when there is one.

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

3 years ago[lit] Sort test start times based on prior test timing data
David Zarzycki [Wed, 10 Mar 2021 15:19:15 +0000 (10:19 -0500)]
[lit] Sort test start times based on prior test timing data

Lit as it exists today has three hacks that allow users to run tests earlier:

1) An entire test suite can set the `is_early` boolean.
2) A very recently introduced "early_tests" feature.
3) The `--incremental` flag forces failing tests to run first.

All of these approaches have problems.

1) The `is_early` feature was until very recently undocumented. Nevertheless it still lacks testing and is a imprecise way of optimizing test starting times.
2) The `early_tests` feature requires manual updates and doesn't scale.
3) `--incremental` is undocumented, untested, and it requires modifying the *source* file system by "touching" the file. This "touch" based approach is arguably a hack because it confuses editors (because it looks like the test was modified behind the back of the editor) and "touching" the test source file doesn't work if the test suite is read only from the perspective of `lit` (via advanced filesystem/build tricks).

This patch attempts to simplify and address all of the above problems.

This patch formalizes, documents, tests, and defaults lit to recording the execution time of tests and then reordering all tests during the next execution. By reordering the tests, high core count machines run faster, sometimes significantly so.

This patch also always runs failing tests first, which is a positive user experience win for those that didn't know about the hidden `--incremental` flag.

Finally, if users want, they can _optionally_ commit the test timing data (or a subset thereof) back to the repository to accelerate bots and first-time runs of the test suite.

Reviewed By: jhenderson, yln

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

3 years ago[NFC] Wisely nest dyn_cast in FunctionLoweringInfo
serge-sans-paille [Tue, 16 Mar 2021 09:11:57 +0000 (10:11 +0100)]
[NFC] Wisely nest dyn_cast in FunctionLoweringInfo

Take advantage of the inheritance tree to avoid a few comparison.

3 years ago[SVE][LoopVectorize] Add support for scalable vectorization of loops with vector...
Caroline Concatto [Tue, 19 Jan 2021 11:30:50 +0000 (11:30 +0000)]
[SVE][LoopVectorize] Add support for scalable vectorization of loops with vector reverse

This patch adds support for reverse loop vectorization.
It is possible to vectorize the following loop:
```
  for (int i = n-1; i >= 0; --i)
    a[i] = b[i] + 1.0;
```
with fixed or scalable vector.
The loop-vectorizer will use 'reverse' on the loads/stores to make
sure the lanes themselves are also handled in the right order.
This patch adds support for scalable vector on IRBuilder interface to
create a reverse vector. The IR function
CreateVectorReverse lowers to experimental.vector.reverse for scalable vector
and keedp the original behavior for fixed vector using shuffle reverse.

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

3 years agoscf::ForOp: Fold away iterator arguments with no use and for which the corresponding...
Lorenzo Chelini [Tue, 16 Mar 2021 06:46:10 +0000 (06:46 +0000)]
scf::ForOp: Fold away iterator arguments with no use and for which the corresponding input is yielded

Enhance 'ForOpIterArgsFolder' to remove unused iteration arguments in a
scf::ForOp. If the block argument corresponding to the given iterator has no
use and the yielded value equals the input, we fold it away.

Reviewed By: nicolasvasilache

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

3 years ago[RISCV] Don't emit #undef BUILTIN from RISCVVEmitter.cpp
Jim Lin [Tue, 16 Mar 2021 06:57:45 +0000 (14:57 +0800)]
[RISCV] Don't emit #undef BUILTIN from RISCVVEmitter.cpp

In BuiltinsRISCV.def, other extension 's intrinsics need to be defined by using macro BUILTIN.
So, it shouldn't undefine macro BUILTIN in the end of declaration for V intrinsics.

Reviewed By: craig.topper

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

3 years ago[AArch64][GlobalISel] Fix crash on lowering <1 x half> types.
Amara Emerson [Tue, 16 Mar 2021 06:27:10 +0000 (23:27 -0700)]
[AArch64][GlobalISel] Fix crash on lowering <1 x half> types.

3 years ago[AArch64][ASAN] Disable fgets_fputs.cpp test.
Yvan Roux [Tue, 16 Mar 2021 06:00:19 +0000 (07:00 +0100)]
[AArch64][ASAN] Disable fgets_fputs.cpp test.

This test is failing for long a time on AArch64 bots, disable it for now
to keep the bots green while investigating it.

3 years ago[OpenMP][AMDGPU] Skip backend and assemble phases for amdgcn
Pushpinder Singh [Tue, 16 Mar 2021 04:54:21 +0000 (04:54 +0000)]
[OpenMP][AMDGPU] Skip backend and assemble phases for amdgcn

Remove emit-llvm-bc from addClangTargetOptions as it conflicts with -E for save-temps.

AMDGCN does not yet support linking object files so backend and assemble actions are
skipped, leaving LLVM IR as the output format.

Reviewed By: JonChesterfield, ronlieb

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

3 years ago[CSSPGO][llvm-profgen] Fix getCanonicalFnName usage in llvm-profgen
wlei [Thu, 4 Mar 2021 04:37:19 +0000 (20:37 -0800)]
[CSSPGO][llvm-profgen] Fix getCanonicalFnName usage in llvm-profgen

Previously we didn't support to keep the unique linkage name(-funique-internal-linkage-name) in llvm-profgen. As discussed in https://reviews.llvm.org/D96932, we choose to do canonicalization for it.

Now since "selected" is set as the default parameter of getCanonicalFnName in `D96932`, we don't need to add any attribute here for the previous usage and only fix the missing usage in the pseudo probe decoding.

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

3 years ago[OpenMP][FIX] Repair accidental replacement of _shfl_sync with _shfl
Johannes Doerfert [Tue, 16 Mar 2021 02:52:38 +0000 (21:52 -0500)]
[OpenMP][FIX] Repair accidental replacement of _shfl_sync with _shfl

This was broken accidentally in D95752.

Reviewed By: ye-luo

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

3 years ago[NVPTX] CUDA does provide malloc/free since compute capability 2.X
Johannes Doerfert [Sun, 14 Mar 2021 17:27:42 +0000 (12:27 -0500)]
[NVPTX] CUDA does provide malloc/free since compute capability 2.X

https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dynamic-global-memory-allocation-and-operations

Reviewed By: tra

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

3 years ago[OCaml][test] Fix Bindings/OCaml/executionengine.ml test
Josh Berdine [Sat, 13 Mar 2021 23:29:36 +0000 (23:29 +0000)]
[OCaml][test] Fix Bindings/OCaml/executionengine.ml test

It seems that at some point it became necessary to pass `-thread` to
the ocaml compiler for this test.

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

3 years ago[gn build] Port 4f198b0c27b0
LLVM GN Syncbot [Tue, 16 Mar 2021 02:41:16 +0000 (02:41 +0000)]
[gn build] Port 4f198b0c27b0

3 years ago[X86] Pass to transform amx intrinsics to scalar operation.
Bing1 Yu [Tue, 16 Mar 2021 01:44:42 +0000 (09:44 +0800)]
[X86] Pass to transform amx intrinsics to scalar operation.

This pass runs in any situations but we skip it when it is not O0 and the
function doesn't have optnone attribute. With -O0, the def of shape to amx
intrinsics is near the amx intrinsics code. We are not able to find a
point which post-dominate all the shape and dominate all amx intrinsics.
To decouple the dependency of the shape, we transform amx intrinsics
to scalar operation, so that compiling doesn't fail. In long term, we
 should improve fast register allocation to allocate amx register.

Reviewed By: pengfei

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

3 years agoSkip path separators to make the test portable across Win/Linux
David Blaikie [Tue, 16 Mar 2021 00:08:37 +0000 (17:08 -0700)]
Skip path separators to make the test portable across Win/Linux

3 years ago[mlir][amx] Add Intel AMX dialect (architectural-specific vector dialect)
Aart Bik [Mon, 15 Mar 2021 22:32:57 +0000 (15:32 -0700)]
[mlir][amx] Add Intel AMX dialect (architectural-specific vector dialect)

The Intel Advanced Matrix Extensions (AMX) provides a tile matrix
multiply unit (TMUL), a tile control register (TILECFG), and eight
tile registers TMM0 through TMM7 (TILEDATA). This new MLIR dialect
provides a bridge between MLIR concepts like vectors and memrefs
and the lower level LLVM IR details of AMX.

Reviewed By: nicolasvasilache

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

3 years agoFix 34885bffdf43920c0f011e17a65fd678100240dd
Walter Erquinigo [Mon, 15 Mar 2021 23:35:49 +0000 (16:35 -0700)]
Fix 34885bffdf43920c0f011e17a65fd678100240dd

It failed https://lab.llvm.org/buildbot/#/builders/17/builds/5262 and
the fix is simply to relax a regex expression in a test.

3 years ago[CMake] Clean up unnecessary dependency
Petr Hosek [Mon, 15 Mar 2021 23:26:18 +0000 (16:26 -0700)]
[CMake] Clean up unnecessary dependency

The LINK_COMPONENTS dependency between DebugInfoCodeView and
DebugInfoMSF is unnecessary. Breaking them would allow a more
fine-controlled distribution.

Patch By: dangyi

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

3 years ago[libomptarget] Build amdgcn devicertl by default
Jon Chesterfield [Mon, 15 Mar 2021 23:17:49 +0000 (23:17 +0000)]
[libomptarget] Build amdgcn devicertl by default

[libomptarget] Build amdgcn devicertl by default

The cmake for this looks for an llvm install and does the right thing when
building as part of enable_runtimes. It will probably do the right thing
in other settings - at least, it won't try to build this with gcc.

Reviewed By: jdoerfert

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

3 years ago[gn build] Port ecf6466f01c5
LLVM GN Syncbot [Mon, 15 Mar 2021 23:01:19 +0000 (23:01 +0000)]
[gn build] Port ecf6466f01c5