platform/upstream/llvm.git
3 years ago[libc++] NFC: Reindent the run-buildbot script
Louis Dionne [Thu, 15 Jul 2021 17:29:47 +0000 (13:29 -0400)]
[libc++] NFC: Reindent the run-buildbot script

3 years ago[test] Avoid llvm-readelf/llvm-readobj one-dash long options and deprecated aliases...
Fangrui Song [Thu, 15 Jul 2021 17:26:21 +0000 (10:26 -0700)]
[test] Avoid llvm-readelf/llvm-readobj one-dash long options and deprecated aliases (e.g. --file-headers)

3 years ago[llvm-exegesis] Fix missing-headers build errors.
Vy Nguyen [Tue, 13 Jul 2021 17:27:09 +0000 (13:27 -0400)]
[llvm-exegesis] Fix missing-headers build errors.

Details:

Switch all #includes to use <> because that is consistent with what happens in the cmake checks.
Otherwise, we could be in the situation where cmake checks see that headers exist at <perfmon/...>
but in  llvm-exegesis code, we use "perfmon/...", which may not exist.

Related PR/revisions: D84076, PR51017+D105615

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

3 years agoRevert "[SLP]Workaround for InsertSubVector cost."
Arthur Eubanks [Thu, 15 Jul 2021 17:15:51 +0000 (10:15 -0700)]
Revert "[SLP]Workaround for InsertSubVector cost."

This reverts commit 2eb50baf059648214cb1c624b5269978a62e86a1.

Causes hangs, see comments on D105827.

3 years ago[GlobalISel] Fix infinite loop in reassociationCanBreakAddressingModePattern
Jessica Paquette [Thu, 15 Jul 2021 16:56:14 +0000 (09:56 -0700)]
[GlobalISel] Fix infinite loop in reassociationCanBreakAddressingModePattern

It didn't update the opcode while walking through G_INTTOPTR/G_PTRTOINT.

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

3 years ago[WebAssembly] Fixed LLD generation of 64-bit __wasm_apply_data_relocs
Wouter van Oortmerssen [Tue, 13 Jul 2021 00:18:39 +0000 (17:18 -0700)]
[WebAssembly] Fixed LLD generation of 64-bit __wasm_apply_data_relocs

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

3 years ago[lld-macho] Add LTO cache support
Leonard Grey [Thu, 15 Jul 2021 16:56:13 +0000 (12:56 -0400)]
[lld-macho] Add LTO cache support

This adds support for the lld-only `--thinlto-cache-policy` option, as well as
implementations for ld64's `-cache_path_lto`, `-prune_interval_lto`,
`-prune_after_lto`, and `-max_relative_cache_size_lto`.

Test is adapted from lld/test/ELF/lto/cache.ll

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

3 years ago[AMDGPU] Refine -O0 and -O1 passes.
Stanislav Mekhanoshin [Wed, 7 Jul 2021 17:57:56 +0000 (10:57 -0700)]
[AMDGPU] Refine -O0 and -O1 passes.

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

3 years ago[llvm-nm] Remove one-dash long options except -arch
Fangrui Song [Thu, 15 Jul 2021 16:50:37 +0000 (09:50 -0700)]
[llvm-nm] Remove one-dash long options except -arch

The documentation and help messages have recommended the double-dash forms for
quite a while. Remove one-dash long options which are not recognized by GNU
style `getopt_long`.

`-arch` is kept as it is in the manpage of classic nm
https://keith.github.io/xcode-man-pages/nm.1.html

Note: the dyldinfo related options don't have a test.

Reviewed By: jhenderson

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

3 years ago[test] Avoid llvm-nm one-dash long options
Fangrui Song [Thu, 15 Jul 2021 16:45:46 +0000 (09:45 -0700)]
[test] Avoid llvm-nm one-dash long options

3 years ago[mlir][sparse] add shift ops support
Aart Bik [Wed, 14 Jul 2021 18:07:39 +0000 (11:07 -0700)]
[mlir][sparse] add shift ops support

Arbitrary shifts have some complications, but shift by invariants
(viz. tensor index exp only at left hand side) can be easily
handled with the conjunctive rule.

Reviewed By: gussmith23

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

3 years ago[flang][driver] Randomise the names of the unparsed files
Andrzej Warzynski [Thu, 15 Jul 2021 10:36:33 +0000 (11:36 +0100)]
[flang][driver] Randomise the names of the unparsed files

This patch makes sure that the base name of the temporary unparsed files
(generated by the `flang` bash script) are randomised and unique to a
particular invocation of the script. Otherwise, we cannot reliably run
the script in parallel.

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

3 years agoEnable Flang by default in the test-release.sh script
Andrzej Warzynski [Tue, 13 Jul 2021 10:54:37 +0000 (10:54 +0000)]
Enable Flang by default in the test-release.sh script

I've also brought this up on llvm-dev:
  https://lists.llvm.org/pipermail/llvm-dev/2021-July/151744.html

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

3 years ago[mlir][sparse] remove linalg-to-loops from integration tests
Aart Bik [Thu, 15 Jul 2021 15:40:31 +0000 (08:40 -0700)]
[mlir][sparse] remove linalg-to-loops from integration tests

With the migration from linalg.copy to memref.copy, this pass
(which was there solely to handle the linalg.copy op) is no
longer required for the end-to-end path for sparse compilation.

Reviewed By: ftynse

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

3 years ago[libc++] Add a CMake target to re-generate files and revamp CONTRIBUTING.rst
Louis Dionne [Thu, 15 Jul 2021 14:19:39 +0000 (10:19 -0400)]
[libc++] Add a CMake target to re-generate files and revamp CONTRIBUTING.rst

As we automate more and more things in the library, it becomes useful for
contributors to have a single target for running all the automation as
part of their workflow. This commit adds a new `libcxx-generate-files`
target that should re-generate all the auto-generated files in the library.

As a fly-by, I also revamped the documentation on Contributing to account
for this new target and present it as a bullet list of things to check
before committing. I also added a few things that are often overlooked
to that list, such as updating the synopsis and the status files.

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

3 years ago[IR] Add elementtype attribute
Nikita Popov [Wed, 7 Jul 2021 20:29:43 +0000 (22:29 +0200)]
[IR] Add elementtype attribute

This implements the elementtype attribute specified in D105407. It
just adds the attribute and the specified verifier rules, but
doesn't yet make use of it anywhere.

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

3 years ago[LangRef] Add elementtype attribute
Nikita Popov [Sun, 4 Jul 2021 13:52:20 +0000 (15:52 +0200)]
[LangRef] Add elementtype attribute

This adds an elementtype(<ty>) attribute, which can be used to
attach an element type to a pointer typed argument. It is similar
to byval/byref in purpose, but unlike those does not carry any
specific semantics by itself. However, certain intrinsics may
require it and interpret it in specific ways.

The in-tree use cases for this that I'm currently aware of are:

    call ptr @llvm.preserve.array.access.index.p0.p0(ptr elementtype(%ty) %base, i32 %dim, i32 %index)
    call ptr @llvm.preserve.struct.access.index.p0.p0(ptr elementtype(%ty) %base, i32 %gep_index, i32 %di_index)
    call token @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0, ptr addrspace(1) %obj)

Notably, the gc.statepoint case needs a function as element type,
in which case the workaround of adding a separate %ty undef
argument would not work, as arguments cannot be unsized.

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

3 years ago[InstCombine] Look through invariant group intrinsics when removing malloc
Arthur Eubanks [Wed, 14 Jul 2021 20:56:59 +0000 (13:56 -0700)]
[InstCombine] Look through invariant group intrinsics when removing malloc

Fixes some regressions with -fstrict-vtable-pointers in llvm-test-suite.

Reviewed By: lebedev.ri

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

3 years ago[Bazel] Update for 01bdb0f75efb
Geoffrey Martin-Noble [Thu, 15 Jul 2021 15:57:43 +0000 (08:57 -0700)]
[Bazel] Update for 01bdb0f75efb

Update the build files for
https://github.com/llvm/llvm-project/commit/01bdb0f75efb

Tested:
bazel query //... + @llvm-project//... | xargs bazel test --config=generic_clang --config=rbe --test_output=errors --test_ta
g_filters=-nobuildkite --build_tag_filters=-nobuildkite

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

3 years ago[LV] Enable vectorization of multiple exit loops w/computable exit counts
Philip Reames [Thu, 15 Jul 2021 15:52:52 +0000 (08:52 -0700)]
[LV] Enable vectorization of multiple exit loops w/computable exit counts

This change enables vectorization of multiple exit loops when the exit count is statically computable. That requirement - shared with the rest of LV - in turn requires each exit to be analyzeable and to dominate the latch.

The majority of work to support this was done in a set of previous patches. In particular,, 72314466 avoids having multiple edges from the middle block to the exits, and 4b33b2387 which added support for non-latch single exit and multiple exits with a single exiting block. As a result, this change is basically just removing a bailout and adjusting some tests now that the prerequisite work is done and has stuck in tree for a bit.

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

3 years ago[AsmParser] Unify parsing of attributes
Nikita Popov [Tue, 13 Jul 2021 20:14:55 +0000 (22:14 +0200)]
[AsmParser] Unify parsing of attributes

Continuing on from D105780, this should be the last major bit of
attribute cleanup. Currently, LLParser implements attribute parsing
for functions, parameters and returns separately, enumerating all
supported (and unsupported) attributes each time. This patch
extracts the common parsing logic, and performs a check afterwards
whether the attribute is valid in the given position. Parameters
and returns are handled together, while function attributes need
slightly different logic to support attribute groups.

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

3 years agotsan: make obtaining current PC faster
Dmitry Vyukov [Thu, 15 Jul 2021 08:51:32 +0000 (10:51 +0200)]
tsan: make obtaining current PC faster

We obtain the current PC is all interceptors and collectively
common interceptor code contributes to overall slowdown
(in particular cheaper str/mem* functions).

The current way to obtain the current PC involves:

  4493e1:       e8 3a f3 fe ff          callq  438720 <_ZN11__sanitizer10StackTrace12GetCurrentPcEv>
  4493e9:       48 89 c6                mov    %rax,%rsi

and the called function is:

uptr StackTrace::GetCurrentPc() {
  438720:       48 8b 04 24             mov    (%rsp),%rax
  438724:       c3                      retq

The new way uses address of a local label and involves just:

  44a888:       48 8d 35 fa ff ff ff    lea    -0x6(%rip),%rsi

I am not switching all uses of StackTrace::GetCurrentPc to GET_CURRENT_PC
because it may lead some differences in produced reports and break tests.
The difference comes from the fact that currently we have PC pointing
to the CALL instruction, but the new way does not yield any code on its own
so the PC points to a random instruction in the function and symbolizing
that instruction can produce additional inlined frames (if the random
instruction happen to relate to some inlined function).

Reviewed By: melver

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

3 years ago[PowerPC] Add PowerPC rotate related builtins and emit target independent code for...
Victor Huang [Thu, 15 Jul 2021 15:22:36 +0000 (10:22 -0500)]
[PowerPC] Add PowerPC rotate related builtins and emit target independent code for XL compatibility

This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch adds the builtins and emit target independent
code for rotate related operations.

Reviewed By: nemanjai, #powerpc

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

3 years agoRevert "[AbstractAttributor] Fold function calls to `__kmpc_is_spmd_exec_mode` if...
Shilei Tian [Thu, 15 Jul 2021 15:19:28 +0000 (11:19 -0400)]
Revert "[AbstractAttributor] Fold function calls to `__kmpc_is_spmd_exec_mode` if possible"

This reverts commit 1100e4aafea233bc8bbc307c5758a7d287ad3bae.

3 years ago[DAG] Fold select(cond,binop(x,y),binop(x,z)) -> binop(x,select(cond,y,z))
Simon Pilgrim [Thu, 15 Jul 2021 15:08:09 +0000 (16:08 +0100)]
[DAG] Fold select(cond,binop(x,y),binop(x,z)) -> binop(x,select(cond,y,z))

Similar to the folds performed in InstCombinerImpl::foldSelectOpOp, this attempts to push a select further up to help merge a pair of binops.

I'm primarily interested in select(cond,add(x,y),add(x,z)) folds to help expose pointer math (see https://bugs.llvm.org/show_bug.cgi?id=51069 etc.) but I've tried to use the more generic isBinOp().

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

3 years ago[mlir][sparse] replace linalg.copy with memref.copy
Aart Bik [Thu, 15 Jul 2021 05:58:21 +0000 (22:58 -0700)]
[mlir][sparse] replace linalg.copy with memref.copy

Note, this revision relies on the following revision
for a bugfix in the memref copy library in order for
all sparse integration tests to pass.

https://reviews.llvm.org/D106036

Reviewed By: ftynse

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

3 years ago[NVPTX] Tweak fast-math tests to avoid select(binop(x,y),binop(x,z)) fold
Simon Pilgrim [Thu, 15 Jul 2021 14:42:11 +0000 (15:42 +0100)]
[NVPTX] Tweak fast-math tests to avoid select(binop(x,y),binop(x,z)) fold

As suggested on D106058, tweak the tests to keep the combineRepeatedFPDivisors test coverage.

3 years ago[Analyzer][solver] Remove unused functions
Gabor Marton [Thu, 15 Jul 2021 13:45:58 +0000 (15:45 +0200)]
[Analyzer][solver] Remove unused functions

../../git/llvm-project/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2395:17: warning: 'clang::ento::ProgramStateRef {anonymous}::RangeConstraintManager::setRange(clang::ento::ProgramStateRef, {anonymous}::EquivalenceClass, clang::ento::RangeSet)' defined but not used [-Wunused-function]
../../git/llvm-project/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2384:10: warning: 'clang::ento::RangeSet {anonymous}::RangeConstraintManager::getRange(clang::ento::ProgramStateRef, {anonymous}::EquivalenceClass)' defined but not used [-Wunused-function]

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

3 years agoRevert "[LV] Print remark when loop cannot be vectorized due to invalid costs."
Sander de Smalen [Thu, 15 Jul 2021 14:20:44 +0000 (15:20 +0100)]
Revert "[LV] Print remark when loop cannot be vectorized due to invalid costs."

This reverts commit efaf3099c8cec1954831ee28a2f75a72096f50eb.
This reverts commit dc7bdc1e7121693df112f2fdb11cc6b88580ba4b.

Reverting patches due to buildbot failures.

3 years ago[OpenCL] Add support of __opencl_c_program_scope_global_variables feature macro
Anton Zabaznov [Thu, 15 Jul 2021 10:02:47 +0000 (13:02 +0300)]
[OpenCL] Add support of __opencl_c_program_scope_global_variables feature macro

Reviewed By: Anastasia

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

3 years agoMachO: fix Clang test broken by dropping private labels in LLVM.
Tim Northover [Thu, 15 Jul 2021 14:03:43 +0000 (15:03 +0100)]
MachO: fix Clang test broken by dropping private labels in LLVM.

LLVM changed to not emit L... labels for things marked "do_not_dead_strip"
because the linker can sometimes drop the flag if there's no proper symbol.
This Clang test checked for the old behaviour, but doesn't actually care about
that bit.

3 years ago[docs] More CMAKE variable documentation
Nathan Sidwell [Mon, 12 Jul 2021 15:54:51 +0000 (08:54 -0700)]
[docs] More CMAKE variable documentation

This breaks out some (more) common llvm-specific
variables. Controlling the subprojects and target architectures, along
with clues about restricting build parallelism when linking. 'more
common' is somewhat subjective, of course.

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

3 years ago[ARM] Expand types handled in VQDMULH recognition
David Green [Thu, 15 Jul 2021 13:47:53 +0000 (14:47 +0100)]
[ARM] Expand types handled in VQDMULH recognition

We have a DAG combine for recognizing the sequence of nodes that make up
an MVE VQDMULH, but only currently handles specifically legal types.
This patch expands that to other power-2 vector types. For smaller than
legal types this means any_extending the type and casting it to a legal
type, using a VQDMULH where we only use some of the lanes. The result is
sign extended back to the original type, to properly set the invalid
lanes. Larger than legal types are split into chunks with extracts and
concat back together.

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

3 years agoMachO: don't emit L... private symbols in do_not_dead_strip sections.
Tim Northover [Thu, 15 Jul 2021 13:21:42 +0000 (14:21 +0100)]
MachO: don't emit L... private symbols in do_not_dead_strip sections.

The linker can sometimes drop the do_not_dead_strip if it can't associate the
atom with a symbol (the other place to specify no dead-stripping in MachO
files).

3 years agoFix documentation; NFC
liuke [Thu, 15 Jul 2021 13:38:05 +0000 (09:38 -0400)]
Fix documentation; NFC

The documentation about ignoringImpCasts is wrong, which can cause
misunderstandings. This patch fixes it.

3 years ago[SimplifyCFG] Rerun PHI deduplication after common code sinkinkg (PR51092)
Roman Lebedev [Thu, 15 Jul 2021 13:25:36 +0000 (16:25 +0300)]
[SimplifyCFG] Rerun PHI deduplication after common code sinkinkg (PR51092)

`SinkCommonCodeFromPredecessors()` doesn't itself ensure that duplicate PHI nodes aren't created.
I suppose, we could teach it to do that on-the-fly (& account for the already-existing PHI nodes,
& adjust costmodel), the diff will be bigger than this.

The alternative is to schedule a new EarlyCSE pass invocation somewhere later in the pipeline.
Clearly, we don't have any EarlyCSE runs in module optimization passline, so this pattern isn't cleaned up...
That would perhaps better, but it will again have some compile time impact.

Reviewed By: RKSimon

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

3 years ago[mlir][rocdl] Add math::Exp2Op lowering to ROCDL
Adrian Kuegel [Thu, 15 Jul 2021 11:36:42 +0000 (13:36 +0200)]
[mlir][rocdl] Add math::Exp2Op lowering to ROCDL

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

3 years ago[TTI] Consistently make getMinVectorRegisterBitWidth() methods const. NFCI.
Simon Pilgrim [Thu, 15 Jul 2021 12:27:36 +0000 (13:27 +0100)]
[TTI] Consistently make getMinVectorRegisterBitWidth() methods const. NFCI.

The underlying getMinVectorRegisterBitWidth() methods are const, but it was missed in a couple of TargetTransformInfo wrappers.

Noticed while working on D103925

3 years ago[LV] Fix determinism for failing scalable-call.ll test.
Sander de Smalen [Thu, 15 Jul 2021 11:22:24 +0000 (12:22 +0100)]
[LV] Fix determinism for failing scalable-call.ll test.

The sort function for emitting an OptRemark was not deterministic,
which caused scalable-call.ll to fail on some buildbots. This patch
fixes that.

This patch also fixes an issue where `Instruction::comesBefore()`
is called when two Instructions are in different basic blocks,
which would otherwise cause an assertion failure.

3 years ago[mlir][linalg] Improve implementation of hoist padding.
Nicolas Vasilache [Thu, 15 Jul 2021 09:56:50 +0000 (09:56 +0000)]
[mlir][linalg] Improve implementation of hoist padding.

Instead of relying on adhoc bounds calculations, use a projection-based
implementation. This simplifies the implementation and finds more static
constant sizes than previously/

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

3 years ago[libc++] Mark failing rel_ops test as XFAIL in back-deployment
Louis Dionne [Thu, 15 Jul 2021 12:04:00 +0000 (08:04 -0400)]
[libc++] Mark failing rel_ops test as XFAIL in back-deployment

The test triggers availability errors.

3 years agoReapply "[DebugInfo] Enable variadic debug value salvaging"
Stephen Tozer [Wed, 14 Jul 2021 10:54:38 +0000 (11:54 +0100)]
Reapply "[DebugInfo] Enable variadic debug value salvaging"

Reapplied after previous build failures were fixed in 14b62f7e2.

This reverts commit 540b4a5fb31086b6d40735e96e6ec497022107e7.

3 years ago[libc++] Implement views::all_t and ranges::viewable_range
Louis Dionne [Mon, 12 Jul 2021 13:55:00 +0000 (09:55 -0400)]
[libc++] Implement views::all_t and ranges::viewable_range

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

3 years ago[runtimes] Serialize all Lit params instead of passing them to add_lit_testsuite
Louis Dionne [Wed, 14 Jul 2021 15:36:22 +0000 (11:36 -0400)]
[runtimes] Serialize all Lit params instead of passing them to add_lit_testsuite

add_lit_testsuite() takes Lit parameters passed to it and adds them
to the parameters used globally when running all test suites. That
means that a target like `check-all`, which ends up calling Lit on
the whole monorepo, will see the test parameters for all the individual
project's test suites.

So, for example, it would see `--param std=c++03` (from libc++abi), and
`--param std=c++03` (from libc++), and `--param whatever` (from another
project being tested at the same time). While always unclean, that works
when the parameters all agree. However, if the parameters share the same
name but have different values, only one of those two values will be used
and it will be incredibly confusing to understand why one of the test
suites is being run with the incorrect parameter value.

For that reason, this commit moves away from using add_lit_testsuite()'s
PARAM functionality, and serializes the parameter values for the runtimes
in the generated config.py file instead, which is local to the specific
test suite.

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

3 years ago[VP][NFC] Correct formatting in unit test
Fraser Cormack [Thu, 15 Jul 2021 11:30:32 +0000 (12:30 +0100)]
[VP][NFC] Correct formatting in unit test

3 years ago[NVPTX] Add selp.f32 checks to select(cond,fpbinop(),fpbinop()) tests
Simon Pilgrim [Thu, 15 Jul 2021 11:42:29 +0000 (12:42 +0100)]
[NVPTX] Add selp.f32 checks to select(cond,fpbinop(),fpbinop()) tests

Will help show codegen diffs in an upcoming patch

3 years ago[InstCombine] Strip inbounds from (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (selec...
Simon Pilgrim [Thu, 15 Jul 2021 11:19:10 +0000 (12:19 +0100)]
[InstCombine] Strip inbounds from (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C, Idx, 0)) fold

As discussed on rGd561b6fbdbe6, we can't guarantee that the new gep is inbounds

3 years ago[MIPS] Refresh ashr test checks. NFCI.
Simon Pilgrim [Thu, 15 Jul 2021 11:05:33 +0000 (12:05 +0100)]
[MIPS] Refresh ashr test checks. NFCI.

3 years ago[mlir][nvvm]: Add math::Exp2Op lowering to NVVM.
Adrian Kuegel [Thu, 15 Jul 2021 10:04:25 +0000 (12:04 +0200)]
[mlir][nvvm]: Add math::Exp2Op lowering to NVVM.

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

3 years ago[AArch64][GlobalISel] Optimise lowering for some vector types for min/max
Irina Dobrescu [Fri, 9 Jul 2021 12:09:06 +0000 (13:09 +0100)]
[AArch64][GlobalISel] Optimise lowering for some vector types for min/max

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

3 years ago[AMDGPU] Use isMetaInstruction for instruction size
Sebastian Neubauer [Thu, 15 Jul 2021 08:21:33 +0000 (10:21 +0200)]
[AMDGPU] Use isMetaInstruction for instruction size

Meta instructions have a size of 0. Use isMetaInstruction instead of
listing them explicitly.

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

3 years ago[TSan] Add SystemZ SANITIZER_GO support
Ilya Leoshkevich [Fri, 2 Jul 2021 00:49:30 +0000 (02:49 +0200)]
[TSan] Add SystemZ SANITIZER_GO support

Define the address ranges (similar to the C/C++ ones, but with the heap
range merged into the app range) and enable the sanity check.

Reviewed By: dvyukov

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

3 years ago[TSan] Enable SystemZ support
Ilya Leoshkevich [Fri, 2 Jul 2021 00:43:00 +0000 (02:43 +0200)]
[TSan] Enable SystemZ support

Enable building the runtime and enable -fsanitize=thread in clang.

Reviewed By: dvyukov

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

3 years ago[TSan] Adjust tests for SystemZ
Ilya Leoshkevich [Fri, 2 Jul 2021 00:43:49 +0000 (02:43 +0200)]
[TSan] Adjust tests for SystemZ

XFAIL map32bit, define the maximum possible allocation size in
mmap_large.cpp.

Reviewed By: dvyukov

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

3 years ago[TSan] Intercept __tls_get_addr_internal and __tls_get_offset on SystemZ
Ilya Leoshkevich [Fri, 2 Jul 2021 14:59:32 +0000 (16:59 +0200)]
[TSan] Intercept __tls_get_addr_internal and __tls_get_offset on SystemZ

Reuse the assembly glue code from sanitizer_common_interceptors.inc and
the handling logic from the __tls_get_addr interceptor.

Reviewed By: dvyukov

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

3 years ago[TSan] Disable __TSAN_HAS_INT128 on SystemZ
Ilya Leoshkevich [Fri, 2 Jul 2021 00:47:11 +0000 (02:47 +0200)]
[TSan] Disable __TSAN_HAS_INT128 on SystemZ

SystemZ does not have 128-bit atomics.

Reviewed By: dvyukov

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

3 years ago[TSan] Add SystemZ longjmp support
Ilya Leoshkevich [Fri, 2 Jul 2021 00:46:21 +0000 (02:46 +0200)]
[TSan] Add SystemZ longjmp support

Implement the interceptor and stack pointer demangling.

Reviewed By: dvyukov

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

3 years ago[TSan] Define C/C++ address ranges for SystemZ
Ilya Leoshkevich [Fri, 2 Jul 2021 00:44:43 +0000 (02:44 +0200)]
[TSan] Define C/C++ address ranges for SystemZ

The kernel supports a full 64-bit VMA, but we can use only 48 bits due
to the limitation imposed by SyncVar::GetId(). So define the address
ranges similar to the other architectures, except that the address
space "tail" needs to be made inaccessible in CheckAndProtect(). Since
it's for only one architecture, don't make an abstraction for this.

Reviewed By: dvyukov

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

3 years ago[TSan] Define PTHREAD_ABI_BASE for SystemZ
Ilya Leoshkevich [Fri, 2 Jul 2021 00:47:25 +0000 (02:47 +0200)]
[TSan] Define PTHREAD_ABI_BASE for SystemZ

SystemZ's glibc symbols use version 2.3.2.

Reviewed By: dvyukov

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

3 years ago[TSan] Build ignore_lib{0,1,5} tests with -fno-builtin
Ilya Leoshkevich [Thu, 8 Jul 2021 13:09:10 +0000 (15:09 +0200)]
[TSan] Build ignore_lib{0,1,5} tests with -fno-builtin

These tests depend on TSan seeing the intercepted memcpy(), so they
break when the compiler chooses the builtin version.

Reviewed By: dvyukov

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

3 years ago[TSan] Use zeroext for function parameters
Ilya Leoshkevich [Fri, 2 Jul 2021 00:42:24 +0000 (02:42 +0200)]
[TSan] Use zeroext for function parameters

SystemZ ABI requires zero-extending function parameters to 64-bit. The
compiler is free to optimize the code around this assumption, e.g.
failing to zero-extend __tsan_atomic32_load()'s morder may cause
crashes in to_mo() switch table lookup.

Fix by adding zeroext attributes to TSan's FunctionCallees, similar to
how it was done in commit 3bc439bdff8b ("[MSan] Add instrumentation for
SystemZ"). This is a no-op on arches that don't need it.

Reviewed By: dvyukov

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

3 years ago[TSan] Align thread_registry_placeholder
Ilya Leoshkevich [Tue, 13 Jul 2021 13:51:47 +0000 (15:51 +0200)]
[TSan] Align thread_registry_placeholder

s390x requires ThreadRegistry.mtx_.opaque_storage_ to be 4-byte
aligned. Since other architectures may have similar requirements, use
the maximum thread_registry_placeholder alignment from other
sanitizers, which is 64 (LSan).

Reviewed By: dvyukov

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

3 years ago[sanitizer] Force TLS allocation on s390
Ilya Leoshkevich [Tue, 13 Jul 2021 17:19:42 +0000 (19:19 +0200)]
[sanitizer] Force TLS allocation on s390

When running with an old glibc, CollectStaticTlsBlocks() calls
__tls_get_addr() in order to force TLS allocation. This function is not
available on s390 and the code simply does nothing in this case,
so all the resulting static TLS blocks end up being incorrect.

Fix by calling __tls_get_offset() on s390.

Reviewed By: dvyukov

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

3 years ago[sanitizer] Fix __sanitizer_kernel_sigset_t endianness issue
Ilya Leoshkevich [Fri, 2 Jul 2021 00:42:38 +0000 (02:42 +0200)]
[sanitizer] Fix __sanitizer_kernel_sigset_t endianness issue

setuid(0) hangs on SystemZ under TSan because TSan's BackgroundThread
ignores SIGSETXID. This in turn happens because internal_sigdelset()
messes up the mask bits on big-endian system due to how
__sanitizer_kernel_sigset_t is defined.

Commit d9a1a53b8d80 ("[ESan] [MIPS] Fix workingset-signal-posix.cpp on
MIPS") fixed this for MIPS by adjusting the __sanitizer_kernel_sigset_t
definition. Generalize this by defining __SANITIZER_KERNEL_NSIG based
on kernel's _NSIG and using uptr[] for __sanitizer_kernel_sigset_t.sig
on all platforms.

Reviewed By: dvyukov

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

3 years ago[Test] We can benefit from pipelining of ymm load/stores
Max Kazantsev [Thu, 15 Jul 2021 09:40:34 +0000 (16:40 +0700)]
[Test] We can benefit from pipelining of ymm load/stores

This patch demonstrates a scenario when we need to load/store a single
64-byte value, which is done by 2 ymm loads and stores in AVX. The current
codegen choses the following sequence:

  load ymm0
  load ymm1
  store ymm1
  store ymm0

If we instead stored ymm0 before ymm1, we could execute 2nd load and 1st store
in parallel.

3 years ago[AArch64][SME] Add outer product instructions
Cullen Rhodes [Thu, 15 Jul 2021 08:41:08 +0000 (08:41 +0000)]
[AArch64][SME] Add outer product instructions

This patch adds support for the following outer product instructions:

  * BFMOPA, BFMOPS, FMOPA, FMOPS, SMOPA, SMOPS, SUMOPA, SUMOPS, UMOPA,
    UMOPS, USMOPA, USMOPS.

Depends on D105570.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06

Reviewed By: david-arm

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

3 years ago[NFC] [hwasan] Split argument logic into functions.
Florian Mayer [Wed, 14 Jul 2021 11:50:50 +0000 (12:50 +0100)]
[NFC] [hwasan] Split argument logic into functions.

Reviewed By: vitalybuka

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

3 years agoFixes memory sanitizer 'use-of-uninitialized-value' diagnostic.
Bogdan Graur [Thu, 15 Jul 2021 09:15:17 +0000 (11:15 +0200)]
Fixes memory sanitizer 'use-of-uninitialized-value' diagnostic.

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

3 years agoFix undeduced type assert
serge-sans-paille [Mon, 7 Jun 2021 15:14:43 +0000 (17:14 +0200)]
Fix undeduced type assert

If the instantiation of a member variable makes it possible to
compute a previously undeduced type, we should use that piece of
information.

Fix bug#50590

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

3 years ago[llvm][tools] Hide unrelated llvm-bcanalyzer options
Timm Bäder [Tue, 13 Jul 2021 14:37:26 +0000 (16:37 +0200)]
[llvm][tools] Hide unrelated llvm-bcanalyzer options

They otherwise show up when we link against the dynamic libLLVM.so.

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

3 years ago[mlir][crunner] fix bug in memref copy for rank 0
Aart Bik [Thu, 15 Jul 2021 04:01:00 +0000 (21:01 -0700)]
[mlir][crunner] fix bug in memref copy for rank 0

While replacing linalg.copy with the more desired memref.copy
I found a bug in the support library for rank 0 memref copying.
The code would loop for something like the following, since there
is code for no-rank and rank > 0, but rank == 0 was unexpected.

  memref.copy %0, %1: memref<f32> to memref<f32>

Note that a "regression test" for this will follow using the
sparse compiler migration to memref.copy which exercises this
case many times.

Reviewed By: herhut

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

3 years ago[gn build] Port b0d38ad0bc25
LLVM GN Syncbot [Thu, 15 Jul 2021 07:50:35 +0000 (07:50 +0000)]
[gn build] Port b0d38ad0bc25

3 years ago[clang][Analyzer] Add symbol uninterestingness to bug report.
Balázs Kéri [Thu, 15 Jul 2021 06:34:59 +0000 (08:34 +0200)]
[clang][Analyzer] Add symbol uninterestingness to bug report.

`PathSensitiveBughReport` has a function to mark a symbol as interesting but
it was not possible to clear this flag. This can be useful in some cases,
so the functionality is added.

Reviewed By: NoQ

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

3 years ago[2/2][RemoveRedundantDebugValues] Add a Pass that removes redundant DBG_VALUEs
Djordje Todorovic [Thu, 15 Jul 2021 06:45:19 +0000 (23:45 -0700)]
[2/2][RemoveRedundantDebugValues] Add a Pass that removes redundant DBG_VALUEs

This patch adds the forward scan for finding redundant DBG_VALUEs.

This analysis aims to remove redundant DBG_VALUEs by going forward
in the basic block by considering the first DBG_VALUE as a valid
until its first (location) operand is not clobbered/modified.
For example:

(1) DBG_VALUE $edi, !"var1", ...
(2) <block of code that does affect $edi>
(3) DBG_VALUE $edi, !"var1", ...
 ...
in this case, we can remove (3).

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

3 years ago[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x44
Tony Tye [Wed, 14 Jul 2021 03:31:04 +0000 (03:31 +0000)]
[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x44

Reviewed By: rampitec

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

3 years ago[Coroutines] Run coroutine passes by default
Chuanqi Xu [Thu, 15 Jul 2021 06:31:31 +0000 (14:31 +0800)]
[Coroutines] Run coroutine passes by default

This patch make coroutine passes run by default in LLVM pipeline. Now
the clang and opt could handle IR inputs containing coroutine intrinsics
without special options.
It should be fine. On the one hand, the coroutine passes seems to be stable
since there are already many projects using coroutine feature.
On the other hand, the coroutine passes should do nothing for IR who doesn't
contain coroutine intrinsic.

Test Plan: check-llvm

Reviewed by: lxfind, aeubanks

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

3 years agoDefend early against operation created without a registered dialect
Mehdi Amini [Thu, 15 Jul 2021 02:13:30 +0000 (02:13 +0000)]
Defend early against operation created without a registered dialect

Reviewed By: rriddle

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

3 years ago[MLIR] [Python] Add `owner` to PyValue and fix its parent reference
John Demme [Thu, 15 Jul 2021 03:19:27 +0000 (20:19 -0700)]
[MLIR] [Python] Add `owner` to PyValue and fix its parent reference

Adds `owner` python call to `mlir.ir.Value`.

Assuming that `PyValue.parentOperation` is intended to be the value's owner, this fixes the construction of it from `PyOpOperandList`.

Reviewed By: stellaraccident

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

3 years agoRevert "Defend early against operation created without a registered dialect"
Mehdi Amini [Thu, 15 Jul 2021 03:31:19 +0000 (03:31 +0000)]
Revert "Defend early against operation created without a registered dialect"

This reverts commit 58018858e887320e2432e2e00ace13273b8a1f29.

The Python bindings test are broken.

3 years ago[Attributor] AACallEdges, Add a way to ask nonasm unknown callees
Kuter Dinel [Wed, 14 Jul 2021 15:42:51 +0000 (18:42 +0300)]
[Attributor] AACallEdges, Add a way to ask nonasm unknown callees

This patch adds a feature to AACallEdges AbstractAttribute that allows
users to ask if there is a unknown callee that isn't a inline assembly.
This feature is needed by some of it's users.

Reviewed By: jdoerfert

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

3 years agoDefend early against operation created without a registered dialect
Mehdi Amini [Thu, 15 Jul 2021 02:13:30 +0000 (02:13 +0000)]
Defend early against operation created without a registered dialect

Reviewed By: rriddle

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

3 years ago[PowerPC][NFC] add testcase for update-form preparation with non-const increment
Chen Zheng [Thu, 15 Jul 2021 02:20:01 +0000 (02:20 +0000)]
[PowerPC][NFC] add testcase for update-form preparation with non-const increment

3 years ago[mlir][linalg] Improve codegen when tiling PadTensor evenly
Matthias Springer [Thu, 15 Jul 2021 02:27:52 +0000 (11:27 +0900)]
[mlir][linalg] Improve codegen when tiling PadTensor evenly

Produce simpler IR with more static type information and fewer affine expressions.

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

3 years ago[mlir][linalg] Improve codegen of ExtractSliceOfPadTensorSwapPattern
Matthias Springer [Thu, 15 Jul 2021 02:05:12 +0000 (11:05 +0900)]
[mlir][linalg] Improve codegen of ExtractSliceOfPadTensorSwapPattern

Generate simpler code in case low/high padding of the PadTensorOp is statically zero.

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

3 years ago[mlir][linalg] Fix Windows build
Matthias Springer [Thu, 15 Jul 2021 01:55:22 +0000 (10:55 +0900)]
[mlir][linalg] Fix Windows build

The build failure was introduced by D105458. (Linux builds were not affected.)

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

3 years ago[mlir][linalg] Tile PadTensorOp
Matthias Springer [Thu, 15 Jul 2021 01:35:46 +0000 (10:35 +0900)]
[mlir][linalg] Tile PadTensorOp

Tiling can be enabled with `linalg-tile-pad-tensor-ops`. Only scf::ForOp can be generated at the moment.

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

3 years ago[mlir][NFC] Move asOpFoldResult helper functions to StaticValueUtils
Matthias Springer [Thu, 15 Jul 2021 01:28:25 +0000 (10:28 +0900)]
[mlir][NFC] Move asOpFoldResult helper functions to StaticValueUtils

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

3 years ago[mlir][linalg] Add optional output operand to PadTensorOp
Matthias Springer [Thu, 15 Jul 2021 01:20:00 +0000 (10:20 +0900)]
[mlir][linalg] Add optional output operand to PadTensorOp

This optional operand will be used for tiling in a subsequent commit.

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

3 years ago[mlir][linalg][NFC] Factor out tile generation in makeTiledShapes
Matthias Springer [Thu, 15 Jul 2021 01:11:35 +0000 (10:11 +0900)]
[mlir][linalg][NFC] Factor out tile generation in makeTiledShapes

Factor out the functionality into a new function, so that it can be used for creating PadTensorOp tiles.

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

3 years ago[gn build] Port b9c3941cd61d
LLVM GN Syncbot [Thu, 15 Jul 2021 01:12:36 +0000 (01:12 +0000)]
[gn build] Port b9c3941cd61d

3 years ago[PowerPC] Generate inlined quadword lock free atomic operations via AtomicExpand
Kai Luo [Thu, 15 Jul 2021 00:49:42 +0000 (00:49 +0000)]
[PowerPC] Generate inlined quadword lock free atomic operations via AtomicExpand

This patch uses AtomicExpandPass to implement quadword lock free atomic operations. It adopts the method introduced in https://reviews.llvm.org/D47882, which expand atomic operations post RA to avoid spilling that might prevent LL/SC progress.

Reviewed By: jsji

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

3 years ago[OpenCL] opencl-c.h: CL3.0 generic address space
Dave Airlie [Thu, 15 Jul 2021 00:51:01 +0000 (10:51 +1000)]
[OpenCL] opencl-c.h: CL3.0 generic address space

This is one of the easier pieces of adding CL3.0 support.

Reviewed By: Anastasia

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

3 years ago[OpenCL][NFC] opencl-c.h: reorder atomic operations
Dave Airlie [Thu, 15 Jul 2021 00:48:19 +0000 (10:48 +1000)]
[OpenCL][NFC] opencl-c.h: reorder atomic operations

This just reorders the atomics, it doesn't change anything except their layout in the header.

This is a prep patch for adding some conditionals around these for CL3.0 but that patch is much easier to review if all the atomic operations are grouped together like this.

Reviewed By: Anastasia

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

3 years agolibclc: Add -cl-no-stdinc to clang flags on clang >=13
Jan Vesely [Thu, 15 Jul 2021 00:41:50 +0000 (10:41 +1000)]
libclc: Add -cl-no-stdinc to clang flags on clang >=13

cf3ef15a6ec5e5b45c6c54e8fbe3769255e815ce ("[OpenCL] Add builtin
declarations by default.")
 switched behaviour to include "opencl-c-base.h". We don't want or need
 that for libclc so pass the flag to revert to old behaviour.

Fixes build since cf3ef15a6ec5e5b45c6c54e8fbe3769255e815ce

Reviewed By: tstellar

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

3 years ago[AMDGPU] Use update_test_checks.py script for annotate kernel features tests.
Kuter Dinel [Tue, 13 Jul 2021 02:14:50 +0000 (05:14 +0300)]
[AMDGPU] Use update_test_checks.py script for annotate kernel features tests.

This patch makes the annotate kernel features tests use the update_tests_checks.py
script. Which makes it easy to update the tests.

Reviewed By: arsenm

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

3 years ago[libc++] NFCI: Restore code duplication in wrap_iter, with test.
Arthur O'Dwyer [Wed, 14 Jul 2021 04:01:47 +0000 (00:01 -0400)]
[libc++] NFCI: Restore code duplication in wrap_iter, with test.

It turns out that D105040 broke `std::rel_ops`; we actually do need
both a one-template-parameter and a two-template-parameter version of
all the comparison operators, because if we have only the heterogeneous
two-parameter version, then `x > x` is ambiguous:

    template<class T, class U> int f(S<T>, S<U>) { return 1; }
    template<class T> int f(T, T) { return 2; }  // rel_ops
    S<int> s; f(s,s);  // ambiguous between #1 and #2

Adding the one-template-parameter version fixes the ambiguity:

    template<class T, class U> int f(S<T>, S<U>) { return 1; }
    template<class T> int f(T, T) { return 2; }  // rel_ops
    template<class T> int f(S<T>, S<T>) { return 3; }
    S<int> s; f(s,s);  // #3 beats both #1 and #2

We have the same problem with `reverse_iterator` as with `__wrap_iter`.
But so do libstdc++ and Microsoft, so we're not going to worry about it.

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

3 years ago[clang] Refactor AST printing tests to share more infrastructure
Nathan Ridge [Tue, 6 Jul 2021 05:40:24 +0000 (01:40 -0400)]
[clang] Refactor AST printing tests to share more infrastructure

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

3 years ago[WebAssembly] Codegen for v128.storeX_lane instructions
Thomas Lively [Wed, 14 Jul 2021 23:15:24 +0000 (16:15 -0700)]
[WebAssembly] Codegen for v128.storeX_lane instructions

Replace the experimental clang builtins and LLVM intrinsics for these
instructions with normal codegen patterns. Resolves PR50435.

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

3 years ago[GlobalOpt] Fix a miscompile when evaluating struct initializers.
Jon Roelofs [Mon, 12 Jul 2021 19:43:45 +0000 (12:43 -0700)]
[GlobalOpt] Fix a miscompile when evaluating struct initializers.

The bug was that evaluateBitcastFromPtr attempts a narrowing to a struct's 0th
element of a store that covers other elements. While this is okay on the load
side, applying it to stores causes us to miss the writes to the additionally
covered elements.

rdar://79503568

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

3 years ago[Support] Turn on SupportTest for Apple Silicon
Steven Wu [Wed, 14 Jul 2021 22:23:37 +0000 (15:23 -0700)]
[Support] Turn on SupportTest for Apple Silicon

Follow up for D106012, turn on unittest for Host on Apple Silicon.

Reviewed By: dexonsmith

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