Fangrui Song [Sat, 28 Mar 2020 23:48:59 +0000 (16:48 -0700)]
[MC][PowerPC] Make .reloc support arbitrary relocation types
Generalizes
ad7199f3e60a49db023099dcb879fcc9cdf94a2e (R_PPC_NONE/R_PPC64_NONE).
Joerg Sonnenberger [Tue, 17 Mar 2020 23:39:54 +0000 (00:39 +0100)]
Fix compatibility for __builtin_stdarg_start
The __builtin_stdarg_start is the legacy spelling of __builtin_va_start.
It should behave exactly the same, but for the last 9 years it would
behave subtly different for diagnostics. Follow the change from
29ad95b23217 to require custom type checking.
Matt Arsenault [Sat, 7 Sep 2019 23:07:47 +0000 (19:07 -0400)]
AMDGPU: Make use of default operands
Benjamin Kramer [Sat, 28 Mar 2020 21:06:12 +0000 (22:06 +0100)]
Put back initializers that were dropped in
0ab5b5b8581d9f2951575f7245824e6e4fc57dec
Found by msan.
Benjamin Kramer [Sat, 28 Mar 2020 20:38:50 +0000 (21:38 +0100)]
[COFF] Stabilize sort
Found by llvm::sort's expensive checks.
Benjamin Kramer [Sat, 28 Mar 2020 20:16:51 +0000 (21:16 +0100)]
[MDBuilder] Don't use stable sort for sorting integers.
Nikita Popov [Sat, 28 Mar 2020 20:16:48 +0000 (21:16 +0100)]
[InstCombine] Remove unreachable blocks before DCE
Dropping unreachable code may reduce use counts on other instructions,
so it's better to do this earlier rather than later.
NFC-ish, may only impact worklist order.
Nikita Popov [Sat, 28 Mar 2020 20:13:33 +0000 (21:13 +0100)]
[InstCombine] Merge two functions; NFC
Merge AddReachableCodeToWorklist() into prepareICWorklistFromFunction().
It's one logical step, and this makes it easier to move code.
Benjamin Kramer [Sat, 28 Mar 2020 17:47:26 +0000 (18:47 +0100)]
[ADT] Automatically forward llvm::sort to array_pod_sort if safe
This is safe if the iterator type is a pointer and the comparator is
stateless. The enable_if pattern I'm adding here only uses
array_pod_sort for the default comparator (std::less).
Using array_pod_sort has a potential performance impact, but I didn't
notice anything when testing clang. Sorting doesn't seem to be on the
hot path anywhere in LLVM.
Shrinks Release+Asserts clang by 73k.
Benjamin Kramer [Sat, 28 Mar 2020 19:16:41 +0000 (20:16 +0100)]
[AMDGPU] Stabilize sort order
Found by the expensive checks in llvm::sort.
Yonghong Song [Sun, 22 Mar 2020 05:54:20 +0000 (22:54 -0700)]
[BPF] support 128bit int explicitly in layout spec
Currently, bpf does not specify 128bit alignment in its
layout spec. So for a structure like
struct ipv6_key_t {
unsigned pid;
unsigned __int128 saddr;
unsigned short lport;
};
clang will generate IR type
%struct.ipv6_key_t = type { i32, [12 x i8], i128, i16, [14 x i8] }
Additional padding is to ensure later IR->MIR can generate correct
stack layout with target layout spec.
But it is common practice for a tracing program to be
first compiled with target flag (e.g., x86_64 or aarch64) through
clang to generate IR and then go through llc to generate bpf
byte code. Tracing program often refers to kernel internal
data structures which needs to be compiled with non-bpf target.
But such a compilation model may cause a problem on aarch64.
The bcc issue https://github.com/iovisor/bcc/issues/2827
reported such a problem.
For the above structure, since aarch64 has "i128:128" in its
layout string, the generated IR will have
%struct.ipv6_key_t = type { i32, i128, i16 }
Since bpf does not have "i128:128" in its spec string,
the selectionDAG assumes alignment 8 for i128 and
computes the stack storage size for the above is 32 bytes,
which leads incorrect code later.
The x86_64 does not have this issue as it does not have
"i128:128" in its layout spec as it does permits i128 to
be alignmented at 8 bytes at stack. Its IR type looks like
%struct.ipv6_key_t = type { i32, [12 x i8], i128, i16, [14 x i8] }
The fix here is add i128 support in layout spec, the same as
aarch64. The only downside is we may have less optimal stack
allocation in certain cases since we require 16byte alignment
for i128 instead of 8. But this is probably fine as i128 is
not used widely and in most cases users should already
have proper alignment.
Differential Revision: https://reviews.llvm.org/D76587
Benjamin Kramer [Sat, 28 Mar 2020 18:19:55 +0000 (19:19 +0100)]
Upgrade some instances of std::sort to llvm::sort. NFC.
Benjamin Kramer [Sat, 28 Mar 2020 18:21:56 +0000 (19:21 +0100)]
Remove constexpr that MSVC doesn't like
Reid Kleckner [Sat, 28 Mar 2020 18:03:14 +0000 (11:03 -0700)]
[CodeGen] Fix sinking local values in lpads with phis
There was already a test case for landingpads to handle this case, but I
had forgotten to consider PHI instructions preceding the EH_LABEL in the
landingpad.
PR45261
Nikita Popov [Sat, 28 Mar 2020 18:02:48 +0000 (19:02 +0100)]
[InstCombine] Use replaceOperand() API in GEP transforms
To make sure that replaced operands get DCEd. This drops one
iteration from gepphigep.ll, which is still not optimal.
This was the last test case performing more than 3 iterations.
NFC-ish, only worklist order should change.
Nikita Popov [Sat, 28 Mar 2020 17:44:35 +0000 (18:44 +0100)]
[InstCombine] Reduce code duplication in GEP of PHI transform; NFC
The `NewGEP->setOperand(DI, NewPN)` call was duplicated, and the
insertion of NewGEP is the same in both if/else, so we can extract it.
Benjamin Kramer [Sat, 28 Mar 2020 17:12:28 +0000 (18:12 +0100)]
Const-initialize ParsedAttrInfos
Gets rid of a 150k static initializer (Release clang)
Alexandre Ganea [Sat, 28 Mar 2020 17:54:44 +0000 (13:54 -0400)]
After
09158252f777c2e2f06a86b154c44abcbcf9bb74, fix build when -DLLVM_ENABLE_THREADS=OFF
Tested on Linux with Clang 9, and on Windows with Visual Studio 2019 16.5.1 with -DLLVM_ENABLE_THREADS=ON and OFF.
Nikita Popov [Fri, 21 Feb 2020 21:48:06 +0000 (22:48 +0100)]
[InstCombine] Fix worklist management in foldXorOfICmps()
Because this code does not use the IC-aware replaceInstUsesWith()
helper, we need to manually push users to the worklist.
This is NFC-ish, in that it may only change worklist order.
Nikita Popov [Sat, 28 Mar 2020 17:15:31 +0000 (18:15 +0100)]
[InstCombine] Change limit-max-iterations test case; NFC
This particular case will stop needing multiple iterations in
a followup change.
Matt Schulte [Sat, 28 Mar 2020 16:54:06 +0000 (09:54 -0700)]
[lld][ELF] Mark empty NOLOAD output sections SHT_NOBITS instead of SHT_PROGBITS
This fixes PR# 45336.
Output sections described in a linker script as NOLOAD with no input sections would be marked as SHT_PROGBITS.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D76981
Enna1 [Sat, 28 Mar 2020 16:59:22 +0000 (17:59 +0100)]
[CorrelatedValuePropagation] Remove redundant if statement in processSelect()
This statement
if (ReplaceWith == S) ReplaceWith = UndefValue::get(S->getType());
is introduced in https://reviews.llvm.org/rG35609d97ae89b8e13f40f4e6b9b056954f8baa83
to fix a case where unreachable code can cause select instruction
simplification to fail. In https://reviews.llvm.org/rGd10480657527ffb44ea213460fb3676a6b1300aa,
we begin to perform a depth-first walk of basic blocks. This means
we will not visit unreachable blocks. So we do not need this the
special check any more.
Differential Revision: https://reviews.llvm.org/D76753
Martin Storsjö [Sat, 28 Mar 2020 15:37:59 +0000 (17:37 +0200)]
[AsmPrinter] Emit .weak directive for weak linkage on COFF for symbols without a comdat
MC already knows how to emulate the .weak directive (with its ELF
semantics; i.e., an undefined weak symbol resolves to 0, and a defined
weak symbol has lower link precedence than a strong symbol of the same
name) using COFF weak externals. Plumb this through the ASM printer too,
so that definitions marked with __attribute__((weak)) at the language
level (which gets translated to weak linkage at the IR level) have the
corresponding .weak directive emitted. Note that declarations marked
with __attribute__((weak)) at the language level (which translates to
extern_weak at the IR level) already have .weak directives emitted.
Weak*/linkonce* symbols without an associated comdat (in particular, ones
generated with __attribute__((weak)) in C/C++) were earlier emitted as
normal unique globals, as the comdat is required to provide the linkonce
semantics. This change makes sure they are emitted as .weak instead,
allowing other symbols to override them.
Rename the existing coff-weak.ll test to coff-linkonce.ll. I'm not
quite sure what that test covers, since the behavior being tested in it
(the emission of a one_only section) is just a result of passing
-function-sections to llc; the linkonce_odr makes no difference.
Add a new coff-weak.ll which tests the new directive emission.
Based on an previous patch by Shoaib Meenai.
Differential Revision: https://reviews.llvm.org/D44543
Alex Brachet [Sat, 28 Mar 2020 16:28:43 +0000 (12:28 -0400)]
[libc] Only use __has_builtin on clang
The preprocessor reads the whole line even if the first condition of an and is false so this broke when compiling on older gcc versions which don't recognize `__has_builtin`
Florian Hahn [Sat, 28 Mar 2020 15:20:10 +0000 (15:20 +0000)]
[SCCP] Remove LatticeVal alias now that transition is done (NFC).
The LatticeVal alias was introduced to reduce the diff size for the
transition to ValueLatticeElement, which is done now.
This patch removes the unnecessary alias and updates some very verbose
type uses with auto.
Florian Hahn [Sat, 28 Mar 2020 15:18:12 +0000 (15:18 +0000)]
[SCCP] Remove unused toLatticeValue helper (NFC).
LatticeVal is an alias for ValueLatticeElement and the function is not
used any longer.
Kadir Cetinkaya [Sat, 29 Feb 2020 12:37:31 +0000 (13:37 +0100)]
[clang][Syntax] Handle macro arguments in spelledForExpanded
Reviewers: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75446
Raphael Isemann [Sat, 28 Mar 2020 15:16:08 +0000 (16:16 +0100)]
[lldb][NFC] Fix typo in TestInvalidArgsLog
Michael Liao [Sat, 28 Mar 2020 14:12:58 +0000 (10:12 -0400)]
Fix GCC warning on enum class bitfield. NFC.
Michael Liao [Sat, 28 Mar 2020 05:40:31 +0000 (01:40 -0400)]
Fix `-Wsign-compare` warning. NFC.
Martin Storsjö [Fri, 27 Mar 2020 19:58:48 +0000 (21:58 +0200)]
[llvm-rc] Allow -1 for menu item IDs
This seems to be used in some resource files, e.g.
https://github.com/wxWidgets/wxWidgets/blob/
f3217573d7240411e7817c9d76d965b2452987a2/include/wx/msw/wx.rc#L28.
MSVC rc.exe and GNU windres both allow any value here, and silently
just truncate to uint16_t range. This just explicitly allows the
-1 value and errors out on others - the same was done for control
IDs in dialogs in
c1a67857ba0a6ba558818b589fe7c0fcc8f238ae.
Differential Revision: https://reviews.llvm.org/D76951
Simon Pilgrim [Sat, 28 Mar 2020 10:56:34 +0000 (10:56 +0000)]
[X86][SSE] Add testnzc(~X,Y) -> testnzc(X,Y) test cases
Simon Pilgrim [Fri, 27 Mar 2020 22:42:58 +0000 (22:42 +0000)]
[X86][SSE] Add original PR38522 test case
Simon Pilgrim [Fri, 27 Mar 2020 21:52:51 +0000 (21:52 +0000)]
[X86][SSE] Add combine tests for PTEST/TESTPS/TESTPD instructions
Including some test coverage for PR38522
Evan LeClercq [Sat, 28 Mar 2020 09:09:58 +0000 (04:09 -0500)]
[docs] Added solutions to slow build under common problems.
I added a list of options to configure should someone have issues with
long build time or running out of memory. This was added under common
problems in the getting started section of the documentation.
Reviewed By: Meinersbur, dim, e-leclercq
Differential Revision: https://reviews.llvm.org/D75425
Dmitry Vyukov [Sat, 28 Mar 2020 08:07:15 +0000 (09:07 +0100)]
tsan: fix build bugs
1. Fix expression inside of DCHECK_LE.
2. Add a debug build test to buildgo.sh.
3. Fix race binary path in buildgo.sh.
Uday Bondhugula [Sat, 28 Mar 2020 06:51:49 +0000 (12:21 +0530)]
[NFC] Attributor comment updates / cast cleanup
Minor update/fixes to comments for the Attributor pass, and dyn_cast -> cast.
Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76972
Siva Chandra Reddy [Wed, 25 Mar 2020 16:44:06 +0000 (09:44 -0700)]
[libc] Extend add_object rule to handle helper object libraries.
The rule is now called add_object_library.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D76826
Alex Brachet [Sat, 28 Mar 2020 06:59:42 +0000 (02:59 -0400)]
[libc][NFC] Ensure internal implementation is in __llvm_libc namespace
Summary: In preparation for D76818.
Reviewers: PaulkaToast, sivachandra, gchatelet
Reviewed By: PaulkaToast, sivachandra
Subscribers: MaskRay, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D76967
Jason Molenda [Sat, 28 Mar 2020 05:35:19 +0000 (22:35 -0700)]
Merge in symbols from Mach-O dyld trie to the symbol table
In ObjectFileMachO we construct the symbol table from multiple
sources -- primarily the binary's nlist records, but when the nlist
symbols have been stripped, we would augment those with function
start address from the LC_FUNCTION_STARTS or eh_frame. This patch
adds another source of symbols - the exported symbols that the
dynamic linker, dyld, uses at runtime from its trie structure. This
provides us names and addresses for these functions/data.
This patch removes the code from ParseSymtab that would reject an
empty symbol table / nlist source. It adds a new symbols_added
set which tracks the address of every symbol we've added to the
symtab. We add symbols in most-information-ful order, and before
adding a symbol from less-informational-ful source (e.g.
LC_FUNCTION_STARTS with no function name), we check if that symbol
has already been added.
On targets with thumb code generation, instead of using the 0th bit
in these addresses in FunctionStarts (or now the trie entries), we
use the data field of FunctionStarts (formerly used to track if the
func_start should be added) and a flag for the trie entries to
encode this, and only store the actual addresses in the symbols_seen
and these vectors.
<rdar://problem/
50791451>
Differential revision: https://reviews.llvm.org/D76758
Serge Pavlov [Wed, 15 Jan 2020 05:44:54 +0000 (12:44 +0700)]
[FEnv] Constfold some unary constrained operations
This change implements constant folding to constrained versions of
intrinsics, implementing rounding: floor, ceil, trunc, round, rint and
nearbyint.
Differential Revision: https://reviews.llvm.org/D72930
Yaxun (Sam) Liu [Wed, 25 Mar 2020 13:50:51 +0000 (09:50 -0400)]
[AMDGPU] Add __builtin_amdgcn_workgroup_size_x/y/z
The main purpose of introducing these builtins is to add a range
metadata [1, 1025) on the work group size loaded from dispatch
ptr, which cannot be done by source code.
Differential Revision: https://reviews.llvm.org/D76772
Richard Smith [Sat, 28 Mar 2020 03:59:49 +0000 (20:59 -0700)]
PR45294: Fix handling of assumed template names looked up in the lexical
scope.
There are a few contexts in which we assume a name is a template name;
if such a context is one where we should perform an unqualified lookup,
and lookup finds nothing, we would form a dependent template name even
if the name is not dependent. This happens in particular for the lookup
of a pseudo-destructor.
In passing, rename ActOnDependentTemplateName to just ActOnTemplateName
given that we apply it for non-dependent template names too.
Mehdi Amini [Sat, 28 Mar 2020 03:49:53 +0000 (03:49 +0000)]
Remove spurious duplicated header include (NFC)
Richard Smith [Sat, 28 Mar 2020 03:26:34 +0000 (20:26 -0700)]
Form invalid template-id annotations when parsing a construct that is
required to be a template-id but names an undeclared identifier.
Sean Silva [Thu, 26 Mar 2020 21:57:01 +0000 (14:57 -0700)]
Verify number of result types in generated builder.
Summary: This just bit me and is nasty to debug.
Differential Revision: https://reviews.llvm.org/D76888
Jonas Devlieghere [Sat, 28 Mar 2020 02:21:10 +0000 (19:21 -0700)]
Revert "[FileCollector] Add a method to add a whole directory and it contents."
This reverts commit
8913769e353a171ba01fa8ce9d598e979b620be9 because the
unit test is failing on the Windows bot.
Ilya Leoshkevich [Fri, 27 Mar 2020 19:23:20 +0000 (20:23 +0100)]
[compiler-rt] Fall back to internal_uname() when called early
Summary:
Commit
5f5fb56c68e4 ("[compiler-rt] Intercept the uname() function")
broke sanitizer-x86_64-linux and clang-cmake-thumbv7-full-sh (again)
builds:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/26313
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-full-sh/builds/4324
The reason is that uname() can be called as early as
__pthread_initialize_minimal_internal(). When intercepted, this
triggers ASan initialization, which eventually calls dlerror(), which
in turn uses pthreads, causing all sorts of issues.
Fix by falling back to internal_uname() when interceptor runs before
ASan is initialized. This is only for Linux at the moment.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: dberris, #sanitizers, pcc
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D76919
Richard Smith [Sat, 28 Mar 2020 01:50:02 +0000 (18:50 -0700)]
Improve error recovery from missing '>' in template argument list.
Produce the conventional "to match this '<'" note, so that the user
knows why we expected a '>', and properly handle '>>' in C++11 onwards.
Uday Bondhugula [Tue, 24 Mar 2020 08:43:46 +0000 (14:13 +0530)]
[MLIR][NFC] Move TestDialect -> Dialect/Test
Move test/lib/TestDialect to test/lib/Dialect/Test - makes the dir
structure more uniform.
Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76677
Uday Bondhugula [Mon, 23 Mar 2020 15:00:12 +0000 (20:30 +0530)]
[MLIR] Introduce full/partial tile separation using if/else
This patch introduces a utility to separate full tiles from partial
tiles when tiling affine loop nests where trip counts are unknown or
where tile sizes don't divide trip counts. A conditional guard is
generated to separate out the full tile (with constant trip count loops)
into the then block of an 'affine.if' and the partial tile to the else
block. The separation allows the 'then' block (which has constant trip
count loops) to be optimized better subsequently: for eg. for
unroll-and-jam, register tiling, vectorization without leading to
cleanup code, or to offload to accelerators. Among techniques from the
literature, the if/else based separation leads to the most compact
cleanup code for multi-dimensional cases (because a single version is
used to model all partial tiles).
INPUT
affine.for %i0 = 0 to %M {
affine.for %i1 = 0 to %N {
"foo"() : () -> ()
}
}
OUTPUT AFTER TILING W/O SEPARATION
map0 = affine_map<(d0) -> (d0)>
map1 = affine_map<(d0)[s0] -> (d0 + 32, s0)>
affine.for %arg2 = 0 to %M step 32 {
affine.for %arg3 = 0 to %N step 32 {
affine.for %arg4 = #map0(%arg2) to min #map1(%arg2)[%M] {
affine.for %arg5 = #map0(%arg3) to min #map1(%arg3)[%N] {
"foo"() : () -> ()
}
}
}
}
OUTPUT AFTER TILING WITH SEPARATION
map0 = affine_map<(d0) -> (d0)>
map1 = affine_map<(d0) -> (d0 + 32)>
map2 = affine_map<(d0)[s0] -> (d0 + 32, s0)>
#set0 = affine_set<(d0, d1)[s0, s1] : (-d0 + s0 - 32 >= 0, -d1 + s1 - 32 >= 0)>
affine.for %arg2 = 0 to %M step 32 {
affine.for %arg3 = 0 to %N step 32 {
affine.if #set0(%arg2, %arg3)[%M, %N] {
// Full tile.
affine.for %arg4 = #map0(%arg2) to #map1(%arg2) {
affine.for %arg5 = #map0(%arg3) to #map1(%arg3) {
"foo"() : () -> ()
}
}
} else {
// Partial tile.
affine.for %arg4 = #map0(%arg2) to min #map2(%arg2)[%M] {
affine.for %arg5 = #map0(%arg3) to min #map2(%arg3)[%N] {
"foo"() : () -> ()
}
}
}
}
}
The separation is tested via a cmd line flag on the loop tiling pass.
The utility itself allows one to pass in any band of contiguously nested
loops, and can be used by other transforms/utilities. The current
implementation works for hyperrectangular loop nests.
Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76700
Kazuaki Ishizaki [Thu, 26 Mar 2020 18:51:37 +0000 (03:51 +0900)]
[mlir] NFC: fix trivial typo in source files
Summary: fix trivial typos in the source files
Reviewers: mravishankar, antiagainst, nicolasvasilache, herhut, rriddle, aartbik
Reviewed By: antiagainst, rriddle
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, bader, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76876
Jessica Paquette [Thu, 26 Mar 2020 22:00:34 +0000 (15:00 -0700)]
[GlobalISel] Fix equality for copies from physregs in matchEqualDefs
When we see this:
```
%a = COPY $physreg
...
SOMETHING implicit-def $physreg
...
%b = COPY $physreg
```
The two copies are not equivalent, and so we shouldn't perform any folding
on them.
When we have two instructions which use a physical register check that they
define the same virtual register(s) as well.
e.g., if we run into this case
```
%a = COPY $physreg
...
%b = COPY %a
```
we can say that the two copies are the same, and can be folded.
Differential Revision: https://reviews.llvm.org/D76890
Jonas Devlieghere [Sat, 28 Mar 2020 00:48:58 +0000 (17:48 -0700)]
[lldb/CMake] Only CMAKE_CFG_INTDIR if it's not '.'
Thanks to Brooks Davis for spotting this and finding a solution.
Jonas Devlieghere [Sat, 28 Mar 2020 00:47:17 +0000 (17:47 -0700)]
[FileCollector] Devirtualize FileCollector (NFC)
This is not (yet) necessary.
Jonas Devlieghere [Fri, 27 Mar 2020 22:41:08 +0000 (15:41 -0700)]
[FileCollector] Add a method to add a whole directory and it contents.
Extend the FileCollector's API with addDirectory which adds a directory
and its contents to the VFS mapping.
Differential revision: https://reviews.llvm.org/D76671
Kamlesh Kumar [Sat, 28 Mar 2020 00:27:00 +0000 (17:27 -0700)]
[RISCV] Support llvm.thread.pointer
Fixes https://bugs.llvm.org/show_bug.cgi?id=45303 (clang crashed on __builtin_thread_pointer)
Reviewed By: lenary, MaskRay, luismarques
Differential Revision: https://reviews.llvm.org/D76828
Richard Smith [Sat, 28 Mar 2020 00:08:26 +0000 (17:08 -0700)]
Improve recovery from invalid template-ids.
Instead of bailing out of parsing when we encounter an invalid
template-name or template arguments in a template-id, produce an
annotation token describing the invalid construct.
This avoids duplicate errors and generally allows us to recover better.
In principle we should be able to extend this to store some kinds of
invalid template-id in the AST for tooling use, but that isn't handled
as part of this change.
Sean Silva [Thu, 26 Mar 2020 22:11:23 +0000 (15:11 -0700)]
`shape` dialect: add some ops
- add `to_extent_tensor`
- rename `create_shape` to `from_extent_tensor` for symmetry
- add `split_at` and `concat` ops for basic shape manipulations
This set of ops is inspired by the requirements of lowering a dynamic-shape-aware batch matmul op. For such an op, the "matrix" dimensions aren't subject to broadcasting but the others are, and so we need to slice, broadcast, and reconstruct the final output shape. Furthermore, the actual broadcasting op used downstream uses a tensor of extents as its preferred shape interface for the actual op that does the broadcasting.
However, this functionality is quite general. It's obvious that `to_extent_tensor` is needed long-term to support many common patterns that involve computations on shapes. We can evolve the shape manipulation ops introduced here. The specific choices made here took into consideration the potentially unranked nature of the !shape.shape type, which means that a simple listing of dimensions to extract isn't possible in general.
Differential Revision: https://reviews.llvm.org/D76817
David Blaikie [Fri, 27 Mar 2020 23:28:35 +0000 (16:28 -0700)]
FunctionRef: Strip cv qualifiers in the converting constructor
Without this some instances of copy construction would use the
converting constructor & lead to the destination function_ref referring
to the source function_ref instead of the underlying functor.
Discovered in feedback from
857bf5da35af8e1f9425e1865dab5f5fce5e38f2
Thanks to Johannes Doerfert, Arthur O'Dwyer, and Richard Smith for the
discussion and debugging.
Sam McCall [Fri, 27 Mar 2020 17:51:25 +0000 (18:51 +0100)]
[AST] Add a Dependence bitmask to use for calculations with multiple node types.
Summary:
This makes it easier/safer to add bits (error) to other node types without
worrying about bit layout all the time.
For now, just use to implement the ad-hoc conversion functions.
Next: remove these functions and use this directly.
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D76939
Sam McCall [Fri, 27 Mar 2020 23:08:59 +0000 (00:08 +0100)]
[Syntax] Prevent (accidentally) copying TokenBuffer
Nemanja Ivanovic [Fri, 27 Mar 2020 22:29:05 +0000 (17:29 -0500)]
[DAGCombine] Fix splitting indexed loads in ForwardStoreValueToDirectLoad()
In DAGCombiner::visitLOAD() we perform some checks before breaking up an indexed
load. However, we don't do the same checking in ForwardStoreValueToDirectLoad()
which can lead to failures later during combining
(see: https://bugs.llvm.org/show_bug.cgi?id=45301).
This patch just adds the same checks to this function as well.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=45301
Differential revision: https://reviews.llvm.org/D76778
Lei Zhang [Fri, 27 Mar 2020 22:52:15 +0000 (18:52 -0400)]
[mlir][spirv] Add return to function to please MSVC
This suppresses the "not all control paths return a value" warning.
Francesco Petrogalli [Fri, 27 Mar 2020 21:41:03 +0000 (21:41 +0000)]
[llvm][Type] Return fixed size for scalar types. [NFC]
Summary:
It is safe to assume that the TypeSize associated to scalar types has
a fixed size.
This avoids an implicit cast of TypeSize to integer inside
`Type::getScalarSizeInBits()`, as such implicit cast is deprecated.
Reviewers: efriedma, sdesmalen
Reviewed By: efriedma
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76892
Florian Hahn [Fri, 27 Mar 2020 22:06:28 +0000 (22:06 +0000)]
[Darwin] Respect -fno-unroll-loops during LTO.
Currently -fno-unroll-loops is ignored when doing LTO on Darwin. This
patch adds a new -lto-no-unroll-loops option to the LTO code generator
and forwards it to the linker if -fno-unroll-loops is passed.
Reviewers: thegameg, steven_wu
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D76916
Jonas Devlieghere [Fri, 27 Mar 2020 22:02:24 +0000 (15:02 -0700)]
[VirtualFileSystem] Support directory entries in the YAMLVFSWriter
The current implementation of the JSONWriter does not support writing
out directory entries. Earlier today I added a unit test to illustrate
the problem. When an entry is added to the YAMLVFSWriter and the path is
a directory, it will incorrectly emit the directory as a file, and any
files inside that directory will not be found by the VFS.
It's possible to partially work around the issue by only adding "leaf
nodes" (files) to the YAMLVFSWriter. However, this doesn't work for
representing empty directories. This is a problem for clients of the VFS
that want to iterate over a directory. The directory not being there is
not the same as the directory being empty.
This is not just a hypothetical problem. The FileCollector for example
does not differentiate between file and directory paths. I temporarily
worked around the issue for LLDB by ignoring directories, but I suspect
this will prove problematic sooner rather than later.
This patch fixes the issue by extending the JSONWriter to support
writing out directory entries. We store whether an entry should be
emitted as a file or directory.
Differential revision: https://reviews.llvm.org/D76670
Alexey Bataev [Fri, 27 Mar 2020 15:15:17 +0000 (11:15 -0400)]
[OPENMP50]Fix PR45117: Orphaned task reduction should be allowed.
Add support for orpahned task reductions.
shafik [Fri, 27 Mar 2020 21:12:38 +0000 (14:12 -0700)]
[LLDB] CPlusPlusNameParser does not handles templated operator< properly
CPlusPlusNameParser is used in several places on of them is during IR execution and setting breakpoints to pull information C++ like the basename, the context and arguments.
Currently it does not handle templated operator< properly, because of idiosyncrasy is how clang generates debug info for these cases.
It uses clang::Lexer which will tokenize operator<<A::B> into:
tok::kw_operator
tok::lessless
tok::raw_identifier
Later on the parser in ConsumeOperator() does not handle this case properly and we end up failing to parse.
Differential Revision: https://reviews.llvm.org/D76168
Thomas Preud'homme [Wed, 4 Mar 2020 16:24:49 +0000 (16:24 +0000)]
[lld test] Tighten ELF/pre_init_fini_array.s test
Summary:
Make use of FileCheck numeric variable to tighten symbol address checks
in ELF/pre_init_fini_array.s test.
Reviewers: khemant, compnerd, echristo, jhenderson, espindola, MaskRay
Reviewed By: MaskRay
Subscribers: emaste, MaskRay, llvm-commits, rupprecht
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76852
Sam McCall [Fri, 27 Mar 2020 18:42:49 +0000 (19:42 +0100)]
Add BitWidth trait to BitmaskEnum, and use for clang DependenceFlags. NFC
Reviewers: hokein
Subscribers: dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D76942
Sanjay Patel [Fri, 27 Mar 2020 20:55:31 +0000 (16:55 -0400)]
[InstCombine] reduce FP-casted and bitcasted signbit check
PR45305:
https://bugs.llvm.org/show_bug.cgi?id=45305
Alive2 proofs:
http://volta.cs.utah.edu:8080/z/bVyrko
http://volta.cs.utah.edu:8080/z/Vxpz9q
Sanjay Patel [Fri, 27 Mar 2020 19:22:14 +0000 (15:22 -0400)]
[InstCombine] add tests for FP cast+bitcast signbit checks; NFC
PR45305:
https://bugs.llvm.org/show_bug.cgi?id=45305
Adrian Prantl [Fri, 27 Mar 2020 21:22:02 +0000 (14:22 -0700)]
Unbreak LLDB tests after
96023917e6f
by teaching LLDB to apply DW_AT_comp_dir to the DW_AT_LLVM_include path.
Adrian Prantl [Wed, 18 Mar 2020 22:30:20 +0000 (15:30 -0700)]
Allow remapping Clang module include paths
in the debug info with -fdebug-prefix-map.
rdar://problem/
55685132
This reapplies an earlier attempt to commit this without
modifications.
Differential Revision: https://reviews.llvm.org/D76385
Michael Liao [Fri, 27 Mar 2020 19:47:12 +0000 (15:47 -0400)]
[cuda][hip] Add CUDA builtin surface/texture reference support.
Summary: - Re-commit after fix Sema checks on partial template specialization.
Reviewers: tra, rjmccall, yaxunl, a.sidorin
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D76365
Francesco Petrogalli [Fri, 27 Mar 2020 20:41:06 +0000 (20:41 +0000)]
[llvm][Support] Add isZero method for TypeSize. [NFC]
Summary:
The method is used where TypeSize is implicitly cast to integer for
being checked against 0.
Reviewers: sdesmalen, efriedma
Reviewed By: sdesmalen, efriedma
Subscribers: efriedma, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76748
Matt Arsenault [Wed, 4 Dec 2019 09:04:14 +0000 (14:34 +0530)]
CodeGen: Add -denormal-fp-math-f32 flag
Make the set of FP related attributes and command flags closer.
Jay Foad [Thu, 26 Mar 2020 15:15:55 +0000 (15:15 +0000)]
[AMDGPU] Fix getEUsPerCU for gfx10 in CU mode
Summary:
"Per CU" is a bit simplistic for gfx10, but I couldn't think of a better
name.
Reviewers: arsenm, rampitec, nhaehnle, dstuttard, tpr
Subscribers: kzhuravl, jvesely, wdng, yaxunl, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76861
Fangrui Song [Fri, 27 Mar 2020 19:41:35 +0000 (12:41 -0700)]
[MC][X86] Make .reloc support arbitrary relocation types
Generalizes D62014 (R_386_NONE/R_X86_64_NONE).
Unlike ARM (D76746) and AArch64 (D76754), we cannot delete FK_NONE from
getFixupKindSize because FK_NONE is still used by R_386_TLS_DESC_CALL/R_X86_64_TLSDESC_CALL.
Henry Kao [Fri, 27 Mar 2020 20:29:05 +0000 (16:29 -0400)]
[OpenMP] Add memory barrier to solve data race
Data race occurs when acquiring lock for critical section
triggering assertion failure. Added barrier to ensure
all memory is commited before checking assertion.
Reviewed By: Hahnfeld
Differential Revision: https://reviews.llvm.org/D76780
Matt Arsenault [Fri, 27 Mar 2020 20:25:36 +0000 (16:25 -0400)]
Fix line endings in test
diggerlin [Fri, 27 Mar 2020 20:21:53 +0000 (16:21 -0400)]
[AIX] Address comment https://reviews.llvm.org/D76162#inline-701237
SUMMARY:
Address clang format issue:
"clang format this block, I don't think the spaces are aligned correctly."
Subscribers: wuzish, nemanjai, hiraditya
Differential Revision: https://reviews.llvm.org/D76162
Matt Arsenault [Thu, 5 Dec 2019 09:45:32 +0000 (15:15 +0530)]
AMDGPU: Stop setting attributes based on TargetOptions
Having arbitrary passes looking at the TargetOptions is pretty
messy. This was also disregarding if a function already had an
explicit attribute setting on it. opt/llc now add the attributes to
functions that don't specify the attribute. clang and lld do not call
the function to do this, which they maybe should.
This was also treating unsafe-fp-math as implying the others, and
setting the other attributes based on it. This is not done anywhere
else, and I'm not sure is correct based on the current description of
the option bit.
Effectively reverts
1d8cf2be89087a2babc1dc38b16040fad0a555e2
Davide Italiano [Fri, 27 Mar 2020 20:12:00 +0000 (13:12 -0700)]
Revert "[Dexter] Add support for Windows to regression test suite."
This reverts commit
89025da9f676aebff7daf055824d6fd102a70c34 as
it breaks the lldb macOS bot.
Matt Arsenault [Wed, 11 Mar 2020 21:12:20 +0000 (17:12 -0400)]
Fix denormal-fp-math flag and attribute interaction
Make these behave the same way unsafe-fp-math and co. The command line
flag should add the attribute to functions that do not already have
it, and leave existing attributes. The attribute is the actual
implementation, but the flag is useful in some testing situations.
AMDGPU has a variety of tests with denormals enabled/disabled that
would require a painful level of test duplication without a flag. This
doesn't expose setting the separate input/output modes, or add a flag
for the f32 version yet.
Tests will be included in future patch.
Reid Kleckner [Fri, 27 Mar 2020 16:09:06 +0000 (09:09 -0700)]
[COFF] Don't treat DWARF sections as GC roots
DWARF sections are typically live and not COMDAT, so they would be
treated as GC roots. Enabling DWARF would essentially keep all code with
debug info alive, preventing any section GC.
Fixes PR45273
Reviewed By: mstorsjo, MaskRay
Differential Revision: https://reviews.llvm.org/D76935
Jonas Devlieghere [Fri, 27 Mar 2020 19:31:49 +0000 (12:31 -0700)]
[lldb/PlatformMacOSX] Re-implement GetDeveloperDirectory
GetDeveloperDirectory returns a const char* which is NULL when we cannot
find the developer directory. This crashes in
PlatformDarwinKernel::CollectKextAndKernelDirectories because we're
unconditionally assigning it to a std::string. Coincidentally I just
refactored a bunch of code in PlatformMacOSX so instead of a ad-hoc fix
I've reimplemented the method based on GetXcodeContentsDirectory.
The change is mostly NFC. Obviously it fixes the crash, but it also
removes support for finding the Xcode directory through he legacy
$XCODE_SELECT_PREFIX_DIR/usr/share/xcode-select/xcode_dir_path.
Differential revision: https://reviews.llvm.org/D76938
Fangrui Song [Wed, 25 Mar 2020 03:06:31 +0000 (20:06 -0700)]
[MC][AArch64] Make .reloc support arbitrary relocation types
Depends on D76746. Generalizes D61973.
Differential Revision: https://reviews.llvm.org/D76754
Fangrui Song [Wed, 25 Mar 2020 01:31:39 +0000 (18:31 -0700)]
[MC][ARM] Make .reloc support arbitrary relocation types
Generalizes D61992. In GNU as, the .reloc directive supports arbitrary relocation types.
A MCFixupKind value `V` larger than or equal to FirstLiteralRelocationKind
is used to represent the relocation type whose number is V-FirstLiteralRelocationKind.
This is useful for linker tests. Without the feature the assembler
cannot produce certain relocation records (e.g. R_ARM_ALU_PC_G0/R_ARM_LDR_PC_G0)
This helps move forward D75349 and D76575.
Differential Revision: https://reviews.llvm.org/D76746
Paul Robinson [Fri, 27 Mar 2020 18:51:37 +0000 (11:51 -0700)]
Fix a Diag call not to assume option spelling
Julian Lettner [Fri, 27 Mar 2020 17:46:32 +0000 (10:46 -0700)]
[lit] Avoid global imports in module declaration
A previous attempt to cleanup module imports broke installing via
pip/setup.py [1]. This should be fixed now.
[1]
cf252240e8819d0c90a5e10f773078bdeba33e44
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D76940
Fangrui Song [Fri, 27 Mar 2020 18:35:02 +0000 (11:35 -0700)]
[ELF][test] Split basic.s
Sam McCall [Fri, 27 Mar 2020 17:53:23 +0000 (18:53 +0100)]
[AST] Fix typo on NoInitExpr dependence computation
shafik [Fri, 27 Mar 2020 18:00:24 +0000 (11:00 -0700)]
[LLDB] Fix handling of bit-fields when there is a base class when parsing DWARF
When parsing DWARF and laying out bit-fields we currently don't take into account whether we have a base class or not.
Currently if the first field is a bit-field but the bit offset is due a field we inherit from a base class we currently
treat it as an unnamed bit-field and therefore add an extra field.
This fix will not check if we have a base class and assume that this offset is due to members we are inheriting from the base.
We are currently seeing asserts during codegen when debugging clang::DiagnosticOptions.
This assumption will fail in the case where the first field in the derived class in an unnamed bit-field. Fixing the first field
being an unnamed bit-field looks like it will require a larger change since we will need a way to track or discover the last field offset of the bases(s).
Differential Revision: https://reviews.llvm.org/D76808
Dan Liew [Fri, 27 Mar 2020 01:17:53 +0000 (18:17 -0700)]
Only add `darwin_log_cmd` lit shell test feature when the log can be queried.
Summary:
Follow up fix to
445b810fbd4. The `log show` command only works for
privileged users so run a quick test of the command during lit config to
see if the command works and only add the `darwin_log_cmd` feature if
this is the case.
Unfortunately this means the `asan/TestCases/Darwin/duplicate_os_log_reports.cpp`
test and any other tests in the future that use this feature won't run
for unprivileged users which is likely the case in CI.
rdar://problem/
55986279
Reviewers: kubamracek, yln, dcoughlin
Subscribers: Charusso, #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D76899
Tom Weaver [Fri, 27 Mar 2020 18:15:17 +0000 (18:15 +0000)]
[Dexter] Add support for Windows to regression test suite.
This patch addresses the issue of the regression suite not running on windows hardware. It changes the following things:
add new dexter regression suite command to lit.cfg.py that makes use of the clang-cl_vs2015 and dbgend builder and debuggers.
sprinkle the new regression suite command through the feature and tool tests that require them.
mark certain problem tests on windows
There's a couple of tests that fail (or pass) in unexpected ways on Windows.
Problem tests are both the penalty and perfect expect_watch_type.cpp tests. Type information reporting parity is not possible a this time in dexter due to the nature of how different debuggers report type information back to their users.
reviewers: Orlando
Differential Revision: https://reviews.llvm.org/D76609
Lang Hames [Wed, 25 Mar 2020 20:07:00 +0000 (13:07 -0700)]
[ORC] Introduce JITSymbolFlags::HasMaterializeSideEffectsOnly flag.
This flag can be used to mark a symbol as existing only for the purpose of
enabling materialization. Such a symbol can be looked up to trigger
materialization with the lookup returning only once materialization is
complete. Symbols with this flag will never resolve however (to avoid
permanently polluting the symbol table), and should only be looked up using
the SymbolLookupFlags::WeaklyReferencedSymbol flag. The primary use case for
this flag is initialization symbols.
Lang Hames [Thu, 26 Mar 2020 20:06:13 +0000 (13:06 -0700)]
[ORC] Don't create MaterializingInfo entries unnecessarily.
Alexey Bataev [Fri, 27 Mar 2020 15:27:04 +0000 (11:27 -0400)]
[OPENMP50]Add basic support for inscan reduction modifier.
Added basic support (parsing/sema checks) for the inscan modifier in the
reduction clauses.