platform/upstream/llvm.git
2 years ago[lldb] Remove summary for signed char *
Pavel Labath [Thu, 6 Jan 2022 18:50:44 +0000 (19:50 +0100)]
[lldb] Remove summary for signed char *

It conflicts with the summary for BOOL * (aka signed char *). This
partially reverts D112709.

2 years ago[mlir][Linalg] Disable fusion of reshape with elementwise ops for purely dynamic...
MaheshRavishankar [Thu, 6 Jan 2022 18:31:53 +0000 (10:31 -0800)]
[mlir][Linalg] Disable fusion of reshape with elementwise ops for purely dynamic cases.

`tensor.collapse_shape` op when fused with a consumer elementwise
`linalg.generic` operation results in creation of tensor.expand_shape
ops. In purely dynamic cases this can end up with a dynamic dimensions
being expanded to more than one dynamic dimension. This is disallowed
by the semantics of `tensor.expand_shape` operation. (While the
transformation is itself correct, its a gap in the specification of
`tensor.expand_shape` that is the issue). So disallow fusions which
result in such a pattern.

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

2 years ago[InstCombine] Factor out a common pattern match used 3 times. NFC.
Stanislav Mekhanoshin [Thu, 23 Dec 2021 00:08:14 +0000 (16:08 -0800)]
[InstCombine] Factor out a common pattern match used 3 times. NFC.

This is needed for the next patch which will add more patterns
to the same match.

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

2 years agoRevert "[AArch64] Emit .cfi_negate_ra_state for PAC-auth instructions."
Daniel Kiss [Thu, 6 Jan 2022 18:17:45 +0000 (19:17 +0100)]
Revert "[AArch64] Emit .cfi_negate_ra_state for PAC-auth instructions."

This reverts commit f903c8505515f15e956febbd8cdfa0037fbaf689.

2 years ago[libc++] Implement P1425R4 (Iterator pair constructors for std::stack and std::queue)
Nikolas Klauser [Thu, 6 Jan 2022 11:36:07 +0000 (12:36 +0100)]
[libc++] Implement P1425R4 (Iterator pair constructors for std::stack and std::queue)

Implement P1425R4

Reviewed By: Quuxplusone, #libc, Mordante

Spies: Mordante, jloser, libcxx-commits, arichardson

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

2 years ago[libc++] Re-enable `GCC11 / C++11`, `Clang 12` and `ASAN` CI-runs
Nikolas Klauser [Thu, 6 Jan 2022 17:51:25 +0000 (18:51 +0100)]
[libc++] Re-enable `GCC11 / C++11`, `Clang 12` and `ASAN` CI-runs

2 years ago[DFSan] Refactor dfsan_mem_shadow_transfer.
Andrew Browne [Wed, 5 Jan 2022 22:54:28 +0000 (14:54 -0800)]
[DFSan] Refactor dfsan_mem_shadow_transfer.

Reviewed By: morehouse

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

2 years ago[Hexagon] Some compound opportunities missed in presence of branches
Colin LeMahieu [Thu, 6 Jan 2022 17:24:31 +0000 (09:24 -0800)]
[Hexagon] Some compound opportunities missed in presence of branches

2 years ago[AArch64] Add basic umulo and smulo costs
David Green [Thu, 6 Jan 2022 17:22:47 +0000 (17:22 +0000)]
[AArch64] Add basic umulo and smulo costs

This adds some AArch64 specific smul_with_overflow and umul_with_overflow
costs, overriding the default costs. The code generation for these mul
with overflow intrinsics is usually better than the default expansion on
AArch64. The costs come from https://godbolt.org/z/zEzYhMWqo with various
types, or llvm/test/CodeGen/AArch64/arm64-xaluo.ll.

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

2 years ago[libc++] [test] XFAIL "span.cons/initializer_list.pass.cpp" for apple-clang-12.
Arthur O'Dwyer [Thu, 6 Jan 2022 17:15:28 +0000 (12:15 -0500)]
[libc++] [test] XFAIL "span.cons/initializer_list.pass.cpp" for apple-clang-12.

This should have been done in 6a6a80e88e, but buildkite was down so I
hadn't noticed. This brings this test file into line with several others
in this directory.

2 years ago[LowerMatrixIntrinsics] writeFnName - don't dereference a dyn_cast<>. NFC.
Simon Pilgrim [Thu, 6 Jan 2022 17:09:09 +0000 (17:09 +0000)]
[LowerMatrixIntrinsics] writeFnName - don't dereference a dyn_cast<>. NFC.

dyn_cast<> can return null - use cast<> instead to assert the cast is valid before dereferencing the casted pointer.

Fixes static-analyzer null dereference warning.

2 years ago[Hexagon] Consider HVX reg aliases for .cur warning
Brian Cain [Fri, 28 Sep 2018 15:14:11 +0000 (10:14 -0500)]
[Hexagon] Consider HVX reg aliases for .cur warning

2 years ago[unroll] Strengthen verification of analysis updates under expensive asserts
Philip Reames [Thu, 6 Jan 2022 16:50:09 +0000 (08:50 -0800)]
[unroll] Strengthen verification of analysis updates under expensive asserts

I am suspecting a bug around updates of loop info for unreachable exits, but don't have a test case.  Running this locally on make check didn't reveal anything, we'll see if the expensive checks bots find it.

2 years ago[flang] Separate temporary and user-specified object files
Andrzej Warzynski [Tue, 4 Jan 2022 11:02:11 +0000 (11:02 +0000)]
[flang] Separate temporary and user-specified object files

This patch updates the `flang` bash scripts to differentiate between
object files provided by the user and intermediate object files
generated by the script. The latter are an "implementation detail" that
should not be visible to the end user (i.e. deleted before the scripts
exits). The former should be preserved.

Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1348

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

2 years ago[gn build] Port 56ca11e31e6a
LLVM GN Syncbot [Thu, 6 Jan 2022 16:28:57 +0000 (16:28 +0000)]
[gn build] Port 56ca11e31e6a

2 years ago[RISCV] Use simm5_plus1_nonzero in isel patterns for vmsgeu.vi/vmsltu.vi intrinsics.
Craig Topper [Thu, 6 Jan 2022 16:24:32 +0000 (08:24 -0800)]
[RISCV] Use simm5_plus1_nonzero in isel patterns for vmsgeu.vi/vmsltu.vi intrinsics.

The 0 immediate can't be selected to vmsgtu.vi/vmsleu.vi by decrementing
the immediate. To prevent his we had special patterns that provided
alternate lowering for the 0 cases. This relied on tablegen prioritizing
the 0 pattern over the sim5_plus1 range.

This patch introduces simm5_plus1_nonzero that excludes 0. It also
excludes the special case for vmsltu.vi since we can just use
vmsltu.vx and let the 0 be selected to X0.

This is an alternative to some of the changes in D116584.

Reviewed By: Chenbing.Zheng, asb

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

2 years ago[CMake] Include ZLIB_ROOT in LLVMConfig.cmake
Jake Egan [Thu, 6 Jan 2022 16:22:09 +0000 (11:22 -0500)]
[CMake] Include ZLIB_ROOT in LLVMConfig.cmake

Include the value of `ZLIB_ROOT` in `LLVMConfig.cmake` so `FindZLIB` can pick it up. This fixes an issue where ZLIB is not found on AIX runtimes despite specifying `-DZLIB_ROOT`.

Reviewed By: daltenty

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

2 years ago[RISCV] Add an MIR pass to replace redundant sext.w instructions with copies.
Craig Topper [Thu, 6 Jan 2022 16:17:07 +0000 (08:17 -0800)]
[RISCV] Add an MIR pass to replace redundant sext.w instructions with copies.

Function calls and compare instructions tend to cause sext.w
instructions to be inserted. If we make good use of W instructions,
these operations can often end up being redundant. We don't always
detect these during SelectionDAG due to things like phis. There also
some cases caused by failure to turn extload into sextload in
SelectionDAG. extload selects to LW allowing later sext.ws to become
redundant.

This patch adds a pass that examines the input of sext.w instructions trying
to determine if it is already sign extended. Either by finding a
W instruction, other instructions that produce a sign extended result,
or looking through instructions that propagate sign bits. It uses
a worklist and visited set to search as far back as necessary.

Reviewed By: asb, kito-cheng

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

2 years agoFix build failure with GCC 11 in C++20 mode
Evgeny Mandrikov [Thu, 6 Jan 2022 16:01:05 +0000 (17:01 +0100)]
Fix build failure with GCC 11 in C++20 mode

See https://wg21.link/cwg2237

Reviewed By: shafik, dexonsmith

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

2 years ago[RISCV] Don't advertise i32->i64 zextload as free for RV64.
Craig Topper [Thu, 6 Jan 2022 16:13:41 +0000 (08:13 -0800)]
[RISCV] Don't advertise i32->i64 zextload as free for RV64.

The zextload hook is only used to determine whether to insert a
zero_extend or any_extend for narrow types leaving a basic block.
Returning true from this hook tends to cause any load whose output
leaves the basic block to become an LWU instead of an LW.

Since we tend to prefer sexts for i32 compares on RV64, this can
cause extra sext.w instructions to be created in other basic blocks.

If we use LW instead of LWU this gives the MIR pass from D116397
a better chance of removing them.

Another option might be to teach getPreferredExtendForValue in
FunctionLoweringInfo.cpp about our preference for sign_extend of
i32 compares. That would cause SIGN_EXTEND to be chosen for any
value used by a compare instead of using the isZExtFree heuristic.
That will require code to convert from the llvm::Type* to EVT/MVT
as well as querying the type legalization actions to get the
promoted type in order to call TargetLowering::isSExtCheaperThanZExt.
That seemed like many extra steps when no other target wants it.
Though it would avoid us needing to lean on the MIR pass in some cases.

Reviewed By: asb

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

2 years ago[RISCV] Change RISCVISD::FCVT*RTZ opcodes to take rounding mode as an operand.
Craig Topper [Thu, 6 Jan 2022 07:14:19 +0000 (23:14 -0800)]
[RISCV] Change RISCVISD::FCVT*RTZ opcodes to take rounding mode as an operand.

Pre-work for a future change that will use these opcodes with other
rounding modes.

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

2 years ago[EarlyCSE] Support opaque pointers
Nikita Popov [Tue, 28 Dec 2021 15:00:33 +0000 (16:00 +0100)]
[EarlyCSE] Support opaque pointers

Explicitly check the load/store value type, because this is no
longer implicitly checked through the pointer type.

2 years ago[AST] ASTContext::mergeTypes - pull out repeated getAs<> calls. NFC.
Simon Pilgrim [Thu, 6 Jan 2022 16:04:26 +0000 (16:04 +0000)]
[AST] ASTContext::mergeTypes - pull out repeated getAs<> calls. NFC.

Avoids static-analyzer null dereference warnings.

2 years agoAMDGPU: Clear NoPHIs property in SIOptimizeVGPRLiveRanges
Matt Arsenault [Thu, 6 Jan 2022 00:30:21 +0000 (19:30 -0500)]
AMDGPU: Clear NoPHIs property in SIOptimizeVGPRLiveRanges

Fixes verifier error when writing MIR tests that didn't have phis to
begin with.

2 years ago[mlir][linalg][bufferize][NFC] Use RewritePatterns instead of custom traversal
Matthias Springer [Thu, 6 Jan 2022 15:50:21 +0000 (00:50 +0900)]
[mlir][linalg][bufferize][NFC] Use RewritePatterns instead of custom traversal

This change simplifies BufferizableOpInterface and other functions. Overall, the API will get smaller: Functions related to custom IR traversal are deleted entirely. This will makes it easier to write BufferizableOpInterface implementations.

This is also in preparation of unifying Comprehensive Bufferize and core bufferization. While Comprehensive Bufferize could theoretically maintain its own IR traversal, there is no reason to do so, because all bufferize implementations in BufferizableOpInterface have to support partial bufferization anyway. And we can share a larger part of the code base between the two bufferizations.

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

2 years agoReland "[clang][ObjC] Add fix it for missing methods in impl"
David Goldman [Thu, 6 Jan 2022 15:24:14 +0000 (10:24 -0500)]
Reland "[clang][ObjC] Add fix it for missing methods in impl"

This reverts commit 37be74885946f18dbeb70343ad659924c61d2549/
relands https://reviews.llvm.org/D116417 now that the internal
issue has been fixed.

2 years ago[clang][lex] NFC: Move some HeaderSearch functions to .cpp file
Jan Svoboda [Thu, 6 Jan 2022 15:22:36 +0000 (16:22 +0100)]
[clang][lex] NFC: Move some HeaderSearch functions to .cpp file

2 years ago[mlir][linalg][bufferize][NFC] Pass BufferizationState as const reference
Matthias Springer [Thu, 6 Jan 2022 15:16:16 +0000 (00:16 +0900)]
[mlir][linalg][bufferize][NFC] Pass BufferizationState as const reference

This is mostly for documentation purposes: Passing the object as a const reference signifies that analysis decisions cannot be changed after the analysis.

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

2 years ago[libc++][NFC] Reformat <__filesystem/operations.h>
Nikolas Klauser [Thu, 23 Dec 2021 22:26:49 +0000 (23:26 +0100)]
[libc++][NFC] Reformat <__filesystem/operations.h>

Reformat `<__filesystem/operations.h>`

Reviewed By: Quuxplusone, #libc, ldionne

Spies: ldionne, libcxx-commits

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

2 years ago[MemCpyOptimizer] hasUndefContents - only look for underlying object if we've found...
Simon Pilgrim [Thu, 6 Jan 2022 15:14:53 +0000 (15:14 +0000)]
[MemCpyOptimizer] hasUndefContents - only look for underlying object if we've found an alloca

Provides an early-out if we fail to find an AllocaInst, and avoids a static analyzer warning about null dereferencing.

2 years ago[MemCpyOptimizer] Use auto* for cast<> results (style). NFC.
Simon Pilgrim [Thu, 6 Jan 2022 15:07:30 +0000 (15:07 +0000)]
[MemCpyOptimizer] Use auto* for cast<> results (style). NFC.

2 years ago[mlir][linalg][bufferize][NFC] Do not cache bufferized function types
Matthias Springer [Thu, 6 Jan 2022 14:58:20 +0000 (23:58 +0900)]
[mlir][linalg][bufferize][NFC] Do not cache bufferized function types

This does not work if BufferizationState is passed around as a const reference in most places.

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

2 years ago[lld][macho][nfc] Make tests less britle by not expecting ordering in symbol table...
Vy Nguyen [Thu, 6 Jan 2022 02:58:12 +0000 (21:58 -0500)]
[lld][macho][nfc] Make tests less britle by not expecting ordering in symbol table dump.

(parial)fixes PR/53026

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

2 years ago[SLP][NFC]Fix comment, NFC.
Alexey Bataev [Thu, 6 Jan 2022 14:38:29 +0000 (06:38 -0800)]
[SLP][NFC]Fix comment, NFC.

2 years ago[SLP][NFC]Add a test for the extra shuffle after alternate node, NFC.
Alexey Bataev [Thu, 6 Jan 2022 14:34:58 +0000 (06:34 -0800)]
[SLP][NFC]Add a test for the extra shuffle after alternate node, NFC.

2 years ago[Verifier] Enforce elementtype attr for inline asm indirect constraints
Nikita Popov [Thu, 6 Jan 2022 14:17:35 +0000 (15:17 +0100)]
[Verifier] Enforce elementtype attr for inline asm indirect constraints

This enforces the LangRef change from D116531 in the Verifier, now
that clang and tests have been updated.

2 years ago[LoopFlatten] checkOverflow - use cast<> instead of dyn_cast<> to avoid dereference...
Simon Pilgrim [Tue, 4 Jan 2022 22:24:18 +0000 (22:24 +0000)]
[LoopFlatten] checkOverflow - use cast<> instead of dyn_cast<> to avoid dereference of nullptr.

Fix static analysis warning by using cast<> instead of dyn_cast<> as both isa<> and isGuaranteedToExecuteForEveryIteration expect a non-null Instruction pointer.

2 years ago[BitCode] Autoupgrade inline asm elementtype attribute
Nikita Popov [Thu, 6 Jan 2022 14:02:45 +0000 (15:02 +0100)]
[BitCode] Autoupgrade inline asm elementtype attribute

This is the autoupgrade part of D116531. If old bitcode is missing
the elementtype attribute for indirect inline asm constraints,
automatically add it. As usual, this only works when upgrading
in typed mode, we haven't figured out upgrade in opaque mode yet.

2 years ago[mlir][Linalg] NFC - Modernize padding pattern
Nicolas Vasilache [Thu, 6 Jan 2022 13:30:49 +0000 (08:30 -0500)]
[mlir][Linalg] NFC - Modernize padding pattern

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

2 years ago[SystemZ][z/OS][libcxx]:Fix fopen64 undeclared error in 32 bit mode
Fanbo Meng [Thu, 6 Jan 2022 13:56:13 +0000 (08:56 -0500)]
[SystemZ][z/OS][libcxx]:Fix fopen64 undeclared error in 32 bit mode

z/OS doesn't support fopen64() functions. Modify the preprocessor directive for z/OS to use fopen() instead.

Reviewed By: #libc, abhina.sreeskantharajan, muiez, ldionne

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

2 years ago[MLIR] Simplex::findPivotRow: silence spurious coverity warning
Arjun P [Thu, 6 Jan 2022 13:46:57 +0000 (19:16 +0530)]
[MLIR] Simplex::findPivotRow: silence spurious coverity warning

Initialize some variables to zero to avoid a warning about them possibly being
used uninitialized. In actuality, they will never be used before initialization.

2 years ago[LICM] Update comments related to escape check (NFC)
Nikita Popov [Thu, 6 Jan 2022 13:44:39 +0000 (14:44 +0100)]
[LICM] Update comments related to escape check (NFC)

The comments here were outdated and a bit confusing without the
knowledge that we're only guarding against reads on unwind.

2 years ago[MLIR] Simplex::normalizeRow: assert gcd is non-zero before dividing
Arjun P [Thu, 6 Jan 2022 13:33:11 +0000 (19:03 +0530)]
[MLIR] Simplex::normalizeRow: assert gcd is non-zero before dividing

2 years ago[LICM] Check for noalias call instead of alloc like fn
Nikita Popov [Thu, 6 Jan 2022 09:20:42 +0000 (10:20 +0100)]
[LICM] Check for noalias call instead of alloc like fn

When determining whether the memory is local to the function (and
we can thus introduce spurious writes without thread-safety issues),
check for a noalias call rather than the hardcoded list of memory
allocation functions. Noalias calls are the more general way to
determine allocation functions, as long as we're only interested
in the property that the returned value is distinct from any other
accessible memory.

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

2 years ago[Tests] Add elementtype attribute to indirect inline asm operands (NFC)
Nikita Popov [Thu, 6 Jan 2022 11:10:58 +0000 (12:10 +0100)]
[Tests] Add elementtype attribute to indirect inline asm operands (NFC)

This updates LLVM tests for D116531 by adding elementtype attributes
to operands that correspond to indirect asm constraints.

2 years ago[LV] Load/store/reduction type must be sized, assert it.
Sander de Smalen [Thu, 6 Jan 2022 10:53:59 +0000 (10:53 +0000)]
[LV] Load/store/reduction type must be sized, assert it.

This addresses a suggestion by @nikic on D115356.

2 years ago[flang][OpenMP] Add some semantic checks for threadprivate and declare target directives
Peixin-Qiao [Thu, 6 Jan 2022 12:00:16 +0000 (20:00 +0800)]
[flang][OpenMP] Add some semantic checks for threadprivate and declare target directives

This supports the following checks for THREADPRIVATE Directive:
```
[5.1] 2.21.2 THREADPRIVATE Directive
A threadprivate variable must not appear in any clause except the
copyin, copyprivate, schedule, num_threads, thread_limit, and if clauses.
```

This supports the following checks for DECLARE TARGET Directive:
```
[5.1] 2.14.7 Declare Target Directive
A threadprivate variable cannot appear in the directive.
```

Besides, procedure name and the entity with PARAMETER attribute cannot
be in the threadprivate directive. The main program name and module name
cannot be in the threadprivate directive and declare target directive.
There is no clear description or restriction about the entity with
PARAMETER attribute in OpenMP 5.1 Specification, and a warning is given.

Reviewed By: kiranchandramohan, shraiysh, NimishMishra

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

2 years ago[SCEVExpand] Do not create redundant 'or false' for pred expansion.
Florian Hahn [Thu, 6 Jan 2022 11:52:19 +0000 (11:52 +0000)]
[SCEVExpand] Do not create redundant 'or false' for pred expansion.

This patch updates SCEVExpander::expandUnionPredicate to not create
redundant 'or false, x' instructions. While those are trivially
foldable, they can be easily avoided and hinder code that checks the
size/cost of the generated checks before further folds.

I am planning on look into a few other similar improvements to code
generated by SCEVExpander.

I remember a while ago @lebedev.ri working on doing some trivial folds
like that in IRBuilder itself, but there where concerns that such
changes may subtly break existing code.

Reviewed By: reames, lebedev.ri

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

2 years ago[CMake] Support passing arguments to build tool for external projects
Andrew Ng [Tue, 14 Dec 2021 14:34:44 +0000 (14:34 +0000)]
[CMake] Support passing arguments to build tool for external projects

Add CMake variable LLVM_EXTERNAL_PROJECT_BUILD_TOOL_ARGS to allow
arguments to be passed to the native tool used in CMake --build
invocations for external projects.

Can be used to pass extra arguments for enhanced versions of build
tools, e.g. distributed build options.

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

2 years ago[AArch64] Regenerate arith overflow test, and add a few more select tests. NFC
David Green [Thu, 6 Jan 2022 11:02:14 +0000 (11:02 +0000)]
[AArch64] Regenerate arith overflow test, and add a few more select tests. NFC

2 years ago[MLIR] Add division normalization by GCD in `getDivRepr` fn.
Prashant Kumar [Thu, 6 Jan 2022 10:42:41 +0000 (16:12 +0530)]
[MLIR] Add division normalization by GCD in `getDivRepr` fn.

This commits adds division normalization in  the `getDivRepr` function which extracts
 the gcd from the dividend and divisor and normalizes them.

Signed-off-by: Prashant Kumar <pk5561@gmail.com>
Reviewed By: bondhugula

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

2 years ago[LICM] Add test for noalias call (NFC)
Nikita Popov [Thu, 6 Jan 2022 09:26:16 +0000 (10:26 +0100)]
[LICM] Add test for noalias call (NFC)

Add a test with a noalias call that is not a known allocation
function.

2 years ago[mlir][LLVM] Implement mapping of phi source values of `llvm.invoke`
Markus Böck [Wed, 5 Jan 2022 23:41:35 +0000 (00:41 +0100)]
[mlir][LLVM] Implement mapping of phi source values of `llvm.invoke`

This patch allows the usage of the normalDestOperands and unwindDestOperands operands of llvm.invoke and have them be correctly mapped to phis in the successor when exported to LLVM IR.

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

2 years agoUpdate Bug report URL to Github Issues
Chuanqi Xu [Thu, 6 Jan 2022 09:33:25 +0000 (17:33 +0800)]
Update Bug report URL to Github Issues

Although we moved to Github Issues. The bug report message refers to
Bugzilla still. This patch tries to update these URLs.

Reviewed By: MaskRay, Quuxplusone, jhenderson, libunwind, libc++

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

2 years ago[mlir] Split out Python bindings for dialects into separate libs
Alex Zinenko [Wed, 5 Jan 2022 10:21:21 +0000 (11:21 +0100)]
[mlir] Split out Python bindings for dialects into separate libs

Historically, the bindings for the Linalg dialect were included into the
"core" bindings library because they depended on the C++ implementation
of the "core" bindings. The other dialects followed the pattern. Now
that this dependency is gone, split out each dialect into a separate
Python extension library.

Depends On D116649, D116605

Reviewed By: stellaraccident

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

2 years ago[ELF] Enforce double-dash form for --color-diagnostics/--rsp-quoting/--symbol-orderin...
Fangrui Song [Thu, 6 Jan 2022 09:02:14 +0000 (01:02 -0800)]
[ELF] Enforce double-dash form for --color-diagnostics/--rsp-quoting/--symbol-ordering-file

They are LLD-specific and by convention we enforce the double-dash form to avoid
collision with short options (e.g. weird `-c olor-diagnostics` interpretation in
GNU ld). They are rarely used and to the best of my investigation the undesired
single-dash forms are not used in the wild.

2 years ago[ConstFold] Add missing check for inbounds gep
Nikita Popov [Thu, 6 Jan 2022 08:58:31 +0000 (09:58 +0100)]
[ConstFold] Add missing check for inbounds gep

If the gep is not inbounds, then the gep might compute a null
value even if the base pointer is non-null.

2 years ago[ConstantFold] Add test for invalid non-inbounds gep icmp fold
Nikita Popov [Thu, 6 Jan 2022 08:55:56 +0000 (09:55 +0100)]
[ConstantFold] Add test for invalid non-inbounds gep icmp fold

The gep evaluated to null in this case, and as such is not ne null.

2 years ago[mlir][linalg][bufferize] Fix tiled_loop bufferization
Matthias Springer [Thu, 6 Jan 2022 08:49:21 +0000 (17:49 +0900)]
[mlir][linalg][bufferize] Fix tiled_loop bufferization

Until now, bufferization assumed that the yieleded tensor of a linalg.tiled_loop is an output tensor. This is not necessarily the case.

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

2 years ago[M68k][test][NFC] Add missing tests for arith inst with size byte or word
Jim Lin [Thu, 6 Jan 2022 03:40:36 +0000 (11:40 +0800)]
[M68k][test][NFC] Add missing tests for arith inst with size byte or word

2 years ago[ELF] Update help messages to prefer canonical name for some long options
Fangrui Song [Thu, 6 Jan 2022 08:43:46 +0000 (00:43 -0800)]
[ELF] Update help messages to prefer canonical name for some long options

And improve the help message for --pop-state.

2 years ago[mlir][linalg][bufferize][NFC] Simplify InsertSliceOp bufferization
Matthias Springer [Thu, 6 Jan 2022 08:34:01 +0000 (17:34 +0900)]
[mlir][linalg][bufferize][NFC] Simplify InsertSliceOp bufferization

No need to keep track of equivalent extract_slice / insert_slice tensors during bufferization. Just emit a copy, it will fold away.

Note: The analysis still keeps track of equivalent tensors to make the correct inplace bufferization decisions.

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

2 years ago[CodeGen] Emit elementtype attributes for indirect inline asm constraints
Nikita Popov [Wed, 5 Jan 2022 14:16:24 +0000 (15:16 +0100)]
[CodeGen] Emit elementtype attributes for indirect inline asm constraints

This implements the clang side of D116531. The elementtype
attribute is added for all indirect constraints (*) and tests are
updated accordingly.

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

2 years ago[lldb] [debugserver] Simplify handling of arch specific files
Martin Storsjö [Tue, 4 Jan 2022 21:14:30 +0000 (23:14 +0200)]
[lldb] [debugserver] Simplify handling of arch specific files

There are no duplicates among the include files, and all the
source files are wrapped in architecture ifdefs, so there's no harm
in including all of them, always.

This fixes builds if TARGET_TRIPLE is set to something else than the
build architecture.

This also allows building for multiple architectures at once by
setting CMAKE_OSX_ARCHITECTURES.

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

2 years ago[IR] Track users of comdats
Nikita Popov [Thu, 16 Dec 2021 09:48:40 +0000 (10:48 +0100)]
[IR] Track users of comdats

Track all GlobalObjects that reference a given comdat, which allows
determining whether a function in a comdat is dead without scanning
the whole module.

In particular, this makes filterDeadComdatFunctions() have complexity
O(#DeadFunctions) rather than O(#SymbolsInModule), which addresses
half of the compile-time issue exposed by D115545.

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

2 years ago[clang-format] Missing space after cast in a macro
mydeveloperday [Thu, 6 Jan 2022 08:05:59 +0000 (08:05 +0000)]
[clang-format] Missing space after cast in a macro

https://github.com/llvm/llvm-project/issues/52979

Though SpaceAfterCStyleCast is set to true, clang-format 13 does not add a space after (void *) here:

```
```

This patch addresses that

Fixes: #52979

Reviewed By: curdeius, HazardyKnusperkeks, owenpan

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

2 years agoRe-apply "[JITLink] Update JITLink to use ExecutorAddr rather... " with fixes.
Lang Hames [Thu, 6 Jan 2022 05:03:06 +0000 (16:03 +1100)]
Re-apply "[JITLink] Update JITLink to use ExecutorAddr rather... " with fixes.

This re-applies 133f86e95492b2a00b944e070878424cfa73f87c, which was reverted in
c5965a411c635106a47738b8d2e24db822b7416f while I investigated bot failures.

The original failure contained an arithmetic conversion think-o (on line 419 of
EHFrameSupport.cpp) that could cause failures on 32-bit platforms. The issue
should be fixed in this patch.

2 years agoRevert "SIGSEGV in Sanitizer INTERCEPTOR of strstr function."
Vitaly Buka [Thu, 6 Jan 2022 05:25:26 +0000 (21:25 -0800)]
Revert "SIGSEGV in Sanitizer INTERCEPTOR of strstr function."

Breaks Asan on Fuchsia's and ubsan with gcc.

This reverts commit 685c94c6cbba4f2bf076b01fd3e0dcb4b1425b53.

2 years ago[AMDGPU] Iterate LoweredEndCf in the reverse order
Christudasan Devadasan [Fri, 24 Dec 2021 20:05:41 +0000 (15:05 -0500)]
[AMDGPU] Iterate LoweredEndCf in the reverse order

The function that optimally inserts the exec mask
restore operations by combining the blocks currently
visits the lowered END_CF pseudos in the forward
direction as it iterates the setvector in the order
the entries are inserted in it.

Due to the absence of BranchFolding at -O0, the
irregularly placed BBs cause the forward traversal
to incorrectly place two unconditional branches in
certain BBs while combining them, especially when
an intervening block later gets optimized away in
subsequent iterations.

It is avoided by reverse iterating the setvector.
The blocks at the bottom of a function will get
optimized first before processing those at the top.

Fixes: SWDEV-315215

Reviewed By: rampitec

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

2 years agoRevert "Remove unused variable (-Wunused)"
David Blaikie [Thu, 6 Jan 2022 04:43:30 +0000 (20:43 -0800)]
Revert "Remove unused variable (-Wunused)"

Patch that removed the use of this variable was  reverted in
8ade3d43a3e48eb739c9db2f38b618fa213f0546

This reverts commit 3988a06d86e1a14dfd5f5fdae84ddbf928e85dab.

2 years agollvm-dwarfdump: Speed up type unit lookup using the TUIndex or a cache
David Blaikie [Thu, 6 Jan 2022 04:41:07 +0000 (20:41 -0800)]
llvm-dwarfdump: Speed up type unit lookup using the TUIndex or a cache

Use the TUIndex in a DWP file if present, otherwise (in .o, .dwo, and
non-split linked executables) cache a DenseMap for lookup of type units.

2 years agollvm-dwarfdump --summarize-types: skip compilation units
David Blaikie [Thu, 6 Jan 2022 04:35:08 +0000 (20:35 -0800)]
llvm-dwarfdump --summarize-types: skip compilation units

Important for DWARFv5 debug info which might contain type units in the
debug_info section, which made summarize-types fairly ineffective/lost
amongst the noise of CUs being dumped.

2 years agoRevert "[LoopInterchange] Remove a limitation in LoopInterchange legality"
Congzhe Cao [Thu, 6 Jan 2022 04:26:03 +0000 (23:26 -0500)]
Revert "[LoopInterchange] Remove a limitation in LoopInterchange legality"

This reverts commit 15702ff9ce28b3f4aafec13be561359d4c721595 while I
investigate a ppc build bot failure at
https://lab.llvm.org/buildbot#builders/36/builds/16051.

2 years agoRemove unused variable (-Wunused)
David Blaikie [Thu, 6 Jan 2022 04:29:35 +0000 (20:29 -0800)]
Remove unused variable (-Wunused)

2 years agoDebugInfo: Rebuild varargs function types correctly
David Blaikie [Wed, 5 Jan 2022 21:25:13 +0000 (13:25 -0800)]
DebugInfo: Rebuild varargs function types correctly

Improves llvm-dwarfdump output and for simplified template names roundtripping.

2 years ago[MLIR][DataFlowAnalysis] Use a queue to maintain the worklist
Vaivaswatha Nagaraj [Wed, 5 Jan 2022 08:44:27 +0000 (14:14 +0530)]
[MLIR][DataFlowAnalysis] Use a queue to maintain the worklist

Since the analysis is described to be suitable for a forward
data-flow analysis, maintaining the worklist as a queue mimics
RPO ordering of block visits, thus reaching the fixpoint earlier.

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

2 years agoRevert "[JITLink] Update JITLink to use ExecutorAddr rather than..."
Lang Hames [Thu, 6 Jan 2022 04:18:40 +0000 (15:18 +1100)]
Revert "[JITLink] Update JITLink to use ExecutorAddr rather than..."

This reverts commit 133f86e95492b2a00b944e070878424cfa73f87c while I investigate
the bot failures at https://lab.llvm.org/buildbot#builders/186/builds/3370.

2 years ago[OpenMP][Offloading] Fixed a crash caused by dereferencing nullptr
Shilei Tian [Thu, 6 Jan 2022 04:04:17 +0000 (23:04 -0500)]
[OpenMP][Offloading] Fixed a crash caused by dereferencing nullptr

In function `DeviceTy::getTargetPointer`, `Entry` could be `nullptr` because of
zero length array section. We need to check if it is a valid iterator before
using it.

Reviewed By: ronlieb

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

2 years ago[CMake] Disable LLVM_INCLUDE_GO_TESTS by default
Fangrui Song [Thu, 6 Jan 2022 04:03:52 +0000 (20:03 -0800)]
[CMake] Disable LLVM_INCLUDE_GO_TESTS by default

llvm/test/Bindings/Go is quite flaky in the past few months and nobody fixes it.

See

* https://lists.llvm.org/pipermail/llvm-dev/2021-December/154353.html "Suggestions on debugging pre-merge test failure that looks irrelevant."
* https://github.com/llvm/llvm-project/issues/53017

Reviewed By: aeubanks

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

2 years ago[LoopInterchange] Remove a limitation in LoopInterchange legality
Congzhe Cao [Thu, 6 Jan 2022 03:17:03 +0000 (22:17 -0500)]
[LoopInterchange] Remove a limitation in LoopInterchange legality

There was a limitation in legality that in the original inner loop latch,
no instruction was allowed between the induction variable increment
and the branch instruction. This is because we used to split the
inner latch at the induction variable increment instruction. Since
now we have split at the inner latch branch instruction and have
properly duplicated instructions over to the split block, we remove
this limitation.

Please refer to the test case updates to see how we now interchange
loops where instructions exist between the induction variable increment
and the branch instruction.

Reviewed By: bmahjour

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

2 years ago[msan] Check for AVX regs using offset
Petr Hosek [Thu, 6 Jan 2022 03:24:00 +0000 (19:24 -0800)]
[msan] Check for AVX regs using offset

glibc versions < 2.26 use different names for the fields.
However the layout is unchanged, so using the offset should be a
portable way to address this issue across platforms.

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

Patch By: paulkirth

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

2 years ago[lldb] Add StringList::AppendString(const Twine&) (NFC)
Dave Lee [Wed, 5 Jan 2022 18:21:13 +0000 (10:21 -0800)]
[lldb] Add StringList::AppendString(const Twine&) (NFC)

Add a convenience for appending constructed string values.

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

2 years ago[JITLink] Update JITLink to use ExecutorAddr rather than JITTargetAddress.
Lang Hames [Wed, 5 Jan 2022 06:00:06 +0000 (17:00 +1100)]
[JITLink] Update JITLink to use ExecutorAddr rather than JITTargetAddress.

ExecutorAddr is the preferred representation for executor process addresses now.

2 years ago[ORC] Make ExecutorAddrDiff an alias for uint64_t.
Lang Hames [Mon, 3 Jan 2022 23:21:44 +0000 (10:21 +1100)]
[ORC] Make ExecutorAddrDiff an alias for uint64_t.

We don't need to restrict operations on ExecutorAddrDiff as carefully as we do
for ExecutorAddr.

2 years ago[lldb] Break out long help for 'frame var'
Dave Lee [Wed, 5 Jan 2022 22:22:33 +0000 (14:22 -0800)]
[lldb] Break out long help for 'frame var'

The current help for `frame variable` is somewhat long. Its length, combined
with the few aliases (`var`, `v`, and `vo`) can make the output of `apropos`
redundant and noisy.

This separates out the details into a separate long help.

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

2 years ago[M68k][test][NFC] Add missing tests for MxCMP_RM
Jim Lin [Thu, 6 Jan 2022 02:14:46 +0000 (10:14 +0800)]
[M68k][test][NFC] Add missing tests for MxCMP_RM

Let each format of inst have two tests for it like other MxCMP
testcases.

2 years ago[MLIR][LLVM] Add simple folders for bitcast/addrspacecast/gep
William S. Moses [Thu, 6 Jan 2022 01:34:01 +0000 (20:34 -0500)]
[MLIR][LLVM] Add simple folders for bitcast/addrspacecast/gep

Add 5 simple folders
* bitcast(x : T0, T0) -> x
* addrcast(x : T0, T0) -> x
* bitcast(bitcast(x : T0, T1), T0) -> x
* addrcast(addrcast(x : T0, T1), T0) -> x
* gep %x:T, 0 -> %x:T

Reviewed By: mehdi_amini

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

2 years ago[M68k][test][NFC] Fix no newline at end of file
Jim Lin [Thu, 6 Jan 2022 01:35:23 +0000 (09:35 +0800)]
[M68k][test][NFC] Fix no newline at end of file

2 years ago[mlir][ods] ODS ops get an `extraClassDefinition`
Mogball [Thu, 6 Jan 2022 01:42:12 +0000 (01:42 +0000)]
[mlir][ods] ODS ops get an `extraClassDefinition`

Extra definitions are placed in the generated source file for each op class. The substitution `$cppClass` is replaced by the op's C++ class name.

This is useful when declaring but not defining methods in TableGen base classes:

```
class BaseOp<string mnemonic>
    : Op<MyDialect, mnemonic, [DeclareOpInterfaceMethods<SomeInterface>] {
  let extraClassDeclaration = [{
    // ZOp is declared at at the bottom of the file and is incomplete here
    ZOp getParent();
  }];
  let extraClassDefinition = [{
    int $cppClass::someInterfaceMethod() {
      return someUtilityFunction(*this);
    }
    ZOp $cppClass::getParent() {
      return dyn_cast<ZOp>(this->getParentOp());
    }
  }];
}
```

Certain things may prevent defining these functions inline, in the declaration. In this example, `ZOp` in the same dialect is incomplete at the function declaration because ops classes are declared in alphabetical order. Alternatively, functions may be too big to be desired as inlined, or they may require dependencies that create cyclic includes, or they may be calling a templated utility function that one may not want to expose in a header. If the functions are not inlined, then inheriting from the base class N times means that each function will need to be defined N times. With `extraClassDefinitions`, they only need to be defined once.

Reviewed By: rriddle

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

2 years ago[LTO][codegen] Add TargetLibraryInfoWrapperPass initially
Craig Topper [Thu, 6 Jan 2022 00:59:40 +0000 (08:59 +0800)]
[LTO][codegen] Add TargetLibraryInfoWrapperPass initially

Many codegen pass require this pass with useful triple info. Legacy pass manager need to
add a TargetLibraryInfo with the module info before run passes. Or the TargetLibraryInfo
will be initialized too conservative.

Reviewed By: pengfei, aeubanks

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

2 years agoConsider CMAKE_{t}_LINKER_FLAGS_<CONFIG> when passing -gcodeview-ghash
Yuanfang Chen [Thu, 6 Jan 2022 01:21:46 +0000 (17:21 -0800)]
Consider CMAKE_{t}_LINKER_FLAGS_<CONFIG> when passing -gcodeview-ghash

CMake may add /Debug in the CONFIG-specific flag.

Reviewed By: rnk

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

2 years ago[OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement
Shilei Tian [Thu, 6 Jan 2022 01:19:55 +0000 (20:19 -0500)]
[OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement

The async data movement can cause data race if the target supports it.
Details can be found in [1]. This patch tries to fix this problem by attaching
an event to the entry of data mapping table. Here are the details.

For each issued data movement, a new event is generated and returned to `libomptarget`
by calling `createEvent`. The event will be attached to the corresponding mapping table
entry.

For each data mapping lookup, if there is no need for a data movement, the
attached event has to be inserted into the queue to gaurantee that all following
operations in the queue can only be executed if the event is fulfilled.

This design is to avoid synchronization on host side.

Note that we are using CUDA terminolofy here. Similar mechanism is assumped to
be supported by another targets. Even if the target doesn't support it, it can
be easily implemented in the following fall back way:
- `Event` can be any kind of flag that has at least two status, 0 and 1.
- `waitEvent` can directly busy loop if `Event` is still 0.

My local test shows that `bug49334.cpp` can pass.

Reference:
[1] https://bugs.llvm.org/show_bug.cgi?id=49940

Reviewed By: grokos, JonChesterfield, ye-luo

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

2 years ago[Clang] Extract availability mapping from VersionMap for watchOS/tvOS
Egor Zhdan [Tue, 4 Jan 2022 19:58:10 +0000 (19:58 +0000)]
[Clang] Extract availability mapping from VersionMap for watchOS/tvOS

This change makes it possible to extract iOS-to-another-platform version mappings from `VersionMap` in the `SDKSettings.json` file in Darwin SDKs, for example, `iOS_watchOS` and `iOS_tvOS`.

This code was originally authored by Alex Lorenz.

rdar://81491680

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

2 years ago[mlir][sparse] Strengthening first arguments of fromCOO/toCOO
wren romano [Wed, 5 Jan 2022 21:46:15 +0000 (13:46 -0800)]
[mlir][sparse] Strengthening first arguments of fromCOO/toCOO

Better capturing of invariants

Reviewed By: aartbik

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

2 years ago[mlir][sparse] Marking cursor parameters const
wren romano [Wed, 5 Jan 2022 21:13:04 +0000 (13:13 -0800)]
[mlir][sparse] Marking cursor parameters const

These parameters aren't modified, so we make that invariant explicit.

Reviewed By: aartbik

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

2 years agoIntroduce NewPM .dot printers for DomTree
Daniil Suchkov [Tue, 4 Jan 2022 02:38:56 +0000 (02:38 +0000)]
Introduce NewPM .dot printers for DomTree

This patch adds a couple of NewPM function passes (dot-dom and
dot-dom-only) that dump DomTree into .dot files.

Reviewed-By: aeubanks
Differential Revision: https://reviews.llvm.org/D116629

2 years ago[clang-tidy] Recognize transformer checks as providing fixits
Richard [Mon, 3 Jan 2022 17:16:38 +0000 (10:16 -0700)]
[clang-tidy] Recognize transformer checks as providing fixits

- Recognize older checks that might not end with Check.cpp
- Update list of checks based on improvements to add_new_check
- Fix spelling error in TransformerClangTidyCheck.h

Fixes #52962

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

2 years ago[DFSan] Add option for conditional callbacks.
Andrew Browne [Thu, 23 Dec 2021 07:54:26 +0000 (23:54 -0800)]
[DFSan] Add option for conditional callbacks.

This allows DFSan to find tainted values used to control program behavior.

Reviewed By: morehouse

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

2 years ago[lldb] Create a property to store the REPL language
Jonas Devlieghere [Wed, 5 Jan 2022 22:42:21 +0000 (14:42 -0800)]
[lldb] Create a property to store the REPL language

Until the introduction of the C++ REPL, there was always a single REPL
language. Several places relied on this assumption through
repl_languages.GetSingularLanguage. Now that this is no longer the case,
we need a way to specify a selected/preferred REPL language. This patch
does that with the help of a debugger property, taking inspiration from
how we store the scripting language.

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

2 years ago[Hexagon] Handle instruction selection for select(I1,Q,Q)
Ikhlas Ajbar [Thu, 16 Apr 2020 20:56:56 +0000 (15:56 -0500)]
[Hexagon] Handle instruction selection for select(I1,Q,Q)

Lower select(I1,Q,Q) by converting vector predicate Q to vector register V,
doing select(I1,V,V), and then converting the resulting V back to Q. Also,
try to avoid creating such situations in the first place.