platform/upstream/llvm.git
6 years agoRevert "(Retry) Add a basic integration test for C++ smart pointers"
Vedant Kumar [Mon, 20 Aug 2018 19:53:33 +0000 (19:53 +0000)]
Revert "(Retry) Add a basic integration test for C++ smart pointers"

This reverts r340189. The new test is still failing on some
Apple-internal bots.

llvm-svn: 340204

6 years agoMove Itanium demangler implementation into a header file and add visitation support.
Richard Smith [Mon, 20 Aug 2018 19:44:01 +0000 (19:44 +0000)]
Move Itanium demangler implementation into a header file and add visitation support.

Summary:
This transforms the Itanium demangler into a generic reusable library that can
be used to build, traverse, and transform Itanium mangled name trees.

This is in preparation for adding a canonicalizing demangler, which
cannot live in the Demangle library for layering reasons. In order to
keep the diffs simpler, this patch moves more code to the new header
than is strictly necessary: in particular, all of the printLeft /
printRight implementations can be moved to the implementation file.
(And indeed we could make them non-virtual now if we wished, and remove
the vptr from Node.)

All nodes are now included in the Kind enumeration, rather than omitting
some of the Expr nodes, and the three different floating-point literal
node types now have distinct Kind values.

As a proof of concept for the visitation / matching mechanism, this
patch implements a Node dumping facility on top of it, replacing the
prior mechanism that produced the pretty-printed output rather than a
tree dump. Sample dump output:

FunctionEncoding(
  NameType("int"),
  NameWithTemplateArgs(
    NestedName(
      NameWithTemplateArgs(
        NameType("A"),
        TemplateArgs(
          {NameType("B")})),
      NameType("f")),
    TemplateArgs(
      {NameType("int")})),
  {},
  <null>,
  QualConst, FunctionRefQual::FrefQualLValue)

As a next step, it would make sense to move the LLVM high-level interface to
the demangler (the itaniumDemangler function and ItaniumPartialDemangler class)
into the Support library, and implement them in terms of the Demangle library.
This would allow the libc++abi demangler implementation to be an identical copy
of the llvm Demangle library, and would allow the LLVM implementation to reuse
LLVM components such as llvm::BumpPtrAllocator, but we'll need to decide how to
coordinate that with the MS ABI demangler, so I'm not doing that in this patch.

No functionality change intended other than the behavior of dump().

Reviewers: erik.pilkington, zturner, chandlerc, dlj

Subscribers: aheejin, llvm-commits

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

llvm-svn: 340203

6 years agoRevert "AMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space"
Vitaly Buka [Mon, 20 Aug 2018 19:31:03 +0000 (19:31 +0000)]
Revert "AMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space"

As it introduces out of bound access.

This reverts commit r340172 and r340171

llvm-svn: 340202

6 years ago[FPEnv] Support constrained FREM intrinsic
Cameron McInally [Mon, 20 Aug 2018 19:28:56 +0000 (19:28 +0000)]
[FPEnv] Support constrained FREM intrinsic

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

llvm-svn: 340201

6 years ago[PSV] Update API to be able to use TargetCustom without UB.
Marcello Maggioni [Mon, 20 Aug 2018 19:23:45 +0000 (19:23 +0000)]
[PSV] Update API to be able to use TargetCustom without UB.

getTargetCustom() requires values for "Kind" in the constructor
that are not in the PSVKind enum. Passing a value that is not inside
an enum as an argument to a constructor of the type of the enum is
UB. Changing to the underlying type of the enum would solve the UB

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

llvm-svn: 340200

6 years ago[MS Demangler] Demangle member pointer template parameters.
Zachary Turner [Mon, 20 Aug 2018 19:15:35 +0000 (19:15 +0000)]
[MS Demangler] Demangle member pointer template parameters.

llvm-svn: 340199

6 years ago[Lex] Make HeaderMaps a unique_ptr vector
Fangrui Song [Mon, 20 Aug 2018 19:15:02 +0000 (19:15 +0000)]
[Lex] Make HeaderMaps a unique_ptr vector

Summary: unique_ptr makes the ownership clearer than a raw pointer container.

Reviewers: Eugene.Zelenko, dblaikie

Subscribers: cfe-commits

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

llvm-svn: 340198

6 years agoRevert "Revert r339977: [GISel]: Add Opcodes for a few LLVM Intrinsics"
Aditya Nandakumar [Mon, 20 Aug 2018 18:43:19 +0000 (18:43 +0000)]
Revert "Revert r339977: [GISel]: Add Opcodes for a few LLVM Intrinsics"

This reverts commit 7debc334e6421bb5251ef8f18e97166dfc7dd787.

I missed updating legalizer-info-validation.mir as I had assertions
turned off in my build and that specific test requires asserts. Fixed it
now.

llvm-svn: 340197

6 years ago[TargetLowering] Disable BuildSDiv division by one or negone.
Simon Pilgrim [Mon, 20 Aug 2018 18:23:54 +0000 (18:23 +0000)]
[TargetLowering] Disable BuildSDiv division by one or negone.

Fuzz tests have detected an issue, currently working on a fix.

llvm-svn: 340195

6 years ago[ConstantFolding] improve folding of binops with vector undef operand
Sanjay Patel [Mon, 20 Aug 2018 18:19:02 +0000 (18:19 +0000)]
[ConstantFolding] improve folding of binops with vector undef operand

A non-undef operand may still have undef constant elements,
so we should always propagate the vector results per-lane.

llvm-svn: 340194

6 years agoRename -mlink-cuda-bitcode to -mlink-builtin-bitcode
Matt Arsenault [Mon, 20 Aug 2018 18:16:48 +0000 (18:16 +0000)]
Rename -mlink-cuda-bitcode to -mlink-builtin-bitcode

The same semantics work for OpenCL, and probably any offload
language. Keep the old name around as an alias.

llvm-svn: 340193

6 years ago[MemorySSA] Update comment to better describe cfg change (NFC).
Alina Sbirlea [Mon, 20 Aug 2018 18:15:02 +0000 (18:15 +0000)]
[MemorySSA] Update comment to better describe cfg change (NFC).

llvm-svn: 340192

6 years ago[OPENMP] Fix crash on the emission of the weak function declaration.
Alexey Bataev [Mon, 20 Aug 2018 18:03:40 +0000 (18:03 +0000)]
[OPENMP] Fix crash on the emission of the weak function declaration.

If the function is actually a weak reference, it should not be marked as
deferred definition as this is only a declaration. Patch adds checks for
the definitions if they must be emitted. Otherwise, only declaration is
emitted.

llvm-svn: 340191

6 years ago[ConstantFolding] add tests for binops on vectors with undef elements; NFC
Sanjay Patel [Mon, 20 Aug 2018 17:31:34 +0000 (17:31 +0000)]
[ConstantFolding] add tests for binops on vectors with undef elements; NFC

llvm-svn: 340190

6 years ago(Retry) Add a basic integration test for C++ smart pointers
Vedant Kumar [Mon, 20 Aug 2018 17:17:38 +0000 (17:17 +0000)]
(Retry) Add a basic integration test for C++ smart pointers

Check that the debugger can pretty-print unique_ptr and shared_ptr when
passed as a function argument.

This was reverted in r339961 because of a bug in the version of lldb
installed on the public Green Dragon builders.

rdar://42314305

llvm-svn: 340189

6 years agoClose FileEntries of cached files in ModuleManager::addModule().
Adrian Prantl [Mon, 20 Aug 2018 17:10:27 +0000 (17:10 +0000)]
Close FileEntries of cached files in ModuleManager::addModule().

While investigating why LLDB (which can build hundreds of clang
modules during one debug session) was getting "too many open files"
errors, I found that most of them are .pcm files that are kept open by
ModuleManager. Pretty much all of the open file dscriptors are
FileEntries that are refering to `.pcm` files for which a buffer
already exists in a CompilerInstance's PCMCache.

Before PCMCache was added it was necessary to hold on to open file
descriptors to ensure that all ModuleManagers using the same
FileManager read the a consistent version of a given `.pcm` file on
disk, even when a concurrent clang process overwrites the file halfway
through. The PCMCache makes this practice unnecessary, since it caches
the entire contents of a `.pcm` file, while the FileManager caches all
the stat() information.

This patch adds a call to FileEntry::closeFile() to the path where a
Buffer has already been created. This is necessary because even for a
freshly written `.pcm` file the file is stat()ed once immediately
after writing to generate a FileEntry in the FileManager. Because a
freshly-generated file's contents is stored in the PCMCache, it is
fine to close the file immediately thereafter.  The second change this
patch makes is to set the `ShouldClose` flag to true when reading a
`.pcm` file into the PCMCache for the first time.

[For reference, in 1 Clang instance there is
     - 1 FileManager and
     - n ModuleManagers with
     - n PCMCaches.]

rdar://problem/40906753

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

llvm-svn: 340188

6 years agoValueTracking: Handle more instructions in isKnownNeverNaN
Matt Arsenault [Mon, 20 Aug 2018 16:51:00 +0000 (16:51 +0000)]
ValueTracking: Handle more instructions in isKnownNeverNaN

llvm-svn: 340187

6 years agoRevert rr340111 "[GISel]: Add Legalization/lowering code for bit counting operations"
Reid Kleckner [Mon, 20 Aug 2018 16:50:19 +0000 (16:50 +0000)]
Revert rr340111 "[GISel]: Add Legalization/lowering code for bit counting operations"

It causes LegalizerHelperTest.LowerBitCountingCTTZ1 to fail.

llvm-svn: 340186

6 years agoAdd cmake option to disable minidumps, default it to off
Reid Kleckner [Mon, 20 Aug 2018 16:49:54 +0000 (16:49 +0000)]
Add cmake option to disable minidumps, default it to off

Since crash dumping landed in r268519, May 2016, I have not once seen
anyone use an uploaded minidump to debug a compiler crash. Therefore,
I'm turning this off by default. The dumps clutter up user and buildbot
temp directories. Each file is only about 56KB, but it adds up.

In the context of clang, the extra line about the minidump confuses
users, when what we really want from them is the pre-processed source
code.

llvm-svn: 340185

6 years ago[InstCombine] add tests for insertelement+binop; NFC
Sanjay Patel [Mon, 20 Aug 2018 16:49:08 +0000 (16:49 +0000)]
[InstCombine] add tests for insertelement+binop; NFC

llvm-svn: 340184

6 years ago[ASTImporter] Add test for C++ casts and fix broken const_cast importing.
Raphael Isemann [Mon, 20 Aug 2018 16:20:01 +0000 (16:20 +0000)]
[ASTImporter] Add test for C++ casts and fix broken const_cast importing.

Summary:
The ASTImporter does currently not handle const_casts. This patch adds the
missing const_cast importer code and the test case that discovered this.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 340182

6 years ago[OPENMP][BLOCKS]Fix PR38923: reference to a global variable is captured
Alexey Bataev [Mon, 20 Aug 2018 16:00:22 +0000 (16:00 +0000)]
[OPENMP][BLOCKS]Fix PR38923: reference to a global variable is captured
by a block.

Added checks for capturing of the variable in the block when trying to
emit correct address for the variable with the reference type. This
extra check allows correctly identify the variables that are not
captured in the block context.

llvm-svn: 340181

6 years ago[ASTImporter] Test for importing condition variable from a ForStmt
Raphael Isemann [Mon, 20 Aug 2018 15:51:41 +0000 (15:51 +0000)]
[ASTImporter] Test for importing condition variable from a ForStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: cfe-commits, martong

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

llvm-svn: 340180

6 years agoRemove manual byte counting from Opcode::Dump
Raphael Isemann [Mon, 20 Aug 2018 15:51:14 +0000 (15:51 +0000)]
Remove manual byte counting from Opcode::Dump

Summary:
Stream now has byte-counting functionality, so let's use this instead of manual byte
counting.

Reviewers: clayborg, davide

Reviewed By: davide

Subscribers: davide, lldb-commits

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

llvm-svn: 340179

6 years ago[sanitizer] Use private futex operations for BlockingMutex
Kostya Kortchinsky [Mon, 20 Aug 2018 14:57:58 +0000 (14:57 +0000)]
[sanitizer] Use private futex operations for BlockingMutex

Summary:
Use `FUTEX_PRIVATE_FLAG` in conjunction with the wait & wake operations
employed by `BlockingMutex`. As far as I can tell, the mutexes are
process-private, and there is an actual performance benefit at employing the
private operations. There should be no downside to switching to it.

Reviewers: eugenis, alekseyshl, dvyukov

Reviewed By: dvyukov

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

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

llvm-svn: 340178

6 years ago[llvm-mca] Make the LSUnit a HardwareUnit, and allow derived classes to implement...
Andrea Di Biagio [Mon, 20 Aug 2018 14:41:36 +0000 (14:41 +0000)]
[llvm-mca] Make the LSUnit a HardwareUnit, and allow derived classes to implement a different memory consistency model.

The LSUnit is now a HardwareUnit, and it is owned by the mca::Context.
Derived classes can now implement a different consistency model by overriding
method `LSUnit::isReady()`.

This patch also slightly refactors the Scheduler interface in the attempt to
simplifying the interaction between ExecuteStage and the underlying Scheduler.

llvm-svn: 340176

6 years ago[clangd] DexIndex implementation prototype
Kirill Bobyrev [Mon, 20 Aug 2018 14:39:32 +0000 (14:39 +0000)]
[clangd] DexIndex implementation prototype

This patch is a proof-of-concept Dex index implementation. It has
several flaws, which don't allow replacing static MemIndex yet, such as:

* Not being able to handle queries of small size (less than 3 symbols);
  a way to solve this is generating trigrams of smaller size and having
  such incomplete trigrams in the index structure.
* Speed measurements: while manually editing files in Vim and requesting
  autocompletion gives an impression that the performance is at least
  comparable with the current static index, having actual numbers is
  important because we don't want to hurt the users and roll out slow
  code. Eric (@ioeric) suggested that we should only replace MemIndex as
  soon as we have the evidence that this is not a regression in terms of
  performance. An approach which is likely to be successful here is to
  wait until we have benchmark library in the LLVM core repository, which
  is something I have suggested in the LLVM mailing lists, received
  positive feedback on and started working on. I will add a dependency as
  soon as the suggested patch is out for a review (currently there's at
  least one complication which is being addressed by
  https://github.com/google/benchmark/pull/649). Key performance
  improvements for iterators are sorting by cost and the limit iterator.
* Quality measurements: currently, boosting iterator and two-phase
  lookup stage are not implemented, without these the quality is likely to
  be worse than the current implementation can yield. Measuring quality is
  tricky, but another suggestion in the offline discussion was that the
  drop-in replacement should only happen after Boosting iterators
  implementation (and subsequent query enhancement).

The proposed changes do not affect Clangd functionality or performance,
`DexIndex` is only used in unit tests and not in production code.

Reviewed by: ioeric

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

llvm-svn: 340175

6 years ago[NFC] Don't define static function in header (UninitializedObject.h)
Andrei Elovikov [Mon, 20 Aug 2018 13:45:38 +0000 (13:45 +0000)]
[NFC] Don't define static function in header (UninitializedObject.h)

Summary:
See also http://lists.llvm.org/pipermail/cfe-users/2016-January/000854.html for
the reasons why it's bad.

Reviewers: Szelethus, erichkeane

Reviewed By: Szelethus

Subscribers: cfe-commits

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

llvm-svn: 340174

6 years ago[SelectionDAG] Reuse the Op's VT. NFCI.
Simon Pilgrim [Mon, 20 Aug 2018 13:44:03 +0000 (13:44 +0000)]
[SelectionDAG] Reuse the Op's VT. NFCI.

llvm-svn: 340173

6 years agoAMDGPU: fix compilation errors since r340171
Samuel Pitoiset [Mon, 20 Aug 2018 13:31:41 +0000 (13:31 +0000)]
AMDGPU: fix compilation errors since r340171

Some buildbot slaves reports compilation errors, but it
compiled fine on my side, sorry for the breakage.

llvm-svn: 340172

6 years agoAMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space
Samuel Pitoiset [Mon, 20 Aug 2018 13:18:59 +0000 (13:18 +0000)]
AMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space

32-bit constant address space is declared as 6, so the
maximum number of address spaces is 6, not 5.

Fixes "LLVM ERROR: Pointer address space out of range".

v3: use static_assert()
v2: add a very simple test for 32-bit addr space

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106630
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
llvm-svn: 340171

6 years agoFix an undefined behavior when storing an empty StringRef.
Haojian Wu [Mon, 20 Aug 2018 13:12:54 +0000 (13:12 +0000)]
Fix an undefined behavior when storing an empty StringRef.

Summary: Passing a nullptr to memcpy is UB.

Reviewers: ioeric

Subscribers: llvm-commits, cfe-commits

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

llvm-svn: 340170

6 years ago[SelectionDAG] Add partial sign-bit support to ComputeNumSignBits for BITCAST nodes
Simon Pilgrim [Mon, 20 Aug 2018 13:05:48 +0000 (13:05 +0000)]
[SelectionDAG] Add partial sign-bit support to ComputeNumSignBits for BITCAST nodes

Only adds support to the existing 'large element' scalar/vector to 'small element' vector bitcasts.

Handle the case where the sign bit extends to only part of the small elements.

llvm-svn: 340169

6 years agoFix lit.cfg for python3: can only concatenate str (not "bytes") to str
Stefan Granitz [Mon, 20 Aug 2018 12:37:54 +0000 (12:37 +0000)]
Fix lit.cfg for python3: can only concatenate str (not "bytes") to str

llvm-svn: 340168

6 years ago[X86][SSE] Fix PACKSS bitcast test from rL340166
Simon Pilgrim [Mon, 20 Aug 2018 11:47:15 +0000 (11:47 +0000)]
[X86][SSE] Fix PACKSS bitcast test from rL340166

We need the signbits to extends to lower 16-bits of the even elements

llvm-svn: 340167

6 years ago[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle a partial...
Simon Pilgrim [Mon, 20 Aug 2018 11:10:12 +0000 (11:10 +0000)]
[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle a partial sign bits extension through a bitcast

llvm-svn: 340166

6 years ago[X86] Drop unnecessary exact qualifier from packss test
Simon Pilgrim [Mon, 20 Aug 2018 11:01:51 +0000 (11:01 +0000)]
[X86] Drop unnecessary exact qualifier from packss test

llvm-svn: 340165

6 years ago[LLD][ELF] - Fix warning.
George Rimar [Mon, 20 Aug 2018 10:29:21 +0000 (10:29 +0000)]
[LLD][ELF] - Fix warning.

This fixes the following warning when compiling with gcc version 8.0.1 20180319 (experimental) (GCC):

/home/umb/LLVM/llvm/tools/lld/ELF/SyntheticSections.cpp:1951:46: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
     return OS->SectionIndex >= SHN_LORESERVE ? SHN_XINDEX : OS->SectionIndex;

llvm-svn: 340164

6 years ago[DWARF] Refactor DWARF classes to use unified error reporting. NFC.
Victor Leschuk [Mon, 20 Aug 2018 09:59:08 +0000 (09:59 +0000)]
[DWARF] Refactor DWARF classes to use unified error reporting. NFC.

DWARF-related classes in lib/DebugInfo/DWARF contained
duplicating code for creating StringError instances, like:

template <typename... Ts>
static Error createError(char const *Fmt, const Ts &... Vals) {
  std::string Buffer;
  raw_string_ostream Stream(Buffer);
  Stream << format(Fmt, Vals...);
  return make_error<StringError>(Stream.str(), inconvertibleErrorCode());
}

Similar function was placed in Support lib in https://reviews.llvm.org/D49824

This revision makes DWARF classes use this function
instead of their local implementation of it.

Reviewers: aprantl, dblaikie, probinson, wolfgangp, JDevlieghere, jhenderson

Reviewed By: JDevlieghere, jhenderson

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

llvm-svn: 340163

6 years agoUse LLVM_BUILTIN_TRAP not __builtin_trap to appease windows builds. NFCI.
Simon Pilgrim [Mon, 20 Aug 2018 09:49:20 +0000 (09:49 +0000)]
Use LLVM_BUILTIN_TRAP not __builtin_trap to appease windows builds. NFCI.

llvm-svn: 340162

6 years ago[clangd] Simplify the code using UniqueStringSaver, NFC.
Haojian Wu [Mon, 20 Aug 2018 09:47:12 +0000 (09:47 +0000)]
[clangd] Simplify the code using UniqueStringSaver, NFC.

llvm-svn: 340161

6 years ago[ELF] Add support for Armv5 and Armv6 compatible Thunks
Peter Smith [Mon, 20 Aug 2018 09:37:50 +0000 (09:37 +0000)]
[ELF] Add support for Armv5 and Armv6 compatible Thunks

Older Arm architectures do not support the MOVT and MOVW instructions so we
must use an alternative sequence of instructions to transfer control to the
destination.

Assuming at least Armv5 this patch adds support for Thunks that load or add
to the program counter. Note that there are no Armv5 Thumb Thunks as there
is no Thumb branch instruction in Armv5 that supports Thunks. These thunks
will not work for Armv4t (arm7tdmi) as this architecture cannot change state
from using the LDR or ADD instruction.

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

llvm-svn: 340160

6 years ago[ELF] Add support for older Arm Architectures with smaller branch range
Peter Smith [Mon, 20 Aug 2018 09:19:30 +0000 (09:19 +0000)]
[ELF] Add support for older Arm Architectures with smaller branch range

The Thumb BL and BLX instructions on older Arm Architectures such as v5 and
v6 have a constrained encoding J1 and J2 must equal 1, later Architectures
relaxed this restriction allowing J1 and J2 to be used to calculate a larger
immediate.

This patch adds support for the old encoding, it is used when the build
attributes for the input objects only contain older architectures.

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

llvm-svn: 340159

6 years ago[AArch64][SVE] Asm: Add SVE System registers
Sander de Smalen [Mon, 20 Aug 2018 09:16:59 +0000 (09:16 +0000)]
[AArch64][SVE] Asm: Add SVE System registers

This patch adds system registers for controlling aspects of SVE:
- ZCR_EL1  (r/w)   visible at EL1 and EL0.
- ZCR_EL2  (r/w)   visible at EL2 and Non-secure EL1 and EL0.
- ZCR_EL3  (r/w)   visible at all exception levels.

and a system register identifying SVE:
- ID_AA64ZFR0_EL1  (r)  SVE Feature identifier.

Reviewers: SjoerdMeijer, samparker, pbarrio, fhahn, javed.absar

Reviewed By: SjoerdMeijer

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

llvm-svn: 340158

6 years ago[clangd] NFC: Cleanup Dex Iterator comments and simplify tests
Kirill Bobyrev [Mon, 20 Aug 2018 09:16:14 +0000 (09:16 +0000)]
[clangd] NFC: Cleanup Dex Iterator comments and simplify tests

Proposed changes:

* Cleanup comments in `clangd/index/dex/Iterator.h`: Vim's `gq`
  formatting added redundant spaces instead of newlines in few
  places
* Few comments in `OrIterator` are wrong
* Use `EXPECT_TRUE(Condition)` instead of
  `EXPECT_THAT(Condition, true)` (same with `EXPECT_FALSE`)
* Don't expose `dump()` method to the public by misplacing
  `private:`

This patch does not affect functionality.

Reviewed by: ioeric

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

llvm-svn: 340157

6 years ago[clangd] Add missing lock in the lookup.
Haojian Wu [Mon, 20 Aug 2018 09:07:59 +0000 (09:07 +0000)]
[clangd] Add missing lock in the lookup.

Reviewers: ioeric

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

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

llvm-svn: 340156

6 years ago[clangd] Implement TRUE Iterator
Kirill Bobyrev [Mon, 20 Aug 2018 08:47:30 +0000 (08:47 +0000)]
[clangd] Implement TRUE Iterator

This patch introduces TRUE Iterator which efficiently handles posting
lists containing all items within `[0, Size)` range.

Reviewed by: ioeric

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

llvm-svn: 340155

6 years ago[llvm] Make YAML serialization up to 2.5 times faster
Kirill Bobyrev [Mon, 20 Aug 2018 07:00:36 +0000 (07:00 +0000)]
[llvm] Make YAML serialization up to 2.5 times faster

This patch significantly improves performance of the YAML serializer by
optimizing `YAML::isNumeric` function. This function is called on the
most strings and is highly inefficient for two reasons:

* It uses `Regex`, which is parsed and compiled each time this
  function is called
* It uses multiple passes which are not necessary

This patch introduces stateful ad hoc YAML number parser which does not
rely on `Regex`. It also fixes YAML number format inconsistency: current
implementation supports C-stile octal number format (`01234567`) which
was present in YAML 1.0 specialization (http://yaml.org/spec/1.0/),
[Section 2.4. Tags, Example 2.19] but was deprecated and is no longer
present in latest YAML 1.2 specification
(http://yaml.org/spec/1.2/spec.html), see [Section 10.3.2. Tag
Resolution]. Since the rest of the rest of the implementation does not
support other deprecated YAML 1.0 numeric features such as sexagecimal
numbers, commas as delimiters it is treated as inconsistency and not
longer supported. This patch also adds unit tests to ensure the validity
of proposed implementation.

This performance bottleneck was identified while profiling Clangd's
global-symbol-builder tool with my colleague @ilya-biryukov. The
substantial part of the runtime was spent during a single-thread Reduce
phase, which concludes with YAML serialization of collected symbol
collection. Regex matching was accountable for approximately 45% of the
whole runtime (which involves sharded Map phase), now it is reduced to
18% (which is spent in `clang::clangd::CanonicalIncludes` and can be
also optimized because all used regexes are in fact either suffix
matches or exact matches).

`llvm-yaml-numeric-parser-fuzzer` was used to ensure the validity of the
proposed regex replacement. Fuzzing for ~60 hours using 10 threads did
not expose any bugs.

Benchmarking `global-symbol-builder` (using `hyperfine --warmup 2
--min-runs 5 'command 1' 'command 2'`) tool by processing a reasonable
amount of code (26 source files matched by
`clang-tools-extra/clangd/*.cpp` with all transitive includes) confirmed
our understanding of the performance bottleneck nature as it speeds up
the command by the factor of 1.6x:

| Command | Mean [s] | Min…Max [s] |
| this patch (D50839) | 84.7 Â± 0.6 | 83.3…84.7 |
| master (rL339849) | 133.1 Â± 0.8 | 132.4…134.6 |

Using smaller samples (e.g. by collecting symbols from
`clang-tools-extra/clangd/AST.cpp` only) yields even better performance
improvement, which is expected because Map phase takes less time
compared to Reduce and is 2.05x faster and therefore would significantly
improve the performance of standalone YAML serializations.

| Command | Mean [ms] | Min…Max [ms] |
| this patch (D50839) | 3702.2 Â± 48.7 | 3635.1…3752.3 |
| master (rL339849) | 7607.6 Â± 109.5 | 7533.3…7796.4 |

Reviewed by: zturner, ilya-biryukov

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

llvm-svn: 340154

6 years ago[SimplifyCFG] Replace some uses of bitwise or with logical or
Justin Bogner [Mon, 20 Aug 2018 06:37:11 +0000 (06:37 +0000)]
[SimplifyCFG] Replace some uses of bitwise or with logical or

It's clearer to use logical or for boolean values. Thanks to Steven
Zhang for noticing!

llvm-svn: 340153

6 years agoRemove unnecessary applyMask() application.
Rui Ueyama [Mon, 20 Aug 2018 06:33:29 +0000 (06:33 +0000)]
Remove unnecessary applyMask() application.

applyMask(0xffffffff, x) is an identity function.

llvm-svn: 340152

6 years ago[NFC] Minor update to comment
Aleksandr Urakov [Mon, 20 Aug 2018 05:59:27 +0000 (05:59 +0000)]
[NFC] Minor update to comment

Update comment after rLLDB339994

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

llvm-svn: 340151

6 years ago[InstCombine] Move some variable declarations into a more appropriate scope. NFC
Craig Topper [Mon, 20 Aug 2018 05:35:12 +0000 (05:35 +0000)]
[InstCombine] Move some variable declarations into a more appropriate scope. NFC

llvm-svn: 340150

6 years ago[PowerPC] Add a peephole post RA to transform the inst that fed by add
QingShan Zhang [Mon, 20 Aug 2018 02:52:55 +0000 (02:52 +0000)]
[PowerPC] Add a peephole post RA to transform the inst that fed by add

If the arch is P8, we will select XFLOAD to load the floating point, and then, expand it to vsx and non-vsx X-form instruction post RA. This patch is trying to convert the X-form to D-form if it meets the requirement that one operand of the x-form inst is the special Zero register, and another operand fed by add inst. i.e.
y = add imm, reg
LFDX. 0, y
-->
LFD imm(reg)

Reviewers: Nemanjai
Differential Revision: https://reviews.llvm.org/D49007

llvm-svn: 340149

6 years ago[bindings/go] Add coroutine passes
whitequark [Sun, 19 Aug 2018 23:40:05 +0000 (23:40 +0000)]
[bindings/go] Add coroutine passes

Add Go bindings for CoroEarly, CoroSplit, CoroElide and CoroCleanup.

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

llvm-svn: 340148

6 years ago[LLVM-C] Add coroutine passes
whitequark [Sun, 19 Aug 2018 23:39:57 +0000 (23:39 +0000)]
[LLVM-C] Add coroutine passes

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

llvm-svn: 340147

6 years ago[C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType
whitequark [Sun, 19 Aug 2018 23:39:47 +0000 (23:39 +0000)]
[C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType

Added DIFlags in LLVMDIBuilderCreateBasicType to add optional DWARF
attributes, such as DW_AT_endianity.

Patch by Chirag Patel.

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

llvm-svn: 340146

6 years ago[Lex] Fix some inconsistent parameter names and duplicate comments. NFC
Fangrui Song [Sun, 19 Aug 2018 22:23:42 +0000 (22:23 +0000)]
[Lex] Fix some inconsistent parameter names and duplicate comments. NFC

llvm-svn: 340145

6 years ago[InstCombine] Add test cases for an icmp combine that is missing support for splat...
Craig Topper [Sun, 19 Aug 2018 18:03:34 +0000 (18:03 +0000)]
[InstCombine] Add test cases for an icmp combine that is missing support for splat vector constants.

llvm-svn: 340144

6 years ago[SelectionDAG] Add basic demanded elements support to ComputeNumSignBits for BITCAST...
Simon Pilgrim [Sun, 19 Aug 2018 17:47:50 +0000 (17:47 +0000)]
[SelectionDAG] Add basic demanded elements support to ComputeNumSignBits for BITCAST nodes

Only adds support to the existing 'large element' scalar/vector to 'small element' vector bitcasts.

The next step would be to support cases where the large elements aren't all sign bits, and determine the small element equivalent based on the demanded elements.

llvm-svn: 340143

6 years ago[CodeGen] add test file that should have been included with r340141
Sanjay Patel [Sun, 19 Aug 2018 17:32:56 +0000 (17:32 +0000)]
[CodeGen] add test file that should have been included with r340141

llvm-svn: 340142

6 years ago[CodeGen] add rotate builtins that map to LLVM funnel shift
Sanjay Patel [Sun, 19 Aug 2018 16:50:30 +0000 (16:50 +0000)]
[CodeGen] add rotate builtins that map to LLVM funnel shift
This is a partial retry of rL340137 (reverted at rL340138 because of gcc host compiler crashing)
with 1 change:
Remove the changes to make microsoft builtins also use the LLVM intrinsics.

This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang
(when both halves of a funnel shift are the same value, it's a rotate).

We're free to name these as we want because we're not copying gcc, but if there's some other
existing art (eg, the microsoft ops) that we want to replicate, we can change the names.

The funnel shift intrinsics were added here:
https://reviews.llvm.org/D49242

With improved codegen in:
https://reviews.llvm.org/rL337966
https://reviews.llvm.org/rL339359

And basic IR optimization added in:
https://reviews.llvm.org/rL338218
https://reviews.llvm.org/rL340022

...so these are expected to produce asm output that's equal or better to the multi-instruction
alternatives using primitive C/IR ops.

In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.

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

llvm-svn: 340141

6 years ago[NEON] Define fp16 vld and vst intrinsics conditionally
Ivan A. Kosarev [Sun, 19 Aug 2018 16:30:57 +0000 (16:30 +0000)]
[NEON] Define fp16 vld and vst intrinsics conditionally

This patch fixes definitions of vld and vst NEON intrinsics so
that we only define them if half-precision arithmetic is
supported on the target platform, as prescribed in ACLE 2.0.

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

llvm-svn: 340140

6 years ago[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle demanded...
Simon Pilgrim [Sun, 19 Aug 2018 16:01:47 +0000 (16:01 +0000)]
[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle demanded elts through a bitcast

llvm-svn: 340139

6 years agorevert r340137: [CodeGen] add rotate builtins
Sanjay Patel [Sun, 19 Aug 2018 15:31:42 +0000 (15:31 +0000)]
revert r340137: [CodeGen] add rotate builtins

At least a couple of bots (gcc host compiler on PPC only?) are showing the compiler dying while trying to compile.

llvm-svn: 340138

6 years ago[CodeGen] add/fix rotate builtins that map to LLVM funnel shift (retry)
Sanjay Patel [Sun, 19 Aug 2018 14:44:47 +0000 (14:44 +0000)]
[CodeGen] add/fix rotate builtins that map to LLVM funnel shift (retry)

This is a retry of rL340135 (reverted at rL340136 because of gcc host compiler crashing)
with 2 changes:
1. Move the code into a helper to reduce code duplication (and hopefully work-around the crash).
2. The original commit had a formatting bug in the docs (missing an underscore).

Original commit message:

This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang
(when both halves of a funnel shift are the same value, it's a rotate).

We're free to name these as we want because we're not copying gcc, but if there's some other
existing art (eg, the microsoft ops that are modified in this patch) that we want to replicate,
we can change the names.

The funnel shift intrinsics were added here:
https://reviews.llvm.org/D49242

With improved codegen in:
https://reviews.llvm.org/rL337966
https://reviews.llvm.org/rL339359

And basic IR optimization added in:
https://reviews.llvm.org/rL338218
https://reviews.llvm.org/rL340022

...so these are expected to produce asm output that's equal or better to the multi-instruction
alternatives using primitive C/IR ops.

In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.

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

llvm-svn: 340137

6 years agorevert r340135: [CodeGen] add rotate builtins
Sanjay Patel [Sun, 19 Aug 2018 13:48:06 +0000 (13:48 +0000)]
revert r340135: [CodeGen] add rotate builtins

At least a couple of bots (PPC only?) are showing the compiler dying while trying to compile:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/11065/steps/build%20stage%201/logs/stdio
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/18267/steps/build%20stage%201/logs/stdio

llvm-svn: 340136

6 years ago[CodeGen] add rotate builtins
Sanjay Patel [Sun, 19 Aug 2018 13:12:40 +0000 (13:12 +0000)]
[CodeGen] add rotate builtins

This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang
(when both halves of a funnel shift are the same value, it's a rotate).

We're free to name these as we want because we're not copying gcc, but if there's some other
existing art (eg, the microsoft ops that are modified in this patch) that we want to replicate,
we can change the names.

The funnel shift intrinsics were added here:
D49242

With improved codegen in:
rL337966
rL339359

And basic IR optimization added in:
rL338218
rL340022

...so these are expected to produce asm output that's equal or better to the multi-instruction
alternatives using primitive C/IR ops.

In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.

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

llvm-svn: 340135

6 years ago[X86] Fix an issue in the matching for ADDUS.
Craig Topper [Sun, 19 Aug 2018 04:26:31 +0000 (04:26 +0000)]
[X86] Fix an issue in the matching for ADDUS.

We were basically assuming only one operand of the compare could be an ADD node and using that to swap operands. But we can have a normal add followed by a saturing add.

This rewrites the canonicalization to just be based on the condition code.

llvm-svn: 340134

6 years ago[X86] Add a test case showing an issue in our addusw pattern matching.
Craig Topper [Sun, 19 Aug 2018 04:26:29 +0000 (04:26 +0000)]
[X86] Add a test case showing an issue in our addusw pattern matching.

We are unable to handle a normal add followed by a saturing add with certain operand orders on the icmp.

llvm-svn: 340133

6 years ago[msan] Remove XFAIL: freebsd from test/msan/tls_reuse.cc
Fangrui Song [Sat, 18 Aug 2018 23:25:55 +0000 (23:25 +0000)]
[msan] Remove XFAIL: freebsd from test/msan/tls_reuse.cc

This passes now.

llvm-svn: 340132

6 years agoUpdating MergeFunctions.rst
Aditya Kumar [Sat, 18 Aug 2018 20:17:19 +0000 (20:17 +0000)]
Updating MergeFunctions.rst

Improving readability, removing redundant contents.

Reviewers: hiraditya
Differential Revision: https://reviews.llvm.org/D50686

llvm-svn: 340131

6 years ago[X86] Use SDValue::operator== instead of DAG.isEqualTo in strictly integer matching.
Craig Topper [Sat, 18 Aug 2018 19:16:56 +0000 (19:16 +0000)]
[X86] Use SDValue::operator== instead of DAG.isEqualTo in strictly integer matching.

isEqualTo is more useful for floating point. operator== is sufficient for integer.

llvm-svn: 340130

6 years ago[X86] Simplify the PADDUS legality check in combineSelect to match PSUBUS. NFC
Craig Topper [Sat, 18 Aug 2018 18:51:04 +0000 (18:51 +0000)]
[X86] Simplify the PADDUS legality check in combineSelect to match PSUBUS. NFC

While there remove some trailing whitespace.

llvm-svn: 340129

6 years ago[X86] Add support for using 512-bit PSUBUS to combineSelect.
Craig Topper [Sat, 18 Aug 2018 18:51:03 +0000 (18:51 +0000)]
[X86] Add support for using 512-bit PSUBUS to combineSelect.

The code already support 128 and 256 and even knows to split 256 for AVX1. So we really just needed to stop looking for specific VTs and subtarget features and just look for legal VTs with i8/i16 elements.

While there, add some curly braces around outer if statement bodies that contain only another if. It makes all the closing curly braces look more regular.

llvm-svn: 340128

6 years ago[X86] Add test cases to show missed opportunities to use 512-bit PSUBUS.
Craig Topper [Sat, 18 Aug 2018 18:50:59 +0000 (18:50 +0000)]
[X86] Add test cases to show missed opportunities to use 512-bit PSUBUS.

llvm-svn: 340127

6 years ago[MS Demangler] Resolve backreferences eagerly, not lazily.
Zachary Turner [Sat, 18 Aug 2018 18:49:48 +0000 (18:49 +0000)]
[MS Demangler] Resolve backreferences eagerly, not lazily.

A while back I submitted a patch to resolve backreferences
lazily, thinking this that it was not always possible to know
in advance what type you were looking at until you had completed
a full pass over the input, and therefore it would be impossible
to resolve backreferences eagerly.

This was mistaken though, and turned out to be an unrelated
problem.  In fact, the reverse is true.  You *must* resolve
backreferences eagerly.  This is because certain types of nested
mangled symbols do not share a backreference context with their
parent symbol, and as such, if you try to resolve them lazily
their backreference context will have been lost by the time you
finish demangling the entire input.  On the other hand, resolving
them eagerly appears to always work, and enables us to port
many more tests over.

llvm-svn: 340126

6 years ago[RuntimeDyld] Fix a bug in RuntimeDyld::loadObjectImpl that was over-allocating
Lang Hames [Sat, 18 Aug 2018 18:38:37 +0000 (18:38 +0000)]
[RuntimeDyld] Fix a bug in RuntimeDyld::loadObjectImpl that was over-allocating
space for common symbols.

Patch by Dmitry Sidorov. Thanks Dmitry!

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

llvm-svn: 340125

6 years ago[X86] Replace all single match schedule class instregexs with instrs entries
Simon Pilgrim [Sat, 18 Aug 2018 18:04:29 +0000 (18:04 +0000)]
[X86] Replace all single match schedule class instregexs with instrs entries

Helps reduce cost of instrw collection

llvm-svn: 340124

6 years ago[X86] Merge shift/rotate schedule class instregexs
Simon Pilgrim [Sat, 18 Aug 2018 15:58:19 +0000 (15:58 +0000)]
[X86] Merge shift/rotate schedule class instregexs

Helps reduce cost of instrw collection

llvm-svn: 340123

6 years ago[DebugInfo] In FastISel, convert llvm.dbg.label to DBG_LABEL MI.
Hsiangkai Wang [Sat, 18 Aug 2018 14:55:34 +0000 (14:55 +0000)]
[DebugInfo] In FastISel, convert llvm.dbg.label to DBG_LABEL MI.

Convert llvm.dbg.label(!label_metadata) to DBG_LABEL !label_metadata.

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

llvm-svn: 340122

6 years ago[X86] Add a signed test case for PR38622. Use nounwind to reduce the output on the...
Craig Topper [Sat, 18 Aug 2018 06:00:16 +0000 (06:00 +0000)]
[X86] Add a signed test case for PR38622. Use nounwind to reduce the output on the unsigned test case.

llvm-svn: 340121

6 years ago[DAGCombiner] Allow divide by constant optimization on opaque constants.
Craig Topper [Sat, 18 Aug 2018 05:52:42 +0000 (05:52 +0000)]
[DAGCombiner] Allow divide by constant optimization on opaque constants.

Summary:
I believe this restores the behavior we had before r339147.

Fixes PR38622.

Reviewers: RKSimon, chandlerc, spatel

Reviewed By: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 340120

6 years agoRevert "Add a basic integration test for C++ smart pointers"
Bruno Cardoso Lopes [Sat, 18 Aug 2018 04:16:50 +0000 (04:16 +0000)]
Revert "Add a basic integration test for C++ smart pointers"

This reverts commit 73786631984289b3d601034b2bf4ba2b8f5845eb.

Revert r339961 since its causing debuginfo-tests to fail:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/48514/

rdar://problem/43449629

llvm-svn: 340119

6 years agoAdd the extended XMM registers mappings for AVX-512.
Zachary Turner [Sat, 18 Aug 2018 03:54:16 +0000 (03:54 +0000)]
Add the extended XMM registers mappings for AVX-512.

After this we should have the entire AVX-512 register set
mapping in place.

llvm-svn: 340118

6 years agoRevert "[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker"
Bruno Cardoso Lopes [Sat, 18 Aug 2018 03:22:11 +0000 (03:22 +0000)]
Revert "[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker"

This reverts commit a786521fa66c72edd308baff0c08961b6d964fb1.

Bots haven't caught up yet, but broke modules build with:

../tools/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h:18:10:
fatal error: cyclic dependency in module 'Clang_StaticAnalyzer_Core':
Clang_StaticAnalyzer_Core -> Clang_Analysis ->
Clang_StaticAnalyzer_Checkers -> Clang_StaticAnalyzer_Core
         ^

llvm-svn: 340117

6 years ago[ORC] Fix some parameter names. NFC.
Lang Hames [Sat, 18 Aug 2018 02:48:02 +0000 (02:48 +0000)]
[ORC] Fix some parameter names. NFC.

llvm-svn: 340116

6 years ago[ORC] Rename 'finalize' to 'emit' to avoid potential confusion.
Lang Hames [Sat, 18 Aug 2018 02:06:18 +0000 (02:06 +0000)]
[ORC] Rename 'finalize' to 'emit' to avoid potential confusion.

An emitted symbol has had its contents written and its memory protections
applied, but it is not automatically ready to execute.

Prior to ORC supporting concurrent compilation, the term "finalized" could be
interpreted two different (but effectively equivalent) ways: (1) The finalized
symbol's contents have been written and its memory protections applied, and (2)
the symbol is ready to run. Now that ORC supports concurrent compilation, sense
(1) no longer implies sense (2). We have already introduced a new term, 'ready',
to capture sense (2), so rename sense (1) to 'emitted' to avoid any lingering
confusion.

llvm-svn: 340115

6 years ago[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker
George Karpenkov [Sat, 18 Aug 2018 01:45:50 +0000 (01:45 +0000)]
[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker

ARCMigrator is using code from RetainCountChecker, which is a layering
violation (and it also does it badly, by using a different header, and
then relying on implementation being present in a header file).

This change splits up RetainSummaryManager into a separate library in
lib/Analysis, which can be used independently of a checker.

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

llvm-svn: 340114

6 years agoMC: Remove dead code from WinCOFFObjectWriter.cpp. NFCI.
Peter Collingbourne [Sat, 18 Aug 2018 00:54:46 +0000 (00:54 +0000)]
MC: Remove dead code from WinCOFFObjectWriter.cpp. NFCI.

Remove code for writing auxiliary symbols of type function definition
and begin function. These types of symbols are associated with
pre-CodeView debug info and we never emit them.

llvm-svn: 340113

6 years agoSkip tests on Darwin for now. The build bots are not passing due to heavy load and...
Greg Clayton [Sat, 18 Aug 2018 00:33:15 +0000 (00:33 +0000)]
Skip tests on Darwin for now. The build bots are not passing due to heavy load and poor machines.

llvm-svn: 340112

6 years ago[GISel]: Add Legalization/lowering code for bit counting operations
Aditya Nandakumar [Sat, 18 Aug 2018 00:01:54 +0000 (00:01 +0000)]
[GISel]: Add Legalization/lowering code for bit counting operations

https://reviews.llvm.org/D48847#inline-448257

Ported legalization expansions for CTLZ/CTTZ from DAG to GISel.

Reviewed by rtereshin.

llvm-svn: 340111

6 years agoQuickfix for failing tests.
George Karpenkov [Fri, 17 Aug 2018 23:54:00 +0000 (23:54 +0000)]
Quickfix for failing tests.

llvm-svn: 340110

6 years ago[index] For an ObjC message call, also record as receivers the protocols if they...
Argyrios Kyrtzidis [Fri, 17 Aug 2018 23:50:59 +0000 (23:50 +0000)]
[index] For an ObjC message call, also record as receivers the protocols if they are present in the ObjC type

llvm-svn: 340109

6 years ago[AST] Clarify printing of unknown size locations [NFC]
Philip Reames [Fri, 17 Aug 2018 23:17:31 +0000 (23:17 +0000)]
[AST] Clarify printing of unknown size locations [NFC]

Printing "unknown" is much more clear than an arbitrary large integer

llvm-svn: 340108

6 years ago[llvm-objcopy] Implement -G/--keep-global-symbol(s).
Jordan Rupprecht [Fri, 17 Aug 2018 22:34:48 +0000 (22:34 +0000)]
[llvm-objcopy] Implement -G/--keep-global-symbol(s).

Summary:
Port GNU Objcopy -G/--keep-global-symbol(s).

This is slightly different than the already-implemented --globalize-symbol, which marks a symbol as global when copying. When --keep-global-symbol (alias -G) is used, *only* those symbols marked will stay global, and all other globals are demoted to local. (Also note that it doesn't *promote* a symbol to global). Additionally, there is a pluralized version of the flag --keep-global-symbols, which effectively applies --keep-global-symbol for every non-comment in a file.

Reviewers: jakehehrlich, jhenderson, alexshap

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 340105

6 years ago[DebugCounters] don't do redundant map lookups; NFC
George Burgess IV [Fri, 17 Aug 2018 22:34:04 +0000 (22:34 +0000)]
[DebugCounters] don't do redundant map lookups; NFC

llvm-svn: 340104

6 years ago[ObjC] Error out when using forward-declared protocol in a @protocol
Alex Lorenz [Fri, 17 Aug 2018 22:18:08 +0000 (22:18 +0000)]
[ObjC] Error out when using forward-declared protocol in a @protocol
expression

Clang emits invalid protocol metadata when a @protocol expression is used with a
forward-declared protocol. The protocol metadata is missing protocol conformance
list of the protocol since we don't have access to the definition of it in the
compiled translation unit. The linker then might end up picking the invalid
metadata when linking which will lead to incorrect runtime protocol conformance
checks.

This commit makes sure that Clang fails to compile code that uses a @protocol
expression with a forward-declared protocol. This ensures that Clang does not
emit invalid protocol metadata. I added an extra assert in CodeGen to ensure
that this kind of issue won't happen in other places.

rdar://32787811

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

llvm-svn: 340102

6 years agoDon't warn on returning the address of a label from a statement expression
Reid Kleckner [Fri, 17 Aug 2018 22:11:31 +0000 (22:11 +0000)]
Don't warn on returning the address of a label from a statement expression

Summary:
There isn't anything inherently wrong with returning a label from a
statement expression. In practice, the Linux kernel uses this pattern to
materialize PCs.

Fixes PR38569

Reviewers: niravd, rsmith, nickdesaulniers

Subscribers: cfe-commits

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

llvm-svn: 340101

6 years ago[AST][Tests] Clarify what each test is doing
Philip Reames [Fri, 17 Aug 2018 21:58:26 +0000 (21:58 +0000)]
[AST][Tests] Clarify what each test is doing

llvm-svn: 340100

6 years ago[AST[Tests] Shorten tests using noalias params
Philip Reames [Fri, 17 Aug 2018 21:45:57 +0000 (21:45 +0000)]
[AST[Tests] Shorten tests using noalias params

llvm-svn: 340099