platform/upstream/llvm.git
6 years ago[dwarfdump] Verify DW_AT_type is set and points to a compatible DIE.
Jonas Devlieghere [Fri, 21 Sep 2018 07:50:21 +0000 (07:50 +0000)]
[dwarfdump] Verify DW_AT_type is set and points to a compatible DIE.

This extends the verifier to catch three new errors:

  * Missing DW_AT_type attributes for DW_TAG_formal_parameter,
    DW_TAG_variable and DW_TAG_array_type.

  * Valid references for DW_AT_type pointing to a non-type tag.

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

llvm-svn: 342713

6 years ago[dwarfdump] Verify compatibility of attribute TAGs.
Jonas Devlieghere [Fri, 21 Sep 2018 07:49:29 +0000 (07:49 +0000)]
[dwarfdump] Verify compatibility of attribute TAGs.

Verify that DW_AT_specification and DW_AT_abstract_origin reference a
DIE with a compatible tag.

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

llvm-svn: 342712

6 years agoRevert "[ADT] restrict bit_cast to trivially-constructible To"
JF Bastien [Fri, 21 Sep 2018 05:34:12 +0000 (05:34 +0000)]
Revert "[ADT] restrict bit_cast to trivially-constructible To"

Of course some bots don't have std::is_trivially_constructible...

llvm-svn: 342711

6 years ago[ADT] restrict bit_cast to trivially-constructible To
JF Bastien [Fri, 21 Sep 2018 05:18:49 +0000 (05:18 +0000)]
[ADT] restrict bit_cast to trivially-constructible To

Summary: As discussed in r341853 by blaikie, the reinterpret_cast was technically an aliasing violation. Restrict our bit_cast implementation to To which are trivially-constructible (and note the existing restriction to constexpr). Once we move to C++17 we can use a version of bit_cast without these restrictions, or if we care we can SFINAE a different implementation when To isn't trivially-constructible.

Reviewers: dblaikie, rsmith

Subscribers: dexonsmith, kristina, llvm-commits

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

llvm-svn: 342710

6 years agoMerge clang's isRepeatedBytePattern with LLVM's isBytewiseValue
JF Bastien [Fri, 21 Sep 2018 05:17:42 +0000 (05:17 +0000)]
Merge clang's isRepeatedBytePattern with LLVM's isBytewiseValue

Summary:
his code was in CGDecl.cpp and really belongs in LLVM's isBytewiseValue. Teach isBytewiseValue the tricks clang's isRepeatedBytePattern had, including merging undef properly, and recursing on more types.

clang part of this patch: D51752

Subscribers: dexonsmith, llvm-commits

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

llvm-svn: 342709

6 years ago[clang-format] Do not merge short case labels if followed by a block.
Owen Pan [Fri, 21 Sep 2018 03:46:36 +0000 (03:46 +0000)]
[clang-format] Do not merge short case labels if followed by a block.

Do not allow short case labels on a single line if the label is followed by a
left brace.

Fixes PR38926.

llvm-svn: 342708

6 years ago[WebAssembly] Revert r342701, "Add WebAssembly to LLVM_ALL_TARGTS."
Dan Gohman [Fri, 21 Sep 2018 03:24:42 +0000 (03:24 +0000)]
[WebAssembly] Revert r342701, "Add WebAssembly to LLVM_ALL_TARGTS."

There is a memory leak which is detected in some of the sanitizer builds.
MCSymbolWasm contains SmallVectors for holding signature information,
however MCContext doesn't run destructors for MCSymbols, so in cases
where the SmallVectors heap-allocate, the memory is leaked.

llvm-svn: 342707

6 years ago[MCA] Remove dependency on CodeGen.
Dean Michael Berris [Fri, 21 Sep 2018 01:54:08 +0000 (01:54 +0000)]
[MCA] Remove dependency on CodeGen.

Summary:
There isn't any actual dependency - there's one #include from CodeGen
but nothing from the header is actually used.

With this change we can use the MCA library from CodeGen without
circular dependencies (e.g. for scheduling).

Reviewers: andreadb

Reviewed By: andreadb

Authored By: orodley

Subscribers: mgorny, gbedwell, llvm-commits

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

llvm-svn: 342706

6 years ago[Docs] [Support] Correct a missed reference and use up to date .inc examples.
Kristina Brooks [Fri, 21 Sep 2018 01:53:51 +0000 (01:53 +0000)]
[Docs] [Support] Correct a missed reference and use up to date .inc examples.

In my original diff I missed #include "llvm/System/Thing.h" and forgot to update a
reference to .inc files a few lines down. This patch corrects these things as
they were missed in revision 342500.

llvm-svn: 342705

6 years ago[ELF] Use the Repl point to avoid the segfault when using ICF
Petr Hosek [Fri, 21 Sep 2018 00:55:42 +0000 (00:55 +0000)]
[ELF] Use the Repl point to avoid the segfault when using ICF

This addresses PR38918.

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

llvm-svn: 342704

6 years ago[MachineCopyPropagation] Refactor copy tracking into a class. NFC
Justin Bogner [Fri, 21 Sep 2018 00:51:04 +0000 (00:51 +0000)]
[MachineCopyPropagation] Refactor copy tracking into a class. NFC

This is a bit easier to follow than handling the copy and src maps
directly in the pass, and will make upcoming changes to how this is
done easier to follow.

llvm-svn: 342703

6 years ago[llvm-objcopy/llvm-strip]: handle --version
Jordan Rupprecht [Fri, 21 Sep 2018 00:47:31 +0000 (00:47 +0000)]
[llvm-objcopy/llvm-strip]: handle --version

Summary:
Implement --version for objcopy and strip.

I think there are LLVM utilities that automatically handle this, but that doesn't seem to work with custom parsing since this binary handles both objcopy and strip, so it uses custom parsing.

This fixes PR38298

Reviewers: jhenderson, alexshap, jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 342702

6 years ago[WebAssembly] Add WebAssembly to LLVM_ALL_TARGTS.
Dan Gohman [Fri, 21 Sep 2018 00:39:57 +0000 (00:39 +0000)]
[WebAssembly] Add WebAssembly to LLVM_ALL_TARGTS.

This makes WebAssembly build by default, rather than requiring
LLVM_EXPERIMENTAL_TARGETS_TO_BUILD!

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

llvm-svn: 342701

6 years ago[MachineCopyPropagation] Minor clang-formatting. NFC
Justin Bogner [Fri, 21 Sep 2018 00:08:33 +0000 (00:08 +0000)]
[MachineCopyPropagation] Minor clang-formatting. NFC

llvm-svn: 342700

6 years ago[lldbtest] Fix self.filecheck check file lookup
Vedant Kumar [Thu, 20 Sep 2018 23:56:39 +0000 (23:56 +0000)]
[lldbtest] Fix self.filecheck check file lookup

The 'test_filename' property in TestBase changes over time, so
attempting to find a check file relative to the directory containing
'test_filename' is flaky.

Use the absolute path of the check file as that's always correct (and
simpler). This relies on the test driver changing into the test
directory, which it seems we can safely assume.

As a drive-by, make self.filecheck respect the trace (-t) option.

llvm-svn: 342699

6 years ago[fuzzer] Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp
Jonathan Metzman [Thu, 20 Sep 2018 23:24:48 +0000 (23:24 +0000)]
[fuzzer] Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp

Summary:
Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp
to get externally defined functions (eg: LLVMFuzzerInitialize,
LLVMFuzzerCustomMutator, etc) working again.

Also enable tests that depended on these functions (on windows)

Reviewers: rnk, morehouse

Reviewed By: rnk, morehouse

Subscribers: rnk, morehouse, mgorny

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

llvm-svn: 342698

6 years agoFix DenseSet::ConstIterator typedefs
David Blaikie [Thu, 20 Sep 2018 23:11:27 +0000 (23:11 +0000)]
Fix DenseSet::ConstIterator typedefs

Fix DenseSet::ConstIterator pointer/reference typedefs to be const

Patch by Brad Moody!

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

llvm-svn: 342697

6 years agoAdd the ability to register callbacks for removal and insertion of MachineInstrs
Aditya Nandakumar [Thu, 20 Sep 2018 23:01:56 +0000 (23:01 +0000)]
Add the ability to register callbacks for removal and insertion of MachineInstrs

https://reviews.llvm.org/D52127

This patch adds the ability to watch for insertions/deletions of
MachineInstructions similar to MachineRegisterInfo.

llvm-svn: 342696

6 years agoMake a member function non-member. NFC.
Rui Ueyama [Thu, 20 Sep 2018 22:58:00 +0000 (22:58 +0000)]
Make a member function non-member. NFC.

Non-member functions are generally preferred over member functions
because it is clear that non-member functions don't depend on an
internal state of an object.

llvm-svn: 342695

6 years agoRemove an unused function
David Blaikie [Thu, 20 Sep 2018 22:48:09 +0000 (22:48 +0000)]
Remove an unused function

llvm-svn: 342694

6 years agoRemove failing test.
Zachary Turner [Thu, 20 Sep 2018 22:32:51 +0000 (22:32 +0000)]
Remove failing test.

Removing on behalf of Jorge Moya.  This test is broken on
Windows due to it actually being able to resolve the path.  There
is an actual Windows-specific bug somewhere, but we already have
sufficient test coverage of this with a different test, so removing
this was the approach suggested by Jorge.

llvm-svn: 342693

6 years agobpf: check illegal usage of XADD insn return value
Yonghong Song [Thu, 20 Sep 2018 22:24:27 +0000 (22:24 +0000)]
bpf: check illegal usage of XADD insn return value

Currently, BPF has XADD (locked add) insn support and the
asm looks like:
  lock *(u32 *)(r1 + 0) += r2
  lock *(u64 *)(r1 + 0) += r2
The instruction itself does not have a return value.

At the source code level, users often use
  __sync_fetch_and_add()
which eventually translates to XADD. The return value of
__sync_fetch_and_add() is supposed to be the old value
in the xadd memory location. Since BPF::XADD insn does not
support such a return value, this patch added a PreEmit
phase to check such a usage. If such an illegal usage
pattern is detected, a fatal error will be reported like
  line 4: Invalid usage of the XADD return value
if compiled with -g, or
  Invalid usage of the XADD return value
if compiled without -g.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 342692

6 years ago[WebAssembly][NFC] Add missing tests for indirect calls
Thomas Lively [Thu, 20 Sep 2018 22:08:27 +0000 (22:08 +0000)]
[WebAssembly][NFC] Add missing tests for indirect calls

Summary: Depends on D52105.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342691

6 years ago[WebAssembly] Add v128 value type
Thomas Lively [Thu, 20 Sep 2018 22:07:18 +0000 (22:07 +0000)]
[WebAssembly] Add v128 value type

Reviewers: sbc100, aheejin, dschuff

Subscribers: jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342690

6 years ago[WebAssembly] Add V128 value type to binary format
Thomas Lively [Thu, 20 Sep 2018 22:04:44 +0000 (22:04 +0000)]
[WebAssembly] Add V128 value type to binary format

Summary: Adds the necessary support to lib/ObjectYAML and fixes SIMD
calls to allow the tests to work. Also removes some dead code that
would otherwise have to have been updated.

Reviewers: aheejin, dschuff, sbc100

Subscribers: jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342689

6 years ago[MachineOutliner][NFC] Don't add MBBs with a size < 2 to the search space
Jessica Paquette [Thu, 20 Sep 2018 21:53:25 +0000 (21:53 +0000)]
[MachineOutliner][NFC] Don't add MBBs with a size < 2 to the search space

The suffix tree won't ever consider sequences with a length less than 2.

Therefore, we really ought to not even consider them in the first place.

Also add a FIXME explaining that this should be defined in terms of the size
in B of an outlined call versus the size in B of the MBB.

llvm-svn: 342688

6 years agoRename a function. NFC.
Rui Ueyama [Thu, 20 Sep 2018 21:40:38 +0000 (21:40 +0000)]
Rename a function. NFC.

llvm-svn: 342687

6 years agoMake variable names shorter. NFC.
Rui Ueyama [Thu, 20 Sep 2018 21:29:14 +0000 (21:29 +0000)]
Make variable names shorter. NFC.

llvm-svn: 342686

6 years agoSimplify. NFC.
Rui Ueyama [Thu, 20 Sep 2018 21:18:56 +0000 (21:18 +0000)]
Simplify. NFC.

llvm-svn: 342685

6 years ago[GlobalDCE] AvailableExternal linkage is checked in isDiscardableIfUnused [NFC].
Xin Tong [Thu, 20 Sep 2018 21:16:16 +0000 (21:16 +0000)]
[GlobalDCE] AvailableExternal linkage is checked in isDiscardableIfUnused [NFC].

Summary:
AvailableExternal was not handled in isDiscardableIfUnused when isDiscardableIfUnused
was added in r158476. Till it was handled in r247044. This is a NFC.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits

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

llvm-svn: 342684

6 years ago[InstCombine] rename test file, simplify tests, regenerate full checks; NFC
Sanjay Patel [Thu, 20 Sep 2018 21:10:14 +0000 (21:10 +0000)]
[InstCombine] rename test file, simplify tests, regenerate full checks; NFC

Fast-math is irrelevant for these transforms.

llvm-svn: 342683

6 years ago[RegAllocGreedy] Fix crash in tryLocalSplit
Walter Lee [Thu, 20 Sep 2018 20:05:57 +0000 (20:05 +0000)]
[RegAllocGreedy] Fix crash in tryLocalSplit

tryLocalSplit only handles a single use block, but an interval may
have multiple use blocks.  So don't crash in that case.  This fixes
PR38795.

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

llvm-svn: 342682

6 years ago[PDB] Fix -Wcovered-switch-default warning.
Zachary Turner [Thu, 20 Sep 2018 19:57:49 +0000 (19:57 +0000)]
[PDB] Fix -Wcovered-switch-default warning.

llvm-svn: 342681

6 years ago[Hwasan] interceptor macro / extra comma removal
David Carlier [Thu, 20 Sep 2018 19:30:51 +0000 (19:30 +0000)]
[Hwasan] interceptor macro / extra comma removal

gcc being pedantic, removing the unnecessary comma.

Reviewers: eugenis, kcc

Reviewed By: eugenis

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

llvm-svn: 342680

6 years agoFix an assert in -Wquoted-include-in-framework-header
Erik Pilkington [Thu, 20 Sep 2018 19:00:03 +0000 (19:00 +0000)]
Fix an assert in -Wquoted-include-in-framework-header

Fixes rdar://43692300

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

llvm-svn: 342679

6 years ago[Bitcode] Address backwards compat bug in r342631
Vedant Kumar [Thu, 20 Sep 2018 18:59:33 +0000 (18:59 +0000)]
[Bitcode] Address backwards compat bug in r342631

r342631 expanded bitc::METADATA_LOCATION by one element. The bitcode
metadata loader was changed in a backwards-incompatible way, leading to
crashes when disassembling old bitcode:

  assertion: empty() && "PlaceholderQueue hasn't been flushed before being destroyed"
  Assertion failed: (empty() && "PlaceholderQueue hasn't been flushed before being destroyed")

This commit teaches the metadata loader to assume that the newly-added
IsImplicitCode bit is 'false' when not present in old bitcode. I've added a
bitcode compat regression test.

rdar://44645820

llvm-svn: 342678

6 years ago[MachineOutliner][NFC] Move debug info emission to createOutlinedFunction
Jessica Paquette [Thu, 20 Sep 2018 18:53:53 +0000 (18:53 +0000)]
[MachineOutliner][NFC] Move debug info emission to createOutlinedFunction

When you create an outlined function, you know everything you need to know
to decide if debug info should be created. If we emit debug info in
createOutlinedFunction, then we don't need to keep track of every IR function
we create.

llvm-svn: 342677

6 years ago[inline Cost] Don't mark functions accessing varargs as non-inlinable
Sameer AbuAsal [Thu, 20 Sep 2018 18:39:34 +0000 (18:39 +0000)]
[inline Cost] Don't mark functions accessing varargs as non-inlinable

Summary:
rL323619 marks functions that are calling va_end as not viable for
inlining. This patch reverses that since this va_end doesn't need
access to the vriadic arguments list that are saved on the stack, only
va_start does.

Reviewers: efriedma, fhahn

Reviewed By: fhahn

Subscribers: eraman, haicheng, llvm-commits

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

llvm-svn: 342675

6 years agoFix -Wtrigraphs.
Rui Ueyama [Thu, 20 Sep 2018 18:26:38 +0000 (18:26 +0000)]
Fix -Wtrigraphs.

llvm-svn: 342674

6 years agoAdd paretntheses around a C macro parameter.
Rui Ueyama [Thu, 20 Sep 2018 18:24:19 +0000 (18:24 +0000)]
Add paretntheses around a C macro parameter.

llvm-svn: 342673

6 years ago[Sema] Retain __restrict qualifiers when substituting a reference type.
Erik Pilkington [Thu, 20 Sep 2018 18:12:24 +0000 (18:12 +0000)]
[Sema] Retain __restrict qualifiers when substituting a reference type.

Fixes rdar://43760099

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

llvm-svn: 342672

6 years agoReplace boolean parameter with enum value according r342633
Tatyana Krasnukha [Thu, 20 Sep 2018 17:57:24 +0000 (17:57 +0000)]
Replace boolean parameter with enum value according r342633

llvm-svn: 342671

6 years agoFix warnings.
Zachary Turner [Thu, 20 Sep 2018 17:48:44 +0000 (17:48 +0000)]
Fix warnings.

llvm-svn: 342670

6 years ago[SelectionDAG] replace duplicated peekThroughBitcast helper functions; NFCI
Sanjay Patel [Thu, 20 Sep 2018 17:34:08 +0000 (17:34 +0000)]
[SelectionDAG] replace duplicated peekThroughBitcast helper functions; NFCI

x86 had 2 versions of peekThroughBitcast. DAGCombiner had 1. Plus, it had a 1-off implementation for the one-use variant.
Move the x86 versions of the code to SelectionDAG, so we don't have different copies of the code.
No functional change intended.

I'm putting this next to isBitwiseNot() because I am planning to use it in there. Another option is next to the
helpers in the ISD namespace (eg, ISD::isConstantSplatVector()). But if there's no good reason for those to be
there, I'd prefer to pull other helpers over to SelectionDAG in follow-up steps.

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

llvm-svn: 342669

6 years agoAdd testcases for r342667.
Eric Christopher [Thu, 20 Sep 2018 17:22:43 +0000 (17:22 +0000)]
Add testcases for r342667.

llvm-svn: 342668

6 years agor342177 introduced a hint in cases where an #included file is not found. It tries...
Eric Christopher [Thu, 20 Sep 2018 17:21:56 +0000 (17:21 +0000)]
r342177 introduced a hint in cases where an #included file is not found. It tries to find a suggestion by removing leading or trailing non-alphanumeric characters and checking if a matching file exists, then it reports an error like:

include-likely-typo.c:3:10: error: '<empty_file_to_include.h>' file not found, did you mean 'empty_file_to_include.h'?
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         "empty_file_to_include.h"
1 error generated.
However, if a hint is not found, the error message will show only the trimmed name we use to look for a hint, so:

will result in:

include-leading-nonalpha-no-suggest.c:3:10: fatal error: 'non_existing_file_to_include.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
where the name reported after "fatal error:" doesn't match what the user wrote.

Patch by Jorge Gorbe!

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

This change reports the original file name instead of the trimmed one when a suggestion is not found.

llvm-svn: 342667

6 years ago[OPENMP] Fix spelling of getLoopCounter (NFC)
Mike Rice [Thu, 20 Sep 2018 17:19:41 +0000 (17:19 +0000)]
[OPENMP] Fix spelling of getLoopCounter (NFC)

llvm-svn: 342666

6 years ago[InstCombine] add tests for vector concat with binop (PR33026); NFC
Sanjay Patel [Thu, 20 Sep 2018 17:10:38 +0000 (17:10 +0000)]
[InstCombine] add tests for vector concat with binop (PR33026); NFC

llvm-svn: 342665

6 years ago[New PM] Introducing PassInstrumentation framework
Fedor Sergeev [Thu, 20 Sep 2018 17:08:45 +0000 (17:08 +0000)]
[New PM] Introducing PassInstrumentation framework

Pass Execution Instrumentation interface enables customizable instrumentation
of pass execution, as per "RFC: Pass Execution Instrumentation interface"
posted 06/07/2018 on llvm-dev@

The intent is to provide a common machinery to implement all
the pass-execution-debugging features like print-before/after,
opt-bisect, time-passes etc.

Here we get a basic implementation consisting of:
* PassInstrumentationCallbacks class that handles registration of callbacks
  and access to them.

* PassInstrumentation class that handles instrumentation-point interfaces
  that call into PassInstrumentationCallbacks.

* Callbacks accept StringRef which is just a name of the Pass right now.
  There were some ideas to pass an opaque wrapper for the pointer to pass instance,
  however it appears that pointer does not actually identify the instance
  (adaptors and managers might have the same address with the pass they govern).
  Hence it was decided to go simple for now and then later decide on what the proper
  mental model of identifying a "pass in a phase of pipeline" is.

* Callbacks accept llvm::Any serving as a wrapper for const IRUnit*, to remove direct dependencies
  on different IRUnits (e.g. Analyses).

* PassInstrumentationAnalysis analysis is explicitly requested from PassManager through
  usual AnalysisManager::getResult. All pass managers were updated to run that
  to get PassInstrumentation object for instrumentation calls.

* Using tuples/index_sequence getAnalysisResult helper to extract generic AnalysisManager's extra
  args out of a generic PassManager's extra args. This is the only way I was able to explicitly
  run getResult for PassInstrumentationAnalysis out of a generic code like PassManager::run or
  RepeatedPass::run.
  TODO: Upon lengthy discussions we agreed to accept this as an initial implementation
  and then get rid of getAnalysisResult by improving RepeatedPass implementation.

* PassBuilder takes PassInstrumentationCallbacks object to pass it further into
  PassInstrumentationAnalysis. Callbacks registration should be performed directly
  through PassInstrumentationCallbacks.

* new-pm tests updated to account for PassInstrumentationAnalysis being run

* Added PassInstrumentation tests to PassBuilderCallbacks unit tests.
  Other unit tests updated with registration of the now-required PassInstrumentationAnalysis.

  Made getName helper to return std::string (instead of StringRef initially) to fix
  asan builtbot failures on CGSCC tests.

Reviewers: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D47858

llvm-svn: 342664

6 years agoRefactor FindVariable() core functionality into StackFrame out of SBFrame
Shafik Yaghmour [Thu, 20 Sep 2018 17:06:34 +0000 (17:06 +0000)]
Refactor FindVariable() core functionality into StackFrame out of SBFrame

rdar://problem/14365983

Patch by Shafik Yaghmour

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

llvm-svn: 342663

6 years ago[ELF][HEXAGON] Set DefaultMaxPageSize to 64K
Sid Manning [Thu, 20 Sep 2018 16:32:19 +0000 (16:32 +0000)]
[ELF][HEXAGON] Set DefaultMaxPageSize to 64K

Update testcase to reflect the change.

llvm-svn: 342662

6 years ago[profile] Fix tests in compiler-rt for patch in gcov (https://reviews.llvm.org/D49659)
Calixte Denizet [Thu, 20 Sep 2018 16:21:09 +0000 (16:21 +0000)]
[profile] Fix tests in compiler-rt for patch in gcov (https://reviews.llvm.org/D49659)

Summary: Some tests are broken if patch in D49659 is accepted so this patch fixes them.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: dberris, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 342661

6 years agoFix one more test failure.
Zachary Turner [Thu, 20 Sep 2018 16:18:15 +0000 (16:18 +0000)]
Fix one more test failure.

llvm-svn: 342660

6 years ago[PDB] Fix failing test.
Zachary Turner [Thu, 20 Sep 2018 16:12:27 +0000 (16:12 +0000)]
[PDB] Fix failing test.

This test was missed on the last run since I only ran a subset
of them before commiting.

llvm-svn: 342659

6 years ago[PDB] Better printing of builtin types when using DIA dumper.
Zachary Turner [Thu, 20 Sep 2018 16:12:05 +0000 (16:12 +0000)]
[PDB] Better printing of builtin types when using DIA dumper.

llvm-svn: 342658

6 years ago[gcov] Fix wrong line hit counts when multiple blocks are on the same line
Calixte Denizet [Thu, 20 Sep 2018 16:09:30 +0000 (16:09 +0000)]
[gcov] Fix wrong line hit counts when multiple blocks are on the same line

Summary:
The goal of this patch is to have the same behaviour than gcc-gcov.
Currently the hit counts for a line is the sum of the counts for each block on that line.
The idea is to detect the cycles in the graph of blocks in using the algorithm by Hawick & James.
The count for a cycle is the min of the counts for each edge in the cycle.
Once we've the count for each cycle, we can sum them and add the transition counts of those cycles.

Fix both https://bugs.llvm.org/show_bug.cgi?id=38065 and https://bugs.llvm.org/show_bug.cgi?id=38066

Reviewers: marco-c, davidxl

Reviewed By: marco-c

Subscribers: vsk, lebedev.ri, sylvestre.ledru, dblaikie, llvm-commits

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

llvm-svn: 342657

6 years ago[PDB] Add the ability to map forward references to full decls.
Zachary Turner [Thu, 20 Sep 2018 15:50:13 +0000 (15:50 +0000)]
[PDB] Add the ability to map forward references to full decls.

Some records point to an LF_CLASS, LF_UNION, LF_STRUCTURE, or LF_ENUM
which is a forward reference and doesn't contain complete debug
information. In these cases, we'd like to be able to quickly locate the
full record. The TPI stream stores an array of pre-computed record hash
values, one for each type record. If we pre-process this on startup, we
can build a mapping from hash value -> {list of possible matching type
indices}. Since hashes of full records are only based on the name and or
unique name and not the full record contents, we can then use forward
ref record to compute the hash of what *would* be the full record by
just hashing the name, use this to get the list of possible matches, and
iterate those looking for a match on name or unique name.

llvm-pdbutil is updated to resolve forward references for the purposes
of testing (plus it's just useful).

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

llvm-svn: 342656

6 years ago[llvm-mca][BtVer2] Modify ANDN tests in zero-idioms-avx-256.s. NFC
Andrea Di Biagio [Thu, 20 Sep 2018 15:48:23 +0000 (15:48 +0000)]
[llvm-mca][BtVer2] Modify ANDN tests in zero-idioms-avx-256.s. NFC

Two test cases should have tested 256-bit variants of VANDN zero-idioms instead
of the 128-bit variants.

llvm-svn: 342655

6 years agoFix test after r342652
David Major [Thu, 20 Sep 2018 15:22:21 +0000 (15:22 +0000)]
Fix test after r342652

llvm-svn: 342654

6 years ago[IR] add shuffle query for vector concatenation
Sanjay Patel [Thu, 20 Sep 2018 15:21:52 +0000 (15:21 +0000)]
[IR] add shuffle query for vector concatenation

This can be used for combining and in the vectorizers/cost models.

llvm-svn: 342653

6 years ago[winasan] Unpoison the stack in NtTerminateThread
David Major [Thu, 20 Sep 2018 14:59:33 +0000 (14:59 +0000)]
[winasan] Unpoison the stack in NtTerminateThread

In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall.

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

llvm-svn: 342652

6 years ago[sanitizer] Make __sanitizer::CheckFailed not public
Kostya Kortchinsky [Thu, 20 Sep 2018 14:50:06 +0000 (14:50 +0000)]
[sanitizer] Make __sanitizer::CheckFailed not public

Summary:
As far as I can tell, there is no reason why `__sanitizer::CheckFailed` should
be exported. Looking back in time, it was added with the FIXME with the
following by @timurrrr:

```
[*San/RTL] Fix minor breakage
Grumbling: this hasn't been caught by running 'make check-{a,l,t}san check-sanitizer'
```

I can't find any detail about the breakage, all tests seem to work for me, so
maybe Windows (@rnk?) or something I have no setup for.

The reason to make it private (past the FIXME) is that Scudo defines its own
(without callback) and I am trying to make the .so be loadable with the UBsan
one (that has its own public `CheckFailed`) with as little drama as possible.

Reviewers: eugenis, rnk

Reviewed By: eugenis, rnk

Subscribers: kubamracek, delcypher, #sanitizers, timurrrr, rnk, llvm-commits

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

llvm-svn: 342651

6 years ago[IR] reduce duplication in unittest for shuffles; NFC
Sanjay Patel [Thu, 20 Sep 2018 14:36:09 +0000 (14:36 +0000)]
[IR] reduce duplication in unittest for shuffles; NFC

llvm-svn: 342650

6 years ago[winasan] Reduce hotpatch prefix check to 8 bytes
David Major [Thu, 20 Sep 2018 14:28:50 +0000 (14:28 +0000)]
[winasan] Reduce hotpatch prefix check to 8 bytes

Same idea as r310419: The 8 byte nop is a suffix of the 9 byte nop, and we need at most 6 bytes.

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

llvm-svn: 342649

6 years ago[OPENMP] Add support for mapping memory pointed by member pointer.
Alexey Bataev [Thu, 20 Sep 2018 13:54:02 +0000 (13:54 +0000)]
[OPENMP] Add support for mapping memory pointed by member pointer.

Added support for map(s, s.ptr[0:1]) kind of mapping.

llvm-svn: 342648

6 years ago[InstCombine] Handle vector compares in foldGEPIcmp()
Jesper Antonsson [Thu, 20 Sep 2018 13:37:28 +0000 (13:37 +0000)]
[InstCombine] Handle vector compares in foldGEPIcmp()

Summary:
This is to fix PR38984 "InstCombine assertion at vector gep/icmp folding":
https://bugs.llvm.org/show_bug.cgi?id=38984

Reviewers: majnemer, spatel, lattner, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 342647

6 years ago[llvm-exegesis] Fix broken build bots.
Guillaume Chatelet [Thu, 20 Sep 2018 13:37:04 +0000 (13:37 +0000)]
[llvm-exegesis] Fix broken build bots.

Reviewers: javed.absar

Subscribers: tschuett, courbet, llvm-commits

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

llvm-svn: 342646

6 years ago[X86][SSE] Remove UNPCKL(SHUFFLE)->UNPCKH custom combine
Simon Pilgrim [Thu, 20 Sep 2018 13:10:22 +0000 (13:10 +0000)]
[X86][SSE] Remove UNPCKL(SHUFFLE)->UNPCKH custom combine

This can be achieved more generally by combineX86ShufflesRecursively.

llvm-svn: 342645

6 years ago[llvm-exegesis] Improve Register Setup (roll forward of D51856).
Guillaume Chatelet [Thu, 20 Sep 2018 12:22:18 +0000 (12:22 +0000)]
[llvm-exegesis] Improve Register Setup (roll forward of D51856).

Summary:
Added function to set a register to a particular value + tests.
Add EFLAGS test, use new setRegTo instead of setRegToConstant.

Reviewers: courbet, javed.absar

Subscribers: llvm-commits, tschuett, mgorny

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

llvm-svn: 342644

6 years ago[ADT] Bring back memmove to make GCC 5.4 happy
Benjamin Kramer [Thu, 20 Sep 2018 12:21:24 +0000 (12:21 +0000)]
[ADT] Bring back memmove to make GCC 5.4 happy

All other GCCs look good so far. GCC 5.4 complains about strict
aliasing, so fix that.

llvm-svn: 342643

6 years ago[X86][SSE] Remove PSHUFLW/PSHUFHW combineRedundantHalfShuffle combine
Simon Pilgrim [Thu, 20 Sep 2018 12:11:38 +0000 (12:11 +0000)]
[X86][SSE] Remove PSHUFLW/PSHUFHW combineRedundantHalfShuffle combine

This can be achieved more generally by combineX86ShufflesRecursively and was causing a fuzz test failure found by Mikael Holmén.

llvm-svn: 342642

6 years ago[RISCV][MC] Modify evaluateConstantImm interface to allow reuse from addExpr
Alex Bradbury [Thu, 20 Sep 2018 11:40:43 +0000 (11:40 +0000)]
[RISCV][MC] Modify evaluateConstantImm interface to allow reuse from addExpr

This is a trivial refactoring that I'm committing now as it makes a patch I'm
about to post for review easier to follow. There is some overlap between
evaluateConstantImm and addExpr in RISCVAsmParser. This patch allows
evaluateConstantImm to be reused from addExpr to remove this overlap. The
benefit will be greater when a future patch adds extra code to allows
immediates to be evaluated from constant symbols (e.g. `.equ CONST, 0x1234`).

No functional change intended.

llvm-svn: 342641

6 years agoFix -Wdocumentation warnings introduced by r342555. NFC
Andrea Di Biagio [Thu, 20 Sep 2018 11:07:57 +0000 (11:07 +0000)]
Fix -Wdocumentation warnings introduced by r342555. NFC

These were reported by buildbot llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast (see
build #36798).

llvm-svn: 342640

6 years agoFix line-endings. NFCI.
Simon Pilgrim [Thu, 20 Sep 2018 10:59:08 +0000 (10:59 +0000)]
Fix line-endings. NFCI.

llvm-svn: 342639

6 years ago[OpenCL] Diagnose redundant address space conversion
Sven van Haastregt [Thu, 20 Sep 2018 10:07:27 +0000 (10:07 +0000)]
[OpenCL] Diagnose redundant address space conversion

Add a warning if a parameter with a named address space is passed
to a to_addr builtin.

For example:

  int i;
  to_private(&i); // generate warning as conversion from private to private is redundant.

Patch by Alistair Davies.

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

llvm-svn: 342638

6 years ago[ADT] Try again to use the same version of llvm::Optional on all compilers
Benjamin Kramer [Thu, 20 Sep 2018 10:02:06 +0000 (10:02 +0000)]
[ADT] Try again to use the same version of llvm::Optional on all compilers

The miscompile doesn't reproduce for me anymore with GCC 7.3. I'll watch
the buildbots closely.

Having different versions of Optional is an ABI violation when linking
GCC- and clang-built code together.

llvm-svn: 342637

6 years agoFileCheckify test/Driver/Xarch.c
Hans Wennborg [Thu, 20 Sep 2018 09:29:35 +0000 (09:29 +0000)]
FileCheckify test/Driver/Xarch.c

llvm-svn: 342636

6 years ago[DWARF] - Emit the correct value for DW_AT_addr_base.
George Rimar [Thu, 20 Sep 2018 09:17:36 +0000 (09:17 +0000)]
[DWARF] - Emit the correct value for DW_AT_addr_base.

Currently, we emit DW_AT_addr_base that points to the beginning of
the .debug_addr section. That is not correct for the DWARF5 case because address
table contains the header and the attribute should point to the first entry
following the header.

This is currently the reason why LLDB does not work with such executables correctly.
Patch fixes the issue.

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

llvm-svn: 342635

6 years ago[target] Change target create's behavior wrt loading dependent files.
Jonas Devlieghere [Thu, 20 Sep 2018 09:09:13 +0000 (09:09 +0000)]
[target] Change target create's behavior wrt loading dependent files.

When creating a target, lldb loads all dependent files (i.e. libs in
LC_LOAD_DYLIB for Mach-O). This can be confusing, especially when two
versions of the same library end up in the shared cache. It's possible
to change this behavior, by specifying  target create -d <target> these
dependents are not loaded.

This patch changes the default behavior to only load dependent files
only when the target is an executable. When creating a target for a
library, it is now no longer necessary to pass -d. The user can still
override this behavior by specifying the -d option to change this
behavior.

rdar://problem/43721382

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

llvm-svn: 342634

6 years ago[NFC] Turn "load dependent files" boolean into an enum
Jonas Devlieghere [Thu, 20 Sep 2018 09:09:05 +0000 (09:09 +0000)]
[NFC] Turn "load dependent files" boolean into an enum

This is an NFC commit to refactor the "load dependent files" parameter
from a boolean to an enum value. We want to be able to specify a
default, in which case we decide whether or not to load the dependent
files based on whether the target is an executable or not (i.e. a
dylib).

This is a dependency for D51934.

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

llvm-svn: 342633

6 years ago[IPSCCP] Fix a problem with removing labels in a switch with undef condition
Bjorn Pettersson [Thu, 20 Sep 2018 09:00:17 +0000 (09:00 +0000)]
[IPSCCP] Fix a problem with removing labels in a switch with undef condition

Summary:
Before removing basic blocks that ipsccp has considered as dead
all uses of the basic block label must be removed. That is done
by calling ConstantFoldTerminator on the users. An exception
is when the branch condition is an undef value. In such
scenarios ipsccp is using some internal assumptions regarding
which edge in the control flow that should remain, while
ConstantFoldTerminator don't know how to fold the terminator.

The problem addressed here is related to ConstantFoldTerminator's
ability to rewrite a 'switch' into a conditional 'br'. In such
situations ConstantFoldTerminator returns true indicating that
the terminator has been rewritten. However, ipsccp treated the
true value as if the edge to the dead basic block had been
removed. So the code for resolving an undef branch condition
did not trigger, and we ended up with assertion that there were
uses remaining when deleting the basic block.

The solution is to resolve indeterminate branches before the
call to ConstantFoldTerminator.

Reviewers: efriedma, fhahn, davide

Reviewed By: fhahn

Subscribers: llvm-commits

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

llvm-svn: 342632

6 years ago[IR] Add a boolean field in DILocation to know if a line must covered or not
Calixte Denizet [Thu, 20 Sep 2018 08:53:06 +0000 (08:53 +0000)]
[IR] Add a boolean field in DILocation to know if a line must covered or not

Summary:
Some lines have a hit counter where they should not have one.
For example, in C++, some cleanup is adding at the end of a scope represented by a '}'.
So such a line has a hit counter where a user expects to not have one.
The goal of the patch is to add this information in DILocation which is used to get the covered lines in GCOVProfiling.cpp.
A following patch in clang will add this information when generating IR (https://reviews.llvm.org/D49916).

Reviewers: marco-c, davidxl, vsk, javed.absar, rnk

Reviewed By: rnk

Subscribers: eraman, xur, danielcdh, aprantl, rnk, dblaikie, #debug-info, vsk, llvm-commits, sylvestre.ledru

Tags: #debug-info

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

llvm-svn: 342631

6 years ago[RISCV][MC] Improve parsing of jal/j operands
Alex Bradbury [Thu, 20 Sep 2018 08:10:35 +0000 (08:10 +0000)]
[RISCV][MC] Improve parsing of jal/j operands

Examples such as `jal a3`, `j a3` and `jal a3, a3` are accepted by gas
but rejected by LLVM MC. This patch rectifies this. I introduce
RISCVAsmParser::parseJALOffset to ensure that symbol names that coincide with
register names can safely be parsed. This is made a somewhat fiddly due to the
single-operand alias form (see the comment in parseJALOffset for more info).

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

llvm-svn: 342629

6 years agofix some typos in the doc
Sylvestre Ledru [Thu, 20 Sep 2018 08:05:01 +0000 (08:05 +0000)]
fix some typos in the doc

llvm-svn: 342628

6 years agoadd a quick link to libc++
Sylvestre Ledru [Thu, 20 Sep 2018 08:01:16 +0000 (08:01 +0000)]
add a quick link to libc++

llvm-svn: 342627

6 years agoadd a quick link to libc++abi
Sylvestre Ledru [Thu, 20 Sep 2018 07:58:43 +0000 (07:58 +0000)]
add a quick link to libc++abi

llvm-svn: 342625

6 years agorefresh the libc++ homepage
Sylvestre Ledru [Thu, 20 Sep 2018 07:57:31 +0000 (07:57 +0000)]
refresh the libc++ homepage

llvm-svn: 342624

6 years ago[NFC][x86][AArch64] Add BEXTR-like test patterns.
Roman Lebedev [Thu, 20 Sep 2018 07:54:49 +0000 (07:54 +0000)]
[NFC][x86][AArch64] Add BEXTR-like test patterns.

Summary: Also, adjust the check prefixes so that we actually get to check the BMI1-only-case.

Reviewers: craig.topper, RKSimon, spatel, javed.absar

Reviewed By: RKSimon

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 342623

6 years agoImprove the doc about the initial commit email sent to the ML
Sylvestre Ledru [Thu, 20 Sep 2018 07:43:24 +0000 (07:43 +0000)]
Improve the doc about the initial commit email sent to the ML

llvm-svn: 342622

6 years ago[MachineVerifier] Relax checkLivenessAtDef regarding dead subreg defs
Bjorn Pettersson [Thu, 20 Sep 2018 06:59:18 +0000 (06:59 +0000)]
[MachineVerifier] Relax checkLivenessAtDef regarding dead subreg defs

Summary:
Consider an instruction that has multiple defs of the same
vreg, but defining different subregs:
  %7.sub1:rc, dead %7.sub2:rc = inst

Calling checkLivenessAtDef for the live interval associated
with %7 incorrectly reported "live range continues after a
dead def". The live range for %7 has a dead def at the slot
index for "inst" even if the live range continues (given that
there are later uses of %7.sub1).

This patch adjusts MachineVerifier::checkLivenessAtDef
to allow dead subregister definitions, unless we are checking
a subrange (when tracking subregister liveness).

A limitation is that we do not detect the situation when the
live range continues past an instruction that defines the
full virtual register by multiple dead subreg defines.

I also removed some dead code related to physical register
in checkLivenessAtDef. Wwe only call that method for virtual
registers, so I added an assertion instead.

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: llvm-commits

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

llvm-svn: 342618

6 years ago[XRay][compiler-rt] FDRLogWriter Abstraction
Dean Michael Berris [Thu, 20 Sep 2018 05:22:37 +0000 (05:22 +0000)]
[XRay][compiler-rt] FDRLogWriter Abstraction

Summary:
This change introduces an `FDRLogWriter` type which is responsible for
serialising metadata and function records to character buffers. This is
the first step in a refactoring of the implementation of the FDR runtime
to allow for more granular testing of the individual components of the
implementation.

The main contribution of this change is a means of hiding the details of
how specific records are written to a buffer, and for managing the
extents of these buffers. We make use of C++ features (templates and
some metaprogramming) to reduce repetition in the act of writing out
specific kinds of records to the buffer.

In this process, we make a number of changes across both LLVM and
compiler-rt to allow us to use the `Trace` abstraction defined in the
LLVM project in the testing of the runtime implementation. This gives us
a closer end-to-end test which version-locks the runtime implementation
with the loading implementation in LLVM.

We also allow using gmock in compiler-rt unit tests, by adding the
requisite definitions in the `AddCompilerRT.cmake` module. We also add
the terminfo library detection along with inclusion of the appropriate
compiler flags for header include lookup.

Finally, we've gone ahead and updated the FDR logging implementation to
use the FDRLogWriter for the lowest-level record-writing details.

Following patches will isolate the state machine transitions which
manage the set-up and tear-down of the buffers we're using in multiple
threads.

Reviewers: mboerger, eizan

Subscribers: mgorny, jfb, llvm-commits

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

llvm-svn: 342617

6 years agoTemporarily Revert "[New PM] Introducing PassInstrumentation framework"
Eric Christopher [Thu, 20 Sep 2018 05:16:29 +0000 (05:16 +0000)]
Temporarily Revert "[New PM] Introducing PassInstrumentation framework"
as it was causing failures in the asan buildbot.

This reverts commit r342597.

llvm-svn: 342616

6 years agoFix for bug 34002 - label generated before it block is finalized. Differential Revisi...
Maya Madhavan [Thu, 20 Sep 2018 05:11:42 +0000 (05:11 +0000)]
Fix for bug 34002 - label generated before it block is finalized. Differential Revision: https://reviews.llvm.org/D52258

llvm-svn: 342615

6 years ago[PowerPC] [Clang] Add vector int128 pack/unpack builtins
QingShan Zhang [Thu, 20 Sep 2018 05:04:57 +0000 (05:04 +0000)]
[PowerPC] [Clang] Add vector int128 pack/unpack builtins

unsigned long long builtin_unpack_vector_int128 (vector int128_t, int);
vector int128_t builtin_pack_vector_int128 (unsigned long long, unsigned long long);

Builtins should behave the same way as in GCC.

Patch By: wuzish (Zixuan Wu)
Differential Revision: https://reviews.llvm.org/D52074

llvm-svn: 342614

6 years ago[unittests] Do not use llvm::sort in googlemock
Dean Michael Berris [Thu, 20 Sep 2018 04:27:32 +0000 (04:27 +0000)]
[unittests] Do not use llvm::sort in googlemock

Summary:
This reverts r329475 which applied to googlemock. This change makes the
googlemock implementation in LLVM dependent on LLVM unnecessarily.

Reviewers: echristo, mgrang

Subscribers: llvm-commits

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

llvm-svn: 342612

6 years ago[PowerPC] Fix the assert of combineBVOfConsecutiveLoads when element num is 1
QingShan Zhang [Thu, 20 Sep 2018 03:09:15 +0000 (03:09 +0000)]
[PowerPC] Fix the assert of combineBVOfConsecutiveLoads when element num is 1
Building a vector out of multiple loads can be converted to a load of the vector type if the loads are consecutive.
But the special condition is that the element number is 1, such as <1 x i128>. So just early exit to fix the assert.

Patch By: wuzish (Zixuan Wu)
Differential Revision: https://reviews.llvm.org/D52072

llvm-svn: 342611

6 years ago[WebAssembly] Renumber SIMD ops
Thomas Lively [Thu, 20 Sep 2018 02:55:28 +0000 (02:55 +0000)]
[WebAssembly] Renumber SIMD ops

Summary:
This change leaves holes in the opcode space where missing
instructions could logically be added later if they were found to be
useful.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342610

6 years agoFix diagnostic regex in variant tests to tolerate older clang versions
Eric Fiselier [Thu, 20 Sep 2018 01:15:17 +0000 (01:15 +0000)]
Fix diagnostic regex in variant tests to tolerate older clang versions

llvm-svn: 342609

6 years ago[builtins] Add __emutls_unregister_key function
Yi Kong [Thu, 20 Sep 2018 01:02:13 +0000 (01:02 +0000)]
[builtins] Add __emutls_unregister_key function

This is called by Bionic on dlclose to delete the emutls pthread key.

The return value of pthread_key_delete is unchecked and behaviour of
multiple calls to the method is dependent on the implementation of
pthread_key_delete.

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

llvm-svn: 342608

6 years agoThread Safety Analysis: warnings for attributes without arguments
Aaron Puchert [Thu, 20 Sep 2018 00:39:27 +0000 (00:39 +0000)]
Thread Safety Analysis: warnings for attributes without arguments

Summary:
When thread safety annotations are used without capability arguments,
they are assumed to apply to `this` instead. So we warn when either
`this` doesn't exist, or the class is not a capability type.

This is based on earlier work by Josh Gao that was committed in r310403,
but reverted in r310698 because it didn't properly work in template
classes. See also D36237.

The solution is not to go via the QualType of `this`, which is then a
template type, hence the attributes are not known because it could be
specialized. Instead we look directly at the class in which we are
contained.

Additionally I grouped two of the warnings together. There are two
issues here: the existence of `this`, which requires us to be a
non-static member function, and the appropriate annotation on the class
we are contained in. So we don't distinguish between not being in a
class and being static, because in both cases we don't have `this`.

Fixes PR38399.

Reviewers: aaron.ballman, delesley, jmgao, rtrieu

Reviewed By: delesley

Subscribers: cfe-commits

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

llvm-svn: 342605