Vedant Kumar [Thu, 20 Feb 2020 17:40:27 +0000 (09:40 -0800)]
[LiveDebugValues] Encode a location in VarLoc IDs, NFC [2/3]
This is part 2 of a 3-part series to address a compile-time explosion
issue in LiveDebugValues.
---
Each VarLoc has a unique ID: this ID is used to look up a VarLoc in the
VarLocMap, and to virtually insert a VarLoc into a VarLocSet. Instead of
inserting the VarLoc /itself/ into the VarLocSet, we insert just the ID,
because this can be represented efficiently with a SparseBitVector.
This change introduces LocIndex, a layer of abstraction on top of VarLoc
IDs. Prior to this change, an ID was just an index into a vector. With
this change, an ID encodes both an index /and/ a register location. The
type-checker ensures that conversions to and from LocIndex are correct.
For the moment the register location is always 0 (undef). We have plenty
of bits left over to encode physregs, stack slots, and other locations
in the future.
Differential Revision: https://reviews.llvm.org/D74985
Vedant Kumar [Tue, 18 Feb 2020 13:41:55 +0000 (05:41 -0800)]
[ADT] Add CoalescingBitVector, implemented using IntervalMap [1/3]
Add CoalescingBitVector to ADT. This is part 1 of a 3-part series to
address a compile-time explosion issue in LiveDebugValues.
---
CoalescingBitVector is a bitvector that, under the hood, relies on an
IntervalMap to coalesce elements into intervals.
CoalescingBitVector efficiently represents sets which predominantly
contain contiguous ranges (e.g. the VarLocSets in LiveDebugValues,
which are very long sequences that look like {1, 2, 3, ...}). OTOH,
CoalescingBitVector isn't good at representing sets with lots of gaps
between elements. The first N coalesced intervals of set bits are stored
in-place (in the initial heap allocation).
Compared to SparseBitVector, CoalescingBitVector offers more predictable
performance for non-sequential find() operations. This provides a
crucial speedup in LiveDebugValues.
Differential Revision: https://reviews.llvm.org/D74984
Eric Fiselier [Thu, 27 Feb 2020 20:16:30 +0000 (15:16 -0500)]
[libc++] Rework docker files for buildbots.
I've been sitting on this change for a while and have been using
it to build the bot images, so it should be upstream.
This re-configures the docker build files to use docker-compose
more heavily. This allows for composing large images with multiple
compilers without invalidating the docker caches.
After this commit I'll quickly switch all the current buildbots
over to a new docker image, followed by another update to add new
compilers
Sanjay Patel [Thu, 27 Feb 2020 20:19:37 +0000 (15:19 -0500)]
[x86] use instruction-level fast-math-flags to drive MachineCombiner
The code changes here are hopefully straightforward:
1. Use MachineInstruction flags to decide if FP ops can be reassociated
(use both "reassoc" and "nsz" to be consistent with IR transforms;
we probably don't need "nsz", but that's a safer interpretation of
the FMF).
2. Check that both nodes allow reassociation to change instructions.
This is a stronger requirement than we've usually implemented in
IR/DAG, but this is needed to solve the motivating bug (see below),
and it seems unlikely to impede optimization at this late stage.
3. Intersect/propagate MachineIR flags to enable further reassociation
in MachineCombiner.
We managed to make MachineCombiner flexible enough that no changes are
needed to that pass itself. So this patch should only affect x86
(assuming no other targets have implemented the hooks using MachineIR
flags yet).
The motivating example in PR43609 is another case of fast-math transforms
interacting badly with special FP ops created during lowering:
https://bugs.llvm.org/show_bug.cgi?id=43609
The special fadd ops used for converting int to FP assume that they will
not be altered, so those are created without FMF.
However, the MachineCombiner pass was being enabled for FP ops using the
global/function-level TargetOption for "UnsafeFPMath". We managed to run
instruction/node-level FMF all the way down to MachineIR sometime in the
last 1-2 years though, so we can do better now.
The test diffs require some explanation:
1. llvm/test/CodeGen/X86/fmf-flags.ll - no target option for unsafe math was
specified here, so MachineCombiner kicks in where it did not previously;
to make it behave consistently, we need to specify a CPU schedule model,
so use the default model, and there are no code diffs.
2. llvm/test/CodeGen/X86/machine-combiner.ll - replace the target option for
unsafe math with the equivalent IR-level flags, and there are no code diffs;
we can't remove the NaN/nsz options because those are still used to drive
x86 fmin/fmax codegen (special SDAG opcodes).
3. llvm/test/CodeGen/X86/pow.ll - similar to #1
4. llvm/test/CodeGen/X86/sqrt-fastmath.ll - similar to #1, but MachineCombiner
does some reassociation of the estimate sequence ops; presumably these are
perf wins based on latency/throughput (and we get some reduction of move
instructions too); I'm not sure how it affects numerical accuracy, but the
test reflects reality better now because we would expect MachineCombiner to
be enabled if the IR was generated via something like "-ffast-math" with clang.
5. llvm/test/CodeGen/X86/vec_int_to_fp.ll - this is the test added to model PR43609;
the fadds are not reassociated now, so we should get the expected results.
6. llvm/test/CodeGen/X86/vector-reduce-fadd-fast.ll - similar to #1
7. llvm/test/CodeGen/X86/vector-reduce-fmul-fast.ll - similar to #1
Differential Revision: https://reviews.llvm.org/D74851
Sanjay Patel [Thu, 27 Feb 2020 18:57:06 +0000 (13:57 -0500)]
[AArch64] add splat shuffle combine test; NFC
Sanjay Patel [Thu, 27 Feb 2020 18:54:02 +0000 (13:54 -0500)]
[AArch64] regenerate complete test checks; NFC
Paolo Severini [Thu, 27 Feb 2020 19:17:10 +0000 (11:17 -0800)]
[LLDB] Fix AddressSanitizer failure in MemoryCache
The lldb sanitizer bot is flagging a container-overflow error after we
introduced test TestWasm.py. MemoryCache::Read didn't behave correctly
in case of partial reads that can happen with object files whose size is
smaller that the cache size. It should return the actual number of bytes
read and not try to fill the buffer with random memory.
Module::GetMemoryObjectFile needs to be modified accordingly, to resize
its buffer to only the size that was read.
Differential Revision: https://reviews.llvm.org/D75200
Nicolas Vasilache [Thu, 27 Feb 2020 18:45:43 +0000 (13:45 -0500)]
[mlir] NFC - Split out RunnerUtils that don't require a C++ runtime
Summary:
This revision split out a new CRunnerUtils library that supports
MLIR execution on targets without a C++ runtime.
Differential Revision: https://reviews.llvm.org/D75257
Stephan Herhut [Thu, 27 Feb 2020 09:48:02 +0000 (10:48 +0100)]
[MLIR][Loops] Expose transformations on loop.parallel in header (NFC).
Summary:
This change does not add any functionality but merely exposes existing
static functions to make the associated transformations available
outside of their testing passes.
Differential Revision: https://reviews.llvm.org/D75232
Stephen Neuendorffer [Tue, 18 Feb 2020 22:56:45 +0000 (14:56 -0800)]
[MLIR] add show-dialects option for mlir-opt
Display the list of dialects known to mlir-opt. This is useful
for ensuring that linkage has happened correctly, for instance.
Differential Revision: https://reviews.llvm.org/D74865
Joe Turner [Tue, 25 Feb 2020 13:56:57 +0000 (14:56 +0100)]
[clang-tidy] Store all ranges in clang::tooling::Diagnostic
Summary: Instead of dropping all the ranges associated with a Diagnostic when
converting them to a ClangTidy error, instead attach them to the ClangTidyError,
so they can be consumed by other APIs.
Patch by Joe Turner <joturner@google.com>.
Differential Revision: https://reviews.llvm.org/D69782
David Tenty [Thu, 27 Feb 2020 15:43:27 +0000 (10:43 -0500)]
[XCOFF] Don't emit non-external labels in the symbol table and handle MCSA_LGlobal
Summary:
We need to handle the MCSA_LGlobal case in emitSymbolAttribute for functions marked internal in the IR so that the
appropriate storage class is emitted on the function descriptor csect. As part of this we need to make sure that external
labels are not emitted into the symbol table, so we don't emit the descriptor label in the object writing path.
Reviewers: jasonliu, DiggerLin, hubert.reinterpretcast
Reviewed By: jasonliu
Subscribers: Xiangling_L, wuzish, nemanjai, hiraditya, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74968
Eric Fiselier [Wed, 26 Feb 2020 22:25:03 +0000 (17:25 -0500)]
[libc++] Mark more try_lock tests as possibly flaky.
These tests check that an operations happens within a specified
deadline, which causes flaky failures on slow machines or machines
under heavy load.
By adding the // FLAKY_TEST. tag it allows the test suite to
retry or ignore the tests
Reid Kleckner [Thu, 27 Feb 2020 00:29:37 +0000 (16:29 -0800)]
Forward declare FileEntry and DirectoryEntry in Module.h
FileManager.h is an expensive header (~350ms for me in isolation), so
try to do without it.
Notably, we need to avoid checking the alignment of FileEntry, which
happens for DenseMap<FileEntry*> and PointerUnion<FileEntry*>. I
adjusted the code to avoid PointerUnion, and moved the DenseMap
insertion to the .cpp file.
Globally, this only saved about ~17 includes of the related headers
because SourceManager.h still includes FileManager.h, and it is more
popular than Module.h.
Reid Kleckner [Thu, 27 Feb 2020 01:24:52 +0000 (17:24 -0800)]
Forward declare special case lists
This avoids pulling in unordered_map from TrigramIndex.h:
$ diff -u thedeps-before.txt thedeps-after.txt | \
grep '^[-+] ' | sort | uniq -c | sort -nr
976 - ../llvm/include/llvm/Support/TrigramIndex.h
976 - ../llvm/include/llvm/Support/SpecialCaseList.h
976 - ../clang/include/clang/Basic/SanitizerSpecialCaseList.h
502 - ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/unordered_map
467 - ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/xhash
467 - ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/xbit_ops.h
212 - ../llvm/include/llvm/ADT/StringSet.h
Sameer Sahasrabuddhe [Thu, 27 Feb 2020 10:29:25 +0000 (15:59 +0530)]
[AMDGPU] improve fragile test for divergent branches
Summary:
The affected LIT test intends to test the correct use of divergence
analysis to detect a divergent branch with a uniform predicate. The
passes involved are LLVM IR passes, but the test runs llc and tries to
match against generated ISA, which makes it hard to demonstrate that
the intended behavior was really tested. Replaced this with a test
that invokes opt on the required passes and then checks for the
appropriate changes in the LLVM IR.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D75267
Nicolas Vasilache [Thu, 27 Feb 2020 17:58:41 +0000 (12:58 -0500)]
[mlir] Hotfix - Rename MLIRRuntimeUtils to mlir_runtime_utils
Nikita Popov [Thu, 20 Feb 2020 21:42:42 +0000 (22:42 +0100)]
[InstCombine] DCE instructions earlier
When InstCombine initially populates the worklist, it already
performs constant folding and DCE. However, as the instructions
are initially visited in program order, this DCE can pick up only
the last instruction of a dead chain, the rest would only get
picked up in the main InstCombine run.
To avoid this, we instead perform the DCE in separate pass over the
collected instructions in reverse order, which will allow us to
pick up full dead instruction chains. We already need to do this
reverse iteration anyway to populate the worklist, so this
shouldn't add extra cost.
This by itself only fixes a small part of the problem though:
The same basic issue also applies during the main InstCombine loop.
We generally always want DCE to occur as early as possible,
because it will allow one-use folds to happen. Address this by also
performing DCE while adding deferred instructions to the main worklist.
This drops the number of tests that perform more than 2 InstCombine
iterations from ~80 to ~40. There's some spurious test changes due
to operand order / icmp toggling.
Differential Revision: https://reviews.llvm.org/D75008
John Brawn [Fri, 7 Feb 2020 14:21:13 +0000 (14:21 +0000)]
Add an attribute registry so plugins can add attributes
When constructing a ParsedAttr the ParsedAttrInfo gets looked up in the
AttrInfoMap, which is auto-generated using tablegen. If that lookup fails then
we look through the ParsedAttrInfos that plugins have added to the registry and
check if any has a spelling that matches.
Differential Revision: https://reviews.llvm.org/D31338
Simon Moll [Thu, 27 Feb 2020 17:05:54 +0000 (09:05 -0800)]
Remove BinaryOperator::CreateFNeg
Use UnaryOperator::CreateFNeg instead.
Summary:
With the introduction of the native fneg instruction, the
fsub -0.0, %x idiom is obsolete. This patch makes LLVM
emit fneg instead of the idiom in all places.
Reviewed By: cameron.mcinally
Differential Revision: https://reviews.llvm.org/D75130
Alexey Bader [Thu, 27 Feb 2020 13:23:54 +0000 (16:23 +0300)]
Revert "[SYCL] Driver option to select SYCL version"
This reverts commit
bd97704eaaaab5a95ecb048ce343c1a4be5d94e5.
It broke tests on mac: http://45.33.8.238/mac/9011/step_7.txt
Pierre-vh [Thu, 27 Feb 2020 12:32:51 +0000 (12:32 +0000)]
[Transforms][Debugify] Ignore PHI nodes when checking for DebugLocs
Fix for: https://bugs.llvm.org/show_bug.cgi?id=37964
Differential Revision: https://reviews.llvm.org/D75242
Dan Gohman [Mon, 25 Nov 2019 17:50:58 +0000 (09:50 -0800)]
[WebAssembly] Mangle the argc/argv `main` as `__wasm_argc_argv`.
WebAssembly enforces a rule that caller and callee signatures must
match. This means that the traditional technique of passing `main`
`argc` and `argv` even when it doesn't need them doesn't work.
Currently the backend renames `main` to `__original_main`, however this
doesn't interact well with LTO'ing libc, and the name isn't intuitive.
This patch allows us to transition to `__main_argc_argv` instead.
This implements the proposal in
https://github.com/WebAssembly/tool-conventions/pull/134
with a flag to disable it when targeting Emscripten, though this is
expected to be temporary, as discussed in the proposal comments.
Differential Revision: https://reviews.llvm.org/D70700
Dan Gohman [Thu, 27 Feb 2020 15:51:37 +0000 (07:51 -0800)]
[WebAssembly] Teach lld how to demangle "__main_argc_argv".
WebAssembly requires that caller and callee signatures match, so it
can't do the usual trick of passing more arguments to main than it
expects. Instead WebAssembly will mangle "main" with argc/argv
parameters as "__main_argc_argv". This patch teaches lld how to
demangle it.
This patch is part of https://reviews.llvm.org/D70700.
Dan Gohman [Thu, 27 Feb 2020 15:49:56 +0000 (07:49 -0800)]
[WebAssembly] Add an `isWasm` target triple predicate.
This simplies code which needs to apply the same logic to both wasm32
and wasm64.
This patch is part of https://reviews.llvm.org/D70700.
Simon Pilgrim [Thu, 27 Feb 2020 15:53:22 +0000 (15:53 +0000)]
[InstCombine] Add PR14365 test cases + vector equivalents.
Simon Pilgrim [Thu, 27 Feb 2020 15:36:13 +0000 (15:36 +0000)]
[CostModel][X86] Improve extract/insert element costs (PR43605)
This tries to improve the accuracy of extract/insert element costs by accounting for subvector extraction/insertion for >128-bit vectors and the shuffling of elements to/from the 0'th index.
It also adds INSERTPS for f32 types and PINSR/PEXTR costs for integer types (at the moment we assume the same cost as MOVD/MOVQ - which isn't always true).
Differential Revision: https://reviews.llvm.org/D74976
Sam Parker [Thu, 27 Feb 2020 15:36:53 +0000 (15:36 +0000)]
Revert "[ARM] Add CPSR as an implicit use of t2IT"
This reverts commit
e58229fded0407f3e4f77cd87bedcd4d35bb7c89.
Differential Revision: https://reviews.llvm.org/D75186
Alexey Lapshin [Thu, 27 Feb 2020 14:53:00 +0000 (17:53 +0300)]
[Debuginfo][NFC] Unify error reporting routines inside DebugInfoDWARF.
Summary:
Error reporting in DebugInfoDWARF library currently done in three ways :
1. Direct calls to WithColor::error()/WithColor::warning()
2. ErrorPolicy defaultErrorHandler(Error E);
3. void dumpWarning(Error Warning);
additionally, other locations could have more variations:
lld/ELF/SyntheticSection.cpp
if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
error(toString(sec) + ": " + toString(std::move(e)));
DebugInfo/DWARF/DWARFUnit.cpp
if (Error e = tryExtractDIEsIfNeeded(CUDieOnly))
WithColor::error() << toString(std::move(e));
Thus error reporting could look inconsistent. To have a consistent error
messages it is necessary to have a possibility to redefine error
reporting functions. This patch creates two handlers and allows to
redefine them. It also patches all places inside DebugInfoDWARF
to use these handlers.
The intention is always to use following handlers for error reporting
purposes inside DebugInfoDWARF:
DebugInfo/DWARF/DWARFContext.h
std::function<void(Error E)> RecoverableErrorHandler = WithColor::defaultErrorHandler;
std::function<void(Error E)> WarningHandler = WithColor::defaultWarningHandler;
This is last patch from series of patches: D74481, D74635, D75118.
Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere
Reviewed By: jhenderson
Subscribers: grimar, hiraditya, llvm-commits
Tags: #llvm, #debug-info
Differential Revision: https://reviews.llvm.org/D74308
Bardia Mahjour [Wed, 26 Feb 2020 17:51:58 +0000 (12:51 -0500)]
[DA] Delinearization of fixed-size multi-dimensional arrays
Summary:
Currently the dependence analysis in LLVM is unable to compute accurate
dependence vectors for multi-dimensional fixed size arrays.
This is mainly because the delinearization algorithm in scalar evolution
relies on parametric terms to be present in the access functions. In the
case of fixed size arrays such parametric terms are not present, but we
can use the indexes from GEP instructions to recover the subscripts for
each dimension of the arrays. This patch adds this ability under the
existing option `-da-disable-delinearization-checks`.
Authored By: bmahjour
Reviewer: Meinersbur, sebpop, fhahn, dmgreen, grosser, etiotto, bollu
Reviewed By: Meinersbur
Subscribers: hiraditya, arphaman, Whitney, ppc-slack, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72178
Ruyman [Fri, 26 Jul 2019 15:21:01 +0000 (16:21 +0100)]
[SYCL] Driver option to select SYCL version
Summary:
User can select the version of SYCL the compiler will
use via the flag -sycl-std, similar to -cl-std.
The flag defines the LangOpts.SYCLVersion option to the
version of SYCL. The default value is undefined.
If driver is building SYCL code, flag is set to the default SYCL
version (1.2.1)
The preprocessor uses this variable to define CL_SYCL_LANGUAGE_VERSION macro,
which should be defined according to SYCL 1.2.1 standard.
Only valid value at this point for the flag is 1.2.1.
Co-Authored-By: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
Signed-off-by: Ruyman Reyes <ruyman@codeplay.com>
Subscribers: ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72857
Signed-off-by: Alexey Bader <alexey.bader@intel.com>
Krzysztof Parzyszek [Thu, 27 Feb 2020 15:04:56 +0000 (09:04 -0600)]
[Hexagon] Do not use init_arrays by default
Nicolas Vasilache [Thu, 27 Feb 2020 14:51:15 +0000 (09:51 -0500)]
[mlir] NFC - Move runner utils from mlir-cpu-runner to ExecutionEngine
Runner utils are useful beyond just CPU and hiding them within the test directory
makes it unnecessarily harder to reuse in other projects.
Kirill Bobyrev [Thu, 27 Feb 2020 14:58:39 +0000 (15:58 +0100)]
Revert "Devirtualize a call on alloca without waiting for post inline cleanup and next"
This reverts commit
59fb9cde7a4a96fe8485a80d9010e4420ffdca82.
The patch caused internal miscompilations.
Jay Foad [Wed, 26 Feb 2020 15:16:57 +0000 (15:16 +0000)]
[AMDGPU][ConstantFolding] Fold llvm.amdgcn.fract intrinsic
Reviewers: nhaehnle, arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75179
Simon Pilgrim [Thu, 27 Feb 2020 14:34:37 +0000 (14:34 +0000)]
Fix cppcheck definition/declaration arg mismatch warnings. NFCI.
Simon Pilgrim [Thu, 27 Feb 2020 14:27:16 +0000 (14:27 +0000)]
[X86] Use Subtarget.useSoftFloat() in X86TargetLowering constructor
Avoid use of X86TargetLowering::useSoftFloat() in the constructor as its a virtual function
Aaron Ballman [Thu, 27 Feb 2020 14:29:40 +0000 (09:29 -0500)]
Adding some documentation for __builtin_dump_struct.
Adrian Kuegel [Thu, 27 Feb 2020 12:03:05 +0000 (13:03 +0100)]
Add GPU lowerings for the different log ops.
Summary: This adds GPU lowerings for log, log10 and log2.
Reviewers: mravishankar, herhut
Subscribers: jholewinski, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75239
Simon Pilgrim [Thu, 27 Feb 2020 14:23:05 +0000 (14:23 +0000)]
Fix shadow variable warning. NFC.
Simon Pilgrim [Thu, 27 Feb 2020 14:20:30 +0000 (14:20 +0000)]
Fix shadow variable warnings. NFC.
Simon Pilgrim [Thu, 27 Feb 2020 14:02:20 +0000 (14:02 +0000)]
[X86] LowerMSCATTER/MGATHER - reduce scope of MaskVT. NFCI.
Fixes cppcheck warning.
Simon Pilgrim [Thu, 27 Feb 2020 13:55:31 +0000 (13:55 +0000)]
Fix uninitialized variable warning. NFC.
Alex Zinenko [Thu, 27 Feb 2020 13:45:54 +0000 (14:45 +0100)]
[mlir] fix wrong symbol order in AffineApplyNormalizer
Summary:
AffineApplyNormalizer provides common logic for folding affine maps that appear
in affine.apply into other affine operations that use the result of said
affine.apply. In the process, affine maps of both operations are composed.
During the composition `A.compose(B)` the symbols from the map A are placed
before those of the map B in a single concatenated symbol list. However,
AffineApplyNormalizer was ordering the operands of the operation being
normalized by iteratively appending the symbols into a single list accoridng to
the operand order, regardless of whether these operands are symbols of the
current operation or of the map that is being folded into it. This could lead
to wrong order of symbols and, when the symbols were bound to constant values,
to visibly incorrect folding of constants into affine maps as reported in
PR45031. Make sure symbols operands to the current operation are always placed
before symbols coming from the folded maps.
Update the test that was exercising the incorrect folder behavior. For some
reason, the order of symbol operands was swapped in the test input compared to
the previous operations, making it easy to assume the correct maps were
produced whereas they were swapping the symbols back due to the problem
described above.
Closes https://bugs.llvm.org/show_bug.cgi?id=45031
Differential Revision: https://reviews.llvm.org/D75247
Haojian Wu [Thu, 27 Feb 2020 13:46:01 +0000 (14:46 +0100)]
[clangd][NFC] Don't query the index if the rename symbol is function
local.
This would save an unnecessary index query when renaming a function
local symbol in cross-file rename mode.
Simon Pilgrim [Thu, 27 Feb 2020 13:52:16 +0000 (13:52 +0000)]
[X86] createVariablePermute - handle case where recursive createVariablePermute call fails
Account for the case where a recursive createVariablePermute call with a wider vector type fails.
Original test case from @craig.topper (Craig Topper)
Jonathan Coe [Thu, 27 Feb 2020 13:46:43 +0000 (13:46 +0000)]
[clang-format] Recognize C# named argument colons as a token type
Summary:
No longer merge 'name' and ':' into a single token.
Ensure that line breaks cannot be placed before or after a named-argument colon.
Ensure that no space is inserted before a named-argument colon.
Reviewers: krasimir
Reviewed By: krasimir
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D75244
Hans Wennborg [Thu, 27 Feb 2020 13:33:43 +0000 (14:33 +0100)]
Revert "make -fmodules-codegen and -fmodules-debuginfo work also with PCHs"
This caused PR44953. See also the discussion on D74846.
This reverts commit
cbc9d22e49b434b6ceb2eb94b67079d02e0a7b74.
Djordje Todorovic [Thu, 27 Feb 2020 10:44:53 +0000 (11:44 +0100)]
[CallSiteInfo] Handle bundles when updating call site info
This will address the issue: P8198 and P8199 (from D73534).
The methods was not handle bundles properly.
Differential Revision: https://reviews.llvm.org/D74904
Andrzej Warzynski [Fri, 21 Feb 2020 13:59:02 +0000 (13:59 +0000)]
[AArch64][SVE] Add intrinsics for first-faulting gather loads
Summary:
The following intrinsics are added:
* @llvm.aarch64.sve.ldff1.gather
* @llvm.aarch64.sve.ldff1.gather.index
* @llvm.aarch64.sve.ldff1.gather_sxtw
* @llvm.aarch64.sve.ldff1.gather.uxtw
* @llvm.aarch64.sve.ldff1.gather_sxtw.index
* @llvm.aarch64.sve.ldff1.gather.uxtw.index
* @llvm.aarch64.sve.ldff1.gather.scalar.offset
Although this patch is quite substantial, the vast majority of the
implementation is just a 'copy & paste' of the implementation of regular
gather loads, including tests. There's only a handful of new
definitions:
* AArch64ISD nodes defined in AArch64ISelLowering.h (e.g. GLDFF1)
* Seleciton DAG Types in AArch64SVEInstrInfo.td (e.g.
AArch64ldff1_gather)
* intrinsics in IntrinsicsAArch64.td (e.g. aarch64_sve_ldff1_gather)
* Pseudo instructions in SVEInstrFormats.td to workaround the issue of
use-before-def for the FFR register.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D75128
Hans Wennborg [Thu, 27 Feb 2020 12:48:26 +0000 (13:48 +0100)]
[driver][darwin] Don't use -platform_version flag by default (PR44813)
The code in llvmorg-10-init-12188-g25ce33a6e4f is a breaking change for
users of older linkers who don't pass a version parameter, which
prevents a drop-in clang upgrade. Old tools can't know about what future
tools will do, so as a general principle the burden should be new tools
to be compatible by default. Also, for comparison, none of the other
tests of Version within AddLinkArgs add any new behaviors unless the
version is explicitly specified. Therefore, this patch changes the
-platform_version behavior from opt-out to opt-in.
Patch by David Major!
Differential revision: https://reviews.llvm.org/D74784
Simon Pilgrim [Thu, 27 Feb 2020 12:27:18 +0000 (12:27 +0000)]
[AVX] Cleanup check prefixes
We were missing some coverage for avx512bw targets as the update script can be pretty dumb about check prefix orders...
Kirill Bobyrev [Thu, 27 Feb 2020 12:16:12 +0000 (13:16 +0100)]
Require asserts for debuginline-cost-delta.ll test
-debug-only=inline-cost does not exist in optimized builds without
asserts and therefore the test fails for such configurations.
Related revision:
c965fd942f1d2de6179cd1a2f78c78fa4bd74626
David Green [Tue, 25 Feb 2020 11:26:53 +0000 (11:26 +0000)]
[ARM] Fixup FP16 bitcasts
Under fp16 we optimise the bitcast between a VMOVhr and a CopyToReg via
custom lowering. This rewrites that to be a DAG combine instead, which
helps produce better code in the cases where the bitcast is actaully
legal.
Differential Revision: https://reviews.llvm.org/D72753
Jonathan Coe [Thu, 27 Feb 2020 11:39:57 +0000 (11:39 +0000)]
[clang-format] Handle commas in [] in C#
Summary:
Respect setting `SpacesInSquareBrackets` for commas in square brackets in C# code.
Reviewers: krasimir, MyDeveloperDay
Reviewed By: krasimir
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D75182
Hans Wennborg [Thu, 27 Feb 2020 11:35:10 +0000 (12:35 +0100)]
[MC][ARM] Resolve some pcrel fixups at assembly time (PR44929)
MC currently does not emit these relocation types, and lld does not
handle them. Add FKF_Constant as a work-around of some ARM code after
D72197. Eventually we probably should implement these relocation types.
By Fangrui Song!
Differential revision: https://reviews.llvm.org/D72892
Jay Foad [Thu, 27 Feb 2020 11:27:49 +0000 (11:27 +0000)]
[InstCombine] Fix confusing variable name.
Raphael Isemann [Thu, 27 Feb 2020 10:46:10 +0000 (11:46 +0100)]
[lldb] Show the actual error when 'watchpoint set expression' failed
Currently we only show the user that the expression failed but not
what is actually wrong with it. This just dumps the error we get
back alongside the other output to the error stream.
This should also help with finding out with why sometimees the
TestWatchLocationWithWatchSet.py test fails here on the LLDB
incremental bot on Green Dragon.
Kirill Bobyrev [Thu, 27 Feb 2020 10:58:32 +0000 (11:58 +0100)]
Revert "[Hexagon] Improve casting of boolean HVX vectors to scalars"
This reverts commit
7691790dfd1011d08f5468f63952d7690755aad4.
The patch is failing tests with MSAN:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/39054/steps/check-llvm%20msan/logs/stdio
Djordje Todorovic [Thu, 27 Feb 2020 09:30:41 +0000 (10:30 +0100)]
[DebugInfo][ARM] Fix noreg case when checkig if it is an addImm
This fixes a build failure with an ARM buildbot.
Differential Revision: https://reviews.llvm.org/D75231
David Stenberg [Thu, 27 Feb 2020 08:54:37 +0000 (09:54 +0100)]
[DebugInfo] Describe call site values for chains of expression producing instrs
Summary:
If the describeLoadedValue() hook produced a DIExpression when
describing a instruction, and it was not possible to emit a call site
entry directly (the value operand was not an immediate nor a preserved
register), then that described value could not be inserted into the
worklist, and would instead be dropped, meaning that the parameter's
call site value couldn't be described.
This patch extends the worklist so that each entry has an DIExpression
that is built up when iterating through the instructions.
This allows us to describe instruction chains like this:
$reg0 = mv $fp
$reg0 = add $reg0, offset
call @call_with_offseted_fp
Since DW_OP_LLVM_entry_value operations can't be combined with any other
expression, such call site entries will not be emitted. I have added a
test, dbgcall-site-expr-entry-value.mir, which verifies that we don't
assert or emit broken DWARF in such cases.
Reviewers: djtodoro, aprantl, vsk
Reviewed By: djtodoro, vsk
Subscribers: hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D75036
David Stenberg [Thu, 27 Feb 2020 08:53:31 +0000 (09:53 +0100)]
[DebugInfo][NFC] Move out lambdas from collectCallSiteParameters()
Summary:
This is a preparatory patch for D75036, in which a debug expression is
associated with each parameter register in the worklist. In that patch
the two lambda functions addToWorklist() and finishCallSiteParams() grow
a bit, so move those out to separate functions. This patch also prepares
for each parameter register having their own expression moving the
creation of the DbgValueLoc into finishCallSiteParams().
Reviewers: djtodoro, vsk
Reviewed By: djtodoro, vsk
Subscribers: hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D75050
Raphael Isemann [Thu, 27 Feb 2020 10:16:16 +0000 (11:16 +0100)]
[lldb][NFC] Fix several -Wdocumentation warnings
The GetOffset documentation was copied from the function above
so I completely deleted that one. The rest was just outdated
documentation that didn't keep up with renamed or changed
function parameters/return types.
Sam Parker [Thu, 27 Feb 2020 10:10:40 +0000 (10:10 +0000)]
[ARM] Add CPSR as an implicit use of t2IT
This use is already attached to the BUNDLE instruction but is lost
after finalisation.
Differential Revision: https://reviews.llvm.org/D75186
Raphael Isemann [Thu, 27 Feb 2020 09:45:26 +0000 (10:45 +0100)]
[lldb] Skip TestWasm.py on sanitized builds until D75200 has landed
Simon Tatham [Thu, 27 Feb 2020 09:36:43 +0000 (09:36 +0000)]
[clang,ARM,MVE] Remove redundant #includes in test file.
I made that file by pasting together several pieces, and forgot to
take out the #include <arm_mve.h> from the tops of the later ones, so
the test was pointlessly including the same header five times. NFC.
Sam Parker [Thu, 27 Feb 2020 09:38:13 +0000 (09:38 +0000)]
[NFC][ARM] Add test case
Sjoerd Meijer [Thu, 27 Feb 2020 09:23:47 +0000 (09:23 +0000)]
[AArch64] Peephole optimization: merge AND and TST instructions
In some cases Clang does not perform merging of instructions AND and TST (aka
ANDS xzr).
Example:
tst x2, x1
and x3, x2, x1
to:
ands x3, x2, x1
This patch add such merging during instruction selection: when AND is replaced
with ANDS instruction in LowerSELECT_CC, all users of AND also should be
changed for using this ANDS instruction
Short discussion on mailing list:
http://llvm.1065342.n5.nabble.com/llvm-dev-ARM-Peephole-optimization-instructions-tst-add-tp133109.html
Patch by Pavel Kosov.
Differential Revision: https://reviews.llvm.org/D71701
Kadir Cetinkaya [Wed, 26 Feb 2020 17:22:27 +0000 (18:22 +0100)]
[clangd] Get rid of lexer usage in AST.cpp
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75193
Guillaume Chatelet [Thu, 20 Feb 2020 14:00:45 +0000 (15:00 +0100)]
[libc] Add CMake script to check host cpu features
Summary:
Tested on MacOSX and Linux.
For robustness we can go the OpenCV way and add individual c++ files with intrinsics.
https://github.com/opencv/opencv/blob/master/cmake/checks/cpu_avx2.cpp
Reviewers: sivachandra, abrachet
Subscribers: mgorny, MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D74897
Kadir Cetinkaya [Wed, 26 Feb 2020 14:23:40 +0000 (15:23 +0100)]
[clangd] Get rid of getBeginningOfIdentifier helper
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75176
Alexander Belyaev [Wed, 26 Feb 2020 20:12:39 +0000 (21:12 +0100)]
[MLIR] Add `take_back()` to STLExtras.h for completeness.
Differential Revision: https://reviews.llvm.org/D75208
Siva Chandra Reddy [Fri, 21 Feb 2020 06:05:52 +0000 (22:05 -0800)]
[libc] Add an optional `NAME` argument to `add_entrypoint_object` rule.
This argument can be used to specify the entrypoint name if it is different
from the target name.
Reviewers: gchatelet, abrachet
Differential Revision: https://reviews.llvm.org/D74948
ogiroux [Thu, 27 Feb 2020 00:49:37 +0000 (16:49 -0800)]
Some fixes for open breaks on MacOS and UBSan
Nemanja Ivanovic [Thu, 27 Feb 2020 03:56:11 +0000 (21:56 -0600)]
Fix buildbot break after
c46b85aaf4d4
I added test cases that rely on the availability of the PPC target into
the general directory for the loop vectorizer. This causes failures on
bots that don't build the PPC target. Moving them to the PowerPC directory
to fix this.
Nemanja Ivanovic [Wed, 26 Feb 2020 23:13:14 +0000 (17:13 -0600)]
[LoopVectorize] Fix cost for calls to functions that have vector versions
A recent commit
(https://reviews.llvm.org/rG66c120f02560ef528a60924104ead66f330190f1) changed
the cost for calls to functions that have a vector version for some
vectorization factor. However, no check is performed for whether the
vectorization factor matches the current one being cost modeled. This leads to
attempts to widen call instructions to a vectorization factor for which such a
function does not exist, which in turn leads to an assertion failure.
This patch adds the check for vectorization factor (i.e. not just that the
called function has a vector version for some VF, but that it has a vector
version for this VF).
Differential revision: https://reviews.llvm.org/D74944
Matt Arsenault [Thu, 27 Feb 2020 03:29:33 +0000 (22:29 -0500)]
AMDGPU/GlobalISel: Add missing test for G_UMULH
Matt Arsenault [Wed, 26 Feb 2020 22:21:10 +0000 (17:21 -0500)]
GlobalISel: Fix lowering for G_UADDE/G_USUBE
The type parameter passed into lower is invalid and should be removed
from the function.
Matt Arsenault [Wed, 26 Feb 2020 22:12:54 +0000 (17:12 -0500)]
AMDGPU/GlobalISel: Add missing G_[US]ADDE/G_[US]SUBE tests
The s64 case currently crashes, so leave that for later.
Matt Arsenault [Wed, 26 Feb 2020 22:18:43 +0000 (17:18 -0500)]
GlobalISel: Cleanup code with MachineIRBuilder features
Stefanos Baziotis [Thu, 27 Feb 2020 02:36:11 +0000 (20:36 -0600)]
[docs][LoopTerminology] Add Loop Simplify Form description.
Information taken from https://youtu.be/3pRhvQi7Z10?t=481 and
comments in LoopSimplify.h.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D74989
Craig Topper [Thu, 27 Feb 2020 02:06:59 +0000 (18:06 -0800)]
[X86] Add test cases showing incorrect setting of nofpexcept flag due to CSE occuring during SelectionDAG creation.
These tests generate two nodes that are identical except for the
metadata that indicates their exception behavior. The nodes get
CSEd by SelectionDAG, but the nofpexcept flag is being set based
only on the fpexcept.ignore node being created last.
We need to detect this case and intersect the flags similar to
what is already done with fast math flags.
Fangrui Song [Thu, 27 Feb 2020 00:24:58 +0000 (16:24 -0800)]
[ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"
Test cleanups.
Kirill Naumov [Wed, 26 Feb 2020 23:44:42 +0000 (15:44 -0800)]
Cost Annotation Writer for InlineCost
Add extra diagnostics for the inline cost analysis under
-print-instruction-deltas cl option. When enabled along with
-debug-only=inline-cost it prints the IR of inline candidate
annotated with cost and threshold change per every instruction.
Reviewed By: apilipenko, davidxl, mtrofin
Differential Revision: https://reviews.llvm.org/D71501
Craig Topper [Thu, 27 Feb 2020 00:54:38 +0000 (16:54 -0800)]
[X86] Add proper MachinePointerInfo to stack store created in LowerWin64_i128OP.
Louis Dionne [Thu, 27 Feb 2020 00:29:49 +0000 (19:29 -0500)]
[libc++] Workaround unused variable warning in test
This only showed up in C++11/C++14 where the static_assert below was
ifdef'd out, and the variable was indeed unused.
Craig Topper [Thu, 27 Feb 2020 00:16:03 +0000 (16:16 -0800)]
[X86] Explicitly pass Destination VT and debug location to BuildFILD. NFC
We'd already passed most everything else. Might was well pass
these two things and stop passing Op.
Craig Topper [Thu, 27 Feb 2020 00:02:32 +0000 (16:02 -0800)]
[X86] Explicitly pass Pointer, MachinePointerInfo and Alignment to BuildFILD.
Previously this code was called into two ways, either a FrameIndexSDNode
was passed in StackSlot. Or a load node was passed in the argument
called StackSlot. This was determined by a dyn_cast to FrameIndexSDNode.
In the case of a load, we had to go find the real pointer from
operand 0 and cast the node to MemSDNode to find the pointer info.
For the stack slot case, the code assumed that the stack slot
was perfectly aligned despite not being the creator of the slot.
This commit modifies the interface to make the caller responsible
for passing all of the required information to avoid all the
guess work and reverse engineering.
I'm not aware of any issues with the original code after an
earlier commit to fix the alignment of one of the stack objects.
This is just clean up to make the code less surprising.
Louis Dionne [Thu, 27 Feb 2020 00:14:34 +0000 (19:14 -0500)]
Revert "[libc++] Do not set the `availability=XXX` feature when not testing against a system libc++"
This reverts commit
7dd6a862e, which broke more tests than it fixed.
Louis Dionne [Thu, 27 Feb 2020 00:09:07 +0000 (19:09 -0500)]
[libc++] Temporarily disable availability markup for the C++20 Synchronization library
The markup wasn't quite right, and that broke compilation with availability
markup enabled. I'm disabling it until I have time to fix it properly to
get the CI mostly green again.
Richard Smith [Wed, 26 Feb 2020 22:50:04 +0000 (14:50 -0800)]
PR44978: Accept as an extension some cases where destructor name lookup
is ambiguous, but only one of the possible lookup results could possibly
be right.
Clang recently started diagnosing ambiguity in more cases, and this
broke the build of Firefox. GCC, ICC, MSVC, and previous versions of
Clang all accept some forms of ambiguity here (albeit different ones in
each case); this patch mostly accepts anything any of those compilers
accept.
Erik Pilkington [Wed, 26 Feb 2020 22:47:02 +0000 (14:47 -0800)]
Disable memory leak checking in a test to work around a bot failure
This leak is expected, see the discussion on commit 85fb997
Adrian Prantl [Wed, 26 Feb 2020 22:12:30 +0000 (14:12 -0800)]
Visit previously unreachable nodes in the debug info metadata verifier.
This allows for diagnosing malformed LLVM IR debug info metadata such
as the one in the testcase.
<rdar://problem/
59756060>
Differential Revision: https://reviews.llvm.org/D75212
Craig Topper [Wed, 26 Feb 2020 22:11:19 +0000 (14:11 -0800)]
[X86] Query constant pool object alignment instead of hardcoding.
Craig Topper [Wed, 26 Feb 2020 22:10:50 +0000 (14:10 -0800)]
[X86] Use proper alignment for stack temporary and correct MachinePointerInfo for stack accesses in LowerUINT_TO_FP.
Craig Topper [Wed, 26 Feb 2020 21:41:00 +0000 (13:41 -0800)]
[X86] Use correct MachineMemOperand for stack load in LowerFLT_ROUNDS_
Craig Topper [Wed, 26 Feb 2020 19:46:40 +0000 (11:46 -0800)]
[X86] Add proper MachinePointerInfo to the loads/stores created for moving data between SSE and X87 in X86DAGToDAGISel::PreprocessISelDAG
Davide Italiano [Wed, 26 Feb 2020 22:31:06 +0000 (14:31 -0800)]
[ObjectFileMachO] Fix a build error on embedded.
Amara Emerson [Mon, 24 Feb 2020 22:27:32 +0000 (14:27 -0800)]
[AArch64][GlobalISel] Fixup <32b heterogeneous regbanks of G_PHIs just before selection.
Since all types <32b on gpr end up being assigned gpr32 regclasses, we can end
up with PHIs here which try to select between a gpr32 and an fpr16. Ideally RBS
shouldn't be selecting heterogenous regbanks for operands if possible, but we
still need to be able to deal with it here.
To fix this, if we have a gpr-bank operand < 32b in size and at least one other
operand is on the fpr bank, then we add cross-bank copies to homogenize the
operand banks. For simplicity the bank that we choose to settle on is whatever
bank the def operand has. For example:
%endbb:
%dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2:fpr(s16), %bb2
=>
%bb2:
...
%in2_copy:gpr(s16) = COPY %in2:fpr(s16)
...
%endbb:
%dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2_copy:gpr(s16), %bb2
Differential Revision: https://reviews.llvm.org/D75086
Nathan James [Wed, 26 Feb 2020 22:06:38 +0000 (22:06 +0000)]
[ASTMatchers] HasNameMatcher handles `extern "C"`
Summary: Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42193 | hasName AST matcher is confused by extern "C" in namespace. ]]
Reviewers: klimek, aaron.ballman, gribozavr2
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75202