Johannes Doerfert [Mon, 4 May 2020 00:42:21 +0000 (19:42 -0500)]
[Attributor][NFC] Use reference instead of pointer
Johannes Doerfert [Mon, 4 May 2020 00:08:30 +0000 (19:08 -0500)]
[Attributor][NFC] Proactively ask for `nocapure` on call site arguments
This minimizes test noise later on and is in line with other attributes
we derive proactively.
Sam McCall [Sun, 3 May 2020 20:13:49 +0000 (22:13 +0200)]
[clangd] Fix yet-another gratuitous llvm::Error crash
Shilei Tian [Sun, 3 May 2020 19:58:46 +0000 (15:58 -0400)]
[OpenMP] Fix an issue of wrong return type of DeviceRTLTy::getNumOfDevices
Summary: There is a typo in DeviceRTLTy::getNumOfDevices that the type of its return value is bool. It will lead to a problem of wrong device number returned from omp_get_num_devices.
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: yaxunl, guansong, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D79255
Kadir Cetinkaya [Sun, 3 May 2020 19:06:51 +0000 (21:06 +0200)]
[clangd] Reland LSP latency test
Sergey Dmitriev [Sun, 3 May 2020 18:28:53 +0000 (11:28 -0700)]
[Attributor] Bitcast constant to the returned value type if it has different type
Reviewers: jdoerfert, sstefan1, uenoku
Reviewed By: jdoerfert
Subscribers: hiraditya, uenoku, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79277
Nikita Popov [Sun, 3 May 2020 18:45:10 +0000 (20:45 +0200)]
Revert "[InstSimplify] Remove known bits constant folding"
This reverts commit
08556afc54e7ddfa7cc2fdd69c615ad417722517.
This breaks some AMDGPU tests.
Nikita Popov [Fri, 20 Mar 2020 10:57:20 +0000 (11:57 +0100)]
[InstSimplify] Remove known bits constant folding
If SimplifyInstruction() does not succeed in simplifying the
instruction, it will compute the known bits of the instruction
in the hope that all bits are known and the instruction can be
folded to a constant. I have removed a similar optimization
from InstCombine in D75801, and would like to drop this one as well.
On average, we spend ~1% of total compile-time performing this
known bits calculation. However, if we introduce some additional
statistics for known bits computations and how many of them succeed
in simplifying the instruction we get (on test-suite):
instsimplify.NumKnownBits: 216
instsimplify.NumKnownBitsComputed:
13828375
valuetracking.NumKnownBitsComputed:
45860806
Out of ~14M known bits calculations (accounting for approximately
one third of all known bits calculations), only 0.0015% succeed in
producing a constant. Those cases where we do succeed to compute
all known bits will get folded by other passes like InstCombine
later. On test-suite, only lencod.test and GCC-C-execute-pr44858.test
show a hash difference after this change. On lencod we see an
improvement (a loop phi is optimized away), on the GCC torture
test a regression (a function return value is determined only
after IPSCCP, preventing propagation from a noinline function.)
There are various regressions in InstSimplify tests. However, all
of these cases are already handled by InstCombine, and corresponding
tests have already been added there.
Differential Revision: https://reviews.llvm.org/D79294
Casey Carter [Sun, 3 May 2020 17:59:10 +0000 (10:59 -0700)]
[libc++][test] Use a non-narrowing conversion in assign_pair.pass.cpp
...to avoid warnings, e.g., from MSVC.
Hongtao Yu [Fri, 1 May 2020 19:44:46 +0000 (12:44 -0700)]
[ICP] Handling must tail calls in indirect call promotion
Per the IR convention, a musttail call must precede a ret with an optional bitcast. This was violated by the indirect call promotion optimization which could result an IR like:
; <label>:2192:
br i1 %2198, label %2199, label %2201, !dbg !226012, !prof !229483
; <label>:2199: ; preds = %2192
musttail call fastcc void @foo(i8* %2195), !dbg !226012
br label %2202, !dbg !226012
; <label>:2201: ; preds = %2192
musttail call fastcc void %2197(i8* %2195), !dbg !226012
br label %2202, !dbg !226012
; <label>:2202: ; preds = %605, %2201, %2199
ret void, !dbg !229485
This is being fixed in this change where the return statement goes together with the promoted indirect call. The code generated is like:
; <label>:2192:
br i1 %2198, label %2199, label %2201, !dbg !226012, !prof !229483
; <label>:2199: ; preds = %2192
musttail call fastcc void @foo(i8* %2195), !dbg !226012
ret void, !dbg !229485
; <label>:2201: ; preds = %2192
musttail call fastcc void %2197(i8* %2195), !dbg !226012
ret void, !dbg !229485
Differential Revision: https://reviews.llvm.org/D79258
Mircea Trofin [Fri, 1 May 2020 20:27:43 +0000 (13:27 -0700)]
[llvm][NFC] Inliner: factor cost and reporting out of inlining process
Summary:
This factors cost and reporting out of the inlining workflow, thus
making it easier to reuse when driving inlining from the upcoming
InliningAdvisor.
Depends on: D79215
Reviewers: davidxl, echristo
Subscribers: eraman, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79275
Florian Hahn [Sun, 26 Apr 2020 16:52:49 +0000 (17:52 +0100)]
[VPlan] Remove unused & undefined print method (NFC).
Johannes Doerfert [Fri, 17 Apr 2020 23:03:04 +0000 (18:03 -0500)]
[Attributor][NFC] Encode IRPositions in the bits of a single pointer
This reduces memory consumption for IRPositions by eliminating the
vtable pointer and the `KindOrArgNo` integer. Since each abstract
attribute has an associated IRPosition, the 12-16 bytes we save add up
quickly.
No functional change is intended.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 469545 (260135/s)
temporary memory allocations: 77137 (42735/s)
peak heap memory consumption: 30.50MB
peak RSS (including heaptrack overhead): 119.50MB
total memory leaked: 269.07KB
```
After:
```
calls to allocation functions: 468999 (274108/s)
temporary memory allocations: 77002 (45004/s)
peak heap memory consumption: 28.83MB
peak RSS (including heaptrack overhead): 118.05MB
total memory leaked: 269.07KB
```
Difference:
```
calls to allocation functions: -546 (5808/s)
temporary memory allocations: -135 (1436/s)
peak heap memory consumption: -1.67MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```
---
CTMark 15 runs
Metric: compile_time
Program lhs rhs diff
test-suite...:: CTMark/sqlite3/sqlite3.test 25.07 24.09 -3.9%
test-suite...Mark/mafft/pairlocalalign.test 14.58 14.14 -3.0%
test-suite...-typeset/consumer-typeset.test 21.78 21.58 -0.9%
test-suite :: CTMark/SPASS/SPASS.test 21.95 22.03 0.4%
test-suite :: CTMark/lencod/lencod.test 25.43 25.50 0.3%
test-suite...ark/tramp3d-v4/tramp3d-v4.test 23.88 23.83 -0.2%
test-suite...TMark/7zip/7zip-benchmark.test 60.24 60.11 -0.2%
test-suite :: CTMark/kimwitu++/kc.test 15.69 15.69 -0.0%
test-suite...:: CTMark/ClamAV/clamscan.test 25.43 25.42 -0.0%
test-suite :: CTMark/Bullet/bullet.test 37.63 37.62 -0.0%
Geomean difference -0.8%
---
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D78722
Johannes Doerfert [Thu, 23 Apr 2020 03:03:44 +0000 (22:03 -0500)]
[Attributor][NFC] Let AbstractAttribute be an IRPosition
Since every AbstractAttribute so far, and for the foreseeable future,
corresponds to a single IRPosition we can simplify the class structure.
We already did this for IRAttribute but there is no reason to stop
there.
Nico Weber [Sun, 3 May 2020 16:46:46 +0000 (12:46 -0400)]
Revert "Optimize path::remove_dots"
This reverts commit
53913a65b408ade2956061b4c0aaed6bba907403.
Breaks VFSFromYAMLTest.DirectoryIterationSameDirMultipleEntries
in SupportTests on non-Windows.
Simon Pilgrim [Sun, 3 May 2020 16:38:57 +0000 (17:38 +0100)]
[X86] Add tests showing failure to fold mul(abs(x),abs(x)) -> mul(x,x) (PR39476)
Mircea Trofin [Sun, 3 May 2020 16:28:28 +0000 (09:28 -0700)]
[llvm][NFC] Inliner.cpp shouldInline post-commit feedback
Discussion is in https://reviews.llvm.org/D79215
Kadir Cetinkaya [Sun, 3 May 2020 16:09:40 +0000 (18:09 +0200)]
[clangd] Change include to be relative to current directory
Reid Kleckner [Sun, 3 May 2020 13:26:12 +0000 (06:26 -0700)]
Optimize path::remove_dots
LLD calls this on every source file string in every object file when
writing PDBs, so it is somewhat hot.
Avoid rewriting paths that do not contain path traversal components
(./..). Use find_first_not_of(separators) directly instead of using the
path iterators. The path component iterators appear to be slow, and
directly searching for slashes makes it easier to find double separators
that need to be canonicalized.
I discovered that the VFS relies on remote_dots to not canonicalize
early slashes (/foo or C:/foo) on Windows, so I had to leave that
behavior behind with unit tests for it. This is undesirable, but I claim
that my change is NFC.
Reid Kleckner [Sun, 3 May 2020 02:53:49 +0000 (19:53 -0700)]
[COFF] Paritally inline Symbol::getName, NFC
Sanjay Patel [Sun, 3 May 2020 13:43:49 +0000 (09:43 -0400)]
[InstCombine] use select-of-constants with set/clear bit mask patterns
Cond ? (X & ~C) : (X | C) --> (X & ~C) | (Cond ? 0 : C)
Cond ? (X | C) : (X & ~C) --> (X & ~C) | (Cond ? C : 0)
The select-of-constants form results in better codegen.
There's an existing test diff that shows a transform that
results in an extra IR instruction, but that's an existing
problem.
This is motivated by code seen in LLVM itself - see PR37581:
https://bugs.llvm.org/show_bug.cgi?id=37581
define i8 @src(i8 %x, i8 %C, i1 %b) {
%notC = xor i8 %C, -1
%and = and i8 %x, %notC
%or = or i8 %x, %C
%cond = select i1 %b, i8 %or, i8 %and
ret i8 %cond
}
define i8 @tgt(i8 %x, i8 %C, i1 %b) {
%notC = xor i8 %C, -1
%and = and i8 %x, %notC
%mul = select i1 %b, i8 %C, i8 0
%or = or i8 %mul, %and
ret i8 %or
}
http://volta.cs.utah.edu:8080/z/Vt2WVm
Differential Revision: https://reviews.llvm.org/D78880
Kadir Cetinkaya [Sun, 3 May 2020 13:20:20 +0000 (15:20 +0200)]
[clangd] Drop duplicate header
Benjamin Kramer [Sun, 3 May 2020 12:52:19 +0000 (14:52 +0200)]
[Support] Don't initialize buffer allocated by zlib::uncompress
This is a somewhat annoying API, but not without precedend in this low
level API.
Simon Pilgrim [Sun, 3 May 2020 12:23:46 +0000 (13:23 +0100)]
[X86] Use splitVector helper in truncateVectorWithPACK/splitVectorStore/combineHorizontalMinMaxResult/combineReductionToHorizontal. NFC.
All these locations were performing the same type splitting/extractSubVector calls as the spltVector helper.
LLVM GN Syncbot [Sun, 3 May 2020 12:08:26 +0000 (12:08 +0000)]
[gn build] Port
e64f99c51a8
Nico Weber [Sun, 3 May 2020 12:07:52 +0000 (08:07 -0400)]
[gn build] (manually) port
ad97ccf6b26a more, for include added in
e64f99c51a8
Simon Pilgrim [Sun, 3 May 2020 11:27:14 +0000 (12:27 +0100)]
[X86] Don't limit splitVector helper to simple types.
It can handle EVT just as well (and so can the extractSubVector calls).
Alexey Lapshin [Thu, 30 Apr 2020 11:05:17 +0000 (14:05 +0300)]
[Debuginfo][NFC] Avoid double calling of DWARFDie::find(DW_AT_name).
Summary:
Current implementation of DWARFDie::getName(DINameKind Kind) could
lead to double call to DWARFDie::find(DW_AT_name) in following
scenario:
getName(LinkageName);
getName(ShortName);
getName(LinkageName) calls find(DW_AT_name) if linkage name is not
found. Then, it is called again in getName(ShortName). This patch
alows to request LinkageName and ShortName separately
to avoid extra call to find(DW_AT_name).
It helps D74169 to parse clang debuginfo faster(~1%).
Reviewers: clayborg, dblaikie
Differential Revision: https://reviews.llvm.org/D79173
Nikita Popov [Sun, 3 May 2020 10:42:00 +0000 (12:42 +0200)]
[InstCombine] Duplicate some InstSimplify tests (NFC)
Duplicate some tests in preparation for D79294.
Simon Pilgrim [Sun, 3 May 2020 09:48:28 +0000 (10:48 +0100)]
[X86][SSE] splitAndLowerShuffle - use splitVector helper. NFC.
The splitVector helper uses extractSubVector which splits build vectors like we do here, so avoid reimplementing it.
splitVector could easily be extended to peek through bitcasts as well but I'd prefer to keep this commit NFC.
Simon Pilgrim [Sun, 3 May 2020 08:54:54 +0000 (09:54 +0100)]
[X86] detectAVGPattern - use matchUnaryPredicate helper. NFC.
Use the ISD::matchUnaryPredicate helper to check for inrange constants.
Nikita Popov [Sun, 3 May 2020 10:21:50 +0000 (12:21 +0200)]
[ValueTracking] Convert test to unit test (NFC)
Test this directly, rather than going through InstSimplify.
Kadir Cetinkaya [Sun, 3 May 2020 09:44:52 +0000 (11:44 +0200)]
[clangd] Fix name hiding in TestTracer and disable racy test for now
Kadir Cetinkaya [Thu, 16 Apr 2020 21:12:09 +0000 (23:12 +0200)]
[clangd] Metric tracking through Tracer
Summary: Introduces an endpoint to Tracer for tracking metrics on
internal events.
Reviewers: sammccall
Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78429
Ten Tzen [Sun, 3 May 2020 08:15:59 +0000 (01:15 -0700)]
Test Commit: add two head comments in WinEHPrepare.cpp
This is a Test commit.
Reid Kleckner [Sun, 3 May 2020 01:33:27 +0000 (18:33 -0700)]
Re-land "[PDB] Avoid calling discoverTypeIndices for a known record kind"
Fixed bad usage of slice API causing assertion failures.
Reverts
810c8e9b495c191f49b162cee3fb8829185a2691
Reinstates
bd7ea8641e7667b109534ae06b33be7bc9b59821
Reid Kleckner [Sun, 3 May 2020 01:06:41 +0000 (18:06 -0700)]
[PDB] Bypass generic deserialization code for publics sorting
The number of public symbols is very large, and each deserialization
does a few heap allocations. The public symbols are serialized by the
linker, so we can assume they have the expected layout and use it
directly.
Saves O(#publics) temporary heap allocations and shrinks some data
structures.
Nico Weber [Sun, 3 May 2020 01:06:06 +0000 (21:06 -0400)]
Revert "[PDB] Avoid calling discoverTypeIndices for a known record kind"
This reverts commit
bd7ea8641e7667b109534ae06b33be7bc9b59821.
Breaks check-lld everywhere.
Craig Topper [Sat, 2 May 2020 23:33:48 +0000 (16:33 -0700)]
[X86] Fix a few issues in the evex-to-vex-compress.mir test.
Don't use $noreg for instructions that take register inputs.
Only allow $noreg for parts of memory operands.
Don't use index register with $rip base.
Use RETQ instead of the RET pseudo. This pass is after the
ExpandPseudo pass that converts RET to RETQ.
Craig Topper [Sun, 3 May 2020 00:28:58 +0000 (17:28 -0700)]
[PDB] Remove a couple asserts that are no longer valid now that C13Builders does not use unique_ptr.
These asserts used to check that unique_ptr was not null.
This fixes failures from
7af4bb16417deeb1d01e7dbbbb2272f1f46753c6
Reid Kleckner [Sat, 2 May 2020 23:31:43 +0000 (16:31 -0700)]
[PDB] Remove unique_ptr wrapper around C13 line table subsections
This accounts for a large portion of the memory allocations in LLD.
This DebugSubsectionRecordBuilder object can be stored directly in
C13Builders, it mostly wraps other subsections.
Remove the container kind field from the object. It is always the same
for all elements in the vector, and we can pass it in during writing.
Reid Kleckner [Sat, 2 May 2020 22:48:31 +0000 (15:48 -0700)]
[PDB] Avoid calling discoverTypeIndices for a known record kind
This particular overload allocates memory, and we do this for every
S_[GL]PROC32_ID record. Instead, hardcode the offset of the typeindex
that we are looking for in the LF_[MEM]FUNC_ID record. We already
assumed that looking up the item index already found a record of this
kind.
Thomas Preud'homme [Fri, 1 May 2020 18:25:08 +0000 (19:25 +0100)]
[docs][FileCheck] Fix invalid example
Summary:
FileCheck documentation contains an example of a numeric variable
defined and used on the same line. This is not currently supported by
FileCheck so this commit fixes the example to use CHECK-SAME for the
variable use.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D79253
LemonBoy [Sat, 2 May 2020 21:09:18 +0000 (14:09 -0700)]
[SelectionDAG] Unify scalarizeVectorLoad and VectorLegalizer::ExpandLoad
The two code paths have the same goal, legalizing a load of a non-byte-sized vector by loading the "flattened" representation in memory, slicing off each single element and then building a vector out of those pieces.
The technique employed by `ExpandLoad` is slightly more convoluted and produces slightly better codegen on ARM, AMDGPU and x86 but suffers from some bugs (D78480) and is wrong for BE machines.
Differential Revision: https://reviews.llvm.org/D79096
Reid Kleckner [Sat, 2 May 2020 21:53:59 +0000 (14:53 -0700)]
[COFF] Use a global option table to avoid reconstructing it
Otherwise an ArgumentParser is constructed for every directive section,
and that involves copying the entire table of options into a vector.
There is no need for this, just have one option table.
Thomas Preud'homme [Fri, 1 May 2020 22:22:07 +0000 (23:22 +0100)]
[test] Fix lld's ELF/linkerscript/thunk-gen-mips.s
Summary:
Lld test ELF/linkerscript/thunk-gen-mips.s was accidentally disabled due
to the use of wrong FileCheck directives. As a result the test seems to
have bitrotted as it fails to pass if fixing the directive. To ease
updates to the test in case of change of the __start address the checks
have been changed to use numeric variables to express all the addresses
based on the __start address.
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D79270
Milian Wolff [Sat, 2 May 2020 20:18:09 +0000 (22:18 +0200)]
[libclang]: visit C++17 if init statements
This makes the previously unaccessible AST nodes for C++17 "if with
init statements" accessible to consumers of libclang.
Differential Revision: https://reviews.llvm.org/D78214
Milian Wolff [Sat, 2 May 2020 20:17:59 +0000 (22:17 +0200)]
[libclang]: visit BindingDecl in DecompositionDecl
This makes the BindingDecl accessible to consumers of libclang
as CXCursor_UnexposedDecl where previously these AST nodes were
not visited at all from the libclang API.
Differential Revision: https://reviews.llvm.org/D78213
River Riddle [Sat, 2 May 2020 19:28:57 +0000 (12:28 -0700)]
[mlir] Add a new context flag for disabling/enabling multi-threading
This is useful for several reasons:
* In some situations the user can guarantee that thread-safety isn't necessary and don't want to pay the cost of synchronization, e.g., when parsing a very large module.
* For things like logging threading is not desirable as the output is not guaranteed to be in stable order.
This flag also subsumes the pass manager flag for multi-threading.
Differential Revision: https://reviews.llvm.org/D79266
Simon Pilgrim [Sat, 2 May 2020 19:08:33 +0000 (20:08 +0100)]
Revert rG8e05ac0a510c - "[DAGCombine] visitTRUNCATE - remove GetDemandedBits call"
Causing buildbot failures
Simon Pilgrim [Sat, 2 May 2020 18:51:58 +0000 (19:51 +0100)]
[DAGCombine] visitTRUNCATE - remove GetDemandedBits call
rL368553 added SimplifyMultipleUseDemandedBits handling for ISD::TRUNCATE to SimplifyDemandedBits so we don't need to duplicate this (and it gets rid of another GetDemandedBits call which is slowly being replaced with SimplifyMultipleUseDemandedBits anyhow).
mydeveloperday [Sat, 2 May 2020 18:33:18 +0000 (19:33 +0100)]
[sema] NFC Unable to build Sema library with MSVC Debug target due to missing /bigobj
Summary:
Unable to build sema library on MSVC with Debug target
```
C:\clang\llvm-project\clang\lib\Sema\SemaOpenMP.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
```
Reviewed By: aaron.ballman
Subscribers: mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79292
Benjamin Kramer [Sat, 2 May 2020 18:18:09 +0000 (20:18 +0200)]
[MBP] tuple->pair. NFC.
std::pair has a trivial copy ctor, std::tuple doesn't.
Nico Weber [Sat, 2 May 2020 18:10:18 +0000 (14:10 -0400)]
[gn build] Port
8f766e382b77e more and fix 2 llvm-config test failures.
The failures only happened in fully clean builds.
Also put all current dependencies of LibraryDependencies.inc in the
build graph, so that this type of thing will cause a failure in
incremental builds next time as well.
Reid Kleckner [Fri, 1 May 2020 14:34:12 +0000 (07:34 -0700)]
[COFF] Add and use a zero-copy tokenizer for .drectve
This generalizes the main Windows command line tokenizer to be able to
produce StringRef substrings as well as freshly copied C strings. The
implementation is still shared with the normal tokenizer, which is
important, because we have unit tests for that.
.drective sections can be very long. They can potentially list up to
every symbol in the object file by name. It is worth avoiding these
string copies.
This saves a lot of memory when linking chrome.dll with PGO
instrumentation:
BEFORE AFTER % IMP
peak memory: 6657.76MB 4983.54MB -25%
real: 4m30.875s 2m26.250s -46%
The time improvement may not be real, my machine was noisy while running
this, but that the peak memory usage improvement should be real.
This change may also help apps that heavily use dllexport annotations,
because those also use linker directives in object files. Apps that do
not use many directives are unlikely to be affected.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D79262
Benjamin Kramer [Sat, 2 May 2020 17:22:15 +0000 (19:22 +0200)]
[SmallVector] Weaken the predicate for the memcpy optimization
We don't require the type to be trivially assignable. While the standard
says that only is_trivially_copyable types may be memcpy'd, this seems
overly strict. We never assign the type, so there's no way for the type
to observe that the copy/move construction got elided. This is important
for std::pair<POD, POD>, which is not trivially assignable and probably
never will be because changing that would break ABI.
As a side-effect this no longer allows types with deleted copy/move
constructors in SmallVector. That's an unintended side-effect of
is_trivially_copyable anyways.
Shrinks Release+Asserts clang by 20k.
Benjamin Kramer [Sun, 26 Apr 2020 20:44:31 +0000 (22:44 +0200)]
Don't stash types that aren't copyable or moveable into a SmallVector
This seems to be working by accident.
Benjamin Kramer [Sat, 2 May 2020 15:04:52 +0000 (17:04 +0200)]
Use realloc for NestedNameSpecifierLocBuilder
These allocations are so tiny that the buffer can be grown in-place most
of the time.
mydeveloperday [Sat, 2 May 2020 14:42:20 +0000 (15:42 +0100)]
[clang-format] NFC - clang-format the FormatTests
Summary:
Ensure the clang-format unit tests are themselves clang-formatted
Having areas of the llvm code which are clang-format clean, give us more areas to run new clang-format binaries on ensuring we haven't broken anything.
It seems to me we SHOULD have this clang-formatted at a minimum, otherwise how can we expect others to use clang-format if we "don't eat our own dogfood", also if the tests are dependent on the formatting of the code then that would also be bad!
Reviewed By: sammccall
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79204
Benjamin Kramer [Sat, 2 May 2020 13:59:10 +0000 (15:59 +0200)]
[Allocator] Make Deallocate() pass alignment and make it use (de)allocate_buffer
This lets it use sized deallocation and make more efficient alignment
decisions. Also adjust BumpPtrAllocator to always allocate at
alignof(std::max_align_t).
Sam Elliott [Sat, 2 May 2020 14:05:12 +0000 (15:05 +0100)]
[RISCV] Implement convertSelectOfConstantsToMath
Summary:
The current lowering of `select` on RISC-V uses a branch instruction to load a
register with one or other value. This is inefficient, especially in the case of
small constants that can be computed easily.
By implementing the TargetLowering::convertSelectOfConstantsToMath hook, some of
the simpler cases are covered that let us avoid introducing a branch in these
cases.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D79260
Sam Elliott [Sat, 2 May 2020 14:05:02 +0000 (15:05 +0100)]
[RISCV][NFC] Tests for (select (const), (const))
Summary:
This just adds some simple cases for testing select of constants. There will be
a follow-up patch that improves code generation in some of these cases.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D79259
Sam Elliott [Sat, 2 May 2020 14:00:38 +0000 (15:00 +0100)]
[RISCV] Add patterns for checking isnan
Summary:
This patch addresses some weird assembly sequences we were seeing during
comparing floats. In particular, comparing a float to itself tells you whether
it is NaN or not, which we were doing correctly, but with an extra unneeded
`and` instruction.
This patch specialises the existing patterns to remove the `and` instructions
when both their operands are the same.
Reviewed By: luismarques, asb
Differential Revision: https://reviews.llvm.org/D78908
Sam Elliott [Sat, 2 May 2020 13:56:35 +0000 (14:56 +0100)]
[RISCV][NFC] Add tests for checking isnan patterns
Summary:
I worked on adding some SelectionDag patterns to address code generated by these
examples, which came out of some differential testing against GCC. The pattern
additions will be in a follow-up patch.
Reviewers: luismarques, asb
Reviewed By: luismarques, asb
Differential Revision: https://reviews.llvm.org/D78907
Sam McCall [Sat, 2 May 2020 13:34:53 +0000 (15:34 +0200)]
std::isspace -> llvm::isSpace (where locale should be ignored)
I've left out some cases where I wasn't totally sure this was right or
whether the include was ok (compiler-rt) or idiomatic (flang).
Sam McCall [Sat, 2 May 2020 13:18:35 +0000 (15:18 +0200)]
[ADT] Add locale-independent isSpace() to StringExtras. NFC
Use this in clangd, will follow up with replacements for isspace where
locale-dependent is clearly not intended.
LLVM GN Syncbot [Sat, 2 May 2020 12:54:28 +0000 (12:54 +0000)]
[gn build] Port
fa1f4cf8432
Sam McCall [Sat, 2 May 2020 12:53:47 +0000 (14:53 +0200)]
[clangd] Rename FormattedString -> Markup, move to support. NFC
Sam McCall [Wed, 29 Apr 2020 23:03:59 +0000 (01:03 +0200)]
[clangd] Fix whitespace between chunks in markdown paragraphs.
Summary:
Old model: chunks are always separated by one space.
This makes it impossible to render "Foo `bar`." correctly.
New model: chunks are separated by space if the left had trailing space, or
the right had leading space, or space was explicitly requested.
(Only leading/trailing space in plaintext chunks count, not code)
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79139
Tamás Zolnai [Sat, 2 May 2020 12:04:17 +0000 (14:04 +0200)]
[clang-tidy] extend bugprone-signed-char-misuse check with array subscript case.
Summary:
To cover STR34-C rule's second use case, where ``signed char`` is
used for array subscript after an integer conversion. In the case
of non-ASCII character this conversion will result in a value
in excess of UCHAR_MAX.
There is another clang-tidy check which catches these cases.
cppcoreguidelines-pro-bounds-constant-array-index catches any
indexing which is not integer constant. I think this check is
very strict about the index (e.g. constant), so it's still useful
to cover the ``signed char`` use case in this check, so we
can provide a way to catch the SEI cert rule's use cases on a
codebase, where this CPP guideline is not used.
Reviewers: aaron.ballman, njames93
Reviewed By: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D78904
Marek Kurdej [Sat, 2 May 2020 11:58:03 +0000 (13:58 +0200)]
[libc++][P1115][C++20] Improving the Return Value of Erase-Like Algorithms II: Free erase/erase if.
Summary:
This patch adds return type to std::erase and std::erase_if functions.
Also:
* Update __cpp_lib_erase_if to 202002L.
* Fix synopsis in unordered_map.
* Fix generate_feature_test_macro_components.py script.
Reviewers: EricWF, mclow.lists, ldionne, #libc
Reviewed By: ldionne, #libc
Subscribers: broadwaylamb, zoecarver, dexonsmith, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75905
Nikita Popov [Sat, 2 May 2020 09:47:04 +0000 (11:47 +0200)]
[ValueTracking] Short-circuit GEP known bits calculation (NFC)
Don't compute known bits of all GEP operands, if we already know
that we don't know anything.
Nikita Popov [Sat, 2 May 2020 09:03:36 +0000 (11:03 +0200)]
Remove getNumUses() comparisons (NFC)
getNumUses() scans the full use list. Don't use it is we only want
to check if there's zero or one uses.
Nikita Popov [Fri, 1 May 2020 20:28:59 +0000 (22:28 +0200)]
[MergeFuncs] Don't merge shufflevectors with different masks
When the shufflevector mask operand was converted into special
instruction data, the FunctionComparator was not updated to
account for this. As such, MergeFuncs will happily merge
shufflevectors with different masks.
This fixes https://bugs.llvm.org/show_bug.cgi?id=45773.
Differential Revision: https://reviews.llvm.org/D79261
Xing GUO [Sat, 2 May 2020 06:04:04 +0000 (14:04 +0800)]
[Object] Change ObjectFile::getSymbolValue() return type to Expected<uint64_t>
Summary:
In D77860, we have changed `getSymbolFlags()` return type to `Expected<uint32_t>`.
This change helps bubble the error further up the stack.
Reviewers: jhenderson, grimar, JDevlieghere, MaskRay
Reviewed By: jhenderson
Subscribers: hiraditya, MaskRay, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79075
Stephen Neuendorffer [Sat, 2 May 2020 05:12:40 +0000 (22:12 -0700)]
[MLIR] Ensure that out-of-tree users have an mlir-generic-headers target
Prior change introduces this target, but we need it for out-of-tree users
too
Michael Liao [Sat, 2 May 2020 05:07:44 +0000 (01:07 -0400)]
Add the missing '='. NFC.
Stephen Neuendorffer [Fri, 24 Apr 2020 23:42:07 +0000 (16:42 -0700)]
[MLIR] add dependencies for all tablegen targets on 'mlir-headers'
In cmake, dependencies on generated files require some sophistication in the build system. At build time, files are parsed to determine which headers they depend on and these dependencies are injected into the build system. This works well with ninja, but has some constraints with the makefile generator. According to the cmake documentation, this only works reliably within the same directory.
This patch expands the usage of mlir-headers to include all generated headers and adds an mlir-generic-headers target which triggers generation of dialect-independent headers. These targets are used to express dependencies on generated headers. This is mostly handled in AddMLIR.cmake and only a few CMakeLists.txt files need to change.
Differential Revision: https://reviews.llvm.org/D79242
Stephen Neuendorffer [Thu, 30 Apr 2020 20:09:13 +0000 (13:09 -0700)]
[MLIR] Move Verifier and Dominance Analysis from /Analysis to /IR
These libraries are distinct from other things in Analysis in that they
operate only on core IR concepts. This also simplifies dependencies
so that Dialect -> Analysis -> Parser -> IR. Previously, the parser depended
on portions of the the Analysis directory as well, which sometimes
caused issues with the way the cmake makefile generator discovers
dependencies on generated files during compilation.
Differential Revision: https://reviews.llvm.org/D79240
River Riddle [Sat, 2 May 2020 02:25:32 +0000 (19:25 -0700)]
[mlir][NFC] Cleanup StandardTypes and reorder the type classes
Craig Topper [Sat, 2 May 2020 01:35:42 +0000 (18:35 -0700)]
[CostModel][X86][ARM] Teach default implementation of getCastInstrCost to not add a split/join cost if source type and the destination type both have a SplitVector action
If both the source and the destination need to be split then the two halves of the split operation are completely independent and don't need to be split or joined. So we don't need to assess a cost for the split or join.
Differential Revision: https://reviews.llvm.org/D79111
Craig Topper [Sat, 2 May 2020 00:30:41 +0000 (17:30 -0700)]
[X86] Use more accurate increments for the induction variables in sad.ll. NFC
I think some copy/pasting was used to create loops of different
VFs. But the increment of the induction variable wasn't updated
to match the VF.
This has no effect on the pattern matching we're testing, it just
helps the test make sense to the reader.
Alexander Shaposhnikov [Sat, 2 May 2020 01:22:35 +0000 (18:22 -0700)]
[llvm-objcopy][MachO] Fix isExternalSymbol method
N_PEXT bit should not affect whether a symbol is considered to be external or not.
This also fixes the construction of the symbol table since it relies on the correct
ordering of symbols.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D78888
Julian Lettner [Sat, 2 May 2020 00:35:40 +0000 (17:35 -0700)]
[lit] Don't use Python3 yet
String interpolation is a Python3 feature, we can't use it yet.
Thomas Lively [Fri, 1 May 2020 01:11:15 +0000 (18:11 -0700)]
[WebAssembly] Renumber SIMD opcodes
Summary:
As described in https://github.com/WebAssembly/simd/pull/209. This is
the final reorganization of the SIMD opcode space before
standardization. It has been landed in concert with corresponding
changes in other projects in the WebAssembly SIMD ecosystem.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79224
Nemanja Ivanovic [Sat, 2 May 2020 00:17:30 +0000 (19:17 -0500)]
[PowerPC] Refactor PPCInstrVSX.td
Over time, we have made many additions to this file and it has frankly become a
bit of a mess. This has led to at least one issue - we have a number of
instructions where the side effects flag should be set to false and we neglected
to do this. This patch suggests a refactoring that should make the file much
more maintainable. The file is split up into major sections and the nesting
level is reduced, predicate blocks merged, etc.
Sections:
- Custom PPCISD node definitions
- Predicate definitions
- Instruction formats
- Instruction definitions
- Helper DAG definitions
- Anonymous patterns
- Instruction aliases
Differential revision: https://reviews.llvm.org/D78132
Julian Lettner [Fri, 1 May 2020 23:27:59 +0000 (16:27 -0700)]
[lit] Extract by_suite_and_test_path sort key function
Julian Lettner [Fri, 1 May 2020 22:52:44 +0000 (15:52 -0700)]
[lit] Create report generators during argument parsing
Julian Lettner [Fri, 1 May 2020 22:20:18 +0000 (15:20 -0700)]
[lit] Small refinements for xunit report output
Julian Lettner [Fri, 1 May 2020 16:35:46 +0000 (09:35 -0700)]
[lit] Factor out report generators into separate file
Factor out the report generators from main.py into reports.py.
I verified that we generate the exact same output by running `check-all`
and comparing the new and old output for both report flavors.
Julian Lettner [Fri, 1 May 2020 16:51:46 +0000 (09:51 -0700)]
[lit] Only update specific fields from remote test object
Don't update whole test object from the remote (pickled) finished test
object. Doing so also changes the config and suite members, which we
want to avoid.
LLVM GN Syncbot [Sat, 2 May 2020 00:00:04 +0000 (00:00 +0000)]
[gn build] Port
6cb073133c5
Kellie Medlin [Fri, 1 May 2020 23:29:06 +0000 (16:29 -0700)]
[lld] Merge Mach-O input sections
Summary: Similar to other formats, input sections in the MachO
implementation are now grouped under output sections. This is primarily
a refactor, although there's some new logic (like resolving the output
section's flags based on its inputs).
Differential Revision: https://reviews.llvm.org/D77893
River Riddle [Fri, 1 May 2020 23:26:45 +0000 (16:26 -0700)]
[mlir][DenseStringElementsAttr] Add support for the Attribute based get* methods.
This was missed in the original revision. This allows for using the opaque Attribute accessors when the elements are strings.
Mircea Trofin [Fri, 1 May 2020 23:30:41 +0000 (16:30 -0700)]
[llvm][NFC] Rename variable as per https://reviews.llvm.org/D79215
Operator error - performed the rename and didn't save.
Mircea Trofin [Thu, 30 Apr 2020 23:22:31 +0000 (16:22 -0700)]
[llvm][NFC] Inliner: simplify inlining decision logic
Summary:
shouldInline makes a decision based on the InlineCost of a call site, as
well as an evaluation on whether the site should be deferred. This means
it's possible for the decision to be not to inline, even for an
InlineCost that would otherwise allow it.
Both uses of shouldInline performed the exact same logic after calling
it. In addition, the decision on whether to inline or not was
communicated through two values of the Option<InlineCost> return value:
None, or an InlineCost evaluating to false.
Simplified by:
- encapsulating the decision in the return object. The bool it evaluates
to communicates unambiguously the decision. The InlineCost is also
available.
- encapsulated the common post-shouldInline code into shouldInline.
Reviewers: davidxl, echristo, eraman
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79215
River Riddle [Fri, 1 May 2020 22:57:42 +0000 (15:57 -0700)]
[mlir][GPUOpsLowering] Add missing include for FormatVariadic
Davide Italiano [Fri, 1 May 2020 22:05:42 +0000 (15:05 -0700)]
[ARM64] Remove more dead code. NFC.
Davide Italiano [Fri, 1 May 2020 22:04:44 +0000 (15:04 -0700)]
[ARM64] Remove dead code.
Sander de Smalen [Fri, 1 May 2020 20:39:16 +0000 (21:39 +0100)]
[SveEmitter] Add builtins for shifts.
This patch adds builtins for:
- svasrd
- svlsl
- svlsr