Haojian Wu [Tue, 19 May 2020 13:26:42 +0000 (15:26 +0200)]
[AST] Fix an assertion violation in FieldDecl::getParent.
Summary:
FieldDecl::getParent assumes that the FiledDecl::getDeclContext returns a
RecordDecl, this is true for C/C++, but not for ObjCIvarDecl:
The Decls hierarchy is like following
FieldDecl <-- ObjCIvarDecl
DeclContext <-- ObjCContainerDecl <-- ObjCInterfaceDecl
^
|----- TagDecl <-- RecordDecl
calling getParent() on ObjCIvarDecl will:
1. invoke getDeclContext(), which returns a DeclContext*, which points to an ObjCInterfaceDecl;
2. then downcast the "DeclContext" pointer to a RecordDecl*, and we will hit
the "is_a<RecordDecl>" assertion in llvm::cast (undefined behavior
in release build without assertion enabled);
Fixes https://github.com/clangd/clangd/issues/369
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: rsmith, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79627
Haojian Wu [Tue, 19 May 2020 13:21:50 +0000 (15:21 +0200)]
[clangd] Add a flag to preserve type for recovery expression.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79938
Haojian Wu [Tue, 19 May 2020 13:10:10 +0000 (15:10 +0200)]
[AST] Fix the PrintQualifiedName for ObjC instance variable in class extension.
Summary:
Similar to property, we print the containing interface decl as the
nested name specifier for ivar; otherwise we will get "::ivar_name".
this would fix an assertion crash in clangd: https://github.com/clangd/clangd/issues/365
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79576
George [Tue, 19 May 2020 13:07:49 +0000 (09:07 -0400)]
Added a TanOp to SPIR-V dialect GLSL ops
Implemented tangent op from SPIR-V's GLSL extended instruction set.
Added a round-trip and serialization/deserialization tests for the op.
Differential Revision: https://reviews.llvm.org/D80152
Haojian Wu [Tue, 19 May 2020 10:02:52 +0000 (12:02 +0200)]
[AST][RecoveryExpr] Fix an assertion crash on openMP.
Summary:
With recovery expr, it is possible that we have a value-dependent expr
within non-dependent context.
Reviewers: sammccall, jdoerfert
Subscribers: yaxunl, guansong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80200
Sam Parker [Tue, 19 May 2020 12:56:51 +0000 (13:56 +0100)]
[NFC][ARM] Add more tail predication tests
Alexey Bataev [Mon, 18 May 2020 17:37:53 +0000 (13:37 -0400)]
[OPENMP50]Add initial support for 'affinity' clause.
Summary:
Added parsing/sema/serialization support for affinity clause in task
directives.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, arphaman, llvm-commits, cfe-commits, caomhin
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D80148
Jay Foad [Tue, 19 May 2020 11:30:26 +0000 (12:30 +0100)]
[IR] Revert r119493
r119493 protected against PHINode::hasConstantValue returning the PHI
node itself, but a later fix in r159687 means that can never happen, so
the workarounds are no longer required.
Simon Pilgrim [Tue, 19 May 2020 12:16:24 +0000 (13:16 +0100)]
Fix "not all control paths return a value" warning on MSVC builds.
Use llvm_unreachable as typeName(Metric::MetricType T) should handle all enum values.
Simon Pilgrim [Tue, 19 May 2020 11:33:28 +0000 (12:33 +0100)]
ObjectCache.h - replace unnecessary MemoryBuffer.h include with forward declarations. NFC.
Simon Pilgrim [Tue, 19 May 2020 11:08:29 +0000 (12:08 +0100)]
GlobalVariable.h - remove unused PointerUnion.h include. NFC
Kirstóf Umann [Tue, 5 May 2020 12:55:37 +0000 (14:55 +0200)]
[analyzer][MallocChecker] When modeling realloc-like functions, don't early return if the argument is symbolic
The very essence of MallocChecker lies in 2 overload sets: the FreeMemAux
functions and the MallocMemAux functions. The former houses most of the error
checking as well (aside from leaks), such as incorrect deallocation. There, we
check whether the argument's MemSpaceRegion is the heap or unknown, and if it
isn't, we know we encountered a bug (aside from a corner case patched by
@balazske in D76830), as specified by MEM34-C.
In ReallocMemAux, which really is the combination of FreeMemAux and
MallocMemAux, we incorrectly early returned if the memory argument of realloc is
non-symbolic. The problem is, one of the cases where this happens when we know
precisely what the region is, like an array, as demonstrated in the test file.
So, lets get rid of this false negative :^)
Side note, I dislike the warning message and the associated checker name, but
I'll address it in a later patch.
Differential Revision: https://reviews.llvm.org/D79415
Christian Sigg [Mon, 18 May 2020 12:13:14 +0000 (14:13 +0200)]
Unrank mcuMemHostRegister tensor argument.
Reviewers: herhut
Reviewed By: herhut
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80118
Sam McCall [Tue, 19 May 2020 11:58:12 +0000 (13:58 +0200)]
[clangd] Squash GCC error with StringRef + gtest MatchesRegex()
Frederik Gossen [Mon, 18 May 2020 08:56:22 +0000 (08:56 +0000)]
[MLIR] Add helper functions for common integer types
Add helper functions for 32-bit and 64-bit integer types.
Differential Revision: https://reviews.llvm.org/D80111
Sam McCall [Sat, 9 May 2020 20:43:35 +0000 (22:43 +0200)]
[clangd] Add CSV export for trace metrics
Summary: Example: https://docs.google.com/spreadsheets/d/1VZKGetSUTTDe9p4ooIETmdcwUod1_aE3vgD0E9x7HhI/edit
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79678
Sam McCall [Tue, 5 May 2020 23:39:59 +0000 (01:39 +0200)]
[clangd] Complete filenames after < / ".
Summary:
Extract prefix filters to CodeComplete so it can be easily tested.
Fixes https://github.com/clangd/clangd/issues/366
Reviewers: adamcz
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79456
Kiran Kumar T P [Tue, 19 May 2020 11:30:15 +0000 (17:00 +0530)]
[MLIR, OpenMP] Support for flush operation, and translating the same to LLVM IR
Summary:
This patch adds support for flush operation in OpenMP dialect and translation of this construct to LLVM IR.
The OpenMP IRBuilder is used for this translation.
The patch includes code changes and testcase modifications.
Reviewed By: ftynse, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D79937
Carl Ritson [Tue, 19 May 2020 10:27:16 +0000 (19:27 +0900)]
[AMDGPU] Add more VMEM to SALU WAR hazard tests. NFC
Simon Pilgrim [Tue, 19 May 2020 09:49:08 +0000 (10:49 +0100)]
GlobPattern.h - remove unnecessary StringRef.h include. NFC
Use forward declaration instead.
Remove unnecessary BitVector forward declaration while we're here - we need to include BitVector.h.
Balázs Kéri [Tue, 19 May 2020 10:12:28 +0000 (12:12 +0200)]
[Analyzer][VLASizeChecker] Try to fix vla.c test problems.
Georgii Rymar [Mon, 18 May 2020 13:43:13 +0000 (16:43 +0300)]
[yaml2obj] - Stop using square brackets for unique suffixes.
For describing section/symbol names we can use unique suffixes,
e.g:
```
- Name: '.foo [1]`
- Name: '.foo [2]`
```
It can be a problem (see https://reviews.llvm.org/D79984#inline-734829),
because `[]` are sometimes used to describe a macros:
```
- Name: "[[a0]]"
```
Seems the better approach is to use something else, like "()".
This patch does it and refactors the code related.
Differential revision: https://reviews.llvm.org/D80123
Mikael Holmen [Tue, 19 May 2020 09:57:15 +0000 (11:57 +0200)]
[clangd] Fix gcc compiler warning by removing extra ";" [NFC]
gcc complained with:
/data/repo/master/clang-tools-extra/clangd/index/Ref.h:189:2: warning: extra ';' [-Wpedantic]
}; // namespace llvm
^
Sam McCall [Mon, 18 May 2020 21:01:46 +0000 (23:01 +0200)]
[Tooling] Drop leading/trailing whitespace from compile_flags.txt lines
Summary:
These files tend to be hand-authored, and people get very confused.
I can't think of any reason that such whitespace would be intended.
Reviewers: kadircet
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80160
Sam McCall [Mon, 18 May 2020 15:22:59 +0000 (17:22 +0200)]
[AST] Fix recovery-AST crash: dependent overloaded call exprs are now possible.
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80154
Simon Pilgrim [Mon, 18 May 2020 16:49:59 +0000 (17:49 +0100)]
TargetIntrinsicInfo.h - remove unnecessary Compiler.h include. NFC.
We don't need use compiler specific attributes so don't need Compiler.h
Simon Pilgrim [Mon, 18 May 2020 15:56:53 +0000 (16:56 +0100)]
TargetLoweringObjectFile.h - remove unnecessary includes. NFCI.
Replace with forward declarations and move includes down to source files where required.
I also needed to move the TargetLoweringObjectFile::SectionForGlobal wrapper implementation down into TargetLoweringObjectFile.cpp
Heejin Ahn [Fri, 8 May 2020 23:19:46 +0000 (16:19 -0700)]
[WebAssembly] Handle exception specifications
Summary:
Wasm currently does not fully handle exception specifications. Rather
than crashing,
- This treats `throw()` in the same way as `noexcept`.
- This ignores and prints a warning for `throw(type, ..)`, for a
temporary measure. This warning is controlled by
`-Wwasm-exception-spec`, which is on by default. You can suppress the
warning by using `-Wno-wasm-exception-spec`.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80061
Balázs Kéri [Tue, 19 May 2020 06:21:47 +0000 (08:21 +0200)]
[Analyzer][VLASizeChecker] Check for VLA size overflow.
Summary:
Variable-length array (VLA) should have a size that fits into
a size_t value. According to the standard: "std::size_t can
store the maximum size of a theoretically possible object of
any type (including array)" (this is applied to C too).
The size expression is evaluated at the definition of the
VLA type even if this is a typedef.
The evaluation of the size expression in itself might cause
problems if it overflows.
Reviewers: Szelethus, baloghadamsoftware, martong, gamesh411
Reviewed By: Szelethus, martong, gamesh411
Subscribers: whisperity, rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79330
Jonas Paulsson [Wed, 13 May 2020 12:19:08 +0000 (14:19 +0200)]
[SystemZ] Eliminate the need to create a zero vector by reusing the VPERM mask.
Try to avoid creating VGBMs by reusing the permutation mask if it contains a
zero. If the first byte was into (any byte of) a zero vector, then the first
byte of the mask can become zero and reused by putting the mask also as the
first operand. If there instead was a first-byte use of the other source
operand, then that zero index can be reused if the mask is placed as the
second operand.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D79925
Martin Böhme [Tue, 19 May 2020 06:43:46 +0000 (08:43 +0200)]
[clang] Add an API to retrieve implicit constructor arguments.
Summary:
This is needed in Swift for C++ interop -- see here for the corresponding Swift change:
https://github.com/apple/swift/pull/30630
As part of this change, I've had to make some changes to the interface of CGCXXABI to return the additional parameters separately rather than adding them directly to a `CallArgList`.
Reviewers: rjmccall
Reviewed By: rjmccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79942
Igor Kudrin [Tue, 19 May 2020 06:36:07 +0000 (13:36 +0700)]
[DebugInfo] Add a test for dumping DWARF64 CIEs and FDEs (8/8).
This adds a test to check that Length and CIE_id/CIE_pointer fields in
.debug_frame section are printed as 16-digit hex values if the records
are in the DWARF64 format.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:35:58 +0000 (13:35 +0700)]
[DebugInfo] Dump offsets in .debug_str_offsets according to the DWARF format (7/8).
The patch changes dumping of offsets in .debug_str_offsets sections so
that they are printed as 16-digit hex values if the contribution is in
the DWARF64 format.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:35:48 +0000 (13:35 +0700)]
[DebugInfo] Dump values in .debug_pubnames and .debug_pubtypes according to the DWARF format (6/8).
The patch changes dumping of unit_length, debug_info_offset, and
debug_info_length fields in headers in .debug_pubname and
.debug_pubtypes sections so that they are printed as 16-digit hex values
if the contribution is in the DWARF64 format. Dumping of offsets in the
tables is changed in the same way.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:35:41 +0000 (13:35 +0700)]
[DebugInfo] Dump values in .debug_loclists and .debug_rnglists according to the DWARF format (5/8).
The patch changes dumping of a unit_length field and offsets in headers
in .debug_loclists and .debug_rnglists sections so that they are printed
as 16-digit hex values if the contribution is in the DWARF64 format.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:35:31 +0000 (13:35 +0700)]
[DebugInfo] Dump length in .debug_line according to the DWARF format (4/8).
The patch changes dumping of unit_length and header_length fields in
headers in .debug_line sections so that they are printed as 16-digit hex
values if the contribution is in the DWARF64 format.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:35:20 +0000 (13:35 +0700)]
[DebugInfo] Dump length of CUs and TUs according to the DWARF format (3/8).
The patch changes dumping of the unit_length field in a unit header so
that it is printed as a 16-digit hex value if the unit is in the DWARF64
format.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:35:07 +0000 (13:35 +0700)]
[DebugInfo] Dump form values according to the DWARF format (2/8).
The patch changes dumping of DWARF form values which sizes depend on
the DWARF format so that they are printed as 16-digit hex values for
DWARF64.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:34:54 +0000 (13:34 +0700)]
[DebugInfo] Dump fields in .debug_aranges according to the DWARF format (1/8).
The patch changes dumping of unit_length and debug_info_offset fields in
an address range header so that they are printed as 16-digit hex values
if the contribution is in the DWARF64 format.
Differential Revision: https://reviews.llvm.org/D79997
Igor Kudrin [Tue, 19 May 2020 06:20:50 +0000 (13:20 +0700)]
[DebugInfo] Remove an outdated test.
64-bit DWARF is supported for most of the sections now, and there are
separate tests for each of them. This test uses a binary input, while
the preferable way is to have a text-based source. Thus, it looks like
this test may be safely removed.
Differential Revision: https://reviews.llvm.org/D80122
Sylvestre Ledru [Tue, 19 May 2020 06:30:25 +0000 (08:30 +0200)]
Add support of the next Ubuntu (Ubuntu 20.10 - Groovy Gorilla)
LLVM GN Syncbot [Tue, 19 May 2020 06:07:14 +0000 (06:07 +0000)]
[gn build] Port
bcc0c894f38
Xiang1 Zhang [Tue, 19 May 2020 05:29:30 +0000 (13:29 +0800)]
Add cet.h for writing CET-enabled assembly code
Summary:
Add x86 feature with IBT and/or SHSTK bits to ELF program property if they are enabled. Otherwise, contents in this header file are unused.
This file is mainly design for assembly source code which want to enable CET
Reviewers: hjl.tools, annita.zhang, LuoYuanke, craig.topper, tstellar, pengfei, rsmith
Reviewed By: LuoYuanke
Subscribers: cfe-commits, mgorny
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79617
Jonas Devlieghere [Tue, 19 May 2020 05:59:31 +0000 (22:59 -0700)]
[lldb/Test] Skip TestPositionalArgs with lldb-repro
Qiu Chaofan [Tue, 19 May 2020 05:37:25 +0000 (13:37 +0800)]
[NFC] [PowerPC] Refresh fma-mutate.ll using script
This is a clean-up after D78989. The old comments are out of date.
Yonghong Song [Tue, 19 May 2020 05:20:33 +0000 (22:20 -0700)]
[BPF] fix an asan issue when disassemble an illegal instruction
Commit
8e8f1bd75a9a ("[BPF] Return fail if disassembled insn registers
out of range") tried to fix a segfault when an illegal instruction
is decoded. A test case is added to emulate such an illegal instruction.
The llvm buildbot reported an asan issue with this test case.
ERROR: AddressSanitizer: global-buffer-overflow on address ...
decodeMemoryOpValue(llvm::MCInst&, unsigned int, ...)
llvm::MCDisassembler::DecodeStatus llvm::decodeToMCInst<unsigned long>(...)
llvm::MCDisassembler::DecodeStatus llvm::decodeInstruction<unsigned long>(...)
in (anonymous namespace)::BPFDisassembler::getInstruction(...)
...
Basically, the fix in Commit
8e8f1bd75a9a is too later to prevent
the asan. The fix in this patch moved the register number check earlier
during decodeInstruction(). It will return fail for decodeInstruction()
if the register number is out of range.
Note that DecodeGPRRegisterClass() and DecodeGPR32RegisterClass()
already have register number checking, so here we only check
decodeMemoryOpValue().
LLVM GN Syncbot [Tue, 19 May 2020 05:18:58 +0000 (05:18 +0000)]
[gn build] Port
62a9eca859d
Xiang1 Zhang [Tue, 19 May 2020 05:15:26 +0000 (13:15 +0800)]
Test asm-cet.S fail for window clang
This reverts commit
e7e84ff24a5f0f4ed2d706de4168a4ec6073e3ef.
Sameer Sahasrabuddhe [Tue, 19 May 2020 03:52:08 +0000 (09:22 +0530)]
[LoopSimplify] don't separate nested loops with convergent calls
Summary:
When a loop has multiple backedges, loop simplification attempts to
separate them out into nested loops. This results in incorrect control
flow in the presence of some functions like a GPU barrier. This change
skips the transformation when such "convergent" function calls are
present in the loop body.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D80078
Chen Zheng [Tue, 19 May 2020 01:57:16 +0000 (21:57 -0400)]
[PowerPC-QPX] adjust operands order of qpx fma instructions.
convert
%3 = QVFMADD %2, %0, %1, implicit $rm
to
%3 = QVFMADD %2, %1, %0, implicit $rm
Reviewed By: hfinkel, steven.zhang
Differential Revision: https://reviews.llvm.org/D78986
LLVM GN Syncbot [Tue, 19 May 2020 02:41:51 +0000 (02:41 +0000)]
[gn build] Port
e7e84ff24a5
Xiang1 Zhang [Tue, 19 May 2020 02:37:46 +0000 (10:37 +0800)]
Add cet.h for writing CET-enabled assembly code
Summary:
Add x86 feature with IBT and/or SHSTK bits to ELF program property if they are enabled. Otherwise, contents in this header file are unused.
This file is mainly design for assembly source code which want to enable CET
Reviewers: hjl.tools, annita.zhang, LuoYuanke, craig.topper, tstellar, pengfei, rsmith
Reviewed By: LuoYuanke
Subscribers: mgorny
Differential Revision: https://reviews.llvm.org/D79617
Eli Friedman [Tue, 19 May 2020 02:16:06 +0000 (19:16 -0700)]
[NFC] Replace MaybeAlign with Align in TargetTransformInfo.
Yonghong Song [Sat, 16 May 2020 05:57:25 +0000 (22:57 -0700)]
[BPF] Return fail if disassembled insn registers out of range
Daniel reported a llvm-objdump segfault like below:
$ llvm-objdump -D bpf_xdp.o
...
0000000000000000 <.strtab>:
0: 00 63 69 6c 69 75 6d 5f <unknown>
1: 6c 62 36 5f 61 66 66 69 w2 <<= w6
...
(llvm-objdump: lib/Target/BPF/BPFGenAsmWriter.inc:1087: static const char*
llvm::BPFInstPrinter::getRegisterName(unsigned int): Assertion
`RegNo && RegNo < 25 && "Invalid register number!"' failed.
Stack dump:
0. Program arguments: llvm-objdump -D bpf_xdp.o
...
abort
...
llvm::BPFInstPrinter::getRegisterName(unsigned int)
llvm::BPFInstPrinter::printMemOperand(llvm::MCInst const*,
int, llvm::raw_ostream&, char const*)
llvm::BPFInstPrinter::printInstruction(llvm::MCInst const*,
unsigned long, llvm::raw_ostream&)
llvm::BPFInstPrinter::printInst(llvm::MCInst const*,
unsigned long, llvm::StringRef, llvm::MCSubtargetInfo const&,
llvm::raw_ostream&)
...
Basically, since -D enables disassembly for all sections, .strtab is also disassembled,
but some strings are decoded as legal instructions but with illegal register numbers.
When llvm-objdump tries to print register name for these illegal register numbers,
assertion and segfault happens.
The patch fixed the issue by returning fail for a disassembled insn if
that insn contains a reg operand with illegal reg number.
The insn will be printed as "<unknown>" instead of causing an assertion.
Jonas Devlieghere [Tue, 19 May 2020 01:10:53 +0000 (18:10 -0700)]
[lldb/Driver] Fix handling on positional arguments
Before the transition to libOption it was possible to specify arguments
for the inferior without -- as long as they didn't start with a dash.
For example, the following invocations should all behave the same:
$ lldb inferior inferior-arg
$ lldb inferior -- inferior-arg
$ lldb -- inferior inferior-arg
This patch fixes that behavior, documents it and adds a test to cover
the different combinations.
Differential revision: https://reviews.llvm.org/D80165
Chen Zheng [Tue, 19 May 2020 01:44:47 +0000 (21:44 -0400)]
fix build failure due to commit rGddcb3cf213e8
Chen Zheng [Tue, 19 May 2020 01:20:52 +0000 (21:20 -0400)]
[TargetInstrInfo] add override function setSpecialOperandAttr - NFC
Chen Zheng [Tue, 19 May 2020 01:16:21 +0000 (21:16 -0400)]
[PowerPC][MachineCombiner] add testcase for reassociating FMA - NFC
Yonghong Song [Mon, 18 May 2020 18:56:29 +0000 (11:56 -0700)]
[BPF] Prevent disassembly segfault for NOP insn
For a simple program like below:
-bash-4.4$ cat t.c
int test() {
asm volatile("r0 = r0" ::);
return 0;
}
compiled with
clang -target bpf -O2 -c t.c
the following llvm-objdump command will segfault.
llvm-objdump -d t.o
0: bf 00 00 00 00 00 00 00 nop
llvm-objdump: ../include/llvm/ADT/SmallVector.h:180
...
Assertion `idx < size()' failed
...
abort
...
llvm::BPFInstPrinter::printOperand
llvm::BPFInstPrinter::printInstruction
...
The reason is both NOP and MOV_rr (r0 = r0) having the same encoding.
The disassembly getInstruction() decodes to be a NOP instruciton but
during printInstruction() the same encoding is interpreted as
a MOV_rr instruction. Such a mismatcch caused the segfault.
The fix is to make NOP instruction as CodeGen only so disassembler
will skip NOP insn for disassembling.
Note that instruction "r0 = r0" should not appear in non inline
asm codes since BPF Machine Instruction Peephole optimization will
remove it.
Differential Revision: https://reviews.llvm.org/D80156
Reid Kleckner [Mon, 18 May 2020 19:07:31 +0000 (12:07 -0700)]
Re-land [Debug][CodeView] Emit fully qualified names for globals
This reverts commit
525a591f0f48b9d54018bf5245f2abee09c9c1c8.
Fixed an issue with pointers to members based on typedefs. In this case,
LLVM would emit a second UDT. I fixed it by not passing the class type
to getTypeIndex when the base type is not a function type. lowerType
only uses the class type for direct function types. This suggests if we
have a PMF with a function typedef, there may be an issue, but that can
be solved separately.
Vedant Kumar [Mon, 18 May 2020 23:37:04 +0000 (16:37 -0700)]
[lldb/test] Disable NSDate format check under _WIN32
Disable the test which attempts to format an NSDate with a date_value of
0 on _WIN32.
When _WIN32 is defined, GetOSXEpoch returns a date that should be in
2001, but after this is passed through timegm (which, afaict isn't
portable?) the result is a date in 1970:
```
lldb-x64-windows-ninja\llvm-project\lldb\unittests\DataFormatter\MockTests.cpp(39): error: Expected: *formatDateValue(0)
Which is: "1970-01-01 00:00:00 Pacific Standard Time"
To be equal to: "2001-01-01 00:00:00 UTC"
```
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/4520/steps/test/logs/stdio
Sam McCall [Mon, 18 May 2020 23:30:23 +0000 (01:30 +0200)]
[clangd] Tidy up SelectionTree dumps with newlines
Amara Emerson [Mon, 18 May 2020 23:23:53 +0000 (16:23 -0700)]
[AArch64][GlobalISel] Add legalizer & selector support for G_FREEZE.
These should legalize like undefs and select into copies.
The ll test is copied from the x86 test, minus the half fp case because
we don't currently support that.
Francesco Petrogalli [Mon, 11 May 2020 17:44:17 +0000 (17:44 +0000)]
[clang][SveEmitter] SVE builtins for `svusdot` and `svsudot` ACLE.
Summary:
Intrinsics, guarded by `__ARM_FEATURE_SVE_MATMUL_INT8`:
* svusdot[_s32]
* svusdot[_n_s32]
* svusdot_lane[_s32]
* svsudot[_s32]
* svsudot[_n_s32]
* svsudot_lane[_s32]
Reviewers: sdesmalen, efriedma, david-arm, rengolin
Subscribers: tschuett, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79877
Vedant Kumar [Mon, 18 May 2020 22:59:34 +0000 (15:59 -0700)]
[lldb/test] Relax NSDate mock test for non-Apple platforms
On Ubuntu, a formatted date prints as "GMT" instead of "UTC", which is
ok.
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/4520/steps/test/logs/stdio
Fangrui Song [Thu, 14 May 2020 00:25:04 +0000 (17:25 -0700)]
Map -O to -O1 instead of -O2
rL82131 changed -O from -O1 to -O2, because -O1 was not different from
-O2 at that time.
GCC treats -O as -O1 and there is now work to make -O1 meaningful.
We can change -O back to -O1 again.
Reviewed By: echristo, dexonsmith, arphaman
Differential Revision: https://reviews.llvm.org/D79916
Ayal Zaks [Sun, 17 May 2020 14:51:03 +0000 (17:51 +0300)]
[LV] Fix FoldTail under user VF and UF
LV considers an internally computed MaxVF to decide if a constant trip-count is
a multiple of any subsequently chosen VF, and conclude that no scalar remainder
iterations (tail) will be left for Fold Tail to handle. If an external VF is
provided via -force-vector-width, it must be considered instead of the internal
MaxVF.
If an external UF is provided via -force-vector-interleave, it too must be
considered in addition to MaxVF or user VF.
Fixes PR45679.
Differential Revision: https://reviews.llvm.org/D80085
LLVM GN Syncbot [Mon, 18 May 2020 22:19:17 +0000 (22:19 +0000)]
[gn build] Port
9d69072fb80
Kirstóf Umann [Sun, 1 Mar 2020 16:49:44 +0000 (17:49 +0100)]
[analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker
One of the pain points in simplifying MallocCheckers interface by gradually
changing to CallEvent is that a variety of C++ allocation and deallocation
functionalities are modeled through preStmt<...> where CallEvent is unavailable,
and a single one of these callbacks can prevent a mass parameter change.
This patch introduces a new CallEvent, CXXDeallocatorCall, which happens after
preStmt<CXXDeleteExpr>, and can completely replace that callback as
demonstrated.
Differential Revision: https://reviews.llvm.org/D75430
Matt Arsenault [Mon, 18 May 2020 00:00:59 +0000 (20:00 -0400)]
GlobalISel: Fold G_MUL x, 0, and G_*DIV 0, x
Francesco Petrogalli [Fri, 8 May 2020 20:50:10 +0000 (20:50 +0000)]
[llvm][sve] Intrinsics for SVE sudot and usdot instructions.
Summary:
This patch adds IR intrinsics for the mnemonics USDOT and SUDOT of the
8.6 extension of Armv8-a.
Reviewers: sdesmalen, efriedma, david-arm
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79876
Francesco Petrogalli [Wed, 6 May 2020 20:52:30 +0000 (20:52 +0000)]
[SveEmitter] Builtins for SVE matrix multiply `mmla`.
Summary:
Guarded by __ARM_FEATURE_SVE_MATMUL_INT8:
* svmmla_u32
* svmmla_s32
* svusmmla_s32
Guarded by __ARM_FEATURE_SVE_MATMUL_FP32:
* svmmla_f32
Guarded by __ARM_FEATURE_SVE_MATMUL_FP64:
* svmmla_f64
Reviewers: sdesmalen, kmclaughlin, efriedma, rengolin
Subscribers: tschuett, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79639
Francesco Petrogalli [Wed, 6 May 2020 02:56:28 +0000 (02:56 +0000)]
[llvm][SVE] IR intrinscs for matrix multiplication instructions.
Summary:
Instructions:
* SMMLA
* UMMLA
* USMMLA
* FMMLA
Reviewers: sdesmalen, efriedma, kmclaughlin
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79638
Amara Emerson [Mon, 18 May 2020 17:31:11 +0000 (10:31 -0700)]
[GlobalISel] Add support for using vector values in memset inlining.
Sanjay Patel [Mon, 18 May 2020 19:42:23 +0000 (15:42 -0400)]
[x86] add tests for heroic horizontal ops; NFC
Sanjay Patel [Mon, 18 May 2020 17:56:15 +0000 (13:56 -0400)]
[x86] add tests for disguised horizontal ops; NFC
Stanislav Mekhanoshin [Mon, 18 May 2020 20:26:58 +0000 (13:26 -0700)]
[AMDGPU] Fixed selection error for 64 bit extract_subvector
Differential Revision: https://reviews.llvm.org/D80155
Matt Arsenault [Mon, 18 May 2020 20:05:09 +0000 (16:05 -0400)]
DAG: Use correct pointer size for llvm.ptrmask
This was ignoring the address space, and would assert on address
spaces with a different size from the default.
Sam McCall [Thu, 14 May 2020 17:23:01 +0000 (19:23 +0200)]
[clangd] Avoid wasteful data structures in RefSlab::Builder
Summary: This is worth another 10% or so on InedxBenchmark.DexBuild.
Reviewers: kbobyrev
Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79950
Craig Topper [Mon, 18 May 2020 19:41:36 +0000 (12:41 -0700)]
Fix several places that were calling verifyFunction or verifyModule without checking the return value.
verifyFunction/verifyModule don't assert or error internally. They
also don't print anything if you don't pass a raw_ostream to them.
So the caller needs to check the result and ideally pass a stream
to get the messages. Otherwise they're just really expensive no-ops.
I've filed PR45965 for another instance in SLPVectorizer
that causes a lit test failure.
Differential Revision: https://reviews.llvm.org/D80106
Vedant Kumar [Tue, 21 Apr 2020 17:00:13 +0000 (10:00 -0700)]
[lldb/DataFormatter] Check for overflow when finding NSDate epoch
Summary:
Fixes UBSan-reported issues where the date value inside of an
uninitialized NSDate overflows the 64-bit epoch.
rdar://
61774575
Reviewers: JDevlieghere, mib, teemperor
Subscribers: mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D80150
Nikita Popov [Mon, 18 May 2020 19:50:15 +0000 (21:50 +0200)]
[Sanitizers] Use getParamByValType() (NFC)
Instead of fetching the pointer element type.
Jinsong Ji [Mon, 18 May 2020 18:36:43 +0000 (18:36 +0000)]
[compiler-rt][CMake] Fix PowerPC runtime build
When build in runtime bulid mode with LLVM_ENABLE_RUNTIMES,
the base-config-ix.cmake will complain about two errors.
One is empty string in replace, the other one is unknown `TEST_BIG_ENDIAN ` command.
This patch fix it so that we can test runtime build.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D80040
Jean-Michel Gorius [Mon, 18 May 2020 19:30:43 +0000 (21:30 +0200)]
[x86] Propagate memory operands during ISel DAG postprocessing
Summary:
Propagate memory operands when folding test instructions.
This was split from D80062.
Reviewers: craig.topper, rnk, lebedev.ri
Reviewed By: craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80140
Matt Arsenault [Sat, 16 May 2020 17:48:55 +0000 (13:48 -0400)]
AMDGPU: Fix illegally constant folding from V_MOV_B32_sdwa
This was assumed to be a simple move, and interpreting the immediate
modifier operand as a materialized immediate. Apparently the SDWA pass
never produces these, but GlobalISel does emit these for some vector
shuffles.
Artem Belevich [Mon, 18 May 2020 19:17:39 +0000 (12:17 -0700)]
Revert "[CUDA][HIP] Workaround for resolving host device function against wrong-sided function"
Still breaks CUDA compilation.
This reverts commit
e03394c6a6ff5832aa43259d4b8345f40ca6a22c.
Lei Zhang [Sun, 17 May 2020 14:14:36 +0000 (10:14 -0400)]
[mlir][vulkan-runner] Add back accidentially removed header include
Differential Revision: https://reviews.llvm.org/D80149
Matt Arsenault [Mon, 18 May 2020 18:53:26 +0000 (14:53 -0400)]
AMDGPU/GlobalISel: Fix f64 G_FDIV lowering
This was using an integer multiply instead of FP.
Volkan Keles [Mon, 18 May 2020 19:11:46 +0000 (12:11 -0700)]
LoadStoreVectorizer: Match nested adds to prove vectorization is safe
If both OpA and OpB is an add with NSW/NUW and with the same LHS operand,
we can guarantee that the transformation is safe if we can prove that OpA
won't overflow when IdxDiff added to the RHS of OpA.
Review: https://reviews.llvm.org/D79817
Nikita Popov [Mon, 18 May 2020 17:09:03 +0000 (19:09 +0200)]
[Loads] Require Align in isSafeToLoadUnconditionally() (NFC)
Now that load/store have required alignment, accept Align here.
This also avoids uses of getPointerElementType(), which is
incompatible with opaque pointers.
George [Mon, 18 May 2020 18:40:32 +0000 (14:40 -0400)]
Fixed a typo in the comment for allocateBuffer()
Differential Revision: https://reviews.llvm.org/D80087
Jonas Devlieghere [Mon, 18 May 2020 18:34:09 +0000 (11:34 -0700)]
[dsymutil] Make sure the --help output and man page are consistent
As suggested by Adrian in D79398.
Arthur Eubanks [Mon, 18 May 2020 16:02:12 +0000 (09:02 -0700)]
Add verifier check that musttail and preallocated are not used together
Summary:
Currently they are not supported together. Supporting them will require
a LangRef change. See discussion in https://reviews.llvm.org/D77689.
Reviewers: rnk, efriedma
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80132
Jay Foad [Mon, 18 May 2020 15:06:42 +0000 (16:06 +0100)]
[IR] Revert r2694 in BasicBlock::removePredecessor
r2694 fixed a bug where removePredecessor could create IR with a use not
dominated by its def in a self loop. But this could only happen in an
unreachable loop, and since that time the rules have been relaxed so
that defs don't have to dominate uses in unreachable code, so the fix is
unnecessary. The regression test added in r2691 still stands.
Differential Revision: https://reviews.llvm.org/D80128
Jonas Paulsson [Mon, 18 May 2020 16:20:40 +0000 (18:20 +0200)]
[SystemZ] Don't create PERMUTE nodes with an undef operand.
It's better to reuse the first source value than to use an undef second
operand, because that will make more resulting VPERMs have identical operands
and therefore MachineCSE more successful.
Review: Ulrich Weigand
Mircea Trofin [Mon, 18 May 2020 17:26:45 +0000 (10:26 -0700)]
[llvm][NFC] Fixed non-compliant style in InlineAdvisor.h
Changed OnPass{Entry|Exit} -> onPass{Entry|Exit}
Also fixed a small typo in a comment.
Jonas Devlieghere [Mon, 18 May 2020 16:55:33 +0000 (09:55 -0700)]
[lldb/Reproducers] Add skipIfReproducer to more tests
Mark more tests as unsupported with reproducers.
Vedant Kumar [Fri, 15 May 2020 20:58:40 +0000 (13:58 -0700)]
[Local] Do not ignore zexts in salvageDebugInfo, PR45923
Summary:
When salvaging a dead zext instruction, append a convert operation to
the DIExpressions of the debug uses of the instruction, to prevent the
salvaged value from being sign-extended.
I confirmed that lldb prints out the correct unsigned result for "f" in
the example from PR45923 with this changed applied.
rdar://
63246143
Reviewers: aprantl, jmorse, chrisjackson, davide
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80034
Alexandre Rames [Mon, 18 May 2020 16:44:26 +0000 (18:44 +0200)]
[MLIR] Use `MLIR_INCLUDE_TESTS` to conditionally compile tests.
This is equivalent to what is done for other projects (e.g. clang).
Differential Revision: https://reviews.llvm.org/D80022
Tobias Gysi [Mon, 18 May 2020 16:30:39 +0000 (18:30 +0200)]
[mlir] Support optional attributes in assembly formats
Summary: This revision adds support for assembly formats with optional attributes. It elides optional attributes that are part of the syntax from the attribute dictionary.
Reviewers: ftynse, Kayjukh
Reviewed By: ftynse, Kayjukh
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, jurahul, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80113