platform/upstream/llvm.git
4 years agoAdded Delta IR Reduction Tool
Diego Trevino Ferrer [Wed, 7 Aug 2019 21:37:11 +0000 (21:37 +0000)]
Added Delta IR Reduction Tool

Summary: Tool parses input IR file, and runs the delta debugging algorithm to reduce the functions inside the input file.

Reviewers: alexshap, chandlerc

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

> llvm-svn: 368071

llvm-svn: 368214

4 years ago[libc++] Take 3: Do not cleverly link against libc++abi just because it happens to...
Louis Dionne [Wed, 7 Aug 2019 21:36:03 +0000 (21:36 +0000)]
[libc++] Take 3: Do not cleverly link against libc++abi just because it happens to be there

Summary:
Otherwise, when libcxxabi is not an enabled project in the monorepo, we
get a link error because we try to link against non-existent cxxabi_shared.

More generally, we shouldn't change the behavior of the build based on
implicit things like whether a file happens to be at a specific path or
not.

This is a re-application of r365222 that had been reverted in r365233
and then r365359 because it broke the build bots. The build bots
should now specify explicitly what ABI library they want to use
(libc++abi), so this commit should now be OK to merge. It takes a while
for build bots to pick up configuration changes, which is why this failed
the last time around.

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

llvm-svn: 368213

4 years agoDebugInfo/DWARF: Remove unused return type from DWARFUnit::extractDIEsIfNeeded
David Blaikie [Wed, 7 Aug 2019 21:31:33 +0000 (21:31 +0000)]
DebugInfo/DWARF: Remove unused return type from DWARFUnit::extractDIEsIfNeeded

llvm-svn: 368212

4 years ago[NFC][LICM] Pre-commit test for unary FNeg support in LICM.
Cameron McInally [Wed, 7 Aug 2019 21:30:00 +0000 (21:30 +0000)]
[NFC][LICM] Pre-commit test for unary FNeg support in LICM.

llvm-svn: 368211

4 years ago[X86] Allow pack instructions to be used for 512->256 truncates when -mprefer-vector...
Craig Topper [Wed, 7 Aug 2019 21:16:10 +0000 (21:16 +0000)]
[X86] Allow pack instructions to be used for 512->256 truncates when -mprefer-vector-width=256 is causing 512-bit vectors to be split

If we're splitting the 512-bit vector anyway and we have zero/sign bits, then we might as well use pack instructions to concat and truncate at once.

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

llvm-svn: 368210

4 years ago[clang-doc] Add second index for sections within info's content
Diego Astiazaran [Wed, 7 Aug 2019 21:04:52 +0000 (21:04 +0000)]
[clang-doc] Add second index for sections within info's content

This new index contains links to the main section of infos: Namespaces, Records, Functions, Enums, Members.
Also to each child function or enum.
Index is currently rendered on top of the info content, this will be fixed later with CSS.

Depends on D65690.

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

llvm-svn: 368209

4 years ago[CommandObject] Remove unused function
Jonas Devlieghere [Wed, 7 Aug 2019 20:56:17 +0000 (20:56 +0000)]
[CommandObject] Remove unused function

llvm-svn: 368208

4 years ago[X86] Add test cases for missed opportunities to use pack instructions for 512->256...
Craig Topper [Wed, 7 Aug 2019 20:54:46 +0000 (20:54 +0000)]
[X86] Add test cases for missed opportunities to use pack instructions for 512->256 truncates with prefer-vector-width=256

If the 512-bit vectors are going to be split anyway, then we are
better off using pack to implicitly concatenate the 256 bit pieces.

llvm-svn: 368207

4 years ago[clang-doc] Parallelize reducing phase
Diego Astiazaran [Wed, 7 Aug 2019 20:54:26 +0000 (20:54 +0000)]
[clang-doc] Parallelize reducing phase

Reduce phase has been parallelized and a execution time was reduced by
60% with this.
The reading of bitcode (bitcode -> Info) was moved to this segment of
code parallelized so it now happens just before reducing.

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

llvm-svn: 368206

4 years ago[Symbol] Remove commented out code from CompileUnit
Alex Langford [Wed, 7 Aug 2019 20:51:21 +0000 (20:51 +0000)]
[Symbol] Remove commented out code from CompileUnit

llvm-svn: 368205

4 years agoRevert r367501 "Create unique, but identically-named ELF sections..."
Bob Haarman [Wed, 7 Aug 2019 20:45:23 +0000 (20:45 +0000)]
Revert r367501 "Create unique, but identically-named ELF sections..."

This reverts commit fbc563e2cb6c5f1d0200b390513506b6aca4d2e9 "Create
unique, but identically-named ELF sections for explicitly-sectioned
functions and globals when using -function-sections and
-data-sections."

Reason for revert: sections are created with potentially wrong
attributes.

llvm-svn: 368204

4 years ago[pstl] Make sure we install all of PSTL's include/ directory
Louis Dionne [Wed, 7 Aug 2019 20:29:04 +0000 (20:29 +0000)]
[pstl] Make sure we install all of PSTL's include/ directory

We want to install files directly in include/, not only in include/pstl.

llvm-svn: 368203

4 years agoAdd target requirements for those bots which don't handle x86.
Bill Wendling [Wed, 7 Aug 2019 19:36:48 +0000 (19:36 +0000)]
Add target requirements for those bots which don't handle x86.

llvm-svn: 368202

4 years ago[NFC] Fixed newly added tests
David Bolvansky [Wed, 7 Aug 2019 19:36:46 +0000 (19:36 +0000)]
[NFC] Fixed newly added tests

llvm-svn: 368201

4 years ago[NFC] Added tests for x/fabs(X) fold
David Bolvansky [Wed, 7 Aug 2019 19:35:25 +0000 (19:35 +0000)]
[NFC] Added tests for x/fabs(X) fold

llvm-svn: 368200

4 years agoAdd support for deterministically linked binaries on macOS to lldb.
Nico Weber [Wed, 7 Aug 2019 19:29:04 +0000 (19:29 +0000)]
Add support for deterministically linked binaries on macOS to lldb.

When ld64 links a binary deterministically using the flag ZERO_AR_DATE,
it sets a timestamp of 0 for N_OSO members in the symtab section, rather
than the usual last modified date of the object file. Prior to this
patch, lldb would compare the timestamp from the N_OSO member against
the last modified date of the object file, and skip loading the object
file if there was a mismatch. This patch updates the logic to ignore the
timestamp check if the N_OSO member has timestamp 0.

The original logic was added in https://reviews.llvm.org/rL181631 as a
safety check to avoid problems when debugging if the object file was out
of date. This was prior to the introduction of deterministic build in
ld64. lld still doesn't support deterministic build.

Other code in llvm already relies on and uses the assumption that a
timestamp of 0 means deterministic build. For example, commit
9ccfddc39d4d27f9b16fcc72ab30d483151d6d08 adds similar timestamp checking
logic to dsymutil, but special cases timestamp 0. Likewise, commit
0d1bb79a0413f221432a7b1d0d2d10c84c4bbb99 adds a long comment describing
deterministic archive, which mostly uses timestamp 0 for determinism.

Patch from Erik Chen <erikchen@chromium.org>!

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

llvm-svn: 368199

4 years agoFix indentation
David Blaikie [Wed, 7 Aug 2019 19:09:31 +0000 (19:09 +0000)]
Fix indentation

llvm-svn: 368198

4 years ago[LoopVectorize][X86] Add test case for missed vectorization from PR42674.
Craig Topper [Wed, 7 Aug 2019 19:07:10 +0000 (19:07 +0000)]
[LoopVectorize][X86] Add test case for missed vectorization from PR42674.

We do end vectorizing the code, but use an interleave factor that
is too high and causes the vector code to be dead.

llvm-svn: 368197

4 years ago[Tooling] Expose ExecutorConcurrency option.
Diego Astiazaran [Wed, 7 Aug 2019 18:35:28 +0000 (18:35 +0000)]
[Tooling] Expose ExecutorConcurrency option.

D65628 requires a flag to specify the number of threads for a clang-doc step. It would be good to use ExecutorConcurrency after exposing it instead of creating a new one that has the same purpose.

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

llvm-svn: 368196

4 years ago[ValueTracking] When calculating known bits for integer abs, make sure we're looking...
Craig Topper [Wed, 7 Aug 2019 18:28:16 +0000 (18:28 +0000)]
[ValueTracking] When calculating known bits for integer abs, make sure we're looking at a negate and not just any instruction with the nsw flag set.

The matchSelectPattern code can match patterns like (x >= 0) ? x : -x
for absolute value. But it can also match ((x-y) >= 0) ? (x-y) : (y-x).
If the latter form was matched we can only use the nsw flag if its
set on both subtracts.

This match makes sure we're looking at the former case only.

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

llvm-svn: 368195

4 years ago[Attributor] Introduce checkForAllReadWriteInstructions(...).
Stefan Stipanovic [Wed, 7 Aug 2019 18:26:02 +0000 (18:26 +0000)]
[Attributor] Introduce checkForAllReadWriteInstructions(...).

Summary: Similarly to D65731 `Attributor::checkForAllReadWriteInstructions` is introduced.

Reviewers: jdoerfert, uenoku

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 368194

4 years ago[SCEV] Return zero from computeConstantDifference(X, X)
Nikolai Bozhenov [Wed, 7 Aug 2019 17:38:38 +0000 (17:38 +0000)]
[SCEV] Return zero from computeConstantDifference(X, X)

Without this patch computeConstantDifference returns None for cases like
these:

  computeConstantDifference(%x, %x)
  computeConstantDifference({%x,+,16}, {%x,+,16})

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

llvm-svn: 368193

4 years ago[OpenMP][libomptarget] Add support for unified memory for regular maps
Gheorghe-Teodor Bercea [Wed, 7 Aug 2019 17:29:45 +0000 (17:29 +0000)]
[OpenMP][libomptarget] Add support for unified memory for regular maps

Summary:
This patch adds support for using unified memory in the case of regular maps that happen when a target region is offloaded to the device.

For cases where only a single version of the data is required then the host address can be used. When variables need to be privatized in any way or globalized, then the copy to the device is still required for correctness.

Reviewers: ABataev, jdoerfert, Hahnfeld, AlexEichenberger, caomhin, grokos

Reviewed By: Hahnfeld

Subscribers: mgorny, guansong, openmp-commits

Tags: #openmp

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

llvm-svn: 368192

4 years ago[DataLayout] Check StackNatural and FunctionPtr alignments.
Florian Hahn [Wed, 7 Aug 2019 17:20:55 +0000 (17:20 +0000)]
[DataLayout] Check StackNatural and FunctionPtr alignments.

MaybeAlignment asserts that the passed in value is == 0 or a power of 2.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16272

Reviewers: michaelplatings, gchatelet, jakehehrlich, jfb

Reviewed By: gchatelet

Tags: #llvm

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

llvm-svn: 368191

4 years agoAPI update for change to LLVM's lib/DebugInfo/DWARF
David Blaikie [Wed, 7 Aug 2019 17:18:18 +0000 (17:18 +0000)]
API update for change to LLVM's lib/DebugInfo/DWARF

llvm-svn: 368190

4 years agoDebugInfo/DWARF: Normalize DWARFObject members on the DWARF spec section names
David Blaikie [Wed, 7 Aug 2019 17:18:11 +0000 (17:18 +0000)]
DebugInfo/DWARF: Normalize DWARFObject members on the DWARF spec section names

Some of these names were abbreviated, some were not, some pluralised,
some not. Made the API difficult to use - since it's an exact 1:1
mapping to the DWARF sections - use those names (changing underscore
separation for camel casing).

llvm-svn: 368189

4 years ago[clang][NFC] Fix typo in matcher comment
Yitzhak Mandelbaum [Wed, 7 Aug 2019 17:01:31 +0000 (17:01 +0000)]
[clang][NFC] Fix typo in matcher comment

Also updates corresponding html doc.

llvm-svn: 368188

4 years agoSupport: Remove needless allocation when getMainExecutable() calls readlink()
Nico Weber [Wed, 7 Aug 2019 17:00:19 +0000 (17:00 +0000)]
Support: Remove needless allocation when getMainExecutable() calls readlink()

We built a StringRef from a string literal which we then converted to a
std::string to call c_str().  Just use a pointer to the string literal
instead of a StringRef.

No behavior change.

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

llvm-svn: 368187

4 years agoCode completion should not ignore default parameters in functions.
Sam McCall [Wed, 7 Aug 2019 16:52:21 +0000 (16:52 +0000)]
Code completion should not ignore default parameters in functions.

Summary:
Inorder to display the default arguments we must process the
CK_Optional chunks of CodeCompletionString while creating the Signature.

We do not create placeholders for default arguments.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 368186

4 years agoRecommit r368081 "[X86] Add more extract subvector cost model tests for smaller eleme...
Craig Topper [Wed, 7 Aug 2019 16:42:47 +0000 (16:42 +0000)]
Recommit r368081 "[X86] Add more extract subvector cost model tests for smaller element sizes and smaller than 128-bit vectors."

llvm-svn: 368185

4 years agoRecommit r368079 "[X86] Remove uses of the -x86-experimental-vector-widening-legaliza...
Craig Topper [Wed, 7 Aug 2019 16:33:37 +0000 (16:33 +0000)]
Recommit r368079 "[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag from test/CodeGen/X86/"

llvm-svn: 368184

4 years agoRecommit r367901 "[X86] Enable -x86-experimental-vector-widening-legalization by...
Craig Topper [Wed, 7 Aug 2019 16:24:26 +0000 (16:24 +0000)]
Recommit r367901 "[X86] Enable -x86-experimental-vector-widening-legalization by default."

The assert that caused this to be reverted should be fixed now.

Original commit message:

This patch changes our defualt legalization behavior for 16, 32, and
64 bit vectors with i8/i16/i32/i64 scalar types from promotion to
widening. For example, v8i8 will now be widened to v16i8 instead of
promoted to v8i16. This keeps the elements widths the same and pads
with undef elements. We believe this is a better legalization strategy.
But it carries some issues due to the fragmented vector ISA. For
example, i8 shifts and multiplies get widened and then later have
to be promoted/split into vXi16 vectors.

This has the potential to cause regressions so we wanted to get
it in early in the 10.0 cycle so we have plenty of time to
address them.

Next steps will be to merge tests that explicitly test the command
line option. And then we can remove the option and its associated
code.

llvm-svn: 368183

4 years ago[Driver] Expand the executable path in the target create output
Jonas Devlieghere [Wed, 7 Aug 2019 16:21:40 +0000 (16:21 +0000)]
[Driver] Expand the executable path in the target create output

Resolve the path in the target create output. This is nice when passing
relative paths to the lldb command line driver.

  $ lldb ./binary
  (lldb) target create "./binary"
  Current executable set to '/absolute/path/to/binary' (x86_64).

This change only affects the target create output and does not change
the debugger's behavior. It doesn't resolve symbolic links so it won't
cause confusing when debugging something like clang++ that's symlinked
to clang.

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

llvm-svn: 368182

4 years ago[ExecutionContext] Return the target/process byte order.
Jonas Devlieghere [Wed, 7 Aug 2019 16:09:35 +0000 (16:09 +0000)]
[ExecutionContext] Return the target/process byte order.

Currently ExecutionContext::GetByteOrder() always returns the host byte
order. This seems like a simple mistake: the return keyword appears to
have been omitted by accident. This patch fixes that and adds a unit
test.

Bugreport: https://llvm.org/PR37950

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

llvm-svn: 368181

4 years ago[ARM] Expand CTPOP intrinsic for MVE
Oliver Cruickshank [Wed, 7 Aug 2019 15:47:45 +0000 (15:47 +0000)]
[ARM] Expand CTPOP intrinsic for MVE

llvm-svn: 368180

4 years agogn build: Merge r368158
Nico Weber [Wed, 7 Aug 2019 15:30:44 +0000 (15:30 +0000)]
gn build: Merge r368158

llvm-svn: 368179

4 years agogn build: Merge r368119
Nico Weber [Wed, 7 Aug 2019 15:29:01 +0000 (15:29 +0000)]
gn build: Merge r368119

llvm-svn: 368178

4 years agoUse forceinline. Necessary for nvcc to inline small functions within the bitcode...
Jon Chesterfield [Wed, 7 Aug 2019 15:24:12 +0000 (15:24 +0000)]
Use forceinline. Necessary for nvcc to inline small functions within the bitcode library

Summary:
[libomptarget] Use forceinline. Necessary for nvcc to inline small functions within the bitcode library
Suggested in D65836

Reviewers: ABataev, jdoerfert, grokos, gregrodgers

Subscribers: openmp-commits

Tags: #openmp

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

llvm-svn: 368177

4 years ago[InstCombine] Add a TODO comment
Jay Foad [Wed, 7 Aug 2019 15:18:34 +0000 (15:18 +0000)]
[InstCombine] Add a TODO comment

llvm-svn: 368176

4 years ago[InstCombine] Propagate fast math flags through selects
Jay Foad [Wed, 7 Aug 2019 15:16:28 +0000 (15:16 +0000)]
[InstCombine] Propagate fast math flags through selects

Summary:
In SimplifySelectsFeedingBinaryOp, propagate fast math flags from the
outer op into both arms of the new select, to take advantage of
simplifications that require fast math flags.

Reviewers: mcberg2017, majnemer, spatel, arsenm, xbolva00

Subscribers: wdng, javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368175

4 years ago[UpdateTestChecks] Update tests option
David Bolvansky [Wed, 7 Aug 2019 14:44:50 +0000 (14:44 +0000)]
[UpdateTestChecks] Update tests option

Summary:
Port of new feature introduced https://reviews.llvm.org/D65610 to other update scripts.

- update_*_checks.py: add an alias -u for --update-only
- port --update-only to other update_*_test_checks.py scripts
- update script aborts if the test file was generated by another update_*_test_checks.py utility

Reviewers: lebedev.ri, RKSimon, MaskRay, reames, gbedwell

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368174

4 years agoRemove LLVM mutexes from clang in favor of std::mutex
Benjamin Kramer [Wed, 7 Aug 2019 14:44:40 +0000 (14:44 +0000)]
Remove LLVM mutexes from clang in favor of std::mutex

None of those need to be recursive mutexes. No functionality change
intended.

llvm-svn: 368173

4 years ago[OPENMP]Set default version to OpenMP 4.5.
Alexey Bataev [Wed, 7 Aug 2019 14:39:17 +0000 (14:39 +0000)]
[OPENMP]Set default version to OpenMP 4.5.

Since clang fully supports OpenMP 4.5, set the default version to 4.5
instead of 3.1.

llvm-svn: 368172

4 years ago[EarlyCSE] Add support for unary FNeg to EarlyCSE
Cameron McInally [Wed, 7 Aug 2019 14:34:41 +0000 (14:34 +0000)]
[EarlyCSE] Add support for unary FNeg to EarlyCSE

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

llvm-svn: 368171

4 years ago[OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.
Alexey Bataev [Wed, 7 Aug 2019 14:02:11 +0000 (14:02 +0000)]
[OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.

According to the OpenMP standard, compiler must define _OPENMP macro,
which has value in format yyyymm, where yyyy is the year of the standard
and mm is the month of the standard. For OpenMP 5.0 this value must be
set to 201811.

llvm-svn: 368170

4 years agoTry to fix windows build bots after r368153.
Igor Kudrin [Wed, 7 Aug 2019 13:22:29 +0000 (13:22 +0000)]
Try to fix windows build bots after r368153.

llvm-svn: 368169

4 years agoProcessElfCore: Remove linux and freebsd NT_*** constants
Pavel Labath [Wed, 7 Aug 2019 13:12:59 +0000 (13:12 +0000)]
ProcessElfCore: Remove linux and freebsd NT_*** constants

These are already defined in llvm/BinaryFormat/ELF.h. Leaving the NetBSD
and OpenBSD constants as-is, as they have no llvm counterparts.

llvm-svn: 368168

4 years ago[RISCV][NFC] Document RISC-V-specific assembly constraints
Sam Elliott [Wed, 7 Aug 2019 13:08:07 +0000 (13:08 +0000)]
[RISCV][NFC] Document RISC-V-specific assembly constraints

llvm-svn: 368167

4 years agoGlobalISel: factor common code from translateCall and translateInvoke. NFC.
Tim Northover [Wed, 7 Aug 2019 12:43:53 +0000 (12:43 +0000)]
GlobalISel: factor common code from translateCall and translateInvoke. NFC.

llvm-svn: 368166

4 years ago[X86] EltsFromConsecutiveLoads - early out for non-byte sized memory (PR42909)
Simon Pilgrim [Wed, 7 Aug 2019 12:41:59 +0000 (12:41 +0000)]
[X86] EltsFromConsecutiveLoads - early out for non-byte sized memory (PR42909)

Don't attempt to merge loads for types that aren't modulo 8-bits.

llvm-svn: 368165

4 years ago[AArch64][WinCFI] Do not pair callee-save instructions in LoadStoreOptimizer
Sander de Smalen [Wed, 7 Aug 2019 12:41:38 +0000 (12:41 +0000)]
[AArch64][WinCFI] Do not pair callee-save instructions in LoadStoreOptimizer

Prevent the LoadStoreOptimizer from pairing any load/store instructions with
instructions from the prologue/epilogue if the CFI information has encoded the
operations as separate instructions.  This would otherwise lead to a mismatch
of the actual prologue size from the size as recorded in the Windows CFI.

Reviewers: efriedma, mstorsjo, ssijaric

Reviewed By: efriedma

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

llvm-svn: 368164

4 years ago[ASTImporter] Do not import FunctionTemplateDecl in record twice.
Balazs Keri [Wed, 7 Aug 2019 12:40:17 +0000 (12:40 +0000)]
[ASTImporter] Do not import FunctionTemplateDecl in record twice.

Summary:
For functions there is a check to not duplicate the declaration if it is in a
record (class). For function templates there was no similar check, if a
template (in the same class) was imported multiple times the
FunctionTemplateDecl was created multiple times with the same templated
FunctionDecl. This can result in problems with the declaration chain.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

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

Tags: #clang

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

llvm-svn: 368163

4 years ago[mips] Make a couple of class methods plain static functions. NFC
Simon Atanasyan [Wed, 7 Aug 2019 12:21:41 +0000 (12:21 +0000)]
[mips] Make a couple of class methods plain static functions. NFC

llvm-svn: 368162

4 years ago[mips] Use isMicroMips() function to check enabled feature flag. NFC
Simon Atanasyan [Wed, 7 Aug 2019 12:21:32 +0000 (12:21 +0000)]
[mips] Use isMicroMips() function to check enabled feature flag. NFC

llvm-svn: 368161

4 years ago[Mips] Instruction `sc` now accepts symbol as an argument
Simon Atanasyan [Wed, 7 Aug 2019 12:21:26 +0000 (12:21 +0000)]
[Mips] Instruction `sc` now accepts symbol as an argument

Function MipsAsmParser::expandMemInst() did not properly handle
instruction `sc` with a symbol as an argument because first argument
would be counted twice. We add additional checks and handle this case
separately.

Patch by Mirko Brkusanin.

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

llvm-svn: 368160

4 years agoObjectFileELF: Remove NT_*** constants
Pavel Labath [Wed, 7 Aug 2019 12:13:48 +0000 (12:13 +0000)]
ObjectFileELF: Remove NT_*** constants

llvm now has definitions of those in BinaryFormat/ELF.h. Use those
instead.

llvm-svn: 368159

4 years ago[Support] Base SmartMutex on std::recursive_mutex
Benjamin Kramer [Wed, 7 Aug 2019 11:59:57 +0000 (11:59 +0000)]
[Support] Base SmartMutex on std::recursive_mutex

- Remove support for non-recursive mutexes. This was unused.
- The std::recursive_mutex is now created/destroyed unconditionally.
  Locking is still only done if threading is enabled.
- Alias SmartScopedLock to std::lock_guard.

This should make no semantic difference on the existing APIs.

llvm-svn: 368158

4 years agoReplace non-recursive sys::Mutex users with std::mutex
Benjamin Kramer [Wed, 7 Aug 2019 11:59:44 +0000 (11:59 +0000)]
Replace non-recursive sys::Mutex users with std::mutex

Also remove a use of sys::MutexImpl, that's just evil. No functionality
change intended.

llvm-svn: 368157

4 years agoRemove support for 32-bit offsets in utility classes (5/5)
Igor Kudrin [Wed, 7 Aug 2019 11:44:47 +0000 (11:44 +0000)]
Remove support for 32-bit offsets in utility classes (5/5)

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

llvm-svn: 368156

4 years ago[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for...
Simon Pilgrim [Wed, 7 Aug 2019 11:43:13 +0000 (11:43 +0000)]
[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for ISD::VECTOR_SHUFFLE

In particular this helps the SSE vector shift cvttps2dq+add+shl pattern by avoiding the need for zeros in shuffle style extensions to vXi32 types as we'll be shifting out those bits anyway

llvm-svn: 368155

4 years agoA more robust way of testing debug_line parser near the end of module
Pavel Labath [Wed, 7 Aug 2019 11:33:56 +0000 (11:33 +0000)]
A more robust way of testing debug_line parser near the end of module

Summary:
While removing -z separate-code makes lld produce place the code at the
end of a segment right now, it's possible that future changes to the
linker will change that, thereby removing the coverage for the changes
in r367983. This patch adds a linker script to one of the line table
tests, which ensures that the code (and its line table) will be placed
at the very end of a module.

Reviewers: MaskRay

Subscribers: lldb-commits

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

llvm-svn: 368154

4 years ago[ELF] Fix splitting messages for duplicate symbols.
Igor Kudrin [Wed, 7 Aug 2019 11:32:43 +0000 (11:32 +0000)]
[ELF] Fix splitting messages for duplicate symbols.

D65213 (rL367536) does not work for the case when a source file path
includes subdirectories.

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

llvm-svn: 368153

4 years ago[clang] Fix mismatched args constructing AddressSpaceAttr.
Anton Bikineev [Wed, 7 Aug 2019 11:12:43 +0000 (11:12 +0000)]
[clang] Fix mismatched args constructing AddressSpaceAttr.

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

llvm-svn: 368152

4 years ago[lldb][CMake] Workaround debugserver code-signing issue in generated Xcode project
Stefan Granitz [Wed, 7 Aug 2019 11:02:04 +0000 (11:02 +0000)]
[lldb][CMake] Workaround debugserver code-signing issue in generated Xcode project

Summary:
Explicitly code-sign the LLDB.framework copy of debugserver in the build-tree. This is necessary, because the Xcode-specific logic in `llvm_codesign` [1] has the side-effect that Xcode code-signs after post-build steps (here: after copying debugserver over into the framework). The special case for Xcode was necessary to avoid double-signing errors in the past (see D55116 and D55816).

[1] https://github.com/llvm/llvm-project/blob/36fb93982f0e/llvm/cmake/modules/AddLLVM.cmake#L1676

Reviewers: jingham, davide, JDevlieghere, teemperor

Reviewed By: JDevlieghere

Subscribers: beanz, mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 368151

4 years ago[lldb][NFC] Remove commented out code in ClangASTContext::AddMethodToCXXRecordType
Raphael Isemann [Wed, 7 Aug 2019 10:59:34 +0000 (10:59 +0000)]
[lldb][NFC] Remove commented out code in ClangASTContext::AddMethodToCXXRecordType

llvm-svn: 368150

4 years agoReplace llvm::MutexGuard/UniqueLock with their standard equivalents
Benjamin Kramer [Wed, 7 Aug 2019 10:57:25 +0000 (10:57 +0000)]
Replace llvm::MutexGuard/UniqueLock with their standard equivalents

All supported platforms have <mutex> now, so we don't need our own
copies any longer. No functionality change intended.

llvm-svn: 368149

4 years ago[lldb][CMake] Fix one more detail in r368066
Stefan Granitz [Wed, 7 Aug 2019 10:47:49 +0000 (10:47 +0000)]
[lldb][CMake] Fix one more detail in r368066

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

llvm-svn: 368148

4 years agogsl::Owner/gsl::Pointer: Add implicit annotations for some std types
Matthias Gehre [Wed, 7 Aug 2019 10:45:36 +0000 (10:45 +0000)]
gsl::Owner/gsl::Pointer: Add implicit annotations for some std types

Summary:
Hard code gsl::Owner/gsl::Pointer for std types. The paper mentions
some types explicitly. Generally, all containers and their iterators are
covered. For iterators, we cover both the case that they are defined
as an nested class or as an typedef/using. I have started to test this
implementation against some real standard library implementations, namely
libc++ 7.1.0, libc++ 8.0.1rc2, libstdc++ 4.6.4, libstdc++ 4.8.5,
libstdc++ 4.9.4, libstdc++ 5.4.0, libstdc++ 6.5.0, libstdc++ 7.3.0,
libstdc++ 8.3.0 and libstdc++ 9.1.0.

The tests are currently here
  https://github.com/mgehre/llvm-project/blob/lifetime-ci/lifetime-attr-test.sh
  https://github.com/mgehre/llvm-project/blob/lifetime-ci/lifetime-attr-test.cpp
I think due to their dependency on a standard library, they are not a good fit
for clang/test/. Where else could I put them?

Reviewers: gribozavr, xazax.hun

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

llvm-svn: 368147

4 years ago[ARM] Generate MVE VHADDs/VHSUBs
Oliver Cruickshank [Wed, 7 Aug 2019 10:26:57 +0000 (10:26 +0000)]
[ARM] Generate MVE VHADDs/VHSUBs

llvm-svn: 368146

4 years agoHandle /align option.
Rui Ueyama [Wed, 7 Aug 2019 10:16:21 +0000 (10:16 +0000)]
Handle /align option.

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

llvm-svn: 368145

4 years agoSimplify error message output. NFC.
Rui Ueyama [Wed, 7 Aug 2019 10:11:24 +0000 (10:11 +0000)]
Simplify error message output. NFC.

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

llvm-svn: 368144

4 years ago[lldb][NFC] Fix typo in 368066
Stefan Granitz [Wed, 7 Aug 2019 10:03:11 +0000 (10:03 +0000)]
[lldb][NFC] Fix typo in 368066

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

llvm-svn: 368143

4 years ago[ELF][X86] Add --no-show-raw-insn and -soname to some i386 tests
Fangrui Song [Wed, 7 Aug 2019 09:43:54 +0000 (09:43 +0000)]
[ELF][X86] Add --no-show-raw-insn and -soname to some i386 tests

llvm-svn: 368142

4 years ago[InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern
Roman Lebedev [Wed, 7 Aug 2019 09:41:50 +0000 (09:41 +0000)]
[InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern

This was initially committed in r368059 but got reverted in r368084
because there was a faulty logic in how the shift amounts type mismatch
was being handled (it simply wasn't).

I've added an explicit bailout before we SimplifyAddInst() - i don't think
it's designed in general to handle differently-typed values, even though
the actual problem only comes from ConstantExpr's.

I have also changed the common type deduction, to not just blindly
look past zext, but try to do that so that in the end types match.

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

llvm-svn: 368141

4 years ago[obj2yaml] - MIPS: move and improve testing of the e_flags
George Rimar [Wed, 7 Aug 2019 09:35:04 +0000 (09:35 +0000)]
[obj2yaml] - MIPS: move and improve testing of the e_flags

Mips/elf-flags.yaml and Mips/elf-abi.yaml are tests that intention was to
show that yaml2obj/obj2yaml are able to read/dump MIPS specific e_flags.

They were not complete, contained an excessive YAML parts and were placed
at a wrong location.

I removed them and created the obj2yaml/elf-mips-eflags.yaml instead.

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

llvm-svn: 368140

4 years ago[ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link...
George Rimar [Wed, 7 Aug 2019 09:29:42 +0000 (09:29 +0000)]
[ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link is broken.

When e_shstrndx is equal to SHN_XINDEX,
the index of the section string table section should
be taken from the sh_link field of the section
header at index 0.

If sh_link is broken, e.g. contains an index that is
larger than number of sections, then error is reported.

This error message was untested before.

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

llvm-svn: 368139

4 years ago[llvm-readelf] --notes: move 'Data size' column left by 1
Fangrui Song [Wed, 7 Aug 2019 09:13:11 +0000 (09:13 +0000)]
[llvm-readelf] --notes: move 'Data size' column left by 1

readelf -n:

```
// "Data size" is not left justified
  Owner                 Data size       Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
```

llvm-readelf -n (before):
```
// "Data size" column shifted by 1
  Owner                 Data size        Description
  GNU                   0x00000010       NT_GNU_ABI_TAG (ABI version tag)
```

llvm-readelf -n (after):
```
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
```

This change is made to reduce the diff with readelf -n, so that it is
slightly easier to check what features readelf implements but we don't.

Reviewed By: grimar, jhenderson

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

llvm-svn: 368138

4 years ago[clangd] Added a TextMate theme parser to the vscode extension.
Johan Vikstrom [Wed, 7 Aug 2019 08:48:52 +0000 (08:48 +0000)]
[clangd] Added a TextMate theme parser to the vscode extension.

Summary:
Adds a TextMate parser module to the vscode extension. It parses a theme into an array of a pair of TextMate scopes and text colors.

Reviewers: hokein, ilya-biryukov

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

Tags: #clang

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

llvm-svn: 368136

4 years ago[unittests] Mark private gmock headers with IWYU pragmas. NFC
Ilya Biryukov [Wed, 7 Aug 2019 08:45:38 +0000 (08:45 +0000)]
[unittests] Mark private gmock headers with IWYU pragmas. NFC

Summary: To prevent clangd from adding #include of those headers.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: kadircet, llvm-commits, cfe-commits

Tags: #llvm

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

llvm-svn: 368135

4 years agoRemove inclusion of a private gmock header from a test
Dmitri Gribenko [Wed, 7 Aug 2019 08:16:29 +0000 (08:16 +0000)]
Remove inclusion of a private gmock header from a test

llvm-svn: 368132

4 years agoRe-submit r367649: Improve raw_ostream so that you can "write" colors using operator<<
Rui Ueyama [Wed, 7 Aug 2019 08:08:17 +0000 (08:08 +0000)]
Re-submit r367649: Improve raw_ostream so that you can "write" colors using operator<<

The original patch broke buildbots, perhaps because it changed the
default setting whether colors are enabled or not.

llvm-svn: 368131

4 years ago[ARM][LowOverheadLoops] Revert after read/write
Sam Parker [Wed, 7 Aug 2019 07:39:19 +0000 (07:39 +0000)]
[ARM][LowOverheadLoops] Revert after read/write

Currently we check whether LR is stored/loaded to/from inbetween the
loop decrement and loop end pseudo instructions. There's two problems
here:
- It relies on all load/store instructions being labelled as such in
  tablegen.
- Actually any use of loop decrement is troublesome because the value
  doesn't exist!

So we need to check for any read/write of LR that occurs between the
two instructions and revert if we find anything.

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

llvm-svn: 368130

4 years agoForce check prof branch_weights consistency in SwitchInstProfUpdateWrapper
Yevgeny Rouban [Wed, 7 Aug 2019 07:17:45 +0000 (07:17 +0000)]
Force check prof branch_weights consistency in SwitchInstProfUpdateWrapper

This patch turns on the prof branch_weights metadata consistency
check in SwitchInstProfUpdateWrapper.

If this patch causes a failure then please before reverting do report
the IR that hits the assertion and try identifying the pass that
introduces the inconsistency. We have to fix all such passes.

See also the upcoming change https://reviews.llvm.org/D61179
in the Verifier.

Reviewers: davidx, nikic, eraman, reames, chandlerc
Reviewed By: davidx
Differential Revision: https://reviews.llvm.org/D64061

llvm-svn: 368129

4 years ago[RISCV] Remove duplicated logic when determining the target ABI
Roger Ferrer Ibanez [Wed, 7 Aug 2019 07:08:00 +0000 (07:08 +0000)]
[RISCV] Remove duplicated logic when determining the target ABI

We were calculating twice ilp32/lp64. Do this in one place instead.

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

llvm-svn: 368128

4 years ago[X86] Allow any 8-bit immediate to be used with bt/btc/btr/bts memory aliases.
Craig Topper [Wed, 7 Aug 2019 06:17:58 +0000 (06:17 +0000)]
[X86] Allow any 8-bit immediate to be used with bt/btc/btr/bts memory aliases.

We have aliases that disambiguate memory forms of bt/btc/btr/bts
without suffixes to the 32-bit form. These aliases should have
been updated when the instructions were updated in r356413.

llvm-svn: 368127

4 years ago[X86] Use isInt<8> to simplify some code. NFC
Craig Topper [Wed, 7 Aug 2019 06:17:55 +0000 (06:17 +0000)]
[X86] Use isInt<8> to simplify some code. NFC

llvm-svn: 368126

4 years agoDetect HAVE_SYS_TYPES_H in lldb
Haibo Huang [Wed, 7 Aug 2019 06:15:01 +0000 (06:15 +0000)]
Detect HAVE_SYS_TYPES_H in lldb

Summary:
After rL368069 I noticed that HAVE_SYS_TYPES_H is not defined in
Platform.h, or anywhere else in lldb. This change fixes that.

Reviewers: labath

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 368125

4 years ago[MachineCSE][NFC] Use 'profitable' rather than 'beneficial' to name method.
Kai Luo [Wed, 7 Aug 2019 05:40:21 +0000 (05:40 +0000)]
[MachineCSE][NFC] Use 'profitable' rather than 'beneficial' to name method.

llvm-svn: 368124

4 years ago[X86] Limit vpermil2pd/vpermil2ps immediates to 4 bits in the assembly parser.
Craig Topper [Wed, 7 Aug 2019 05:34:27 +0000 (05:34 +0000)]
[X86] Limit vpermil2pd/vpermil2ps immediates to 4 bits in the assembly parser.

The upper 4 bits of the immediate byte are used to encode a
register. We need to limit the explicit immediate to fit in the
remaining 4 bits.

Fixes PR42899.

llvm-svn: 368123

4 years agoReverts commit r368117, r368115 and r368112
Petr Hosek [Wed, 7 Aug 2019 05:15:34 +0000 (05:15 +0000)]
Reverts commit r368117, r368115 and r368112

This reverts commits:

  "Added Delta IR Reduction Tool"
  "[Bugpoint redesign] Added Pass to Remove Global Variables"
  "Added Tool as Dependency to tests & fixed warnings"

Reduce/remove-funcs.ll is failing on bots.

llvm-svn: 368122

4 years agoAppend an executable suffix to the toolchain tool paths on Windows platform.
Galina Kistanova [Wed, 7 Aug 2019 03:19:40 +0000 (03:19 +0000)]
Append an executable suffix to the toolchain tool paths on Windows platform.

Append a default CMake suffix (CMAKE_EXECUTABLE_SUFFIX) for the build host to the toolchain tool path when adding a LLVM external project.
The tool binary files should contain .exe suffix to run them properly on Windows platform when building the projects.

Patch by Vlad Vereschaka.

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

llvm-svn: 368121

4 years agoFixes failing test cases on Windows for rL368119
Alex Brachet [Wed, 7 Aug 2019 03:18:23 +0000 (03:18 +0000)]
Fixes failing test cases on Windows for rL368119

Windows test cases were failing because the executable is called yaml2obj.exe
not just yaml2obj. I removed FileCheck patterns including yaml2obj so they
start matching at the error message not the program name.

llvm-svn: 368120

4 years ago[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Alex Brachet [Wed, 7 Aug 2019 02:44:49 +0000 (02:44 +0000)]
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests

Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath

Reviewed By: rupprecht

Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits

Tags: #llvm

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

llvm-svn: 368119

4 years agoUpstream a few small Apple changes to debugserver - arm64_32, Catalyst
Jason Molenda [Wed, 7 Aug 2019 02:06:06 +0000 (02:06 +0000)]
Upstream a few small Apple changes to debugserver - arm64_32, Catalyst

Adrian's changes to support Catalyst processes and my
changes to support debugserver running on an arm64_32
device (Apple Watch Series 4, which uses an IPL32 model
on arm64 cpus).

llvm-svn: 368118

4 years agoAdded Tool as Dependency to tests & fixed warnings
Diego Trevino Ferrer [Wed, 7 Aug 2019 01:51:56 +0000 (01:51 +0000)]
Added Tool as Dependency to tests & fixed warnings

Summary: Fixes http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan/builds/14002 and http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/35392/steps/build_Lld/logs/stdio

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368117

4 years ago[Gardening] Remove more dead code from IOHandler
Jonas Devlieghere [Wed, 7 Aug 2019 01:50:03 +0000 (01:50 +0000)]
[Gardening] Remove more dead code from IOHandler

Remove more dead code and reformat the file.

llvm-svn: 368116

4 years ago[Bugpoint redesign] Added Pass to Remove Global Variables
Diego Trevino Ferrer [Wed, 7 Aug 2019 00:42:50 +0000 (00:42 +0000)]
[Bugpoint redesign] Added Pass to Remove Global Variables

Summary:
This pass tries to remove Global Variables, as well as their derived uses. For example if a variable `@x` is used by `%call1` and `%call2`, both these uses and the definition of `@x` are deleted. Moreover if `%call1` or `%call2` are used elsewhere those uses are also deleted, and so on recursively.

I'm still uncertain if this pass should remove derived uses, I'm open to suggestions.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368115

4 years agoTLI: darwin does not support _bcmp
Alex Lorenz [Wed, 7 Aug 2019 00:03:37 +0000 (00:03 +0000)]
TLI: darwin does not support _bcmp

Not all Darwin targets support _bcmp in all circumstances.

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

llvm-svn: 368113

4 years agoAdded Delta IR Reduction Tool
Diego Trevino Ferrer [Wed, 7 Aug 2019 00:00:52 +0000 (00:00 +0000)]
Added Delta IR Reduction Tool

Summary: Tool parses input IR file, and runs the delta debugging algorithm to reduce the functions inside the input file.

Reviewers: alexshap, chandlerc

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

> llvm-svn: 368071

llvm-svn: 368112

4 years agoRequire lld for hwasan tests.
Peter Collingbourne [Tue, 6 Aug 2019 23:43:20 +0000 (23:43 +0000)]
Require lld for hwasan tests.

We're using relocations that are unsupported by the version of gold on the
bot, so force the use of lld. One of the tests is already using lld,
so this should be safe.

llvm-svn: 368111