Commit Graph

396435 Commits

Author SHA1 Message Date
Giorgis Georgakoudis 60e643fe05 [OpenMP][Fix] Fix disable spmdization option
Besides SPMDization, other analysis and optimization for original, frontend-generated SPMD regions uses information from the AAKernelInfoFunction attribute. This fix makes sure disabling SPMDization through the corresponding option applies only to generic mode regions, which should not be SPMDized, while it leaves unaffected the attribute state of original SPMD regions.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D108001
2021-08-12 17:59:14 -07:00
Ruiling Song e1beebbac5 SplitKit: Don't further split subrange mask in buildCopy
We may use several COPY instructions to copy the needed sub-registers
during split. But the way we split the lanes during the COPYs may be
different from the subranges of the old register. This would fail when we
extend the subranges of the new register because the LaneMasks do not
match exactly between subranges of new register and old register.
Since we are bundling the COPYs, I think there is no need to further refine the
subranges of the new register based on the set of LaneMasks of the inserted COPYs.

I am not sure if there will be further breaking cases. But as the subranges of
new register are created based on the LaneMasks of the subranges of old register,
it will be highly possible we will always find an exact LaneMask match.
We can think about how to make the extendPHIKillRanges() work for
subrange mask mismatch case if we meet more such cases in the future.

The test case was from D105065 by @arsenm.

Differential Revision: https://reviews.llvm.org/D107829
2021-08-13 07:36:38 +08:00
Yonghong Song 1b194ef1ab [Clang] add btf_tag attribute
A new attribute btf_tag is added. The syntax looks like
  __attribute__((btf_tag(<string>)))

Users may tag a particular structure/member/function/func_parameter/variable
declaration with an arbitrary string and the intention is
that this string is passed to dwarf so it is available for
post-compilation analysis. The string will be also passed
to .BTF section if the target is BPF. For each permitted
declaration, multiple btf_tag's are allowed.
For detailed use cases, please see
  https://lists.llvm.org/pipermail/llvm-dev/2021-June/151009.html

In case that there exist redeclarations, the btf_tag attributes
will be accumulated along with different declarations, and the
last declaration will contain all attributes.

Differential Revision: https://reviews.llvm.org/D106614
2021-08-12 16:34:22 -07:00
Heejin Ahn adb96d2e76 [WebAssembly] Fix leak in Emscripten SjLj
For SjLj, we allocate a table to record setjmp buffer info in the entry
of each setjmp-calling function by inserting a `malloc` call, and insert
a `free` call to free the buffer before each `ret` instruction.

But this is not sufficient; we have to free the buffer before we throw.
In SjLj handling, normal functions that can possibly throw or longjmp
are wrapped with an invoke and caught within the function so they don't
end up escaping the function. But three functions throw and escape the
function:
- `__resumeException` (Emscripten library function used for Emscripten
  EH)
- `emscripten_longjmp` (Emscripten library function used for Emscripten
  SjLj)
- `__cxa_throw` (libc++abi function called when for C++ `throw` keyword)

The first two functions are used to rethrow the current
exception/longjmp when the caught exception/longjmp is not for the
current function. `__cxa_throw` is used for exception, and because we
consider that a function that cannot longjmp, it escapes the function
right away, before which we should free the buffer.

Currently `lsan.test_longjmp3` and `lsan.test_exceptions_longjmp3` fail
in Emscripten; this CL fixes these.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D107852
2021-08-12 16:32:46 -07:00
Heejin Ahn aca198cf74 [WebAssembly] Error out when Emscripten SjLj setjmp is used with Wasm EH
Currently, when Wasm EH is used with Emscripten SjLj, Emscripten SjLj
cannot handle `invoke` instructions - it assumes all `invoke`s have been
lowered away with Emscripten EH. But in Wasm EH they are lowered in
instruction selection, so they are still present in the IR stage. This
happens when
1. Wasm EH and Emscripten SjLj are used together
2. A function that calls `setjmp` uses exceptions, i.e., has `invoke`s

We were already erroring out with an assertion failure in this case, but
this CL makes it error out more properly with a valid error message.

Wasm EH + Wasm SjLj will not have this restrictions. (it will have
another restriction though, e.g., `setjmp` cannot be called within
`catch`. But why would anyone do that..)

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D107687
2021-08-12 16:19:04 -07:00
Vitaly Buka bf6000dc98 [sanitizer] Fix the test on Solaris
On Solaris sem_open on the same name returns the same pointer, and
then sem_close fails the call.
2021-08-12 16:10:23 -07:00
Duncan P. N. Exon Smith b714f73def Frontend: Add -f{,no-}implicit-modules-uses-lock and -Rmodule-lock
Add -cc1 flags `-fmodules-uses-lock` and `-fno-modules-uses-lock` to
allow the lock manager to be turned off when building implicit modules.

Add `-Rmodule-lock` so that we can see when it's being used.

Differential Revision: https://reviews.llvm.org/D95583
2021-08-12 15:58:19 -07:00
natashaknk ba0997ca09 [mlir][tosa] Fix depthwise_conv2D strides/dilation and name
Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D107997
2021-08-12 15:43:41 -07:00
Sam McCall 2ff7ca98a9 [clangd] Avoid "expected one compiler job" by picking the first eligible job.
This happens in createInvocationWithCommandLine but only clangd currently passes
ShouldRecoverOnErorrs (sic).

One cause of this (with correct command) is several -arch arguments for mac
multi-arch support.

Fixes https://github.com/clangd/clangd/issues/827

Differential Revision: https://reviews.llvm.org/D107632
2021-08-13 00:36:30 +02:00
Christian Kandeler 6b28835b37 clangd: Make documentation property of completion items more similar
... to the one of signature hints.
In particular, completion items now also carry annotations, which client
code might be interested in.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D107365
2021-08-13 00:18:15 +02:00
Duncan P. N. Exon Smith c130300f8b Frontend: Refactor compileModuleAndReadAST, NFC
This renames `compileModuleAndReadAST`, adding a `BehindLock` suffix,
and refactors it to significantly reduce nesting.

- Split out helpers `compileModuleAndReadASTImpl` and
  `readASTAfterCompileModule` which have straight-line code that doesn't
  worry about locks.
- Use `break` in the interesting cases of `switch` statements to reduce
  nesting.
- Use early `return`s to reduce nesting.

Detangling the compile-and-read logic from the check-for-locks logic
should be a net win for readability, although I also have a side
motivation of making the locks optional in a follow-up.

No functionality change here.

Differential Revision: https://reviews.llvm.org/D95581
2021-08-12 15:16:08 -07:00
Christian Kandeler f9c8602b53 clangd: Provide hover info for include directives
It's quite useful to be able to hover over an #include and see the full
path to the header file.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D107137
2021-08-13 00:07:23 +02:00
Sam McCall ece4e92085 [CodeComplete] Basic code completion for attribute names.
Only the bare name is completed, with no args.
For args to be useful we need arg names. These *are* in the tablegen but
not currently emitted in usable form, so left this as future work.

C++11, C2x, GNU, declspec, MS syntax is supported, with the appropriate
spellings of attributes suggested.
`#pragma clang attribute` is supported but not terribly useful as we
only reach completion if parens are balanced (i.e. the line is not truncated)

There's no filtering of which attributes might make sense in this
grammatical context (e.g. attached to a function). In code-completion context
this is hard to do, and will only work in few cases :-(

There's also no filtering by langopts: this is because currently the
only way of checking is to try to produce diagnostics, which requires a
valid ParsedAttr which is hard to get.
This should be fairly simple to fix but requires some tablegen changes
to expose the logic without the side-effect.

Differential Revision: https://reviews.llvm.org/D107696
2021-08-12 23:49:10 +02:00
Sam McCall 3b99acbff2 [Attributes]: refactor to expose ParsedAttrInfo::acceptsLangOpts. NFC
We will use this function to filter code completion of attributes.

Differential Revision: https://reviews.llvm.org/D107836
2021-08-12 23:47:01 +02:00
Sam McCall 08c04ca005 [clangd] Overload bundles are only deprecated if each overloads is.
Fixes https://github.com/clangd/clangd/issues/705

Differential Revision: https://reviews.llvm.org/D97803
2021-08-12 23:46:08 +02:00
Jason Molenda 7150b56208 Symbolicate aarch64 adrp+add pc-relative addr in disass
On aarch64 a two instruction sequence is used to calculate a
pc-relative address, add some state to the DisassemblerLLVMC
symbolicator so it can track the necessary data across the
two instructions and compute the address being calculated.

Differential Revision: https://reviews.llvm.org/D107213
rdar://49119253
2021-08-12 14:44:17 -07:00
Lei Huang 8930af45c3 [PowerPC] Implement XL compatibility builtin __addex
Add builtin and intrinsic for `__addex`.

This patch is part of a series of patches to provide builtins for
compatibility with the XL compiler.

Reviewed By: stefanp, nemanjai, NeHuang

Differential Revision: https://reviews.llvm.org/D107002
2021-08-12 16:38:21 -05:00
Michael Jones 472fa04de8 [libc][nfc] add CPP Limits.h for numeric_limits
Add an implementation of numeric_limits for use in str_conv_utils.
It currently only supports the basic integer types, with more types
coming as needed.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D107987
2021-08-12 21:31:16 +00:00
Chia-hung Duan 62df4df41c [mlir-tblgen] Minor Refactor for StaticVerifierFunctionEmitter.
Move StaticVerifierFunctionEmitter to CodeGenHelper.h so that it can be
used for both ODS and DRR.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D106636
2021-08-12 20:53:05 +00:00
Vyacheslav Zakharin 15497e62f6 [openmp][ELF] Recognize LLVM OpenMP offload specific notes
The new ELF notes are added in clang-offload-wrapper, and llvm-readobj has to visualize them properly.

Differential Revision: https://reviews.llvm.org/D99552
2021-08-12 13:47:48 -07:00
Heejin Ahn 78e87970af [WebAssembly] Disable offset folding for function addresses
Wasm does not support function addresses with offsets, but isel can
generate folded SDValues in the form of (@func + offset) without this
patch.

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

Reviewed By: dschuff, sbc100

Differential Revision: https://reviews.llvm.org/D107940
2021-08-12 13:40:41 -07:00
Thomas Preud'homme 1e11ccad83 [clang/test] Run thinlto-clang-diagnostic-handler-in-be.c on x86
Clang test CodeGen/thinlto-clang-diagnostic-handler-in-be.c fails on
some non x86 targets, e.g. hexagon. Since the test already requires x86
to be available as a target this commit forces the target to x86_64.

Reviewed By: steven_wu

Differential Revision: https://reviews.llvm.org/D107667
2021-08-12 21:38:35 +01:00
Sanjay Patel 14eefa57f2 [InstCombine] factorize min/max intrinsic ops with common operand (2nd try)
This is a re-try of 6de1dbbd09 which was reverted because
it missed a null check. Extra test for that failure added.

Original commit message:
This is an adaptation of D41603 and another step on the way
to canonicalizing to the intrinsic forms of min/max.

See D98152 for status.
2021-08-12 16:32:07 -04:00
peter klausler a05bae6163 [flang] Correct off-by-one error in SET_EXPONENT
SET_EXPONENT is returning values that are too large by a factor
of two.

Differential Revision: https://reviews.llvm.org/D107986
2021-08-12 12:50:16 -07:00
Craig Topper a2556bf44c [RISCV] Improve check prefixes in B extension tests. NFC
-Add Z for the B extension subextensions.
-Don't mention I along with B or its sub extensions.

This is based on comments in D107817.

Differential Revision: https://reviews.llvm.org/D107992
2021-08-12 12:41:40 -07:00
Amy Huang 427520a8fa Revert "[InstCombine] factorize min/max intrinsic ops with common operand"
This reverts commit 6de1dbbd09 because it causes a
compiler crash.
2021-08-12 12:36:25 -07:00
Andrzej Warzynski 8150c1bd8e [flang] Disable Plugins in out-of-tree builds
https://reviews.llvm.org/D106137 added support for plugins in Flang. The
CMake configuration for plugins requires some LLVM variables that are
not available in out-of-tree builds (e.g. `LLVM_SHLIB_OUTPUT_INTDIR`).
This has caused the out-of-tree BuildBot worker to start failing:
  * https://lab.llvm.org/buildbot/#/builders/175

This patch effectively disables plugins in out-of-tree builds and fixes
the configuration error. In order to support plugins in out-of-tree
builds, we would have to find a way to access the missing CMake
variables from LLVM. This could be implemented at a later time.

Differential Revision: https://reviews.llvm.org/D107973
2021-08-12 19:29:28 +00:00
Sam McCall 18f9e25ce1 [AST][clangd] Expose documentation of Attrs on hover.
This adds a method to Attr to get at the documentation programmatically.

Differential Revision: https://reviews.llvm.org/D107703
2021-08-12 21:16:37 +02:00
Vitaly Buka 2f1ee56f3c [unwind] Handle UNW_X86_64_RIP register
In some binaries, built with clang/lld, libunwind crashes
with "unsupported x86_64 register" for regNum == 16:

Differential Revision: https://reviews.llvm.org/D107919
2021-08-12 12:08:07 -07:00
Michael Kruse 5a6d770651 [Polly] Fix compiler warnings. NFC. 2021-08-12 13:35:20 -05:00
Bill Wendling b61359f92b [llvm-diff] correct variable typo 2021-08-12 11:29:48 -07:00
Bill Wendling 39809eb1b3 [llvm-diff] add "reset" method to DiffConsumer
A DiffConsumer object may be reused, but we'd like to reset it before
the next use.

No functionality change intended.

Differential Revision: https://reviews.llvm.org/D107985
2021-08-12 11:25:47 -07:00
Aart Bik 56d607006d [mlir][sparse][python] add an "exhaustive" sparse test using python
Using the python API to easily set up sparse kernels, this test
exhaustively builds, compilers, and runs SpMM for all annotations
on a sparse tensor, making sure every version generates the correct
result. This test also illustrates using the python API to set up
a sparse kernel and sparse compilation.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D107943
2021-08-12 11:13:04 -07:00
Vyacheslav Zakharin 50c7e299f1 [NFC] Enumerate LLVMOMPOFFLOAD note types.
It is a NFC to enumerate types of LLVMOMPOFFLOAD ELF notes.

Differential Revision: https://reviews.llvm.org/D99612
2021-08-12 11:01:41 -07:00
Ivan Zhechev 35249cb7b1 [Flang] Fix error messages on Windows.
Flang uses positional arguments for `messages::say()`, such as "%1$s" which is only supported in MS Compilers with the `_*printf_p` form of the function. This uses a conditional macro to convert the existing `vsnprintf` used to the one needed in MS-World.

7 tests in D107575 rely on this change.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D107654
2021-08-12 18:35:54 +01:00
Florian Hahn f999312872
Recommit "[Matrix] Overload stride arg in matrix.columnwise.load/store."
This reverts the revert 28c04794df.

The failing MLIR test that caused the revert should be fixed  in this
version.

Also includes a PPC test fix previously in 1f87c7c478.
2021-08-12 18:31:57 +01:00
Louis Dionne 6900df37d2 [libc++] Remove Lit annotations for unsupported GCC versions from the test suite
Since we officially don't support several older compilers now, we can
drop a lot of the markup in the test suite. This helps keep the test
suite simple and makes sure that UNSUPPORTED annotations don't rot.

This is the first patch of a series that will remove annotations for
compilers that are now unsupported.

Differential Revision: https://reviews.llvm.org/D107787
2021-08-12 13:30:47 -04:00
LLVM GN Syncbot f5d32c56ee [gn build] Port 4ac87e3378 2021-08-12 17:16:05 +00:00
Kiran Chandramohan 4573c31f89 [Flang] Fix build failure on MacOS
std::clock_t can be an unsigned value on some platforms like MacOS and
therefore needs a cast when initializing an std::clock_t value with -1.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D107972
2021-08-12 18:14:46 +01:00
Craig Topper e25665f52e [RISCV] Add test cases showing inefficient materialization for stores of immediates. NFC
DAGCombiner::visitStore can call GetDemandedBits which will remove
upper bits from immediates. The upper bits are important for good
materialization of negative constants on RISCV. GetDemandedBits is a
different mechanism than SimplifyDemandedBits so
TargetShrinkDemandedConstant can't block it.

As far as I know this behavior is unique to stores.

I think we can fix this in isel using a concept similar to D107658.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D107860
2021-08-12 10:14:07 -07:00
zoecarver 4ac87e3378 [libcxx][ranges] Add `unreachable_sentinel`.
Differential Revision: https://reviews.llvm.org/D107920
2021-08-12 10:11:27 -07:00
Craig Topper 79fbddbea0 [RISCV] Teach vsetvli insertion pass that it doesn't need to insert vsetvli for unit-stride or strided loads/stores in some cases.
For unit-stride and strided load/stores we set the SEW operand of
the pseudo instruction equal the EEW in the opcode. The LMUL
of the pseudo instruction is the LMUL we want.

These instructions calculate EMUL=(EEW/SEW) * LMUL. We can use
this to avoid changing vtype if the SEW/LMUL of the previous
vtype matches the EEW/EMUL ratio we need for the instruction.

Due to how the global analysis works, we can only do this
optimization when the previous vsetvli was produced in the block
containing the store. We need to know in the first phase if the
vsetvli will be inserted so we can propagate information to
the successors in the second phase correctly. This means we can't
depend on predecessors.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D106601
2021-08-12 10:05:27 -07:00
Craig Topper f66ba5fcef [Sema] Fix -Wparentheses warning from gcc. NFC 2021-08-12 10:05:27 -07:00
Craig Topper 6171f84942 [RISCV] Use getNaturalPointeeTypeAlignment to get alignment for stores created for vector builtins.
Instead of using scalar size divided by 8 for segment loads, get
the alignment from clang's type system.

Make vleff match for consistency.

Also replace uses of getPointerElementType() which will be removed as part of the OpaquePtr changes.

Reviewed By: HsiangKai

Differential Revision: https://reviews.llvm.org/D106738
2021-08-12 10:05:27 -07:00
Roman Lebedev f30a7dff8a
[NFCI][SimplifyCFG] simplifyCondBranch(): assert that branch is non-tautological
We really shouldn't deal with a conditional branch that can be trivially
constant-folded into an unconditional branch.

Indeed, barring failure to trigger BB reprocessing, that should be true,
so let's assert as much, and hope the assertion never fires.
If it does, we have a bug to fix.
2021-08-12 20:03:09 +03:00
Roman Lebedev 628f63d3d5
[SimplifyCFG] If FoldTwoEntryPHINode() changed things, restart
Mainly, i want to add an assertion that `SimplifyCFGOpt::simplifyCondBranch()`
doesn't get asked to deal with non-unconditional branches,
and if i do that, then said assertion fires on existing tests,
and this is what prevents it from firing.
2021-08-12 20:03:09 +03:00
Kazu Hirata 45938114b2 [DWARF] Remove getMaxLineIncrementForSpecialOpcode (NFC)
The function was introduced without a use on Sep 16, 2011 in
commit 5acab501de.
2021-08-12 09:53:49 -07:00
Jon Chesterfield 6a8e5120ab Revert "[openmp] Annotate tmp variables with omp_thread_mem_alloc"
This reverts commit b6113548c9.
2021-08-12 17:44:36 +01:00
Sanjay Patel 790c29ab86 [InstCombine] fold umax/umin intrinsics based on demanded bits
This is a direct translation of the select folds added with
D53033 / D53036 and another step towards canonicalization
using the intrinsics (see D98152).
2021-08-12 12:37:45 -04:00
Sanjay Patel 4b2fd1149d [InstCombine] add test for umax/umin intrinsic demanded bits; NFC 2021-08-12 12:37:44 -04:00