Mitchell Balan [Wed, 11 Mar 2020 19:53:12 +0000 (15:53 -0400)]
[clang-format] Add option to specify explicit config file
Summary:
This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when adding IDE commands to reformat code to a personal style.
Reviewers: djasper, ioeric, krasimir, MyDeveloperDay
Reviewed by: MyDeveloperDay
Contributed by: tnorth
Subscribers: cfe-commits, lebedev.ri, MyDeveloperDay, klimek, sammccall, mitchell-stellar
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D72326
Sanjay Patel [Wed, 11 Mar 2020 18:35:31 +0000 (14:35 -0400)]
[InstCombine] reduce demand-limited bool math to logic
The cmp math test is inspired by memcmp() patterns seen in D75840.
I know there's at least 1 related fold we can do here if both
values are sext'd, but I'm not seeing a way to generalize further.
We have some other bool math patterns that we want to reduce, but
that might require fixing the bogus transforms noted in D72396.
Alive proof translations of the regression tests:
https://rise4fun.com/Alive/zGWi
Name: demand add 1
%xz = zext i1 %x to i32
%ys = sext i1 %y to i32
%sub = add i32 %xz, %ys
%r = lshr i32 %sub, 31
=>
%notx = xor i1 %x, 1
%and = and i1 %y, %notx
%r = zext i1 %and to i32
Name: demand add 2
%xz = zext i1 %x to i5
%ys = sext i1 %y to i5
%sub = add i5 %xz, %ys
%r = and i5 %sub, 16
=>
%notx = xor i1 %x, 1
%and = and i1 %y, %notx
%r = select i1 %and, i5 -16, i5 0
Name: demand add 3
%xz = zext i1 %x to i8
%ys = sext i1 %y to i8
%a = add i8 %ys, %xz
%r = ashr i8 %a, 7
=>
%notx = xor i1 %x, 1
%and = and i1 %y, %notx
%r = sext i1 %and to i8
Name: cmp math
%gt = icmp ugt i32 %x, %y
%lt = icmp ult i32 %x, %y
%xz = zext i1 %gt to i32
%yz = zext i1 %lt to i32
%s = sub i32 %xz, %yz
%r = lshr i32 %s, 31
=>
%r = zext i1 %lt to i32
Differential Revision: https://reviews.llvm.org/D75961
Sanjay Patel [Tue, 10 Mar 2020 21:14:41 +0000 (17:14 -0400)]
[InstCombine] add tests for bool math; NFC
Adrian Prantl [Wed, 11 Mar 2020 17:44:15 +0000 (10:44 -0700)]
Add a verification mechanism to CompilerType.
Badly-written code can combine an unrelated TypeSystem and opaque type
pointer into a CompilerType. This is particularly an issue in
swift-lldb. This patch adds an assertion mechanism that catches these
kinds of mistakes early. Because this is an assertion-only code path
there is not cost for release builds.
Differential Revision: https://reviews.llvm.org/D76011
Matt Arsenault [Wed, 11 Mar 2020 15:49:03 +0000 (11:49 -0400)]
AMDGPU: Don't hard error on LDS globals in functions
Instead, emit a trap and a warning. We force inlining of this
situation, so any function where this happens should be dead as
indirect or external calls are not yet supported. This should avoid
erroring on dead code.
Philip Reames [Wed, 11 Mar 2020 18:12:28 +0000 (11:12 -0700)]
[GC] Loosen ordering on statepoint reloads to allow CSE
We just removed a broken duplicate elimination algorithm in D75964, and after landed that it occurred to me that duplicate elimination is simply CSE. SelectionDAG has a build in CSE, so why wasn't that triggering? Well, it turns out we were overly conservative in the memory states for our reloads and CSE (rightly) considers the incoming memory state for a load part of the identity of the load.
By loosening the chain and allowing reordering, we also allow CSE. As shown in the test case, doing iterative CSE as we go is enough to eliminate duplicate stores in later statepoints as well. We key our (block local) slot map by SDValue, so commoning a previous pair of loads at construction time means we also common following stores.
Differential Revision: https://reviews.llvm.org/D76013
Paula Toth [Wed, 11 Mar 2020 19:12:35 +0000 (12:12 -0700)]
[clang-tidy] Mock system headers for portability-restrict-system-includes tests.
Summary: Didn't realize that headers such as stddef.h may not exist on all systems. This patch mocks the headers so that the check's tests work on all systems. (:
Reviewers: RKSimon, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D76015
Stephen Neuendorffer [Fri, 6 Mar 2020 23:46:51 +0000 (15:46 -0800)]
[MLIR] Link MLIRMlirOptMain with the same libraries as mlir-opt
MLIRMlirOptMain seems to need the same libraries as mlir-opt.
Differential Revision: https://reviews.llvm.org/D75783
Simon Pilgrim [Wed, 11 Mar 2020 18:55:18 +0000 (18:55 +0000)]
[DAG] MatchRotate - Add funnel shift by immediate support
This patch reuses the existing MatchRotate ROTL/ROTR rotation pattern code to also recognize the more general FSHL/FSHR funnel shift patterns when we have constant shift amounts.
Differential Revision: https://reviews.llvm.org/D75114
Stephen Neuendorffer [Wed, 11 Mar 2020 16:50:19 +0000 (09:50 -0700)]
[MLIR] Do not link mlir-cpu-runner with X86 libs
The three libs where recently added to the `mlir-cpu-runner`'s
`CMakeLists.txt` file. This prevent the runner to compile on other
platform (e.g. Power in my case). Native codegen is pulled in
by the ExecutionEngine library, so this is redundant in any case.
Differential Revision: https://reviews.llvm.org/D75916
Sergej Jaskiewicz [Mon, 17 Feb 2020 12:22:18 +0000 (15:22 +0300)]
Temporarily re-apply https://reviews.llvm.org/D74347
It was reverted in
35367e06b84618e21945674aa22e7cfda1957ea4
because it broke the buildbot due to missing libc++abi headers.
https://reviews.llvm.org/D75991 improves the diagnostics, so I hope
the build log will be more informative.
Francesco Petrogalli [Wed, 11 Mar 2020 18:25:29 +0000 (18:25 +0000)]
[llvm][CodeGen] IR intrinsics for SVE2 contiguous conflict detection instructions.
Summary:
The IR intrinsics are mapped to the following SVE2 instructions:
* WHILERW <Pd>.<T>, <Xn>, <Xm>
* WHILEWR <Pd>.<T>, <Xn>, <Xm>
The intrinsics introduced in this patch are the IR counterpart of the
SVE ACLE functions `svwhilerw` and `svwhilewr` (all data type
variants).
Patch by Maciej Gąbka <maciej.gabka@arm.com>.
Reviewers: kmclaughlin, rengolin
Reviewed By: kmclaughlin
Subscribers: tschuett, kristof.beyls, hiraditya, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75862
Stanislav Mekhanoshin [Tue, 10 Mar 2020 20:29:11 +0000 (13:29 -0700)]
[AMDGPU] Disable nested endcf collapse
The assumption is that conditional regions are perfectly nested
and a mask restored at the exit from the inner block will be
completely covered by a mask restored in the outer.
It turns out with our current structurizer this is not always
the case.
Disable the optimization for now, but I want to keep it around
for a while to either try after further structurizer changes or
to move it into control flow lowering where we have more info
and reuse the test.
Differential Revision: https://reviews.llvm.org/D75958
Tim Shen [Wed, 26 Feb 2020 04:16:08 +0000 (20:16 -0800)]
[MLIR] Guard DMA-specific logic with DMA option
Differential Revision: https://reviews.llvm.org/D75963
Juneyoung Lee [Mon, 9 Mar 2020 16:37:36 +0000 (01:37 +0900)]
[CodeGenPrepare] Fold br(freeze(icmp x, const)) to br(icmp(freeze x, const))
Summary:
This patch helps CodeGenPrepare move freeze into the icmp when it is used by branch.
It reenables generation of efficient conditional jumps.
This is only done when at least one of icmp's operands is constant to prevent the transformation from increasing # of freeze instructions.
Performance degradation of MultiSource/Benchmarks/Ptrdist/yacr2/yacr2.test is resolved with this patch.
Checked with Alive2
Reviewers: reames, fhahn, nlopes
Reviewed By: reames
Subscribers: jdoerfert, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75859
Sergej Jaskiewicz [Wed, 11 Mar 2020 18:00:46 +0000 (21:00 +0300)]
[libc++] [cmake] Better diagnostics for missing abi library headers
Summary:
This is NFC. We only add additional information to the log.
Reviewers: EricWF, ldionne, mclow.lists
Reviewed By: ldionne
Subscribers: kristof.beyls, dexonsmith, danielkiss, mgorny, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75991
Jay Foad [Wed, 11 Mar 2020 17:01:24 +0000 (17:01 +0000)]
[AMDGPU] Extend macro fusion for ADDC and SUBB to SUBBREV
Summary:
There's a lot of test case churn but the overall effect is to increase
the number of back-to-back v_sub,v_subbrev pairs, which can execute with
no delay even on gfx10.
Reviewers: arsenm, rampitec, nhaehnle
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75999
Florian Hahn [Wed, 11 Mar 2020 17:01:47 +0000 (17:01 +0000)]
[Matrix] Add remark propagation along the inlined-at chain.
This patch adds support for propagating matrix expressions along the
inlined-at chain and emitting remarks at the traversed function scopes.
To motivate this new behavior, consider the example below. Without the
remark 'up-leveling', we would only get remarks in load.h and store.h,
but we cannot generate a remark describing the full expression in
toplevel.cpp, which is the place where the user has the best chance of
spotting/fixing potential problems.
With this patch, we generate a remark for the load in load.h, one for
the store in store.h and one for the complete expression in
toplevel.cpp. For a bigger example, please see remarks-inlining.ll.
load.h:
template <typename Ty, unsigned R, unsigned C> Matrix<Ty, R, C> load(Ty *Ptr) {
Matrix<Ty, R, C> Result;
Result.value = *reinterpret_cast <typename Matrix<Ty, R, C>::matrix_t *>(Ptr);
return Result;
}
store.h:
template <typename Ty, unsigned R, unsigned C> void store(Matrix<Ty, R, C> M1, Ty *Ptr) {
*reinterpret_cast<typename decltype(M1)::matrix_t *>(Ptr) = M1.value;
}
toplevel.cpp
void test(double *A, double *B, double *C) {
store(add(load<double, 3, 5>(A), load<double, 3, 5>(B)), C);
}
For a given function, we traverse the inlined-at chain for each
matrix instruction (= instructions with shape information). We collect
the matrix instructions in each DISubprogram we visit. This produces a
mapping of DISubprogram -> (List of matrix instructions visible in the
subpogram). We then generate remarks using the list of instructions for
each subprogram in the inlined-at chain. Note that the list of instructions
for a subprogram includes the instructions from its own subprograms
recursively. For example using the example above, for the subprogram
'test' this includes inline functions 'load' and 'store'. This allows
surfacing the remarks at a level useful to users.
Please note that the current approach may create a lot of extra remarks.
Additional heuristics to cut-off the traversal can be implemented in the
future. For example, it might make sense to stop 'up-leveling' once all
matrix instructions are at the same debug location.
Reviewers: anemet, Gerolf, thegameg, hfinkel, andrew.w.kaylor, LuoYuanke
Reviewed By: anemet
Differential Revision: https://reviews.llvm.org/D73600
Alexey Bataev [Wed, 11 Mar 2020 17:26:01 +0000 (13:26 -0400)]
[OPENMP][DOCS]Mark depobj as implemented, NFC.
Sterling Augustine [Thu, 5 Mar 2020 00:29:58 +0000 (16:29 -0800)]
Lazily save initialState of registers during unwind.
Summary:
Copying all of the saved register state on every entry to
parseInstruction is a severe performance contraint, especially
because most of this saved state is never used. On x86 linux
this is about 560 bytes, and will be more on other platforms.
When performance testing libunwind, this memcpy appears at the
top of nearly all our tests.
By only saving this state as needed, we see increasing in performance
of around 2.5% for the ctak test here.
https://github.com/clasp-developers/ctak
Certain internal extremely exception-heavy tasks run in about 2/3
the time.
Note that by stashing the new boolean inside what had been padding in
the original structure, this uses no additional memory.
Subscribers: fedor.sergeev, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75692
Andrzej Warzynski [Tue, 10 Mar 2020 15:40:40 +0000 (15:40 +0000)]
[AArch64][SVE] Add the @llvm.aarch64.sve.sel intrinsic
Reviewers: sdesmalen, efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75928
Philip Reames [Wed, 11 Mar 2020 17:01:11 +0000 (10:01 -0700)]
[GC] Remove buggy untested optimization from statepoint lowering
A downstream test case (see included reduced test) revealed that we have a bug in how we handle duplicate relocations. If we have the same SDValue relocated twice, and that value happens to be a constant (such as null), we only export one of the two llvm::Values. Exporting on a per llvm::Value basis is required to allow lowering of gc.relocates in following basic blocks (e.g. invokes). Without it, we end up with a use of an undefined vreg and bad things happen.
Rather than fixing the optimization - which appears to be hard - I propose we simply remove it. There are no tests in tree that change with this code removed. If we find out later that this did matter for something, we can reimplement a variation of this in CodeGenPrepare to catch the easy cases without complicating the lowering code.
Thanks to Denis and Serguei who did all the hard work of figuring out what went wrong here. The patch is by far the easy part. :)
Differential Revision: https://reviews.llvm.org/D75964
Adrian Prantl [Mon, 9 Mar 2020 17:40:33 +0000 (10:40 -0700)]
Add a decorator option to skip tests based on a default setting.
This patch allows skipping a test based on a default setting, which is
useful when running the testsuite in different "modes" based on a
default setting. This is a feature I need for the Swift testsuite, but
I think it's generally useful.
Differential Revision: https://reviews.llvm.org/D75864
Fangrui Song [Tue, 3 Mar 2020 23:37:12 +0000 (15:37 -0800)]
[ELF] Simplify sh_addr computation and warn if sh_addr is not a multiple of sh_addralign
See `docs/ELF/linker_script.rst` for the new computation for sh_addr and sh_addralign.
`ALIGN(section_align)` now means: "increase alignment to section_align"
(like yet another input section requirement).
The "start of section .foo changes from 0x11 to 0x20" warning no longer
makes sense. Change it to warn if sh_addr%sh_addralign!=0.
To decrease the alignment from the default max_input_align,
use `.output ALIGN(8) : {}` instead of `.output : ALIGN(8) {}`
See linkerscript/section-address-align.test as an example.
When both an output section address and ALIGN are set (can be seen as an
"undefined behavior" https://sourceware.org/ml/binutils/2020-03/msg00115.html),
lld may align more than GNU ld, but it makes a linker script working
with GNU ld hard to break with lld.
This patch can be considered as restoring part of the behavior before D74736.
Differential Revision: https://reviews.llvm.org/D75724
James Henderson [Wed, 11 Mar 2020 15:30:04 +0000 (15:30 +0000)]
[Object][unittest] Skip tests on machines with non-64 bit size_t
Speculative fix for build bot failures such as
http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/14317/
David Green [Wed, 11 Mar 2020 14:24:48 +0000 (14:24 +0000)]
[ARM] Extra VFMA tests. NFC
Haojian Wu [Wed, 11 Mar 2020 15:07:44 +0000 (16:07 +0100)]
[clangd] Improve the "max limit" error message in rename, NFC.
previously, we emited "exceeds the max limit 49" which was weird, now we
emit "exceeds the max limit 50".
Matt Arsenault [Thu, 20 Feb 2020 19:00:56 +0000 (14:00 -0500)]
AMDGPU/GlobalISel: Manually RegBankSelect copies
This was failng on any pre-assigned copy to the VCC bank.
This is something of a workaround for the default implementation in
getInstrMappingImpl, and how it treats copy-like operations in
general.
Copy-like operations are considered to only have one result register
bank, rather than separate banks for each source like a normal
instruction. To avoid potentially mishandling reg_sequence with
impossible operand combinations, the generic implementation errors on
impossible costs. If the bank was already assigned, is treated it
as-if it were an unsatisfiable REG_SEQUENCE mapping. We really don't
get any value from any of what getInstrMappingImpl tries to do for
copies, so just directly emit the simple mapping we really want.
Christian Sigg [Mon, 9 Mar 2020 13:42:04 +0000 (14:42 +0100)]
[MLIR] Remove all-reduce lowering from GPU to NVVM. Use in-dialect lowering instead.
Reviewers: herhut, mravishankar
Reviewed By: herhut
Subscribers: merge_guards_bot, jholewinski, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73794
Christian Sigg [Wed, 29 Jan 2020 08:57:54 +0000 (09:57 +0100)]
Change to individual pretty printer classes, remove generic `make_printer`.
Summary: Follow-up from D72589.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: merge_guards_bot, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73609
Hubert Tong [Wed, 11 Mar 2020 13:58:10 +0000 (09:58 -0400)]
[unittests][Object] Use matching signedness for expected value
Speculative fix for buildbot breakage:
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/1899/steps/ninja%20check%201/logs/stdio
D75742 introduces checks that cause bots to complain about comparing
values where the integer types mismatch on signedness.
This patch makes the expected value unsigned in various cases (since the
value being tested is unsigned).
Artem Dergachev [Wed, 11 Mar 2020 12:53:10 +0000 (15:53 +0300)]
[analyzer] Fix a strange compile error on a certain Clang-7.0.0
error: default initialization of an object of const type
'const clang::QualType' without a user-provided
default constructor
Irrelevant; // A placeholder, whenever we do not care about the type.
^
{}
Joachim Protze [Wed, 11 Mar 2020 13:12:51 +0000 (14:12 +0100)]
[compiler-rt][tsan] Make fiber support in thread sanitizer dynamic linkable
This patch will allow dynamic libraries to call into the fiber support functions
introduced in https://reviews.llvm.org/D54889
Differential Revision: https://reviews.llvm.org/D74487
Alexey Bataev [Tue, 10 Mar 2020 17:07:39 +0000 (13:07 -0400)]
[LIBOMPTARGET]Fix PR45139: Bug in mixing Python and OpenMP target offload.
Summary: Explicitly initialize data members of RTLsTy class upon construction.
Reviewers: grokos
Subscribers: guansong, openmp-commits, caomhin, kkwli0
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D75946
Valentin Clement [Wed, 11 Mar 2020 12:56:31 +0000 (13:56 +0100)]
[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering
Summary:
This patch add some builtin operation for the gpu.all_reduce ops.
- for Integer only: `and`, `or`, `xor`
- for Float and Integer: `min`, `max`
This is useful for higher level dialect like OpenACC or OpenMP that can lower to the GPU dialect.
Differential Revision: https://reviews.llvm.org/D75766
Stephan Herhut [Wed, 11 Mar 2020 13:03:03 +0000 (14:03 +0100)]
Revert "[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering"
Attribution to original author got lost.
Jonathan Coe [Wed, 11 Mar 2020 12:57:29 +0000 (12:57 +0000)]
[clang-format] Improved identification of C# nullables
Summary:
Allow `?` inside C# generics.
Do not mistake casts like `(Type?)` as conditional operators.
Reviewers: krasimir
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D75983
Jonathan Coe [Wed, 11 Mar 2020 12:53:53 +0000 (12:53 +0000)]
[clang-format] No space in `new()` and `this[Type x]` in C#
Reviewers: krasimir
Reviewed By: krasimir
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D75984
Sam Parker [Wed, 11 Mar 2020 11:51:52 +0000 (11:51 +0000)]
[NFC][ARM] Add test
Precommit test for LowOverheadLoops.
Sam Parker [Wed, 11 Mar 2020 11:39:14 +0000 (11:39 +0000)]
[NFC][ARM] Reorder some logic
Move some logic around in LowOverheadLoop::ValidateLiveOut
Simon Pilgrim [Wed, 11 Mar 2020 11:17:34 +0000 (11:17 +0000)]
[X86] Replace (most) X86ISD::SHLD/SHRD usage with ISD::FSHL/FSHR generic opcodes (PR39467)
For i32 and i64 cases, X86ISD::SHLD/SHRD are close enough to ISD::FSHL/FSHR that we can use them directly, we just need to account for the operand commutation for SHRD.
The i16 SHLD/SHRD case is annoying as the shift amount is modulo-32 (vs funnel shift modulo-16), so I've added X86ISD::FSHL/FSHR equivalents, which matches the generic implementation in all other terms.
Something I'm slightly concerned with is that ISD::FSHL/FSHR legality is controlled by the Subtarget.isSHLDSlow() feature flag - we don't normally use non-ISA features for this but it allows the DAG combines to continue to operate after legalization in a lot more cases.
The X86 *bits.ll changes are all affected by the same issue - we now have a "FSHR(-1,-1,amt) -> ROTR(-1,amt) -> (-1)" simplification that reduces the dependencies enough for the branch fall through code to mess up.
Differential Revision: https://reviews.llvm.org/D75748
Peter Smith [Tue, 10 Mar 2020 13:26:50 +0000 (13:26 +0000)]
[LLD][ELF] Add initial LLD LinkerScript docs page
LLD implements Linker Scripts as they are described in the GNU ld manual.
This description is far from a specification, with the only true reference
the GNU ld implementation, which has undocumented behaviour that can vary
from release to release.
To make it easy for people to switch between linkers we try to follow GNU
ld implementation details wherever possible. We reserve the right to make
our own decisions where the undocumented GNU ld behaviour is not
appropriate for LLD. We don't have a place to document these decisions and
it can be difficult for users to find out this information.
This file is a statement of the LLD implementation policy and will contain
intentional deviations from GNU ld.
The first patch that will add concrete details to this file is D75724
Differential Revision: https://reviews.llvm.org/D75921
LLVM GN Syncbot [Wed, 11 Mar 2020 10:47:56 +0000 (10:47 +0000)]
[gn build] Port
326bc1da45b
James Henderson [Fri, 6 Mar 2020 14:25:32 +0000 (14:25 +0000)]
[Object] Fix handling of large archive members
The archive library truncated the size of archive members whose size was
greater than max uint32_t. This patch fixes the issue and adds some unit
tests to verify.
Reviewed by: ruiu, MaskRay, grimar, rupprecht
Differential Revision: https://reviews.llvm.org/D75742
Anna Welker [Wed, 11 Mar 2020 10:13:11 +0000 (10:13 +0000)]
[TTI][ARM][MVE] Refine gather/scatter cost model
Refines the gather/scatter cost model, but also changes the TTI
function getIntrinsicInstrCost to accept an additional parameter
which is needed for the gather/scatter cost evaluation.
This did require trivial changes in some non-ARM backends to
adopt the new parameter.
Extending gathers and truncating scatters are now priced cheaper.
Differential Revision: https://reviews.llvm.org/D75525
Victor Campos [Mon, 9 Mar 2020 13:29:37 +0000 (13:29 +0000)]
[ARM] Improve codegen of volatile load/store of i64
Summary:
Instead of generating two i32 instructions for each load or store of a volatile
i64 value (two LDRs or STRs), now emit LDRD/STRD.
These improvements cover architectures implementing ARMv5TE or Thumb-2.
The code generation explicitly deviates from using the register-offset
variant of LDRD/STRD. In this variant, the register allocated to the
register-offset cannot be reused in any of the remaining operands. Such
restriction seems to be non-trivial to implement in LLVM, thus it is
left as a to-do.
Reviewers: dmgreen, efriedma, john.brawn, nickdesaulniers
Reviewed By: efriedma, nickdesaulniers
Subscribers: danielkiss, alanphipps, hans, nathanchance, nickdesaulniers, vvereschaka, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70072
QingShan Zhang [Wed, 11 Mar 2020 09:35:40 +0000 (09:35 +0000)]
[NFC][Test] Add a PowerPC test to verify the behavior of a*b +/- c*d
Sebastian Neubauer [Thu, 5 Mar 2020 13:29:40 +0000 (14:29 +0100)]
[AMDGPU] Use script to generate atomic optimizations test
This is a preparation for introducing a llvm.amdgcn.ballot intrinsic in
D65088.
QingShan Zhang [Wed, 11 Mar 2020 08:49:53 +0000 (08:49 +0000)]
[NFC][Test] Format the test PowerPC/recipest.ll with update_llc_test_checks.py
Jonas Devlieghere [Wed, 11 Mar 2020 06:06:39 +0000 (23:06 -0700)]
[lldb/Reproducer] Prevent crash when GDB multi-loader can't be created.
Check that the multi loader isn't null and print an error otherwise.
This patch also extends the test to cover these error paths.
Akira Hatanaka [Wed, 11 Mar 2020 05:01:45 +0000 (22:01 -0700)]
[CodeGen][ObjC] Don't extend lifetime of ObjC pointers passed to calls
to __builtin_os_log_format if ARC isn't enabled
Fixes a bug introduced in this commit:
https://github.com/llvm/llvm-project/commit/
f4d791f8332c2bb7e89849d0fe4ef48cb0a23229
rdar://problem/
60301219
Serge Pavlov [Thu, 27 Feb 2020 11:16:14 +0000 (18:16 +0700)]
Make IEEEFloat::roundToIntegral more standard conformant
Behavior of IEEEFloat::roundToIntegral is aligned with IEEE-754
operation roundToIntegralExact. In partucular this function now:
- returns opInvalid for signaling NaNs,
- returns opInexact if the result of rounding differs from argument.
Differential Revision: https://reviews.llvm.org/D75246
Matt Arsenault [Thu, 13 Feb 2020 20:08:59 +0000 (15:08 -0500)]
GlobalISel: Don't try to narrow extending loads/trunc store
If the loaded memory size was smaller than the result size, this would
produce out of bounds memory accesses. I'm wondering if we need a
distinct narrow memory legalize action type, since a case I care about
is decomposing a 4-byte unaligned access into 4 extending loads, which
would leave the original result register type. I'm currently awkwardly
using narrowScalar to handle unaligned accesses that need to be split.
Matt Arsenault [Wed, 26 Feb 2020 20:05:14 +0000 (15:05 -0500)]
GlobalISel: Add missing add/sub with carries to MachineIRBuilder
Matt Arsenault [Sat, 11 Jan 2020 14:05:27 +0000 (09:05 -0500)]
AMDGPU/GlobalISel: Add some tests that used to infinite loop
Leonard Chan [Wed, 11 Mar 2020 01:58:41 +0000 (18:58 -0700)]
[libunwind] Remove __FILE__ and __LINE__ from error reporting
We were seeing non-deterministic binary size differences depending on which
toolchain was used to build fuchsia. This is because libunwind embeded the
FILE path into a logging macro, even for release builds, which makes the code
dependent on the build directory.
This removes the file and line number from the error message. This is
consistent with how other runtimes report error, e.g.
https://github.com/llvm/llvm-project/blob/master/libcxxabi/src/abort_message.cpp#L30.
Differential Revision: https://reviews.llvm.org/D75890
Hubert Tong [Wed, 11 Mar 2020 01:31:10 +0000 (21:31 -0400)]
[cmake] Link libclangDaemonTweaks with clangFormat
Speculative fix for buildbot failure in
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/1881/steps/build%20stage%201/logs/stdio
Cause appears to be D75716.
Paula Toth [Tue, 10 Mar 2020 23:52:57 +0000 (16:52 -0700)]
[clang-tidy] Use more widely available headers for protability-restrict-system-includes-check's test
Richard Smith [Tue, 10 Mar 2020 23:33:42 +0000 (16:33 -0700)]
Fix crash-on-invalid when trying to recover from a function template
being deleted on its second or subsequent declaration.
Carl Ritson [Tue, 10 Mar 2020 22:46:08 +0000 (07:46 +0900)]
[AMDGPU] Allow struct.buffer.*.format intrinsics to accept i32
Summary:
In the same manner as struct.buffer.load / struct.buffer.store,
allow struct.buffer.load.format / struct.buffer.store.format to
return / accept any type. This simplifies front-end code gen.
Reviewers: tpr, arsenm, nhaehnle
Reviewed By: arsenm
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75789
Lang Hames [Mon, 9 Mar 2020 23:56:07 +0000 (16:56 -0700)]
[RuntimeDyld][COFF] Build stubs for COFF dllimport symbols.
Summary:
Enables JIT-linking by RuntimeDyld of COFF objects that contain references to
dllimport symbols. This is done by recognizing symbols that start with the
reserved "__imp_" prefix and building a pointer entry to the target symbol in
the stubs area of the section. References to the "__imp_" symbol are updated to
point to this pointer.
Work in progress: The generic code is in place, but only RuntimeDyldCOFFX86_64
and RuntimeDyldCOFFI386 have been updated to look for and update references to
dllimport symbols.
Reviewers: compnerd
Subscribers: hiraditya, ributzka, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75884
Lang Hames [Tue, 10 Mar 2020 20:07:46 +0000 (13:07 -0700)]
[RuntimeDyld] Allow multi-line rtdyld-check and jitlink-check expressions.
This patch allows rtdyld-check / jitlink-check expressions to be extended over
multiple lines by terminating each line with a '\'. E.g.
# llvm-rtdyld: *{8}X = \
# llvm-rtdyld: Y
X:
.quad Y
This will be used to break up some long lines in upcoming test cases.
Matt Arsenault [Sun, 16 Feb 2020 02:59:30 +0000 (21:59 -0500)]
AMDGPU/GlobalISel: Refine G_TRUNC legality rules
Scalarize most truncates. Avoid touching cases that could end up in
unresolvable infinite loops.
Bill Wendling [Tue, 10 Mar 2020 22:26:03 +0000 (15:26 -0700)]
Add triple for non-x86 environments.
Matt Arsenault [Sun, 16 Feb 2020 01:24:36 +0000 (20:24 -0500)]
GlobalISel: Implement fewerElementsVector for G_TRUNC
Extend fewerElementsVectorBasic to handle operands with different
element types.
Louis Dionne [Tue, 10 Mar 2020 22:11:26 +0000 (18:11 -0400)]
Revert "[libc++abi] Change __cxa_finalize return type to void"
This reverts commit
fde9d33f7, which was not properly reviewed by a
libc++ or libc++abi code owner.
Hanhan Wang [Tue, 10 Mar 2020 21:59:47 +0000 (14:59 -0700)]
[mlir] Create a std op instead of chain of ops.
Summary:
1-bit integer is tricky in different dialects sometimes. E.g., there is no
arithmetic instructions on 1-bit integer in SPIR-V, i.e., `spv.IMul %0, %1 : i1`
is not valid. Instead, `spv.LogicalAnd %0, %1 : i1` is valid. Creating the op
directly makes lowering easier because we don't need to match a complicated
pattern like `!(!lhs && !rhs)`. Also, this matches the semantic better.
Also add assertions on inputs.
Differential Revision: https://reviews.llvm.org/D75764
Ryan Prichard [Sat, 8 Feb 2020 01:00:39 +0000 (17:00 -0800)]
[libc++abi] Change __cxa_finalize return type to void
Summary:
The return type of __cxa_finalize is documented as void in the Itanium
C++ ABI, and it is void in various C libraries.
Reviewers: EricWF, ldionne, compnerd, mclow.lists, MaskRay
Reviewed By: MaskRay
Subscribers: MaskRay, dexonsmith, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75795
Louis Dionne [Mon, 9 Mar 2020 15:16:22 +0000 (11:16 -0400)]
[libc++] Properly mark std::function as deprecated in C++03
Due to Clang bug http://llvm.org/PR45151, deprecated attributes are not
picked up on partial specializations. This patch instead applies it to
the first declaration of std::function itself.
Richard Smith [Tue, 10 Mar 2020 00:34:33 +0000 (17:34 -0700)]
PR45083: Mark statement expressions as being dependent if they appear in
a dependent context.
This matches the GCC behavior.
We track the enclosing template depth when determining whether a
statement expression is within a dependent context; there doesn't appear
to be any other reliable way to determine this.
We previously assumed they were neither value- nor
instantiation-dependent under any circumstances, which would lead to
crashes and other misbehavior.
Matt Arsenault [Mon, 9 Mar 2020 20:53:00 +0000 (16:53 -0400)]
AMDGPU: Use V_MAC_F32 for fmad.ftz
This avoids regressions in a future patch. I'm confused by the use of
the gfx9 usage legacy_mad. Was this a pointless instruction rename, or
uses fmul_legacy handling? Why is regular mac avilable in that case?
Erik Pilkington [Tue, 10 Mar 2020 18:42:47 +0000 (11:42 -0700)]
[CodeGenObjC] Place property names in __objc_methname
This allows the property name to deduplicate with the accessor method name.
rdar://
58927964
Saar Raz [Tue, 10 Mar 2020 21:17:00 +0000 (23:17 +0200)]
[Concepts] Fix incorrect DeclContext for transformed RequiresExprBodyDecl
We would assign the incorrect DeclContext when transforming the RequiresExprBodyDecl, causing incorrect
handling of 'this' inside RequiresExprBodyDecls (bug #45162).
Assign the current context as the DeclContext of the transformed decl.
Akira Hatanaka [Tue, 10 Mar 2020 21:06:25 +0000 (14:06 -0700)]
[CodeGen] Emit destructor calls to destruct compound literals
Fix a bug in IRGen where it wasn't destructing compound literals in C
that are ObjC pointer arrays or non-trivial structs. Also diagnose jumps
that enter or exit the lifetime of the compound literals.
rdar://problem/
51867864
Differential Revision: https://reviews.llvm.org/D64464
Paula Toth [Tue, 10 Mar 2020 21:01:23 +0000 (14:01 -0700)]
[clang-tidy] Fix warning from my previous patch in ReleaseNotes.txt
Bill Wendling [Tue, 10 Mar 2020 20:47:30 +0000 (13:47 -0700)]
Warn of uninitialized variables on asm goto's indirect branch
Summary:
Outputs from an asm goto block cannot be used on the indirect branch.
It's not supported and may result in invalid code generation.
Reviewers: jyknight, nickdesaulniers, hfinkel
Reviewed By: nickdesaulniers
Subscribers: martong, cfe-commits, rnk, craig.topper, hiraditya, rsmith
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71314
Nathan Ridge [Fri, 6 Mar 2020 00:03:26 +0000 (19:03 -0500)]
[clangd] Have visibleNamespaces() and getEligiblePoints() take a LangOptions rather than a FormatStyle
Summary:
These functions only use the FormatStyle to obtain a LangOptions via
format::getFormattingLangOpts(), and some callers can more easily obtain
a LangOptions more directly.
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75716
Nathan Ridge [Tue, 10 Mar 2020 20:10:04 +0000 (16:10 -0400)]
[clangd] Run clang-format on CodeComplete.cpp and SourceCodeTests.cpp
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75959
LLVM GN Syncbot [Tue, 10 Mar 2020 20:34:28 +0000 (20:34 +0000)]
[gn build] Port
ebdb98f254f
Paula Toth [Tue, 10 Mar 2020 17:28:23 +0000 (10:28 -0700)]
[clang-tidy] Move fuchsia-restrict-system-includes to portability module for general use.
Summary:
Created a general check for restrict-system-includes under portability as recommend in the comments under D75332. I also fleshed out the user facing documentation to show examples for common use-cases such as allow-list, block-list, and wild carding.
Removed fuchsia's check as per phosek sugguestion.
Reviewers: aaron.ballman, phosek, alexfh, hokein, njames93
Reviewed By: phosek
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, phosek, cfe-commits, MaskRay
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D75786
Lei Zhang [Tue, 10 Mar 2020 20:20:07 +0000 (16:20 -0400)]
[mlir][vulkan-runner] Use std::make_tuple to create tuple
Stephan Herhut [Tue, 10 Mar 2020 20:04:48 +0000 (21:04 +0100)]
[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering
Summary:
This patch add some builtin operation for the gpu.all_reduce ops.
- for Integer only: `and`, `or`, `xor`
- for Float and Integer: `min`, `max`
This is useful for higher level dialect like OpenACC or OpenMP that can lower to the GPU dialect.
Differential Revision: https://reviews.llvm.org/D75766
Saar Raz [Tue, 10 Mar 2020 20:05:36 +0000 (22:05 +0200)]
[Concepts] Add constraints checks to isSameEntity
isSameEntity was missing constraints checking, causing constrained overloads
to not travel well accross serialization. (bug #45115)
Add constraints checking to isSameEntity.
Saar Raz [Tue, 10 Mar 2020 20:04:11 +0000 (22:04 +0200)]
[Concepts] Add FoundDecl to ConceptSpecializationExpr serialization
FoundDecl was missing from ConceptSpecializationExpr serialization - add it.
Denis Khalikov [Tue, 10 Mar 2020 19:17:07 +0000 (15:17 -0400)]
[mlir][vulkan-runner] Update mlir-vulkan-runner execution driver.
* Adds GpuLaunchFuncToVulkanLaunchFunc conversion pass.
* Moves a serialization of the `spirv::Module` from LaunchFuncToVulkanCalls pass to newly created pass.
* Updates LaunchFuncToVulkanCalls instrumentation pass, adds `initVulkan` and `deinitVulkan` runtime calls.
* Adds `bindResource` call to bind specifc resource by the given descriptor set and descriptor binding.
* Eliminates static construction and desctruction of `VulkanRuntimeManager`.
Differential Revision: https://reviews.llvm.org/D75192
River Riddle [Tue, 10 Mar 2020 19:25:08 +0000 (12:25 -0700)]
[mlir][NFC] Move the interfaces and traits for side effects out of IR/ to Interfaces/
Summary:
Interfaces/ is the designated directory for these types of interfaces, and also removes the need for including them directly in IR/.
Differential Revision: https://reviews.llvm.org/D75886
River Riddle [Tue, 10 Mar 2020 19:20:24 +0000 (12:20 -0700)]
[mlir][NFC] Move the operation interfaces out of Analysis/ and into a new Interfaces/ directory.
The interfaces themselves aren't really analyses, they may be used by analyses though. Having them in Analysis can also create cyclic dependencies if an analysis depends on a specific dialect, that also provides one of the interfaces.
Differential Revision: https://reviews.llvm.org/D75867
Jay Foad [Fri, 28 Feb 2020 23:38:41 +0000 (23:38 +0000)]
[AMDGPU] Fix the gfx10 scheduling model for f32 conversions
Summary:
As far as I can tell on gfx10 conversions to/from f32 (that are not
converting f32 to/from f64) are full rate instructions, but they were
marked as quarter rate instructions.
I have fixed this for gfx10 only. I assume the scheduling model was
correct for older architectures, though I don't have any documentation
handy to confirm that.
Reviewers: rampitec, arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75392
Nicolas Vasilache [Tue, 10 Mar 2020 19:10:34 +0000 (15:10 -0400)]
[mlir][Linalg] Revisit 0-D abstraction
This revision takes advantage of the empty AffineMap to specify the
0-D edge case. This allows removing a bunch of annoying corner cases
that ended up impacting users of Linalg.
Differential Revision: https://reviews.llvm.org/D75831
Aaron Ballman [Tue, 10 Mar 2020 18:21:55 +0000 (14:21 -0400)]
Convert a reachable llvm_unreachable into an assert.
Fangrui Song [Tue, 10 Mar 2020 15:05:00 +0000 (08:05 -0700)]
[SimplifyLibcalls] Don't replace locked IO (fgetc/fgets/fputc/fputs/fread/fwrite) with unlocked IO (*_unlocked)
This essentially reverts some of the SimplifyLibcalls part changes of D45736 [SimplifyLibcalls] Replace locked IO with unlocked IO.
C11 7.21.5.2 The fflush function
> If stream is a null pointer, the fflush function performs this flushing action on all streams for which the behavior is defined above.
i.e. fopen'ed FILE* is inherently captured.
POSIX.1-2017 getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - stdio with explicit client locking
> These functions can safely be used in a multi-threaded program if and only if they are called while the invoking thread owns the ( FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions.
After a thread fopen'ed a FILE*, when it is calling foobar() which is now replaced by foobar_unlocked(),
if another thread is concurrently calling fflush(0), the behavior is undefined.
C11 7.22.4.4 The exit function
> Next, all open streams with unwritten buffered data are flushed, all open streams are closed, and all files created by the tmpfile function are removed.
The replacement is only feasible if the program is single threaded, or exit or fflush(0) is never called.
See also http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20180528/556615.html
for how the replacement makes libc interceptors difficult to implement.
dalias: in a worst case, it's unbounded data corruption because of concurrent access to pointers
without synchronization. f->wpos or rpos could get outside of the buffer, thread A could do
f->wpos += j after knowing j is in bounds, while thread B also changes it concurrently.
This can produce exploitable conditions depending on libc internals.
Revert the SimplifyLibcalls part change because the cons obviously
overweigh the pros. Even when the replacement is feasible, the benefit
is indemonstrable, more so in an application instead of an artificial
glibc benchmark. Theoretically the replacement could be beneficial when
calling getc_unlocked/putc_unlocked in a loop, but then it is better
using a blocked IO operation and the user is likely aware of that.
The function attribute inference is still useful and thus kept.
Reviewed By: xbolva00
Differential Revision: https://reviews.llvm.org/D75933
Craig Topper [Tue, 10 Mar 2020 18:08:19 +0000 (11:08 -0700)]
[docs] Regenerate ClangCommandLineReference.rst
Just ran clang-tblgen -gen-opt-docs ClangOptionDocs.td
Matt Arsenault [Mon, 9 Mar 2020 15:08:49 +0000 (11:08 -0400)]
ARM: Fixup some tests using denormal-fp-math attribute
Don't use the deprecated, single mode form in tests. Also make sure to
parse the attribute, in case of the deprecated form.
Eugene Zhulenev [Tue, 10 Mar 2020 17:55:05 +0000 (10:55 -0700)]
[MLIR] Add custom option parser type to PassOption
Summary: Pass custom DataType parser to pass options, similar to llvm::cl::opt class.
Differential Revision: https://reviews.llvm.org/D75794
Rumeet Dhindsa [Tue, 10 Mar 2020 17:59:26 +0000 (10:59 -0700)]
Revert "[modules] Do not cache invalid state for modules that we attempted to load."
As per comment on https://reviews.llvm.org/D72860, it is suggested to
revert this change in the meantime, since it has introduced regression.
This reverts commit
83f4c3af021cd5322ea10fd1c4e839874c1dae49.
Nathan James [Tue, 10 Mar 2020 13:41:01 +0000 (13:41 +0000)]
Add Optional overload to DiagnosticBuilder operator <<
Reviewers: aaron.ballman, gribozavr2, lebedev.ri
Reviewed By: gribozavr2
Subscribers: wuzish, nemanjai, kbarton, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75714
Sterling Augustine [Fri, 6 Mar 2020 23:59:16 +0000 (15:59 -0800)]
Rework findUnwindSectionsByPhdr to be more optimal.
Summary:
- Executable segment is usually segment 3. Look there for the address first.
- GNU_EH_FRAME_HEADER segment is usually near the end. Iterate from the end.
- Exit early if both phdrs have been found.
This is the last cl before a patch to cache the information this function
finds.
Subscribers: libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75781
Louis Dionne [Tue, 10 Mar 2020 17:33:07 +0000 (13:33 -0400)]
[libc++abi] NFC: Fix typo in comment
Benjamin Kramer [Tue, 10 Mar 2020 17:24:04 +0000 (18:24 +0100)]
Give helpers internal linkage. NFC.
Kadir Cetinkaya [Tue, 10 Mar 2020 15:52:31 +0000 (16:52 +0100)]
[clangd] Use a separate RunningTask flag instead of leaving a broken request on top of the queue
Summary:
This helps us prevent races when scheduler (or any other thread) tries
to read a request while it's still running.
Reviewers: sammccall
Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75927