Commit Graph

279252 Commits

Author SHA1 Message Date
Joachim Protze 9c9b61df7e [OMPT] Fix failing test cases for gcc on Ubuntu
The compiler warns that _BSD_SOURCE is deprecated and _DEFAULT_SOURCE should
be used instead. We keep _BSD_SOURCE for older compilers, that don't know
about _DEFAULT_SOURCE.

The linker drops the tool when linking, since there is no visible need for
the library. So we need to tell the linker, that the tool should be linked
anyway.

Differential Revision: https://reviews.llvm.org/D41499

llvm-svn: 321362
2017-12-22 16:40:32 +00:00
Joachim Protze 25aa3ec1c5 Remove unused positional argument for printf
The format string for hints only prints the second argument (string) and drops
the first argument (hint id). Depending on how you read the POSIX text for
printf, this could be valid. But for practical reason, i.e., unpacking the
va_list passed to printf based on the formating information, it makes sense
to fix the implementation and not pass the id for hint.

Failing testcases were:

misc_bugs/teams-reduction.c
ompt/parallel/not_enough_threads.c

Differential Revision: https://reviews.llvm.org/D41504

llvm-svn: 321361
2017-12-22 16:40:26 +00:00
Serge Pavlov ccdac23ab2 Unit tests for TBAA metadata generation.
Now tests for metadata created by clang involve compiling code snippets
placed into c/c++ source files and matching interesting patterns in the
obtained textual representation of IR. Writting such tests is a painful
process as metadata often form complex tree-like structures but textual
representation of IR contains only a pile of metadata at the module end.

This change implements IR matchers that may be used to match required
patterns in the binary IR representation. In this case the metadata
structure is not broken and creation of match patterns is easier.

The change adds unit tests for TBAA metadata generation.

Differential Revision: https://reviews.llvm.org/D41433

llvm-svn: 321360
2017-12-22 15:22:45 +00:00
Dmitry Preobrazhensky 2713495318 [AMDGPU][MC] Added support of 256- and 512-bit tuples of ttmp registers
See bug 35561: https://bugs.llvm.org/show_bug.cgi?id=35561

This patch also affects implementation of SGPR and VGPR registers though changes are cosmetic.

Reviewers: artem.tamazov, arsenm

Differential Revision: https://reviews.llvm.org/D41437

llvm-svn: 321359
2017-12-22 15:18:06 +00:00
Haojian Wu 7f880c1850 [clangd] Add a tool to build YAML-format global symbols.
Summary:
The tools is used to generate global symbols for clangd (global code completion),
The format is YAML, which is only for **experiment**.

Usage:
./bin/global-symbol-builder </path/to/llvm-dir> > global-symbols.yaml

TEST:
used the tool to generate global symbols for LLVM (~72MB).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits

Differential Revision: https://reviews.llvm.org/D41491

llvm-svn: 321358
2017-12-22 14:38:05 +00:00
Simon Atanasyan 5cd90ccbe3 [mips] Add test case to check that calls to mcount follow long calls / short calls options. NFC
llvm-svn: 321357
2017-12-22 13:45:46 +00:00
Diana Picus 28a6d0e639 [ARM GlobalISel] Support G_INTTOPTR and G_PTRTOINT for s32
Mark conversions between pointers and 32-bit scalars as legal, map them
to the GPR and select to a simple COPY.

llvm-svn: 321356
2017-12-22 13:05:51 +00:00
Pavel Labath deb45f2043 debugserver: Propagate environment in launch-mode (pr35671)
Summary:
Make sure we propagate environment when starting debugserver with a pre-loaded
inferior. AFAIK, RNBRunLoopLaunchInferior is only called in pre-loaded inferior
scenario, so we can just pick up the debugserver environment instead of trying
to construct an envp from the (empty) context.

This makes debugserver pass an test added for an equivalent lldb-server fix.

Reviewers: jasonmolenda, clayborg

Subscribers: JDevlieghere, lldb-commits

Differential Revision: https://reviews.llvm.org/D41352

llvm-svn: 321355
2017-12-22 11:09:21 +00:00
Diana Picus 68773859c8 [ARM GlobalISel] Support pointer constants
Pointer constants are pretty rare, since we usually represent them as
integer constants and then cast to pointer. One notable exception is the
null pointer constant, which is represented directly as a G_CONSTANT 0
with pointer type. Mark it as legal and make sure it is selected like
any other integer constant.

llvm-svn: 321354
2017-12-22 11:09:18 +00:00
Pavel Labath b8318155eb Enable TestReadMemCString on non-darwin targets
The test works fine on linux, and I believe other targets should not
have an issue with as well. If they do, we can start blacklisting
instead of whitelisting.

The idea of using "-1" as the value of the pointer on non-apple targets
backfired, as it fails the "address != LLDB_INVALID_ADDRESS" test (-1 is
the value of LLDB_INVALID_ADDRESS).  However, it should be safe to use
0x100 for other targets as well. The first page of memory is generally
kept unreadable to catch null pointer dereferences.

llvm-svn: 321353
2017-12-22 10:26:59 +00:00
Ivan A. Kosarev 57493e2919 [CodeGen] Represent array members in new-format TBAA type descriptors
Now that in the new TBAA format we allow access types to be of
any object types, including aggregate ones, it becomes critical
to specify types of all sub-objects such aggregates comprise as
their members. In order to meet this requirement, this patch
enables generation of field descriptors for members of array
types.

Differential Revision: https://reviews.llvm.org/D41399

llvm-svn: 321352
2017-12-22 09:57:24 +00:00
Ivan A. Kosarev d50b847ac8 [CodeGen] Support generation of TBAA info in the new format
Now that the MDBuilder helpers generating TBAA type and access
descriptors in the new format are in place, we can teach clang to
use them when requested.

Differential Revision: https://reviews.llvm.org/D41394

llvm-svn: 321351
2017-12-22 09:54:23 +00:00
Sam McCall c02ba7270e [clangd] Simplify GlobalCompilationDatabase, cache missing GCDs
llvm-svn: 321350
2017-12-22 09:47:34 +00:00
Sam Parker cf426fccd4 [DAGCombine] Revert r321259
Improve ReduceLoadWidth for SRL Patch is causing an issue on the
PPC64 BE santizer.

llvm-svn: 321349
2017-12-22 08:36:25 +00:00
Sam McCall 98a7318113 [clangd] Improve packing of Symbol struct. NFC
llvm-svn: 321348
2017-12-22 08:12:39 +00:00
Sam McCall 1371cba56f Fix unused variable warning in SemaTemplate. NFC
llvm-svn: 321346
2017-12-22 07:09:51 +00:00
Chandler Carruth 54a5ad3681 Rewrite the cached map used for locating the most precise DIE among
inlined subroutines for a given address.

This is essentially the hot path of llvm-symbolizer when extracting
inlined frames during symbolization. Previously, we would read every
subprogram and every inlined subroutine, building a std::map across the
entire PC space to the best DIE, and then do only a handful of queries
as we symbolized a backtrace. A huge fraction of the time was spent
building the map itself.

This patch changes it two a two-level system. First, we just build a map
from PC-interval to DWARF subprograms. These are required to be disjoint
and so constructing this is pretty easy. Second, we build a map *just*
for the inlined subroutines within the subprogram containing the query
address. This allows us to look at far fewer DIEs and build a *much*
smaller set of cached maps in the llvm-symbolizer case where only a few
address get symbolized during the entire run.

It also builds both interval maps in a very different way. It constructs
a single flat vector of pairs that maps from offset -> index. The
indices point into collections of DIE objects, but can also be
"tombstones" (-1) to mark gaps. In the case of subprograms, this mostly
just simplifies the data structure a bit. For inlined subroutines,
because we carefully split them as we build the map, we end up in many
cases having no holes and not having to store both start and stop
offsets.

Finally, the PC ranges for the inlined subroutines are compressed into
32-bits by making them relative to the base PC of the outer subprogram.
This means that if you have a single function body with over 2gb of
executable code in it, we will stop mapping address past the first 2gb
of that function into inlined subroutines and just give you the
subprogram. This doesn't seem like a problem. ;]

All of this combines to make llvm-symbolizer *well* over 2x faster for
symbolizing backtraces out of LLVM's unittests. Death-test heavy unit
tests are running >2x faster. I'm still going to look at completely
disabling symbolization there, but figured while I had a good benchmark
we should make symbolization a bit better.

Sadly, the logic to build the flat interval map for the inlined
subroutines is fairly complex. I'm not super happy about this and
welcome any simplifying suggestions.

Huge thanks to Dave Blaikie who helped walk me through what the various
things I needed to do in DWARF to make this work.

Differential Revision: https://reviews.llvm.org/D40987

llvm-svn: 321345
2017-12-22 06:41:23 +00:00
Aaron Smith 86e9434db9 [lldb] Stop searching for a symbol in a pdb by regex
Summary:
It was possible when searching for a symbol by regex in a pdb that an invalid regex would cause an exception on Windows. This updates the code to avoid throwing an exception.

When fixing the exception it was decided there is no reason to search for a symbol in a pdb by regex. To support this, SymbolFilePDB::FindTypes() now only searches for types by name and no longer calls FindTypesByRegEx().

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: clayborg

Differential Revision: https://reviews.llvm.org/D41086

llvm-svn: 321344
2017-12-22 05:26:50 +00:00
Craig Topper 921aff6e90 [X86] Add missing check lines for the silvermont cases in predefined-arch-macros.c test.
llvm-svn: 321343
2017-12-22 05:09:38 +00:00
Bruno Cardoso Lopes 84bc0a271d [Modules] Map missing private submodules from Foo.Private to Foo_Private
In case `@import Foo.Private` fails because the submodule doesn't exist,
look for `Foo_Private` (if available) and build/load that module
instead. In that process emit a warning and tell the user about the
assumption.

The intention here is to assist all existing private modules owners
(in ObjC and Swift) to migrate to the new `Foo_Private` syntax.

rdar://problem/36023940

llvm-svn: 321342
2017-12-22 05:04:43 +00:00
Craig Topper 66b110edce [X86] Add 'prfchw' to the correct CPUs to match the backend.
llvm-svn: 321341
2017-12-22 04:51:00 +00:00
Craig Topper e2873a17d7 [X86] Add missing initialization for the HasPREFETCHWT1 subtarget variable.
llvm-svn: 321340
2017-12-22 03:53:14 +00:00
Faisal Vali a223d1c856 Diagnose the various invalid decl-specifiers on nontype template parameters.
The standard correctly forbids various decl-specifiers that dont make sense on non-type template parameters - such as the extern in:
    template<extern int> struct X;

This patch implements those restrictions (in a fashion similar to the corresponding checks on function parameters within ActOnParamDeclarator).

Credit goes to miyuki (Mikhail Maltsev) for drawing attention to this issue,  authoring the initial versions of this patch, and supporting the effort to re-engineer it slightly.  Thank you!

For details of how this patch evolved please see: https://reviews.llvm.org/D40705

llvm-svn: 321339
2017-12-22 03:50:55 +00:00
Jason Molenda 16b386de15 Change SBProcess::ReadCStringFromMemory() back to returning
an empty Python string object when it reads a 0-length 
string out of memory (and a successful SBError object).

<rdar://problem/26186692> 

llvm-svn: 321338
2017-12-22 03:27:02 +00:00
Bruno Cardoso Lopes 2972991969 [Modules] Change private modules rules and warnings
We used to advertise private modules to be declared as submodules
(Foo.Private). This has proven to not scale well since private headers
might carry several dependencies, introducing unwanted content into the
main module and often causing dep cycles.

Change the canonical way to name it to Foo_Private, forcing private
modules as top level ones, and provide warnings under -Wprivate-module
to suggest fixes for other private naming. Update documentation to
reflect that.

rdar://problem/31173501

llvm-svn: 321337
2017-12-22 02:53:30 +00:00
Craig Topper 67885f5d58 [X86] Enable PRFCHW feature on KNL/KNM and all CPUs inherited from Broadwell.
llvm-svn: 321336
2017-12-22 02:41:12 +00:00
Craig Topper e268598dd3 [X86] Add prefetchwt1 instruction and overhaul priorities and isel enabling for prefetch instructions.
Previously prefetch was only considered legal if sse was enabled, but it should be supported with 3dnow as well.

The prfchw flag now imply at least some form of prefetch without the write hint is available, either the sse or 3dnow version. This is true even if 3dnow and sse are explicitly disabled.

Similarly prefetchwt1 feature implies availability of prefetchw and the the prefetcht0/1/2/nta instructions. This way we can support _MM_HINT_ET0 using prefetchw and _MM_HINT_ET1 with prefetchwt1. And its assumed that if we have levels for the write hint we would have levels for the non-write hint, thus why we enable the sse prefetch instructions.

I believe this behavior is consistent with gcc. I've updated the prefetch.ll to test all of these combinations.

llvm-svn: 321335
2017-12-22 02:30:30 +00:00
Craig Topper 9befe89367 [X86] Use SIGN_EXTEND to implement ANY_EXTEND from vXi1.
llvm-svn: 321334
2017-12-22 02:30:26 +00:00
Eli Friedman 07d94d59a4 inline-fp.ll was moved in r321332; delete it properly.
llvm-svn: 321333
2017-12-22 02:10:40 +00:00
Eli Friedman 39ed9a602b [Inliner] Restrict soft-float inlining penalty.
The penalty is currently getting applied in a bunch of places where it
doesn't make sense, like bitcasts (which are free) and calls (which
were getting the call penalty applied twice). Instead, just apply the
penalty to binary operators and floating-point casts.

While I'm here, also fix getFPOpCost() to do the right thing in more
cases, so we don't have to dig into function attributes.

Differential Revision: https://reviews.llvm.org/D41522

llvm-svn: 321332
2017-12-22 02:08:08 +00:00
Easwaran Raman a17f220590 Add hasProfileData() to check if a function has profile data. NFC.
Summary:
This replaces calls to getEntryCount().hasValue() with hasProfileData
that does the same thing. This refactoring is useful to do before adding
synthetic function entry counts but also a useful cleanup IMO even
otherwise. I have used hasProfileData instead of hasRealProfileData as
David had earlier suggested since I think profile implies "real" and I
use the phrase "synthetic entry count" and not "synthetic profile count"
but I am fine calling it hasRealProfileData if you prefer.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41461

llvm-svn: 321331
2017-12-22 01:33:52 +00:00
Wolfgang Pieb b4ba1aa486 [DWARF] Fix formatting bug with r321295. This fixes a MIPS buildbot failure.
llvm-svn: 321330
2017-12-22 01:12:24 +00:00
Michael Kruse 5c2441901f Fix isl out-of-quota errors affecting later quota guards.
If an out-of-quota error occurred, the last error would be
isl_error_quota unless a different error occured. We typically check
whether the max-operations occured by comparing to that error value
after leaving the quota guard. This would check whether there ever
was a quota-error, not just in the last quota guards.

The observable bug occurred if the max-operations limit was reached in
DeLICM, and if -polly-dependences-computout=0, DependenceInfo would
think that the quota for computing dependencies was the reason,
i.e., fail the operation even if the calculation itself was successful.

Fix by reseting the last error to isl_error_none when entering a
quota guard, signaling that no quota error occured unless in the
guard's scope.

llvm-svn: 321329
2017-12-22 01:10:31 +00:00
Jason Molenda a22e923106 Change the default Aarch64 ISA to be v8.2 to correctly decode newer
instructions (e.g. on the new iphones).
<rdar://problem/30585124> 

llvm-svn: 321328
2017-12-22 00:16:04 +00:00
Aaron Smith 1f8552abf3 Enable more abilities in SymbolFilePDB
Summary:
1) Finding symbols through --symfile
2) More abilities: Functions, Blocks, GlobalVariables, LocalVariables, VariableTypes

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: clayborg

Differential Revision: https://reviews.llvm.org/D41092

llvm-svn: 321327
2017-12-22 00:04:36 +00:00
Artem Belevich 3cebc738b6 [CUDA] More fixes for __shfl_* intrinsics.
* __shfl_{up,down}* uses unsigned int for the third parameter.
* added [unsigned] long overloads for non-sync shuffles.

Differential Revision: https://reviews.llvm.org/D41521

llvm-svn: 321326
2017-12-21 23:52:09 +00:00
Craig Topper 170de4b4ba [X86] Allow _mm_prefetch (both the header implementation and the builtin) to accept bit 2 which is supposed to indicate the prefetched addresses will be written to
Add the appropriate _MM_HINT_ET0/ET1 defines to match gcc.

llvm-svn: 321325
2017-12-21 23:50:22 +00:00
Erich Keane e8192cc15f Correct hasFeature/isValidFeatureName's handling of shstk/adx/mwaitx
https://bugs.llvm.org/show_bug.cgi?id=35721 reports that x86intrin.h
is issuing a few warnings. This is because attribute target is using
isValidFeatureName for its source. It was also discovered that two of
these were missing from hasFeature.  

Additionally, shstk is and ibu are reordered alphabetically, as came
up during code review.

llvm-svn: 321324
2017-12-21 23:27:36 +00:00
Paul Robinson 1db24196d1 Update test after r321312
llvm-svn: 321323
2017-12-21 23:19:25 +00:00
Adrian Prantl 559d2c98a8 Bring clang options in error messages up to date.
llvm-svn: 321322
2017-12-21 23:04:51 +00:00
Adrian Prantl 58000d28ab Delete dead code.
llvm-svn: 321321
2017-12-21 23:03:05 +00:00
George Karpenkov 151407c35b [analyzer] Add Javascript to analyzer HTML output to allow keyboard navigation.
Differential Revision: https://reviews.llvm.org/D41414

llvm-svn: 321320
2017-12-21 22:57:51 +00:00
Richard Trieu f72fb7e989 [ODRHash] Canonicalize Decl's before processing.
Canonicalizing the Decl before processing it as part of the hash should reduce
issues with non-canonical types showing up as mismatches.

llvm-svn: 321319
2017-12-21 22:38:29 +00:00
Richard Smith e9d8789de3 Suppress "redundant parens" warning for "A (::B())".
This is a slightly odd construct (it's more common to see "A (::B)()") but can
happen in friend declarations, and the parens are not redundant as they prevent
the :: binding to the left.

llvm-svn: 321318
2017-12-21 22:26:47 +00:00
Rafael Espindola b9a18fd0a2 Define isUndefWeak inline.
This small function was showing up in the profile. Defining it inline
gives about 0.3% speedup.

llvm-svn: 321317
2017-12-21 22:26:44 +00:00
Petr Hosek 7279762fc0 [CMake][Fuchsia] Enable assertions
Enable assertions in both stages.
Release+Asserts is fast enough.
No need to let insanity through.

Patch By: mcgrathr

Reviewers: phosek

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D41471

llvm-svn: 321316
2017-12-21 22:10:27 +00:00
Craig Topper 8772228963 [X86] Use SIGN_EXTEND rather than ZERO_EXTEND for lowering extract_vector_elt from vXi1 with a non-const index.
We have a better range of instructions we can use if we can fill with the value i1 value rather than zeroing.

llvm-svn: 321315
2017-12-21 22:08:23 +00:00
Petr Hosek 37ae5afb25 [scudo] Add -fsanitize=scudo option to Fuchsia
Apparently the -fsanitize flag hadn't been added for Scudo upstream yet.

Patch By: flowerhack

Reviewers: cryptoad, alekseyshl, mcgrathr, phosek

Reviewed By: mcgrathr, phosek

Differential Revision: https://reviews.llvm.org/D41413

llvm-svn: 321314
2017-12-21 22:04:31 +00:00
Reid Kleckner d0711dfba1 Include process.h for getpid on Windows in instr profiling
llvm-svn: 321313
2017-12-21 21:48:55 +00:00
Paul Robinson f183848ace [AST] Incorrectly qualified unscoped enumeration as template actual parameter.
An unscoped enumeration used as template argument, should not have any
qualified information about its enclosing scope, as its visibility is
global.

In the case of scoped enumerations, they must include information
about their enclosing scope.

Patch by Carlos Alberto Enciso!

Differential Revision: https://reviews.llvm.org/D39239

llvm-svn: 321312
2017-12-21 21:47:22 +00:00