platform/upstream/llvm.git
2 years agoRevert "[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType"
Alex Bradbury [Wed, 6 Jul 2022 04:07:22 +0000 (05:07 +0100)]
Revert "[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType"

This reverts commit 8ccc7e0aa461350bce02d70669c11f4a5e300ee7.

Wrong version of the patch was pushed.

2 years ago[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType
Alex Bradbury [Wed, 6 Jul 2022 03:54:13 +0000 (04:54 +0100)]
[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType

Use the isExternRefType and isFuncRefType helpers rather than
reimplementing that logic in this function (which acts as a blocker to
work to prototype alternative IR-level representations of reference
types).

2 years ago[mlir][Vector] Fold InsertOp(SplatOp(X), SplatOp(X)) to SplatOp(X).
jacquesguan [Fri, 1 Jul 2022 08:02:28 +0000 (16:02 +0800)]
[mlir][Vector] Fold InsertOp(SplatOp(X), SplatOp(X)) to SplatOp(X).

This patch folds InsertOp(SplatOp(X), SplatOp(X)) to SplatOp(X).

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

2 years ago[Clang][unittests] Silence trucation warning with MSVC 2022
Alexandre Ganea [Wed, 6 Jul 2022 00:27:53 +0000 (20:27 -0400)]
[Clang][unittests] Silence trucation warning with MSVC 2022

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

2 years ago[Clang] Silence warning when building with MSVC 2022
Alexandre Ganea [Tue, 5 Jul 2022 16:40:22 +0000 (12:40 -0400)]
[Clang] Silence warning when building with MSVC 2022

Previously, the warning seen:

[22/95] Building CXX object tools\clang\lib\StaticAnalyzer\Checker...bj.clangStaticAnalyzerCheckers.dir\NoReturnFunctionChecker.cpp.objC:\git\llvm-project\clang\lib\StaticAnalyzer\Checkers\NoReturnFunctionChecker.cpp(149): warning C4305: 'if': truncation from 'size_t' to 'bool'
C:\git\llvm-project\clang\include\clang/Analysis/SelectorExtras.h(28): note: see reference to function template instantiation 'clang::Selector clang::getKeywordSelector<const char,const char,const char,const char>(clang::ASTContext &,const char *,const char *,const char *,const char *)' being compiled
C:\git\llvm-project\clang\lib\StaticAnalyzer\Checkers\NoReturnFunctionChecker.cpp(125): note: see reference to function template instantiation 'void clang::lazyInitKeywordSelector<const char,const char,const char,const char>(clang::Selector &,clang::ASTContext &,const char *,const char *,const char *,const char *)' being compiled

2 years ago[mlir] Silence warnings when building with Clang ToT
Alexandre Ganea [Tue, 5 Jul 2022 16:15:36 +0000 (12:15 -0400)]
[mlir] Silence warnings when building with Clang ToT

Previously, these warnings were seen:

[6599/7564] Building native mlir-pdll...
[270/278] Building CXX object tools/mlir/lib/Tools/PDLL/CodeGen/CMakeFiles/obj.MLIRPDLLCodeGen.dir/CPPGen.cpp.obj
In file included from C:/git/llvm-project/mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp:20:
C:/git/llvm-project/mlir/include\mlir/Tools/PDLL/ODS/Operation.h(202,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
  friend class Dialect;
               ^
               ::mlir::
1 warning generated.

[278/278] Linking CXX executable bin\mlir-pdll.exe
[6857/7564] Building CXX object tools/mlir/unittests/ExecutionEngine/CMakeFiles/MLIRExecutionEngineTests.dir/Invoke.cpp.obj
In file included from C:/git/llvm-project/mlir/unittests/ExecutionEngine/Invoke.cpp:20:
C:/git/llvm-project/mlir/include\mlir/ExecutionEngine/MemRefUtils.h(104,27): warning: shift count >= width of type [-Wshift-count-overflow]
  assert(sizeof(T) < (1ul << 32) && "Elemental type overflows");
                          ^  ~~
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\assert.h(40,17): note: expanded from macro 'assert'
            (!!(expression)) ||                                                              \
                ^~~~~~~~~~
1 warning generated.

2 years agoAllow non-variadic functions to be attributed with `__attribute__((format))`
Félix Cloutier [Tue, 7 Jun 2022 22:45:07 +0000 (15:45 -0700)]
Allow non-variadic functions to be attributed with `__attribute__((format))`

Clang only allows you to use __attribute__((format)) on variadic functions. There are legit use cases for __attribute__((format)) on non-variadic functions, such as:

(1) variadic templates

```c++
template<typename… Args>
void print(const char *fmt, Args… &&args) __attribute__((format(1, 2))); // error: format attribute requires variadic function
```

(2) functions which take fixed arguments and a custom format:

```c++
void print_number_string(const char *fmt, unsigned number, const char *string) __attribute__((format(1, 2)));
// ^error: format attribute requires variadic function

void foo(void) {
    print_number_string(“%08x %s\n”, 0xdeadbeef, “hello”);
    print_number_string(“%d %s”, 0xcafebabe, “bar”);
}
```

This change allows Clang users to attach __attribute__((format)) to non-variadic functions, including functions with C++ variadic templates. It replaces the error with a GCC compatibility warning and improves the type checker to ensure that received arrays are treated like pointers (this is a possibility in C++ since references to template types can bind to arrays).

Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D112579
rdar://84629099

2 years ago[Sanitizer][Darwin] Fix log-path_test.cpp
Julian Lettner [Tue, 5 Jul 2022 23:27:11 +0000 (16:27 -0700)]
[Sanitizer][Darwin] Fix log-path_test.cpp

In my previous change [1], I added log output that made a test that
expected "no output" fail.  The easiest solution is to only print the
new hint/warning when we at least ask for `verbosity=1`.

[1] https://reviews.llvm.org/D128936

Radar-Id: rdar://96437354

2 years ago[lldb/Core] Fix finite progress event reporting
Med Ismail Bennani [Tue, 5 Jul 2022 23:25:23 +0000 (16:25 -0700)]
[lldb/Core] Fix finite progress event reporting

This patch should fix event handling for finite progress reports.

Previously, the event handler would get stuck when receiving a finite
progress report, and stop displaying upcoming reports.
This was due to the fact that we were checking if the progress event was
completed by calling `GetCompleted` but returns the completion amount
instead of saying whether it's completed.

That caused the current event id to remain the same, preventing all the
following progress reports to be shown to the user.

This patch also adds some logging to facilitate debugging progress events.

rdar://91788326

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[RISCV] Add more SHXADD patterns where the input is (and (shl/shr X, C2), C1)
Craig Topper [Tue, 5 Jul 2022 23:01:41 +0000 (16:01 -0700)]
[RISCV] Add more SHXADD patterns where the input is (and (shl/shr X, C2), C1)

It might be possible to rewrite (and (shl/shr X, C2), C1) in a way
that gives us a left shift that can be folded into a SHXADD.

2 years ago[mlir:Parser] Don't use strings for the "ugly" form of Attribute/Type syntax
River Riddle [Tue, 5 Jul 2022 23:20:30 +0000 (16:20 -0700)]
[mlir:Parser] Don't use strings for the "ugly" form of Attribute/Type syntax

This commit refactors the syntax of "ugly" attribute/type formats to not use
strings for wrapping. This means that moving forward attirbutes and type formats
will always need to be in some recognizable form, i.e. if they use incompatible
characters they will need to manually wrap those in a string, the framework will
no longer do it automatically.

This has the benefit of greatly simplifying how parsing attributes/types work, given
that we currently rely on some extremely complicated nested parser logic which is
quite problematic for a myriad of reasons; unecessary complexity(we create a nested
source manager/lexer/etc.), diagnostic locations can be off/wrong given string escaping,
etc.

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

2 years ago[OpenMP] add 4 custom APIs supporting MSVC OMP codegen
Vadim Paretsky [Tue, 5 Jul 2022 22:20:32 +0000 (17:20 -0500)]
[OpenMP] add 4 custom APIs supporting MSVC OMP codegen

This check-in adds 4 APIs to support MSVC, specifically:

* 3 APIs (__kmpc_sections_init, __kmpc_next_section,
   __kmpc_end_sections) to support the dynamic scheduling of OMP sections.
* 1 API (__kmpc_copyprivate_light, a light-weight version of
  __kmpc_copyrprivate) to support the OMP single copyprivate clause.

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

2 years ago[AArch64][GlobalISel] Add support for sret demotion.
Amara Emerson [Mon, 4 Jul 2022 23:43:56 +0000 (16:43 -0700)]
[AArch64][GlobalISel] Add support for sret demotion.

To do this, we need to implement a target hook and make a minor change to the
call lowering to demote arguments to sret if they can't be handled by the
calling conventions.

Fixes issue 56295

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

2 years agoFix running orc-rt tests with LLVM_BUILD_EXTERNAL_COMPILER_RT (again).
Lang Hames [Tue, 5 Jul 2022 22:01:15 +0000 (15:01 -0700)]
Fix running orc-rt tests with LLVM_BUILD_EXTERNAL_COMPILER_RT (again).

Add missing dependency on lli when building compiler-rt with
LLVM_BUILD_EXTERNAL_COMPILER_RT. Previously we would non-deterministically fail
the tests due to the missing binary.

This is essentially identical to 0e5ea403e8d, which added an earlier dependence
on llvm-jitlink.

rdar://96467892

2 years ago[RISCV][Driver] Add libm linking to `RISCVToolchain` for C++
Anton Afanasyev [Fri, 1 Jul 2022 14:17:59 +0000 (17:17 +0300)]
[RISCV][Driver] Add libm linking to `RISCVToolchain` for C++

GCC automatically links math library by adding `-lm` to linker command
line, since C++ runtime `libstdc++` requires libm, so add it to
`RISCVToochain` as well.

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

2 years ago[LLDB] Remove TestLoadUnload.py Arm/Linux Xfail decorator
Muhammad Omair Javaid [Tue, 5 Jul 2022 21:39:49 +0000 (01:39 +0400)]
[LLDB] Remove TestLoadUnload.py Arm/Linux Xfail decorator

This is a follow up on my last commit where one of the decorator was
left unremoved.

This patch removes Xfail decorator from TestLoadUnload.py as it is now
passing on Arm/Linux buildbot.

2 years ago[NFC][HLSL] Add tests for vector alias. Remove dead code.
Chris Bieneman [Tue, 5 Jul 2022 20:38:06 +0000 (15:38 -0500)]
[NFC][HLSL] Add tests for vector alias. Remove dead code.

Based on feedback from @Aaron.Ballman.

Remove the unused static ID char (can re-add it later if needed).

Add test to cover some invalid HLSL vector instantations ensuring
that the appropriate error messages are generated.

2 years ago[LLDB] Remove TestLoadUnload.py Arm/Linux Xfail decorator
Muhammad Omair Javaid [Tue, 5 Jul 2022 21:13:54 +0000 (01:13 +0400)]
[LLDB] Remove TestLoadUnload.py Arm/Linux Xfail decorator

This patch removes Xfail decorator from TestLoadUnload.py as it is now
passing on Arm/Linux buildbot.

2 years ago[clang-tools-extra] Fix a link in ReleaseNotes.rst
Dmitri Gribenko [Tue, 5 Jul 2022 21:08:28 +0000 (23:08 +0200)]
[clang-tools-extra] Fix a link in ReleaseNotes.rst

2 years ago[gn build] Port 05130a6ba7d9
LLVM GN Syncbot [Tue, 5 Jul 2022 21:04:41 +0000 (21:04 +0000)]
[gn build] Port 05130a6ba7d9

2 years agonew clang-tidy checker for assignments within condition clause of if statement
Dmitri Gribenko [Tue, 5 Jul 2022 20:48:53 +0000 (22:48 +0200)]
new clang-tidy checker for assignments within condition clause of if statement

new clang-tidy checker for assignments within the condition clause of an 'if' statement.

Reviewed By: gribozavr2

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

2 years ago[RISCV] Add more SHXADD tests. NFC
Craig Topper [Tue, 5 Jul 2022 20:04:19 +0000 (13:04 -0700)]
[RISCV] Add more SHXADD tests. NFC

2 years ago[RISCV] Use a switch statement in PreprocessISelDAG. NFC
Craig Topper [Tue, 5 Jul 2022 18:58:03 +0000 (11:58 -0700)]
[RISCV] Use a switch statement in PreprocessISelDAG. NFC

This should make it easier to add more peepholes in the future.

2 years ago[RISCV] Update PreprocessISelDAG to use RemoveDeadNodes.
Craig Topper [Tue, 5 Jul 2022 16:37:58 +0000 (09:37 -0700)]
[RISCV] Update PreprocessISelDAG to use RemoveDeadNodes.

Instead of deleting nodes as we go, delete all dead nodes if a
change is made. This allows adding peepholes that might make
multiple nodes dead.

2 years ago[PowerPC] PPCTLSDynamicCall does not preserve LiveIntervals
Jay Foad [Thu, 23 Jun 2022 10:28:02 +0000 (11:28 +0100)]
[PowerPC] PPCTLSDynamicCall does not preserve LiveIntervals

According to D127731, PPCTLSDynamicCall does not preserve
LiveIntervals, so stop claiming that it does and remove the code
that tried to repair them. NFCI.

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

2 years ago[AMDGPU] NFC. Add a test of the error message for assembling global_atomic_cmpswap_x2
Joe Nash [Tue, 5 Jul 2022 18:15:07 +0000 (14:15 -0400)]
[AMDGPU] NFC. Add a test of the error message for assembling global_atomic_cmpswap_x2

2 years ago[Libomptarget][NFC] Make Libomptarget use the LLVM naming convention
Joseph Huber [Fri, 1 Jul 2022 15:48:15 +0000 (11:48 -0400)]
[Libomptarget][NFC] Make Libomptarget use the LLVM naming convention

Libomptarget grew out of a project that was originally not in LLVM. As
we develop libomptarget this has led to an increasingly large clash
between the naming conventions used. This patch fixes most of the
variable names that did not confrom to the LLVM standard, that is
`VariableName` for variables and `functionName` for functions.

This patch was primarily done using my editor's linting messages, if
there are any issues I missed arising from the automation let me know.

Reviewed By: saiislam

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

2 years ago[pseudo] Add error-recovery framework & brace-based recovery
Sam McCall [Wed, 29 Jun 2022 11:48:00 +0000 (13:48 +0200)]
[pseudo] Add error-recovery framework & brace-based recovery

The idea is:

- a parse failure is detected when all heads die when trying to shift the next token
- we can recover by choosing a nonterminal we're partway through parsing, and
  determining where it ends through nonlocal means (e.g. matching brackets)
- we can find candidates by walking up the stack from the (ex-)heads
- the token range is defined using heuristics attached to grammar rules
- the unparsed region is represented in the forest by an Opaque node

This patch has the core GLR functionality.
It does not allow recovery heuristics to be attached as extensions to
the grammar, but rather infers a brace-based heuristic.

Expected followups:

- make recovery heuristics grammar extensions (depends on D127448)
- add recovery to our grammar for bracketed constructs and sequence nodes
- change the structure of our augmented `_ := start` rules to eliminate some
  special-cases in glrParse.
- (if I can work out how): avoid some spurious recovery cases described in comments

(Previously mistakenly committed as a0f4c10ae227a62c2a63611e64eba83f0ff0f577)

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

2 years ago[InstCombine] avoid conflict between CHECK prefix and value name in test file; NFC
Sanjay Patel [Tue, 5 Jul 2022 17:35:47 +0000 (13:35 -0400)]
[InstCombine] avoid conflict between CHECK prefix and value name in test file; NFC

Tests can fail if a value name (%sqrt becomes SQRT) and that is the same as the RUN prefix.

2 years ago[InstCombine] add tests for sqrt libcalls; NFC
Sanjay Patel [Tue, 5 Jul 2022 13:44:29 +0000 (09:44 -0400)]
[InstCombine] add tests for sqrt libcalls; NFC

2 years ago[SimplifyCFG] Skip hoisting common instructions that return token type
Yuanfang Chen [Tue, 5 Jul 2022 17:56:19 +0000 (10:56 -0700)]
[SimplifyCFG] Skip hoisting common instructions that return token type

By LangRef, hoisting token-returning instructions obsures the origin
so it should be skipped. Found this issue while investigating a
CoroSplit pass crash.

Reviewed By: nikic

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

2 years ago[mlir][tblgen] Consistently use `$_ctxt` instead of `$_ctx`
Markus Böck [Tue, 5 Jul 2022 18:04:50 +0000 (20:04 +0200)]
[mlir][tblgen] Consistently use `$_ctxt` instead of `$_ctx`

With the exceptions of AttrOrTypeParameter and DerivedAttr, all of MLIR consistently uses $_ctxt as the substitute variable for the MLIRContext in TableGen C++ code.
Usually this does not matter unless one where to reuse some code in multiple fields but it is still needlessly inconsistent and prone to error.

This patch fixes that by consistently using _$ctxt everywhere.

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

2 years ago[LinkerWrapper] Add AMDGPU specific options to the LLD invocation
Joseph Huber [Thu, 30 Jun 2022 15:41:38 +0000 (11:41 -0400)]
[LinkerWrapper] Add AMDGPU specific options to the LLD invocation

We use LLD to perform AMDGPU linking. This linker accepts some arguments
through the `-plugin-opt` facilities. These options match what `Clang`
will output when given the same input.

Reviewed By: yaxunl

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

2 years ago[llvm-lib] Ignore /NODEFAULTLIB flag
Pengxuan Zheng [Sat, 2 Jul 2022 02:23:03 +0000 (19:23 -0700)]
[llvm-lib] Ignore /NODEFAULTLIB flag

It doesn't look like there is anything llvm-lib needs to handle based on
Microsoft's description of the flag.

https://docs.microsoft.com/en-us/cpp/build/reference/managing-a-library?view=msvc-170

Reviewed By: thakis

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

2 years agoRevert "[lldb/test] Don't use preexec_fn for launching inferiors"
Jonas Devlieghere [Tue, 5 Jul 2022 17:12:57 +0000 (10:12 -0700)]
Revert "[lldb/test] Don't use preexec_fn for launching inferiors"

This reverts commit b15b1421bc9a11b318b65b489e5fd58dd917db1f because it
breaks GreenDragon [1]. The bot has been red for several days, so
reverting to green while I take a look.

[1] https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45012/

2 years ago[analyzer] Fix assertion in simplifySymbolCast
Gabor Marton [Wed, 1 Jun 2022 14:29:51 +0000 (16:29 +0200)]
[analyzer] Fix assertion in simplifySymbolCast

Depends on D128068.
Added a new test code that fails an assertion in the baseline.
That is because `getAPSIntType` works only with integral types.

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

2 years ago[analyzer] Do not emit redundant SymbolCasts
Gabor Marton [Fri, 17 Jun 2022 16:19:55 +0000 (18:19 +0200)]
[analyzer] Do not emit redundant SymbolCasts

In `RegionStore::getBinding` we call `evalCast` unconditionally to align
the stored value's type to the one that is being queried. However, the
stored type might be the same, so we may end up having redundant
`SymbolCasts` emitted.

The solution is to check whether the `to` and `from` type are the same
in `makeNonLoc`.

Note, we can't just do type equivalence check at the beginning of `evalCast`
because when `evalCast` is called from `getBinding` then the original type
(`OriginalTy`) is not set, so one operand is missing for the comparison. In
`evalCastSubKind(nonloc::SymbolVal)` when the original type is not set,
we get the `from` type via `SymbolVal::getType()`.

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

2 years ago[gn build] Port b8dbc6ffea93
LLVM GN Syncbot [Tue, 5 Jul 2022 16:35:01 +0000 (16:35 +0000)]
[gn build] Port b8dbc6ffea93

2 years ago[LSR] Fix bug for optimizing unused IVs to final values
Zaara Syeda [Tue, 5 Jul 2022 16:16:08 +0000 (12:16 -0400)]
[LSR] Fix bug for optimizing unused IVs to final values

This is a fix for a crash reported for https://reviews.llvm.org/D118808
The fix is to only consider PHINodes which are induction phis.
Fixes #55529

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

2 years ago[HLSL] Add ExternalSemaSource & vector alias
Chris Bieneman [Thu, 16 Jun 2022 20:35:48 +0000 (15:35 -0500)]
[HLSL] Add ExternalSemaSource & vector alias

HLSL vector types are ext_vector types, but they are also exposed via a
template syntax `vector<T, #>`. This is morally equavalent to the code:

```c++
template <typename T, int Size>
using vector = T __attribute__((ext_vector_type(Size)))
```

The problem is that templates aren't supported before HLSL 2021, and
type aliases still aren't supported in HLSL.

To resolve this (and other issues where HLSL can't represent its own
types), we rely on an external AST & Sema source being registered for
HLSL code.

This patch adds the HLSLExternalSemaSource and registers the vector
type alias.

Depends on D127802

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

2 years ago[mlir][LLVMIR] Apply CallOp/CallableInterface on suitable operations
Min-Yih Hsu [Fri, 1 Jul 2022 22:29:02 +0000 (15:29 -0700)]
[mlir][LLVMIR] Apply CallOp/CallableInterface on suitable operations

  - Applying CallOpInterface on CallOp and InvokeOp.
  - Applying CallableInterface on LLVMFuncOp.

We're testing the changes using CallGraph, which uses both interfaces.

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

2 years ago[AMDGPU] GFX11 trivial NFC tweaks
Jay Foad [Tue, 5 Jul 2022 16:17:01 +0000 (17:17 +0100)]
[AMDGPU] GFX11 trivial NFC tweaks

A few miscellaneous comment, whitespace and indentation tweaks.

2 years ago[Thumb2] Remove unneeded IR from MIR test (NFC)
Nikita Popov [Tue, 5 Jul 2022 16:17:02 +0000 (18:17 +0200)]
[Thumb2] Remove unneeded IR from MIR test (NFC)

Apart from the global, the IR does not appear to be relevant for
the test. Drop it, to remove the dependence on the sdiv constant
expression.

2 years ago[VectorCombine] Improve shuffle select shuffle-of-shuffles
David Green [Tue, 5 Jul 2022 16:16:18 +0000 (17:16 +0100)]
[VectorCombine] Improve shuffle select shuffle-of-shuffles

This in an extension to the code added in D123911 which added vector
combine folding of shuffle-select patterns, attempting to reduce the
total amount of shuffling required in patterns like:
  %x = shuffle %i1, %i2
  %y = shuffle %i1, %i2
  %a = binop %x, %y
  %b = binop %x, %y
  shuffle %a, %b, selectmask

This patch extends the handing of shuffles that are dependent on one
another, which can arise from the SLP vectorizer, as-in:
  %x = shuffle %i1, %i2
  %y = shuffle %x

The input shuffles can also be emitted, in which case they are treated
like identity shuffles. This patch also attempts to calculate a better
ordering of input shuffles, which can help getting lower cost input
shuffles, pushing complex shuffles further down the tree.

This is a recommit with some additional checks for supported forms and
out-of-bounds mask elements, with some extra tests.

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

2 years ago[Assembler] Name globals in test (NFC)
Nikita Popov [Tue, 5 Jul 2022 16:01:25 +0000 (18:01 +0200)]
[Assembler] Name globals in test (NFC)

This makes it easier to modify the test without having to renumber
everything.

2 years agoRevert "[mlir][sparse] add more unittest cases to sparse dialect merger"
Stella Stamenova [Tue, 5 Jul 2022 15:52:54 +0000 (08:52 -0700)]
Revert "[mlir][sparse] add more unittest cases to sparse dialect merger"

This broke the windows mlir bot: https://lab.llvm.org/buildbot/#/builders/13/builds/22743

This reverts commit daeb2dcea09820d92f81db84623cf1c6df825e14 and 537db49596f65a05c0309cf3333fc44f1657e999.

2 years ago[DAG] visitREM - use isAllOnesOrAllOnesSplat instead of isConstOrConstSplat
Simon Pilgrim [Tue, 5 Jul 2022 15:44:21 +0000 (16:44 +0100)]
[DAG] visitREM - use isAllOnesOrAllOnesSplat instead of isConstOrConstSplat

We were only using the N1C scalar/splat value once, so for clarity use isAllOnesOrAllOnesSplat instead if we actually need it.

2 years ago[DAG] foldAddSubOfSignBit - don't bother creating the new shift node unless constant...
Simon Pilgrim [Tue, 5 Jul 2022 15:27:30 +0000 (16:27 +0100)]
[DAG] foldAddSubOfSignBit - don't bother creating the new shift node unless constant folding succeeds

Noticed by inspection - the new shift is only ever used if the constant fold occurs

2 years ago[MLIR][Presburger] Rename attachments to identifiers in PresburgerSpace
Groverkss [Tue, 5 Jul 2022 15:15:43 +0000 (16:15 +0100)]
[MLIR][Presburger] Rename attachments to identifiers in PresburgerSpace

"attachment" was a temporary name chosen for the information attached to a
variable in a PresburgerSpace. After the disambiguation of "variables" and
"identifiers" in PresburgerSpace, we use the word "identifiers" for this
information, since this information is used to "identify" these variables.

Reviewed By: arjunp

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

2 years ago[AMDGPU] Add patterns for GFX11 v_minmax and v_maxmin instructions
Jay Foad [Thu, 23 Jun 2022 14:32:50 +0000 (15:32 +0100)]
[AMDGPU] Add patterns for GFX11 v_minmax and v_maxmin instructions

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

2 years ago[BUILD] Add missed CMakeLists.txt change from dfb77f2
Ben Dunbobbin [Tue, 5 Jul 2022 15:01:27 +0000 (16:01 +0100)]
[BUILD] Add missed CMakeLists.txt change from dfb77f2

See: https://reviews.llvm.org/D128195

2 years ago[mlir][memref][NFC] Silence compiler warnings
Matthias Springer [Tue, 5 Jul 2022 15:01:40 +0000 (17:01 +0200)]
[mlir][memref][NFC] Silence compiler warnings

2 years ago[mlir][interfaces][NFC] Remove ViewLikeInterface::expandToRank
Matthias Springer [Tue, 5 Jul 2022 14:54:38 +0000 (16:54 +0200)]
[mlir][interfaces][NFC] Remove ViewLikeInterface::expandToRank

This helper function is no longer needed.

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

2 years agoRevert "[SimplifyCFG] Thread branches on same condition in more cases (PR54980)"
Nikita Popov [Tue, 5 Jul 2022 08:56:54 +0000 (10:56 +0200)]
Revert "[SimplifyCFG] Thread branches on same condition in more cases (PR54980)"

This reverts commit 4e545bdb355a470d601e9bb7f7b2693c99e61a3e.

The newly added test is the third infinite combine loop caused by
this change. In this case, it's a combination of the branch to
common dest and jump threading folds that keeps peeling off loop
iterations.

The core problem here is that we ideally would not thread over
loop backedges, both because it is potentially non-profitable
(it may break canonical loop structure) and because it may result
in these kinds of loops. Unfortunately, due to the lack of a
dominator tree in SimplifyCFG, there is no good way to prevent
this. While we have LoopHeaders, this is an optional structure and
we don't do a good job of keeping it up to date. It would be fine
for a profitability check, but is not suitable for a correctness
check.

So for now I'm just giving up here, as I don't see a good way to
robustly prevent infinite combine loops.

Fixes https://github.com/llvm/llvm-project/issues/56203.

2 years ago[mlir][memref] Improve type inference for rank-reducing subviews
Matthias Springer [Tue, 5 Jul 2022 14:39:29 +0000 (16:39 +0200)]
[mlir][memref] Improve type inference for rank-reducing subviews

The result shape of a rank-reducing subview cannot be inferred in the general case. Just the result rank is not enough. The only thing that we can infer is the layout map.

This change also improves the bufferization patterns of tensor.extract_slice and tensor.insert_slice to fully support rank-reducing operations.

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

2 years ago[AMDGPU] gfx11 CodeGen for new DPP instructions
Joe Nash [Mon, 27 Jun 2022 17:20:21 +0000 (13:20 -0400)]
[AMDGPU] gfx11 CodeGen for new DPP instructions

Modifies the GCNDPPCombine pass to enable DPP formation for the new DPP
instruction in gfx11, namely VOP3 encoded instructions with DPP and VOPC
with DPP.

Depends on D128656

Reviewed By: #amdgpu, rampitec

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

2 years ago[mlir][tensor][bufferize][NFC] Clean up test case
Matthias Springer [Tue, 5 Jul 2022 13:36:02 +0000 (15:36 +0200)]
[mlir][tensor][bufferize][NFC] Clean up test case

Insert -split-input-file flag to make the test cases more stable.

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

2 years ago[gn build] Port d1af09ad9617
LLVM GN Syncbot [Tue, 5 Jul 2022 13:57:20 +0000 (13:57 +0000)]
[gn build] Port d1af09ad9617

2 years ago[pseudo] Implement guard extension.
Haojian Wu [Fri, 1 Jul 2022 12:50:07 +0000 (14:50 +0200)]
[pseudo] Implement guard extension.

- Extend the GLR parser to allow conditional reduction based on the
  guard functions;
- Implement two simple guards (contextual-override/final) for cxx.bnf;
- layering: clangPseudoCXX depends on clangPseudo (as the guard function need
  to access the TokenStream);

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

2 years ago[ConstExpr] Don't create div/rem expressions
Nikita Popov [Wed, 29 Jun 2022 12:27:04 +0000 (14:27 +0200)]
[ConstExpr] Don't create div/rem expressions

This removes creation of udiv/sdiv/urem/srem constant expressions,
in preparation for their removal. I've added a
ConstantExpr::isDesirableBinOp() predicate to determine whether
an expression should be created for a certain operator.

With this patch, div/rem expressions can still be created through
explicit IR/bitcode, forbidding them entirely will be the next step.

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

2 years ago[clang][dataflow] Handle null pointers of type std::nullptr_t
Eric Li [Mon, 4 Jul 2022 20:46:07 +0000 (20:46 +0000)]
[clang][dataflow] Handle null pointers of type std::nullptr_t

Treat `std::nullptr_t` as a regular scalar type to avoid tripping
assertions when analyzing code that uses `std::nullptr_t`.

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

2 years ago[AMDGPU] gfx11 Generate VOPD Instructions
Joe Nash [Thu, 23 Jun 2022 19:57:01 +0000 (15:57 -0400)]
[AMDGPU] gfx11 Generate VOPD Instructions

We form VOPD  instructions in the GCNCreateVOPD pass by combining
back-to-back component instructions. There are strict register
constraints for creating a legal VOPD, namely that the matching operands
(e.g. src0x and src0y, src1x and src1y) must be in different register
banks. We add a PostRA scheduler
mutation to put possible VOPD components back-to-back.

Depends on D128442, D128270

Reviewed By: #amdgpu, rampitec

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

2 years ago[pseudo] Fix the build for the benchmark tool.
Haojian Wu [Tue, 5 Jul 2022 13:40:02 +0000 (15:40 +0200)]
[pseudo] Fix the build for the benchmark tool.

2 years ago[RuntimeDyld] Fix R_AARCH64_TSTBR14 relocation
Vladislav Khmelevsky [Tue, 28 Jun 2022 16:54:59 +0000 (19:54 +0300)]
[RuntimeDyld] Fix R_AARCH64_TSTBR14 relocation

Wrong mask was used to get branch instruction imm value.

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

2 years ago[SCEV] Fix isImpliedViaMerge() with values from previous iteration (PR56242)
Nikita Popov [Mon, 27 Jun 2022 13:09:24 +0000 (15:09 +0200)]
[SCEV] Fix isImpliedViaMerge() with values from previous iteration (PR56242)

When trying to prove an implied condition on a phi by proving it
for all incoming values, we need to be careful about values coming
from a backedge, as these may refer to a previous loop iteration.
A variant of this issue was fixed in D101829, but the dominance
condition used there isn't quite right: It checks that the value
dominates the incoming block, which doesn't exclude backedges
(values defined in a loop will usually dominate the loop latch,
which is the incoming block of the backedge).

Instead, we should be checking for domination of the phi block.
Any values defined inside the loop will not dominate the loop
header phi.

Fixes https://github.com/llvm/llvm-project/issues/56242.

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

2 years ago[Compiler-RT] Remove FlushViewOfFile call when unmapping gcda files on win32.
Andi-Bogdan Postelnicu [Tue, 5 Jul 2022 09:07:15 +0000 (09:07 +0000)]
[Compiler-RT]  Remove FlushViewOfFile call when unmapping gcda files on win32.

This patch was pushed for calixte@mozilla.com

- this function (Windows only) is called when gcda are dumped on disk;
- according to its documentation, it's only useful in case of hard failures, this is highly improbable;
- it drastically decreases the time in the tests and consequently it avoids timeouts when we use slow disks.

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

2 years ago[pseudo] Use the prebuilt cxx grammar for the lit tests, NFC.
Haojian Wu [Mon, 4 Jul 2022 12:15:51 +0000 (14:15 +0200)]
[pseudo] Use the prebuilt cxx grammar for the lit tests, NFC.

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

2 years ago[AMDGPU][NFC] Refine matching SMRD offsets.
Ivan Kosarev [Tue, 5 Jul 2022 13:06:36 +0000 (14:06 +0100)]
[AMDGPU][NFC] Refine matching SMRD offsets.

Tell the matcher what we are looking for instead of matching everything
and then discarding the result if doesn't fit.

Reviewed By: foad

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

2 years ago[AMDGPU][GlobalISel] Support register offsets for SMRDs.
Ivan Kosarev [Tue, 5 Jul 2022 12:39:46 +0000 (13:39 +0100)]
[AMDGPU][GlobalISel] Support register offsets for SMRDs.

Reviewed By: foad

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

2 years ago[pseudo] Eliminate LRTable::Action. NFC
Sam McCall [Mon, 4 Jul 2022 18:35:40 +0000 (20:35 +0200)]
[pseudo] Eliminate LRTable::Action. NFC

The last remaining uses are in tests/test builders.
Replace with a builder struct.

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

2 years ago[SimplifyCFG] Thread all predecessors with same value at once
Nikita Popov [Tue, 5 Jul 2022 10:21:06 +0000 (12:21 +0200)]
[SimplifyCFG] Thread all predecessors with same value at once

If there are multiple predecessors that have the same condition
value (and thus same "real destination"), these were previously
handled by copying the threaded block for each predecessor.
Instead, we can reuse one block for all of them. This makes the
behavior of SimplifyCFG's jump threading match that of the
actual JumpThreading pass.

This also avoids the infinite combine loop reported in:
https://reviews.llvm.org/D124159#3624387

2 years ago[LV] Remove stray dbgs() call after 774fc63490939.
Florian Hahn [Tue, 5 Jul 2022 11:58:13 +0000 (12:58 +0100)]
[LV] Remove stray dbgs() call after  774fc63490939.

2 years ago[SimplifyCFG] Add additional jump threading test (NFC)
Nikita Popov [Tue, 5 Jul 2022 11:57:16 +0000 (13:57 +0200)]
[SimplifyCFG] Add additional jump threading test (NFC)

A case where multiple predecessors can be threaded over the same
edge, with a phi node in the threaded block.

2 years ago[clang-extdef-mapping] Directly process .ast files
Tobias Hieta [Tue, 5 Jul 2022 11:45:32 +0000 (13:45 +0200)]
[clang-extdef-mapping] Directly process .ast files

When doing CTU analysis setup you pre-compile .cpp to .ast and then
you run clang-extdef-mapping on the .cpp file as well. This is a
pretty slow process since we have to recompile the file each time.

With this patch you can now run clang-extdef-mapping directly on
the .ast file. That saves a lot of time.

I tried this on llvm/lib/AsmParser/Parser.cpp and running
extdef-mapping on the .cpp file took 5.4s on my machine.

While running it on the .ast file it took 2s.

This can save a lot of time for the setup phase of CTU analysis.

Reviewed By: martong

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

2 years ago[NFC] Fix wrong comment.
Thomas Symalla [Tue, 5 Jul 2022 11:37:44 +0000 (13:37 +0200)]
[NFC] Fix wrong comment.

2 years ago[LLDB] Fix decorator import in TestTwoHitsOneActual.py
Muhammad Omair Javaid [Tue, 5 Jul 2022 11:26:14 +0000 (15:26 +0400)]
[LLDB] Fix decorator import in TestTwoHitsOneActual.py

2 years ago[MLIR][Affine] Allow `<=` in IntegerSet constraints
Groverkss [Tue, 5 Jul 2022 11:17:24 +0000 (12:17 +0100)]
[MLIR][Affine] Allow `<=` in IntegerSet constraints

This patch extends the affine parser to allow affine constraints with `<=`.
This is useful in writing unittests for Presburger library and test in general.

The internal storage and printing of IntegerSet is still in the original format.

Reviewed By: bondhugula

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

2 years agoUpdating office hours
Alexey Bader [Tue, 5 Jul 2022 11:11:45 +0000 (07:11 -0400)]
Updating office hours

2 years ago[LLDB] Skip TestTwoHitsOneActual.py on Arm/AArch64 Linux
Muhammad Omair Javaid [Tue, 5 Jul 2022 11:00:53 +0000 (15:00 +0400)]
[LLDB] Skip TestTwoHitsOneActual.py on Arm/AArch64 Linux

This test has some race condition which is making it hang on LLDB
Arm/AArch64 Linux buildbot. I am marking it as skipped until we
investigate whats going wrong.

2 years ago[VE] Restructure eliminateFrameIndex
Kazushi (Jam) Marukawa [Tue, 5 Jul 2022 10:38:06 +0000 (19:38 +0900)]
[VE] Restructure eliminateFrameIndex

Restructure the current implementation of eliminateFrameIndex function
in order to support more instructions.

Reviewed By: efocht

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

2 years agoCorrect XFAIL according to bot owner's advice
Jun Zhang [Tue, 5 Jul 2022 10:43:21 +0000 (18:43 +0800)]
Correct XFAIL according to bot owner's advice

Signed-off-by: Jun Zhang <jun@junz.org>
2 years ago[clang-tidy] By-pass portability issues in confusable-identifiers test
serge-sans-paille [Tue, 5 Jul 2022 10:19:00 +0000 (12:19 +0200)]
[clang-tidy] By-pass portability issues in confusable-identifiers test

2 years agoRevert "[VE] Restructure eliminateFrameIndex"
Kazushi (Jam) Marukawa [Tue, 5 Jul 2022 10:35:12 +0000 (19:35 +0900)]
Revert "[VE] Restructure eliminateFrameIndex"

This reverts commit 98e52e8bff525b1fb2b269f74b27f0a984588c9c.

2 years ago[VE] Restructure eliminateFrameIndex
Kazushi (Jam) Marukawa [Sat, 2 Jul 2022 05:06:17 +0000 (14:06 +0900)]
[VE] Restructure eliminateFrameIndex

Restructure the current implementation of eliminateFrameIndex function
in order to support more instructions.

Reviewed By: efocht

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

2 years agoReland "Reland "[NFC] Add a missing test for for clang-repl""
Jun Zhang [Tue, 5 Jul 2022 04:32:12 +0000 (12:32 +0800)]
Reland "Reland "[NFC] Add a missing test for for clang-repl""

This reverts commit 6956840b5c0029d7f8e043b3c77bb1ffc230e4d5.
Try to use `XFAIL: windows-msvc || ps4` to disable all unsupported targets.

Signed-off-by: Jun Zhang <jun@junz.org>
2 years ago[LLDB] Disable TestGdbRemoteFork* for Arm/AArch64 Linux
Muhammad Omair Javaid [Tue, 5 Jul 2022 09:16:23 +0000 (13:16 +0400)]
[LLDB] Disable TestGdbRemoteFork* for Arm/AArch64 Linux

This test is causing some trouble with LLDB Arm/AArch64 Linux buildbot.
I am disabling is temporarily to make buildbot green.

2 years ago[ARM] Add Support for Cortex-M85
Archibald Elliott [Tue, 5 Jul 2022 09:43:31 +0000 (10:43 +0100)]
[ARM] Add Support for Cortex-M85

This patch adds support for Arm's Cortex-M85 CPU. The Cortex-M85 CPU is
an Arm v8.1m Mainline CPU, with optional support for MVE and PACBTI,
both of which are enabled by default.

Parts have been coauthored by by Mark Murray, Alexandros Lamprineas and
David Green.

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

2 years agoFix tests with non-default CLANG_DEFAULT_LINKER
Yi Kong [Tue, 5 Jul 2022 09:26:34 +0000 (17:26 +0800)]
Fix tests with non-default CLANG_DEFAULT_LINKER

Force -fuse-ld option, as some other tests in the same file do.

2 years ago[OpenCL] Remove fast_ half geometric builtins
Sven van Haastregt [Tue, 5 Jul 2022 09:22:34 +0000 (10:22 +0100)]
[OpenCL] Remove fast_ half geometric builtins

These are not mentioned in the OpenCL C Specification nor in the
OpenCL Extension Specification.

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

2 years ago[IndVars] Precommit test with redundant FPToSI.
Florian Hahn [Tue, 5 Jul 2022 09:21:33 +0000 (10:21 +0100)]
[IndVars] Precommit test with redundant FPToSI.

Test for #55505.

2 years ago[InstCombine] improve fold for icmp_eq_and to icmp_ult
Chenbing Zheng [Tue, 5 Jul 2022 09:14:22 +0000 (17:14 +0800)]
[InstCombine] improve fold for icmp_eq_and to icmp_ult

In D95959, the improve analysis for "C >> X" broken the fold
((%x & C) == 0) --> %x u< (-C) iff (-C) is power of two.

It simplifies C, but fails to satisfy the fold condition.
This patch try to restore C before the fold.

Reviewed By: spatel

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

2 years ago[gn build] (manually) port 6b3956e123db
Peter Waller [Mon, 4 Jul 2022 14:10:02 +0000 (14:10 +0000)]
[gn build] (manually) port 6b3956e123db

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

2 years ago[InstCombine] [NFC] use C.isNegatedPowerOf2() instead of (~C + 1).isPowerOf2()
Chenbing Zheng [Tue, 5 Jul 2022 09:02:52 +0000 (17:02 +0800)]
[InstCombine] [NFC] use C.isNegatedPowerOf2() instead of (~C + 1).isPowerOf2()

Reviewed By: RKSimon

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

2 years ago[gn build] (manually) port dfb77f2e99a1
Nico Weber [Tue, 5 Jul 2022 08:59:41 +0000 (10:59 +0200)]
[gn build] (manually) port dfb77f2e99a1

2 years ago[lldb] Add support to load object files from thin archives
Kaining Zhong [Tue, 5 Jul 2022 08:50:37 +0000 (10:50 +0200)]
[lldb] Add support to load object files from thin archives

This fixes https://github.com/llvm/llvm-project/issues/50114 where lldb/mac
can't load object files from thin archives.  This patch allows lldb to identify
thin archives, and load object files contained in them.

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

2 years ago[InstCombine] add negtive tests for (%x & C) == 0 -> %x u< (-C). nfc
Chenbing Zheng [Tue, 5 Jul 2022 08:48:49 +0000 (16:48 +0800)]
[InstCombine] add negtive tests for (%x & C) == 0 -> %x u< (-C). nfc

2 years ago[AArch64][SME] Add SME addha/va intrinsics
David Sherwood [Wed, 15 Jun 2022 14:10:16 +0000 (15:10 +0100)]
[AArch64][SME] Add SME addha/va intrinsics

This patch adds new the following SME intrinsics:

  @llvm.aarch64.sme.addva
  @llvm.aarch64.sme.addha

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

2 years ago[LLD][ELF] Add FORCE_LLD_DIAGNOSTICS_CRASH to force LLD to crash
Ben Dunbobbin [Fri, 1 Jul 2022 15:45:09 +0000 (16:45 +0100)]
[LLD][ELF] Add FORCE_LLD_DIAGNOSTICS_CRASH to force LLD to crash

Add FORCE_LLD_DIAGNOSTICS_CRASH inspired by the existing
FORCE_CLANG_DIAGNOSTICS_CRASH.

This is particularly useful for people customizing LLD as they may
want to modify the crash reporting behavior.

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

2 years ago[LV] Consider minimum vscale assmuption for RT check cost.
Florian Hahn [Tue, 5 Jul 2022 08:41:58 +0000 (09:41 +0100)]
[LV] Consider minimum vscale assmuption for RT check cost.

For scalable VFs, the minimum assumed vscale needs to be included in the
cost-computation, otherwise a smaller VF may be used for RT check cost
computation than was used for earlier cost computations.

Fixes a RISCV test failing with UBSan due to both scalar and vector
loops having the same cost.

2 years ago[mlir][Linalg] Add DropUnitDims support for tensor::ParallelInsertSliceOp.
Nicolas Vasilache [Mon, 4 Jul 2022 16:48:18 +0000 (09:48 -0700)]
[mlir][Linalg] Add DropUnitDims support for tensor::ParallelInsertSliceOp.

ParallelInsertSlice behaves similarly to tensor::InsertSliceOp in its
rank-reducing properties.
This revision extends rank-reducing rewrite behavior and reuses most of the
existing implementation.

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