platform/upstream/llvm.git
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

4 years agoRegenerate mmx-arith.ll.
Mitch Phillips [Tue, 6 Aug 2019 23:39:07 +0000 (23:39 +0000)]
Regenerate mmx-arith.ll.

This test golden file has become out of date since the rollback of
rL368081. Update the test to have the correct values.

llvm-svn: 368110

4 years agoRevert "[X86] Add more extract subvector cost model tests for smaller element sizes...
Mitch Phillips [Tue, 6 Aug 2019 23:38:14 +0000 (23:38 +0000)]
Revert "[X86] Add more extract subvector cost model tests for smaller element sizes and smaller than 128-bit vectors."

This reverts commit fc33e33776b7a7ce22e539f0ec2e3bfdb09ad361.

This commit depends on the rolled back commit rL367901, and thus needs
to be rolled back.

llvm-svn: 368109

4 years ago[clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create
Puyan Lotfi [Tue, 6 Aug 2019 23:25:34 +0000 (23:25 +0000)]
[clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create

I also have replaced all the instances of
"auto DW = DirectoryWatcher::create" with
llvm::Expected<std::unique_ptr<DirectoryWatcher>> DW = DirectoryWatcher::create
to make it more clear that DirectoryWatcher::create is returning an Expected.

I've also allowed for logAllUnhandledErrors to consume errors in the case were
DirectoryWatcher::create produces them.

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

llvm-svn: 368108

4 years agoRevert "[X86] Enable -x86-experimental-vector-widening-legalization by default."
Mitch Phillips [Tue, 6 Aug 2019 23:00:43 +0000 (23:00 +0000)]
Revert "[X86] Enable -x86-experimental-vector-widening-legalization by default."

This reverts commit 3de33245d2c992c9e0af60372043540b60f3a810.

This commit broke the MSan buildbots. See
https://reviews.llvm.org/rL367901 for more information.

llvm-svn: 368107

4 years agoRevert "[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag...
Mitch Phillips [Tue, 6 Aug 2019 23:00:30 +0000 (23:00 +0000)]
Revert "[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag from test/CodeGen/X86/"

This reverts commit 3f572c7b8405f36993ec8a226dcddd57283a7c1e.

The MSan sanitizer buildbot was broken by rL367901. This commit
(rL368079) depends on the broken commit that need to be reverted, and
thus itself is being reverted.

See https://reviews.llvm.org/rL367901 for more information.

llvm-svn: 368106

4 years agoUse parenthses to silence warning.
Bill Wendling [Tue, 6 Aug 2019 22:47:47 +0000 (22:47 +0000)]
Use parenthses to silence warning.

llvm-svn: 368105

4 years agoDelay diagnosing asm constraints that require immediates until after inlining
Bill Wendling [Tue, 6 Aug 2019 22:41:22 +0000 (22:41 +0000)]
Delay diagnosing asm constraints that require immediates until after inlining

Summary:
An inline asm call may result in an immediate input value after inlining.
Therefore, don't emit a diagnostic here if the input isn't an immediate.

Reviewers: joerg, eli.friedman, rsmith

Subscribers: asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, s.egerton, krytarowski, mgorny, riccibruno, eraman, cfe-commits

Tags: #clang

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

llvm-svn: 368104

4 years ago[TSAN] Fix tsan on FreeBSD after D54889
Alexander Richardson [Tue, 6 Aug 2019 22:30:48 +0000 (22:30 +0000)]
[TSAN] Fix tsan on FreeBSD after D54889

Summary:
It appears that since https://reviews.llvm.org/D54889, BackgroundThread()
crashes immediately because cur_thread()-> will return a null pointer
which is then dereferenced. I'm not sure why I only see this issue on
FreeBSD and not Linux since it should also be unintialized on other platforms.

Reviewers: yuri, dvyukov, dim, emaste

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

Tags: #sanitizers, #llvm

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

llvm-svn: 368103

4 years agohwasan: Instrument globals.
Peter Collingbourne [Tue, 6 Aug 2019 22:07:29 +0000 (22:07 +0000)]
hwasan: Instrument globals.

Globals are instrumented by adding a pointer tag to their symbol values
and emitting metadata into a special section that allows the runtime to tag
their memory when the library is loaded.

Due to order of initialization issues explained in more detail in the comments,
shadow initialization cannot happen during regular global initialization.
Instead, the location of the global section is marked using an ELF note,
and we require libc support for calling a function provided by the HWASAN
runtime when libraries are loaded and unloaded.

Based on ideas discussed with @evgeny777 in D56672.

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

llvm-svn: 368102

4 years ago[WebAssembly] Lower ASan constructor priority on Emscripten
Guanzhong Chen [Tue, 6 Aug 2019 21:52:58 +0000 (21:52 +0000)]
[WebAssembly] Lower ASan constructor priority on Emscripten

Summary:
This change gives Emscripten the ability to use more than one constructor
priorities that runs before ASan. By convention, constructor priorites 0-100
are reserved for use by the system. ASan on Emscripten now uses priority 50,
leaving plenty of room for use by Emscripten before and after ASan.

This change is done in response to:
https://github.com/emscripten-core/emscripten/pull/9076#discussion_r310323723

Reviewers: kripken, tlively, aheejin

Reviewed By: tlively

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

Tags: #llvm, #clang

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

llvm-svn: 368101

4 years ago[NFC][ScopBuilder] Move buildDomains and its callees to ScopBuilder.
Dominik Adamski [Tue, 6 Aug 2019 21:51:18 +0000 (21:51 +0000)]
[NFC][ScopBuilder] Move buildDomains and its callees to ScopBuilder.

Scope of changes:

1) Moved buildDomains function to ScopBuilder class.
2) Moved buildDomainsWithBranchConstraints function to ScopBuilder class.
3) Moved propagateDomainConstraints to ScopBuilder class.
4) Moved propagateDomainConstraintsToRegionExit to ScopBuilder class.
5) Moved propagateInvalidStmtDomains to ScopBuilder class.
6) Moved getPredecessorDomainConstraints function to ScopBuilder class.
7) Moved addLoopBoundsToHeaderDomain function to ScopBuilder class.
8) Moved getPwAff function to ScopBuilder class.
9) Moved buildConditionSets functions to ScopBuilder class.
10) Added updateMaxLoopDepth, notifyErrorBlock, getOrInitEmptyDomain, isDomainDefined, setDomain functions to Scop class. They are used by ScopBuilder.
11) Moved helper functions: getRegionNodeBasicBlock, getRegionNodeSuccessor, containsErrorBlock, createNextIterationMap, collectBoundedParts, partitionSetParts, buildConditionSet to ScopBuilder.cpp file.

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

llvm-svn: 368100

4 years agogn build: Merge r368065.
Peter Collingbourne [Tue, 6 Aug 2019 21:48:06 +0000 (21:48 +0000)]
gn build: Merge r368065.

llvm-svn: 368099

4 years agogn build: Merge r368052.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:55 +0000 (21:47 +0000)]
gn build: Merge r368052.

llvm-svn: 368098

4 years agogn build: Merge r368054.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:46 +0000 (21:47 +0000)]
gn build: Merge r368054.

llvm-svn: 368097

4 years agogn build: Merge r368086.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:37 +0000 (21:47 +0000)]
gn build: Merge r368086.

llvm-svn: 368096

4 years agogn build: Merge r368070.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:27 +0000 (21:47 +0000)]
gn build: Merge r368070.

llvm-svn: 368095

4 years agoIR: Disable verifier check for GlobalValues with private linkage named after a comdat...
Peter Collingbourne [Tue, 6 Aug 2019 21:47:18 +0000 (21:47 +0000)]
IR: Disable verifier check for GlobalValues with private linkage named after a comdat for non-COFF.

This check is only meaningful for COFF and it is perfectly valid to create
such a GlobalValue in ELF.

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

llvm-svn: 368094

4 years ago[Sanitizer] little typo
David Carlier [Tue, 6 Aug 2019 21:46:01 +0000 (21:46 +0000)]
[Sanitizer] little typo

llvm-svn: 368093

4 years agofix clang-scan-deps test to match filepaths on Windows
Alex Lorenz [Tue, 6 Aug 2019 21:45:43 +0000 (21:45 +0000)]
fix clang-scan-deps test to match filepaths on Windows

llvm-svn: 368092

4 years ago[X86] Don't allow combineSIntToFP to create v2i32 vectors after type legalization.
Craig Topper [Tue, 6 Aug 2019 21:43:15 +0000 (21:43 +0000)]
[X86] Don't allow combineSIntToFP to create v2i32 vectors after type legalization.

If we're after type legalization we should only be trying to turn
v2i64 into v2i32. So bitcast to v4i32, shuffle the even elements
together. Then use X86ISD::CVTSI2P. The alternative is to leave
the v2i64 type alone and let it scalarized. Hopefully keeping
it packed is better.

Fixes PR42905.

llvm-svn: 368091