Eugene Zhulenev [Fri, 8 Jan 2021 23:23:59 +0000 (15:23 -0800)]
[mlir] AsyncRuntime: use LLVM ThreadPool to run async tasks
Revert https://reviews.llvm.org/D92368 after the dynamic library unloading was fixed in https://reviews.llvm.org/D94312
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D94346
Heejin Ahn [Sat, 26 Dec 2020 04:23:33 +0000 (20:23 -0800)]
[WebAssembly] Remove exnref and br_on_exn
This removes `exnref` type and `br_on_exn` instruction. This is
effectively NFC because most uses of these were already removed in the
previous CLs.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94041
Heejin Ahn [Sat, 26 Dec 2020 10:27:44 +0000 (02:27 -0800)]
[WebAssembly] Update basic EH instructions for the new spec
This implements basic instructions for the new spec.
- Adds new versions of instructions: `catch`, `catch_all`, and `rethrow`
- Adds support for instruction selection for the new instructions
- `catch` needs a custom routine for the same reason `throw` needs one,
to encode `__cpp_exception` tag symbol.
- Updates `WebAssembly::isCatch` utility function to include `catch_all`
and Change code that compares an instruction's opcode with `catch` to
use that function.
- LateEHPrepare
- Previously in LateEHPrepare we added `catch` instruction to both
`catchpad`s (for user catches) and `cleanuppad`s (for destructors).
In the new version `catch` is generated from `llvm.catch` intrinsic
in instruction selection phase, so we only need to add `catch_all`
to the beginning of cleanup pads.
- `catch` is generated from instruction selection, but we need to
hoist the `catch` instruction to the beginning of every EH pad,
because `catch` can be in the middle of the EH pad or even in a
split BB from it after various code transformations.
- Removes `addExceptionExtraction` function, which was used to
generate `br_on_exn` before.
- CFGStackfiy: Deletes `fixUnwindMismatches` function. Running this
function on the new instruction causes crashes, and the new version
will be added in a later CL, whose contents will be completely
different. So deleting the whole function will make the diff easier to
read.
- Reenables all disabled tests in exception.ll and eh-lsda.ll and a
single basic test in cfg-stackify-eh.ll.
- Updates existing tests to use the new assembly format. And deletes
`br_on_exn` instructions from the tests and FileCheck lines.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94040
Fangrui Song [Sat, 9 Jan 2021 08:46:02 +0000 (00:46 -0800)]
Fix CodeGenCXX/difile_entry.cpp on Windows
Fangrui Song [Sat, 9 Jan 2021 08:32:02 +0000 (00:32 -0800)]
Make -fno-pic respect -fno-direct-access-external-data
D92633 added -f[no-]direct-access-external-data to supersede -m[no-]pie-copy-relocations.
(The option works for -fpie but is a no-op for -fno-pic and -fpic.)
This patch makes -fno-pic -fno-direct-access-external-data drop dso_local from
global variable declarations. This usually causes the backend to emit a GOT
indirection for external data access. With a GOT relocation, the subsequent
-no-pie link will not have copy relocation even if the data symbol turns out to
be defined by a shared object.
Differential Revision: https://reviews.llvm.org/D92714
Fangrui Song [Sat, 9 Jan 2021 08:29:09 +0000 (00:29 -0800)]
Add -f[no-]direct-access-external-data to supersede -mpie-copy-relocations
GCC r218397 "x86-64: Optimize access to globals in PIE with copy reloc" made
-fpie code emit R_X86_64_PC32 to reference external data symbols by default.
Clang adopted -mpie-copy-relocations D19996 as a flexible alternative.
The name -mpie-copy-relocations can be improved [1] and does not capture the
idea that this option can apply to -fno-pic and -fpic [2], so this patch
introduces -f[no-]direct-access-external-data and makes -mpie-copy-relocations
their aliases for compatibility.
[1]
For
```
extern int var;
int get() { return var; }
```
if var is defined in another translation unit in the link unit, there is no copy
relocation.
[2]
-fno-pic -fno-direct-access-external-data is useful to avoid copy relocations.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65888
If a shared object is linked with -Bsymbolic or --dynamic-list and exports a
data symbol, normally the data symbol cannot be accessed by -fno-pic code
(because by default an absolute relocation is produced which will lead to a copy
relocation). -fno-direct-access-external-data can prevent copy relocations.
-fpic -fdirect-access-external-data can avoid GOT indirection. This is like the
undefined counterpart of -fno-semantic-interposition. However, the user should
define var in another translation unit and link with -Bsymbolic or
--dynamic-list, otherwise the linker will error in a -shared link. Generally
the user has better tools for their goal but I want to mention that this
combination is valid.
On COFF, the behavior is like always -fdirect-access-external-data.
`__declspec(dllimport)` is needed to enable indirect access.
There is currently no plan to affect non-ELF behaviors or -fpic behaviors.
-fno-pic -fno-direct-access-external-data will be implemented in the subsequent patch.
GCC feature request https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112
Reviewed By: tmsriram
Differential Revision: https://reviews.llvm.org/D92633
Heejin Ahn [Sat, 26 Dec 2020 02:38:59 +0000 (18:38 -0800)]
[WebAssembly] Update WasmEHPrepare for the new spec
Clang generates `wasm.get.exception` and `wasm.get.ehselector`
intrinsics, which respectively return a caught exception value (a
pointer to some C++ exception struct) and a selector (an integer value
that tells which C++ `catch` clause the current exception matches, or
does not match any).
WasmEHPrepare is a pass that does some IR-level preparation before
instruction selection. Previously one of things we did in this pass was
to convert `wasm.get.exception` intrinsic calls to
`wasm.extract.exception` intrinsics. Their semantics were the same
except `wasm.extract.exception` did not have a token argument. We
maintained these two separate intrinsics with the same semantics because
instruction selection couldn't handle token arguments. This
`wasm.extract.exception` intrinsic was later converted to
`extract_exception` instruction in instruction selection, which was a
pseudo instruction to implement `br_on_exn`. Because `br_on_exn` pushed
an extracted value onto the value stack after the `end` instruction of a
`block`, but LLVM does not have a way of modeling that kind of behavior,
so this pseudo instruction was used to pull an extracted value out of
thin air, like this:
```
block $l0
...
br_on_exn $cpp_exception $l0
...
end
extract_exception ;; pushes values onto the stack
```
In the new spec, we don't need this pseudo instruction anymore because
`catch` itself returns a value and we don't have `br_on_exn` anymore. In
the spec `catch` returns multiple values (like `br_on_exn`), but here we
assume it only returns a single i32, which is sufficient to support C++.
So this renames `wasm.get.exception` intrinsic to `wasm.catch`. Because
this CL does not yet contain instruction selection for `wasm.catch`
intrinsic, all `RUN` lines in exception.ll, eh-lsda.ll, and
cfg-stackify-eh.ll, and a single `RUN` line in wasm-eh.cpp (which is an
end-to-end test from C++ source to assembly) fail. So this CL
temporarily disables those `RUN` lines, and for those test files without
any valid remaining `RUN` lines, adds a dummy `RUN` line to make them
pass. These tests will be reenabled in later CLs.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94039
Fangrui Song [Sat, 9 Jan 2021 07:28:22 +0000 (23:28 -0800)]
[IR] Delete unused ReplaceLast in DebugLoc::appendInlineAt
Not used after r304488
Sriraman Tallam [Sat, 9 Jan 2021 06:33:53 +0000 (22:33 -0800)]
Revert "This adds a new test checking llvm-symbolizer with an object built with basic block sections."
This reverts commit
1816de08232673e97ec41287ad3f6494bceaec43.
This breaks on ppc64 and windows although x86-registered-target is
mentioned. I will re-commit after fixing.
Sriraman Tallam [Sat, 9 Jan 2021 05:52:34 +0000 (21:52 -0800)]
This adds a new test checking llvm-symbolizer with an object built with basic block sections.
Build a object with -fbasic-block-sections and reorder the basic blocks to be
non-contiguous. Then check if llvm-symbolizer correctly reports the symbolized
addresses. Included the source to build the object with command lines.
Differential Revision: https://reviews.llvm.org/D91678
Umesh Kalappa [Sat, 9 Jan 2021 05:41:13 +0000 (21:41 -0800)]
PR47391: Canonicalize DIFiles
Like @aprantl suggested, modify to use the canonicalized DIFile, if we
don't know the loc info and filename for the compiler generated
functions for example static initialization functions.
Reviewed By: dblaikie, aprantl
Differential Revision: https://reviews.llvm.org/D87147
Jonas Devlieghere [Sat, 9 Jan 2021 02:57:36 +0000 (18:57 -0800)]
[DWARFLinker] Link against BinaryFormat
Jonas Devlieghere [Sat, 9 Jan 2021 02:53:08 +0000 (18:53 -0800)]
[debugserver] Various plist changes
- Remove unused plists that were referenced (but unused) by Xcode.
- Move all debugserver plists unders tools/debugserver/resources.
- Add the ability to distinguish between com.apple.security.cs.debugger
and com.apple.private.cs.debugger.
rdar://
66082043
Differential revision: https://reviews.llvm.org/D94320
Jonas Devlieghere [Fri, 8 Jan 2021 19:35:46 +0000 (11:35 -0800)]
[DWARFLinker] Print the unsupport DWARF form as part of the warning
Kazu Hirata [Sat, 9 Jan 2021 02:39:57 +0000 (18:39 -0800)]
[SCEV] Remove unused getExactExistingExpansion (NFC)
The last use was removed on Sep 4, 2018 in commit
2cbba5633753552a984572c8b9a5997e5c96496d.
Kazu Hirata [Sat, 9 Jan 2021 02:39:55 +0000 (18:39 -0800)]
[Tablegen] Use llvm::find_if (NFC)
Kazu Hirata [Sat, 9 Jan 2021 02:39:53 +0000 (18:39 -0800)]
[Target, Transforms] Use *Set::contains (NFC)
Ben Shi [Sat, 9 Jan 2021 02:37:21 +0000 (10:37 +0800)]
[RISCV] Optimize multiplication with constant
1. Break MUL with specific constant to a SLLI and an ADD/SUB on riscv32
with the M extension.
2. Break MUL with specific constant to two SLLI and an ADD/SUB, if the
constant needs a pair of LUI/ADDI to construct.
Reviewed by: craig.topper
Differential Revision: https://reviews.llvm.org/D93619
Nathan James [Sat, 9 Jan 2021 02:32:23 +0000 (02:32 +0000)]
[clangd][NFC] Remove unnecessary copy in CodeComplete
All tests still pass with ASAN so fairly confident no use-after-free going on here.
Craig Topper [Sat, 9 Jan 2021 01:47:12 +0000 (17:47 -0800)]
[X86] Remove IntrArgMemOnly from ldmxcsr intrinsic.
Since we're leaving this as ReadWrite with the "write" reflecting
the update to MXCSR, we shouldn't say it only writes arg memory.
Hopefully this fixes the issue reported in post-commit in D93571.
Tony [Sat, 19 Dec 2020 02:05:11 +0000 (02:05 +0000)]
[AMDGPU] Add volatile support to SIMemoryLegalizer
Treat a non-atomic volatile load and store as a relaxed atomic at
system scope for the address spaces accessed. This will ensure all
relevant caches will be bypassed.
A volatile atomic is not changed and still only bypasses caches upto
the level specified by the SyncScope operand.
Differential Revision: https://reviews.llvm.org/D94214
Richard Smith [Sat, 9 Jan 2021 00:41:31 +0000 (16:41 -0800)]
Never call a destroying operator delete when cleaning up from an
exception thrown during construction in a new-expression.
Instead, when performing deallocation function lookup for a
new-expression, ignore all destroying operator delete candidates, and
fall back to global operator delete if there is no member operator
delete other than a destroying operator delete.
Use of destroying operator delete only makes sense when there is an
object to destroy, which there isn't in this case. The language wording
doesn't cover this case; this oversight has been reported to WG21, with
the approach in this patch as the proposed fix.
Michael Jones [Sat, 9 Jan 2021 00:35:00 +0000 (00:35 +0000)]
[libc][NFC] add includes for internal headers to all libc functions
this will make sure that all of the functions are using the correct
prototypes. Explained much better in the comments of this diff:
https://reviews.llvm.org/D94195
Michael Jones [Wed, 23 Dec 2020 18:46:09 +0000 (18:46 +0000)]
[libc] Switch to use a macro which does not insert a section for every libc function.
Summary:
The new macro also inserts the C alias for the C++ implementations
without needing an objcopy based post processing step. The CMake
rules have been updated to reflect this. More CMake cleanup can be
taken up in future rounds and appropriate TODOs have been added for them.
Reviewers: mcgrathr, sivachandra
Subscribers:
Jez Ng [Fri, 8 Jan 2021 23:47:40 +0000 (18:47 -0500)]
[lld-macho] Fix TLV data initialization
We were mishandling the case where both `__tbss` and `__thread_data` sections were
present.
TLVP relocations should be encoded as offsets from the start of `__thread_data`,
even if the symbol is actually located in `__thread_bss`. Previously, we were
writing the offset from the start of the containing section, which doesn't
really make sense since there's no way `tlv_get_addr()` can know which section a
given `tlv$init` symbol is in at runtime.
In addition, this patch ensures that we place `__thread_data` immediately before
`__thread_bss`. This is what ld64 does, likely for performance reasons. Zerofill
sections must also be at the end of their segments; we were already doing this,
but now we ensure that `__thread_bss` occurs before `__bss`, so that it's always
possible to have it contiguous with `__thread_data`.
Fixes llvm.org/PR48657.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D94329
Arthur Eubanks [Wed, 23 Dec 2020 05:41:25 +0000 (21:41 -0800)]
[NewPM] Run ObjC ARC passes
Match the legacy PM in running various ObjC ARC passes.
This requires making some module passes into function passes. These were
initially ported as module passes since they add function declarations
(e.g. https://reviews.llvm.org/D86178), but that's still up for debate
and other passes do so.
Reviewed By: ahatanak
Differential Revision: https://reviews.llvm.org/D93743
Andrew Lenharth [Tue, 5 Jan 2021 21:15:45 +0000 (15:15 -0600)]
Update the maximum integer bitwidth in MLIR.
Large integers are generated in Circt commonly which exceed 4kbits. This aligns the maximum bitwidth in MLIR and LLVM.
Reviewed By: rriddle, lattner, mehdi_amini
Differential Revision: https://reviews.llvm.org/D94116
Richard Smith [Fri, 8 Jan 2021 23:17:54 +0000 (15:17 -0800)]
Attempt to complete an incomplete expression type when considering a
reference binding to an expression.
We need to know the array bound in order to determine whether the
parameter type is reference-compatible with the argument type, so we
need to trigger instantiation in this case.
Vedant Kumar [Fri, 8 Jan 2021 19:08:52 +0000 (11:08 -0800)]
[InitLLVM] Ensure SIGPIPE handler installed before sigaction()
The pipe signal handler must be installed before any other handlers are
registered. This is because the Unix RegisterHandlers function does not
perform a sigaction() for SIGPIPE unless a one-shot handler is present,
to allow long-lived processes (like lldb) to fully opt-out of llvm's
SIGPIPE handling and ignore the signal safely.
Fixes a bug introduced in D70277.
Tested by running Nick's test case:
% xcrun ./bin/clang -E -fno-integrated-cc1 x.c | tee foo.txt | head
I verified that child cc1 process exits with IO_ERR, and that the parent
recognizes the error code, exiting cleanly.
Differential Revision: https://reviews.llvm.org/D94324
Louis Dionne [Fri, 8 Jan 2021 22:23:16 +0000 (17:23 -0500)]
[libc++] NFC: Document the Differential queries to avoid duplicating work
Differential Revision: https://reviews.llvm.org/D94343
River Riddle [Fri, 8 Jan 2021 22:41:14 +0000 (14:41 -0800)]
[mlir][PassManager] Properly set the initialization generation when cloning a pass manager
Fixes a bug where dynamic pass pipelines of cloned pass managers weren't being initialized properly.
Arthur O'Dwyer [Sat, 26 Dec 2020 01:39:36 +0000 (20:39 -0500)]
[libc++] Mark [P0809] "LWG2831: Comparing Unordered Containers" as Nothing To Do.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0809r0.pdf
This issue/paper simply removed some library UB because vendors were
already doing the right thing. libc++ has always done the right thing
(in this respect).
Differential Revision: https://reviews.llvm.org/D93816
Arthur O'Dwyer [Fri, 25 Dec 2020 21:22:54 +0000 (16:22 -0500)]
[libc++] Mark [P0475] "LWG2511: guaranteed copy elision for piecewise construction" as Complete.
The point of LWG2511 is basically just to make sure that we use
`tuple<Args&&...>` instead of `tuple<Args...>` in a couple of places
inside `scoped_allocator_adaptor` and inside `pair`.
As far as I can tell, this has been true for libc++
since EricWF's D27612 (and maybe even earlier than that).
Arthur O'Dwyer [Fri, 8 Jan 2021 22:28:19 +0000 (17:28 -0500)]
Re-enable __cpp_lib_constexpr_functional.
I accidentally disabled this feature-test macro in my D93830,
due to a rebasing conflict. It had been enabled by my D93815,
and should have remained enabled.
Louis Dionne [Thu, 17 Dec 2020 18:26:47 +0000 (13:26 -0500)]
[libc++/abi] Re-remove unnecessary null pointer checks from operator delete
In
7cd67904f776, we removed the unnecessary nullptr checks from the libc++abi
definition of operator delete, but we forgot to update the definition in
libc++ (damn code duplication!). Then, in
d4a1e03c5fb5, I synced the
definitions across libc++ and libc++abi, but I did it the wrong way around.
I re-added the if() checks to libc++abi instead of removing them from libc++.
In
ef74f0fdc339, we re-removed the if() check from operator delete, but
only in libc++abi. This patch corrects this mess and removes it
consistently in libc++ and libc++abi.
Differential Revision: https://reviews.llvm.org/D93473
Eugene Zhulenev [Fri, 8 Jan 2021 22:02:25 +0000 (14:02 -0800)]
[mlir] AsyncRuntime: disable mlir-runner init/disable for WIN32
Differential Revision: https://reviews.llvm.org/D94339
Aart Bik [Fri, 8 Jan 2021 18:26:57 +0000 (10:26 -0800)]
[mlir][vector] generalized masked l/s and compressed l/s with indices
Adding the ability to index the base address brings these operations closer
to the transfer read and write semantics (with lowering advantages), ensures
more consistent use in vector MLIR code (easier to read), and reduces the
amount of code duplication to lower memrefs into base addresses considerably
(making codegen less error-prone).
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D94278
River Riddle [Fri, 8 Jan 2021 21:24:07 +0000 (13:24 -0800)]
[mlir] Add a hook for initializing passes before execution and use it in the Canonicalizer
This revision adds a new `initialize(MLIRContext *)` hook to passes that allows for them to initialize any heavy state before the first execution of the pass. A concrete use case of this is with patterns that rely on PDL, given that PDL is compiled at run time it is imperative that compilation results are cached as much as possible. The first use of this hook is in the Canonicalizer, which has the added benefit of reducing the number of expensive accesses to the context when collecting patterns.
Differential Revision: https://reviews.llvm.org/D93147
Adrian Prantl [Fri, 8 Jan 2021 21:14:52 +0000 (13:14 -0800)]
Don't take the address of a temporary
Eugene Zhulenev [Fri, 8 Jan 2021 16:18:39 +0000 (08:18 -0800)]
[mlir:JitRunner] Use custom shared library init/destroy functions if available
Use custom mlir runner init/destroy functions to safely init and destroy shared libraries loaded by the JitRunner.
This mechanism is ignored for Windows builds (for now) because init/destroy functions are not exported, and library unloading relies on static destructors.
Re-submit https://reviews.llvm.org/D94270 with a temporary workaround for windows
Differential Revision: https://reviews.llvm.org/D94312
Hongtao Yu [Fri, 8 Jan 2021 20:58:03 +0000 (12:58 -0800)]
[Driver] Add DWARF64 flag: -gdwarf64
@ikudrin enabled support for dwarf64 in D87011. Adding a clang flag so it can be used through that compilation pass.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D90507
Martin Storsjö [Fri, 20 Nov 2020 09:33:35 +0000 (11:33 +0200)]
[compiler-rt] [sanitizer] Silence -Wframe-larger-than= for a few windows functions with large stack buffers
Also update a documentation url while touching code nearby, as
requested in review.
Differential Revision: https://reviews.llvm.org/D91853
Saleem Abdulrasool [Fri, 8 Jan 2021 20:44:32 +0000 (20:44 +0000)]
APINotes: annotate dump methods (NFC)
This annotates the dump methods in APINotes to indicate that they are
unused as they are meant for debugging purposes. This avoids an
unnecessary warning.
River Riddle [Fri, 8 Jan 2021 20:29:47 +0000 (12:29 -0800)]
[mlir][PDL] Use ODS for defining PDL types
This removes the need to define these classes and their parser/printers in C++.
Differential Revision: https://reviews.llvm.org/D94135
Matthew Voss [Fri, 8 Jan 2021 18:29:30 +0000 (10:29 -0800)]
[NFC] Specify C11 in loop-opt-setup.c
This test was failing in our internal CI, since our driver does not default to
C11. Adding this switch fixes the issue.
Differential Revision: https://reviews.llvm.org/D94327
Haojian Wu [Tue, 5 Jan 2021 09:26:20 +0000 (10:26 +0100)]
[clangd] Add go-to-def metric.
to track the number of different "special" go-to-def request.
Differential Revision: https://reviews.llvm.org/D94289
MaheshRavishankar [Fri, 8 Jan 2021 19:56:48 +0000 (11:56 -0800)]
[mlir][Linalg] NFC: Refactor fusion of LinalgOp with TensorReshapeOp by expansion.
Change the implementation of LinalgOp with TensorReshapeOp by
expansion to be more modular and easier to follow.
Differential Revision: https://reviews.llvm.org/D93748
Mircea Trofin [Thu, 7 Jan 2021 18:29:39 +0000 (10:29 -0800)]
[NFC] Disallow unused prefixes in CodeGen/AMDGPU
This adds the lit config, and cleans up remaining tests.
Differential Revision: https://reviews.llvm.org/D94245
Craig Topper [Fri, 8 Jan 2021 19:36:24 +0000 (11:36 -0800)]
[RISCV] Cleanup a few section comments in RISCVInstrInfoVPseudos.td. NFC
Raul Tambre [Fri, 8 Jan 2021 19:19:42 +0000 (21:19 +0200)]
[CMake] Fix incorrect rpath for tests if LLVM_LOCAL_RPATH isn't set
d9ce31ae7d (D94322) removed the check because I thought it was dead
due to checking the existance of a variable (which always existed).
This causes LLDB tests to fail as they set NO_INSTALL_RPATH because
they're never meant to be installed, but we still would end up using
the install rpath.
Add the check back and make it explicitly check for an empty value
to make the purpose clearer and avoid implicit test for a false/true
value.
Differential Revision: https://reviews.llvm.org/D94326
Vedant Kumar [Fri, 8 Jan 2021 19:12:08 +0000 (11:12 -0800)]
[Signal] Re-raise SIGPIPE if the handler is uninstalled
Instead of falling through to RunSignalHandlers after the SIGPIPE
handler is uninstalled and we get a SIGPIPE, re-raise the signal, just
like we do for other IntSigs.
This was discussed and informally OK'd here:
https://reviews.llvm.org/rG9a3f892d018238dce5181e458905311db8e682f5#856804
MaheshRavishankar [Fri, 8 Jan 2021 18:52:26 +0000 (10:52 -0800)]
[mlir][Linalg] Add verification checks to disallow illegal reshape ops.
The existing verification of reshape ops in linalg (linalg.reshape and
linalg.tensor_reshape) allows specification of illegal ops, where
- A dynamic dimension is expanded into multiple dynamic
dimensions. This is ill-specified.
- A static dimension is expanded into dynamic dimension or viceversa,
- The product of extents of the static dimensions in the expanded type
doesnt match the static dimension of the collapsed type.
Making all of these illegal. This also implies that some pessimization
in canonicalization due to incomplete semantics of the operation can
be dropped.
Differential Revision: https://reviews.llvm.org/D93724
Raul Tambre [Fri, 8 Jan 2021 18:18:25 +0000 (20:18 +0200)]
Re-land "[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath"
Reverted check for empty CMAKE_BUILD_RPATH fixed.
When `BUILD_WITH_INSTALL_RPATH` is enabled it prevents using a custom rpath only
for the build tree as the install rpath will be used. This makes it impossible to run a
runtimes build when compiling with Clang and wanting the installed rpath to be
empty (i.e. `-DCMAKE_BUILD_RPATH="<some path>" -DCMAKE_SKIP_INSTALL_RPATH=ON`).
Disable `BUILD_WITH_INSTALL_RPATH` when `CMAKE_BUILD_RPATH` is non-empty to
allow for such build scenarios.
Differential Revision: https://reviews.llvm.org/D94322
Paul C. Anagnostopoulos [Fri, 8 Jan 2021 18:20:27 +0000 (13:20 -0500)]
[TableGen] Fix use of *CurRec when CurRec is null.
I cannot build with the undefined sanitizer on Visual Studio.
David Green [Fri, 8 Jan 2021 18:21:00 +0000 (18:21 +0000)]
[ARM] Custom lower i1 vector truncates
The ISel patterns we have for truncating to i1's under MVE do not seem
to be correct. Instead custom lower to icmp(ne, and(x, 1), 0).
Differential Revision: https://reviews.llvm.org/D94226
Peter Steinfeld [Mon, 4 Jan 2021 17:35:15 +0000 (09:35 -0800)]
[flang] Fix bogus message on internal subprogram with alternate return
Internal subprograms have explicit interfaces. If an internal subprogram has
an alternate return, we check its explicit interface. But we were not
putting the label values of alternate returns into the actual argument.
I fixed this by changing the definition of actual arguments to be able
to contain a common::Label and putting the label for an alternate return
into the actual argument.
I also verified that we were already doing all of the semantic checking
required for alternate returns and removed a "TODO" for this.
I also added the test altreturn06.f90.
Differential Revision: https://reviews.llvm.org/D94017
Jonas Devlieghere [Fri, 8 Jan 2021 17:43:08 +0000 (09:43 -0800)]
[lldb] Remove stale LLDB-Info.plist
Remove the stale LLDB-Info.plist which was only used by TestHelp.py. The
latter would try to parse the version number from the plist and use that
to verify the version in the help output. Of course this never matched
so it would fall back to matching any arbitrary version.
This patch does *not* change the real LLDB-Info.plist.in file which is
used for the LLDB Framework.
Louis Dionne [Fri, 11 Dec 2020 17:22:16 +0000 (12:22 -0500)]
[libc++] LWG2070: Use Allocator construction for objects created with allocate_shared
This patch updates `allocate_shared` to call `allocator_traits::construct`
when creating the object held inside the shared_pointer, and
`allocator_traits::destroy` when destroying it. This resolves
the part of P0674R1 that was originally filed as LWG2070.
This change is landed separately from the rest of P0674R1 because it is
incredibly tricky from an ABI perspective.
This is the reason why this change is so tricky is that we previously
used EBO in a compressed pair to store both the allocator and the object
type stored in the `shared_ptr`. However, starting in C++20, P0674
requires us to use Allocator construction for initializing the object type.
That requirement rules out the use of the EBO for the object type, since
using the EBO implies that the base will be initialized when the control
block is initialized (and hence we can't do it through Allocator construction).
Hence, supporting P0674 requires changing how we store the object type
inside the control block, which we do while being ABI compatible by using
some trickery with a properly aligned char buffer.
Fixes https://llvm.org/PR41900
Supersedes https://llvm.org/D62760
Differential Revision: https://reviews.llvm.org/D91201
Marek Kurdej [Fri, 8 Jan 2021 17:40:42 +0000 (18:40 +0100)]
[libc++] Add basic support for -std=c++2b.
* Add feature test macros.
* Add buildbot configuration generic-cxx2b that uses clang-tot.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D94227
Raul Tambre [Fri, 8 Jan 2021 17:54:52 +0000 (19:54 +0200)]
Revert "[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath"
This reverts commit
0ebc1fb29f278db0665423f15c53e6ee9601dddb.
The behaviour should have been the same as before unless specifying CMAKE_BUILD_RPATH,
which was previously broken.
However, this seems to have broken builds for some people that don't specify it.
Reverting until I can investigate.
Differential Revision: https://reviews.llvm.org/D94319
Florian Hahn [Fri, 8 Jan 2021 17:40:20 +0000 (17:40 +0000)]
[VPlan] Move reduction start value creation to widenPHIRecipe.
This was suggested to prepare for D93975.
By moving the start value creation to widenPHInstruction, we set the
stage to manage the start value directly in VPWidenPHIRecipe, which be
used subsequently to set the 'resume' value for reductions during
epilogue vectorization.
It also moves RdxDesc to the recipe, so we do not have to rely on Legal
to look it up later.
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D94175
Ganesh Gopalasubramanian [Fri, 8 Jan 2021 16:40:28 +0000 (22:10 +0530)]
[X86] Add TLBSYNC, INVLPGB and SNP instructions
Differential Revision: https://reviews.llvm.org/D94134
Jonas Devlieghere [Fri, 8 Jan 2021 16:46:19 +0000 (08:46 -0800)]
[lldb] Bump the required SWIG version to 3
Bump the required SWIG version to 3. If my memory serves me well we last
bumped the required SWIG version to 2 for Python 3. At that time SWIG 3
had already been around for a while so everyone I know was already using
that.
It appears that SWIG 3 is the only version that officially supports
C++11 which we're using in the typemap. SWIG 3 was released in 2014 so I
think it's reasonable to make that the minimum required version.
https://bugs.llvm.org/show_bug.cgi?id=48685
Differential revision: https://reviews.llvm.org/D94244
Arthur O'Dwyer [Thu, 7 Jan 2021 23:21:07 +0000 (18:21 -0500)]
[libc++] Update generate_feature_test_macro_components.py to match SD-6.
It's still a little confusing because in many cases C++17 and C++20
have different values, and libc++ implements the C++17 behavior but
not the C++20 behavior; 'unimplemented' can't represent that scenario.
Ultimately we probably ought to completely redesign the script to be
in terms of paper numbers, rather than language revisions, and make
it generate the CSV files like "Cxx2aStatusPaperStatus.csv" as well.
Most newly added macros are unimplemented. I've marked a few as implemented,
though, based on my reading of the code; for example I was pretty sure
`__cpp_lib_latch` is implemented since we have `<latch>`.
Differential Revision: https://reviews.llvm.org/D93830
Alex Zinenko [Wed, 6 Jan 2021 15:21:08 +0000 (16:21 +0100)]
[mlir] replace LLVM dialect float types with built-ins
Continue the convergence between LLVM dialect and built-in types by replacing
the bfloat, half, float and double LLVM dialect types with their built-in
counterparts. At the API level, this is a direct replacement. At the syntax
level, we change the keywords to `bf16`, `f16`, `f32` and `f64`, respectively,
to be compatible with the built-in type syntax. The old keywords can still be
parsed but produce a deprecation warning and will be eventually removed.
Depends On D94178
Reviewed By: mehdi_amini, silvas, antiagainst
Differential Revision: https://reviews.llvm.org/D94179
Adam Czachorowski [Fri, 8 Jan 2021 16:21:02 +0000 (17:21 +0100)]
[clangd] Add missing "override" to fix the build.
Follow-up to
d4af86581e80ef0f7a6f4a4fff1c97260a726e71
Differential Revision: https://reviews.llvm.org/D94314
David Green [Fri, 8 Jan 2021 16:10:01 +0000 (16:10 +0000)]
[ConstProp] Constant propagation for get.active.lane.mask instrinsics
Similar to the Arm VCTP intrinsics, if the operands of an
active.lane.mask are both known, the constant lane mask can be
calculated. This can come up after unrolling the loops.
Differential Revision: https://reviews.llvm.org/D94103
Adam Czachorowski [Thu, 7 Jan 2021 20:24:40 +0000 (21:24 +0100)]
[clangd] Fix type printing in the presence of qualifiers
When printing QualType with qualifiers like "const", or pointing to an
elaborated type, we would print garbage like:
std::const std::vector<int>&
with the initial std:: being calculated correctly, but inserted in the
wrong place and the second std:: not removed (due to elaborated type).
This affected, among others, ExtractFunction and ExpandAuto tweaks.
This change introduces a new callback to PrintingPolicy, which allows us
to influence the printing of namespace qualifiers. In the future, the
same callback can be used to improve handling of "using namespace"
directives as well.
Fixes:
https://github.com/clangd/clangd/issues/640 (ExtractFunction)
https://github.com/clangd/clangd/issues/264 (ExpandAuto)
First point of https://github.com/clangd/clangd/issues/524
Differential Revision: https://reviews.llvm.org/D94259
Eugene Zhulenev [Fri, 8 Jan 2021 15:43:54 +0000 (07:43 -0800)]
Revert "[mlir:JitRunner] Use custom shared library init/destroy functions if available"
This reverts commit
84dc9b451bfd62474f44dd1af0e4955a0110d523.
Fix Windows breakage: http://lab.llvm.org:8011/#/builders/13/builds/3658/steps/6/logs/stdio
Differential Revision: https://reviews.llvm.org/D94309
Simon Pilgrim [Fri, 8 Jan 2021 15:08:12 +0000 (15:08 +0000)]
[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())
UNPCKL/UNPCKH only uses one op from each hop, so we can merge the hops and then permute the result.
David Green [Fri, 8 Jan 2021 15:15:08 +0000 (15:15 +0000)]
[ARM][LV] Additional loop invariant reduction test. NFC
Eugene Zhulenev [Fri, 8 Jan 2021 11:14:04 +0000 (03:14 -0800)]
[mlir:JitRunner] Use custom shared library init/destroy functions if available
Use custom mlir runner init/destroy functions to safely init and destroy shared libraries loaded by the JitRunner.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D94270
Paul C. Anagnostopoulos [Fri, 8 Jan 2021 15:10:05 +0000 (10:10 -0500)]
[TableGen] Remove unused declaration that caused build failures.
Heejin Ahn [Sat, 26 Dec 2020 00:14:35 +0000 (16:14 -0800)]
[WebAssembly] Rename wasm_rethrow_in_catch intrinsic/builtin
`wasm_rethrow_in_catch` intrinsic and builtin are used in order to
rethrow an exception when the exception is caught but there is no
matching clause within the current `catch`. For example,
```
try {
foo();
} catch (int n) {
...
}
```
If the caught exception does not correspond to C++ `int` type, it should
be rethrown. These intrinsic/builtin were renamed `rethrow_in_catch`
because at the time I thought there would be another intrinsic for C++'s
`throw` keyword, which rethrows an exception. It turned out that `throw`
keyword doesn't require wasm's `rethrow` instruction, so we rename
`rethrow_in_catch` to just `rethrow` here.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94038
David Green [Fri, 8 Jan 2021 14:54:16 +0000 (14:54 +0000)]
[ARM] Update and regenerate test checks. NFC
Paul C. Anagnostopoulos [Wed, 16 Dec 2020 21:25:54 +0000 (16:25 -0500)]
[TableGen] Add the assert statement, step 1
Differential Revision: https://reviews.llvm.org/D93911
This first step adds the assert statement and supports it at top level
and in record definitions. Later steps will support it in class
definitions and multiclasses.
Kiran Chandramohan [Thu, 7 Jan 2021 15:51:55 +0000 (15:51 +0000)]
[MLIR][OpenMP] Attribute to include WsLoop upperbound
This patch adds an attribute `inclusive` which if present causes
the upperbound to be included in the loop iteration interval.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94235
Simon Pilgrim [Fri, 8 Jan 2021 14:37:19 +0000 (14:37 +0000)]
[X86][SSE] Add vphaddd/vphsubd unpack(hop(),hop()) tests
Alexey Bataev [Fri, 8 Jan 2021 13:31:07 +0000 (05:31 -0800)]
[SLP][NFC]Add a test for reused shrink check, NFC.
Xiangling Liao [Thu, 7 Jan 2021 22:16:33 +0000 (17:16 -0500)]
[NFC] Renaming PackStack to AlignPackStack
This patch renames PackStack and related variable names to also contain align across Clang.
As it is right now, Clang already uses one stack to record the information from both #pragma
align and #pragma pack. Leaving it as PackStack is confusing, and could cause people to
ignore #pragma align when developing code that interacts with PackStack.
Differential Revision: https://reviews.llvm.org/D93901
Simon Pilgrim [Fri, 8 Jan 2021 13:58:46 +0000 (13:58 +0000)]
[X86][SSE] Add tests for unpack(hop(),hop())
We should be able to convert these to permute(hop()) as we only ever use one of the ops from each hop.
KareemErgawy-TomTom [Fri, 8 Jan 2021 13:48:48 +0000 (14:48 +0100)]
[MLIR][SPIRV] Add `UsableInSpecConstantOp` trait.
Instead of checking explicitly checking for whether an op is usalbe
inside a `SpecConstantOperationOP`, this commit adds a new trait to
filter such ops.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D94288
Kazushi (Jam) Marukawa [Fri, 8 Jan 2021 11:10:02 +0000 (20:10 +0900)]
[VE] Support pack_f32p and pack_f32a intrinsic instructions
Support pack_f32p and pack_f32a intrinsic instructions and regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D94296
Heejin Ahn [Thu, 24 Dec 2020 11:07:24 +0000 (03:07 -0800)]
[WebAssembly] Change label numbers to variables in test
cfg-stackify-eh.ll contains many `CHECK` lines specifying label / catch
comments with numbers. These numbers are subject to change every time
any block/loop/try is added in the middle in existing functions or any
other function is added in the middle of the file, generating a large
number of lines in diffs. This change converts them to variables so they
can be more resistent to future changes.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94037
Anastasia Stulova [Fri, 8 Jan 2021 13:37:27 +0000 (13:37 +0000)]
[OpenCL] Documentation for experimental C++ libs
Started a new doc section about the OpenCL experimental
features and described ongoing work on C++ libraries
e.g. type traits.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D94188
Alexander Belyaev [Fri, 8 Jan 2021 13:33:39 +0000 (14:33 +0100)]
Revert "[SLP]Need shrink the load vector after reordering."
This reverts commit
4284afdf9432f7d756f56b0ab21d69191adefa8d.
This changes computed values in fused_batchnorm_test_cpu.
Not equal to tolerance rtol=1e-06, atol=0.001
Mismatched value: a is different from b.
not close where = (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1]), array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1]), array([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1]), array([0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
4, 5]))
not close lhs = [-0.6636615 -0.9804948 -1.148275 -0.
68193716 -0.8572368 -0.
65046215
-0.6993756 -1.2244141 -1.0938729 -0.
50369143 -0.
51830524 -0.738452
-0.7214286 -0.
48115745 -0.9380924 -0.9341769 -0.5916775 -1.2896856
-0.7264182 -0.9746917 -0.783249 -0.7659018 -0.
86214024 -0.
47784212]
not close rhs = [ 0.
44102234 0.
12418899 -0.
04359123 0.
42274666 0.
24744703 0.
45422167
0.
40530816 -0.
11973029 0.
01081094 0.6009924 0.5863786 0.3662318
0.
38325527 0.
62352633 0.1665914 0.1705069 0.5130063 -0.
18500176
0.
37826565 0.
12999213 0.3214348 0.338782 0.
24254355 0.
62684166]
not close dif = [1.1046839 1.1046838 1.1046838 1.1046839 1.1046839 1.1046839 1.1046838
1.1046839 1.1046839 1.1046839 1.1046839 1.1046839 1.1046839 1.1046838
1.1046839 1.1046839 1.1046839 1.1046839 1.1046839 1.1046839 1.1046839
1.1046839 1.1046838 1.1046838]
not close tol = [0.
00100044 0.
00100012 0.
00100004 0.
00100042 0.
00100025 0.
00100045
0.
00100041 0.
00100012 0.
00100001 0.0010006 0.
00100059 0.
00100037
0.
00100038 0.
00100062 0.
00100017 0.
00100017 0.
00100051 0.
00100019
0.
00100038 0.
00100013 0.
00100032 0.
00100034 0.
00100024 0.
00100063]
LLVM GN Syncbot [Fri, 8 Jan 2021 13:30:54 +0000 (13:30 +0000)]
[gn build] Port
9c4b2225b24
Simon Moll [Fri, 8 Jan 2021 12:53:18 +0000 (13:53 +0100)]
[VP] ISD helper functions [VE] isel for vp_add, vp_and
This implements vp_add, vp_and for the VE target by lowering them to the
VVP_* layer. We also add helper functions for VP SDNodes (isVPSDNode,
getVPMaskIdx, getVPExplicitVectorLengthIdx).
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D93766
Raphael Isemann [Fri, 8 Jan 2021 13:24:48 +0000 (14:24 +0100)]
[lldb][NFC] Refactor setup code for Clang diagnostics
Shivam Gupta [Fri, 8 Jan 2021 13:24:36 +0000 (14:24 +0100)]
[MLIR][NFC] remove unnecessary includes form tablegen command
With [[ https://reviews.llvm.org/D77156 | D77156 ]] includes are not needed here.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94216
Mark Murray [Tue, 5 Jan 2021 12:10:04 +0000 (12:10 +0000)]
[AArch64] Add +flagm archictecture option, allowing the v8.4a flag modification extension.
Differential Revision: https://reviews.llvm.org/D94081
Mark Murray [Mon, 4 Jan 2021 13:45:49 +0000 (13:45 +0000)]
[AArch64] Add +pauth archictecture option, allowing the v8.3a pointer authentication extension.
Differential Revision: https://reviews.llvm.org/D94083
Alexander Belyaev [Fri, 8 Jan 2021 13:17:18 +0000 (14:17 +0100)]
Revert "Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""""
This reverts commit
6b0ee02747ed22d41e175d15f27025183341e6f8.
Circular dependency again.
Sanjay Patel [Fri, 8 Jan 2021 12:41:26 +0000 (07:41 -0500)]
[SLP] limit verifyFunction to debug build (PR48689)
As noted in PR48689, the verifier may have some kind
of exponential behavior that should be addressed
separately. For now, only run it in debug mode to
prevent problems for release+asserts.
That limit is what we had before D80401, and I'm
not sure if there was a reason to change it in that
patch.
Haojian Wu [Thu, 3 Dec 2020 08:42:46 +0000 (09:42 +0100)]
[clangd] go-to-implementation on a base class jumps to all subclasses.
Differential Revision: https://reviews.llvm.org/D92749
Alex Richardson [Fri, 8 Jan 2021 11:54:43 +0000 (11:54 +0000)]
[libc++] Add missing XFAIL to tests that need __atomic_* libcalls
FreeBSD did not provide the __atomic_* functions as part of the base
system until recently. They were added to libgcc_s in SVN revision r364753
(August 2020), so check for availability of 'non-lockfree-atomics' so that
these tests do not fail unexpectedly on older versions of FreeBSD.
This also removes the #ifndef __APPLE__ from atomic_helpers.h that was used
to work around lack of atomic runtime functions on older Apple platforms
and replaces it with XFAIL: !non-lockfree-atomics.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D88818
Alex Richardson [Fri, 8 Jan 2021 11:53:04 +0000 (11:53 +0000)]
[compiler-rt] Implement __atomic_is_lock_free
This function is called by the __atomic_is_lock_free() builtin if the value
cannot be resolved to true at compile time. Lack of this function is
causing the non-lockfree atomics tests in libc++ to not be run (see D91911)
This function is also added in D85044, but that review also adds support
for using lock-free atomics in more cases, whereas this is a minimal change
that just adds __atomic_is_lock_free() for the implementation of atomic.c.
Reviewed By: ldionne
Differential Revision: https://reviews.llvm.org/D92302
Kazushi (Jam) Marukawa [Thu, 7 Jan 2021 14:32:12 +0000 (23:32 +0900)]
[VE][NFC] Clean ISel patterns for LSV and LVS
Clean ISel patterns for LSV and LVS before upstream more hand-written
ISel patterns.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D94291
Haojian Wu [Fri, 8 Jan 2021 12:42:33 +0000 (13:42 +0100)]
[clangd] Cleanup a remaining Optional<SymbolID> usage, NFC.
Haojian Wu [Fri, 8 Jan 2021 12:29:11 +0000 (13:29 +0100)]
[clangd] NFC, avoid potential ODR violation.