Marshall Clow [Thu, 18 Jan 2018 17:01:34 +0000 (17:01 +0000)]
Use high_resolution_clock instead of steady_clock. Also now builds with gcc 7.2 (for comparison purposes)
llvm-svn: 322864
Marshall Clow [Thu, 18 Jan 2018 16:52:19 +0000 (16:52 +0000)]
A simple program for testing OSS-Fuzz test cases locally.
llvm-svn: 322863
Benjamin Kramer [Thu, 18 Jan 2018 16:23:40 +0000 (16:23 +0000)]
[ADT] Just give up on GCC, I can't fix this.
While the memmove workaround fixed it for GCC 6.3. GCC 4.8 and GCC 7.1
are still broken. I have no clue what's going on, just blacklist GCC for
now.
Needless to say this code is ubsan, asan and msan-clean.
llvm-svn: 322862
Simon Atanasyan [Thu, 18 Jan 2018 15:59:10 +0000 (15:59 +0000)]
[ELF][MIPS] Rename function. NFC
llvm-svn: 322861
Simon Atanasyan [Thu, 18 Jan 2018 15:59:05 +0000 (15:59 +0000)]
[ELF][MIPS] Decompose relocation type for N32 / N64 earlier. NFC
We need to decompose relocation type for N32 / N64 ABI. Let's do it
before any other manipulations with relocation type in the `relocateOne`
routine.
llvm-svn: 322860
Benjamin Kramer [Thu, 18 Jan 2018 15:47:59 +0000 (15:47 +0000)]
[ADT] Add a workaround for GCC miscompiling the trivially copyable Optional
I've seen random crashes with GCC 4.8, GCC 6.3 and GCC 7.3, triggered by
my Optional change. All of them affect a different set of targets. This
change fixes the instance of the problem I'm seeing on my local machine,
let's hope it's good enough for the other instances too.
llvm-svn: 322859
Jonas Hahnfeld [Thu, 18 Jan 2018 15:38:03 +0000 (15:38 +0000)]
[OpenMP] Correct generation of offloading entries
Firstly, each offloading entry must have a unique name or the
linker will complain if there are multiple files with target
regions. Secondly, the compiler must not introduce padding so
mark the struct with a PackedAttr.
Differential Revision: https://reviews.llvm.org/D42168
llvm-svn: 322858
Sam McCall [Thu, 18 Jan 2018 15:31:30 +0000 (15:31 +0000)]
[clangd] Remove unused IncludeGlobals completion option, always pass true to sema
llvm-svn: 322856
Sanjay Patel [Thu, 18 Jan 2018 15:25:32 +0000 (15:25 +0000)]
[TargetLowering] add punctuation for readability; NFC
llvm-svn: 322855
Ilya Biryukov [Thu, 18 Jan 2018 15:17:00 +0000 (15:17 +0000)]
[clangd] Always use preamble (even stale) for code completion
Summary:
This improves performance of code completion, because we avoid stating
the files from the preamble and never attempt to parse the files
without using the preamble if it's provided.
However, the change comes at a cost of sometimes providing incorrect
results when doing code completion after making actually considerable
changes to the files used in the preamble or the preamble itself.
Eventually the preamble will get rebuilt and code completion will
be providing the correct results.
Reviewers: bkramer, sammccall, jkorous-apple
Reviewed By: sammccall
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D41991
llvm-svn: 322854
Ilya Biryukov [Thu, 18 Jan 2018 15:16:53 +0000 (15:16 +0000)]
[Frontend] Allow to use PrecompiledPreamble without calling CanReuse
Summary:
The new method 'OverridePreamble' allows to override the preamble of
any source file without checking if preamble bounds or dependencies
were changed.
This is used for completion in clangd.
Reviewers: bkramer, sammccall
Reviewed By: sammccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D41990
llvm-svn: 322853
Michael Kruse [Thu, 18 Jan 2018 15:15:50 +0000 (15:15 +0000)]
[ScopBuilder] Revise statement naming when there are multiple statements per BB.
The goal is to have -polly-stmt-granularity=bb and
-polly-stmt-granularity=scalar-indep to have the same names if there is
just one statement per basic block.
This fixes a fluke when Polybench's jacobi-2d is optimized differently
depending on the -polly-stmt-granularity option, although both options
create the same SCoP, just with different statement names.
The new naming scheme is:
With -polly-use-llvm-names=0:
Stmt<BBIdx as decimal><Idx within BB as letter>
With -polly-use-llvm-names=1:
Stmt_BBName_<Idx within BB as letter>
The <Idx within BB> suffix is omitted for the main statement of a BB. The
main statement is either the one containing the first store or call
(those cannot be removed by the simplifyer), or if there is no such
instruction, the first. If after simplification there is just a single
statement left, it should be the main statement and have the same names as
with -polly-stmt-granularity=bb.
Differential Revision: https://reviews.llvm.org/D42136
llvm-svn: 322852
Michael Kruse [Thu, 18 Jan 2018 15:15:38 +0000 (15:15 +0000)]
[ScopInfo] Pass name to ScopStmt ctor. NFC.
This will give control of the statement's name to the caller.
Required to give -polly-stmt-granularity=scalar-indep more control
over the name of the generated statement in a follow-up commit.
llvm-svn: 322851
Sam McCall [Thu, 18 Jan 2018 15:02:28 +0000 (15:02 +0000)]
[MachineOutliner] Fix r322788 - don't write to working directory
llvm-svn: 322850
Joel Jones [Thu, 18 Jan 2018 14:57:55 +0000 (14:57 +0000)]
[docs] Make ReleaseProcess.rst 80 column. NFCI
llvm-svn: 322849
Francis Visoiu Mistrih [Thu, 18 Jan 2018 14:52:14 +0000 (14:52 +0000)]
[CodeGen][NFC] Refactor MachineInstr::print
* Handle more cases where the MI is not attached yet
* Add similar asserts like in MIRPrinter::print
llvm-svn: 322848
Benjamin Kramer [Thu, 18 Jan 2018 14:19:04 +0000 (14:19 +0000)]
[HWAsan] Fix uninitialized variable.
Found by msan.
llvm-svn: 322847
Simon Pilgrim [Thu, 18 Jan 2018 13:42:02 +0000 (13:42 +0000)]
[X86] Add PR35918 test case
llvm-svn: 322846
Simon Pilgrim [Thu, 18 Jan 2018 13:28:54 +0000 (13:28 +0000)]
Fix MSVC "uninitialized variable" warning.
llvm-svn: 322845
Klaus Kretzschmar [Thu, 18 Jan 2018 12:58:50 +0000 (12:58 +0000)]
test commit
llvm-svn: 322844
Alex Bradbury [Thu, 18 Jan 2018 12:36:38 +0000 (12:36 +0000)]
[RISCV] Codegen support for the standard RV32M instruction set extension
llvm-svn: 322843
Kamil Rytarowski [Thu, 18 Jan 2018 11:49:45 +0000 (11:49 +0000)]
Enable sanitizer_common tests on NetBSD
Summary:
NetBSD can handle asan, ubsan, msan, tsan tests
on 64-bit and when applicable 32-bit X86 OS.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka
Subscribers: srhines, llvm-commits, kubamracek, mgorny, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42236
llvm-svn: 322842
Kamil Rytarowski [Thu, 18 Jan 2018 11:38:10 +0000 (11:38 +0000)]
Break a line into two lines
This should restore the rule of <=80 characters per line.
llvm-svn: 322841
Alex Bradbury [Thu, 18 Jan 2018 11:34:02 +0000 (11:34 +0000)]
[RISCV] Implement frame pointer elimination
llvm-svn: 322839
Benjamin Kramer [Thu, 18 Jan 2018 11:26:24 +0000 (11:26 +0000)]
[ADT] Split optional to only include copy mechanics and dtor for non-trivial types.
This makes uses of Optional more transparent to the compiler (and
clang-tidy) and generates slightly smaller code.
This is a re-land of r317019, which had issues with GCC 4.8 back then.
Those issues don't reproduce anymore, but I'll watch the buildbots
closely in case anything goes wrong.
llvm-svn: 322838
Kamil Rytarowski [Thu, 18 Jan 2018 11:17:35 +0000 (11:17 +0000)]
Add new NetBSD interceptors: getgrouplist(3) & getgroupmembership(3)
Summary:
getgrouplist, getgroupmembership -- calculate group access list
Sponsored by <The NetBSD Foundation>
Reviewers: vitalybuka, joerg
Reviewed By: vitalybuka
Subscribers: llvm-commits, kubamracek, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42064
llvm-svn: 322836
Pavel Labath [Thu, 18 Jan 2018 11:15:50 +0000 (11:15 +0000)]
Fix logging test on windows
Refactor in r322653 broke the logging test on windows because MSVC uses
a fully qualified name as the value of __FUNCTION__, which is not what
we were expecting. I'm changing the code to use the more portable
__func__, which behaves the same as on clang/gcc.
The standard still says that the value of __func__ is implementation
defined, so if we run into problems with this test again we may just
need to drop it.
llvm-svn: 322834
Kamil Rytarowski [Thu, 18 Jan 2018 11:04:25 +0000 (11:04 +0000)]
Add new interceptors: access(2), faccessat(2)
Summary:
access, faccessat - check access permissions of a file or pathname
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits, kubamracek, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42065
llvm-svn: 322831
Jonas Hahnfeld [Thu, 18 Jan 2018 10:58:43 +0000 (10:58 +0000)]
Add missing headers for Debug builds
llvm-svn: 322830
Kamil Rytarowski [Thu, 18 Jan 2018 10:53:27 +0000 (10:53 +0000)]
Add new interceptors for pwcache(3)-style functions
Summary:
From <pwd.h>: user_from_uid, uid_from_user
From <grp.h>: group_from_gid, gid_from_group
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42068
llvm-svn: 322829
Andrew V. Tischenko [Thu, 18 Jan 2018 10:40:48 +0000 (10:40 +0000)]
A new test to demostrate the current SHLD/SHRD code generation.
llvm-svn: 322828
Sam McCall [Thu, 18 Jan 2018 10:24:01 +0000 (10:24 +0000)]
[clangd] Output log messages to stderr when not configured (e.g. in tests). NFC
llvm-svn: 322827
Haojian Wu [Thu, 18 Jan 2018 09:47:57 +0000 (09:47 +0000)]
[ASTMatcher] Add isScoped matcher for enumDecl.
Summary:
Reviewers: bkramer, aaron.ballman
Subscribers: aaron.ballman, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D42185
llvm-svn: 322826
Alex Bradbury [Thu, 18 Jan 2018 09:41:14 +0000 (09:41 +0000)]
[RISCV][NFC] Add nounwind to functions in div.ll and mul.ll
Committing this separately to minimise irrelevant changes for an upcoming
patch.
llvm-svn: 322825
Sam McCall [Thu, 18 Jan 2018 09:27:56 +0000 (09:27 +0000)]
[clangd] CodeCompleteTests cleanup: naming, ordering, helpers. NFC
llvm-svn: 322824
Sam Parker [Thu, 18 Jan 2018 09:22:24 +0000 (09:22 +0000)]
[SelectionDAG] Convert assert to condtion
Follow-up to r322120 which can cause assertions for AArch64 because
v1f64 and v1i64 are legal types.
Differential Revision: https://reviews.llvm.org/D42097
llvm-svn: 322823
Haojian Wu [Thu, 18 Jan 2018 08:58:18 +0000 (08:58 +0000)]
[clang-tidy] Don't generate fix for argument constructed from std::initializer_list.
Summary:
A follow-up fix of rL311652.
The previous `vector` in our test is different with `std::vector`, so
The check still generates fixes for std::vector (`auto p =
std::unique_ptr<Foo>(new Foo({1,2,3}))`) in real world, the patch makes the
vector behavior in test align with std::vector (both AST nodes are the same now).
Reviewers: ilya-biryukov, alexfh
Reviewed By: ilya-biryukov
Subscribers: klimek, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D41852
llvm-svn: 322822
Sam McCall [Thu, 18 Jan 2018 08:35:04 +0000 (08:35 +0000)]
[clangd] Use fuzzy match to select top N index results.
Summary:
This makes performance slower but more predictable (it always processes
every symbol). We need to find ways to make this fast, possibly by precomputing
short queries or capping the number of scored results. But our current approach
is too naive.
It also no longer returns results in a "good" order. In fact it's pathological:
the top N results are ranked from worst to best. Indexes aren't responsible for
ranking and MergedIndex can't do a good job, so I'm pleased that this will make
any hidden assumptions we have more noticeable :-)
Reviewers: hokein
Subscribers: klimek, ilya-biryukov, cfe-commits
Differential Revision: https://reviews.llvm.org/D42060
llvm-svn: 322821
Craig Topper [Thu, 18 Jan 2018 07:44:09 +0000 (07:44 +0000)]
[X86] Use vmovdqu64/vmovdqa64 for unmasked integer vector stores for consistency with loads.
Previously we used 64 for vXi64 stores and 32 for everything else. This change uses 64 for everything just like do for loads.
llvm-svn: 322820
Craig Topper [Thu, 18 Jan 2018 07:44:06 +0000 (07:44 +0000)]
[X86] Remove isel patterns for using unmasked vmovdqa32/vmovdqu32 for integer vector loads.
These patterns were just looking for a vXi64 bitcasted to vXi32, but there is no advantage to using vmovdqa32 over vmovdqa64.
llvm-svn: 322819
Clement Courbet [Thu, 18 Jan 2018 07:26:34 +0000 (07:26 +0000)]
Revert "Add a value_type to ArrayRef."
clang OOMs on arm.
This reverts commit
a272b2f2ef63f7f602c9ef4d9e10dc4eb9f00aa1.
llvm-svn: 322818
Craig Topper [Thu, 18 Jan 2018 06:47:09 +0000 (06:47 +0000)]
[X86] Remove windows line endings from a test file. NFC
llvm-svn: 322817
Hiroshi Inoue [Thu, 18 Jan 2018 06:13:25 +0000 (06:13 +0000)]
Revert rC322769: [RISCV] Propagate -mabi and -march values to GNU assembler.
Temporarily revert rC322769 due to buildbot failurs.
llvm-svn: 322816
Rafael Espindola [Thu, 18 Jan 2018 05:40:43 +0000 (05:40 +0000)]
Add a lld test for a llvm fix.
This is tested in llvm, but it seems reasonable to have a small
integration test in lld.
llvm-svn: 322815
Rafael Espindola [Thu, 18 Jan 2018 05:38:43 +0000 (05:38 +0000)]
Don't drop dso_local in LTO.
LTO sets dso_local as an optimization, so don't clear it.
This avoid clearing it from undefined hidden symbols, which would then
fail the verifier.
llvm-svn: 322814
Richard Trieu [Thu, 18 Jan 2018 04:28:56 +0000 (04:28 +0000)]
Fix Scope::dump()
The dump function for Scope only has 20 out of the 24 flags. Since it looped
until no flags were left, having an unknown flag lead to an infinite loop.
That loop has been changed to a single pass for each flag, plus an assert to
alert if new flags are added.
llvm-svn: 322813
Eric Fiselier [Thu, 18 Jan 2018 04:23:01 +0000 (04:23 +0000)]
Update Google Benchmark library
llvm-svn: 322812
Craig Topper [Thu, 18 Jan 2018 04:17:06 +0000 (04:17 +0000)]
[DAGCombiner] Add a DAG combine to turn a splat build_vector where the splat elemnt is a bitcast from a vector type into a concat_vector
For example, a build_vector of i64 bitcasted from v2i32 can be turned into a concat_vectors of the v2i32 vectors with a bitcast to a vXi64 type
Differential Revision: https://reviews.llvm.org/D42090
llvm-svn: 322811
Eric Fiselier [Thu, 18 Jan 2018 03:41:06 +0000 (03:41 +0000)]
Fix most GCC test failures.
This patch fixes almost all currently failing tests when
using GCC ToT.
The specific changes are:
(A) Workaround gcc.gnu.org/PR83921 which rejects variables w/o initializers
in constexpr contexts -- even when the variable is an empty class. This
bug has been worked around at all callsites by adding an initializer.
Additionally a new test, constexpr_init.pass.cpp, has been added to
test that Clang doesn't suffer from these bugs.
(B) Fix streambuf.assign/swap.pass.cpp. This test was never actually
calling the swap method as intended. In fact, the swap function it
intended to call was ill-formed when instantiated. GCC diagnosed
this ill-formedness w/o needing an instantiation.
(C) size_delete11.pass.cpp was fixed by adding c++2a to the list of
unsupported dialects.
llvm-svn: 322810
George Karpenkov [Thu, 18 Jan 2018 03:18:36 +0000 (03:18 +0000)]
[analyzer] a few helper methods for getting and comparing symbolic values
API calls should express intent, and that's a motivation behind this patch.
Differential Revision: https://reviews.llvm.org/D42218
llvm-svn: 322809
Rafael Espindola [Thu, 18 Jan 2018 02:08:38 +0000 (02:08 +0000)]
Update for llvm change.
llvm-svn: 322808
Rafael Espindola [Thu, 18 Jan 2018 02:08:32 +0000 (02:08 +0000)]
Update for llvm change.
llvm-svn: 322807
Rafael Espindola [Thu, 18 Jan 2018 02:08:23 +0000 (02:08 +0000)]
Make GlobalValues with non-default visibilility dso_local.
This is similar to r322317, but for visibility. It is not as neat
because we have to special case extern_weak.
The idea is the same as the previous change, make the transition to
explicit dso_local easier for the frontends. With this they only have
to add dso_local to symbols where we need some external information to
decide if it is dso_local (like it being part of an ELF executable).
llvm-svn: 322806
Justin Bogner [Thu, 18 Jan 2018 02:06:56 +0000 (02:06 +0000)]
GlobalISel: Make MachineCSE runnable in the middle of the GlobalISel
Right now, it is not possible to run MachineCSE in the middle of the
GlobalISel pipeline. Being able to run generic optimizations between the
core passes of GlobalISel was one of the goals of the new ISel framework.
This is the first attempt to do it.
The problem is that MachineCSE pass assumes all register operands have a
register class, which, in GlobalISel context, won't be true until after the
InstructionSelect pass. The reason for this behaviour is that before
replacing one virtual register with another, MachineCSE pass (and most of
the other optimization machine passes) must check if the virtual registers'
constraints have a (sufficiently large) intersection, and constrain the
resulting register appropriately if such intersection exists.
GlobalISel extends the representation of such constraints from just a
register class to a triple (low-level type, register bank, register
class).
This commit adds MachineRegisterInfo::constrainRegAttrs method that extends
MachineRegisterInfo::constrainRegClass to such a triple.
The idea is that going forward we should use:
- RegisterBankInfo::constrainGenericRegister within GlobalISel's
InstructionSelect pass
- MachineRegisterInfo::constrainRegClass within SelectionDAG ISel
- MachineRegisterInfo::constrainRegAttrs everywhere else regardless
the target and instruction selector it uses.
Patch by Roman Tereshin. Thanks!
llvm-svn: 322805
Artem Dergachev [Thu, 18 Jan 2018 01:40:31 +0000 (01:40 +0000)]
[analyzer] NFC: Remove unused method - BugReporter::RemoveUnneededCalls().
Patch by Henry Wong!
Differential Revision: https://reviews.llvm.org/D42106
llvm-svn: 322804
Vedant Kumar [Thu, 18 Jan 2018 01:16:30 +0000 (01:16 +0000)]
[CMake] Make check-lldb work with LLDB_CODESIGN_IDENTITY=''
On Darwin, if a test machine isn't set up for code-signing (see
docs/code-signing.txt), running check-lldb should use the system
debugserver instead of the unsigned one built in-tree. This makes it
possible to run lldb's test suite without having code-signing set up,
which is really convenient.
Differential Revision: https://reviews.llvm.org/D42215
llvm-svn: 322803
Derek Schuff [Thu, 18 Jan 2018 01:15:45 +0000 (01:15 +0000)]
[WebAssembly] Remove duplicated RTLIB names
Remove the tight coupling between llvm/CodeGenRuntimeLibcalls.def and
the table of supported singatures for wasm. This will allow adding new libcalls
without changing wasm's signature table.
Also, some cleanup:
Use ManagedStatics instead of const tables to avoid memory/binary bloat.
Use a StringMap instead of a linear search for name lookup.
Differential Revision: https://reviews.llvm.org/D35592
llvm-svn: 322802
Rafael Espindola [Thu, 18 Jan 2018 01:14:57 +0000 (01:14 +0000)]
Handle parsing AT(ADDR(.foo-bar)).
The problem we had with it is that anything inside an AT is an
expression, so we failed to parse the section name because of the - in
it.
llvm-svn: 322801
Volkan Keles [Thu, 18 Jan 2018 01:10:30 +0000 (01:10 +0000)]
Fix the failure caused by r322773
Do not run GlobalISel if `-fast-isel=0 -global-isel=false`.
llvm-svn: 322800
Artem Dergachev [Thu, 18 Jan 2018 01:01:56 +0000 (01:01 +0000)]
[analyzer] NFC: RetainCount: Protect from dumping raw region to path notes.
MemRegion::getString() is a wrapper around MemRegion::dump(), which is not
user-friendly and should never be used for diagnostic messages.
Actual cases where raw dumps were reaching the user were unintentionally fixed
in r315736; these were noticed accidentally and shouldn't be reproducible
anymore. For now RetainCountChecker only tracks pointers through variable
regions, and for those dumps are "fine". However, we should still use a less
dangerous method for producing our path notes.
This patch replaces the dump with printing a variable name, asserting that this
is indeed a variable.
Differential Revision: https://reviews.llvm.org/D42015
llvm-svn: 322799
Artem Dergachev [Thu, 18 Jan 2018 00:55:29 +0000 (00:55 +0000)]
[analyzer] NFC: Use "= default" for default ProgramPoint constructors.
Differential Revision: https://reviews.llvm.org/D41935
llvm-svn: 322798
Artem Dergachev [Thu, 18 Jan 2018 00:53:50 +0000 (00:53 +0000)]
[analyzer] operator new: Fix callback order for CXXNewExpr.
PreStmt<CXXNewExpr> was never called.
Additionally, under c++-allocator-inlining=true, PostStmt<CXXNewExpr> was
called twice when the allocator was inlined: once after evaluating the
new-expression itself, once after evaluating the allocator call which, for the
lack of better options, uses the new-expression as the call site.
This patch fixes both problems.
Differential Revision: https://reviews.llvm.org/D41934
rdar://problem/
12180598
llvm-svn: 322797
Artem Dergachev [Thu, 18 Jan 2018 00:50:19 +0000 (00:50 +0000)]
[analyzer] operator new: Add a new ProgramPoint for check::NewAllocator.
Add PostAllocatorCall program point to represent the moment in the analysis
between the operator new() call and the constructor call. Pointer cast from
"void *" to the correct object pointer type has already happened by this point.
The new program point, unlike the previously used PostImplicitCall, contains a
reference to the new-expression, which allows adding path diagnostics over it.
Differential Revision: https://reviews.llvm.org/D41800
rdar://problem/
12180598
llvm-svn: 322796
Artem Dergachev [Thu, 18 Jan 2018 00:44:41 +0000 (00:44 +0000)]
[analyzer] Suppress "this" pointer escape during construction.
Pointer escape event notifies checkers that a pointer can no longer be reliably
tracked by the analyzer. For example, if a pointer is passed into a function
that has no body available, or written into a global, MallocChecker would
no longer report memory leaks for such pointer.
In case of operator new() under -analyzer-config c++-allocator-inlining=true,
MallocChecker would start tracking the pointer allocated by operator new()
only to immediately meet a pointer escape event notifying the checker that the
pointer has escaped into a constructor (assuming that the body of the
constructor is not available) and immediately stop tracking it. Even though
it is theoretically possible for such constructor to put "this" into
a global container that would later be freed, we prefer to preserve the old
behavior of MallocChecker, i.e. a memory leak warning, in order to
be able to find any memory leaks in C++ at all. In fact, c++-allocator-inlining
*reduces* the amount of false positives coming from this-pointers escaping in
constructors, because it'd be able to inline constructors in some cases.
With other checkers working similarly, we simply suppress the escape event for
this-value of the constructor, regardless of analyzer options.
Differential Revision: https://reviews.llvm.org/D41797
rdar://problem/
12180598
llvm-svn: 322795
Peter Collingbourne [Thu, 18 Jan 2018 00:33:35 +0000 (00:33 +0000)]
libcxx: Define set_unexpected, _get_unexpected and __uncaught_exceptions without dllimport.
It turns out that the MSVC headers define these functions without
dllimport even when compiling with /MD. This change fixes the resulting
compile-time error.
Differential Revision: https://reviews.llvm.org/D42207
llvm-svn: 322794
Alex Shlyapnikov [Thu, 18 Jan 2018 00:23:46 +0000 (00:23 +0000)]
[Sanitizers] Changes in Hwasan allocator missed in D42198.
Converting a few failure handler calls missed in D42198.
llvm-svn: 322793
Rafael Espindola [Thu, 18 Jan 2018 00:20:03 +0000 (00:20 +0000)]
Use an enum value instead of a string.
The old StringSwitch use was also broken. It assumed that a
StringSwitch returns Optional<T> instead of T and was missing a
.Default.
llvm-svn: 322792
Artem Dergachev [Thu, 18 Jan 2018 00:10:21 +0000 (00:10 +0000)]
[analyzer] operator new: Fix path diagnostics around the operator call.
Implements finding appropriate source locations for intermediate diagnostic
pieces in path-sensitive bug reports that need to descend into an inlined
operator new() call that was called via new-expression. The diagnostics have
worked correctly when operator new() was called "directly".
Differential Revision: https://reviews.llvm.org/D41409
rdar://problem/
12180598
llvm-svn: 322791
Artem Dergachev [Thu, 18 Jan 2018 00:03:43 +0000 (00:03 +0000)]
[analyzer] NFC: operator new: Fix new(nothrow) definition in tests.
Fix the const qualifier so that the operator defined in the tests indeed does
override the default global nothrow version of new.
Differential Revision: https://reviews.llvm.org/D41408
llvm-svn: 322790
Jessica Paquette [Thu, 18 Jan 2018 00:00:58 +0000 (00:00 +0000)]
[MachineOutliner] Add DISubprograms to outlined functions.
Before, it wasn't possible to get backtraces inside outlined functions. This
commit adds DISubprograms to the IR functions created by the outliner which
makes this possible. Also attached a test that ensures that the produced
debug information is correct. This is useful to users that want to debug
outlined code.
llvm-svn: 322789
Reid Kleckner [Wed, 17 Jan 2018 23:55:23 +0000 (23:55 +0000)]
[CodeGen] Hoist common AsmPrinter code out of X86, ARM, and AArch64
Every known PE COFF target emits /EXPORT: linker flags into a .drective
section. The AsmPrinter should handle this.
While we're at it, use global_values() and emit each export flag with
its own .ascii directive. This should make the .s file output more
readable.
llvm-svn: 322788
Artem Dergachev [Wed, 17 Jan 2018 23:46:13 +0000 (23:46 +0000)]
[analyzer] operator new: Add a new checker callback, check::NewAllocator.
The callback runs after operator new() and before the construction and allows
the checker to access the casted return value of operator new() (in the
sense of r322780) which is not available in the PostCall callback for the
allocator call.
Update MallocChecker to use the new callback instead of PostStmt<CXXNewExpr>,
which gets called after the constructor.
Differential Revision: https://reviews.llvm.org/D41406
rdar://problem/
12180598
llvm-svn: 322787
Florian Hahn [Wed, 17 Jan 2018 23:29:25 +0000 (23:29 +0000)]
[LangRef] Clarify Varargs forwarding for musttail calls.
This clarification was suggested by @efriedma in D41335, which uses this
behavior to inline musttail calls with varargs.
Reviewers: hfinkel, efriedma, rnk
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D41861
llvm-svn: 322786
Evgeniy Stepanov [Wed, 17 Jan 2018 23:24:38 +0000 (23:24 +0000)]
[hwasan] LLVM-level flags for linux kernel-compatible hwasan instrumentation.
Summary:
-hwasan-mapping-offset defines the non-zero shadow base address.
-hwasan-kernel disables calls to __hwasan_init in module constructors.
Unlike ASan, -hwasan-kernel does not force callback instrumentation.
This is controlled separately with -hwasan-instrument-with-calls.
Reviewers: kcc
Subscribers: srhines, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D42141
llvm-svn: 322785
Alex Shlyapnikov [Wed, 17 Jan 2018 23:20:36 +0000 (23:20 +0000)]
[Sanitizers] Make common allocator agnostic to failure handling modes.
Summary:
Make common allocator agnostic to failure handling modes and move the
decision up to the particular sanitizer's allocator, where the context
is available (call stack, parameters, return nullptr/crash mode etc.)
It simplifies the common allocator and allows the particular sanitizer's
allocator to generate more specific and detailed error reports (which
will be implemented later).
The behavior is largely the same, except one case, the violation of the
common allocator's check for "size + alignment" overflow is now reportied
as OOM instead of "bad request". It feels like a worthy tradeoff and
"size + alignment" is huge in this case anyway (thus, can be interpreted
as not enough memory to satisfy the request). There's also a Report()
statement added there.
Reviewers: eugenis
Subscribers: kubamracek, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D42198
llvm-svn: 322784
Benjamin Kramer [Wed, 17 Jan 2018 23:14:49 +0000 (23:14 +0000)]
[ASTMatchers] Support generating docs for single-line matchers
clang-format likes this format. PR35989.
llvm-svn: 322783
Kostya Kortchinsky [Wed, 17 Jan 2018 23:10:02 +0000 (23:10 +0000)]
[scudo] Fix for the Scudo interface function scope
Summary:
A forgotten include in `scudo_allocator.cpp` made the symbol only local :/
Before:
```
nm ./lib/clang/7.0.0/lib/linux/libclang_rt.scudo-i686-android.so | grep rss
00024730 t __scudo_set_rss_limit
```
After:
```
nm ./lib/clang/7.0.0/lib/linux/libclang_rt.scudo-i686-android.so | grep rs
00024760 T __scudo_set_rss_limit
```
And we want `T`!
This include also means that we can get rid of the `extern "C"` in the C++
file, the compiler does fine without it (note that this was already the case
for all the `__sanitizer_*` interface functions.
Reviewers: alekseyshl, eugenis
Reviewed By: eugenis
Subscribers: #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D42199
llvm-svn: 322782
Artem Dergachev [Wed, 17 Jan 2018 23:03:25 +0000 (23:03 +0000)]
[analyzer] operator new: Fix ambigious type name.
Hopefully fixes an MSVC buildbot failure.
llvm-svn: 322781
Artem Dergachev [Wed, 17 Jan 2018 22:58:35 +0000 (22:58 +0000)]
[analyzer] operator new: Fix memory space for the returned region.
Make sure that with c++-allocator-inlining=true we have the return value of
conservatively evaluated operator new() in the correct memory space (heap).
This is a regression/omission that worked well in c++-allocator-inlining=false.
Heap regions are superior to regular symbolic regions because they have
stricter aliasing constraints: heap regions do not alias each other or global
variables.
Differential Revision: https://reviews.llvm.org/D41266
rdar://problem/
12180598
llvm-svn: 322780
Benjamin Kramer [Wed, 17 Jan 2018 22:56:57 +0000 (22:56 +0000)]
[Sema] Allow conversion between long double and __float128.
We should only ban this if long double is a double double. x86's 80 bit
long double is fine and supported by the backend.
llvm-svn: 322779
Douglas Yung [Wed, 17 Jan 2018 22:53:15 +0000 (22:53 +0000)]
[DOXYGEN] Fix doxygen and content issues in xmmintrin.h
- Fix inaccurate instruction listings.
- Fix small issues in _mm_getcsr and _mm_setcsr.
- Fix description of NaN handling in comparison intrinsics.
- Fix inaccurate description of _mm_movemask_pi8.
- Fix inaccurate instruction mappings.
- Fix typos.
- Clarify wording on some descriptions.
- Fix bit ranges in return value.
- Fix typo in _mm_move_ms intrinsic instruction since it operates on singe-precision values, not double.
- This patch was made by Craig Flores
Differential Revision: https://reviews.llvm.org/D41523
llvm-svn: 322778
Artem Dergachev [Wed, 17 Jan 2018 22:51:19 +0000 (22:51 +0000)]
[analyzer] operator new: Model the cast of returned pointer into object type.
According to [basic.stc.dynamic.allocation], the return type of any C++
overloaded operator new() is "void *". However, type of the new-expression
"new T()" and the type of "this" during construction of "T" are both "T *".
Hence an implicit cast, which is not present in the AST, needs to be performed
before the construction. This patch adds such cast in the case when the
allocator was indeed inlined. For now, in the case where the allocator was *not*
inlined we still use the same symbolic value (which is a pure SymbolicRegion of
type "T *") because it is consistent with how we represent the casts and causes
less surprise in the checkers after switching to the new behavior.
The better approach would be to represent that value as a cast over a
SymbolicRegion of type "void *", however we have technical difficulties
conjuring such region without any actual expression of type "void *" present in
the AST.
Differential Revision: https://reviews.llvm.org/D41250
rdar://problem/
12180598
llvm-svn: 322777
Eric Fiselier [Wed, 17 Jan 2018 22:48:09 +0000 (22:48 +0000)]
Fix nodiscard failure tests on compilers w/o -verify.
Previously .fail.cpp tests for nodiscard were run with -Wunused-result
being a warning, not an error, when the compiler didn't support -verify.
When -verify isn't enabled this change judiciously adds -Werror=unused-result
when to only the failure tests containing the // expected-error string for nodiscard.
As a drive-by change, this patch also adds a missing // UNSUPPORTED: c++2a to
a test which was only supposed to run in C++ <= 11.
llvm-svn: 322776
Artem Dergachev [Wed, 17 Jan 2018 22:40:36 +0000 (22:40 +0000)]
[analyzer] NFC: Forbid array elements of void type.
Represent the symbolic value for results of pointer arithmetic on void pointers
in a different way: instead of making void-typed element regions, make
char-typed element regions.
Add an assertion that ensures that no void-typed regions are ever constructed.
This is a refactoring of internals that should not immediately affect
the analyzer's (default) behavior.
Differential Revision: https://reviews.llvm.org/D40939
llvm-svn: 322775
Artem Dergachev [Wed, 17 Jan 2018 22:34:23 +0000 (22:34 +0000)]
[analyzer] operator new: Use the correct region for the constructor.
The -analyzer-config c++-allocator-inlining experimental option allows the
analyzer to reason about C++ operator new() similarly to how it reasons about
regular functions. In this mode, operator new() is correctly called before the
construction of an object, with the help of a special CFG element.
However, the subsequent construction of the object was still not performed into
the region of memory returned by operator new(). The patch fixes it.
Passing the value from operator new() to the constructor and then to the
new-expression itself was tricky because operator new() has no call site of its
own in the AST. The new expression itself is not a good call site because it
has an incorrect type (operator new() returns 'void *', while the new expression
is a pointer to the allocated object type). Additionally, lifetime of the new
expression in the environment makes it unsuitable for passing the value.
For that reason, an additional program state trait is introduced to keep track
of the return value.
Finally this patch relaxes restrictions on the memory region class that are
required for inlining the constructor. This change affects the old mode as well
(c++-allocator-inlining=false) and seems safe because these restrictions were
an overkill compared to the actual problems observed.
Differential Revision: https://reviews.llvm.org/D40560
rdar://problem/
12180598
llvm-svn: 322774
Volkan Keles [Wed, 17 Jan 2018 22:34:21 +0000 (22:34 +0000)]
Add a TargetOption to enable/disable GlobalISel
Summary:
This patch adds a new target option in order to control GlobalISel.
This will allow the users to enable/disable GlobalISel prior to the
backend by calling `TargetMachine::setGlobalISel(bool Enable)`.
No test case as there is already a test to check GlobalISel
command line options.
See: CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll.
Reviewers: qcolombet, aemerson, ab, dsanders
Reviewed By: qcolombet
Subscribers: rovka, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D42137
llvm-svn: 322773
Benjamin Kramer [Wed, 17 Jan 2018 22:29:16 +0000 (22:29 +0000)]
Add support for emitting libcalls for x86_fp80 -> fp128 and vice-versa
compiler_rt doesn't provide them (yet), but libgcc does. PR34076.
llvm-svn: 322772
Easwaran Raman [Wed, 17 Jan 2018 22:24:23 +0000 (22:24 +0000)]
Add a ProfileCount class to represent entry counts.
Summary:
The class wraps a uint64_t and an enum to represent the type of profile
count (real and synthetic) with some helper methods.
Reviewers: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41883
llvm-svn: 322771
Simon Pilgrim [Wed, 17 Jan 2018 22:19:31 +0000 (22:19 +0000)]
[X86][MMX] Add PR35982 test cases
FEMMS has the same problem as EMMS
llvm-svn: 322770
Ana Pazos [Wed, 17 Jan 2018 22:09:58 +0000 (22:09 +0000)]
[RISCV] Propagate -mabi and -march values to GNU assembler.
When using -fno-integrated-as flag, the gnu assembler produces code
with some default march/mabi which later causes linker failure due
to incompatible mabi/march.
In this patch we explicitly propagate -mabi and -march flags to the
GNU assembler.
In this patch we explicitly propagate -mabi and -march flags to the GNU assembler.
Differential Revision: https://reviews.llvm.org/D41271
llvm-svn: 322769
Eric Fiselier [Wed, 17 Jan 2018 22:07:09 +0000 (22:07 +0000)]
Fix standalone test-suite run.
This patch updates libc++abi's HandleOutOfTreeLLVM.cmake to match
libc++'s -- and more importantly, to fix a bug where llvm-lit wasn't
found/created when libc++abi was built out-of-tree. This prevented
the test suite from running.
llvm-svn: 322768
Eli Friedman [Wed, 17 Jan 2018 22:04:36 +0000 (22:04 +0000)]
[LegalizeDAG] Fix ATOMIC_CMP_SWAP_WITH_SUCCESS legalization.
The code wasn't zero-extending correctly, so the comparison could
spuriously fail.
Adds some AArch64 tests to cover this case.
Inspired by D41791.
Differential Revision: https://reviews.llvm.org/D41798
llvm-svn: 322767
Eli Friedman [Wed, 17 Jan 2018 21:59:02 +0000 (21:59 +0000)]
[polly] [ScopInfo] Don't use isl_val_get_num_si.
isl_val_get_num_si crashes on overflow, so don't use it on arbitrary
integers.
Testcase only crashes on platforms where long is 32 bits because of the
signature of isl_val_get_num_si; not sure if it's possible to write a
testcase which crashes if long is 64 bits.
There are a few other places in polly which use isl_val_get_num_si;
they probably need to be fixed as well. I don't think polly uses any
of the other "long" isl APIs in an unsafe manner.
Differential Revision: https://reviews.llvm.org/D42129
llvm-svn: 322766
Javed Absar [Wed, 17 Jan 2018 21:58:35 +0000 (21:58 +0000)]
[SCEV] Fix typo. NFC.
Fix confusing typo in comment.
llvm-svn: 322765
Kostya Kortchinsky [Wed, 17 Jan 2018 21:54:48 +0000 (21:54 +0000)]
[scudo] Limit by default the TSD pool to 2 on Android
Summary:
jemalloc on Android currently uses 2 arenas
(https://android.googlesource.com/platform/external/jemalloc/+/master/Android.bp#64).
Since the Android toolchain absorbs compiler-rt and compiles it as is, we have
to enforce the same limit to somehow stay competitive in terms of memory usage.
The changes could either go in:
- `scudo_platform.h` with a default for Android of 2 (this is the solution
implemented here);
- in `CMakeLists.txt` adding -DSCUDO_SHARED_TSD_POOL_SIZE=2 for Android.
- something else?
I don't have a strong opinion on how to do it, but it has to be done upstream
anyway.
Reviewers: alekseyshl, eugenis
Reviewed By: alekseyshl, eugenis
Subscribers: srhines, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D42194
llvm-svn: 322764
Jan Vesely [Wed, 17 Jan 2018 21:22:14 +0000 (21:22 +0000)]
rootn: Port from amd_builtins
Passes piglit on turks and carrizo
fp64 passes ctx on carrizo
v2: fix formatting
check fp32 denormal support at runtime
Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 322763
Jan Vesely [Wed, 17 Jan 2018 21:22:06 +0000 (21:22 +0000)]
powr: Port from amd_builtins
Passes piglit on turks and carrizo
fp64 passes cts on carrizo
v2: fix formatting
check fp32 denormal support at runtime
Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 322762
Jan Vesely [Wed, 17 Jan 2018 21:22:03 +0000 (21:22 +0000)]
pown: Port from amd_builtins
Passes piglit on turks and carrizo
fp64 passes CTS on carrizo
v2: fix formatting
check fp32 denormal support at runtime
Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 322761
Jan Vesely [Wed, 17 Jan 2018 21:21:35 +0000 (21:21 +0000)]
pow: Port from amd_builtins
Passes piglit on turks and carrizo
fp64 passes CTS on carrizo
v2: fix formatting
check fp32 denormal support at runtime
Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 322760
Julie Hockett [Wed, 17 Jan 2018 21:18:15 +0000 (21:18 +0000)]
[clang-tidy] Adding Fuchsia checker for trailing returns
Adds a check to the Fuchsia module to warn if a function has a trailing
return.
See https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md for
reference.
Differential Revision: https://reviews.llvm.org/D42116
llvm-svn: 322759