John McCall [Tue, 10 Dec 2019 21:14:41 +0000 (16:14 -0500)]
Add a function to get the ExceptionSpecInfo of a function type; NFC.
John McCall [Mon, 28 Oct 2019 16:45:53 +0000 (09:45 -0700)]
Introduce some types and functions to make it easier to work with
the tblgen AST node hierarchies.
Not totally NFC because both of the emitters now emit in a different
order. The type-nodes emitter now visits nodes in hierarchy order,
which means we could use range checks in classof if we had any types
that would benefit from that; currently we do not. The AST-nodes
emitter now uses a multimap keyed by the name of the record; previously
it was using `Record*`, which of couse isn't stable across processes
and may have led to non-reproducible builds in some circumstances.
John McCall [Mon, 28 Oct 2019 16:25:31 +0000 (09:25 -0700)]
[NFC] Correct accidental use of tabs.
John McCall [Sat, 26 Oct 2019 01:38:07 +0000 (18:38 -0700)]
[NFC] Rename ClangASTEmitters.h -> ASTTableGen.h
Johannes Doerfert [Sat, 14 Dec 2019 04:11:42 +0000 (22:11 -0600)]
[Attributor] Only replace instruction operands
This was part of D70767. When we replace the value of (call/invoke)
instructions we do not want to disturb the old call graph so we will
only replace instruction uses until we get rid of the old PM.
Accepted as part of D70767.
Johannes Doerfert [Sat, 2 Nov 2019 04:37:04 +0000 (23:37 -0500)]
[Attributor] Reuse the IPConstantProp tests for the Attributor
The Attributor can, to some degree, do what IPConstantProp does. We can
consequently use the corner cases already collected and tested for in
the IPConstantProp tests to improve Attributor test coverage.
This exposed various bugs fixed in previous Attributor patches.
Not all functionality of IPConstantProp is available in AAValueSimplify
and AAIsDead so some tests show that we cannot perform the expected
constant propagation.
Reviewers: fhahn, efriedma, mssimpso, davide
Subscribers: bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69748
Nico Weber [Sat, 14 Dec 2019 03:19:11 +0000 (22:19 -0500)]
gn build: add deps I failed to add in
b2508ce85c1
Xin-Xin Wang [Sat, 14 Dec 2019 03:04:36 +0000 (19:04 -0800)]
[clang] Move CLANG_BOOTSTRAP_CMAKE_ARGS above PASSTHROUGH_VARIABLES
I want to pass some CMake cache files in CLANG_BOOTSTRAP_CMAKE_ARGS as
`-C <cache file>.cmake` arguments. I want to be able to use the values
of the bootstrap passthrough variables in the cache files, so the cache
file arguments need to be after passthrough variables. This should be
safe because the values of passthrough variables are all constants and
can't refer to values in CLANG_BOOTSTRAP_CMAKE_ARGS.
Differential Revision: https://reviews.llvm.org/D71428
Fangrui Song [Sat, 7 Dec 2019 18:23:30 +0000 (10:23 -0800)]
[AArch64] Save FP for leaf functions when disabling frame pointer elimination
The change allows clang -mno-omit-leaf-frame-pointer to disable frame
pointer elimination. This behavior matches X86 and Mips, and also GCC
AArch64.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D71168
Fangrui Song [Sat, 7 Dec 2019 18:40:39 +0000 (10:40 -0800)]
[Driver] Default to -momit-leaf-frame-pointer for AArch64
This matches https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
> -momit-leaf-frame-pointer
> -mno-omit-leaf-frame-pointer
>
> Omit or keep the frame pointer in leaf functions. The former behavior is the default.
-mno-omit-leaf-frame-pointer is currently a no-op because
TargetOptions::DisableFramePointerElim is only considered for non-leaf
functions.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D71167
Richard Smith [Sat, 14 Dec 2019 02:38:33 +0000 (18:38 -0800)]
PR44268: Fix crash if __builtin_object_size is applied to a heap
allocation.
Richard Smith [Thu, 12 Dec 2019 01:28:46 +0000 (17:28 -0800)]
[c++20] Improve phrasing of diagnostic for missing #include <compare>.
Stephan T. Lavavej [Sat, 14 Dec 2019 02:14:09 +0000 (18:14 -0800)]
[libcxx] [test] Include missing headers. (NFC)
libcxx/test/std/containers/sequences/array/at.pass.cpp
Need to include <stdexcept> for std::out_of_range.
libcxx/test/std/localization/locale.categories/category.time/*
Need to include <ios> for std::ios.
Artem Dergachev [Sat, 14 Dec 2019 01:59:36 +0000 (17:59 -0800)]
[analyzer] CStringChecker: Fix a crash on unknown value passed to strlcat.
Checkers should always account for unknown values.
Also use a slightly more high-level API that naturally avoids the problem.
Sean Fertile [Fri, 13 Dec 2019 19:34:11 +0000 (14:34 -0500)]
[PowerPC] Add Support for indirect calls on AIX.
Extends the desciptor-based indirect call support for 32-bit codegen,
and enables indirect calls for AIX.
In-depth Description:
In a function descriptor based ABI, a function pointer points at a
descriptor structure as opposed to the function's entry point. The
descriptor takes the form of 3 pointers: 1 for the function's entry
point, 1 for the TOC anchor of the module containing the function
definition, and 1 for the environment pointer:
struct FunctionDescriptor {
void *EntryPoint;
void *TOCAnchor;
void *EnvironmentPointer;
};
An indirect call has several steps of loading the the information from
the descriptor into the proper registers for setting up the call. Namely
it has to:
1) Save the caller's TOC pointer into the TOC save slot in the linkage
area, and then load the callee's TOC pointer into the TOC register
(GPR 2 on AIX).
2) Load the function descriptor's entry point into the count register.
3) Load the environment pointer into the environment pointer register
(GPR 11 on AIX).
4) Perform the call by branching on count register.
5) Restore the caller's TOC pointer after returning from the indirect call.
A couple important caveats to the above:
- There is no way to directly load a value from memory into the count register.
Instead we populate the count register by loading the entry point address into
a gpr and then moving the gpr to the count register.
- The TOC restore has to come immediately after the branch on count register
instruction (i.e., the 1st instruction executed after we return from the
call). This is an implementation limitation. We could, in theory, schedule
the restore elsewhere as long as no uses of the TOC pointer fall in between
the call and the restore; however, to keep it simple, we insert a pseudo
instruction that represents both the indirect branch instruction and the
load instruction that restores the caller's TOC from the linkage area. As
they flow through the compiler as a single pseudo instruction, nothing can be
inserted between them and the caller's TOC is then valid at any use.
Differtential Revision: https://reviews.llvm.org/D70724
Julian Lettner [Tue, 26 Feb 2019 06:51:50 +0000 (22:51 -0800)]
[lit] Small cleanups. NFCI
Remove unnecessary (argument same as default), cleanup imports, use
"pythonic" names for variables, and general formatting.
Michael Kruse [Sat, 14 Dec 2019 00:40:54 +0000 (18:40 -0600)]
[OpenMP][Docs] Claim loop tiling.
Fangrui Song [Sat, 14 Dec 2019 00:40:34 +0000 (16:40 -0800)]
[Mips] Fix gcc -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D71028
Roman Tereshin [Thu, 12 Dec 2019 21:20:41 +0000 (13:20 -0800)]
[Legalizer] Making artifact combining order-independent
Legalization algorithm is complicated by two facts:
1) While regular instructions should be possible to legalize in
an isolated, per-instruction, context-free manner, legalization
artifacts can only be eliminated in pairs, which could be deeply, and
ultimately arbitrary nested: { [ () ] }, where which paranthesis kind
depicts an artifact kind, like extend, unmerge, etc. Such structure
can only be fully eliminated by simple local combines if they are
attempted in a particular order (inside out), or alternatively by
repeated scans each eliminating only one innermost pair, resulting in
O(n^2) complexity.
2) Some artifacts might in fact be regular instructions that could (and
sometimes should) be legalized by the target-specific rules. Which
means failure to eliminate all artifacts on the first iteration is
not a failure, they need to be tried as instructions, which may
produce more artifacts, including the ones that are in fact regular
instructions, resulting in a non-constant number of iterations
required to finish the process.
I trust the recently introduced termination condition (no new artifacts
were created during as-a-regular-instruction-retrial of artifacts not
eliminated on the previous iteration) to be efficient in providing
termination, but only performing the legalization in full if and only if
at each step such chains of artifacts are successfully eliminated in
full as well.
Which is currently not guaranteed, as the artifact combines are applied
only once and in an arbitrary order that has to do with the order of
creation or insertion of artifacts into their worklist, which is a no
particular order.
In this patch I make a small change to the artifact combiner, making it
to re-insert into the worklist immediate (modulo a look-through copies)
artifact users of each vreg that changes its definition due to an
artifact combine.
Here the first scan through the artifacts worklist, while not
being done in any guaranteed order, only needs to find the innermost
pair(s) of artifacts that could be immediately combined out. After that
the process follows def-use chains, making them shorter at each step, thus
combining everything that can be combined in O(n) time.
Reviewers: volkan, aditya_nandakumar, qcolombet, paquette, aemerson, dsanders
Reviewed By: aditya_nandakumar, paquette
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71448
Roman Tereshin [Thu, 12 Dec 2019 16:35:16 +0000 (08:35 -0800)]
[Legalizer] Refactoring out legalizeMachineFunction
and introducing new unittests/CodeGen/GlobalISel/LegalizerTest.cpp
relying on it to unit test the entire legalizer algorithm (including the
top-level main loop).
See also https://reviews.llvm.org/D71448
Roman Tereshin [Thu, 12 Dec 2019 21:08:40 +0000 (13:08 -0800)]
[Legalizer] More detailed debugging printing in main loop
Vedant Kumar [Fri, 13 Dec 2019 20:57:37 +0000 (12:57 -0800)]
[ubsan] Enable testing of .m files
This allows `.m` test files, like the existing Misc/bool.m, to be
tested.
Jonas Devlieghere [Fri, 13 Dec 2019 22:48:30 +0000 (14:48 -0800)]
[lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.
This groups the headers and interfaces in separate files that can be
included by other swig files for different languages.
Fangrui Song [Thu, 12 Dec 2019 18:49:46 +0000 (10:49 -0800)]
[Driver] Use .init_array for all gcc installations and simplify Generic_ELF -fno-use-init-array rules
D39317 made clang use .init_array when no gcc installations is found.
This change changes all gcc installations to use .init_array .
GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files,
and stopped emitting .ctors for __attribute__((constructor)).
.init_array should always work.
FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D71434
Alexey Bataev [Fri, 13 Dec 2019 21:05:30 +0000 (16:05 -0500)]
[OPENMP]Fix skipping of functions body.
When parsing the code with OpenMP and the function's body must be
skipped, need to skip also OpenMP annotation tokens. Otherwise the
counters for braces/parens are unbalanced and parsing fails.
Jonas Devlieghere [Fri, 13 Dec 2019 21:46:30 +0000 (13:46 -0800)]
[lldb/CMake] Initialize LLDB_ENABLE_POSIX based on the UNIX variable.
Jonas Devlieghere [Fri, 13 Dec 2019 18:37:33 +0000 (10:37 -0800)]
[lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHON
This matches the naming scheme used by LLVM and all the other optional
dependencies in LLDB.
Differential revision: https://reviews.llvm.org/D71482
Alex Richardson [Fri, 13 Dec 2019 19:44:13 +0000 (19:44 +0000)]
[LSAN] Increase stack space for guard-page.c test
Summary:
When running the tests on a Ubuntu 18.04 machine this test is crashing for
me inside the runtime linker. My guess is that it is trying to save more
registers (possibly large vector ones) and the current stack space is not
sufficient.
Reviewers: samsonov, kcc, eugenis
Reviewed By: eugenis
Subscribers: eugenis, merge_guards_bot, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71461
Alex Richardson [Fri, 13 Dec 2019 19:43:15 +0000 (19:43 +0000)]
[NFC] Use SelectionDAG::getMemBasePlusOffset() instead of getNode(ISD::ADD)
Summary:
To find potential opportunities to use getMemBasePlusOffset() I looked at
all ISD::ADD uses found with the regex getNode\(ISD::ADD,.+,.+Ptr
in lib/CodeGen/SelectionDAG. If this patch is accepted I will convert
the files in the individual backends too.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel
Reviewed By: spatel
Subscribers: merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71207
Alex Richardson [Fri, 13 Dec 2019 19:43:06 +0000 (19:43 +0000)]
[NFC] Implement SelectionDAG::getObjectPtrOffset() using getMemBasePlusOffset()
Summary:
This change is preparatory work to use this helper functions in more places.
In order to make this change, getMemBasePlusOffset() has been extended to
also take a SDNodeFlags parameter.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel
Reviewed By: spatel
Subscribers: merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71206
Alex Richardson [Fri, 13 Dec 2019 19:43:02 +0000 (19:43 +0000)]
[NFC] Add a SDValue overload for SelectionDAG::getMemBasePlusOffset()
Summary:
This change is preparatory work to use this helper functions in more places.
Currently the function only allows integer constants offsets, but there
are cases where we can use an existing SDValue parameter.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel, craig.topper
Reviewed By: spatel, craig.topper
Subscribers: craig.topper, merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71205
Alex Richardson [Fri, 13 Dec 2019 19:42:58 +0000 (19:42 +0000)]
[NFC] Change SelectionDAG::getMemBasePlusOffset() to use int64_t
Summary:
This change is preparatory work to use this helper functions in more places.
Currently the function only allows positive offsets, but there are cases
where we want to subtract an offset from an existing pointer.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel
Reviewed By: spatel
Subscribers: merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71204
Alexey Bataev [Fri, 13 Dec 2019 21:24:10 +0000 (16:24 -0500)]
Revert "[libomptarget] Move resource id functions into target specific code, implement for amdgcn"
This reverts commit
dbb3fec8adfc4ac3fbf31f51f294427dbabbebb2 since it
breaks the NVPTX tests.
Akira Hatanaka [Thu, 12 Dec 2019 06:51:18 +0000 (22:51 -0800)]
Call objc_retainBlock before passing a block as a variadic argument
Copy the block to the heap before passing it to the callee in case the
block escapes in the callee.
rdar://problem/
55683462
Differential Revision: https://reviews.llvm.org/D71431
Eric Christopher [Fri, 13 Dec 2019 20:54:13 +0000 (12:54 -0800)]
Fix -Wswitch-coverage warning in clang-tidy after ak_addrspace introduction.
Differential Revision: https://reviews.llvm.org/D71486
Reviewed By: rsmith
Eric Fiselier [Fri, 13 Dec 2019 20:42:07 +0000 (15:42 -0500)]
[libc++] Ensure __config always defines certain configuration macros.
Med Ismail Bennani [Tue, 10 Dec 2019 23:09:25 +0000 (15:09 -0800)]
LanguageRuntime: Simplify NSException::GetSummary() output
Summary:
Right now, NSException::GetSummary() has the following output:
"name: $exception_name - reason: $exception_reason"
It would be better to simplify the output by removing the name and only
showing the exception's reason. This way, annotations would look nicer in
the editor, and would be a shorter summary in the Variables Inspector.
Accessing the exception's name can still be done by expanding the
NSException object in the Variables Inspector.
rdar://
54770115
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71311
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Erich Keane [Fri, 13 Dec 2019 20:15:41 +0000 (12:15 -0800)]
Correct gcc vector splat conversion from float to int-vector
In looking into some other code, I came across this issue where a
float converted to a gcc integer vector via a splat causes it to miss
the float-to-integral cast, which causes some REALLY strange codegen
bugs.
The AST looked like:
`-ImplicitCastExpr <col:13>
'gcc_int_2':'__attribute__((__vector_size__(2 * sizeof(int)))) int' <VectorSplat>
`-ImplicitCastExpr <col:13> 'float' <LValueToRValue>
`-DeclRefExpr <col:13> 'float' lvalue ParmVar
0x556f16a5dc90 'f' 'float'
Despite the type of the VectorSplat cast as printed, it ended up
becoming a vector of float, which caused non-matching instructions. For
example, IntVector + a float constant resulted in:
add <2 x i32> %8, <2 x float> <float 3.000000e+00, float 3.000000e+00>
This patch corrects the conversion so that the float is first converted
to an integral, THEN splatted.
Sam Elliott [Fri, 13 Dec 2019 20:00:14 +0000 (20:00 +0000)]
[RISCV] Move DebugLoc Copy into CompressInstEmitter
Summary:
This copy ensures that debug location information is kept for
compressed instructions. There are places where both compressInstruction and
uncompressInstruction are called that were not doing this copy, discarding some
debug info.
This change merely moves the copy into the generated file, so you cannot forget
to copy the location over when compressing or uncompressing.
Reviewers: asb, luismarques
Reviewed By: luismarques
Subscribers: sameer.abuasal, aprantl, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67493
Francesco Petrogalli [Fri, 13 Dec 2019 19:15:29 +0000 (19:15 +0000)]
Revert "[VectorUtils] Introduce the Vector Function Database (VFDatabase)."
This reverts commit
0be81968a283fd4161cb9ac9748d5ed200926292.
The VFDatabase needs some rework to be able to handle vectorization
and subsequent scalarization of intrinsics in out-of-tree versions of
the compiler. For more details, see the discussion in
https://reviews.llvm.org/D67572.
Fangrui Song [Fri, 13 Dec 2019 19:15:40 +0000 (11:15 -0800)]
[profile] Fix a crash when -fprofile-remapping-file= triggers an error
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D71485
Sanjay Patel [Fri, 13 Dec 2019 19:03:18 +0000 (14:03 -0500)]
[InstSimplify] improve test coverage for insert+splat; NFC
Sanjay Patel [Fri, 13 Dec 2019 14:40:33 +0000 (09:40 -0500)]
[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc (2nd try)
The initial attempt (rG89633320) botched the logic by reversing
the source/dest types. Added x86 tests for additional coverage.
The vector tests show a potential improvement (fold vector load
instead of broadcasting), but that's a known/existing problem.
This fold is done in IR by instcombine, and we have a special
form of it already here in DAGCombiner, but we want the more
general transform too:
https://rise4fun.com/Alive/3jZm
Name: general
Pre: (C1 + zext(C2) < 64)
%s = lshr i64 %x, C1
%t = trunc i64 %s to i16
%r = lshr i16 %t, C2
=>
%s2 = lshr i64 %x, C1 + zext(C2)
%a = and i64 %s2, zext((1 << (16 - C2)) - 1)
%r = trunc %a to i16
Name: special
Pre: C1 == 48
%s = lshr i64 %x, C1
%t = trunc i64 %s to i16
%r = lshr i16 %t, C2
=>
%s2 = lshr i64 %x, C1 + zext(C2)
%r = trunc %s2 to i16
...because D58017 exposes a regression without this fold.
Hiroshi Yamauchi [Thu, 7 Nov 2019 16:52:05 +0000 (08:52 -0800)]
[PGO][PGSO] Enable size optimizations in code gen / target passes for cold code.
Summary: Split off of D67120.
Reviewers: davidxl
Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71288
Mitch Phillips [Fri, 13 Dec 2019 18:55:53 +0000 (10:55 -0800)]
[NFC] Guard scudo_standalone's optional dependency on GWP-ASan behind flags.
Momchil Velikov [Fri, 13 Dec 2019 18:14:38 +0000 (18:14 +0000)]
[ARM] Fix in ICE when retrieving the number of micro-ops for vlldm/vlstm
The big switch in `ARMBaseInstrInfo::getNumMicroOps` is missing cases for
`VLLDM` and `VLSTM`, which are currently defined with itineraries having a
dynamic count of micro-ops.
Assuming an optimistic case in which these instruction do not actually perform
loads or stores, and with the idea that Armv8-m cores are supposed to use the
new style scheduling models, this patch just sets the itinerary for those two
instructions to `NoItinerary`.
Differential Revision: https://reviews.llvm.org/D71266
Nico Weber [Fri, 13 Dec 2019 18:03:55 +0000 (13:03 -0500)]
gn docs: remove obsolete reference to monorepo
Jonas Devlieghere [Fri, 13 Dec 2019 17:49:51 +0000 (09:49 -0800)]
[lldb/Test] C++ test should use CXXFLAGS_EXTRAS
Thanks Ted Woodward for noticing this.
Jonas Devlieghere [Thu, 12 Dec 2019 18:00:45 +0000 (10:00 -0800)]
[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_POSIX
Rename LLDB_DISABLE_POSIX to LLDB_ENABLE_POSIX and use cmakedefine01 for
consistency.
Jon Chesterfield [Fri, 13 Dec 2019 17:48:19 +0000 (17:48 +0000)]
[libomptarget] Build most of common/src for amdgcn
Summary:
[libomptarget] Build most of common/src for amdgcn
Excluding parallel.cu, which uses an integer min() from cuda,
Excluding support.cu, which calls malloc that is not yet available for amdgcn
Reviewers: jdoerfert, ABataev, grokos
Reviewed By: jdoerfert
Subscribers: gregrodgers, ronlieb, jvesely, mgorny, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D71446
Mitch Phillips [Fri, 13 Dec 2019 17:43:51 +0000 (09:43 -0800)]
[GWP-ASan] [Scudo] ifdef entire GWP-ASan tests.
Turns out that gtest in LLVM is only 1.8.0 (the newest version 1.10.0)
supports the GTEST_SKIP() macro, and apparently I didn't build w/o
GWP-ASan.
Should fix the GN bot, as well as any bots that may spuriously break on
platforms where the code wasn't correctly ifdef'd out as well.
Vlad Tsyrklevich [Fri, 13 Dec 2019 17:43:51 +0000 (09:43 -0800)]
Revert "[ELF] Allow getErrPlace() to work before Out::bufferStart is set"
This reverts commit
2bbd32f5e8f0f62d895966e2623d9bdb9778b50b, it was
causing UBSan failures like the following:
lld/ELF/Target.cpp:103:41: runtime error: applying non-zero offset 24 to null pointer
Momchil Velikov [Fri, 13 Dec 2019 17:37:22 +0000 (17:37 +0000)]
[AArch64] Emit PAC/BTI .note.gnu.property flags
This patch make LLVM emit the processor specific program property types
defined in AArch64 ELF spec
https://developer.arm.com/docs/ihi0056/f/elf-for-the-arm-64-bit-architecture-aarch64-abi-2019q2-documentation
A file containing no functions gets both property flags. Otherwise, a property
is set iff all the functions in the file have the corresponding attribute.
Patch by Daniel Kiss and Momchil Velikov.
Differential Revision: https://reviews.llvm.org/D71019
Fangrui Song [Fri, 13 Dec 2019 00:18:57 +0000 (16:18 -0800)]
[MC][PowerPC] Fix a crash when redefining a symbol after .set
Fix PR44284. This is probably not valid assembly but we should not crash.
Reviewed By: luporl, #powerpc, steven.zhang
Differential Revision: https://reviews.llvm.org/D71443
Mark Murray [Fri, 13 Dec 2019 17:25:49 +0000 (17:25 +0000)]
[ARM][MVE][Intrinsics] All vqdmulhq/vqrdmulhq tests should be for signed numbers.
Fix broken tests. I can't yet explain how they worked locally pre-commit.
Fangrui Song [Fri, 13 Dec 2019 17:26:15 +0000 (09:26 -0800)]
[ARM][MVE] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D71062
Fangrui Song [Sat, 7 Dec 2019 05:18:31 +0000 (21:18 -0800)]
[ELF] Update st_size when merging a common symbol with a shared symbol
When a common symbol is merged with a shared symbol, increase st_size if
the shared symbol has a larger st_size. At runtime, the executable's
symbol overrides the shared symbol. The shared symbol may be created
from common symbols in a previous link. This rule makes sure we pick
the largest size among all common symbols.
This behavior matches GNU ld. See
https://sourceware.org/bugzilla/show_bug.cgi?id=25236 for discussions.
A shared symbol does not hold alignment constraints. Ignore the
alignment update.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D71161
Mitch Phillips [Fri, 13 Dec 2019 17:09:34 +0000 (09:09 -0800)]
[Scudo] [GWP-ASan] Add GWP-ASan to Scudo Standalone.
Summary:
Adds GWP-ASan to Scudo standalone. Default parameters are pulled across from the
GWP-ASan build. No backtrace support as of yet.
Reviewers: cryptoad, eugenis, pcc
Reviewed By: cryptoad
Subscribers: merge_guards_bot, mgorny, #sanitizers, llvm-commits, cferris, vlad.tsyrklevich, pcc
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71229
Mark Murray [Fri, 13 Dec 2019 16:36:08 +0000 (16:36 +0000)]
[ARM][MVE][Intrinsics] remove extraneous intrinsics. (Reapply)
Summary:
I overstepped my reach and generated too many intrinsics; these never
made it into the tests.
Remove these extras. Some needed to be signed-olny, and there were some
possible but unrequired _x variants that needed an extra argument to
IntrinsicMX to allow [de-]selection at compile-time.
Reviewers: simon_tatham
Subscribers: kristof.beyls, dmgreen, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71466
LLVM GN Syncbot [Fri, 13 Dec 2019 16:20:43 +0000 (16:20 +0000)]
gn build: Merge
84728e65e95
Dmitri Gribenko [Fri, 13 Dec 2019 16:16:13 +0000 (17:16 +0100)]
Revert "[ARM][MVE][Intrinsics] remove extraneous intrinsics."
This reverts commit
0eb0992739189dba0d86af33722bc27260a9b555.
The code does not compile:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/20462
Miloš Stojanović [Fri, 13 Dec 2019 16:02:19 +0000 (17:02 +0100)]
[llvm-exegesis][mips] Add BenchmarkResultTest unit test
Test writing and reading benchmark instructions to and from disc, and
check calculations of min, max and avg values from a list of benchmark
measures.
Differential Revision: https://reviews.llvm.org/D71265
Sam McCall [Wed, 11 Dec 2019 12:19:52 +0000 (13:19 +0100)]
[clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.
Summary:
The problem:
LSP specifies that Positions are between characters. Therefore when a position
(or an empty range) is used to target elements of the source code, there is an
ambiguity - should we look left or right of the cursor?
Until now, SelectionTree resolved this to the right except in trivial cases
(where there's whitespace, semicolon, or eof on the right).
This meant that it's unable to e.g. out-line `int foo^()` today.
Complicating this, LSP notwithstanding the cursor is *on* a character in many
editors (mostly terminal-based). In these cases there's no ambiguity - we must
"look right" - but there's also no way to tell in LSP.
(Several features currently resolve this by using getBeginningOfIdentifier,
which tries to rewind and supports end-of-identifier. But this relies on
raw lexing and is limited and buggy).
Precedent: well - most other languages aren't so full of densely packed symbols
that we might want to target. Bias-towards-identifier works well enough.
MS C++ for vscode seems to mostly use bias-toward-identifier too.
The problem with this solution is it doesn't provide any way to target some
things such as the constructor call in Foo^(bar());
Presented solution:
When an ambiguous selection is found, we generate *both* possible selection
trees. We try to run the feature on the rightward tree first, and then on the
leftward tree if it fails.
This is basically do-what-I-mean, the main downside is the need to do this on
a feature-by-feature basis (because each feature knows what "fail" means).
The most complicated instance of this is Tweaks, where the preferred selection
may vary tweak-by-tweak.
Wrinkles:
While production behavior is pretty consistent, this introduces some
inconsistency in testing, depending whether the interface we're testing is
inside or outside the "retry" wrapper.
In particular, for many features like Hover, the unit tests will show production
behavior, while for Tweaks the harness would have to run the loop itself if
we want this.
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71345
Sam McCall [Wed, 11 Dec 2019 14:40:23 +0000 (15:40 +0100)]
[Tooling/Syntax] Helpers to find spelled tokens touching a location.
Summary: Useful when positions are used to target nodes, with before/after ambiguity.
Reviewers: ilya-biryukov, kbobyrev
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71356
Mark Murray [Fri, 13 Dec 2019 14:54:23 +0000 (14:54 +0000)]
[ARM][MVE][Intrinsics] remove extraneous intrinsics.
Summary:
I overstepped my reach and generated too many intrinsics; these never
made it into the tests.
Remove these extras. Some needed to be signed-olny, and there were some
possible but unrequired _x variants that needed an extra argument to
IntrinsicMX to allow [de-]selection at compile-time.
Reviewers: simon_tatham
Subscribers: kristof.beyls, dmgreen, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71466
Sam Parker [Wed, 11 Dec 2019 16:12:58 +0000 (16:12 +0000)]
[ARM][MVE] Make VPT invalid for tail predication
We've been marking VPT incompatible instructions as invalid for tail
predication too, though this may not strictly be true. VPT are
incompatible and, unless its the first predicate def in a loop,
they shouldn't be compatible for tail predication either.
Differential Revision: https://reviews.llvm.org/D71410
Kristina Bessonova [Thu, 5 Dec 2019 13:45:57 +0000 (16:45 +0300)]
[llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%
Summary:
This is a follow up for D70548.
Currently, variables with debug info coverage between 0% and 1% are put into
zero-bucket. D70548 changed the way statistics calculate a variable's coverage:
we began to use enclosing scope rather than a possible variable life range.
Thus more variables might be moved to zero-bucket despite they have some debug
info coverage.
The patch is to distinguish between a variable that has location info but
it's significantly less than its enclosing scope and a variable that doesn't
have it at all.
Reviewers: djtodoro, aprantl, dblaikie, avl
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71070
Nicola Zaghen [Fri, 13 Dec 2019 09:55:45 +0000 (09:55 +0000)]
Reland [DataLayout] Fix occurrences that size and range of pointers are assumed to be the same.
GEP index size can be specified in the DataLayout, introduced in D42123. However, there were still places
in which getIndexSizeInBits was used interchangeably with getPointerSizeInBits. This notably caused issues
with Instcombine's visitPtrToInt; but the unit tests was incorrect, so this remained undiscovered.
This fixes the buildbot failures.
Differential Revision: https://reviews.llvm.org/D68328
Patch by Joseph Faulls!
Jon Chesterfield [Fri, 13 Dec 2019 14:27:52 +0000 (14:27 +0000)]
[libomptarget][nfc] Add nop syncwarp function for amdgcn
Sanjay Patel [Thu, 12 Dec 2019 23:19:57 +0000 (18:19 -0500)]
[x86] add tests for shift-trunc-shift; NFC
More coverage for a possible generic transform.
Mikhail Maltsev [Fri, 13 Dec 2019 13:17:29 +0000 (13:17 +0000)]
[ARM][MVE] Add vector reduction intrinsics with two vector operands
Summary:
This patch adds intrinsics for the following MVE instructions:
* VABAV
* VMLADAV, VMLSDAV
* VMLALDAV, VMLSLDAV
* VRMLALDAVH, VRMLSLDAVH
Each of the above 4 groups has a corresponding new LLVM IR intrinsic,
since the instructions cannot be easily represented using
general-purpose IR operations.
Reviewers: simon_tatham, ostannard, dmgreen, MarkMurrayARM
Reviewed By: MarkMurrayARM
Subscribers: merge_guards_bot, kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D71062
Kristina Bessonova [Wed, 11 Dec 2019 17:52:49 +0000 (20:52 +0300)]
[llvm-dwarfdump][Statistics] Change the coverage buckets representation. NFC
Summary:
This changes the representation of 'coverage buckets' in llvm-dwarfdump and
llvm-locstats to one that makes more clear what the buckets contain.
See some related details in D71070.
Reviewers: djtodoro, aprantl, cmtice, jhenderson
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71366
Simon Tatham [Fri, 13 Dec 2019 13:05:07 +0000 (13:05 +0000)]
[ARM][MVE] Add intrinsics for more immediate shifts.
Summary:
This fills in the remaining shift operations that take a single vector
input and an immediate shift count: the `vqshl`, `vqshlu`, `vrshr` and
`vshll[bt]` families.
`vshll[bt]` (which shifts each input lane left into a double-width
output lane) is the most interesting one. There are separate MC
instruction ids for shifting by exactly the input lane width and
shifting by less than that, because the instruction encoding is so
completely different for the lane-width special case. So I had to
write two sets of patterns to match based on the immediate shift
count, which involved adding a ComplexPattern matcher to avoid the
general-case pattern accidentally matching the special case too. For
that family I've made sure to add an llc codegen test for both
versions of each instruction.
I'm experimenting with a new strategy for parametrising the isel
patterns for all these instructions: adding extra fields to the
relevant `Instruction` subclass itself, which are ignored by the
Tablegen backends that generate the MC data, but can be retrieved from
each instance of that instruction subclass when it's passed as a
template parameter to the multiclass that generates its isel patterns.
A nice effect of that is that I can fill in those informational fields
using `let` blocks, rather than having to type them out once per
instruction at `defm` time.
(As a result, quite a lot of existing instruction `def`s are
reindented by this patch, so it's clearer to read with whitespace
changes ignored.)
Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard
Reviewed By: MarkMurrayARM
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D71458
John Brawn [Thu, 5 Dec 2019 12:44:41 +0000 (12:44 +0000)]
[ARM] Add custom strict fp conversion lowering when non-strict is custom
We have custom lowering for operations converting to/from floating-point types
when we don't have hardware support for those types, and this doesn't interact
well with the target-independent legalization of the strict versions of these
operations. Fix this by adding similar custom lowering of the strict versions.
This fixes the last of the assertion failures in the CodeGen/ARM/fp-intrinsics
test, with the remaining failures due to poor instruction selection.
Differential Revision: https://reviews.llvm.org/D71127
Tim Renouf [Tue, 3 Dec 2019 20:09:53 +0000 (20:09 +0000)]
Revert "AMDGPU: Try to commute sub of boolean ext"
This reverts commit
69fcfb7d3597e0cdb5554b4e672e9032b411b167.
As shown in the test I attached to this commit, the change I reverted
causes a problem with "zext(cc1) - zext(cc2)". It commuted
the operands to the sub and used different logic to select the addc/subc
instruction:
sub zext (setcc), x => addcarry 0, x, setcc
sub sext (setcc), x => subcarry 0, x, setcc
... but that is bogus. I believe it is not possible to fold those commuted
patterns into any form of addcarry or subcarry. It may have worked as
intended before "AMDGPU: Change boolean content type to 0 or 1" because
the setcc was considered to be -1 rather than 1.
Differential Revision: https://reviews.llvm.org/D70978
Change-Id: If2139421aa6c935cbd1d925af58fe4a4aa9e8f43
Djordje Todorovic [Thu, 12 Dec 2019 13:31:50 +0000 (14:31 +0100)]
[llvm-locstats] Avoid the locstats when no scope bytes coverage found
If the total number of PC range bytes in each variable's enclosing scope
('scope bytes total') is 0, we will have division by zero.
Differential Revision: https://reviews.llvm.org/D71415
Anastasia Stulova [Fri, 13 Dec 2019 12:30:59 +0000 (12:30 +0000)]
[Sema] Improve diagnostic about addr spaces for overload candidates
Allow sending address spaces into diagnostics to simplify and improve
error reporting. Improved wording of diagnostics for address spaces
in overloading.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71111
Alex Richardson [Fri, 13 Dec 2019 11:28:20 +0000 (11:28 +0000)]
[NFC] Use EVT instead of bool for getSetCCInverse()
Summary:
The use of a boolean isInteger flag (generally initialized using
VT.isInteger()) caused errors in our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project).
In our backend, pointers use a separate ValueType (iFATPTR) and therefore
.isInteger() returns false. This meant that getSetCCInverse() was using the
floating-point variant and generated incorrect code for us:
`(void *)0x12033091e < (void *)0xffffffffffffffff` would return false.
Committing this change will significantly reduce our merge conflicts
for each upstream merge.
Reviewers: spatel, bogner
Reviewed By: bogner
Subscribers: wuzish, arsenm, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, jrtc27, atanasyan, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70917
Alex Richardson [Fri, 13 Dec 2019 12:19:51 +0000 (12:19 +0000)]
[ELF] Allow getErrPlace() to work before Out::bufferStart is set
Summary:
So far it seems like the only test affected by this change is the one I
recently added for R_MIPS_JALR relocations since the other test cases that
use this function early (unknown-relocation-*) do not have a valid input
section for the relocation offset.
Reviewers: ruiu, grimar, MaskRay, espindola
Reviewed By: ruiu, MaskRay
Subscribers: emaste, sdardis, jrtc27, atanasyan, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70659
Sjoerd Meijer [Fri, 13 Dec 2019 11:46:33 +0000 (11:46 +0000)]
Revert "[ARM][MVE] findVCMPToFoldIntoVPS. NFC."
This reverts commit
9468e3334ba54fbb1b209aaec662d7375451fa1f.
There's a test that doesn't like this change. The RDA analysis
gets invalided by changes in the block, which is not taken into
account. Revert while I work on a fix for this.
Mark Murray [Wed, 11 Dec 2019 17:53:12 +0000 (17:53 +0000)]
[ARM][MVE][Intrinsics] Add *_x() variants of my *_m() intrinsics.
Summary:
Better use of multiclass is used, and this helped find some existing
bugs in the predicated VMULL* intrinsics, which are now fixed.
The refactored VMULL[TB]Q_(INT|POLY)_M() intrinsics were discovered
to have an argument ("inactive") with incorrect type, and this required
a fix that is included in this whole patch. The argument "inactive"
should have been the same width (per vector element) as the return
type of the intrinsic, but was not in the case where the return type
was double the element width of the input types.
To assist in testing the multiclassing , and to thwart further gremlins,
the unit tests are improved in scope.
The *.ll tests are all generated by a small bit of throw-away scripting
from the corresponding *.c tests, and as such the diffs are large and
nasty. Look at the file rather than the diff.
Reviewers: dmgreen, miyuki, ostannard, simon_tatham
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D71421
Raphael Isemann [Fri, 13 Dec 2019 11:24:23 +0000 (12:24 +0100)]
[lldb][NFC] Remove all `setUp` overrides that only call the parent implementation
Summary:
A lot of our tests copied the setUp code from our TestSampleTest.py:
```
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
```
This code does nothing unless we actually do any setUp work in there, so let's remove all these method definitions.
Reviewers: labath, JDevlieghere
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71454
Raphael Isemann [Fri, 13 Dec 2019 11:21:59 +0000 (12:21 +0100)]
[lldb][NFC] Remove unused includes in Utility's source files
Raphael Isemann [Fri, 13 Dec 2019 11:11:23 +0000 (12:11 +0100)]
[lldb][NFC] Remove 'from __future__ import print_function' from all tests that don't actually call 'print()'
Summary:
A lot of tests do this trick but the vast majority of them don't even call `print()`.
Most of this patch was generated by a script that just looks at all the files and deletes the line if there is no `print (` or `print(` anywhere else in the file.
I checked the remaining tests manually and deleted the import if we never call print (but instead do stuff like `expr print(...)` and similar false-positives).
I also corrected the additional empty lines after the import in the files that I manually edited.
Reviewers: JDevlieghere, labath, jfb
Reviewed By: labath
Subscribers: dexonsmith, wuzish, nemanjai, kbarton, christof, arphaman, abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71452
Kai Nacke [Mon, 2 Dec 2019 09:27:57 +0000 (10:27 +0100)]
[Docs] Fix target feature matrix for PowerPC and SystemZ
The target feature matrix in the code generator documentation is
outdated. This PR fixes some entries for PowerPC and SystemZ.
Both have:
- assembly parser
- disassembler
- .o file writing
Reviewers: uweigand
Differential Revision: https://reviews.llvm.org/D71004
Raphael Isemann [Fri, 13 Dec 2019 11:09:10 +0000 (12:09 +0100)]
[lldb][NFC] Add reminder to TestSampleTest that setUp should be deleted if it not needed.
Raphael Isemann [Fri, 13 Dec 2019 10:29:48 +0000 (11:29 +0100)]
[lldb][NFC] Make metadata tracking type safe
Summary:
LLDB associates additional information with Types and Declarations which it calls ClangASTMetadata.
ClangASTMetadata is stored by the ClangASTSourceCommon which is implemented by having a large map of
`void *` keys to associated `ClangASTMetadata` values. To make this whole mechanism even unsafer
we also decided to use `clang::Decl *` as one of pointers we throw in there (beside `clang::Type *`).
The Decl class hierarchy uses multiple inheritance which means that not all pointers have the
same address when they are implicitly converted to pointers of their parent classes. For example
`clang::Decl *` and `clang::DeclContext *` won't end up being the same address when they
are implicitly converted from one of the many Decl-subclasses that inherit from both.
As we use the addresses as the keys in our Metadata map, this means that any implicit type
conversions to parent classes (or anything else that changes the addresses) will break our metadata tracking
in obscure ways.
Just to illustrate how broken this whole mechanism currently is:
```lang=cpp
// m_ast is our ClangASTContext. Let's double check that from GetTranslationUnitDecl
// in ClangASTContext and ASTContext return the same thing (one method just calls the other).
assert(m_ast->GetTranslationUnitDecl() == m_ast->getASTContext()->getTranslationUnitDecl());
// Ok, both methods have the same TU*. Let's store metadata with the result of one method call.
m_ast->SetMetadataAsUserID(m_ast->GetTranslationUnitDecl(), 1234U);
// Retrieve the same Metadata for the TU by using the TU* from the other method... which fails?
EXPECT_EQ(m_ast->GetMetadata(m_ast->getASTContext()->getTranslationUnitDecl())->GetUserID(), 1234U);
// Turns out that getTranslationUnitDecl one time returns a TranslationUnitDecl* but the other time
// we return one of the parent classes of TranslationUnitDecl (DeclContext).
```
This patch splits up the `void *` API into two where one does the `clang::Type *` tracking and one the `clang::Decl *` mapping.
Type and Decl are disjoint class hierarchies so there is no implicit conversion possible that could influence
the address values.
I had to change the storing of `clang::QualType` opaque pointers to their `clang::Type *` equivalents as
opaque pointers are already `void *` pointers to begin with. We don't seem to ever set any qualifier in any of these
QualTypes to this conversion should be NFC.
Reviewers: labath, shafik, aprantl
Reviewed By: labath
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71409
Kerry McLaughlin [Wed, 11 Dec 2019 14:46:40 +0000 (14:46 +0000)]
Recommit "[AArch64][SVE] Implement intrinsics for non-temporal loads & stores"
Updated pred_load patterns added to AArch64SVEInstrInfo.td by this patch
to use reg + imm non-temporal loads to fix previous test failures.
Original commit message:
Adds the following intrinsics:
- llvm.aarch64.sve.ldnt1
- llvm.aarch64.sve.stnt1
This patch creates masked loads and stores with the
MONonTemporal flag set when used with the intrinsics above.
David Stenberg [Fri, 13 Dec 2019 09:37:53 +0000 (10:37 +0100)]
[LiveDebugValues] Omit entry values for DBG_VALUEs with pre-existing expressions
Summary:
This is a quickfix for PR44275. An assertion that checks that the
DIExpression is valid failed due to attempting to create an entry value
for an indirect parameter. This started appearing after D69028, as the
indirect parameter started being represented using an DW_OP_deref,
rather than with the DBG_VALUE's second operand, meaning that the
isIndirectDebugValue() check in LiveDebugValues did not exclude such
parameters. A DIExpression that has an entry value operation can
currently not have any other operation, leading to the failed isValid()
check.
This patch simply makes us stop considering emitting entry values
for such parameters. To support such cases I think we at least need
to do the following changes:
* In DIExpression::isValid(): Remove the limitation that a
DW_OP_LLVM_entry_value operation can be the only operation in a
DIExpression.
* In LiveDebugValues::emitEntryValues(): Create an entry value of size
1, so that it only wraps the register operand, and not the whole
pre-existing expression (the DW_OP_deref).
* In LiveDebugValues::removeEntryValue(): Check that the new debug
value has the same debug expression as the original, rather than
checking that the debug expression is empty.
* In DwarfExpression::addMachineRegExpression(): Modify the logic so
that a DW_OP_reg* expression is emitted for the entry value.
That is how GCC emits entry values for indirect parameters. That will
currently not happen to due the DW_OP_deref causing the
!HasComplexExpression to fail. The LocationKind needs to be changed
also, rather than always emitting a DW_OP_stack_value for entry values.
There are probably more things I have missed, but that could hopefully
be a good starting point for emitting such entry values.
Reviewers: djtodoro, aprantl, jmorse, vsk
Reviewed By: aprantl, vsk
Subscribers: hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D71416
Kadir Cetinkaya [Fri, 13 Dec 2019 09:29:39 +0000 (10:29 +0100)]
[clangd] Fix windows builds
Pavel Labath [Fri, 13 Dec 2019 09:20:35 +0000 (10:20 +0100)]
[lldb/cmake] Temporarily revive LLDB_DISABLE_CURSES
At least one lldb bot still uses this cmake variable instead of
LLDB_ENABLE_CURSES. Add code to set the default value of the "enable"
variable based on the old value of the "disable" setting.
This should bring those bots back up, until we can update the master to
use the new setting.
Kadir Cetinkaya [Tue, 1 Oct 2019 08:39:14 +0000 (10:39 +0200)]
[clangd] Add "inline" keyword to prevent ODR-violations in DefineInline
Reviewers: ilya-biryukov, hokein
Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68261
Kadir Cetinkaya [Wed, 11 Dec 2019 18:14:15 +0000 (19:14 +0100)]
[clangd] Introduce codeblocks
Summary: Follow-up to the patch D71248
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71414
Kadir Cetinkaya [Tue, 10 Dec 2019 09:28:37 +0000 (10:28 +0100)]
[clangd] Introduce paragraph, the first part of new rendering structs
Summary:
Initial patch for new rendering structs in clangd.
Splitting implementation into smaller chunks, for a full view of the API see D71063.
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71248
Reviewers: sammccall
Georgii Rymar [Thu, 12 Dec 2019 12:47:29 +0000 (15:47 +0300)]
[yaml2obj] - Add a way to override sh_flags section field.
Currently we have the `Flags` property that allows to
set flags for a section. The problem is that it does not
allow us to set an arbitrary value, because of bit fields
validation under the hood. An arbitrary values can be used
to test specific broken cases.
We probably do not want to relax the validation, so this
patch adds a `ShSize` property that allows to
override the `sh_size`. It is inline with others `Sh*` properties
we have already.
Differential revision: https://reviews.llvm.org/D71411
Georgii Rymar [Thu, 12 Dec 2019 14:09:55 +0000 (17:09 +0300)]
[llvm-readobj] - Fix letters used for dumping section types in GNU style.
I've noticed that when we have all regular flags set, we print "WAEXMSILoGTx"
instead of "WAXMSILOGTCE" printed by GNU readelf.
It happens because:
1) We print SHF_EXCLUDE at the wrong place.
2) We do not recognize SHF_COMPRESSED, we print "x" instead of "C".
3) We print "o" instead of "O" for SHF_OS_NONCONFORMING.
This patch fixes differences and adds test cases.
Differential revision: https://reviews.llvm.org/D71418
Craig Topper [Fri, 13 Dec 2019 08:02:41 +0000 (00:02 -0800)]
[LegalizeTypes] Remove unnecessary if before calling ReplaceValueWith on the chain in SoftenFloatRes_LOAD.
I believe this is a leftover from when fp128 was softened to fp128
on X86-64. In that case type legalization must have been able to
create a load that was the same as N which would make this
replacement fail or assert. Since we no longer do that, this
check should be unneeded.
Nikita Popov [Wed, 4 Dec 2019 19:51:31 +0000 (20:51 +0100)]
Reapply [LVI] Normalize pointer behavior
This is a rebase of the change over D70376, which fixes an LVI cache
invalidation issue that also affected this patch.
-----
Related to D69686. As noted there, LVI currently behaves differently
for integer and pointer values: For integers, the block value is always
valid inside the basic block, while for pointers it is only valid at
the end of the basic block. I believe the integer behavior is the
correct one, and CVP relies on it via its getConstantRange() uses.
The reason for the special pointer behavior is that LVI checks whether
a pointer is dereferenced in a given basic block and marks it as
non-null in that case. Of course, this information is valid only after
the dereferencing instruction, or in conservative approximation,
at the end of the block.
This patch changes the treatment of dereferencability: Instead of
including it inside the block value, we instead treat it as something
similar to an assume (it essentially is a non-nullness assume) and
incorporate this information in intersectAssumeOrGuardBlockValueConstantRange()
if the context instruction is the terminator of the basic block.
This happens either when determining an edge-value internally in LVI,
or when a terminator was explicitly passed to getValueAt(). The latter
case makes this change not fully NFC, because we can now fold
terminator icmps based on the dereferencability information in the
same block. This is the reason why I changed one JumpThreading test
(it would optimize the condition away without the change).
Of course, we do not want to recompute dereferencability on each
intersectAssume call, so we need a new cache for this. The
dereferencability analysis requires walking the entire basic block
and computing underlying objects of all memory operands. This was
previously done separately for each queried pointer value. In the
new implementation (both because this makes the caching simpler,
and because it is faster), I instead only walk the full BB once and
cache all the dereferenced pointers. So the traversal is now performed
only once per BB, instead of once per queried pointer value.
I think the overall model now makes more sense than before, and there
will be no more pitfalls due to differing integer/pointer behavior.
Differential Revision: https://reviews.llvm.org/D69914
Muhammad Omair Javaid [Fri, 13 Dec 2019 07:03:29 +0000 (12:03 +0500)]
[lldb] Remove xpasses after pr44037 fix committed
This patch removes xpass decorator from tests which were failing due to
pr44037.
pr44037 was fixed by rev
6ce1a897b6a82e18059fd3b75b8d52ff12c2a605
Rui Ueyama [Fri, 13 Dec 2019 06:17:10 +0000 (15:17 +0900)]