platform/upstream/llvm.git
5 years agoAdd offsetof support to expression evaluator.
Raphael Isemann [Thu, 18 Jul 2019 17:58:04 +0000 (17:58 +0000)]
Add offsetof support to expression evaluator.

Summary:
We currently don't support offsetof in the expression evaluator as it is implemented as a macro
(which then calls __builtin_offsetof) in stddef.h. The best solution would be to include that
header (or even better, import Clang's builtin module), but header-parsing and
(cross-platform) importing modules is not ready yet.

Until we get this working with modules I would say we add the macro to our existing macro list
as we already do with other macros from stddef.h/stdint.h. We should be able to drop all of them
once we can import the relevant modules by default.

rdar://26040641

Reviewers: shafik, davide

Reviewed By: davide

Subscribers: clayborg, lldb-commits

Tags: #lldb

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

llvm-svn: 366476

5 years ago[WebAssembly] Implement __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 17:53:22 +0000 (17:53 +0000)]
[WebAssembly] Implement __builtin_wasm_tls_base intrinsic

Summary:
Add `__builtin_wasm_tls_base` so that LeakSanitizer can find the thread-local
block and scan through it for memory leaks.

Reviewers: tlively, aheejin, sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 366475

5 years ago[OPENMP]Provide correct data sharing attributes for loop control
Alexey Bataev [Thu, 18 Jul 2019 17:49:13 +0000 (17:49 +0000)]
[OPENMP]Provide correct data sharing attributes for loop control
variables.

Loop control variables are private in loop-based constructs and we shall
take this into account when generate the code for inner constructs.
Currently, those variables are reported as shared in many cases. Moved
the analysis of the data-sharing attributes of the loop control variable
to an early semantic stage to correctly handle their attributes.

llvm-svn: 366474

5 years ago[LibTooling] Relax Transformer to allow rewriting macro expansions
Yitzhak Mandelbaum [Thu, 18 Jul 2019 17:44:54 +0000 (17:44 +0000)]
[LibTooling] Relax Transformer to allow rewriting macro expansions

Summary:
Currently, Transformer rejects any changes to source locations inside macro
expansions. This change relaxes that constraint to allow rewrites when the
entirety of the expansion is replaced, since that can be mapped to replacing the
entirety of the expansion range in the file source.  This change makes
Transformer consistent with the handling of edit ranges in `clang::edit::Commit`
(which is used, for example, for applying `FixItHint`s from diagnostics).

Reviewers: ilya-biryukov

Subscribers: gribozavr, cfe-commits

Tags: #clang

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

llvm-svn: 366473

5 years agoRevert "Fix asan infinite loop on undefined symbol"
Matthew Voss [Thu, 18 Jul 2019 17:43:44 +0000 (17:43 +0000)]
Revert "Fix asan infinite loop on undefined symbol"

This reverts commit 63719119c78ca965b5d80e5c20fcfe81ba28f896.

The tests in this commit were failing on a Linux sanitizer bot
and our internal CI.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/22401/steps/test%20standalone%20compiler-rt%20with%20symbolizer/logs/stdio

llvm-svn: 366472

5 years ago[swig] Enable autodoc feature
Jonas Devlieghere [Thu, 18 Jul 2019 17:40:30 +0000 (17:40 +0000)]
[swig] Enable autodoc feature

This patch enables the SWIG `autodoc` feature so that the generated
Python reference [1] includes class properties.

[1] https://lldb.llvm.org/python_reference/index.html

llvm-svn: 366471

5 years ago[LAA] Re-check bit-width of pointers after stripping.
Michael Liao [Thu, 18 Jul 2019 17:30:27 +0000 (17:30 +0000)]
[LAA] Re-check bit-width of pointers after stripping.

Summary:
- As the pointer stripping now tracks through `addrspacecast`, prepare
  to handle the bit-width difference from the result pointer.

Reviewers: jdoerfert

Subscribers: jvesely, nhaehnle, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 366470

5 years ago[LibTooling] Add function to translate and validate source range for editing
Yitzhak Mandelbaum [Thu, 18 Jul 2019 17:26:57 +0000 (17:26 +0000)]
[LibTooling] Add function to translate and validate source range for editing

Summary:
Adds the function `getRangeForEdit` to validate that a given source range is
editable and, if needed, translate it into a range in the source file (for
example, if it's sourced in macro expansions).

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 366469

5 years ago[clangd] Remove dead code from BackgroundIndex
Kadir Cetinkaya [Thu, 18 Jul 2019 17:25:57 +0000 (17:25 +0000)]
[clangd] Remove dead code from BackgroundIndex

llvm-svn: 366468

5 years ago[clangd] BackgroundIndex stores shards to the closest project
Kadir Cetinkaya [Thu, 18 Jul 2019 17:20:41 +0000 (17:20 +0000)]
[clangd] BackgroundIndex stores shards to the closest project

Summary:
Changes persistance logic to store shards at the directory of closest
CDB. Previously we were storing all shards to directory of the CDB that
triggered indexing, it had its downsides.

For example, if you had two TUs coming from a different CDB but depending on the
same header foo.h, we will store the foo.h only for the first CDB, and it would
be missing for the second and we would never persist it since it was actually
present in the memory and persisted before.

This patch still stores only a single copy of a shard, but makes the directory a
function of the file name. So that the shard place will be unique even with
multiple CDBs accessing the file. This directory is determined as the first
directory containing a CDB in the file's parent directories, if no such
directory exists we make use of the home directory.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366467

5 years agoELF: Add support for remaining R_AARCH64_MOVW* relocations.
Peter Collingbourne [Thu, 18 Jul 2019 17:12:50 +0000 (17:12 +0000)]
ELF: Add support for remaining R_AARCH64_MOVW* relocations.

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

llvm-svn: 366466

5 years ago[LLDB] Remove lldb-mi
Jonas Devlieghere [Thu, 18 Jul 2019 17:06:06 +0000 (17:06 +0000)]
[LLDB] Remove lldb-mi

As discussed on the mailing list [1], this patch removes the lldb-mi
tool and its tests from the LLDB repository. We moved lldb-mi into a
separate repository on GitHub [2] for downstream users or maintainers to
build and package.

[1] http://lists.llvm.org/pipermail/lldb-dev/2019-July/015103.html
[2] https://github.com/lldb-tools/lldb-mi

Differential revision: https://reviews.llvm.org/D64255

llvm-svn: 366465

5 years ago[NFC][llvm-readobj] Refactor dynamic string table indexing into a function.
Yuanfang Chen [Thu, 18 Jul 2019 17:04:28 +0000 (17:04 +0000)]
[NFC][llvm-readobj] Refactor dynamic string table indexing into a function.

Restore printDynamicString removed in rL363868. It provides better
error handling whenever indexing dynamic string table is needed.

Reviewers: jhenderson, MaskRay, grimar

Reviewed by: jhenderson, MaskRay, grimar

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

llvm-svn: 366464

5 years agoELF: Simplify test. NFCI.
Peter Collingbourne [Thu, 18 Jul 2019 16:57:06 +0000 (16:57 +0000)]
ELF: Simplify test. NFCI.

Avoid splitting the test into multiple files and use zero for the value of
the symbol with addends at relocations so that it's clear what value is
being used at relocations.

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

llvm-svn: 366463

5 years agoMC: AArch64: Add support for prel_g* relocation specifiers.
Peter Collingbourne [Thu, 18 Jul 2019 16:54:33 +0000 (16:54 +0000)]
MC: AArch64: Add support for prel_g* relocation specifiers.

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

llvm-svn: 366462

5 years agoAArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.
Peter Collingbourne [Thu, 18 Jul 2019 16:51:53 +0000 (16:51 +0000)]
AArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.

There doesn't seem to be a practical reason for these instructions to have
different restrictions on the types of relocations that they may be used
with, notwithstanding the language in the ELF AArch64 spec that implies that
specific relocations are meant to be used with specific instructions.

For example, we currently forbid the first instruction in the following
sequence, despite it currently being used by clang to generate a global
reference under -mcmodel=large:

movz x0, #:abs_g0_nc:foo
movk x0, #:abs_g1_nc:foo
movk x0, #:abs_g2_nc:foo
movk x0, #:abs_g3:foo

Therefore, allow MOVK/MOVN/MOVZ to accept the union of the set of relocations
that they currently accept individually.

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

llvm-svn: 366461

5 years agoELF: Allow forward references to linked sections.
Peter Collingbourne [Thu, 18 Jul 2019 16:47:29 +0000 (16:47 +0000)]
ELF: Allow forward references to linked sections.

It's possible to create IR that uses !associated to refer to a global that
appears later in the module, which can result in these types of forward
references being generated. Unfortunately our assembler does not currently
accept the resulting .s so I needed to use yaml2obj to test this.

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

llvm-svn: 366460

5 years ago[CMake] Polish folders in generated Xcode project
Stefan Granitz [Thu, 18 Jul 2019 16:44:45 +0000 (16:44 +0000)]
[CMake] Polish folders in generated Xcode project

Summary: Group plugins by subfolder. Move liblldb-resource-headers to `lldb misc`. Avoid install-distribution related targets in IDE-enabled builds.

Reviewers: jingham, mib, stella.stamenova

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 366459

5 years ago[clangd] Refactor background-index shard loading
Kadir Cetinkaya [Thu, 18 Jul 2019 16:25:36 +0000 (16:25 +0000)]
[clangd] Refactor background-index shard loading

Reviewers: sammccall

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366458

5 years ago[ASTUnit] Attempt to unbreak Windows buildbots after r366448
Ilya Biryukov [Thu, 18 Jul 2019 16:24:09 +0000 (16:24 +0000)]
[ASTUnit] Attempt to unbreak Windows buildbots after r366448

llvm-svn: 366457

5 years agoMinor styling fix. NFC.
Michael Liao [Thu, 18 Jul 2019 16:14:22 +0000 (16:14 +0000)]
Minor styling fix. NFC.

llvm-svn: 366456

5 years ago[clangd] Get rid of dots and dotsdots within GlobalCompilationDatabase
Kadir Cetinkaya [Thu, 18 Jul 2019 16:13:23 +0000 (16:13 +0000)]
[clangd] Get rid of dots and dotsdots within GlobalCompilationDatabase

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366455

5 years agoRevert "[RISCV] Hard float ABI support" r366450
Alex Bradbury [Thu, 18 Jul 2019 16:13:17 +0000 (16:13 +0000)]
Revert "[RISCV] Hard float ABI support" r366450

The commit was missing a few hunks. Will fix and recommit.

llvm-svn: 366454

5 years agoRevert r366449: [CrossTU] Add a function to retrieve original source location.
Ilya Biryukov [Thu, 18 Jul 2019 15:43:26 +0000 (15:43 +0000)]
Revert r366449: [CrossTU] Add a function to retrieve original source location.

Reason: the commit breaks layering by adding a dependency on ASTUnit
(which is inside clangFrontend) from the ASTImporter (which is inside
clangAST).

llvm-svn: 366453

5 years ago[Clangd] NFC: Fixed tweaks CMakeLists order to alphabetical
Shaurya Gupta [Thu, 18 Jul 2019 15:42:09 +0000 (15:42 +0000)]
[Clangd] NFC: Fixed tweaks CMakeLists order to alphabetical

llvm-svn: 366452

5 years ago[Clangd] Changed ExtractVariable to only work on non empty selections
Shaurya Gupta [Thu, 18 Jul 2019 15:38:03 +0000 (15:38 +0000)]
[Clangd] Changed ExtractVariable to only work on non empty selections

Summary:
- For now, we don't trigger in any case if it's an empty selection
- Fixed unittests

Reviewers: kadircet, sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366451

5 years ago[RISCV] Hard float ABI support
Alex Bradbury [Thu, 18 Jul 2019 15:33:41 +0000 (15:33 +0000)]
[RISCV] Hard float ABI support

The RISC-V hard float calling convention requires the frontend to:

* Detect cases where, once "flattened", a struct can be passed using
int+fp or fp+fp registers under the hard float ABI and coerce to the
appropriate type(s) * Track usage of GPRs and FPRs in order to gate the
above, and to
determine when signext/zeroext attributes must be added to integer
scalars

This patch attempts to do this in compliance with the documented ABI,
and uses ABIArgInfo::CoerceAndExpand in order to do this. @rjmccall, as
author of that code I've tagged you as reviewer for initial feedback on
my usage.

Note that a previous version of the ABI indicated that when passing an
int+fp struct using a GPR+FPR, the int would need to be sign or
zero-extended appropriately. GCC never did this and the ABI was changed,
which makes life easier as ABIArgInfo::CoerceAndExpand can't currently
handle sign/zero-extension attributes.

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

llvm-svn: 366450

5 years ago[CrossTU] Add a function to retrieve original source location.
Balazs Keri [Thu, 18 Jul 2019 15:23:10 +0000 (15:23 +0000)]
[CrossTU] Add a function to retrieve original source location.

Summary:
A new function will be added to get the original SourceLocation
for a SourceLocation that was imported as result of getCrossTUDefinition.
The returned SourceLocation is in the context of the (original)
SourceManager for the original source file. Additionally the
ASTUnit object for that source file is returned. This is needed
to get a SourceManager to operate on with the returned source location.

The new function works if multiple different source files are loaded
with the same CrossTU context.

This patch can be treated as part of a bigger change that is needed to
improve macro expansion handliong at plist generation.

Reviewers: martong, shafik, a_sidorin, xazax.hun

Reviewed By: martong

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 366449

5 years ago[ASTUnit] Fix a regression in cached completions
Ilya Biryukov [Thu, 18 Jul 2019 15:21:34 +0000 (15:21 +0000)]
[ASTUnit] Fix a regression in cached completions

Summary:
After r345152 cached completions started adding namespaces after
nested name specifiers, e.g. in `some_name::^`

The CCC_Symbol indicates the completed item cannot be a namespace (it is
described as being "a type, a function or a variable" in the comments).

Therefore, 'nested specifier' completions should only be added from cache
when the context is CCC_SymbolOrNewName (which roughly seems to indicate
that a nested name specifier is allowed).

Fixes https://bugs.llvm.org/show_bug.cgi?id=42646

Reviewers: kadircet, sammccall

Reviewed By: kadircet, sammccall

Subscribers: arphaman, nik, sammccall, cfe-commits

Tags: #clang

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

llvm-svn: 366448

5 years ago[CMake] Don't set Python_ADDITIONAL_VERSIONS
Jonas Devlieghere [Thu, 18 Jul 2019 15:17:42 +0000 (15:17 +0000)]
[CMake] Don't set Python_ADDITIONAL_VERSIONS

Until recently, Python_ADDITIONAL_VERSIONS was used to limit LLVM's
Python support to 2.7. Now that both LLVM and LLDB both support Python
3, there's no longer a need to put an arbitrary limit on this.

However, instead of removing the variable, r365692 expanded the list,
which has the (presumably unintentional) side-effect of expression
preference for Python 3.

Instead, as Michal proposed in the original code review, we should just
not set the list at all, and let CMake pick whatever Python interpreter
you have in your path.

This patch removes the Python_ADDITIONAL_VERSIONS variable in llvm,
clang and lld. I've also updated the docs with the default behavior and
how to force a different Python version to be used.

Differential revision: https://reviews.llvm.org/D64894

llvm-svn: 366447

5 years ago[clangd] Suppress unwritten scopes when expanding auto.
Haojian Wu [Thu, 18 Jul 2019 15:13:45 +0000 (15:13 +0000)]
[clangd] Suppress unwritten scopes when expanding auto.

Summary: otherwise the replacement will break the code.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 366446

5 years ago[ELF][PPC] Delete ppc64-dynamic-relocations.s
Fangrui Song [Thu, 18 Jul 2019 15:07:42 +0000 (15:07 +0000)]
[ELF][PPC] Delete ppc64-dynamic-relocations.s

I forgot to delete it in r366424.

llvm-svn: 366445

5 years agoRevert "[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame."
Hsiangkai Wang [Thu, 18 Jul 2019 15:06:50 +0000 (15:06 +0000)]
Revert "[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame."

This reverts commit 17e3cbf5fe656483d9016d0ba9e1d0cd8629379e.

llvm-svn: 366444

5 years ago[clangd] Disable DumpRecordLayout by default per https://bugs.llvm.org/show_bug.cgi...
Sam McCall [Thu, 18 Jul 2019 15:00:38 +0000 (15:00 +0000)]
[clangd] Disable DumpRecordLayout by default per https://bugs.llvm.org/show_bug.cgi?id=42670

llvm-svn: 366443

5 years ago[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
Hsiangkai Wang [Thu, 18 Jul 2019 14:47:34 +0000 (14:47 +0000)]
[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.

It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

llvm-svn: 366442

5 years ago[X86] EltsFromConsecutiveLoads - support common source loads
Simon Pilgrim [Thu, 18 Jul 2019 14:33:25 +0000 (14:33 +0000)]
[X86] EltsFromConsecutiveLoads - support common source loads

This patch enables us to find the source loads for each element, splitting them into a Load and ByteOffset, and attempts to recognise consecutive loads that are in fact from the same source load.

A helper function, findEltLoadSrc, recurses to find a LoadSDNode and determines the element's byte offset within it. When attempting to match consecutive loads, byte offsetted loads then attempt to matched against a previous load that has already been confirmed to be a consecutive match.

Next step towards PR16739 - after this we just need to account for shuffling/repeated elements to create a vector load + shuffle.

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

llvm-svn: 366441

5 years ago[lldb][NFC] Tablegenify alias/regex/history/source/script
Raphael Isemann [Thu, 18 Jul 2019 14:10:49 +0000 (14:10 +0000)]
[lldb][NFC] Tablegenify alias/regex/history/source/script

(Converting these commands together as they are all simple commands
that share the same file).

llvm-svn: 366440

5 years ago[analyzer] Add CTU user docs
Gabor Marton [Thu, 18 Jul 2019 14:03:25 +0000 (14:03 +0000)]
[analyzer] Add CTU user docs

Reviewers: dkrupp, a_sidorin, Szelethus, NoQ

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, gamesh411, Charusso, cfe-commits

Tags: #clang

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

llvm-svn: 366439

5 years ago[OpenMP][libomptarget] Suppress C++ 11 related warnings when building libomptarget...
Alexey Bataev [Thu, 18 Jul 2019 13:54:01 +0000 (13:54 +0000)]
[OpenMP][libomptarget] Suppress C++ 11 related warnings when building libomptarget-nvptx bitcode library, by Doru Bercea.

Summary: Pass -std=c++11 flag to compiler to suppress C++ 11 related warnings when building NVPTX bitcode library.

Reviewers: ABataev, caomhin, Hahnfeld

Reviewed By: ABataev, Hahnfeld

Subscribers: jdoerfert, Hahnfeld, jholewinski, mgorny, guansong, openmp-commits

Tags: #openmp

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

llvm-svn: 366438

5 years ago[OPENMP][NVPTX]Mark barrier functions calls as convergent.
Alexey Bataev [Thu, 18 Jul 2019 13:49:24 +0000 (13:49 +0000)]
[OPENMP][NVPTX]Mark barrier functions calls as convergent.

Added convergent attribute to the barrier functions calls for correct
optimizations.

llvm-svn: 366437

5 years agoRestrict asan + dlopen testcase to x86
Serge Guelton [Thu, 18 Jul 2019 13:47:28 +0000 (13:47 +0000)]
Restrict asan + dlopen testcase to x86

llvm-svn: 366436

5 years ago[DAGCombine] Pull getSubVectorSrc helper out of narrowInsertExtractVectorBinOp. NFCI.
Simon Pilgrim [Thu, 18 Jul 2019 13:45:53 +0000 (13:45 +0000)]
[DAGCombine] Pull getSubVectorSrc helper out of narrowInsertExtractVectorBinOp. NFCI.

NFC step towards reusing this in other EXTRACT_SUBVECTOR combines.

llvm-svn: 366435

5 years ago[FileCheck] Fix numeric variable redefinition
Thomas Preud'homme [Thu, 18 Jul 2019 13:39:04 +0000 (13:39 +0000)]
[FileCheck] Fix numeric variable redefinition

Summary:
Commit r365249 changed usage of FileCheckNumericVariable to have one
instance of that class per variable as opposed to one instance per
definition of a given variable as was done before. However, it retained
the safety check in setValue that it should only be called with the
variable unset, even after r365625.

However this causes assert failure when a non-pseudo variable is being
redefined. And while redefinition of @LINE at each CHECK line work in
the general case, it caused problem when a substitution failed (fixed in
r365624) and still causes problem when a CHECK line does not match since
@LINE's value is cleared after substitutions in match() happened but
printSubstitutions also attempts a substitution.

This commit solves the root of the problem by changing setValue to set a
new value regardless of whether a value was set or not, thus fixing all
the aforementioned issues.

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

llvm-svn: 366434

5 years ago[CMake] Always build debugserver on Darwin and allow tests to use the system's one
Stefan Granitz [Thu, 18 Jul 2019 13:30:37 +0000 (13:30 +0000)]
[CMake] Always build debugserver on Darwin and allow tests to use the system's one

Summary:
We can always build debugserver, but we can't always sign it to be useable for testing. `LLDB_USE_SYSTEM_DEBUGSERVER` should only tell whether or not the system debugserver should be used for testing.
The old behavior complicated the logic around debugserver a lot. The new logic sorts out most of it.

Please note that this patch is in early stage and needs some more testing. It should not affect platfroms other than Darwin. It builds on Davide's approach to validate the code-signing identity at configuration time.

What do you think?

Reviewers: xiaobai, JDevlieghere, davide, compnerd, friss, labath, mgorny, jasonmolenda

Reviewed By: JDevlieghere

Subscribers: lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 366433

5 years agoRelax regexp to detect failed interception by asan
Serge Guelton [Thu, 18 Jul 2019 13:13:29 +0000 (13:13 +0000)]
Relax regexp to detect failed interception by asan

This should fix failed detection on aarch64/ppc64/thumbv8...

llvm-svn: 366432

5 years ago[x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)
Sanjay Patel [Thu, 18 Jul 2019 12:48:01 +0000 (12:48 +0000)]
[x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)

LEA doesn't affect flags, so use it more liberally to replace an ADD when
we know that the ADD operands affect flags.

In the motivating example from PR40483:
https://bugs.llvm.org/show_bug.cgi?id=40483
...this lets us avoid duplicating a math op just to avoid flag conflict.

As mentioned in the TODO comments, this heuristic can be extended to
fire more often if that leads to more improvements.

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

llvm-svn: 366431

5 years ago[llvm-readelf] - Remove the precompiled binary from gnu-hash-symbols.test
George Rimar [Thu, 18 Jul 2019 12:14:36 +0000 (12:14 +0000)]
[llvm-readelf] - Remove the precompiled binary from gnu-hash-symbols.test

I am working on https://bugs.llvm.org/show_bug.cgi?id=42622
and this patch reworks the gnu-hash-symbols.test so that it
will be easier to expand it with x86_64 case.

Differential revision: https://reviews.llvm.org/D64750

llvm-svn: 366430

5 years agoRevert r366422: [OpenCL] Improve destructor support in C++ for OpenCL
Ilya Biryukov [Thu, 18 Jul 2019 11:55:33 +0000 (11:55 +0000)]
Revert r366422: [OpenCL] Improve destructor support in C++ for OpenCL

Reason: this commit causes crashes in the clang compiler when building
LLVM Support with libc++, see https://bugs.llvm.org/show_bug.cgi?id=42665
for details.

llvm-svn: 366429

5 years agoBump the trunk version to 10.0.0svn llvmorg-10-init
Hans Wennborg [Thu, 18 Jul 2019 11:51:05 +0000 (11:51 +0000)]
Bump the trunk version to 10.0.0svn

and clear the release notes.

llvm-svn: 366427

5 years ago[lldb][NFC] Format 'type' commands in Options.td
Raphael Isemann [Thu, 18 Jul 2019 11:43:45 +0000 (11:43 +0000)]
[lldb][NFC] Format 'type' commands in Options.td

llvm-svn: 366426

5 years ago[lldb] Tablegenify thread commands and fix completion bug for thread step-*
Raphael Isemann [Thu, 18 Jul 2019 11:12:00 +0000 (11:12 +0000)]
[lldb] Tablegenify thread commands and fix completion bug for thread step-*

Beside turning the options into the new tablegen format, this patch
also fixes that a few commands had source file completions for the
"count" and "end-linenumber" arguments (which both accepted only
integers). Reason for that are that somehow we added a '1' instead
of our usual '0' value to the initial value for completion.

llvm-svn: 366425

5 years ago[ELF][PPC] Refactor some ppc64 tests
Fangrui Song [Thu, 18 Jul 2019 10:43:07 +0000 (10:43 +0000)]
[ELF][PPC] Refactor some ppc64 tests

Merge ppc64-dynamic-relocations.s into ppc64-plt-stub.s
Add ppc64-tls-ie.s: covers ppc64-initial-exec-tls.s and ppc64-tls-ie-le.s
Add ppc64-tls-gd.s: covers ppc64-general-dynamic-tls.s, ppc64-gd-to-ie.s, ppc64-tls-gd-le.s, and ppc64-tls-gd-le-small.s

llvm-svn: 366424

5 years ago[ARM][DAGCOMBINE][FIX] PerformVMOVRRDCombine
Diogo N. Sampaio [Thu, 18 Jul 2019 10:05:56 +0000 (10:05 +0000)]
[ARM][DAGCOMBINE][FIX] PerformVMOVRRDCombine

Summary:
PerformVMOVRRDCombine ommits adding a offset
of 4 to the PointerInfo, when converting a
f64 = load[M]
to
{i32, i32} = {load[M], load[M + 4]}

Which would allow the machine scheduller
to break dependencies with the second load.

 - pr42638

Reviewers: eli.friedman, dmgreen, ostannard

Reviewed By: ostannard

Subscribers: ostannard, javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 366423

5 years ago[OpenCL] Improve destructor support in C++ for OpenCL
Marco Antognini [Thu, 18 Jul 2019 10:04:18 +0000 (10:04 +0000)]
[OpenCL] Improve destructor support in C++ for OpenCL

Summary:
This patch does mainly three things:
 1. It fixes a false positive error detection in Sema that is similar to
    D62156. The error happens when explicitly calling an overloaded
    destructor for different address spaces.
 2. It selects the correct destructor when multiple overloads for
    address spaces are available.
 3. It inserts the expected address space cast when invoking a
    destructor, if needed, and therefore fixes a crash due to the unmet
    assertion in llvm::CastInst::Create.

The following is a reproducer of the three issues:

    struct MyType {
      ~MyType() {}
      ~MyType() __constant {}
    };

    __constant MyType myGlobal{};

    kernel void foo() {
      myGlobal.~MyType(); // 1 and 2.
      // 1. error: cannot initialize object parameter of type
      //    '__generic MyType' with an expression of type '__constant MyType'
      // 2. error: no matching member function for call to '~MyType'
    }

    kernel void bar() {
      // 3. The implicit call to the destructor crashes due to:
      //    Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
      //    in llvm::CastInst::Create.
      MyType myLocal;
    }

The added test depends on D62413 and covers a few more things than the
above reproducer.

Subscribers: yaxunl, Anastasia, cfe-commits

Tags: #clang

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

llvm-svn: 366422

5 years ago[OpenCL] Update comments/diagnostics to refer to C++ for OpenCL
Anastasia Stulova [Thu, 18 Jul 2019 10:02:35 +0000 (10:02 +0000)]
[OpenCL] Update comments/diagnostics to refer to C++ for OpenCL

Clang doesn't implement OpenCL C++, change the comments to
reflect that.

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

llvm-svn: 366421

5 years ago[clangd] Added highlightings for template parameters and specializations.
Johan Vikstrom [Thu, 18 Jul 2019 09:56:38 +0000 (09:56 +0000)]
[clangd] Added highlightings for template parameters and specializations.

Summary: Template parameters and specializations were not being highlighted before. This adds highlightings to those types of tokens by adding two Visit* methods.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 366420

5 years ago[SCEV] add no wrap flag for SCEVAddExpr.
Chen Zheng [Thu, 18 Jul 2019 09:23:19 +0000 (09:23 +0000)]
[SCEV] add no wrap flag for SCEVAddExpr.
Differential Revision: https://reviews.llvm.org/D64868

llvm-svn: 366419

5 years ago[lld] Fix vs-diagnostics-version-script test. NFC.
Chris Jackson [Thu, 18 Jul 2019 09:17:11 +0000 (09:17 +0000)]
[lld] Fix vs-diagnostics-version-script test. NFC.

Removed unnecessary llvm-mc call.

llvm-svn: 366418

5 years ago[OpenCL][PR42033] Fix addr space deduction with template parameters
Anastasia Stulova [Thu, 18 Jul 2019 09:12:49 +0000 (09:12 +0000)]
[OpenCL][PR42033] Fix addr space deduction with template parameters

If dependent types appear in pointers or references we allow addr
space deduction because the addr space in template argument will
belong to the pointee and not the pointer or reference itself.

We also don't diagnose addr space on a function return type after
template instantiation. If any addr space for the return type was
provided on a template parameter this will be diagnosed during the
parsing of template definition.

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

llvm-svn: 366417

5 years agoFixup r366333 (require x86 in test)
Diana Picus [Thu, 18 Jul 2019 08:27:44 +0000 (08:27 +0000)]
Fixup r366333 (require x86 in test)

Seems to be required for the other added tests too.

llvm-svn: 366416

5 years ago[lldb][NFC] Tablegenify type commands
Raphael Isemann [Thu, 18 Jul 2019 08:22:19 +0000 (08:22 +0000)]
[lldb][NFC] Tablegenify type commands

llvm-svn: 366415

5 years ago[lldb] Don't double emit option groups
Raphael Isemann [Thu, 18 Jul 2019 08:22:11 +0000 (08:22 +0000)]
[lldb] Don't double emit option groups

We currently emit the option groups twice if Groups<[1,2,3]> is
used in the tablegen. This leads to compilation errors. This
patch just removes the line that accidentially emits the option
group a second time.

llvm-svn: 366414

5 years agoFix asan infinite loop on undefined symbol
Serge Guelton [Thu, 18 Jul 2019 08:09:31 +0000 (08:09 +0000)]
Fix asan infinite loop on undefined symbol

Fix llvm#39641

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

llvm-svn: 366413

5 years ago[RISCV] Reset NoPHIS MachineFunctionProperty in emitSelectPseudo
Alex Bradbury [Thu, 18 Jul 2019 07:52:41 +0000 (07:52 +0000)]
[RISCV] Reset NoPHIS MachineFunctionProperty in emitSelectPseudo

We insered PHIS were there were none before, so the property must be
reset. This error was found on an EXPENSIVE_CHECKS build.

llvm-svn: 366412

5 years ago[LoopInfo] Use early return in branch weight update functions. NFC.
Serguei Katkov [Thu, 18 Jul 2019 07:36:20 +0000 (07:36 +0000)]
[LoopInfo] Use early return in branch weight update functions. NFC.

llvm-svn: 366411

5 years ago[RISCV][DebugInfo] Fix dwarf-riscv-relocs.ll test on Windows
Alex Bradbury [Thu, 18 Jul 2019 07:25:56 +0000 (07:25 +0000)]
[RISCV][DebugInfo] Fix dwarf-riscv-relocs.ll test on Windows

Windows sees DW_AT_decl_file (".\dwarf-riscv-relocs.c") while Linux sees
DW_AT_decl_file ("./dwarf-riscv-relocs.c").

This fixes a failure introduced in rL366402.

llvm-svn: 366410

5 years ago[CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken in r342528
Sam McCall [Thu, 18 Jul 2019 07:17:49 +0000 (07:17 +0000)]
[CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken in r342528

Summary:
The problem is the default LoadExternal with no completer, which happens when
loading global results.

Reviewers: ilya-biryukov, nik

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 366409

5 years agoclang-tidy release notes: Split and order changes by type
Hans Wennborg [Thu, 18 Jul 2019 07:12:47 +0000 (07:12 +0000)]
clang-tidy release notes: Split and order changes by type

Patch by Eugene Zelenko!

llvm-svn: 366408

5 years ago[NFC][PowerPC] Add the test to test the pass block-placement
Kang Zhang [Thu, 18 Jul 2019 06:56:49 +0000 (06:56 +0000)]
[NFC][PowerPC] Add the test to test the pass block-placement

llvm-svn: 366407

5 years ago[PowerPC][Clang] Remove use of malloc in mm_malloc
Qiu Chaofan [Thu, 18 Jul 2019 06:20:12 +0000 (06:20 +0000)]
[PowerPC][Clang] Remove use of malloc in mm_malloc

Remove dependency of malloc in implementation of mm_malloc function in PowerPC
intrinsics and alignment assumption on glibc.

Reviewed By: Hal Finkel

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

llvm-svn: 366406

5 years ago[X86] Disable combineConcatVectors for vXi1 vectors.
Craig Topper [Thu, 18 Jul 2019 06:18:06 +0000 (06:18 +0000)]
[X86] Disable combineConcatVectors for vXi1 vectors.

I'm not convinced the code this calls is properly vetted for
vXi1 vectors. Experimental vector widening legalization testing
for D55251 is now hitting an assertion failure inside
EltsFromConsecutiveLoads. This is occurring from a v2i1 load
having a store size different than its VT size. Hopefully
this commit will keep such issues from happening.

llvm-svn: 366405

5 years agoFix typo in programmer's manual cantFile -> cantFail
Nathan Lanza [Thu, 18 Jul 2019 05:24:22 +0000 (05:24 +0000)]
Fix typo in programmer's manual cantFile -> cantFail

llvm-svn: 366403

5 years ago[DWARF][RISCV] Add support for RISC-V relocations needed for debug info
Alex Bradbury [Thu, 18 Jul 2019 05:22:55 +0000 (05:22 +0000)]
[DWARF][RISCV] Add support for RISC-V relocations needed for debug info

When code relaxation is enabled many RISC-V fixups are not resolved but
instead relocations are emitted. This happens even for DWARF debug
sections. Therefore, to properly support the parsing of DWARF debug info
we need to be able to resolve RISC-V relocations. This patch adds:

* Support for RISC-V relocations in RelocationResolver
* DWARF support for two relocations per object file offset
* DWARF changes to support relocations in more DIE fields

The two relocations per offset change is needed because some RISC-V
relocations (used for label differences) come in pairs.

Relocations can also be emitted for DWARF fields where relocations were
not yet evaluated. Adding relocation support for some of these fields is
essencial. On the other hand, LLVM currently emits RISC-V relocations
for fixups that could be safely evaluated, since they can never be
affected by code relaxations. This patch also adds relocation support
for the fields affected by those extraneous relocations (the DWARF unit
entry Length, and the DWARF debug line entry TotalLength and
PrologueLength), for testing purposes.

Differential Revision: https://reviews.llvm.org/D62062
Patch by Luís Marques.

llvm-svn: 366402

5 years ago[ELF][test] Merge/rename some basic*.s tests
Fangrui Song [Thu, 18 Jul 2019 04:54:58 +0000 (04:54 +0000)]
[ELF][test] Merge/rename some basic*.s tests

basic64be.s is a big-endian powerpc64 test that just duplicates what
basic-ppc64.s does. Extend basic-ppc64.s to add big-endian tests.
Delete basic64be.s

Rename basic32.s to basic-i386.s

llvm-svn: 366401

5 years ago[clangd] Fix Fix -Wunused-lambda-capture after r366339
Fangrui Song [Thu, 18 Jul 2019 04:23:54 +0000 (04:23 +0000)]
[clangd] Fix Fix -Wunused-lambda-capture after r366339

llvm-svn: 366400

5 years ago[RISCV] Re-land r366331 d RISCV to LLVM_ALL_TARGETS
Alex Bradbury [Thu, 18 Jul 2019 04:05:18 +0000 (04:05 +0000)]
[RISCV] Re-land r366331 d RISCV to LLVM_ALL_TARGETS

*San flagged issues should be now be addressed.

llvm-svn: 366399

5 years ago[RISCV] Avoid signed integer overflow UB in RISCVMatInt::generateInstSeq
Alex Bradbury [Thu, 18 Jul 2019 04:02:58 +0000 (04:02 +0000)]
[RISCV] Avoid signed integer overflow UB in RISCVMatInt::generateInstSeq

Found by UBSan.

llvm-svn: 366398

5 years ago[RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch
Alex Bradbury [Thu, 18 Jul 2019 03:23:47 +0000 (03:23 +0000)]
[RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch

Issue found by ASan.

llvm-svn: 366397

5 years ago[AArch64] Add dependency from AArch64CodeGen to TransformUtils to fix -DBUILD_SHARED_...
Fangrui Song [Thu, 18 Jul 2019 01:53:08 +0000 (01:53 +0000)]
[AArch64] Add dependency from AArch64CodeGen to TransformUtils to fix -DBUILD_SHARED_LIBS=on link error after D64173/r366361

This fixes:

ld.lld: error: undefined symbol: llvm::findAllocaForValue(llvm::Value*, llvm::DenseMap<llvm::Value*, llvm::Alloc aInst*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::AllocaInst*> >&)
>>> referenced by AArch64StackTagging.cpp

llvm-svn: 366396

5 years agoOnly build lldb-tblgen if it's not a current target
Nathan Lanza [Thu, 18 Jul 2019 01:26:53 +0000 (01:26 +0000)]
Only build lldb-tblgen if it's not a current target

Summary:
When doing standalone builds, you could potentially be building against
an llvm which also built lldb. If this were the case, you'd be
attempting to build this target twice.

Reviewers: xiaobai

Subscribers: mgorny

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

llvm-svn: 366394

5 years ago[Tests] Add a test showing how we handle overaligned allocas w/ no-realign-stack
Philip Reames [Thu, 18 Jul 2019 00:26:03 +0000 (00:26 +0000)]
[Tests] Add a test showing how we handle overaligned allocas w/ no-realign-stack

(At the moment, we ignore the alignment requirement.)

llvm-svn: 366393

5 years ago[cmake] Add NATIVE build for cross compiling standalone builds
Nathan Lanza [Thu, 18 Jul 2019 00:21:57 +0000 (00:21 +0000)]
[cmake] Add NATIVE build for cross compiling standalone builds

TableGen is a host tool and requires a native variant for every build.
While building as a part of llvm this is trivial and llvm handles it.
However, building standalone means that lldb has to handle this itself.
Add a NATIVE build variant to enable this.

llvm-svn: 366392

5 years ago[analyzer] MallocChecker: Prevent Integer Set Library false positives
Csaba Dabis [Thu, 18 Jul 2019 00:03:55 +0000 (00:03 +0000)]
[analyzer] MallocChecker: Prevent Integer Set Library false positives

Summary:
Integer Set Library using retain-count based allocation which is not
modeled in MallocChecker.

Reviewed By: NoQ

Tags: #clang

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

llvm-svn: 366391

5 years agoChanges to display code view debug info type records in hex format
Nilanjana Basu [Wed, 17 Jul 2019 23:43:58 +0000 (23:43 +0000)]
Changes to display code view debug info type records in hex format

llvm-svn: 366390

5 years agohwasan: Use C++ driver for cfi.cc test.
Peter Collingbourne [Wed, 17 Jul 2019 23:35:15 +0000 (23:35 +0000)]
hwasan: Use C++ driver for cfi.cc test.

It turns out that this test was only passing by accident. It was relying on
the optimizer to remove the only reference to A's vtable by realizing that
the CFI check will always fail. The vtable contains a reference to RTTI in
libc++, which will be unresolved because the C driver won't link against it.

This was found by my prototype implementation of HWASAN for globals, which
happens to end up preserving the reference.

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

llvm-svn: 366389

5 years agoMake DT a transitive dependency of LI.
Evgeniy Stepanov [Wed, 17 Jul 2019 23:31:59 +0000 (23:31 +0000)]
Make DT a transitive dependency of LI.

Summary:
LoopInfoWrapperPass::verify uses DT, which means DT must be alive
even if it has no direct users.

Fixes a crash in expensive checks mode.

Reviewers: pcc, leonardchan

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366388

5 years ago[llvm-bcanalyzer] Fixed error 'Expected<T> must be checked before access or destruction'
Denis Bakhvalov [Wed, 17 Jul 2019 23:28:39 +0000 (23:28 +0000)]
[llvm-bcanalyzer] Fixed error 'Expected<T> must be checked before access or destruction'

After rL365286 I had failing test:
  LLVM :: tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll

It was failing with the output:
$ llvm-bcanalyzer --dump llvm/test/tools/gold/X86/v1.12/Output/thinlto_emit_linked_objects.ll.tmp3.o.thinlto.bc
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
Unexpected end of file reading 0 of 0 bytesStack dump:

Change-Id: I07e03262074ea5e0aae7a8d787d5487c87f914a2
llvm-svn: 366387

5 years agollvm-pdbdump: Fix several smaller issues with injected source compression handling
Nico Weber [Wed, 17 Jul 2019 22:59:52 +0000 (22:59 +0000)]
llvm-pdbdump: Fix several smaller issues with injected source compression handling

- getCompression() used to return a PDB_SourceCompression even though
  the docs for IDiaInjectedSource are explicit about the return value
  being compiler-dependent. Return an uint32_t instead, and make the
  printing code handle unknown values better by printing "Unknown" and
  the int value instead of not printing any compression.

- Print compressed contents as hex dump, not as string.

- Add compression type "DotNet", which is used (at least) by csc.exe,
  the C# compiler. Also add a lengthy comment describing the stream
  contents (derived from looking at the raw hex contents long enough
  to see the GUIDs, which led me to the roslyn and mono implementations
  for handling this).

- The native injected source dumper was dumping the contents of the
  whole data stream -- but csc.exe writes a stream that's padded with
  zero bytes to the next 512 boundary, and the dia api doesn't display
  those padding bytes. So make NativeInjectedSource::getCode() do the
  same thing.

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

llvm-svn: 366386

5 years ago[AMDGPU] Simplify AMDGPUInstPrinter::printRegOperand()
Stanislav Mekhanoshin [Wed, 17 Jul 2019 22:58:43 +0000 (22:58 +0000)]
[AMDGPU] Simplify AMDGPUInstPrinter::printRegOperand()

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

llvm-svn: 366385

5 years agoAMDGPU: Set inaccessiblememonly on sendmsg intrinsics
Matt Arsenault [Wed, 17 Jul 2019 22:41:53 +0000 (22:41 +0000)]
AMDGPU: Set inaccessiblememonly on sendmsg intrinsics

llvm-svn: 366384

5 years ago[NFC] Clarify a Cmake status message regarding Python on LLDBConfig
Adrian McCarthy [Wed, 17 Jul 2019 22:36:26 +0000 (22:36 +0000)]
[NFC] Clarify a Cmake status message regarding Python on LLDBConfig

llvm-svn: 366383

5 years ago[X86] Make sure we mark 128/256 MLOAD as Legal with VLX when min-legal-vector-width...
Craig Topper [Wed, 17 Jul 2019 22:26:00 +0000 (22:26 +0000)]
[X86] Make sure we mark 128/256 MLOAD as Legal with VLX when min-legal-vector-width=256 is in effect.

This started triggering an assertion after r364718 when we made
these Custom under AVX2.

llvm-svn: 366382

5 years agoAh, forgot a debug line I left in the dsym-for-uuid.sh script
Jason Molenda [Wed, 17 Jul 2019 21:55:39 +0000 (21:55 +0000)]
Ah, forgot a debug line I left in the dsym-for-uuid.sh script
to make sure it was correctly being disabled after this test
case completed.

llvm-svn: 366381

5 years agogn build: Merge r366361.
Peter Collingbourne [Wed, 17 Jul 2019 21:45:34 +0000 (21:45 +0000)]
gn build: Merge r366361.

llvm-svn: 366380

5 years agohwasan: Initialize the pass only once.
Peter Collingbourne [Wed, 17 Jul 2019 21:45:19 +0000 (21:45 +0000)]
hwasan: Initialize the pass only once.

This will let us instrument globals during initialization. This required
making the new PM pass a module pass, which should still provide access to
analyses via the ModuleAnalysisManager.

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

llvm-svn: 366379

5 years agoAdd support to ProcessMachCore::DoLoadCore to handle an EFI UUID str.
Jason Molenda [Wed, 17 Jul 2019 21:44:05 +0000 (21:44 +0000)]
Add support to ProcessMachCore::DoLoadCore to handle an EFI UUID str.

If a core file has an EFI version string which includes a UUID
(similar to what it returns for the kdp KDP_KERNELVERSION packet)
in the LC_IDENT or LC_NOTE 'kern ver str' load command.  In that
case, we should try to find the binary and dSYM for the UUID
listed.  The dSYM may have python code which knows how to relocate
the binary to the correct address in lldb's target section load
list and loads other ancillary binaries.

The test case is a little involved,

1. it compiles an inferior hello world apple (a.out),
2. it compiles a program which can create a corefile manually
   with a specific binary's UUID encoded in it,
3. it gets the UUID of the a.out binary,
4. it creates a shell script, dsym-for-uuid.sh, which will
   return the full path to the a.out + a.out.dSYM when called
   with teh correct UUID,
5. it sets the LLDB_APPLE_DSYMFORUUID_EXECUTABLE env var before
   creating the lldb target, to point to this dsym-for-uuid.sh,
6. runs the create-corefile binary we compiled in step #2,
7. loads the corefile from step #6 into lldb,
8. verifies that lldb loaded a.out by reading the LC_NOTE
   load command from the corefile, calling dsym-for-uuid.sh with
   that UUID, got back the path to a.out and loaded it.

whew!

<rdar://problem/47562911>

llvm-svn: 366378

5 years ago[NFC][ScopBuilder] Move buildSchedule and its callees to ScopBuilder or ScopHelper
Dominik Adamski [Wed, 17 Jul 2019 21:42:39 +0000 (21:42 +0000)]
[NFC][ScopBuilder] Move buildSchedule and its callees to ScopBuilder or ScopHelper

Scope of changes:
1. Moved buildSchedule functions to ScopBuilder.
2. Moved combineInSequence function to ScopBuilder.
3. Moved mapToDimension function to ScopBuilder.
4. Moved LoopStackTy to ScopBuilder.
5. Moved getLoopSurroundingScop to ScopHelper.
6. Moved getNumBlocksInLoop to ScopHelper.
7. Moved getNumBlocksInRegionNode to ScopHelper.
8. Moved getRegionNodeLoop to ScopHelper.

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

llvm-svn: 366377

5 years ago[AMDGPU] Stop special casing flat_scratch for register name
Stanislav Mekhanoshin [Wed, 17 Jul 2019 21:35:11 +0000 (21:35 +0000)]
[AMDGPU] Stop special casing flat_scratch for register name

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

llvm-svn: 366376

5 years agoSpeculative fix for stack-tagging.ll failure.
Evgeniy Stepanov [Wed, 17 Jul 2019 21:27:44 +0000 (21:27 +0000)]
Speculative fix for stack-tagging.ll failure.

Depending on the evaluation order of function call arguments,
the current code may insert a use before def.

llvm-svn: 366375

5 years ago[NFC][ScopBuilder]Move finalizeAccesses and its callees to ScopBuilder
Dominik Adamski [Wed, 17 Jul 2019 21:25:18 +0000 (21:25 +0000)]
[NFC][ScopBuilder]Move finalizeAccesses and its callees to ScopBuilder

Scope of changes:
1) Moved finalizeAccesses to ScopBuilder
2) Moved updateAccessDimensionality to ScopBuilder
3) Moved foldSizeConstantsToRight to ScopBuilder
4) Moved foldSizeConstantsToRight to ScopBuilder
5) Moved assumeNoOutOfBounds to ScopBuilder
6) Moved markFortranArrays to ScopBuilder
7) Added iterator range for AccessFunctions vector.

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

llvm-svn: 366374