Aart Bik [Tue, 27 Apr 2021 00:03:35 +0000 (17:03 -0700)]
[mlir][tensors] Introduce attribute interface/attribute for tensor encoding
The new "encoding" field in tensor types so far had no meaning. This revision introduces:
1. an encoding attribute interface in IR: for verification between tensors and encodings in general
2. an attribute in Tensor dialect; #tensor.sparse<dict> + concrete sparse tensors API
Active discussion:
https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944/
Reviewed By: silvas, penpornk, bixia
Differential Revision: https://reviews.llvm.org/D101008
Yonghong Song [Wed, 14 Apr 2021 20:08:39 +0000 (13:08 -0700)]
BPF: generate BTF info for LD_imm64 loaded function pointer
For an example like below,
extern int do_work(int);
long bpf_helper(void *callback_fn);
long prog() {
return bpf_helper(&do_work);
}
The final generated codes look like:
r1 = do_work ll
call bpf_helper
exit
where we have debuginfo for do_work() extern function:
!17 = !DISubprogram(name: "do_work", ...)
This patch implemented to add additional checking
in processing LD_imm64 operands for possible function pointers
so BTF for bpf function do_work() can be properly generated.
The original llvm function name processReloc() is renamed to
processGlobalValue() to better reflect what the function is doing.
Differential Revision: https://reviews.llvm.org/D100568
Arthur Eubanks [Mon, 26 Apr 2021 19:53:09 +0000 (12:53 -0700)]
[Inliner] Make ModuleInlinerWrapperPass return PreservedAnalyses::all()
The ModulePassManager should already have taken care of all analysis
invalidation. Without this change, upcoming changes will cause more
invalidation than necessary.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D101320
LLVM GN Syncbot [Tue, 27 Apr 2021 00:18:13 +0000 (00:18 +0000)]
[gn build] Port
7aa3cad46ac3
William S. Moses [Thu, 22 Apr 2021 02:26:10 +0000 (22:26 -0400)]
[MLIR] Add SCF.if Condition Canonicalizations
Add two canoncalizations for scf.if.
1) A canonicalization that allows users of a condition within an if to assume the condition
is true if in the true region, etc.
2) A canonicalization that removes yielded statements that are equivalent to the condition
or its negation
Differential Revision: https://reviews.llvm.org/D101012
William S. Moses [Mon, 15 Mar 2021 18:27:06 +0000 (14:27 -0400)]
[NVPTX] Enable lowering of atomics on local memory
LLVM does not have valid assembly backends for atomicrmw on local memory. However, as this memory is thread local, we should be able to lower this to the relevant load/store.
Differential Revision: https://reviews.llvm.org/D98650
Alex Lorenz [Tue, 27 Apr 2021 00:01:51 +0000 (17:01 -0700)]
[clang] Don't crash when loading invalid VFS for the module dep collector
The VFS is null when it's invalid so return early in collectVFSFromYAML.
Yonghong Song [Wed, 14 Apr 2021 17:43:22 +0000 (10:43 -0700)]
BPF: emit debuginfo for Function of DeclRefExpr if requested
Commit
e3d8ee35e4ad ("reland "[DebugInfo] Support to emit debugInfo
for extern variables"") added support to emit debugInfo for
extern variables if requested by the target. Currently, only
BPF target enables this feature by default.
As BPF ecosystem grows, callback function started to get
support, e.g., recently bpf_for_each_map_elem() is introduced
(https://lwn.net/Articles/846504/) with a callback function as an
argument. In the future we may have something like below as
a demonstration of use case :
extern int do_work(int);
long bpf_helper(void *callback_fn, void *callback_ctx, ...);
long prog_main() {
struct { ... } ctx = { ... };
return bpf_helper(&do_work, &ctx, ...);
}
Basically bpf helper may have a callback function and the
callback function is defined in another file or in the kernel.
In this case, we would like to know the debuginfo types for
do_work(), so the verifier can proper verify the safety of
bpf_helper() call.
For the following example,
extern int do_work(int);
long bpf_helper(void *callback_fn);
long prog() {
return bpf_helper(&do_work);
}
Currently, there is no debuginfo generated for extern function do_work().
In the IR, we have,
...
define dso_local i64 @prog() local_unnamed_addr #0 !dbg !7 {
entry:
%call = tail call i64 @bpf_helper(i8* bitcast (i32 (i32)* @do_work to i8*)) #2, !dbg !11
ret i64 %call, !dbg !12
}
...
declare dso_local i32 @do_work(i32) #1
...
This patch added support for the above callback function use case, and
the generated IR looks like below:
...
declare !dbg !17 dso_local i32 @do_work(i32) #1
...
!17 = !DISubprogram(name: "do_work", scope: !1, file: !1, line: 1, type: !18, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
!18 = !DISubroutineType(types: !19)
!19 = !{!20, !20}
!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
The TargetInfo.allowDebugInfoForExternalVar is renamed to
TargetInfo.allowDebugInfoForExternalRef as now it guards
both extern variable and extern function debuginfo generation.
Differential Revision: https://reviews.llvm.org/D100567
Hongtao Yu [Mon, 26 Apr 2021 16:12:29 +0000 (09:12 -0700)]
[CSSPGO] Unblock optimizations with pseudo probe instrumentation part 2.
As a follow-up to D95982, this patch continues unblocking optimizations that are blocked by pseudu probe instrumention.
The optimizations unblocked are:
- In-block load propagation.
- In-block dead store elimination
- Memory copy optimization that turns stores to consecutive memories into a memset.
These optimizations are local to a block, so they shouldn't affect the profile quality.
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D100075
Fangrui Song [Mon, 26 Apr 2021 23:47:32 +0000 (16:47 -0700)]
[ADT] Remove StatisticBase and make NoopStatistic empty
In LLVM_ENABLE_STATS=0 builds, `llvm::Statistic` maps to `llvm::NoopStatistic`
but has 3 mostly unused pointers. GlobalOpt considers that the pointers can
potentially retain allocated objects, so GlobalOpt cannot optimize out the
`NoopStatistic` variables (see D69428 for more context), wasting 23KiB for stage
2 clang.
This patch makes `NoopStatistic` empty and thus reclaims the wasted space. The
clang size is even smaller than applying D69428 (slightly smaller in both .bss and
.text).
```
# This means the D69428 optimization on clang is mostly nullified by this patch.
HEAD+D69428: size(.bss) = 0x0725a8
HEAD+D101211: size(.bss) = 0x072238
# bloaty - HEAD+D69428 vs HEAD+D101211
# With D101211, we also save a lot of string table space (.rodata).
FILE SIZE VM SIZE
-------------- --------------
-0.0% -32 -0.0% -24 .eh_frame
-0.0% -336 [ = ] 0 .symtab
-0.0% -360 [ = ] 0 .strtab
[ = ] 0 -0.2% -880 .bss
-0.0% -2.11Ki -0.0% -2.11Ki .rodata
-0.0% -2.89Ki -0.0% -2.89Ki .text
-0.0% -5.71Ki -0.0% -5.88Ki TOTAL
```
Note: LoopFuse is a disabled pass. For now this patch adds
`#if LLVM_ENABLE_STATS` so `OptimizationRemarkMissed` is skipped in
LLVM_ENABLE_STATS==0 builds. If these `OptimizationRemarkMissed` are useful in
LLVM_ENABLE_STATS==0 builds, we can replace `llvm::Statistic` with
`llvm::TrackingStatistic`, or use a different abstraction to keep track of the strings.
Similarly, skip the code in `mlir/lib/Pass/PassStatistics.cpp` which
calls `getName`/`getDesc`/`getValue`.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D101211
William S. Moses [Mon, 26 Apr 2021 23:33:01 +0000 (19:33 -0400)]
Revert "[NVPTX] Enable lowering of atomics on local memory"
This reverts commit
fede99d386ec9e7bab2762aa16cb10c0513ae464.
William S. Moses [Mon, 15 Mar 2021 18:27:06 +0000 (14:27 -0400)]
[NVPTX] Enable lowering of atomics on local memory
LLVM does not have valid assembly backends for atomicrmw on local memory. However, as this memory is thread local, we should be able to lower this to the relevant load/store.
Differential Revision: https://reviews.llvm.org/D98650
Fangrui Song [Mon, 26 Apr 2021 23:04:22 +0000 (16:04 -0700)]
[test] Fix tools/gold/X86/weak.ll after D94202
The order regressed after D94202: after `a b`, when adding `a c`, we may reorder
`a` to the right of `b`, causing the final order to be `b a c`.
Craig Topper [Mon, 26 Apr 2021 22:29:34 +0000 (15:29 -0700)]
[RISCV] Use stack slot to handle SPLAT_VECTOR_PARTS on RV32.
Reduces the amount of vector ALU operations and reduces vector
register pressure.
Lei Zhang [Mon, 26 Apr 2021 22:27:41 +0000 (18:27 -0400)]
Revert "[ADT] Remove StatisticBase and make NoopStatistic empty"
This reverts commit
b5403117814a7c39b944839e10492493f2ceb4ac
because it breaks MLIR build:
https://buildkite.com/mlir/mlir-core/builds/13299#
ad0f8901-dfa4-43cf-81b8-
7940e2c6c15b
Hubert Tong [Mon, 26 Apr 2021 22:18:35 +0000 (18:18 -0400)]
[AIX] Avoid use of mtim.tv_nsec member of stat structure on AIX
The value observed for the `mtim.tv_nsec` member is erroneous in some
AIX environments. Avoid using this member by forcing
`HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC` to `0`.
This resolves "mtime changed" errors such as the one
http://lab.llvm.org:8014/#/builders/126/builds/330/steps/5/logs/FAIL__Clang__test_c
has.
Reviewed By: daltenty, jsji
Differential Revision: https://reviews.llvm.org/D101323
Michael Kruse [Mon, 26 Apr 2021 22:04:00 +0000 (17:04 -0500)]
[SimplifyCFG] Preserve metadata when unconditionalizing branches (same target).
When replacing a conditional branch by an unconditional one because the targets are identical, transfer the metadata to the new branch instruction.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D101226
Fangrui Song [Mon, 26 Apr 2021 22:17:28 +0000 (15:17 -0700)]
Revert D76519 "[NFC] Refactor how CFI section types are represented in AsmPrinter"
This reverts commit
0ce723cb228bc1d1a0f5718f3862fb836145a333.
D76519 was not quite NFC. If we see a CFISection::Debug function before a
CFISection::EH one (-fexceptions -fno-asynchronous-unwind-tables), we may
incorrectly pick CFISection::Debug and emit a `.cfi_sections .debug_frame`.
We should use .eh_frame instead.
This scenario is untested.
LLVM GN Syncbot [Mon, 26 Apr 2021 22:16:25 +0000 (22:16 +0000)]
[gn build] Port
bbddadd46e46
Lang Hames [Mon, 26 Apr 2021 22:15:27 +0000 (15:15 -0700)]
Revert "[ORC] Add unit tests for parts of the Orc and LLJIT C APIs."
This reverts commit
8740360093b5154504f5e056596119f9566f4b06.
This commit caused failures on some builders (see e.g.
https://lab.llvm.org/buildbot/#/builders/5/builds/7071). Reverting while I
investigate.
Michael Benfield [Mon, 26 Apr 2021 20:53:21 +0000 (13:53 -0700)]
[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable
These are intended to mimic warnings available in gcc.
-Wunused-but-set-variable is triggered in the case of a variable which
appears on the LHS of an assignment but not otherwise used.
For instance:
void f() {
int x;
x = 0;
}
-Wunused-but-set-parameter works similarly, but for function parameters
instead of variables.
In C++, they are triggered only for scalar types; otherwise, they are
triggered for all types. This is gcc's behavior.
-Wunused-but-set-parameter is controlled by -Wextra, while
-Wunused-but-set-variable is controlled by -Wunused. This is slightly
different from gcc's behavior, but seems most consistent with clang's
behavior for -Wunused-parameter and -Wunused-variable.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D100581
zoecarver [Mon, 26 Apr 2021 16:35:47 +0000 (09:35 -0700)]
[libc++][ranges] iterator.concept.sizedsentinel: sized_sentinel_for and disable_sized_sentinel_for.
Based on D100160.
Reviewed By: cjdb, ldionne, Quuxplusone, #libc, miscco
Differential Revision: https://reviews.llvm.org/D100587
Alex Lorenz [Mon, 26 Apr 2021 21:56:56 +0000 (14:56 -0700)]
Revert "[clang][driver] Use the provided arch name for a Darwin target triple"
This reverts commit
6cc62043c8bf4daa27664a2e1674abbe8d0492c6.
This caused a test failure on a M1 mac CI job (https://reviews.llvm.org/D100807#2718006),
I will recommit this with a fix.
LLVM GN Syncbot [Mon, 26 Apr 2021 21:24:36 +0000 (21:24 +0000)]
[gn build] Port
caf1294d9578
Baptiste Saleil [Mon, 26 Apr 2021 19:48:12 +0000 (15:48 -0400)]
[AMDGPU] Experiments show that the GCNRegBankReassign pass significantly impacts
the compilation time and there is no case for which we see any improvement in
performance. This patch removes this pass and its associated test cases from
the tree.
Differential Revision: https://reviews.llvm.org/D101313
Change-Id: I0599169a7609c19a887f8d847a71e664030cc141
Vineet Kumar [Mon, 26 Apr 2021 19:50:12 +0000 (19:50 +0000)]
Implementation for TargetTransformInfo::hasActiveVectorLength()
This patch adds the missing implementation for
TargetTransformInfo::hasActiveVectorLength() without which using
hasActiveVectorLength() causes linker error.
Patch by Vineet Kumar!
Differential Revision: https://reviews.llvm.org/D100941
Sterling Augustine [Mon, 19 Apr 2021 17:56:25 +0000 (10:56 -0700)]
Support leak sanitizer in libcxx.
Support leak sanitizer in libcxx.
Simple addition for leak checking when running the libcxx testsuite.
Differential Revision: https://reviews.llvm.org/D100775
Sterling Augustine [Fri, 16 Apr 2021 01:03:01 +0000 (18:03 -0700)]
Don't fail the shared_ptr test if libc++ has insufficient debug info.
Don't fail the shared_ptr test if libc++ has insufficient debug info.
This addresses https://bugs.llvm.org/show_bug.cgi?id=48937
Differential Revision: https://reviews.llvm.org/D100610
LLVM GN Syncbot [Mon, 26 Apr 2021 21:04:24 +0000 (21:04 +0000)]
[gn build] Port
8740360093b5
Lang Hames [Mon, 26 Apr 2021 20:55:26 +0000 (13:55 -0700)]
[ORC] Add unit tests for parts of the Orc and LLJIT C APIs.
Patch by Mats Larsen. Thanks Mats!
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D100506
Lang Hames [Mon, 26 Apr 2021 19:43:46 +0000 (12:43 -0700)]
[ORC] C API updates.
Adds support for creating custom MaterializationUnits in the C API with the new
LLVMOrcCreateCustomMaterializationUnit function.
Modifies ownership rules for LLVMOrcAbsoluteSymbols to make it consistent with
LLVMOrcCreateCustomMaterializationUnit. This is an ABI breaking change for any
clients of the LLVMOrcAbsoluteSymbols API.
Adds LLVMOrcLLJITGetObjLinkingLayer and LLVMOrcObjectLayerEmit functions to
allow clients to get a reference to an LLJIT instance's linking layer, then
emit an object file using it. This can be used to support construction of
custom materialization units in the common case where those units will
generate an object file that needs to be emitted to complete the
materialization.
Lang Hames [Mon, 26 Apr 2021 19:30:57 +0000 (12:30 -0700)]
[ORC] Fix type name.
Rename JITTargetSymbolFlags to JITSymbolTargetFlags. This matches the convention
used for JITSymbolGenericFlags.
Fangrui Song [Mon, 26 Apr 2021 20:39:35 +0000 (13:39 -0700)]
[ADT] Remove StatisticBase and make NoopStatistic empty
In LLVM_ENABLE_STATS=0 builds, `llvm::Statistic` maps to `llvm::NoopStatistic`
but has 3 unused pointers. GlobalOpt considers that the pointers can potentially
retain allocated objects, so GlobalOpt cannot optimize out the `NoopStatistic`
variables (see D69428 for more context), wasting 23KiB for stage 2 clang.
This patch makes `NoopStatistic` empty and thus reclaims the wasted space. The
clang size is even smaller than applying D69428 (slightly smaller in both .bss and
.text).
```
# This means the D69428 optimization on clang is mostly nullified by this patch.
HEAD+D69428: size(.bss) = 0x0725a8
HEAD+D101211: size(.bss) = 0x072238
# bloaty - HEAD+D69428 vs HEAD+D101211
# With D101211, we also save a lot of string table space (.rodata).
FILE SIZE VM SIZE
-------------- --------------
-0.0% -32 -0.0% -24 .eh_frame
-0.0% -336 [ = ] 0 .symtab
-0.0% -360 [ = ] 0 .strtab
[ = ] 0 -0.2% -880 .bss
-0.0% -2.11Ki -0.0% -2.11Ki .rodata
-0.0% -2.89Ki -0.0% -2.89Ki .text
-0.0% -5.71Ki -0.0% -5.88Ki TOTAL
```
Note: LoopFuse is a disabled pass. This patch adds `#if LLVM_ENABLE_STATS` so
`OptimizationRemarkMissed` is skipped in LLVM_ENABLE_STATS==0 builds. If these
`OptimizationRemarkMissed` are useful and not noisy, we can replace
`llvm::Statistic` with `llvm::TrackingStatistic` in the future.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D101211
Craig Topper [Mon, 26 Apr 2021 20:23:22 +0000 (13:23 -0700)]
[RISCV] Match splatted load to scalar load + splat. Form strided load during isel.
This modifies my previous patch to push the strided load formation
to isel. This gives us opportunity to fold the splat into a .vx
operation first. Using a scalar register and a .vx operation reduces
vector register pressure which can be important for larger LMULs.
If we can't fold the splat into a .vx operation, then it can make
sense to use a strided load to free up the vector arithmetic
ALU to do actual arithmetic rather than tying it up with vmv.v.x.
Reviewed By: khchen
Differential Revision: https://reviews.llvm.org/D101138
Fangrui Song [Mon, 26 Apr 2021 20:31:37 +0000 (13:31 -0700)]
Add LLVM_ATTRIBUTE_USED to fix problems which could be exposed by aggressive global pointer variable removal
Note to BuryPointer.cpp:GraveYard. 'unused' cannot prevent (1) dead store
elimination and (2) removal of the global pointer variable (D69428) but 'used' can.
Discovered when comparing link maps between HEAD+D69428 and HEAD.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D101217
Fangrui Song [Mon, 26 Apr 2021 20:30:20 +0000 (13:30 -0700)]
[gcov] Set nounwind and respect module flags metadata "frame-pointer" & "uwtable" for synthesized functions
This applies the D100251 mechanism to the gcov instrumentation pass.
With this patch, `-fno-omit-frame-pointer` in
`clang -fprofile-arcs -O1 -fno-omit-frame-pointer` will be respected for synthesized
`__llvm_gcov_writeout,__llvm_gcov_reset,__llvm_gcov_init` functions: the frame pointer
will be kept (note: on many targets -O1 eliminates the frame pointer by default).
`clang -fno-exceptions -fno-asynchronous-unwind-tables -g -fprofile-arcs` will
produce .debug_frame instead of .eh_frame.
Fix: https://github.com/ClangBuiltLinux/linux/issues/955
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D101129
Leonard Chan [Thu, 25 Mar 2021 22:24:12 +0000 (15:24 -0700)]
[compiler-rt][hwasan] Add definition for Symbolizer::SymbolizeFrame
This is undefined if SANITIZER_SYMBOLIZER_MARKUP is 1, which is the case for
Fuchsia, and will result in a undefined symbol error. This function is needed
by hwasan for online symbolization, but is not needed for us since we do
offline symbolization.
Differential Revision: https://reviews.llvm.org/D99386
Arthur O'Dwyer [Mon, 26 Apr 2021 20:00:56 +0000 (16:00 -0400)]
[libc++] [test] Fix a Python warning.
params.py:106: SyntaxWarning: "is" with a literal. Did you mean "=="?
Arthur O'Dwyer [Fri, 16 Apr 2021 21:31:33 +0000 (17:31 -0400)]
[libc++] [test] Improve test_exceptions() in each string.modifiers test.
When checking the strong exception guarantee, also check that
iterators haven't been invalidated.
Reviewed as part of https://reviews.llvm.org/D98573
Arthur O'Dwyer [Fri, 16 Apr 2021 21:49:57 +0000 (17:49 -0400)]
[libc++] Remove the special logic for "noexcept iterators" in basic_string.
This reverts a large chunk of http://reviews.llvm.org/D15862 ,
and also fixes bugs in `insert`, `append`, and `assign`, which are now regression-tested.
(Thanks to Tim Song for pointing out the bug in `append`!)
Before this patch, we did a special dance in `append`, `assign`, and `insert`
(but not `replace`). All of these require the strong exception guarantee,
even when the user-provided InputIterator might have throwing operations.
The naive way to accomplish this is to construct a temporary string and
then append/assign/insert from the temporary; i.e., finish all the potentially
throwing and self-inspecting InputIterator operations *before* starting to
modify self. But this is slow, so we'd like to skip it when possible.
The old code (D15682) attempted to check that specific iterator operations
were nothrow: it assumed that if the iterator operations didn't throw, then
it was safe to iterate the input range multiple times and therefore it was
safe to use the fast-path non-naive version. This was wrong for two reasons:
(1) the old code checked the wrong operations (e.g. checked noexceptness of `==`,
but the code that ran used `!=`), and (2) the conversion of value_type to char
could still throw, or inspect the contents of self.
The new code is much simpler, although still much more complicated than it
really could be. We'll likely revisit this codepath at some point, but for now
this patch suffices to get it passing all the new regression tests.
The added tests all fail before this patch, and succeed afterward.
See https://quuxplusone.github.io/blog/2021/04/17/pathological-string-appends/
Differential Revision: https://reviews.llvm.org/D98573
Arthur O'Dwyer [Sat, 24 Apr 2021 12:20:13 +0000 (08:20 -0400)]
[libc++] __bit_iterator mustn't rely on deprecated SMF generation.
This allows us to turn -Wdeprecated-copy back on. We turned it off
in
3b71de41cc7c7 because Clang's implementation became more stringent
and started diagnosing the old code here.
Differential Revision: https://reviews.llvm.org/D101183
Nico Weber [Mon, 26 Apr 2021 20:04:23 +0000 (16:04 -0400)]
[gn build] reformat all gn files
$ git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Nico Weber [Mon, 26 Apr 2021 20:03:50 +0000 (16:03 -0400)]
[gn build] (manually) port
f8de9aaef2f4
Siva Chandra Reddy [Sat, 24 Apr 2021 06:21:12 +0000 (06:21 +0000)]
[libc] Add differential quality and perf analysis targets for sinf and cosf.
Infrastructure needed for setting up the diff binaries has been added.
Along the way, an exhaustive test for sinf and cosf have also been added.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D101276
Ali Tamur [Mon, 26 Apr 2021 19:09:10 +0000 (12:09 -0700)]
Support DW_FORM_strx* in llvm-dwp.
Currently llvm-dwp only handled DW_FORM_string and DW_FORM_GNU_str_index; with this patch it also starts to handle DW_FORM_strx[1-4]?
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D75485
Guillaume Chatelet [Mon, 26 Apr 2021 19:30:00 +0000 (19:30 +0000)]
[libc] Use different alignment for memcpy between ARM and x86.
Aligned copy used to be 'destination aligned' for x86 but this decision was reverted in D93457 where we noticed that it was better for ARM to be 'source aligned'.
More benchmarking confirmed that it can be up to 30% faster to align copy to destination for x86. This Patch offers both implementations and switches x86 back to destination aligned.
It also fixes alignment to 32 byte on x86.
Differential Revision: https://reviews.llvm.org/D101296
Martin Storsjö [Thu, 15 Apr 2021 11:38:27 +0000 (14:38 +0300)]
[llvm-rc] Add a GNU windres-like frontend to llvm-rc
This primarily parses a different set of options and invokes the same
resource compiler as llvm-rc normally. Additionally, it can convert
directly to an object file (which in MSVC style setups is done with the
separate cvtres tool, or by the linker).
(GNU windres also supports other conversions; from coff object file back
to .res, and from .res or object file back to .rc form; that's not yet
implemented.)
The other bigger complication lies in being able to imply or pass the
intended target triple, to let clang find the corresponding mingw sysroot
for finding include files, and for specifying the default output object
machine format.
It can be implied from the tool triple prefix, like
`<triple>-[llvm-]windres` or picked up from the windres option e.g.
`-F pe-x86-64`. In GNU windres, that option takes BFD style format names
such as pe-i386 or pe-x86-64. As libbfd in binutils doesn't support
Windows on ARM, there's no such canonical name for the ARM targets.
Therefore, as an LLVM specific extension, this option is extended to
allow passing full triples, too.
Differential Revision: https://reviews.llvm.org/D100756
Chris Lattner [Sun, 25 Apr 2021 23:15:17 +0000 (16:15 -0700)]
[Verifier] Tidy up the code a bit, NFC.
This tidies up the code a bit:
* Eliminate the ctx member, which doesn't need to be stored.
* Rename verify(Operation) to make it more clear that it is
doing more than verifyOperation and that the dominance check
isn't being done multiple times.
* Rename mayNotHaveTerminator which was confusing about whether
it wasn't known whether it had a terminator, when it is really
about whether it is legal to have a terminator.
* Some minor optimizations: don't check for RegionKindInterface
if there are no regions. Don't do two passes over the
operations in a block in OperationVerifier::verifyDominance when
one will do.
The optimizations are actually a measurable (but minor) win in some
CIRCT cases.
Differential Revision: https://reviews.llvm.org/D101267
Chris Lattner [Sun, 25 Apr 2021 23:57:45 +0000 (16:57 -0700)]
Remove obsolete using declaration that was just kept around to help with API adoption.
Differential Revision: https://reviews.llvm.org/D101269
Alex Lorenz [Mon, 26 Apr 2021 17:56:30 +0000 (10:56 -0700)]
[clang][driver] Use the provided arch name for a Darwin target triple
This ensures that the Darwin driver uses a consistent target triple
representation when the triple is printed out to the user.
Differential Revision: https://reviews.llvm.org/D100807
Joseph Huber [Mon, 26 Apr 2021 18:20:14 +0000 (14:20 -0400)]
[OpenMP][Documentation] Add FAQ entry for dynamically linked libraries
Summary:
Add an FAW entry detailing the support for using dynamically linked libraries
with OpenMP Offloading
Tim Renouf [Mon, 26 Apr 2021 17:49:33 +0000 (18:49 +0100)]
[AMDGPU][llvm-objdump] Fix memory leak in recent commit
Hopefully stops sanitizer fail in AMDGPU llvm-objdump test.
Change-Id: I7331151d1cb65292bd06b6ae283349fe7231cf6b
Stephen Kelly [Mon, 26 Apr 2021 17:28:50 +0000 (18:28 +0100)]
[AST] Fix DeclarationNameInfo introspection
Some AST classes return `const DeclarationNameInfo &` instead of
returning by value (eg CXXDependentScopeMemberExpr).
Moritz Sichert [Fri, 30 Oct 2020 10:35:12 +0000 (11:35 +0100)]
[RuntimeDyld] Fixed buffer overflows with absolute symbols
Differential Revision: https://reviews.llvm.org/D95596
Jin Lin [Sat, 24 Apr 2021 05:37:08 +0000 (22:37 -0700)]
Preserve the lexical order for global variables during llvm-link merge
The order of global variables is generated in the order of recursively materializing variables if the global variable has the attribute of hasLocalLinkage or hasLinkOnceLinkage during the module merging. In practice, it is often the exact reverse of source order. This new order may cause performance regression.
The change is to preserve the original lexical order for global variables.
Reviewed By: jdoerfert, dexonsmith
Differential Revision: https://reviews.llvm.org/D94202
Sebastian Neubauer [Mon, 26 Apr 2021 17:04:46 +0000 (19:04 +0200)]
[AMDGPU] Fix autogenerated wwm-reserved-spill.ll
Due to a bug in update_llc_test_checks.py, the test is wrongly
coalesced between run lines. Remove common check prefix to fix that.
NFC.
Wael Yehia [Mon, 26 Apr 2021 14:18:51 +0000 (10:18 -0400)]
XFAIL thinlto testcases on AIX
In D100350, we switched off thinLTO on the AIX OS. So, XFAIL tests that
invoke clang with -flto=thin on AIX.
Raphael Isemann [Mon, 26 Apr 2021 16:52:07 +0000 (18:52 +0200)]
[lldb] Skip TestPointerToMemberTypeDependingOnParentSize on Windows and GCC
The test added in D100977 is failing to compile on these platforms. This seems
to be caused by GCC, MSVC and Clang@Windows rejecting the code because
`ToLayout` isn't complete when pointer_to_member_member is declared (even though
that seems to be valid code).
This also reverts the test changes in the lazy-loading test from D100977 as
that failed for the same reason.
William S. Moses [Wed, 21 Apr 2021 01:59:45 +0000 (21:59 -0400)]
[Lexer] Allow LLLexer to be used as an API
Explose LLVM Lexer for usage externally as an API
Differential Revision: https://reviews.llvm.org/D100920
Frederik Gossen [Mon, 26 Apr 2021 16:33:36 +0000 (18:33 +0200)]
[MLIR] Remove empty shape operands from `cstr_broadcastable` ops
Differential Revision: https://reviews.llvm.org/D101170
Jonas Devlieghere [Mon, 26 Apr 2021 16:29:37 +0000 (09:29 -0700)]
[lldb] Don't use ::fork or ::vfork on watchOS or tvOS
Update lldb-server to not use fork or vfork on watchOS and tvOS as these
functions are explicitly marked unavailable there.
llvm-project/lldb/test/API/tools/lldb-server/main.cpp:304:11:
error: 'fork' is unavailable: not available on watchOS
if (fork() == 0)
^
WatchSimulator6.2.sdk/usr/include/unistd.h:447:8: note: 'fork' has been
explicitly marked unavailable here
pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
llvm-project/lldb/test/API/tools/lldb-server/main.cpp:307:11:
error: 'vfork' is unavailable: not available on watchOS
if (vfork() == 0)
^
WatchSimulator6.2.sdk/usr/include/unistd.h:602:8: note: 'vfork' has been
explicitly marked unavailable here
pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
Peter Steinfeld [Fri, 23 Apr 2021 02:29:14 +0000 (19:29 -0700)]
[flang] Check for attributes specific to dummy arguments
We were not checking that attributes that are supposed to be specific to
dummy arguments were not being used for local entities. I added the checks
along with tests for them.
After implementing these new checks, I found that one of the tests in
separate-mp02.f90 was erroneous, and I fixed it.
Differential Revision: https://reviews.llvm.org/D101126
Alexey Bader [Mon, 26 Apr 2021 13:15:03 +0000 (16:15 +0300)]
[Doc] Add SYCLSupport.rst to index toctree.
Wenlei He [Sat, 24 Apr 2021 17:37:55 +0000 (10:37 -0700)]
[CSSPGO] Explicitly disallow Binary and Compact Binary profile format for CSSPGO
CSSPGO only supports text and extended binary profile now. Raw binary does not have the metadata section CSSPGO needs, and Compact binary profile needs special handling for GUID based context names, which is not yet implemented.
Disasslow these two format for CSSPGO profile writing to avoid silently generating invalid profiles.
Differential Revision: https://reviews.llvm.org/D101300
Michael Kruse [Mon, 26 Apr 2021 15:52:06 +0000 (10:52 -0500)]
[SimplifyCFG] Preserve metadata when unconditionalizing branches (constant condition).
When replacing a conditional branch by an unconditional one because the condition is a constant, transfer the metadata to the new branch instruction.
Part of fix for llvm.org/PR50060
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D101141
Frederik Gossen [Mon, 26 Apr 2021 15:52:37 +0000 (17:52 +0200)]
[MLIR][Shape] Ensure to preserve op type of `shape.broadcast`
Ensure to preserve the correct type during when folding and canonicalization.
`shape.broadcast` of of a single operand can only be folded away if the argument
type is correct.
Differential Revision: https://reviews.llvm.org/D101158
Mark de Wever [Mon, 26 Apr 2021 15:53:20 +0000 (17:53 +0200)]
[libc++][NFC] Remove non-ASCII from comment.
Seems our check-generated-output doesn't work as intended. Will
investigate it further.
Sebastian Neubauer [Mon, 26 Apr 2021 15:43:00 +0000 (17:43 +0200)]
[AMDGPU] Use MapVector for WWMReservedRegs
Use MapVector instead of SmallDenseMap because it has a deterministic
iteration order.
Differential Revision: https://reviews.llvm.org/D101299
OCHyams [Mon, 26 Apr 2021 15:33:10 +0000 (16:33 +0100)]
[dexter] Update failing regression test
Commit
7deb970ef added REQUIRES and UNSUPPORTED lines to a test which is
sensitive to line number changes. Update the line number reference in the test.
Alexey Bader [Wed, 24 Mar 2021 13:25:20 +0000 (16:25 +0300)]
[SYCL][Doc] Add design document for SYCL mode
Initial version of the document covers address space handling
Differential Revision: https://reviews.llvm.org/D99488
Simon Pilgrim [Mon, 26 Apr 2021 14:10:20 +0000 (15:10 +0100)]
[X86] Rename multiclass ATOMIC_LOAD_BINOP -> ATOMIC_RMW_BINOP. NFCI.
Noticed while triaging the rG2149aa73f640c96 regressions - the LXADD ops are load+store RMW instructions, not just loads.
Greg McGary [Mon, 26 Apr 2021 00:28:49 +0000 (17:28 -0700)]
[lld-macho] Add option --error-limit=N
Add option to limit (or remove limits) on the number of errors printed before exiting. This option exists in the other lld ports: COFF & ELF.
Differential Revision: https://reviews.llvm.org/D101274
Dávid Bolvanský [Mon, 26 Apr 2021 14:08:18 +0000 (16:08 +0200)]
Revert "Only ignore -Wdeprecated-copy if the used compiler supports the warning"
This reverts commit
b125c034af89e32d5258d593080ff0c4810776a0.
Some bots say " missing binary operator before token "(" "
Nigel Perks [Wed, 21 Apr 2021 17:41:19 +0000 (18:41 +0100)]
[clang][XCore] Define __xcore__ for XCore target.
The headers shipped with the XMOS XCore compiler expect __xcore__ to be defined.
The __XS1B__ macro, already defined, is for the default subtarget.
No other targets affected.
Paul C. Anagnostopoulos [Mon, 26 Apr 2021 14:00:19 +0000 (10:00 -0400)]
[TableGen] Remove a TODO comment that is no longer relevant [NFC]
Dávid Bolvanský [Mon, 26 Apr 2021 13:44:52 +0000 (15:44 +0200)]
Only ignore -Wdeprecated-copy if the used compiler supports the warning
This is needed after
https://reviews.llvm.org/rG9658d045926545e62cc3f963fe611d7c5d0c9d98
which introduced code that at least didn't compile clean with clang 8.
Reviewed By: xbolva00
Differential Revision: https://reviews.llvm.org/D101288
Paul C. Anagnostopoulos [Tue, 20 Apr 2021 14:00:24 +0000 (10:00 -0400)]
[TableGen] Change assertion information from a tuple to a struct [NFC]
Differential Revision: https://reviews.llvm.org/D100854
Alexey Bader [Fri, 20 Dec 2019 09:05:42 +0000 (12:05 +0300)]
[SYCL] Implement SYCL address space attributes handling
Default address space (applies when no explicit address space was
specified) maps to generic (4) address space.
Added SYCL named address spaces `sycl_global`, `sycl_local` and
`sycl_private` defined as sub-sets of the default address space.
Static variables without address space now reside in global address
space when compile for SPIR target, unless they have an explicit address
space qualifier in source code.
Differential Revision: https://reviews.llvm.org/D89909
Dávid Bolvanský [Mon, 26 Apr 2021 12:22:14 +0000 (14:22 +0200)]
[InstCombine] C - ctpop(a) - > ctpop(~a)) if C is bitwidth (PR50104)
Proof: https://alive2.llvm.org/ce/z/mncA9K
Solves https://bugs.llvm.org/show_bug.cgi?id=50104
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D101257
Tim Northover [Thu, 22 Apr 2021 12:30:30 +0000 (13:30 +0100)]
AArch64: support atomics in GISel
Emre Kultursay [Mon, 26 Apr 2021 13:20:33 +0000 (15:20 +0200)]
[lldb] Use forward type in pointer-to-member
This change is similar in spirit to the change at:
https://reviews.llvm.org/rG34c697c85e9d0af11a72ac4df5578aac94a627b3
It fixes the problem where the layout of a type was being accessed
while its base classes were not populated yet; which caused an
incorrect layout to be produced and cached.
This fixes PR50054
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D100977
Tim Renouf [Mon, 26 Apr 2021 13:06:56 +0000 (14:06 +0100)]
[AMDGPU][llvm-objdump] Add lit.local.cfg missing from recent commit
Stops llvm-objdump tests failing when AMDGPU target is not supported.
Change-Id: Ic4ae443958c41c303ff6bee0966e5f21ab7a1851
Tim Renouf [Fri, 23 Apr 2021 07:59:24 +0000 (08:59 +0100)]
[MC][AMDGPU][llvm-objdump] Synthesized local labels in disassembly
1. Add an accessor function to MCSymbolizer to retrieve addresses
referenced by a symbolizable operand, but not resolved to a symbol.
That way, the caller can synthesize labels at those addresses and
then retry disassembling the section.
2. Implement that in AMDGPU -- a failed symbol lookup results in the
address being added to a vector returned by the new function.
3. Use that in llvm-objdump when using MCSymbolizer (which only happens
on AMDGPU) and SymbolizeOperands is on.
Differential Revision: https://reviews.llvm.org/D101145
Change-Id: I19087c3bbfece64bad5a56ee88bcc9110d83989e
Sanjay Patel [Mon, 26 Apr 2021 12:30:27 +0000 (08:30 -0400)]
[IndVars] avoid 'tmp' names in test file with auto-generated CHECK lines; NFC
The script warns that this could be buggy when updating.
Yuanbo Li [Mon, 26 Apr 2021 12:07:18 +0000 (13:07 +0100)]
[LSR][DebugInfo] Don't unnecessarily drop DebugLocs
When transforming a loop terminating condition into a "max" comparison,
the DebugLoc from the old condition should be set on the newly created
comparison. They are the same operation, just optimized. Fixes PR48067.
Differential Revision: https://reviews.llvm.org/D98218
Bradley Smith [Thu, 22 Apr 2021 11:15:43 +0000 (12:15 +0100)]
[AArch64][SVE] Add missing patterns for scalar versions of SQSHL/UQSHL
Differential Revision: https://reviews.llvm.org/D101058
Dávid Bolvanský [Sun, 25 Apr 2021 14:33:57 +0000 (16:33 +0200)]
[InstCombine] Added testcases for PR50104, NFC
David Green [Mon, 26 Apr 2021 11:27:38 +0000 (12:27 +0100)]
[ARM] Expand VMOVRRD simplification pattern
This expands the VMOVRRD(extract(..(build_vector(a, b, c, d)))) pattern,
to also handle insert_vectors. Providing we can find the correct insert,
this helps further simplify patterns by removing the redundant VMOVRRD.
Differential Revision: https://reviews.llvm.org/D100245
David Green [Mon, 26 Apr 2021 09:06:28 +0000 (10:06 +0100)]
[ARM] Additional soft float BE test. NFC
David Sherwood [Tue, 6 Apr 2021 12:23:44 +0000 (13:23 +0100)]
[NFC] Add scalable vectorisation tests for int/FP <> int/FP conversions
We can already vectorize loops that involve int<>int, fp<>fp, int<>fp
and fp<>int conversions, however we didn't previously have any tests
for them. This patch adds some tests for each conversion type.
Differential Revision: https://reviews.llvm.org/D99951
David Sherwood [Fri, 16 Apr 2021 15:08:38 +0000 (16:08 +0100)]
[AArch64] Add AArch64TTIImpl::getMaskedMemoryOpCost function
When vectorising for AArch64 targets if you specify the SVE attribute
we automatically then treat masked loads and stores as legal. Also,
since we have no cost model for masked memory ops we believe it's
cheap to use the masked load/store intrinsics even for fixed width
vectors. This can lead to poor code quality as the intrinsics will
currently be scalarised in the backend. This patch adds a basic
cost model that marks fixed-width masked memory ops as significantly
more expensive than for scalable vectors.
Tests for the cost model are added here:
Transforms/LoopVectorize/AArch64/masked-op-cost.ll
Differential Revision: https://reviews.llvm.org/D100745
Florian Hahn [Mon, 26 Apr 2021 09:16:25 +0000 (10:16 +0100)]
[VPlan] Make blocksOnly work properly with ranges over const pointers.
When iterating over const blocks, the base type in the lambdas needs
to use const VPBlockBase *, otherwise it cannot be used with input
iterators over const VPBlockBase.
Also adjust the type of the input iterator range to const &, as it
does not take ownership of the input range.
Andrzej Warzynski [Fri, 16 Apr 2021 14:07:09 +0000 (14:07 +0000)]
[flang][driver] Fine-tune `-fdebug-dump-symbols`
When generating output for `-fdebug-dump-symbols`, make sure that
BuildRuntimeDerivedTypeTables is also run. This change is needed in
order to make the implementation of `-fdebug-dump-symbols` in
`flang-new` consistent with `f18`. It also allows us to port more tests
to use the new driver whenever it is enabled.
Differential Revision: https://reviews.llvm.org/D100649
Jeremy Morse [Mon, 26 Apr 2021 08:48:36 +0000 (09:48 +0100)]
[Clang][Coroutine][DebugInfo] Relax test ordering requirement
The test added in D97533 (and modified by this patch) has some overly
strict printed metadata ordering requirements, specifically the
interleaving of DILocalVariable nodes and DILocation nodes. Slight changes
in metadata emission can easily break this unfortunately.
This patch stops after clang codegen rather than allowing the coro splitter
to run, and reduces the need for ordering: it picks out the
DILocalVariable nodes being sought, in any order (CHECK-DAG), and doesn't
examine any DILocations. The implicit CHECK-NOT is what's important: the
test seeks to ensure a duplicate set of DILocalVariables aren't emitted in
the same scope.
Differential Revision: https://reviews.llvm.org/D100298
Krasimir Georgiev [Thu, 22 Apr 2021 08:56:15 +0000 (10:56 +0200)]
[clang-format] fix indent in alignChainedConditionals
Clang-format was indenting the lines following the `?` in the added test
case by +5 instead of +4. This only happens in a very specific
situation, where the `?` is followed by a multiline block comment, as in
the example. This fix addresses this without regressing any of the
existing tests.
Differential Revision: https://reviews.llvm.org/D101033
David Green [Mon, 26 Apr 2021 09:04:33 +0000 (10:04 +0100)]
[ARM] Ensure loop invariant active.lane.mask operands
CGP can move instructions like a ptrtoint into a loop, but the
MVETailPredication when converting them will currently assume invariant
trip counts. This tries to ensure the operands are loop invariant, and
bails if not.
Differential Revision: https://reviews.llvm.org/D100550
Hsiangkai Wang [Mon, 26 Apr 2021 09:01:49 +0000 (17:01 +0800)]
[RISCV] Add REQUIRES: riscv-registered-target for RISC-V test cases.
Djordje Todorovic [Mon, 26 Apr 2021 08:14:12 +0000 (01:14 -0700)]
[llvm-dwarfdump] Fix split-dwarf bug in stats for inlined var loc cov
Initial (D96045) patch didn't handle split dwarf cases,
so this fixes that bug.
In addition, before applying this patch, we had a slowdown
that happened after the D96045. With this patch,
the slowdown will be fixed as well.
Differential Revision: https://reviews.llvm.org/D100951
Jan Svoboda [Mon, 26 Apr 2021 08:55:24 +0000 (10:55 +0200)]
[clang][deps] NFC: Fix typo
Jan Svoboda [Thu, 22 Apr 2021 11:49:25 +0000 (13:49 +0200)]
[clang][deps] Only generate absolute paths when asked to
Add option to `clang-scan-deps` to enable/disable generation of command-line arguments with absolute paths. This is essentially a revert of D100533, but with improved naming and added test.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D101051