Jianzhou Zhao [Tue, 25 Aug 2020 00:36:24 +0000 (00:36 +0000)]
Fix a 32-bit overflow issue when reading LTO-generated bitcode files whose strtab are of size > 2^29
This happens when using -flto and -Wl,--plugin-opt=emit-llvm to create a linked LTO bitcode file, and the bitcode file has a strtab with size > 2^29.
All the issues relate to a pattern like this
size_t x64 = y64 + z32 * C
When z32 is >= (2^32)/C, z32 * C overflows.
Reviewed-by: MaskRay
Differential Revision: https://reviews.llvm.org/D86500
Mehdi Amini [Wed, 26 Aug 2020 05:08:32 +0000 (05:08 +0000)]
Remove the use of global dialect registration from the standalone-translate.cpp example (NFC)
Siva Chandra Reddy [Wed, 26 Aug 2020 04:57:46 +0000 (21:57 -0700)]
[libc][obvious] Add back the accidentally removed MPFRNumber destructor.
Siva Chandra Reddy [Fri, 21 Aug 2020 05:36:53 +0000 (22:36 -0700)]
[libc] Extend MPFRMatcher to handle multiple-input-multiple-output functions.
Tests for frexp[f|l] now use the new capability. Not all input-output
combinations have been addressed by this change. Support for newer combinations
can be added in future as needed.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D86506
Xing GUO [Wed, 26 Aug 2020 04:30:33 +0000 (12:30 +0800)]
[DWARFYAML] Use writeDWARFOffset() to write the prologue_length field. NFC.
Use writeDWARFOffset() to simplify the logic. NFC.
Adrien Guinet [Wed, 26 Aug 2020 01:55:50 +0000 (18:55 -0700)]
[llvm-lipo] Add support for bitcode files
A Mach-O universal binary may contain bitcode as a slice.
This diff adds proper handling of such binaries to llvm-lipo.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D85740
Jason Molenda [Wed, 26 Aug 2020 04:03:39 +0000 (21:03 -0700)]
Ah, one test too many updated. This one should be unmodified.
Jason Molenda [Wed, 26 Aug 2020 03:53:01 +0000 (20:53 -0700)]
Update UnwindPlan dump to list if it is a trap handler func; also Command
Update the "image show-unwind" command output to show if the function
being shown is listed as a user-setting or platform trap handler.
Update the individual UnwindPlan dumps to show whether the unwind plan
is registered as a trap handler.
Teresa Johnson [Wed, 4 Mar 2020 23:38:45 +0000 (15:38 -0800)]
[Docs] Document --lto-whole-program-visibility
Summary:
Documents interaction of linker option added in D71913 with LTO
visibility.
Reviewers: pcc
Subscribers: inglorion, hiraditya, steven_wu, dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75655
Mikhail R. Gadelha [Tue, 25 Aug 2020 23:19:58 +0000 (19:19 -0400)]
Add Z3 to system libraries list if enabled
Without this trying to link static LLVM libraries (built with Z3 enabled) fails because `llvm-config` doesn't print `-lz3`.
We are already using this patch at MSYS2: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-clang/0013-Add-Z3-to-system-libraries-list-if-enabled.patch
Reviewed By: mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D85195
Craig Topper [Wed, 26 Aug 2020 01:20:41 +0000 (18:20 -0700)]
[X86] Add an isel pattern for (i8 (trunc (i16 (bitconvert (v16i1 X))))) to avoid an extra EXTRACT_SUBREG
Since we can only copy to GR32 we had to EXTRACT from GR32, but
we would first go to GR16 and then the truncate would extra again
to GR8. This adds a special case to go directly from GR32 to GR8.
This would eventually get cleaned up, but though maybe we should
avoid doing it in the first place. Our k-register handling is weird
and we could probably stand to have some more special ISD nodes
for the conversions so the i32 type would be explicit.
Volodymyr Sapsai [Thu, 23 Jul 2020 19:47:16 +0000 (12:47 -0700)]
[Modules] Improve error message when cannot find parent module for submodule definition.
Before the change the diagnostic for
module unknown.submodule {}
was "error: expected module name" which is incorrect and misleading
because both "unknown" and "submodule" are valid module names.
We already have a better error message when a parent module is a
submodule itself and is missing. Make the error for a missing top-level
module more like the one for a submodule.
rdar://problem/
64424407
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D84458
Mehdi Amini [Tue, 25 Aug 2020 23:21:15 +0000 (23:21 +0000)]
Remove global registration from the test dialect in MLIR (NFC)
Craig Topper [Tue, 25 Aug 2020 23:00:12 +0000 (16:00 -0700)]
[X86] Remove extra getOperand(0) call from recently introduced store(extract_element(vtrunc)) to truncated store combine.
The IsExtractedElement already called getOperand(0) so Extract
here is the source vector. We shouldn't call getOperand(0). This
worked for the original test cases because the result was a
bitcast so the getOperand(0) accidently peeked through the bitcast
which is what we wanted.
In the failing case here, the operand turns out to be undef so
the getOperand(0) asserts because undef has no operands.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25184
Differential Revision: https://reviews.llvm.org/D86428
Mehdi Amini [Tue, 25 Aug 2020 23:08:43 +0000 (23:08 +0000)]
Add llvm_unreachable after fully covered switch to silence some warnings from GCC (NFC)
Zequan Wu [Tue, 25 Aug 2020 22:04:33 +0000 (15:04 -0700)]
Revert "[Coverage] Enable emitting gap area between macros"
This reverts commit
a31c89c1b7a0a2fd3e2c0b8a587a60921abf4abd.
Craig Topper [Tue, 25 Aug 2020 22:16:50 +0000 (15:16 -0700)]
[X86] Remove a redundant COPY_TO_REGCLASS for VK16 after a KMOVWkr in an isel output pattern.
KMOVWkr produces VK16, there's no reason to copy it to VK16 again.
Test changes are presumably because we were scheduling based on
the COPY that is no longer there.
Shoaib Meenai [Tue, 25 Aug 2020 22:03:37 +0000 (15:03 -0700)]
[llvm-libtool-darwin] Address post-commit feedback
Address James Henderson's comments on https://reviews.llvm.org/D86359.
Dave Lee [Mon, 24 Aug 2020 20:46:23 +0000 (13:46 -0700)]
Remove unused/misnamed SetObjectModificationTime
Remove `SetObjectModificationTime` which is not currently used, and assigns to the wrong member.
Differential Revision: https://reviews.llvm.org/D86493
Mircea Trofin [Tue, 25 Aug 2020 16:58:49 +0000 (09:58 -0700)]
[MLInliner] Simplify TFUTILS_SUPPORTED_TYPES
We only need the C++ type and the corresponding TF Enum. The other
parameter was used for the output spec json file, but we can just
standardize on the C++ type name there.
Differential Revision: https://reviews.llvm.org/D86549
Stanislav Mekhanoshin [Tue, 25 Aug 2020 18:58:23 +0000 (11:58 -0700)]
[AMDGPU] Remove unsound dependency on ISA version in waitcnt
Differential Revision: https://reviews.llvm.org/D86566
Fangrui Song [Tue, 25 Aug 2020 20:37:29 +0000 (13:37 -0700)]
[TargetLoweringObjectFileImpl] Make .llvmbc and .llvmcmd non-SHF_ALLOC
There are two ways .llvmbc can be produced:
* clang -c -fembed-bitcode=all (which also produces .llvmcmd)
* LTO backend: ld.lld -mllvm -lto-embed-bitcode or -plugin-opt=-lto-embed-bitcode
.llvmbc and .llvmcmd have the SHF_ALLOC flag, so they can be dropped by
--gc-sections.
This patch sets SectionKind::Metadata to drop the SHF_ALLOC flag. This
is conceptually correct: the two sections are not part of the process
image, so SHF_ALLOC is not appropriate.
`test/LTO/X86/embed-bitcode.ll`: changed `llvm-objcopy -O binary --only-section` to
`llvm-objcopy --dump-section`. `-O binary` does not dump non-SHF_ALLOC sections.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D86374
Krzysztof Parzyszek [Mon, 24 Aug 2020 18:25:06 +0000 (13:25 -0500)]
[SDAG] Improve MemSDNode::getBasePtr
It returned getOperand(1), except for STORE for which it returned
getOperand(2). Handle MSTORE, MGATHER, and MSCATTER as well.
aartbik [Tue, 25 Aug 2020 19:26:28 +0000 (12:26 -0700)]
[mlir] [LLVMIR] Mark reductions as side-effect free
Attribute was missing from original base class.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D86569
Shilei Tian [Tue, 25 Aug 2020 20:04:59 +0000 (16:04 -0400)]
[OpenMP] Pack first-private arguments to improve efficiency of data transfer
In this patch, we pack all small first-private arguments, allocate and transfer them all at once to reduce the number of data transfer which is very expensive.
Let's take the test case as example.
```
int main() {
int data1[3] = {1}, data2[3] = {2}, data3[3] = {3};
int sum[16] = {0};
#pragma omp target teams distribute parallel for map(tofrom: sum) firstprivate(data1, data2, data3)
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 3; ++j) {
sum[i] += data1[j];
sum[i] += data2[j];
sum[i] += data3[j];
}
}
}
```
Here `data1`, `data2`, and `data3` are three first-private arguments of the target region. In the previous `libomptarget`, it called data allocation and data transfer three times, each of which allocated and transferred 12 bytes. With this patch, it only calls allocation and transfer once. The size is `(12+4)*3=48` where 12 is the size of each array and 4 is the padding to keep the address aligned with 8. It is implemented in this way:
1. First collect all information for those *first*-private arguments. _private_ arguments are not the case because private arguments don't need to be mapped to target device. It just needs a data allocation. With the patch for memory manager, the data allocation could be very cheap, especially for the small size. For each qualified argument, push a place holder pointer `nullptr` to the `vector` for kernel arguments, and we will update them later.
2. After we have all information, create a buffer that can accommodate all arguments plus their paddings. Copy the arguments to the buffer at the right place, i.e. aligned address.
3. Allocate a target memory with the same size as the host buffer, transfer the host buffer to target device, and finally update all place holder pointers in the arguments `vector`.
The reason we only consider small arguments is, the data transfer is asynchronous. Therefore, for the large argument, we could continue to do things on the host side meanwhile, hopefully, the data is also being transferred. The "small" is defined by that the argument size is less than a predefined value. Currently it is 1024. I'm not sure whether it is a good one, and that is an open question. Another question is, do we need to make it configurable via an environment variable?
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D86307
Stanislav Mekhanoshin [Tue, 25 Aug 2020 19:13:24 +0000 (12:13 -0700)]
[AMDGPU] Switch to named simm16 in vscnt insertion
Differential Revision: https://reviews.llvm.org/D86568
Ankit Aggarwal [Tue, 25 Aug 2020 19:47:44 +0000 (14:47 -0500)]
[Hexagon] Check if EVT is simple type in HVX lowering
Jonas Devlieghere [Tue, 25 Aug 2020 19:49:30 +0000 (12:49 -0700)]
[lldb] Make Reproducer compatbile with SubsystemRAII (NFC)
Make Reproducer compatbile with SubsystemRAII and use it in
LocateSymbolFileTest.
Abhina Sreeskantharajan [Tue, 25 Aug 2020 17:50:17 +0000 (13:50 -0400)]
[SystemZ][z/OS] Add z/OS Target and define macros
This patch adds the z/OS target and defines macros as a stepping stone
towards enabling a native build on z/OS.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D85324
Juneyoung Lee [Sun, 23 Aug 2020 17:37:10 +0000 (02:37 +0900)]
[ValueTracking] Let getGuaranteedNonPoisonOp find multiple non-poison operands
This patch helps getGuaranteedNonPoisonOp find multiple non-poison operands.
Instead of special-casing llvm.assume, I think it is also a viable option to
add noundef to Intrinsics.td. If it makes sense, I'll make a patch for that.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86477
Juneyoung Lee [Mon, 24 Aug 2020 17:34:17 +0000 (02:34 +0900)]
[ValueTracking] Add a noundef test for D86477; NFC
Amy Huang [Tue, 25 Aug 2020 17:36:03 +0000 (10:36 -0700)]
Reland "[DebugInfo] Move constructor homing case in shouldOmitDefinition."
For some reason the ctor homing case was before the template
specialization case, and could have returned false too early.
I moved the code out into a separate function to avoid this.
This reverts commit
05777ab941063192b9ccb1775358a83a2700ccc1.
Nikita Popov [Thu, 25 Jun 2020 19:35:41 +0000 (21:35 +0200)]
[MemDep] Use BatchAA when computing pointer dependencies
We're not changing IR while running a single MemDep query, so it's
safe to cache alias analysis results using BatchAA. This adds BatchAA
usage to getSimplePointerDependencyFrom(), which is non-intrusive --
covering larger parts (like a whole processNonLocalLoad query) is
also possible, but requires threading BatchAA through a bunch of APIs.
For the ThinLTO configuration, this is a 1% geomean improvement on CTMark.
Differential Revision: https://reviews.llvm.org/D85583
aartbik [Tue, 25 Aug 2020 18:55:45 +0000 (11:55 -0700)]
[mlir] [LLVMIR] Add get active lane mask intrinsic
Provides fast, generic way of setting a mask up to a certain
point. Potential use cases that may benefit are create_mask
and transfer_read/write operations in the vector dialect.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D86501
Wolfgang Pieb [Fri, 21 Aug 2020 22:52:02 +0000 (15:52 -0700)]
[llvm-mca][NFC] Refactor handling of views that examine individual instructions,
including printing them.
Reviewers: andreadb, lebedev.ri
Differential Review: https://reviews.llvm.org/D86390
Introduces a new base class "InstructionView" that such views derive from.
Other views still use the "View" base class.
clementval [Tue, 25 Aug 2020 19:11:05 +0000 (15:11 -0400)]
[mlir][openacc][NFC] Fix comment about OpenACCExecMapping
peter klausler [Tue, 25 Aug 2020 17:34:33 +0000 (10:34 -0700)]
[flang] Check that various variables referenced in I/O statements may be defined
A number of I/O syntax rules involve variables that will be written to,
and must therefore be definable. This includes internal file variables,
IOSTAT= and IOMSG= specifiers, most INQUIRE statement specifiers, a few
other specifiers, and input variables. This patch checks for
these violations, and implements several additional I/O TODO constraint
checks.
Differential Revision: https://reviews.llvm.org/D86557
Kuba Mracek [Tue, 25 Aug 2020 18:59:05 +0000 (11:59 -0700)]
[tsan] On arm64e, strip out ptrauth bits from incoming PCs
Differential Revision: https://reviews.llvm.org/D86378
Craig Topper [Tue, 25 Aug 2020 18:56:43 +0000 (11:56 -0700)]
[X86] Mention -march=sapphirerapids in the release notes.
This was just added in
e02d081f2b60b61eb60ef6a49b1a9f907e432d4c.
Arthur Eubanks [Tue, 25 Aug 2020 17:59:12 +0000 (10:59 -0700)]
[test] Add -inject-tli-mapping to -loop-vectorize -vector-library tests
The legacy LoopVectorize has a dependency on InjectTLIMappingsLegacy.
That cannot be expressed in the new PM since they are both normal
passes. Explicitly add -inject-tli-mappings as a pass.
Follow-up to https://reviews.llvm.org/D86492.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D86561
Lang Hames [Tue, 25 Aug 2020 18:50:32 +0000 (11:50 -0700)]
[examples] Fix dependencies for OrcV2Examples/LLJITWithThinLTOSummaries.
Lang Hames [Mon, 24 Aug 2020 03:34:57 +0000 (20:34 -0700)]
[ORC] Fix an endif comment.
peter klausler [Tue, 25 Aug 2020 16:38:41 +0000 (09:38 -0700)]
[flang] Improve error handling for bad characters in source
When an illegal character appears in Fortran source (after
preprocessing), catch and report it in the prescanning phase
rather than leaving it for the parser to cope with.
Differential Revision: https://reviews.llvm.org/D86553
peter klausler [Tue, 25 Aug 2020 16:39:52 +0000 (09:39 -0700)]
[flang] Parse global compiler directives
Accept and represent "global" compiler directives that appear
before and between program units in a source file.
Differential Revision: https://reviews.llvm.org/D86555
Raphael Isemann [Tue, 25 Aug 2020 18:25:15 +0000 (20:25 +0200)]
[lldb] Initialize reproducers in LocateSymbolFileTest
Since
a842950b62b6d029a392c3c312c6495d6368c2a4 this test started using
the reproducer subsystem but we never initialized it in the test. The
Subsystem takes an argument, so we can't use the usual SubsystemRAII at the
moment to do this for us.
This just adds the initialize/terminate calls to get the test passing again.
Raphael Isemann [Tue, 25 Aug 2020 17:53:48 +0000 (19:53 +0200)]
[lldb] Don't ask for QOS_CLASS_UNSPECIFIED queue in TestQueues
TestQueues is curiously failing for me as my queue for QOS_CLASS_UNSPECIFIED
is named "Utility" and not "User Initiated" or "Default". While debugging, this
I noticed that this test isn't actually using this API right from what I understand. The API documentation
for `dispatch_get_global_queue` specifies for the parameter: "You may specify the value
QOS_CLASS_USER_INTERACTIVE, QOS_CLASS_USER_INITIATED, QOS_CLASS_UTILITY, or QOS_CLASS_BACKGROUND."
QOS_CLASS_UNSPECIFIED isn't listed as one of the supported values. swift-corelibs-libdispatch
even checks for this value and returns a DISPATCH_BAD_INPUT. The
libdispatch shipped on macOS seems to also check for QOS_CLASS_UNSPECIFIED and seems to
instead cause a "client crash", but somehow this doesn't trigger in this test and instead we just
get whatever queue
This patch just removes that part of the test as it appears the code is just incorrect.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D86211
Wei Wang [Tue, 25 Aug 2020 17:42:54 +0000 (10:42 -0700)]
[FIX] Avoid creating BFI when emitting remarks for dead functions
Dead function has its body stripped away, and can cause various
analyses to panic. Also it does not make sense to apply analyses on
such function.
Reviewed By: xazax.hun, MaskRay, wenlei, hoy
Differential Revision: https://reviews.llvm.org/D84715
Kazuaki Ishizaki [Tue, 25 Aug 2020 18:11:48 +0000 (03:11 +0900)]
[mlir] NFC: fix typo in FileCheck prefix
CHECL -> CHECK
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D86550
Matt Arsenault [Wed, 3 Jun 2020 21:53:15 +0000 (17:53 -0400)]
AArch64: Fix hardcoded register in test
peter klausler [Tue, 25 Aug 2020 16:39:09 +0000 (09:39 -0700)]
[flang] Don't completely left-justify fixed-form tokenization
If the label field is empty, and macro replacement occurs,
the rescanned text might be misclassified as a comment card
if it happens to begin with a C or a D. Insert a leading
space into these otherwise empty label fields.
Fixes https://bugs.llvm.org/show_bug.cgi?id=47173
Arthur Eubanks [Mon, 24 Aug 2020 22:38:00 +0000 (15:38 -0700)]
[NewPM][test] Fix accelerate-vector-functions.ll under NPM
The legacy SLPVectorizer has a dependency on InjectTLIMappingsLegacy.
That cannot be expressed in the new PM since they are both normal
passes. Explicitly add -inject-tli-mappings as a pass.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D86492
David Green [Tue, 25 Aug 2020 17:29:15 +0000 (18:29 +0100)]
[ARM] Additional test for tailpred reductions. NFC
Krzysztof Parzyszek [Tue, 25 Aug 2020 16:42:42 +0000 (11:42 -0500)]
[Hexagon] Remove (redundant) HexagonISelLowering::isHvxOperation(SDValue)
Use isHvxOperation(SDNode*) instead.
Sanjay Patel [Tue, 25 Aug 2020 16:42:20 +0000 (12:42 -0400)]
[x86] add AVX shuffle test for PR47262; NFC
Goes with D86429
Ta-Wei Tu [Tue, 25 Aug 2020 16:17:01 +0000 (16:17 +0000)]
[LoopNest] False negative of `arePerfectlyNested` with LCSSA loops
Summary: The LCSSA pass (required for all loop passes) sometimes adds
additional blocks containing LCSSA variables, and checkLoopsStructure
may return false even when the loops are perfectly nested in this case.
This is because the successor of the exit block of the inner loop now
points to the LCSSA block instead of the latch block of the outer loop.
Examples are shown in the test nests-with-lcssa.ll.
To fix the issue, the successor of the exit block of the inner loop can
now point to a block in which all instructions are LCSSA phi node
(except the terminator), and the sole successor of that block should
point to the latch block of the outer loop.
Reviewed By: Whitney, etiotto
Differential Revision: https://reviews.llvm.org/D86133
David Tenty [Tue, 25 Aug 2020 15:30:17 +0000 (11:30 -0400)]
[AIX][compiler-rt][builtins] Don't add ppc builtin implementations that require __int128 on AIX
since __int128 currently isn't supported on AIX.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D85972
Sjoerd Meijer [Tue, 25 Aug 2020 15:14:49 +0000 (16:14 +0100)]
[LangRef] Revise semantics of intrinsic get.active.lane.mask
A first version of get.active.lane.mask was committed in rG7fb8a40e5220. One of
the main purposes and uses of this intrinsic is to communicate information from
the middle-end to the back-end, but its current definition and semantics make
this actually very difficult. The intrinsic was defined as:
@llvm.get.active.lane.mask(%IV, %BTC)
where %BTC is the Backedge-Taken Count (variable names are different in the
LangRef spec). This allows to implicitly communicate the loop tripcount, which
can be reconstructed by calculating BTC + 1. But it has been very difficult to
prove that calculating BTC + 1 is safe and doesn't overflow. We need
complicated range and SCEV analysis, and thus the problem is that this
intrinsic isn't really doing what it was supposed to solve. Examples of the
overflow checks that are required in the (ARM) back-end are D79175 and D86074,
which aren't even complete/correct yet.
To solve this problem, we are revising the definitions/semantics for
get.active.lane.mask to avoid all the complicated overflow analysis. This means
that instead of communicating the BTC, we are now using the loop tripcount. Now
using LangRef's variable names, its semantics is changed from:
icmp ule (%base + i), %n
to:
icmp ult (%base + i), %n
with %n > 0 and corresponding to the loop tripcount. The intrinsic signature
remains the same.
Differential Revision: https://reviews.llvm.org/D86147
Sanjay Patel [Tue, 25 Aug 2020 15:11:43 +0000 (11:11 -0400)]
[InstCombine] improve demanded element analysis for vector insert-of-extract (2nd try)
The 1st attempt (rG557b890) was reverted because it caused miscompiles.
That bug is avoided here by changing the order of folds and as verified
in the new tests.
Original commit message:
InstCombine currently has odd rules for folding insert-extract chains to shuffles,
so we miss collapsing seemingly simple cases as shown in the tests here.
But poison makes this not quite as easy as we might have guessed. Alive2 tests to
show the subtle difference (similar to the regression tests):
https://alive2.llvm.org/ce/z/hp4hv3 (this is ok)
https://alive2.llvm.org/ce/z/ehEWaN (poison leakage)
SLP tends to create these patterns (as shown in the SLP tests), and this could
help with solving PR16739.
Differential Revision: https://reviews.llvm.org/D86460
Sanjay Patel [Tue, 25 Aug 2020 14:57:13 +0000 (10:57 -0400)]
[InstCombine] add vector demanded elements tests with shuffles; NFC
The 1st draft of D86460 (reverted) would show miscompiles with these tests
because the undef element tracking went wrong and became visible in the
shuffle masks.
Fangrui Song [Tue, 25 Aug 2020 15:05:38 +0000 (08:05 -0700)]
[ELF] .note.gnu.property: error for invalid pr_datasize
A n_type==NT_GNU_PROPERTY_TYPE_0 note encodes a program property.
If pr_datasize is invalid, LLD may crash
(https://github.com/ClangBuiltLinux/linux/issues/1141)
This patch adds some error checking, supports big-endian, and add some tests
for invalid n_descsz.
Differential Revision: https://reviews.llvm.org/D86422
Jay Foad [Tue, 25 Aug 2020 14:52:11 +0000 (15:52 +0100)]
AMDGPU/GlobalISel: re-auto-generate some test checks
Sjoerd Meijer [Tue, 25 Aug 2020 14:13:51 +0000 (15:13 +0100)]
[Verifier] Additional check for intrinsic get.active.lane.mask
This adapts the verifier checks for intrinsic get.active.lane.mask to the new
semantics of it as described in D86147. I.e., the second argument %n, which
corresponds to the loop tripcount, must be greater than 0 if it is a constant,
so check that.
Differential Revision: https://reviews.llvm.org/D86301
Kostya Kortchinsky [Mon, 24 Aug 2020 21:13:12 +0000 (14:13 -0700)]
[scudo][standalone] Skip irrelevant regions during release
With the 'new' way of releasing on 32-bit, we iterate through all the
regions in between `First` and `Last`, which covers regions that do not
belong to the class size we are working with. This is effectively wasted
cycles.
With this change, we add a `SkipRegion` lambda to `releaseFreeMemoryToOS`
that will allow the release function to know when to skip a region.
For the 64-bit primary, since we are only working with 1 region, we never
skip.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D86399
Xing GUO [Tue, 25 Aug 2020 14:37:40 +0000 (22:37 +0800)]
[DWARFYAML] Make the 'Attributes' field optional.
This patch makes the 'Attributes' field optional. We don't need to
explicitly specify the 'Attributes' field in the future.
Reviewed By: jhenderson, grimar
Differential Revision: https://reviews.llvm.org/D86537
Sjoerd Meijer [Tue, 25 Aug 2020 13:41:53 +0000 (14:41 +0100)]
[SelectionDAG] Legalize intrinsic get.active.lane.mask
This adapts legalization of intrinsic get.active.lane.mask to the new semantics
as described in D86147. Because the second argument is now the loop tripcount,
we legalize this intrinsic to an 'icmp ULT' instead of an ULE when it was the
backedge-taken count.
Differential Revision: https://reviews.llvm.org/D86302
Jeremy Morse [Tue, 25 Aug 2020 13:23:14 +0000 (14:23 +0100)]
[LiveDebugValues] Add switches for using instr-ref variable locations
This patch adds the -Xclang option
"-fexperimental-debug-variable-locations" and same LLVM CodeGen option,
to pick which variable location tracking solution to use.
Right now all the switch does is pick which LiveDebugValues
implementation to use, the normal VarLoc one or the instruction
referencing one in rGae6f78824031. Over time, the aim is to add fragments
of support in aid of the value-tracking RFC:
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139440.html
also controlled by this command line switch. That will slowly move
variable locations to be defined by an instruction calculating a value,
and a DBG_INSTR_REF instruction referring to that value. Thus, this is
going to grow into a "use the new kind of variable locations" switch,
rather than just "use the new LiveDebugValues implementation".
Differential Revision: https://reviews.llvm.org/D83048
Matt Arsenault [Sat, 22 Aug 2020 22:00:08 +0000 (18:00 -0400)]
AMDGPU/GlobalISel: Use more accurate legality rules for merge/unmerge
Most notably, we were incorrectly reporting <3 x s16> as a legal type
for these. Make sure these aren't legal to help make progress on
fixing the artifact combiner and vector legalizer
rules. Unfortunately, this means spreading the -global-isel-abort=0
hack, although this doesn't change the legalizer result in any
situation.
Matt Arsenault [Sat, 22 Aug 2020 21:24:47 +0000 (17:24 -0400)]
AMDGPU/GlobalISel: Fix using unlegalizable values in tests
Implicit uses of non-register value types places impossible to satisfy
constraints on the legalizer / artifact combiner. These prevent
writing sensible legalize rules for the artifacts without triggering
infinite loops in the legalizer.
The verifier really needs to enforce this, but I'm not sure what the
exact conditions would look like yet.
Sjoerd Meijer [Tue, 25 Aug 2020 12:53:26 +0000 (13:53 +0100)]
[ARM][MVE] Tail-predication: remove the BTC + 1 overflow checks
This adapts tail-predication to the new semantics of get.active.lane.mask as
defined in D86147. This means that:
- we can remove the BTC + 1 overflow checks because now the loop tripcount is
passed in to the intrinsic,
- we can immediately use that value to setup a counter for the number of
elements processed by the loop and don't need to materialize BTC + 1.
Differential Revision: https://reviews.llvm.org/D86303
Matt Arsenault [Sun, 16 Aug 2020 16:51:31 +0000 (12:51 -0400)]
AMDGPU/GlobalISel: Apply bitcast load/store hack to pointer vectors
The selection patterns will currently fail on these.
Anatoly Trosinenko [Tue, 25 Aug 2020 12:52:26 +0000 (15:52 +0300)]
[Utils] Add highlighting definition for byref IR attribute
This patch assumes `byref` can be handled identically to `byval`.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D85768
Anatoly Trosinenko [Tue, 25 Aug 2020 11:01:19 +0000 (14:01 +0300)]
[compiler-rt][builtins] Add more test cases for __div[sdt]f3 LibCalls
* Make the three tests look more uniformly
* Explicitly specify types of integer and floating point literals
* Add more test cases (mostly inspired by divtf3_test.c)
- tests are added for obviously special cases such as +/-Inf, +/-0.0 and some
more implementation-specific cases such as divisor being almost 1.0
* Make NaN in the second test case of `divtf3` to be `sNaN` instead of
testing for `qNaN` again
Reviewed By: sepavloff
Differential Revision: https://reviews.llvm.org/D84932
Ilya Leoshkevich [Tue, 25 Aug 2020 12:37:15 +0000 (14:37 +0200)]
[libFuzzer] Un-XFAIL msan.test on SystemZ
After https://reviews.llvm.org/D86382 it works.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D86184
Sjoerd Meijer [Tue, 25 Aug 2020 12:39:55 +0000 (13:39 +0100)]
[LV] get.active.lane.mask consuming tripcount instead of backedge-taken count
This adapts LV to the new semantics of get.active.lane.mask as discussed in
D86147, which means that the LV now emits intrinsic get.active.lane.mask with
the loop tripcount instead of the backedge-taken count as its second argument.
The motivation for this is described in D86147.
Differential Revision: https://reviews.llvm.org/D86304
Adam Czachorowski [Mon, 24 Aug 2020 17:16:20 +0000 (19:16 +0200)]
[clangd] When inserting "using", add "::" in front if that's the style.
We guess the style based on the existing using declarations. If there
are any and they all start with ::, we add it to the newly added one
too.
Differential Revision: https://reviews.llvm.org/D86473
Alex Richardson [Mon, 24 Aug 2020 17:56:02 +0000 (18:56 +0100)]
Fix update_llc_test_checks function regex for RV64
Some functions also include a `.Lfunc$local:` label due to
-fno-semantic-interposition
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D85888
Alex Richardson [Mon, 24 Aug 2020 17:55:29 +0000 (18:55 +0100)]
Fix crypt.cpp sanitizer test on FreeBSD
FreeBSD doesn't provide a crypt.h header but instead defines the functions
in unistd.h. Use __has_include() to handle that case.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D85406
Alex Richardson [Mon, 24 Aug 2020 17:55:22 +0000 (18:55 +0100)]
[asan] Also allow for SIGBUS in high-address-dereference.c
FreeBSD delivers a SIGBUS signal for bad addresses rather than SIGSEGV.
Reviewed By: #sanitizers, vitalybuka, yln
Differential Revision: https://reviews.llvm.org/D85409
Sam Parker [Tue, 25 Aug 2020 11:13:30 +0000 (12:13 +0100)]
[NFC][SimplifyCFG] More tests for Arm
David Green [Tue, 25 Aug 2020 11:09:06 +0000 (12:09 +0100)]
[ARM][CGP] Fix scalar condition selects for MVE
The arm backend does not handle select/select_cc on vectors with scalar
conditions, preferring to expand them in codegenprepare instead. This
usually works except when optimizing for size, where the optsize check
would end up overruling the backend isSelectSupported check.
We could handle the selects in ISel too, but this seems like smaller
code than trying to splat the condition to all lanes.
Differential Revision: https://reviews.llvm.org/D86433
Mikael Holmen [Tue, 25 Aug 2020 10:26:48 +0000 (12:26 +0200)]
[libunwind] Fix warning when building without frameheader cache
Without the fix the compiler warns with
/data/repo/master/libunwind/src/AddressSpace.hpp:436:44: warning: unused parameter 'pinfo_size' [-Wunused-parameter]
size_t pinfo_size, void *data) {
^
1 warning generated.
Mikael Holmen [Tue, 25 Aug 2020 10:23:56 +0000 (12:23 +0200)]
[PowerPC] Fix gcc warning [NFC]
Without the fix gcc 7.4 warns with
../lib/Target/PowerPC/PPCAsmPrinter.cpp: In member function 'void {anonymous}::PPCAsmPrinter::EmitTlsCall(const llvm::MachineInstr*, llvm::MCSymbolRefExpr::VariantKind)':
../lib/Target/PowerPC/PPCAsmPrinter.cpp:525:53: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
MCInstBuilder(Subtarget->isPPC64() ? Opcode : PPC::BL_TLS)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
Sam Parker [Tue, 25 Aug 2020 10:43:54 +0000 (11:43 +0100)]
[NFC][SimplifyCFG] Add some more tests for Arm.
Shinji Okumura [Tue, 25 Aug 2020 10:31:56 +0000 (19:31 +0900)]
[Attributor][NFC] Clang format
Paul Walker [Fri, 21 Aug 2020 18:00:36 +0000 (19:00 +0100)]
[SVE] Lower scalable vector ISD::FNEG operations.
Also updates isConstOrConstSplatFP to allow the mul(A,-1) -> neg(A)
transformation when -1 is expressed as an ISD::SPLAT_VECTOR.
Differential Revision: https://reviews.llvm.org/D86415
Sam Parker [Tue, 25 Aug 2020 10:16:01 +0000 (11:16 +0100)]
[NFC][ARM] arith code size cost tests
Add a run to measure the code size cost of arithmetic instructions
and add a function for i1 types.
Sam Parker [Tue, 25 Aug 2020 10:12:26 +0000 (11:12 +0100)]
[UpdatesTestChecks] Fix typo in common.py
global_vars_see_dict -> global_vars_seen_dict
Georgii Rymar [Wed, 19 Aug 2020 13:23:51 +0000 (16:23 +0300)]
[llvm-readobj] - Print "Unknown" when a program header is unknown.
Currently, when a program header type is unknown, we dont print anything:
```
ProgramHeader {
Type: (0x60000000)
```
With this patch the output will be:
```
ProgramHeader {
Type: Unknown (0x60000000)
```
It was discussed in D85526 and consistent with what we print for
'--sections' already, e.g.:
```
Section {
Name: .sec
Type: Unknown (0x7FFFFFFF)
}
```
Differential revision: https://reviews.llvm.org/D86213
Roman Lebedev [Tue, 25 Aug 2020 10:00:37 +0000 (13:00 +0300)]
[NFC][InstCombine] Tests for PHI-of-extractvalues
Much like with it's sibling fold HI-of-insertvalues,
it appears to be much more worthwhile than it would seem.
Benjamin Kramer [Tue, 25 Aug 2020 09:31:31 +0000 (11:31 +0200)]
Revert "[InstCombine] improve demanded element analysis for vector insert-of-extract"
This reverts commit
557b890ff4f4dd5fa979c232df5b31cf3fef04c1. Causing
miscompiles, test case is on llvm-commits.
Hans Wennborg [Tue, 25 Aug 2020 09:16:50 +0000 (11:16 +0200)]
Revert "[CMake] Fix ncurses/zlib in LLVM_SYSTEM_LIBS for Windows GNU"
It broke Chromium's llvm build:
CMake Error at lib/Support/CMakeLists.txt:13 (string):
string sub-command REGEX, mode REPLACE: regex "^()" matched an empty
string.
Call Stack (most recent call first):
lib/Support/CMakeLists.txt:223 (get_system_libname)
This reverts commit
2b3807d822c50d361ae67184b6de5a41bd7b1bba / https://reviews.llvm.org/D86434
Georgii Rymar [Mon, 24 Aug 2020 12:44:39 +0000 (15:44 +0300)]
[llvm-readelf/obj] - Change the return type of the `createDRI(...)` to `Expected<>`
This allows to get rid of "Invalid data was encountered while parsing the file"
error reported in cases when sh_size/sh_offset of sections are broken.
Differential revision: https://reviews.llvm.org/D86451
Yang Zhihui [Tue, 25 Aug 2020 08:41:19 +0000 (09:41 +0100)]
[FileCheck][docs] Fix word errors
ouput -> output
Reviewed By: thopre
Differential Revision: https://reviews.llvm.org/D86504
OCHyams [Tue, 25 Aug 2020 05:19:00 +0000 (06:19 +0100)]
[llvm-dwarfdump] Fix misleading scope byte coverage statistics
Fixes PR46575.
Bump statistics version to 6.
Without this patch, for a variable described with a location list the stat
'sum_all_variables(#bytes in parent scope covered by DW_AT_location)' is
calculated by summing all bytes covered by the location ranges in the list and
capping the result to the number of bytes in the parent scope. With the patch,
only bytes which overlap with the parent DIE scope address ranges contribute to
the stat. A new stat 'sum_all_variables(#bytes in any scope covered by
DW_AT_location)' has been added which displays the total bytes covered when
ignoring scopes.
David Sherwood [Wed, 19 Aug 2020 08:13:12 +0000 (09:13 +0100)]
[SVE] Fix TypeSize related warnings with IR truncates of scalable vectors
In getCastInstrCost when the instruction is a truncate we were relying
upon the implicit TypeSize -> uint64_t cast when asking if a given type
has the same size as a legal integer. I've changed the code to only
ask the question if the type is fixed length.
I have also changed InstCombinerImpl::SimplifyDemandedUseBits to bail
out for now if the type is a scalable vector.
I've added the following new tests:
Analysis/CostModel/AArch64/sve-trunc.ll
Transforms/InstCombine/AArch64/sve-trunc.ll
for both of these fixes.
Differential revision: https://reviews.llvm.org/D86432
Florian Hahn [Tue, 25 Aug 2020 07:43:32 +0000 (08:43 +0100)]
[DSE,MemorySSA] Cache accesses with/without reachable read-clobbers.
Currently we repeatedly check the same uses for read clobbers in some
cases. We can avoid unnecessary checks by keeping track of the memory
accesses we already found read clobbers for. To do so, we just add
memory access causing read-clobbers to a set. Note that marking all
visited accesses as read-clobbers would be to pessimistic, as that might
include accesses not on any path to the actual read clobber.
If we do not find any read-clobbers, we can add all visited instructions
to another set and use that to skip the same accesses in the next call.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D75025
Roman Lebedev [Tue, 25 Aug 2020 07:25:34 +0000 (10:25 +0300)]
[InstCombine] PHI-of-insertvalues -> insertvalue-of-PHI's
As per statistic, this happens pretty exceedingly rare,
but i have seen it in exactly the situations the
Phi-aware aggregate reconstruction would have handled,
eventually, and allowed invoke -> call fold later on.
So while this might be something that other fold
will have to learn about, i believe we should be
doing this transform in general.
Here, we are okay with adding two PHI's to get both the base aggregate,
and the inserted value. I'm not sure it makes much sense to restrict
it to a single phi (to just the inserted value?), because originally
we'd be receiving the final aggregate already..
llvm test-suite + RawSpeed:
```
| statistic name | baseline | proposed | Δ | % | \|%\| |
|--------------------------------------------|-----------|-----------|-----:|-------:|------:|
| instcombine.NumPHIsOfInsertValues | 0 | 12 | 12 | 0.00% | 0.00% |
| asm-printer.EmittedInsts | 8926643 | 8926595 | -48 | 0.00% | 0.00% |
| instcombine.NumCombined | 3846614 | 3846640 | 26 | 0.00% | 0.00% |
| instcombine.NumConstProp | 24302 | 24293 | -9 | -0.04% | 0.04% |
| instcombine.NumDeadInst | 1620140 | 1620112 | -28 | 0.00% | 0.00% |
| instcount.NumBrInst | 898466 | 898464 | -2 | 0.00% | 0.00% |
| instcount.NumCallInst | 1760819 | 1760875 | 56 | 0.00% | 0.00% |
| instcount.NumExtractValueInst | 45659 | 45649 | -10 | -0.02% | 0.02% |
| instcount.NumInsertValueInst | 4991 | 4981 | -10 | -0.20% | 0.20% |
| instcount.NumIntToPtrInst | 27084 | 27087 | 3 | 0.01% | 0.01% |
| instcount.NumPHIInst | 371435 | 371429 | -6 | 0.00% | 0.00% |
| instcount.NumStoreInst | 906011 | 906019 | 8 | 0.00% | 0.00% |
| instcount.TotalBlocks | 1105520 | 1105518 | -2 | 0.00% | 0.00% |
| instcount.TotalInsts | 9795737 | 9795776 | 39 | 0.00% | 0.00% |
| simplifycfg.NumInvokes | 2784 | 2786 | 2 | 0.07% | 0.07% |
| simplifycfg.NumSimpl | 1001840 | 1001850 | 10 | 0.00% | 0.00% |
| simplifycfg.NumSinkCommonInstrs | 15174 | 15170 | -4 | -0.03% | 0.03% |
```
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D86306
Sam Parker [Tue, 25 Aug 2020 07:35:07 +0000 (08:35 +0100)]
[NFC][RDA] Add explicit def check
Explicitly check that there is a local def prior to the given
instruction in getReachingLocalMIDef instead of just relying on
a nullptr return from getInstFromId.
Rainer Orth [Tue, 25 Aug 2020 07:36:51 +0000 (09:36 +0200)]
[compiler-rt][asan][test] Set LD_LIBRARY_PATH_{32,64} on Solaris
The dynamically linked ASan tests rely on `LD_LIBRARY_PATH` to find
`libclang_rt.asan-*.so` at runtime.
However, the Solaris runtime linker `ld.so.1` also supports more specific
variables: `LD_LIBRARY_PATH_32` and `LD_LIBRARY_PATH_64` respectively. If
those happen to be set, `LD_LIBRARY_PATH` is ignored. In such a case, all
dynamically linked ASan tests `FAIL`. For i386 alone, this affects about
200 tests.
The following patch fixes that by also setting `LD_LIBRARY_PATH_{32,64}` on
Solaris.
Tested on `amd64-pc-solaris2.11` both with only `LD_LIBRARY_PATH` set and
with `LD_LIBRARY_PATH_{32,64}` set too.
Differential Revision: https://reviews.llvm.org/D86333
Mateusz Mikuła [Tue, 25 Aug 2020 07:16:40 +0000 (10:16 +0300)]
[Compiler-RT] Fix profiler building with MinGW GCC
Differential Revision: https://reviews.llvm.org/D86405