Fangrui Song [Thu, 6 Aug 2020 00:00:16 +0000 (17:00 -0700)]
[ELF][test] Add another -triple=x86_64 to linkorder-mixed.s
Fixes an error on macOS:
error: mach-o section specifier uses an unknown section type
Shoaib Meenai [Wed, 5 Aug 2020 23:59:53 +0000 (16:59 -0700)]
[lld-macho] Fix errant search and replace. NFC
Alina Sbirlea [Wed, 5 Aug 2020 23:12:09 +0000 (16:12 -0700)]
[MSSA] Update test with more detailed and resilient checks. [NFC]
aartbik [Wed, 5 Aug 2020 20:43:16 +0000 (13:43 -0700)]
[mlir] [VectorOps] Add masked load/store operations to Vector dialect
The intrinsics were already supported and vector.transfer_read/write lowered
direclty into these operations. By providing them as individual ops, however,
clients can used them directly, and it opens up progressively lowering transfer
operations at higher levels (rather than direct lowering to LLVM IR as done now).
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D85357
LLVM GN Syncbot [Wed, 5 Aug 2020 23:35:59 +0000 (23:35 +0000)]
[gn build] Port
820e8d8656e
Fangrui Song [Wed, 5 Aug 2020 23:33:54 +0000 (16:33 -0700)]
[ELF] Fix type of ciesWithLSDA after D84610
Fangrui Song [Wed, 5 Aug 2020 23:28:44 +0000 (16:28 -0700)]
[ELF][test] Add REQUIES: x86 and -triple=x86_64 to linkorder-mixed.s
Jan Korous [Tue, 30 Jun 2020 04:34:44 +0000 (21:34 -0700)]
[Analyzer][WebKit] UncountedLambdaCaptureChecker
Differential Revision: https://reviews.llvm.org/D82837
Fangrui Song [Wed, 5 Aug 2020 23:09:41 +0000 (16:09 -0700)]
[ELF] Allow SHF_LINK_ORDER sections to have sh_link=0
Part of https://bugs.llvm.org/show_bug.cgi?id=41734
The semantics of SHF_LINK_ORDER have been extended to represent metadata
sections associated with some other sections (usually text).
The associated text section may be discarded (e.g. LTO) and we want the
metadata section to have sh_link=0 (D72899, D76802).
Normally the metadata section is only referenced by the associated text
section. sh_link=0 means the associated text section is discarded, and
the metadata section will be garbage collected. If there is another
section (.gc_root) referencing the metadata section, the metadata
section will be retained. It's the .gc_root consumer's job to validate
the metadata sections.
# This creates a SHF_LINK_ORDER .meta with sh_link=0
.section .meta,"awo",@progbits,0
1:
.section .meta,"awo",@progbits,foo
2:
.section .gc_root,"a",@progbits
.quad 1b
.quad 2b
Reviewed By: pcc, jhenderson
Differential Revision: https://reviews.llvm.org/D72904
Petr Hosek [Thu, 30 Apr 2020 20:07:13 +0000 (13:07 -0700)]
[CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.
This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.
Differential Revision: https://reviews.llvm.org/D79219
Craig Topper [Wed, 5 Aug 2020 22:53:49 +0000 (15:53 -0700)]
[X86] Rename mod128.ll to divmod128.ll and add test cases for sdiv/udiv/urem.
This improves code coverage on the switch in LowerWin64_i128OP.
Arthur Eubanks [Wed, 5 Aug 2020 18:12:29 +0000 (11:12 -0700)]
[MSSA][NewPM] Handle tests with -print-memoryssa
-print-memoryssa in legacy PM is print<memoryssa> in NPM.
Pin tests with -print-memoryssa to legacy PM.
Add corresponding tests for NPM where missing.
This fixes "unknown pass name 'print-memoryssa'".
Some tests still fail in Analysis/MemorySSA due to other passes that
haven't been ported.
pr43427.ll and pr43438.ll required adding -aa-pipeline=basic-aa,
-loop-simplify (since it doesn't run on legacy PM by default), and
decrementing some of the MemoryPhi numbers.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D85333
Craig Topper [Wed, 5 Aug 2020 22:35:16 +0000 (15:35 -0700)]
[X86] Disable copy elision in LowerMemArgument for scalarized vectors when the loc VT is a different size than the original element.
For example a v4f16 argument is scalarized to 4 i32 values. So
the values are spread out instead of being packed tightly like
in the original vector.
Fixes PR47000.
Craig Topper [Wed, 5 Aug 2020 22:17:27 +0000 (15:17 -0700)]
[X86] Add test case for PR47000. NFC
Jonas Devlieghere [Wed, 5 Aug 2020 22:37:50 +0000 (15:37 -0700)]
[lldb] Skip test_launch_simple on Windows
Because stdio manipulation unsupported on Windows.
Alex Zinenko [Wed, 5 Aug 2020 12:44:03 +0000 (14:44 +0200)]
[mlir] use the new stateful LLVM type translator by default
Previous type model in the LLVM dialect did not support identified structure
types properly and therefore could use stateless translations implemented as
free functions. The new model supports identified structs and must keep track
of the identified structure types present in the target context (LLVMContext or
MLIRContext) to avoid creating duplicate structs due to LLVM's type
auto-renaming. Expose the stateful type translation classes and use them during
translation, storing the state as part of ModuleTranslation.
Drop the test type translation mechanism that is no longer necessary and update
the tests to exercise type translation as part of the main translation flow.
Update the code in vector-to-LLVM dialect conversion that relied on stateless
translation to use the new class in a stateless manner.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D85297
Greg Clayton [Wed, 29 Jul 2020 01:26:24 +0000 (18:26 -0700)]
Add verification for DW_AT_decl_file and DW_AT_call_file.
LTO builds have been creating invalid DWARF and one of the errors was a file index that was out of bounds. "llvm-dwarfdump --verify" will check all file indexes for line tables already, but there are no checks for the validity of file indexes in attributes.
The verification will verify if there is a DW_AT_decl_file/DW_AT_call_file that:
- there is a line table for the compile unit
- the file index is valid
- the encoding is appropriate
Tests are added that test all of the above conditions.
Differential Revision: https://reviews.llvm.org/D84817
Jonas Devlieghere [Wed, 5 Aug 2020 22:21:46 +0000 (15:21 -0700)]
[lldb] Skip TestProcessConnect when running remotely
This test doesn't make much sense when already running remotely.
Jonas Devlieghere [Wed, 5 Aug 2020 22:20:53 +0000 (15:20 -0700)]
[lldb] Modify the `skipIfRemote` decorator so we can skip all PExpect tests.
This patch modifies the skipIfRemote decorator so it can apply to a
whole class, which allows us to skip all PExpect tests as a whole.
Differential revision: https://reviews.llvm.org/D85365
Richard Smith [Wed, 5 Aug 2020 21:52:24 +0000 (14:52 -0700)]
CFG: Destroy temporaries in (a,b) expression in the correct order.
Sanjay Patel [Wed, 5 Aug 2020 21:04:21 +0000 (17:04 -0400)]
[InstCombine] fold icmp with 'mul nsw/nuw' and constant operands
This also removes a more specific fold that only handled icmp with 0.
https://rise4fun.com/Alive/sdM9
Name: mul nsw with icmp eq
Pre: (C1 != 0) && (C2 % C1) == 0
%a = mul nsw i8 %x, C1
%r = icmp eq i8 %a, C2
=>
%r = icmp eq i8 %x, C2 / C1
Name: mul nuw with icmp eq
Pre: (C1 != 0) && (C2 %u C1) == 0
%a = mul nuw i8 %x, C1
%r = icmp eq i8 %a, C2
=>
%r = icmp eq i8 %x, C2 /u C1
Name: mul nsw with icmp ne
Pre: (C1 != 0) && (C2 % C1) == 0
%a = mul nsw i8 %x, C1
%r = icmp ne i8 %a, C2
=>
%r = icmp ne i8 %x, C2 / C1
Name: mul nuw with icmp ne
Pre: (C1 != 0) && (C2 %u C1) == 0
%a = mul nuw i8 %x, C1
%r = icmp ne i8 %a, C2
=>
%r = icmp ne i8 %x, C2 /u C1
Sanjay Patel [Wed, 5 Aug 2020 20:26:14 +0000 (16:26 -0400)]
[InstCombine] add tests for icmp with mul nsw/nuw; NFC
Thomas Lively [Wed, 5 Aug 2020 21:00:01 +0000 (14:00 -0700)]
[WebAssembly] Fix types in wasm_simd128.h and add tests
47f7174ffa changed the types used in the Wasm SIMD builtin functions,
but not all of their uses in wasm_simd128.h were updated. This commit
fixes wasm_simd128.h and adds tests to make sure similar problems do
not pass uncaught in the future.
Differential Revision: https://reviews.llvm.org/D85347
Joel E. Denny [Wed, 5 Aug 2020 20:48:04 +0000 (16:48 -0400)]
[OpenMP] Fix `target data` exit for array extension
For example:
```
#pragma omp target data map(tofrom:arr[0:100])
{
#pragma omp target exit data map(delete:arr[0:100])
#pragma omp target enter data map(alloc:arr[98:2])
}
```
Without this patch, the transfer at the end of the target data region
is broken and fails depending on the target device. According to my
read of the spec, the transfer shouldn't even be attempted because
`arr[0:100]` isn't (fully) present there. To fix that, this patch
makes `DeviceTy::getTgtPtrBegin` return null for this case.
Reviewed By: grokos
Differential Revision: https://reviews.llvm.org/D85342
Joel E. Denny [Wed, 5 Aug 2020 20:47:29 +0000 (16:47 -0400)]
[OpenMP] Fix `present` diagnostic for array extension
For example, without this patch, the following fails as expected with
or without the `present` modifier, but the `present` modifier doesn't
produce its usual diagnostic:
```
#pragma omp target data map(alloc: arr[0:2])
{
#pragma omp target map(present, tofrom: arr[0:100]) // not fully present
;
}
```
Reviewed By: grokos, vzakhari
Differential Revision: https://reviews.llvm.org/D85320
cgyurgyik [Wed, 5 Aug 2020 20:36:52 +0000 (16:36 -0400)]
[libc] Add strspn implementation and std::bitset
Reviewed By: sivachandra, abrachet
Differential Revision: https://reviews.llvm.org/D85103
George Rokos [Wed, 5 Aug 2020 20:06:27 +0000 (13:06 -0700)]
[libomptarget][NFC] Replace `%ld` with PRId64 for data of type int64_t.
The standard way of printing `int64_t` data is via the PRId64 macro, `ld`
is for `long int` and int64_t is not guaranteed to be typedef'ed as `long int`
on all platforms. E.g. on Windows we get mismatch warnings.
Differential Revision: https://reviews.llvm.org/D85353
Stanislav Mekhanoshin [Tue, 4 Aug 2020 21:33:52 +0000 (14:33 -0700)]
[AMDGPU] Scavenge temp reg for AGPR spill
Differential Revision: https://reviews.llvm.org/D85234
Rahman Lavaee [Wed, 5 Aug 2020 19:31:24 +0000 (12:31 -0700)]
[Propeller]: Use a descriptive temporary symbol name for the end of the basic block.
This patch changes the functionality of AsmPrinter to name the basic block end labels as LBB_END${i}_${j}, with ${i} being the identifier for the function and ${j} being the identifier for the basic block. The new naming scheme is consistent with how basic block labels are named (.LBB${i}_{j}), and how function end symbol are named (.Lfunc_end${i}) and helps to write stronger tests for the upcoming patch for BB-Info section (as proposed in https://lists.llvm.org/pipermail/llvm-dev/2020-July/143512.html). The end label is used with basicblock-labels (BB-Info section in future) and basicblock-sections to compute the size of basic blocks and basic block sections, respectively. For BB sections, the section containing the entry basic block will not have a BB end label since it already gets the function end-label.
This label is cached for every basic block (CachedEndMCSymbol) like the label for the basic block (CachedMCSymbol).
Differential Revision: https://reviews.llvm.org/D83885
Jordan Rupprecht [Wed, 5 Aug 2020 20:16:01 +0000 (13:16 -0700)]
[lldb/test] Support git commit version ids for clang.
`getCompilerVersion` assumes that `clang --version` prints out a string like `version [0-9\.]+`.
If clang is built from trunk, the version line might look like `clang version trunk (123abc)`.
Since there isn't any way of knowing by the commit id alone whether one commit is newer or older than another git commit (or clang version), assume that clang with a version id like this is very close to trunk. For example, any tests with `@skipIf(compiler="clang", compiler_version=['<', '8'])` should be run.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D85248
Artem Belevich [Tue, 4 Aug 2020 18:52:54 +0000 (11:52 -0700)]
[CUDA] Work around a bug in rint/nearbyint caused by a broken implementation provided by CUDA.
Normally math functions are forwarded to __nv_* counterparts provided by CUDA's
libdevice bitcode. However, __nv_rint*()/__nv_nearbyint*() functions there have
a bug -- they use round() which rounds *up* instead of rounding towards the
nearest integer, so we end up with rint(2.5f) producing 3.0 instead of expected
2.0. The broken bitcode is not actually used by NVCC itself, which has both a
work-around in CUDA headers and, in recent versions, uses correct
implementations in NVCC's built-ins.
This patch implements equivalent workaround and directs rint*/nearbyint* to
__builtin_* variants that produce correct results.
Differential Revision: https://reviews.llvm.org/D85236
Matt Arsenault [Tue, 28 Jul 2020 21:36:14 +0000 (17:36 -0400)]
AMDGPU: Correct prolog SP initialization logic
Having callees that will read SP is not the only reason we need to
reference the stack pointer.
Stanislav Mekhanoshin [Wed, 5 Aug 2020 19:39:03 +0000 (12:39 -0700)]
[AMDGPU] Added missing gfx1031 cases to CGOpenMPRuntimeGPU.cpp
Stanislav Mekhanoshin [Wed, 5 Aug 2020 19:00:52 +0000 (12:00 -0700)]
[AMDGPU] gfx1031 target
Differential Revision: https://reviews.llvm.org/D85337
Arthur Eubanks [Wed, 5 Aug 2020 19:22:07 +0000 (12:22 -0700)]
[NewPM][LoopRotate] Rename rotate -> loop-rotate
To match legacy pass name.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D85338
Arthur Eubanks [Tue, 4 Aug 2020 21:34:51 +0000 (14:34 -0700)]
[Driver] Accept -fno-lto in clang-cl
Some compiler-rt tests check for the presence of the compiler accepting
-fno-lto to add that flag. Otherwise some tests don't link due to
-flto mismatch between compiling and linking.
$ cmake ... -DLLVM_ENABLE_LTO=Thin ...
$ ninja projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test.exe
previously failed, now links.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D85252
Matt Arsenault [Wed, 5 Aug 2020 01:20:39 +0000 (21:20 -0400)]
AMDGPU: Eliminate BUFFER_ATOMIC_PK_ADD_F16 node
This is redundant with the other no return buffer atomic node, and we
don't really need a separate type profile for it.
Kadir Cetinkaya [Wed, 5 Aug 2020 19:14:31 +0000 (21:14 +0200)]
[clangd][NFC] Delete dead code in ExtractFunction code action
Matt Morehouse [Wed, 5 Aug 2020 19:11:24 +0000 (12:11 -0700)]
Revert "Add libFuzzer shared object build output"
This reverts commit
98d91aecb26a51225242332e73ed454c0f6cac5e since it
breaks on platforms without libstdc++.
Kadir Cetinkaya [Wed, 5 Aug 2020 14:21:55 +0000 (16:21 +0200)]
[clangd] Disable define out-of-line code action on templates
Differential Revision: https://reviews.llvm.org/D85310
Lei Zhang [Mon, 13 Jul 2020 20:20:59 +0000 (16:20 -0400)]
[mlir][StandardToSPIRV] Use spv.UMod for index re-calculation
Per Vulkan's SPIR-V environment spec: "While the OpSRem and OpSMod
instructions are supported by the Vulkan environment, they require
non-negative values and thus do not enable additional functionality
beyond what OpUMod provides."
The `getOffsetForBitwidth` function is used for lowering std.load
and std.store, whose indices are of `index` type and cannot be
negative. So we should be okay to use spv.UMod directly here to
be exact. Also made the comment explicit about the assumption.
Differential Revision: https://reviews.llvm.org/D83714
Roman Lebedev [Wed, 5 Aug 2020 18:20:47 +0000 (21:20 +0300)]
[InstCombine] Negator: -(cond ? x : -x) --> cond ? -x : x
We were errneously only doing that for old-style abs/nabs,
but we have no such legality check on the condition of the select.
https://rise4fun.com/Alive/xBHS
Roman Lebedev [Wed, 5 Aug 2020 18:16:20 +0000 (21:16 +0300)]
[NFC][InstCombine] Add tests for negation of old-style [n]abs, select-of-op-vs-negation-of-op
Matt Arsenault [Wed, 5 Aug 2020 00:41:53 +0000 (20:41 -0400)]
AMDGPU: Refactor buffer atomic intrinsic lowering
Move raw/struct buffer atomic lowering to separate functions. This
avoids a long nested switch, and simplifies a future patch.
Lei Zhang [Wed, 5 Aug 2020 14:06:00 +0000 (10:06 -0400)]
[spirv] Fix bitwidth emulation for Workgroup storage class
If Int16 is not available, 16-bit integers inside Workgroup storage
class should be emulated via 32-bit integers. This was previously
broken because the capability querying logic was incorrectly
intercepting all storage classes where it meant to only handle
interface storage classes. Adjusted where we return to fix this.
Differential Revision: https://reviews.llvm.org/D85308
Matt Arsenault [Wed, 5 Aug 2020 18:43:21 +0000 (14:43 -0400)]
AMDGPU: Remove leftover test
Matt Arsenault [Wed, 5 Aug 2020 13:42:14 +0000 (09:42 -0400)]
AMDGPU: Fix verifier error with undef source producing s_bitset*
This needs to preserve the undef flag.
Sanjay Patel [Wed, 5 Aug 2020 18:37:05 +0000 (14:37 -0400)]
[InstSimplify] fold icmp with mul nsw and constant operands
https://rise4fun.com/Alive/slvl
Name: mul nsw with icmp eq
Pre: (C2 % C1) != 0
%a = mul nsw i8 %x, C1
%r = icmp eq i8 %a, C2
=>
%r = false
Name: mul nsw with icmp ne
Pre: (C2 % C1) != 0
%a = mul nsw i8 %x, C1
%r = icmp ne i8 %a, C2
=>
%r = true
Follow-up to the 'nuw' variation added with:
rGf879c9b79621
Jordan Rupprecht [Wed, 5 Aug 2020 18:35:37 +0000 (11:35 -0700)]
[lldb/test] Use realpath consistently for test root file paths.
LLDB tests assume that tests are in the test tree (the `LLDB_TEST_SRC` env variable, configured by `dotest.py`).
If this assertion doesn't hold, tests fail in strange ways. An early place this goes wrong is in `compute_mydir` which does a simple length-based substring to get the relative path. Later, we use that path to chdir to. If the test file and test tree don't agree in realpath-ness (and therefore length), this will be a cryptic error of chdir-ing to a directory that does not exist.
The actual discrepency is that the places we look for `use_lldb_suite.py` don't use a realpath, but `dotest.py` does (see initialization of `configuration.testdirs`).
It doesn't particularly matter whether we use realpath or abspath to canonicalize things, but many places end up with implicit dependencies on the canonicalized pwd being a realpath, so make them realpath consistently. Also, in the `compute_mydir` method mentioned, raise an error if the path types don't agree.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D85258
Sanjay Patel [Wed, 5 Aug 2020 17:41:05 +0000 (13:41 -0400)]
[InstSimplify] fold icmp with mul nuw and constant operands
https://rise4fun.com/Alive/pZEr
Name: mul nuw with icmp eq
Pre: (C2 %u C1) != 0
%a = mul nuw i8 %x, C1
%r = icmp eq i8 %a, C2
=>
%r = false
Name: mul nuw with icmp ne
Pre: (C2 %u C1) != 0
%a = mul nuw i8 %x, C1
%r = icmp ne i8 %a, C2
=>
%r = true
There are potentially several other transforms we need to add based on:
D51625
...but it doesn't look like there was follow-up to that patch.
Sanjay Patel [Wed, 5 Aug 2020 17:09:20 +0000 (13:09 -0400)]
[InstSimplify] add vector tests for icmp with mul nuw; NFC
Also, the naming was off on a couple of tests.
Mitchell Balan [Wed, 5 Aug 2020 18:29:57 +0000 (14:29 -0400)]
[clang-format] fix BreakBeforeBraces.MultiLine with for each macros
Summary:
The MultiLine option in BreakBeforeBraces was only handling standard
control statement, leading to invalid indentation with for each macros:
Previous behavior:
/* invalid: brace should be on the same line */
Q_FOREACH(int a; list)
{
foo();
}
/* valid */
Q_FOREACH(int longVariable;
list)
{
foo();
}
To fix this, simply add the TT_ForEachMacro kind in the list of
recognized control statements for the multiline option.
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=44632
Reviewers: MyDeveloperDay, mitchell-stellar
Reviewed by: mitchell-stellar
Contributed by: vthib
Subscribers: cfe-commits
Tags: #clang, #clang-format, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D85304
Valentin Clement [Wed, 5 Aug 2020 18:20:26 +0000 (14:20 -0400)]
[flang][NFC] Unify OpenMP and OpenACC structure checker
This patch remove duplicated code between the check-omp-structure and the check-acc-structure
and unify it into a check-directive-structure templated class.
Reviewed By: kiranchandramohan, sscalpone, ichoyjx
Differential Revision: https://reviews.llvm.org/D85104
Alexander Belyaev [Wed, 5 Aug 2020 16:41:29 +0000 (18:41 +0200)]
[mlir][nfc] Rename `promoteMemRefDescriptors` to `promoteOperands`.
`promoteMemRefDescriptors` also converts types of every operand, not only
memref-typed ones. I think `promoteMemRefDescriptors` name does not imply that.
Differential Revision: https://reviews.llvm.org/D85325
Matt Morehouse [Wed, 5 Aug 2020 18:11:42 +0000 (11:11 -0700)]
[libFuzzer] Do not link pthreads on Android.
Android has pthreads included in bionic and doesn't recognize -lpthread.
Vincent Zhao [Wed, 5 Aug 2020 18:06:17 +0000 (20:06 +0200)]
[MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg.
Previously, `LinalgOperand` is defined with `Type<Or<..,>>`, which produces
not very readable error messages when it is not matched, e.g.,
```
'linalg.generic' op operand #0 must be anonymous_326, but got ....
```
It is simply because the `description` property is not properly set.
This diff switches to use `AnyTypeOf` for `LinalgOperand`, which automatically
generates a description based on the allowed types provided.
As a result, the error message now becomes:
```
'linalg.generic' op operand #0 must be ranked tensor of any type values or strided memref of any type values, but got ...
```
Which is clearer and more informative.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D84428
Paul C. Anagnostopoulos [Wed, 5 Aug 2020 18:09:12 +0000 (11:09 -0700)]
Remove Olesen from LLVM code owners
I contacted Jakob Olesen about TableGen and he replied that he is no longer involved with the project.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D84958
Haojian Wu [Wed, 5 Aug 2020 18:03:21 +0000 (20:03 +0200)]
[clangd] Hide "swap if branch" tweak
This tweak is more like a demo, and doesn't provide much value in
practice.
Differential Revision: https://reviews.llvm.org/D85318
Erich Keane [Wed, 5 Aug 2020 17:52:42 +0000 (10:52 -0700)]
Fix _ExtInt(1) to be a i1 in memory.
The _ExtInt(1) in getTypeForMem was hitting the bool logic for expanding
to an 8 bit value. The result was an assert, or store i1 %0, i8* %2, align 1
since the parameter IS an i1. This patch changes the 'forMem' test to
exclude ext-int from the bool test.
Alexey Bataev [Tue, 4 Aug 2020 15:42:26 +0000 (11:42 -0400)]
[LIBOMPTARGET]Fix order of mapper data for targetDataEnd function.
targetDataMapper function fills arrays with the mapping data in the
direct order. When this function is called by targetDataBegin or
tgt_target_update functions, it works as expected. But targetDataEnd
function processes mapped data in reverse order. In this case, the base
pointer might be deleted before the associated data is deleted. Need to
reverse data, mapped by mapper, too, since it always adds data that must
be deleted at the end of the buffer.
Fixes the test declare_mapper_target_update.cpp.
Also, reduces the memry fragmentation by preallocation the memory
buffers.
Differential Revision: https://reviews.llvm.org/D85216
Evgenii Stepanov [Tue, 4 Aug 2020 23:46:35 +0000 (16:46 -0700)]
[msan] Remove readnone and friends from call sites.
MSan removes readnone/readonly and similar attributes from callees,
because after MSan instrumentation those attributes no longer apply.
This change removes the attributes from call sites, as well.
Failing to do this may cause DSE of paramTLS stores before calls to
readonly/readnone functions.
Differential Revision: https://reviews.llvm.org/D85259
Simon Pilgrim [Wed, 5 Aug 2020 17:09:22 +0000 (18:09 +0100)]
[X86][SSE] Fold 128-bit PACK(EXTEND(X),EXTEND(Y)) -> CONCAT(X,Y) subvectors
This is seen in the sub-128-bit vector trunc(ext()) of comparison results
Fixes pr46585.ll regression in D66004
Jordan Rupprecht [Wed, 5 Aug 2020 17:22:27 +0000 (10:22 -0700)]
Revert "[LoopVectorizer] Inloop vector reductions"
This reverts commit
e9761688e41cb979a1fa6a79eb18145a75104933. It breaks the build:
```
~/src/llvm-project/llvm/lib/Analysis/IVDescriptors.cpp:868:10: error: no viable conversion from returned value of type 'SmallVector<[...], 8>' to function return type 'SmallVector<[...], 4>'
return ReductionOperations;
```
Mircea Trofin [Wed, 5 Aug 2020 17:22:45 +0000 (10:22 -0700)]
[TFUtils] Expose untyped accessor to evaluation result tensors
These were implementation detail, but become necessary for generic data
copying.
Also added const variations to them, and move assignment, since we had a
move ctor (and the move assignment helps in a subsequent patch).
Differential Revision: https://reviews.llvm.org/D85262
Jordan Rupprecht [Wed, 5 Aug 2020 15:50:41 +0000 (08:50 -0700)]
[lldb/test] Replace LLDB_TEST_SRC env variable with configuration
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D85322
Julian Lettner [Wed, 5 Aug 2020 17:11:50 +0000 (10:11 -0700)]
[ASan][Darwin] Adapt test for macOS 11+ version scheme
This test depends on the versioning scheme of OSX.
David Green [Wed, 5 Aug 2020 17:14:05 +0000 (18:14 +0100)]
[LoopVectorizer] Inloop vector reductions
Arm MVE has multiple instructions such as VMLAVA.s8, which (in this
case) can take two 128bit vectors, sign extend the inputs to i32,
multiplying them together and sum the result into a 32bit general
purpose register. So taking 16 i8's as inputs, they can multiply and
accumulate the result into a single i32 without any rounding/truncating
along the way. There are also reduction instructions for plain integer
add and min/max, and operations that sum into a pair of 32bit registers
together treated as a 64bit integer (even though MVE does not have a
plain 64bit addition instruction). So giving the vectorizer the ability
to use these instructions both enables us to vectorize at higher
bitwidths, and to vectorize things we previously could not.
In order to do that we need a way to represent that the reduction
operation, specified with a llvm.experimental.vector.reduce when
vectorizing for Arm, occurs inside the loop not after it like most
reductions. This patch attempts to do that, teaching the vectorizer
about in-loop reductions. It does this through a vplan recipe
representing the reductions that the original chain of reduction
operations is replaced by. Cost modelling is currently just done through
a prefersInloopReduction TTI hook (which follows in a later patch).
Differential Revision: https://reviews.llvm.org/D75069
Roman Lebedev [Wed, 5 Aug 2020 17:11:48 +0000 (20:11 +0300)]
[NFC][InstCombine] Negator: include all the needed headers, IWYU
Jonas Devlieghere [Wed, 5 Aug 2020 17:02:51 +0000 (10:02 -0700)]
[lldb] Add an option to inherit TCC permissions from parent.
Add an option that allows the user to decide to not make the inferior is
responsible for its own TCC permissions. If you don't make the inferior
responsible, it inherits the permissions of its parent. The motivation
is the scenario of running the LLDB test suite from an external hard
drive. If the inferior is responsible, every test needs to be granted
access to the external volume. When the permissions are inherited,
approval needs to be granted only once.
Differential revision: https://reviews.llvm.org/D85237
Jonas Devlieghere [Wed, 5 Aug 2020 16:34:18 +0000 (09:34 -0700)]
[lldb] Make SBTarget::LaunchSimple start form the target's LaunchInfo
Currently SBTarget::LaunchSimple creates a new LaunchInfo which means it
ignores any target properties that have been set. Instead, it should
start from the target's LaunchInfo and populated the specified fields.
Differential revision: https://reviews.llvm.org/D85235
Ted Woodward [Thu, 30 Jul 2020 18:37:43 +0000 (13:37 -0500)]
Remove special Hexagon packet traversal code
On Hexagon, breakpoints need to be on the first instruction of a packet.
When the LLVM disassembler for Hexagon returned 32 bit instructions, we
needed code to find the start of the current packet. Now that the LLVM
disassembler for Hexagon returns packets instead of instructions, we always
have the first instruction of the packet. Remove the packet traversal code
because it can cause problems when the next packet has more than one
instruction.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D84966
Roman Lebedev [Wed, 5 Aug 2020 16:17:56 +0000 (19:17 +0300)]
[InstCombine] Negator: 0 - (X + Y) --> (-X) - Y iff a single operand negated
This was the most obvious regression in
f5df5cd5586ae9cfb2d9e53704dfc76f47aff149.
f5df5cd5586ae9cfb2d9e53704dfc76f47aff149
We really don't want to do this if the original/outermost subtraction
isn't a negation, and therefore doesn't go away - just sinking negation
isn't a win. We are actually appear to be missing folds so hoist it.
https://rise4fun.com/Alive/tiVe
Roman Lebedev [Wed, 5 Aug 2020 16:06:40 +0000 (19:06 +0300)]
[NFC][InstCombine] Tests for negation of `add` w/ single negatible operand
Sanjay Patel [Wed, 5 Aug 2020 16:26:56 +0000 (12:26 -0400)]
[InstSimplify] add tests for icmp with 'mul nuw' operand; NFC
Uday Bondhugula [Wed, 5 Aug 2020 16:33:35 +0000 (22:03 +0530)]
[MLIR][NFC] Fix clang-tidy warnings in std to llvm conversion
Fix clang-tidy warnings in std to llvm conversion.
Alexander Belyaev [Wed, 5 Aug 2020 13:30:21 +0000 (15:30 +0200)]
[mlir] Fix rank bitwidth in UnrankedMemRefType conversion.
Differential Revision: https://reviews.llvm.org/D85300
Fangrui Song [Wed, 5 Aug 2020 16:30:23 +0000 (09:30 -0700)]
[ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD
GNU ld allows sections after a non-SHF_ALLOC section to be covered by PT_LOAD
(PR37607) and assigns addresses to non-SHF_ALLOC output sections (similar to
SHF_ALLOC NOBITS sections. The location counter is not advanced).
This patch tries to fix PR37607 (remove a special case in
`Writer<ELFT>::createPhdrs`). To make the created PT_LOAD meaningful, we cannot
reset dot to 0 for a middle non-SHF_ALLOC output section. This results in
removal of two special cases in LinkerScript::assignOffsets. Non-SHF_ALLOC
non-orphan sections can have non-zero addresses like in GNU ld.
The zero address rule for non-SHF_ALLOC sections is weakened to apply to orphan
only. This results in a special case in createSection and findOrphanPos, respectively.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D85100
Fangrui Song [Tue, 4 Aug 2020 23:05:14 +0000 (16:05 -0700)]
[ELF] --icf: don't fold text sections with LSDA
Fix PR36272 and PR46835
A .eh_frame FDE references a text section and (optionally) a LSDA (in
.gcc_except_table). Even if two text sections have identical content and
relocations (e.g. a() and b()), we cannot fold them if their LSDA are different.
```
void foo();
void a() {
try { foo(); } catch (int) { }
}
void b() {
try { foo(); } catch (float) { }
}
```
Scan .eh_frame pieces with LSDA and disallow referenced text sections to be
folded. If two .gcc_except_table have identical semantics (usually identical
content with PC-relative encoding), we will lose folding opportunity.
For ClickHouse (an exception-heavy application), this can reduce --icf=all efficiency
from 9% to 5%. There may be some percentage we can reclaim without affecting
correctness, if we analyze .eh_frame and .gcc_except_table sections.
gold 2.24 implemented a more complex fix (resolution to
https://sourceware.org/bugzilla/show_bug.cgi?id=21066) which combines the
checksum of .eh_frame CIE/FDE pieces.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D84610
Fangrui Song [Wed, 5 Aug 2020 16:04:56 +0000 (09:04 -0700)]
[ELF] --oformat=binary: use LMA to compute file offsets
--oformat=binary is rare (used in a few places in FreeBSD, see `stand/i386/mbr/Makefile` `LDFLAGS_BIN`)
The result should be identical to a normal output transformed by `objcopy -O binary`.
The current implementation ignores addresses and lays out sections by
respecting output section alignments. It can fail when an output section
address is specified, e.g. `.rodata ALIGN(16) :` (PR33651).
Fix PR33651 by respecting LMA. The code is similar to
`tools/llvm-objcop/ELF/Object.cpp` BinaryWriter::finalize after D71035 and D79229.
Unforunately for an output section without PT_LOAD, we assume its LMA is equal
to its VMA. So the result is still incorrect when an output section LMA
(`AT(...)`) is specified
Also drop `alignTo(off, config->wordsize)`. GNU ld does not round up the file size.
Differential Revision: https://reviews.llvm.org/D85086
Matt Morehouse [Wed, 5 Aug 2020 15:15:57 +0000 (08:15 -0700)]
Add libFuzzer shared object build output
This change adds a CMake rule to produce shared object versions of
libFuzzer (no-main). Like the static library versions, these shared
libraries have a copy of libc++ statically linked in. For i386 we don't
link with libc++ since i386 does not support mixing position-
independent and non-position-independent code in the same library.
Patch By: IanPudney
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D84947
Lang Hames [Wed, 5 Aug 2020 04:25:48 +0000 (21:25 -0700)]
[JITLink][AArch64] Handle addends on PAGE21 / PAGEOFF12 relocations.
Lang Hames [Wed, 5 Aug 2020 04:01:41 +0000 (21:01 -0700)]
[JITLink][AArch64] Improve debug output for addend relocations.
Saleem Abdulrasool [Sat, 20 Jun 2020 04:13:03 +0000 (21:13 -0700)]
MachO: support `-syslibroot`
This adds support for the `-syslibroot` option. This is required to
make the library search order actually function. With this, it is now
possible to link a test Darwin x86_64 program with lld on Darwin.
Differential Revision: https://reviews.llvm.org/D82252
Reviewed By: Jez Ng
Sanjay Patel [Wed, 5 Aug 2020 15:30:25 +0000 (11:30 -0400)]
[InstSimplify] reduce code duplication in simplifyICmpWithMinMax(); NFC
Kadir Cetinkaya [Wed, 5 Aug 2020 11:34:05 +0000 (13:34 +0200)]
[clangd] Fix a crash in DefineInline
Differential Revision: https://reviews.llvm.org/D85291
Hans Wennborg [Wed, 5 Aug 2020 15:11:59 +0000 (17:11 +0200)]
Bump forgotten version nbr in llvm/docs/conf.py
Chris Gyurgyik [Wed, 5 Aug 2020 15:05:50 +0000 (11:05 -0400)]
[libc] [obvious] Add ctype functions to linux api.
Adds isspace, isprint, and isxdigit to Linux API to fix failed integration test.
cgyurgyik [Wed, 5 Aug 2020 14:42:30 +0000 (10:42 -0400)]
[libc] Add isspace, isprint, isxdigit implementations.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D85270
Simon Pilgrim [Wed, 5 Aug 2020 14:09:37 +0000 (15:09 +0100)]
[X86] isHorizontalBinOp - only update LHS/RHS references on success
We've had issues in the past where isHorizontalBinOp calls would affect later combines as the LHS/RHS references had been commuted but still failed to match.
Simon Pilgrim [Wed, 5 Aug 2020 13:30:26 +0000 (14:30 +0100)]
[X86][AVX] Fold CONCAT(HOP(X,Y),HOP(Z,W)) -> HOP(CONCAT(X,Z),CONCAT(Y,W)) for integer types
Georgii Rymar [Wed, 5 Aug 2020 13:30:28 +0000 (16:30 +0300)]
[llvm-readobj] - Make decode_relrs() don't return Expected<>. NFCI.
The `decode_relrs` helper is declared as:
`Expected<std::vector<Elf_Rel>> decode_relrs(Elf_Relr_Range relrs) const;`
it never returns an error though and hence can be simplified to return
a vector.
Differential revision: https://reviews.llvm.org/D85302
Joel E. Denny [Wed, 5 Aug 2020 13:00:12 +0000 (09:00 -0400)]
[OpenMP] Fix `omp target update` for array extension
OpenMP TR8 sec. 2.15.6 "target update Construct", p. 183, L3-4 states:
> If the corresponding list item is not present in the device data
> environment and there is no present modifier in the clause, then no
> assignment occurs to or from the original list item.
L10-11 states:
> If a present modifier appears in the clause and the corresponding
> list item is not present in the device data environment then an
> error occurs and the program termintates.
(OpenMP 5.0 also has the first passage but without mention of the
present modifier of course.)
In both passages, I assume "is not present" includes the case of
partially but not entirely present. However, without this patch, the
target update directive misbehaves in this case both with and without
the present modifier. For example:
```
#pragma omp target enter data map(to:arr[0:3])
#pragma omp target update to(arr[0:5]) // might fail on data transfer
#pragma omp target update to(present:arr[0:5]) // might fail on data transfer
```
The problem is that `DeviceTy::getTgtPtrBegin` does not return a null
pointer in that case, so `target_data_update` sees the data as fully
present, and the data transfer then might fail depending on the target
device. However, without the present modifier, there should never be
a failure. Moreover, with the present modifier, there should always
be a failure, and the diagnostic should mention the present modifier.
This patch fixes `DeviceTy::getTgtPtrBegin` to return null when
`target_data_update` is the caller. I'm wondering if it should do the
same for more callers.
Reviewed By: grokos, jdoerfert
Differential Revision: https://reviews.llvm.org/D85246
Joel E. Denny [Wed, 5 Aug 2020 12:55:22 +0000 (08:55 -0400)]
[OpenMP][Docs] Mark `present` map type modifier as done
Joel E. Denny [Wed, 5 Aug 2020 12:53:58 +0000 (08:53 -0400)]
[OpenMP][Docs] Add map clause reordering status as unclaimed
Joel E. Denny [Wed, 5 Aug 2020 12:45:33 +0000 (08:45 -0400)]
[OpenMP] Fix `present` for exit from `omp target data`
Without this patch, the following example fails but shouldn't
according to OpenMP TR8:
```
#pragma omp target enter data map(alloc:i)
#pragma omp target data map(present, alloc: i)
{
#pragma omp target exit data map(delete:i)
} // fails presence check here
```
OpenMP TR8 sec. 2.22.7.1 "map Clause", p. 321, L23-26 states:
> If the map clause appears on a target, target data, target enter
> data or target exit data construct with a present map-type-modifier
> then on entry to the region if the corresponding list item does not
> appear in the device data environment an error occurs and the
> program terminates.
There is no corresponding statement about the exit from a region.
Thus, the `present` modifier should:
1. Check for presence upon entry into any region, including a `target
exit data` region. This behavior is already implemented correctly.
2. Should not check for presence upon exit from any region, including
a `target` or `target data` region. Without this patch, this
behavior is not implemented correctly, breaking the above example.
In the case of `target data`, this patch fixes the latter behavior by
removing the `present` modifier from the map types Clang generates for
the runtime call at the end of the region.
In the case of `target`, we have not found a valid OpenMP program for
which such a fix would matter. It appears that, if a program can
guarantee that data is present at the beginning of a `target` region
so that there's no error there, that data is also guaranteed to be
present at the end. This patch adds a comment to the runtime to
document this case.
Reviewed By: grokos, RaviNarayanaswamy, ABataev
Differential Revision: https://reviews.llvm.org/D84422
Denis Antrushin [Wed, 10 Jun 2020 13:01:19 +0000 (20:01 +0700)]
[Statepoints] Operand folding in presense of tied registers.
Implement proper folding of statepoint meta operands (deopt and GC)
when statepoint uses tied registers.
For deopt operands it is just about properly preserving tiedness
in new instruction.
For tied GC operands folding is a little bit more tricky.
We can fold tied GC operands only from InlineSpiller, because it knows
how to properly reload tied def after it was turned into memory operand.
Other users (e.g. peephole) cannot properly fold such operands as they
do not know how (or when) to reload them from memory.
We do this by un-tieing operand we want to fold in InlineSpiller
and allowing to fold only untied operands in foldPatchpoint.
Bruno Ricci [Wed, 5 Aug 2020 13:12:05 +0000 (14:12 +0100)]
[clang] Add -fno-delayed-template-parsing to the added unit tests in DeclPrinterTest.cpp
Alex Zinenko [Wed, 5 Aug 2020 12:36:16 +0000 (14:36 +0200)]
[mlir] Initial version of C APIs
Introduce an initial version of C API for MLIR core IR components: Value, Type,
Attribute, Operation, Region, Block, Location. These APIs allow for both
inspection and creation of the IR in the generic form and intended for wrapping
in high-level library- and language-specific constructs. At this point, there
is no stability guarantee provided for the API.
Reviewed By: stellaraccident, lattner
Differential Revision: https://reviews.llvm.org/D83310
Roman Lebedev [Wed, 5 Aug 2020 11:55:29 +0000 (14:55 +0300)]
Recommit "[InstCombine] Negator: -(X << C) --> X * (-1 << C)"
This reverts commit
ac70b37a00dc02bd8923e0a4602d26be4581c570
which reverted commit
8aeb2fe13a4100b4c2e78d6ef75119304100cb1f
because codegen tests got broken and i needed time to investigate.
This shows some regressions in tests, but they are all around GEP's,
so i'm not really sure how important those are.
https://rise4fun.com/Alive/1Gn
Nico Weber [Wed, 5 Aug 2020 12:52:55 +0000 (08:52 -0400)]
[gn build] (manually) merge
3ab01550b
This reverts commit
0bbaacc8cae0373d4500c4e3f6f128d21f9033b7 and
2ad56119f5dc6c6af2b8ddfd9fc8c6460a7507c8 which merged
10b1b4a23
(and follow-ups), since that change was reverted in
3ab01550b.