Eric Fiselier [Fri, 14 Feb 2020 16:34:46 +0000 (17:34 +0100)]
[libc++] Remove cycle between <type_traits> and <cstddef>
This was caused by byte depending on traits. This patch moves
the minimal amount of meta-programming into <cstddef> to break the cycle.
Alexandre Ganea [Fri, 14 Feb 2020 16:16:32 +0000 (11:16 -0500)]
Fix compilation breakage introduced by
8404aeb56a73ab24f9b295111de3b37a37f0b841.
Also fix BitVector unittest failure when DLLVM_ENABLE_ASSERTIONS are OFF, introduced by
d110c3a9f5253c4d94c10299c61fbbb33edab7db.
Fangrui Song [Fri, 14 Feb 2020 06:35:18 +0000 (22:35 -0800)]
[Driver] Rename AddGoldPlugin to addLTOOptions. NFC
AddGoldPlugin does more than adding `-plugin path/to/LLVMgold.so`.
It works with lld and GNU ld, and adds other LTO options.
So AddGoldPlugin is no longer a suitable name.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D74591
Evgeniy Brevnov [Fri, 14 Feb 2020 15:55:13 +0000 (22:55 +0700)]
Reverting D73027 [DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses(PR42151).
Eric Fiselier [Fri, 14 Feb 2020 15:38:16 +0000 (16:38 +0100)]
add type_traits include as required for std::integral_constant
Melanie Blower [Fri, 14 Feb 2020 14:44:20 +0000 (06:44 -0800)]
Revert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on""
This reverts commit
0a1123eb43f945593b26dd037490e0c909fa3c4f.
Want to revert this because it's causing trouble for PowerPC
I also fixed test fp-model.c which was looking for an incorrect error message
Alexandre Ganea [Fri, 14 Feb 2020 03:49:57 +0000 (22:49 -0500)]
[Support] On Windows, ensure hardware_concurrency() extends to all CPU sockets and all NUMA groups
The goal of this patch is to maximize CPU utilization on multi-socket or high core count systems, so that parallel computations such as LLD/ThinLTO can use all hardware threads in the system. Before this patch, on Windows, a maximum of 64 hardware threads could be used at most, in some cases dispatched only on one CPU socket.
== Background ==
Windows doesn't have a flat cpu_set_t like Linux. Instead, it projects hardware CPUs (or NUMA nodes) to applications through a concept of "processor groups". A "processor" is the smallest unit of execution on a CPU, that is, an hyper-thread if SMT is active; a core otherwise. There's a limit of 32-bit processors on older 32-bit versions of Windows, which later was raised to 64-processors with 64-bit versions of Windows. This limit comes from the affinity mask, which historically is represented by the sizeof(void*). Consequently, the concept of "processor groups" was introduced for dealing with systems with more than 64 hyper-threads.
By default, the Windows OS assigns only one "processor group" to each starting application, in a round-robin manner. If the application wants to use more processors, it needs to programmatically enable it, by assigning threads to other "processor groups". This also means that affinity cannot cross "processor group" boundaries; one can only specify a "preferred" group on start-up, but the application is free to allocate more groups if it wants to.
This creates a peculiar situation, where newer CPUs like the AMD EPYC 7702P (64-cores, 128-hyperthreads) are projected by the OS as two (2) "processor groups". This means that by default, an application can only use half of the cores. This situation could only get worse in the years to come, as dies with more cores will appear on the market.
== The problem ==
The heavyweight_hardware_concurrency() API was introduced so that only *one hardware thread per core* was used. Once that API returns, that original intention is lost, only the number of threads is retained. Consider a situation, on Windows, where the system has 2 CPU sockets, 18 cores each, each core having 2 hyper-threads, for a total of 72 hyper-threads. Both heavyweight_hardware_concurrency() and hardware_concurrency() currently return 36, because on Windows they are simply wrappers over std::thread::hardware_concurrency() -- which can only return processors from the current "processor group".
== The changes in this patch ==
To solve this situation, we capture (and retain) the initial intention until the point of usage, through a new ThreadPoolStrategy class. The number of threads to use is deferred as late as possible, until the moment where the std::threads are created (ThreadPool in the case of ThinLTO).
When using hardware_concurrency(), setting ThreadCount to 0 now means to use all the possible hardware CPU (SMT) threads. Providing a ThreadCount above to the maximum number of threads will have no effect, the maximum will be used instead.
The heavyweight_hardware_concurrency() is similar to hardware_concurrency(), except that only one thread per hardware *core* will be used.
When LLVM_ENABLE_THREADS is OFF, the threading APIs will always return 1, to ensure any caller loops will be exercised at least once.
Differential Revision: https://reviews.llvm.org/D71775
Alexandre Ganea [Thu, 13 Feb 2020 21:53:25 +0000 (16:53 -0500)]
[clang-scan-deps] Switch to using a ThreadPool
Use a ThreadPool instead of plain std::threads in clang-scan-deps.
This is needed to further support https://reviews.llvm.org/D71775.
Differential Revision: https://reviews.llvm.org/D74569
Alexandre Ganea [Thu, 13 Feb 2020 21:31:05 +0000 (16:31 -0500)]
[ADT] Support BitVector as a key in DenseSet/Map
This patch adds DenseMapInfo<> support for BitVector and SmallBitVector.
This is part of https://reviews.llvm.org/D71775, where a BitVector is used as a thread affinity mask.
Alex Richardson [Fri, 14 Feb 2020 15:17:27 +0000 (15:17 +0000)]
Fix line endings produced by update_cc_test_checks.py
Use the same appraoch as update_llc_test_checks.py to always write \n
line endings. This should fix the Windows buildbots.
Louis Dionne [Fri, 14 Feb 2020 15:03:25 +0000 (16:03 +0100)]
[libc++] Remove unnecessary typenames from std/numerics/c.math/abs.pass.cpp
There are some unnecessary typenames in std/numerics/c.math/abs.pass.cpp;
e.g. they're not in a dependent context.
Patch by Bryce Adelstein Lelbach
Differential Revision: https://reviews.llvm.org/D72106
Luís Marques [Fri, 14 Feb 2020 15:01:52 +0000 (15:01 +0000)]
Revert "[clang-tools-extra] fix the check for if '-latomic' is necessary"
This reverts commit
1d40c4150630729a9c1ce5119a8027dac93a5b2d.
This seemed to have caused build failures on ARM/AArch64.
Haojian Wu [Fri, 14 Feb 2020 13:55:51 +0000 (14:55 +0100)]
[clangd] Update the CompletionItemKind.
Summary: Fix some FIXMEs.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74609
Alex Richardson [Fri, 14 Feb 2020 10:26:07 +0000 (10:26 +0000)]
Move update_cc_test_checks.py tests to clang
Having tests that depend on clang inside llvm/ are not a good idea since
it can break incremental `ninja check-llvm`.
Fixes https://llvm.org/PR44798
Reviewed By: lebedev.ri, MaskRay, rsmith
Differential Revision: https://reviews.llvm.org/D74051
Haojian Wu [Tue, 11 Feb 2020 11:37:09 +0000 (12:37 +0100)]
[clangd] Add tracer to the rename workflow, NFC
Reviewers: kbobyrev
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74395
Teresa Johnson [Wed, 12 Feb 2020 23:17:56 +0000 (15:17 -0800)]
Reenable "Always import constants" after compile time fixes
Summary:
Reenables importing of constants by default, which was disabled in
D73724 due to excessive thin link times. These inefficiencies were
fixed in D73851.
I re-measured thin link times for a number of binaries that had compile
time explosions with importing of constants previously and confirmed
they no longer have any notable increases with it enabled.
Reviewers: wmi, evgeny777
Subscribers: hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74512
Pavel Iliin [Tue, 4 Feb 2020 14:51:17 +0000 (14:51 +0000)]
[AArch64] Add BIT/BIF support.
This patch added generation of SIMD bitwise insert BIT/BIF instructions.
In the absence of GCC-like functionality for optimal constraints satisfaction
during register allocation the bitwise insert and select patterns are matched
by pseudo bitwise select BSP instruction with not tied def.
It is expanded later after register allocation with def tied
to BSL/BIT/BIF depending on operands registers.
This allows to get rid of redundant moves.
Reviewers: t.p.northover, samparker, dmgreen
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D74147
Gokturk Yuksek [Fri, 14 Feb 2020 14:12:45 +0000 (14:12 +0000)]
[clang-tools-extra] fix the check for if '-latomic' is necessary
Summary:
The CheckAtomic module performs two tests to determine if passing
'-latomic' to the linker is required: one for 64-bit atomics, and
another for non-64-bit atomics. clangd only uses the result from
HAVE_CXX_ATOMICS64_WITHOUT_LIB. This is incomplete because there are
uses of non-64-bit atomics in the code, such as the ReplyOnce::Replied
of type std::atomic<bool> defined in clangd/ClangdLSPServer.cpp.
Fix by also checking for the result of HAVE_CXX_ATOMICS_WITHOUT_LIB.
See also: https://reviews.llvm.org/D68964
Reviewers: ilya-biryukov, nridge, kadircet, beanz, compnerd, luismarques
Reviewed By: luismarques
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69869
Luís Marques [Fri, 14 Feb 2020 13:44:42 +0000 (13:44 +0000)]
[Driver][RISCV] Add RedHat Linux RISC-V triple
Summary: Adds the RedHat Linux triple to the list of 64-bit RISC-V triples.
Without this the gcc libraries wouldn't be found by clang on a redhat/fedora
system, as the search list included `/usr/lib/gcc/riscv64-redhat-linux-gnu`
but the correct path didn't include the `-gnu` suffix.
Reviewers: lenary, asb, dlj
Reviewed By: lenary
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74399
James Henderson [Fri, 14 Feb 2020 13:39:41 +0000 (13:39 +0000)]
[test][DebugInfo] Fix signed/unsigned comparison problem in test
This caused build bot failures:
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/8568/
Louis Dionne [Fri, 14 Feb 2020 13:31:15 +0000 (14:31 +0100)]
[libc++] span: Fix incorrect static asserts
The static asserts in span<T, N>::front() and span<T, N>::back() are
incorrect as they may be triggered from valid code due to evaluation
of a never taken branch:
span<int, 0> foo;
if (!foo.empty()) {
auto x = foo.front();
}
The problem is that the branch is always evaluated by the compiler,
creating invalid compile errors for span<T, 0>.
Thanks to Michael Schellenberger Costa for the patch.
Differential Revision: https://reviews.llvm.org/D71995
Kadir Cetinkaya [Thu, 30 Jan 2020 13:07:42 +0000 (14:07 +0100)]
[clang][Index] Introduce a TemplateParm SymbolKind
Summary:
Currently template parameters has symbolkind `Unknown`. This patch
introduces a new kind `TemplateParm` for templatetemplate, templatetype and
nontypetemplate parameters.
Also adds tests in clangd hover feature.
Reviewers: sammccall
Subscribers: kristof.beyls, ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73696
Kadir Cetinkaya [Thu, 30 Jan 2020 13:00:51 +0000 (14:00 +0100)]
[clang][DeclPrinter] Implement visitors for {TemplateType,NonTypeTemplate}Parms
Reviewers: sammccall, hokein
Subscribers: kristof.beyls, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73693
Raphael Isemann [Fri, 14 Feb 2020 11:57:10 +0000 (12:57 +0100)]
[lldb] Print result when expect_expr unexpectedly succeeds
Simon Pilgrim [Fri, 14 Feb 2020 11:54:55 +0000 (11:54 +0000)]
[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre-SSSE3 targets
Without PSHUFB we are better using ROTL (expanding to OR(SHL,SRL)) than using the generic v16i8 shuffle lowering - but if we can widen to v8i16 or more then the existing shuffles are still the better option.
REAPPLIED: Original commit rG11c16e71598d was reverted at rGde1d90299b16 as it wasn't accounting for later lowering. This version emits ROTLI or the OR(VSHLI/VSRLI) directly to avoid the issue.
Luís Marques [Fri, 14 Feb 2020 11:49:18 +0000 (11:49 +0000)]
llvm/cmake/config.guess: add support for riscv32 and riscv64
Summary: LLVM configuration fails with 'unable to guess system type' on riscv64.
Add support for detecting riscv32 and riscv64 systems.
Patch by Gokturk Yuksek (gokturk)
Reviewers: erichkeane, rengolin, mgorny, aaron.ballman, beanz, luismarques
Reviewed By: luismarques
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68899
Roger Ferrer Ibanez [Thu, 12 Dec 2019 08:55:46 +0000 (08:55 +0000)]
[OpenMP] Lower taskyield using OpenMP IR Builder
This is similar to D69828.
Special codegen for enclosing untied tasks is still done in clang.
Differential Revision: https://reviews.llvm.org/D70799
Andrew Ng [Tue, 11 Feb 2020 12:28:17 +0000 (12:28 +0000)]
[llvm-ar] Simplify Windows comparePaths NFCI
Replace use of widenPath in comparePaths with UTF8ToUTF16. widenPath
does a lot more than just conversion from UTF-8 to UTF-16. This is not
necessary for CompareStringOrdinal and could possibly even cause
problems.
Differential Revision: https://reviews.llvm.org/D74477
James Henderson [Mon, 3 Feb 2020 16:43:03 +0000 (16:43 +0000)]
[DebugInfo] Error if unsupported address size detected in line table
Prior to this patch, if a DW_LNE_set_address opcode was parsed with an
address size (i.e. with a length after the opcode) of anything other 1,
2, 4, or 8, an llvm_unreachable would be hit, as the data extractor does
not support other values. This patch introduces a new error check that
verifies the address size is one of the supported sizes, in common with
other places within the DWARF parsing.
This patch also fixes calculation of a generated line table's size in
unit tests. One of the tests in this patch highlighted a bug introduced
in
1271cde4745, when non-byte operands were used as arguments for
extended or standard opcodes.
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D73962
Pavel Labath [Thu, 6 Feb 2020 14:24:39 +0000 (06:24 -0800)]
[lldb/DWARF] Don't hold a unique SymbolFileDWARFDwo in a DWARFUnit
This is the second dwp preparatory patch. When a SymbolFileDWARFDwo will
hold more than one split unit, it will not be able to be uniquely owned
by a single DWARFUnit. I achieve this by changing the
unique_ptr<SymbolFileDWARFDwo> member of DWARFUnit to
shared_ptr<DWARFUnit>. The shared_ptr points to a DWARFUnit, but it is
in fact holding the entire SymbolFileDWARFDwo alive. This is the same
method used by llvm DWARFUnit (except that is uses the DWARFContext
class).
Differential Revision: https://reviews.llvm.org/D73782
Roger Ferrer Ibanez [Thu, 12 Dec 2019 09:19:10 +0000 (09:19 +0000)]
[OpenMP] Lower taskwait using OpenMP IR Builder
The code generation is exactly the same as it was.
But not that the special handling of untied tasks is still handled by
emitUntiedSwitch in clang.
Differential Revision: https://reviews.llvm.org/D69828
James Henderson [Thu, 13 Feb 2020 10:21:55 +0000 (10:21 +0000)]
[doc] Clarify responsibility for fixing experimental target problems
Experimental targets are meant to be maintained by the community behind
the target. They are not monitored by the primary build bots. This
change clarifies that it is this communities responsibility for things
like test fixes related to the target caused by changes unrelated to
that target.
See http://lists.llvm.org/pipermail/llvm-dev/2020-February/139115.html
for a full discussion.
Reviewed by: rupprecht, lattner, MaskRay
Differential Revision: https://reviews.llvm.org/D74538
Mehdi Amini [Fri, 14 Feb 2020 09:12:41 +0000 (09:12 +0000)]
Do not build the CUBIN conversion pass when NVPTX Backend isn't configured
This pass would currently build, but fail to run when this backend isn't
linked in. On the other hand, we'd like it to initialize only the NVPTX
backend, which isn't possible if we continue to build it without the
backend available. Instead of building a broken configuration, let's
skip building the pass entirely.
Differential Revision: https://reviews.llvm.org/D74592
Pavel Labath [Thu, 13 Feb 2020 13:40:09 +0000 (14:40 +0100)]
[lldb/dotest] Remove the "exclusive test subdir" concept
Summary:
This was added in 2018 (r339929), when we were still using the
hand-rolled test runner.
It does not seem to be relevant anymore. In fact as far as I can tell,
it's a big no-op now as the exclusive_test_subdir variable is never set.
Reviewers: vsk, JDevlieghere
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D74551
Alex Zinenko [Fri, 14 Feb 2020 09:18:19 +0000 (10:18 +0100)]
[mlir] Fix argument attribute attribute reassignment in ConvertStandardToLLVM
The commit switching the calling convention for memrefs (
5a1778057)
inadvertently introduced a bug in the function argument attribute conversion:
due to incorrect indexing of function arguments it was not assigning the
attributes to the arguments beyond those generated from the first original
argument. This was not caught in the commit since the test suite does have a
test for converting multi-argument functions with argument attributes. Fix the
bug and add relevant tests.
Pavel Labath [Fri, 14 Feb 2020 08:35:13 +0000 (09:35 +0100)]
[lldb] Remove accidentally checked-in debugging code
Kazushi (Jam) Marukawa [Fri, 14 Feb 2020 08:31:06 +0000 (09:31 +0100)]
[VE] Support for PIC (global data and calls)
Summary: Support for PIC with tests for global variables and function calls.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D74536
Kadir Cetinkaya [Fri, 14 Feb 2020 08:29:56 +0000 (09:29 +0100)]
[VecotrCombine] Fix unused variable for assertion disabled builds
Sam Parker [Fri, 14 Feb 2020 08:28:26 +0000 (08:28 +0000)]
[NFC][ARM] Convert some pointers to references.
Roman Lebedev [Fri, 14 Feb 2020 08:22:29 +0000 (11:22 +0300)]
[NFC][clang-tidy] Move recently newly-added tests into checkers/ subdir
That's where nowadays those tests reside, those outliers were created
before the migration but committed after,
so they just awkwardly reside in the old place.
Pavel Labath [Fri, 14 Feb 2020 07:33:42 +0000 (08:33 +0100)]
[lldb] Add a test for launch failure and its error message
Fangrui Song [Fri, 14 Feb 2020 05:58:16 +0000 (21:58 -0800)]
[AsmPrinter][MCStreamer] De-capitalize EmitInstruction and EmitCFI*
Jonas Devlieghere [Fri, 14 Feb 2020 05:55:41 +0000 (21:55 -0800)]
[lldb/Test] Partially revert assertTrue change
This reverts
b3a0c4d7dcfa252be17ef5f5b63ffaaa83e01a2b for
TestBreakpointHitCount.py because it's now timing out on the Windows
bot. I'm not sure this is the cause, but the substitution doesn't look
correct anyway...
Jonas Devlieghere [Fri, 14 Feb 2020 05:49:12 +0000 (21:49 -0800)]
[lldb/Plugins] Have one initializer per ABI plugin
After the recent change that grouped some of the ABI plugins together,
those plugins ended up with multiple initializers per plugin. This is
incompatible with my proposed approach of generating the initializers
dynamically, which is why I've grouped them together in a new entry
point.
Differential revision: https://reviews.llvm.org/D74451
Evgeniy Brevnov [Thu, 16 Jan 2020 08:17:43 +0000 (15:17 +0700)]
[DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses(PR42151).
Summary:
This is second attempt to fix the problem with incorrect dependencies reported in presence of invariant load. Initial fix (https://reviews.llvm.org/D64405) was reverted due to a regression reported in https://reviews.llvm.org/D70516.
The original fix changed caching behavior for invariant loads. Namely such loads are not put into the second level cache (NonLocalDepInfo). The problem with that fix is the first level cache (CachedNonLocalPointerInfo) still works as if invariant loads were in the second level cache. The solution is in addition to not putting dependence results into the second level cache avoid putting info about invariant loads into the first level cache as well.
Reviewers: jdoerfert, reames, hfinkel, efriedma
Reviewed By: jdoerfert
Subscribers: DaniilSuchkov, hiraditya, bmahjour, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73027
Fangrui Song [Fri, 14 Feb 2020 04:57:03 +0000 (20:57 -0800)]
[ELF][AArch64] Rename pacPlt to zPacPlt and forceBti to zForceIbt after D71327. NFC
We use config->z* for -z options.
Jonas Devlieghere [Fri, 14 Feb 2020 01:39:29 +0000 (17:39 -0800)]
[dsymutil] Fix double relocation of DW_AT_call_return_pc
When the DW_AT_call_return_pc matches a relocation, the call return pc
would get relocated twice, once because of the relocation in the object
file and once because of dsymutil. The same problem exists for the low
and high PC and the fix is the same. We remember the low, high and
return pc of the original DIE and relocate that, rather than the
potentially already relocated value.
Reviewed offline by Fred Riss.
Liu, Chen3 [Thu, 13 Feb 2020 13:16:18 +0000 (21:16 +0800)]
[X86] Fix the bug that _mm_mask_cvtsepi64_epi32 generates result without
zero the upper 64bit.
Differential Revision : https://reviews.llvm.org/D74552
Eric Christopher [Fri, 14 Feb 2020 01:18:53 +0000 (17:18 -0800)]
Remove unused lambda argument.
Eric Christopher [Thu, 13 Feb 2020 20:53:32 +0000 (12:53 -0800)]
Reinstate llvm-go to test the go bindings.
This partially reverts commit
102814b4d36ad004a2e37cd2a1e84bd2c3593d29.
River Riddle [Fri, 14 Feb 2020 01:11:01 +0000 (17:11 -0800)]
[mlir][DeclarativeParser] Add support for formatting enum attributes in the string form.
Summary: This revision adds support to the declarative parser for formatting enum attributes in the symbolized form. It uses this new functionality to port several of the SPIRV parsers over to the declarative form.
Differential Revision: https://reviews.llvm.org/D74525
Fangrui Song [Fri, 14 Feb 2020 00:36:27 +0000 (16:36 -0800)]
[AsmPrinter] De-capitalize all AsmPrinter::Emit* but EmitInstruction
Similar to rL328848.
Thomas Lively [Tue, 4 Feb 2020 05:26:43 +0000 (21:26 -0800)]
[WebAssembly] Make stack pointer args inhibit tail calls
Summary:
Also make return calls terminator instructions so epilogues are
inserted before them rather than after them. Together, these changes
make WebAssembly's tail call optimization more stack-safe.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73943
Fangrui Song [Fri, 14 Feb 2020 00:17:21 +0000 (16:17 -0800)]
Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on"
Buildbot are failing with the current revert status. So reland with a
fix to fp-model.c
Pavel Iliin [Wed, 12 Feb 2020 18:31:18 +0000 (18:31 +0000)]
[AArch64][NFC] Update test checks.
This NFC commit updates several llc tests checks by automatically generated ones.
Jim Ingham [Thu, 13 Feb 2020 23:48:38 +0000 (15:48 -0800)]
Add a test for debugserver handling threads suspended from within a program.
Mach allows you to suspend and resume other threads within a program, so
debugserver has to be careful not to interfere with this when it goes to supend and
resume threads while stepping over breakpoints and calling functions. Even
trickier, if you call a function on a suspended thread, it has to resume the
thread to get the expression to run, and then suspend it properly when done.
This all works already, but there wasn't a test for it. Adding that here.
This same test could be written for a unix that supports pthread_{suspend,resume}_np, but
macOS doesn't support these calls, only the mach version. It doesn't look like
a lot of Linux'es support this (AIX does apparently...) And IIUC Windows allows
you to suspend and resume other threads, but the code for that would look pretty
different than this main.c. So for simplicity's sake I wrote this test for Darwin-only.
aartbik [Thu, 13 Feb 2020 22:50:07 +0000 (14:50 -0800)]
[mlir] [VectorOps] Initial framework for progressively lowering vector.contract
Summary:
This sets the basic framework for lowering vector.contract progressively
into simpler vector.contract operations until a direct vector.reduction
operation is reached. More details will be filled out progressively as well.
Reviewers: nicolasvasilache
Reviewed By: nicolasvasilache
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74520
Melanie Blower [Thu, 13 Feb 2020 22:40:01 +0000 (14:40 -0800)]
Revert "Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on"""
This reverts commit
abd09053bc7aa6144873c196a7d50aa6ce6ca430.
It's causing internal buildbot fails on ppc
Conflicts:
clang/lib/Driver/ToolChains/Clang.cpp
Vedant Kumar [Thu, 13 Feb 2020 22:38:42 +0000 (14:38 -0800)]
Add dbgs() output to help track down missing DW_AT_location bugs, NFC
Vedant Kumar [Mon, 10 Feb 2020 23:37:56 +0000 (15:37 -0800)]
[Local] Do not move around dbg.declares during replaceDbgDeclare
replaceDbgDeclare is used to update the descriptions of stack variables
when they are moved (e.g. by ASan or SafeStack). A side effect of
replaceDbgDeclare is that it moves dbg.declares around in the
instruction stream (typically by hoisting them into the entry block).
This behavior was introduced in llvm/r227544 to fix an assertion failure
(llvm.org/PR22386), but no longer appears to be necessary.
Hoisting a dbg.declare generally does not create problems. Usually,
dbg.declare either describes an argument or an alloca in the entry
block, and backends have special handling to emit locations for these.
In optimized builds, LowerDbgDeclare places dbg.values in the right
spots regardless of where the dbg.declare is. And no one uses
replaceDbgDeclare to handle things like VLAs.
However, there doesn't seem to be a positive case for moving
dbg.declares around anymore, and this reordering can get in the way of
understanding other bugs. I propose getting rid of it.
Testing: stage2 RelWithDebInfo sanitized build, check-llvm
rdar://
59397340
Differential Revision: https://reviews.llvm.org/D74517
Sanjay Patel [Thu, 13 Feb 2020 21:08:15 +0000 (16:08 -0500)]
[VectorCombine] try to form vector binop to eliminate an extract element
binop (extelt X, C), (extelt Y, C) --> extelt (binop X, Y), C
This is a transform that has been considered for canonicalization (instcombine)
in the past because it reduces instruction count. But as shown in the x86 tests,
it's impossible to know if it's profitable without a cost model. There are many
potential target constraints to consider.
We have implemented similar transforms in the backend (DAGCombiner and
target-specific), but I don't think we have this exact fold there either (and if
we did it in SDAG, it wouldn't work across blocks).
Note: this patch was intended to handle the more general case where the extract
indexes do not match, but it got too big, so I scaled it back to this pattern
for now.
Differential Revision: https://reviews.llvm.org/D74495
Francesco Petrogalli [Thu, 13 Feb 2020 22:03:41 +0000 (22:03 +0000)]
[build] Fix shared lib builds.
Wawha [Thu, 13 Feb 2020 21:46:33 +0000 (22:46 +0100)]
[clang] Fix bad line ending (DOS instead of Unix) inside the release notes.
Fangrui Song [Thu, 13 Feb 2020 21:26:21 +0000 (13:26 -0800)]
[AsmPrinter] De-capitalize some AsmPrinter::Emit* functions
Similar to rL328848.
Craig Topper [Thu, 13 Feb 2020 19:10:57 +0000 (11:10 -0800)]
[X86] Don't widen 128/256-bit strict compares with vXi1 result to 512-bits on KNL.
If we widen the compare we might trigger a spurious exception from
the garbage data.
We have two choices here. Explicitly force the upper bits to zero.
Or use a legacy VEX vcmpps/pd instruction and convert the XMM/YMM
result to mask register.
I've chosen to go with the second option. I'm not sure which is
really best. In some cases we could get rid of the zeroing since
the producing instruction probably already zeroed it. But we lose
the ability to fold a load. So which is best is dependent on
surrounding code.
Differential Revision: https://reviews.llvm.org/D74522
Fangrui Song [Thu, 13 Feb 2020 21:10:49 +0000 (13:10 -0800)]
[AsmPrinter] De-capitalize Emit{Function,BasicBlock]* and Emit{Start,End}OfAsmFile
Thomas Lively [Fri, 7 Feb 2020 23:01:34 +0000 (15:01 -0800)]
[WebAssembly] Add cbrt function signatures
Summary:
Fixes a crash in the backend where optimizations produce calls to the
cbrt runtime functions. Fixes PR 44227.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74259
Wawha [Thu, 13 Feb 2020 19:25:34 +0000 (20:25 +0100)]
[clang-format] Add new option BeforeLambdaBody in Allman style.
This option add a line break then a lambda is inside a function call.
Reviewers : djasper, klimek, krasimir, MyDeveloperDay
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D44609
Kostya Kortchinsky [Thu, 13 Feb 2020 20:55:56 +0000 (12:55 -0800)]
[GWP-ASan] Silence gcc error
Summary: It complains about reaching the end of a non-void returning function.
Reviewers: eugenis, hctim, morehouse
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D74578
Jason Molenda [Thu, 13 Feb 2020 21:06:44 +0000 (13:06 -0800)]
Small reformat to avoid tripping up possible formatting.
Jason Molenda [Thu, 13 Feb 2020 21:04:51 +0000 (13:04 -0800)]
Document third option to python synthetic type summary
callback unconditionally; it was added to lldb five years
ago and we don't need to qualify its availability.
Kostya Kortchinsky [Thu, 13 Feb 2020 17:27:18 +0000 (09:27 -0800)]
[scudo][standalone] Workaround for full regions on Android
Summary:
Due to Unity, we had to reduce our region sizes, but in some rare
situations, some programs (mostly tests AFAICT) manage to fill up
a region for a given size class.
So this adds a workaround for that attempts to allocate the block
from the immediately larger size class, wasting some memory but
allowing the application to keep going.
Reviewers: pcc, eugenis, cferris, hctim, morehouse
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D74567
Jonas Devlieghere [Thu, 13 Feb 2020 20:51:19 +0000 (12:51 -0800)]
[llvm][TextAPI/MachO] Extract common code into unittest helper (NFC)
This extract common code between the 4 TBD formats in a header that can
be shared.
Differential revision: https://reviews.llvm.org/D73332
Jonas Devlieghere [Thu, 13 Feb 2020 20:47:40 +0000 (12:47 -0800)]
[llvm][TextAPI/MachO] Extend TBD_V4 unittest to verify writing
Same as D73328 but for TBD_V4. One notable tidbit is that the swift abi
version for swift 1 & 2 is emitted as a float which is considered
invalid input.
Differential revision: https://reviews.llvm.org/D73330
Reid Kleckner [Thu, 13 Feb 2020 20:50:54 +0000 (12:50 -0800)]
Remove unnecessary typedef that GCC doesn't like
serge-sans-paille [Thu, 13 Feb 2020 20:48:56 +0000 (21:48 +0100)]
Fix lit version test
Looks like on some system, version is printed on stderr, on some it's on stdout...
LLVM GN Syncbot [Thu, 13 Feb 2020 20:43:19 +0000 (20:43 +0000)]
[gn build] Port
49bffa5f8b7
Alexey Bataev [Thu, 13 Feb 2020 20:42:39 +0000 (15:42 -0500)]
[OPENMP][DOCS]Fix misprint, NFC.
Roman Lebedev [Thu, 13 Feb 2020 20:34:13 +0000 (23:34 +0300)]
[clang-tidy] misc-no-recursion: a new check
Summary:
Recursion is a powerful tool, but like any tool
without care it can be dangerous. For example,
if the recursion is unbounded, you will
eventually run out of stack and crash.
You can of course track the recursion depth
but if it is hardcoded, there can always be some
other environment when that depth is too large,
so said magic number would need to be env-dependent.
But then your program's behavior is suddenly more env-dependent.
Also, recursion, while it does not outright stop optimization,
recursive calls are less great than normal calls,
for example they hinder inlining.
Recursion is banned in some coding guidelines:
* SEI CERT DCL56-CPP. Avoid cycles during initialization of static objects
* JPL 2.4 Do not use direct or indirect recursion.
* I'd say it is frowned upon in LLVM, although not banned
And is plain unsupported in some cases:
* OpenCL 1.2, 6.9 Restrictions: i. Recursion is not supported.
So there's clearly a lot of reasons why one might want to
avoid recursion, and replace it with worklist handling.
It would be great to have a enforcement for it though.
This implements such a check.
Here we detect both direct and indirect recursive calls,
although since clang-tidy (unlike clang static analyzer)
is CTU-unaware, if the recursion transcends a single standalone TU,
we will naturally not find it :/
The algorithm is pretty straight-forward:
1. Build call-graph for the entire TU.
For that, the existing `clang::CallGraph` is re-used,
although it had to be modified to also track the location of the call.
2. Then, the hard problem: how do we detect recursion?
Since we have a graph, let's just do the sane thing,
and look for Strongly Connected Function Declarations - widely known as `SCC`.
For that LLVM provides `llvm::scc_iterator`,
which is internally an Tarjan's DFS algorithm, and is used throught LLVM,
so this should be as performant as possible.
3. Now that we've got SCC's, we discard those that don't contain loops.
Note that there may be more than one loop in SCC!
4. For each loopy SCC, we call out each function, and print a single example
call graph that shows recursion -- it didn't seem worthwhile enumerating
every possible loop in SCC, although i suppose it could be implemented.
* To come up with that call graph cycle example, we start at first SCC node,
see which callee of the node is within SCC (and is thus known to be in cycle),
and recurse into it until we hit the callee that is already in call stack.
Reviewers: JonasToth, aaron.ballman, ffrankies, Eugene.Zelenko, erichkeane, NoQ
Reviewed By: aaron.ballman
Subscribers: Charusso, Naghasan, bader, riccibruno, mgorny, Anastasia, xazax.hun, cfe-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D72362
Roman Lebedev [Thu, 13 Feb 2020 20:34:11 +0000 (23:34 +0300)]
[clang][Analysis] CallGraph: store the actual call `Expr*` in the CallGraphNode::CallRecord
Summary:
Storing not just the callee, but the actual call may be interesting for some use-cases.
In particular, D72362 would like that to better pretty-print the cycles in call graph.
Reviewers: NoQ, erichkeane
Reviewed By: NoQ
Subscribers: martong, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74081
serge-sans-paille [Thu, 13 Feb 2020 14:30:49 +0000 (15:30 +0100)]
Fix handling of --version in lit
There's no reason why we should require a directory when asking for the version.
Differential Revision: https://reviews.llvm.org/D74553
Matt Arsenault [Wed, 22 Jan 2020 01:22:57 +0000 (20:22 -0500)]
AMDGPU/GlobalISel: Make G_TRUNC legal
This is required to be legal. I'm not sure how we were getting away
without defining any rules for it.
Matt Arsenault [Thu, 13 Feb 2020 19:30:50 +0000 (14:30 -0500)]
GlobalISel: Don't use LLT references
These should always be passed by value
Nathan James [Thu, 13 Feb 2020 20:20:37 +0000 (20:20 +0000)]
Fix crash in InfinteLoopCheck
Frederic Bastien [Thu, 13 Feb 2020 20:07:22 +0000 (12:07 -0800)]
[NVPTX, LSV] Move the LSV optimization pass to later when the graph is cleaner
This allow it to recognize more loads as being consecutive when the load's address are complex at the start.
Differential Revision: https://reviews.llvm.org/D74444
Alexey Bataev [Thu, 13 Feb 2020 20:05:19 +0000 (15:05 -0500)]
[OPENMP50][DOCS]Claim iterators and add reference to array shaping
patch, NFC.
Alexey Bataev [Thu, 13 Feb 2020 20:02:11 +0000 (15:02 -0500)]
[OPENMP50][DOCS]Update list of supported constructs, NFC.
Wawha [Thu, 13 Feb 2020 19:58:57 +0000 (20:58 +0100)]
Test commit to validate invitation
Reid Kleckner [Thu, 13 Feb 2020 19:56:50 +0000 (11:56 -0800)]
Fix MSVC buildbots after ast_type_traits namespace removal
Vedant Kumar [Thu, 13 Feb 2020 19:53:15 +0000 (11:53 -0800)]
Revert "Recommit "[SCCP] Remove forcedconstant, go to overdefined instead""
This reverts commit
bb310b3f73dde5551bc2a0d564e88f7c831dfdb3. This
breaks the stage2 ASan build, see:
https://bugs.llvm.org/show_bug.cgi?id=44898
rdar://
59431448
Alexandre Ganea [Thu, 13 Feb 2020 19:46:30 +0000 (14:46 -0500)]
[clang-tidy] Fix performance-noexcept-move-constructor-fix test on non-English locale
When running on Windows under the following locale:
D:\llvm-project>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
('French_Canada', '1252')
This patch fixes the following issue:
# command stderr:
Traceback (most recent call last):
File "D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py", line 249, in <module>
main()
File "D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py", line 245, in main
run_test_once(args, extra_args)
File "D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py", line 162, in run_test_once
diff_output.decode() +
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 2050: invalid continuation byte
This is caused by diff reporting no EOL on the last line, and unfortunately this is written in French with accentuation on my locale.
Differential Revision: https://reviews.llvm.org/D74498
Greg Clayton [Thu, 13 Feb 2020 19:43:07 +0000 (11:43 -0800)]
Fix buildbots that create shared libraries from GSYM library by adding a dependency on LLVMDebugInfoDWARF.
Alex Brachet [Thu, 13 Feb 2020 19:39:16 +0000 (14:39 -0500)]
[libc] Add Convenience syscall Template Function
Summary: This patch adds a convenience template function so we don't need to cast all types to `long` manually when calling `__llvm_libc::syscall`.
Reviewers: sivachandra, MaskRay, gchatelet
Reviewed By: sivachandra
Subscribers: libc-commits, tschuett
Differential Revision: https://reviews.llvm.org/D74530
Greg Clayton [Thu, 13 Feb 2020 19:35:43 +0000 (11:35 -0800)]
Fix buildbots by not using "and" and "not".
Ted Woodward [Thu, 13 Feb 2020 19:16:46 +0000 (13:16 -0600)]
Clean up hexagon builder after object-emission removal
Original commit:
https://reviews.llvm.org/rG7683a084de6bd2637f2351f53389df8b610566cf
Denis Khalikov [Thu, 13 Feb 2020 18:29:13 +0000 (13:29 -0500)]
[mlir][spirv] Add ConvertGpuLaunchFuncToVulkanCallsPass
Implement a pass to convert gpu.launch_func op into a sequence of
Vulkan runtime calls. The Vulkan runtime API surface is huge so currently we
don't expose separate external functions in IR for each of them, instead we
expose a few external functions to wrapper libraries which manages
Vulkan runtime.
Differential Revision: https://reviews.llvm.org/D74549
Alex Brachet [Thu, 13 Feb 2020 19:02:20 +0000 (14:02 -0500)]
[libc][NFC] clang-format syscall.h.in
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: MaskRay, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D74570
LLVM GN Syncbot [Thu, 13 Feb 2020 18:52:48 +0000 (18:52 +0000)]
[gn build] Port
19602b71949
Greg Clayton [Wed, 12 Feb 2020 00:05:59 +0000 (16:05 -0800)]
Add a DWARF transformer class that converts DWARF to GSYM.
Summary:
The DWARF transformer is added as a class so it can be unit tested fully.
The DWARF is converted to GSYM format and handles many special cases for functions:
- omit functions in compile units with 4 byte addresses whose address is UINT32_MAX (dead stripped)
- omit functions in compile units with 8 byte addresses whose address is UINT64_MAX (dead stripped)
- omit any functions whose high PC is <= low PC (dead stripped)
- StringTable builder doesn't copy strings, so we need to make backing copies of strings but only when needed. Many strings come from sections in object files and won't need to have backing copies, but some do.
- When a function doesn't have a mangled name, store the fully qualified name by creating a string by traversing the parent decl context DIEs and then. If we don't do this, we end up having cases where some function might appear in the GSYM as "erase" instead of "std::vector<int>::erase".
- omit any functions whose address isn't in the optional TextRanges member variable of DwarfTransformer. This allows object file to register address ranges that are known valid code ranges and can help omit functions that should have been dead stripped, but just had their low PC values set to zero. In this case we have many functions that all appear at address zero and can omit these functions by making sure they fall into good address ranges on the object file. Many compilers do this when the DWARF has a DW_AT_low_pc with a DW_FORM_addr, and a DW_AT_high_pc with a DW_FORM_data4 as the offset from the low PC. In this case the linker can't write the same address to both the high and low PC since there is only a relocation for the DW_AT_low_pc, so many linkers tend to just zero it out.
Reviewers: aprantl, dblaikie, probinson
Subscribers: mgorny, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74450
Reid Kleckner [Wed, 12 Feb 2020 19:34:13 +0000 (11:34 -0800)]
Remove clang::ast_type_traits namespace in favor of clang
DynTypedNode and ASTNodeKind are implemented as part of the clang AST
library, which uses the main clang namespace. There doesn't seem to be a
need for this extra level of namespacing.
I left behind aliases in the ast_type_traits namespace for out of tree
clients of these APIs. To provide aliases for the enumerators, I used
this pattern:
namespace ast_type_traits {
constexpr TraversalKind TK_AsIs = ::clang::TK_AsIs;
}
I think the typedefs will be useful for migration, but we might be able
to drop these enumerator aliases.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D74499