platform/upstream/llvm.git
6 years ago[ODRHash] Do not rely on Type* when computing the hash.
Vassil Vassilev [Thu, 28 Jun 2018 13:28:44 +0000 (13:28 +0000)]
[ODRHash] Do not rely on Type* when computing the hash.

ODRHash aims to provide Cross-TU stable hashing. Making clang::Type pointer
part of the hash connects (remotely) the ODRHash with the TU-specific
::Profile hasher.

r332281 exposed the issue by changing the way the ASTContext different
elaborated types if there is an owning tag. In that case, ODRHash stores two
 different types in its TypeMap which yields false ODR violation in modules.

The current state of implementation shouldn't need the TypeMap concept
anymore. Rip it out.

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

llvm-svn: 335853

6 years ago[ELF] - EhFrame.cpp: add test case to cover "corrupted CIE" error message.
George Rimar [Thu, 28 Jun 2018 13:24:39 +0000 (13:24 +0000)]
[ELF] - EhFrame.cpp: add test case to cover "corrupted CIE" error message.

This is to test the following line that was uncovered by LLD test cases yet:
https://github.com/llvm-mirror/lld/blob/master/ELF/EhFrame.cpp#L149

llvm-svn: 335852

6 years agoRevert "Add support for generating a call graph profile from Branch Frequency Info."
Benjamin Kramer [Thu, 28 Jun 2018 13:15:03 +0000 (13:15 +0000)]
Revert "Add support for generating a call graph profile from Branch Frequency Info."

This reverts commits r335794 and r335797. Breaks ThinLTO+FDO selfhost.

llvm-svn: 335851

6 years ago[ARM] Parallel DSP Pass
Sjoerd Meijer [Thu, 28 Jun 2018 12:55:29 +0000 (12:55 +0000)]
[ARM] Parallel DSP Pass

Armv6 introduced instructions to perform 32-bit SIMD operations. The purpose of
this pass is to do some straightforward IR pattern matching to create ACLE DSP
intrinsics, which map on these 32-bit SIMD operations.

Currently, only the SMLAD instruction gets recognised. This instruction
performs two multiplications with 16-bit operands, and stores the result in an
accumulator. We will follow this up with patches to recognise SMLAD in more
cases, and also to generate other DSP instructions (like e.g. SADD16).

Patch by: Sam Parker and Sjoerd Meijer

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

llvm-svn: 335850

6 years ago[ELF] - EhFrame.cpp: add test case to cover "DW_EH_PE_aligned encoding is not support...
George Rimar [Thu, 28 Jun 2018 12:46:56 +0000 (12:46 +0000)]
[ELF] - EhFrame.cpp: add test case to cover "DW_EH_PE_aligned encoding is not supported" error.

It is https://github.com/llvm-mirror/lld/blob/master/ELF/EhFrame.cpp#L144,
and we had no test case to cover it.

llvm-svn: 335849

6 years agoFix warning on MSVC by using size_t arithmetic instead of casting after the fact...
Filipe Cabecinhas [Thu, 28 Jun 2018 12:38:43 +0000 (12:38 +0000)]
Fix warning on MSVC by using size_t arithmetic instead of casting after the fact. NFC

llvm-svn: 335848

6 years ago[ELF] - EhFrame.cpp: add test case to check "unknown FDE encoding".
George Rimar [Thu, 28 Jun 2018 12:20:04 +0000 (12:20 +0000)]
[ELF] - EhFrame.cpp: add test case to check "unknown FDE encoding".

It's https://github.com/llvm-mirror/lld/blob/master/ELF/EhFrame.cpp#L147 line,
which was untested before this patch.

llvm-svn: 335847

6 years agoRemove explicit type from an initializer list. NFC.
Alexander Kornienko [Thu, 28 Jun 2018 12:18:42 +0000 (12:18 +0000)]
Remove explicit type from an initializer list. NFC.

llvm-svn: 335846

6 years agoFix formatting. NFC.
Alexander Kornienko [Thu, 28 Jun 2018 12:15:17 +0000 (12:15 +0000)]
Fix formatting. NFC.

llvm-svn: 335845

6 years agoRevert "ADT: Move ArrayRef comparison operators into the class"
Pavel Labath [Thu, 28 Jun 2018 12:10:21 +0000 (12:10 +0000)]
Revert "ADT: Move ArrayRef comparison operators into the class"

This reverts commit r335839, because it breaks the MSVC build.

llvm-svn: 335844

6 years agoThe :option: syntax was generating Sphinx build warnings; switched to double backtick...
Aaron Ballman [Thu, 28 Jun 2018 12:05:40 +0000 (12:05 +0000)]
The :option: syntax was generating Sphinx build warnings; switched to double backticks to silence the warning; NFC.

llvm-svn: 335843

6 years agoCorrect the code highlighting marker to be Objective-C rather than C++ which fixes...
Aaron Ballman [Thu, 28 Jun 2018 12:02:38 +0000 (12:02 +0000)]
Correct the code highlighting marker to be Objective-C rather than C++ which fixes a Sphinx build warning; NFC.

llvm-svn: 335842

6 years agoFix the indentation in this documentation to remove a Sphinx warning; NFC.
Aaron Ballman [Thu, 28 Jun 2018 12:00:16 +0000 (12:00 +0000)]
Fix the indentation in this documentation to remove a Sphinx warning; NFC.

llvm-svn: 335841

6 years ago[ELF] - EhFrame: add test case to cover uncovered branch of the code.
George Rimar [Thu, 28 Jun 2018 11:58:31 +0000 (11:58 +0000)]
[ELF] - EhFrame: add test case to cover uncovered branch of the code.

This test case adds test for the line that was uncovered previously:
https://github.com/llvm-mirror/lld/blob/master/ELF/EhFrame.cpp#L175

it errors out, but we now can test that we have expected flow,
which is different for CIE of version 1 and CIE of version 3.

llvm-svn: 335840

6 years agoADT: Move ArrayRef comparison operators into the class
Pavel Labath [Thu, 28 Jun 2018 11:45:28 +0000 (11:45 +0000)]
ADT: Move ArrayRef comparison operators into the class

Summary:
This allows the implicit ArrayRef conversions to kick in when e.g.
comparing ArrayRef to a SmallVector.

Reviewers: zturner, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 335839

6 years ago[ELF] - Cover "unknown .eh_frame augmentation string" error.
George Rimar [Thu, 28 Jun 2018 11:35:10 +0000 (11:35 +0000)]
[ELF] - Cover "unknown .eh_frame augmentation string" error.

It was https://github.com/llvm-mirror/lld/blob/master/ELF/EhFrame.cpp#L195
and we did not cover it with test.

Patch fixes it.

llvm-svn: 335838

6 years ago[llvm-mca] Refactor method RegisterFile::collectWrites(). NFCI
Andrea Di Biagio [Thu, 28 Jun 2018 11:20:14 +0000 (11:20 +0000)]
[llvm-mca] Refactor method RegisterFile::collectWrites(). NFCI

Rather than calling std::find in a loop, just sort the vector and remove
duplicate entries at the end of the function.

Also, move the debug print at the end of the function, and query the
MCRegisterInfo to print register names rather than physreg IDs.

No functional change intended.

llvm-svn: 335837

6 years ago[clangd] Fix a data race in TUScheduler
Ilya Biryukov [Thu, 28 Jun 2018 11:04:45 +0000 (11:04 +0000)]
[clangd] Fix a data race in TUScheduler

By recomputing CompilerInvocation instead of copying it.
The problem was caused by the fact that copies of CompilerInvocation
store references to the shared state (DiagnosticOptions) when copied,
causing data races when two different copies are destroyed from
different threads.

llvm-svn: 335836

6 years ago[Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ahead-of...
Adam Balogh [Thu, 28 Jun 2018 10:58:53 +0000 (10:58 +0000)]
[Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ahead-of-begin checks

Add handling of the begin() funcion of containers to the iterator checkers,
together with the pre- and postfix ++ and -- operators of the iterators. This
makes possible the checking of iterators dereferenced ahead of the begin of the
container.

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

llvm-svn: 335835

6 years ago[DebugInfo] Follow-up commit to improve consistency. NFC
Jonas Devlieghere [Thu, 28 Jun 2018 10:56:40 +0000 (10:56 +0000)]
[DebugInfo] Follow-up commit to improve consistency. NFC

Follow-up commit for r335757 to address some inconsistencies.

llvm-svn: 335834

6 years ago[ELF] - Add test case to cover "corrupted CIE (failed to read LEB128)" error.
George Rimar [Thu, 28 Jun 2018 10:55:52 +0000 (10:55 +0000)]
[ELF] - Add test case to cover "corrupted CIE (failed to read LEB128)" error.

It is the following line:
https://github.com/llvm-mirror/lld/blob/master/ELF/EhFrame.cpp#L120

We did not cover it yet.

llvm-svn: 335833

6 years agoComment change to verify commit rights. NFC.
Jesper Antonsson [Thu, 28 Jun 2018 10:55:04 +0000 (10:55 +0000)]
Comment change to verify commit rights. NFC.

Summary: Just a silly one-character correction.

Subscribers: llvm-commits

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

llvm-svn: 335832

6 years agos/TablesChecked/TableChecked/ after r335823
Hans Wennborg [Thu, 28 Jun 2018 10:24:38 +0000 (10:24 +0000)]
s/TablesChecked/TableChecked/ after r335823

llvm-svn: 335831

6 years agoAMDGPU: Remove MFI::ABIArgOffset
Matt Arsenault [Thu, 28 Jun 2018 10:18:55 +0000 (10:18 +0000)]
AMDGPU: Remove MFI::ABIArgOffset

We have too many mechanisms for tracking the various offsets
used for kernel arguments, so remove one. There's still a lot of
confusion with these because there are two different "implicit"
argument areas located at the beginning and end of the kernarg
segment.

Additionally, the offset was determined based on the memory
size of the split element types. This would break in a future
commit where v3i32 is decomposed into separate i32 pieces.

llvm-svn: 335830

6 years agoAMDGPU: Error on calls from graphics shaders
Matt Arsenault [Thu, 28 Jun 2018 10:18:36 +0000 (10:18 +0000)]
AMDGPU: Error on calls from graphics shaders

In principle nothing should stop these from working, but
work is necessary to create an ABI for dealing with the stack
related registers.

llvm-svn: 335829

6 years agoAMDGPU: Fix AMDGPUCodeGenPrepare using uninitialized AMDGPUAS struct
Matt Arsenault [Thu, 28 Jun 2018 10:18:23 +0000 (10:18 +0000)]
AMDGPU: Fix AMDGPUCodeGenPrepare using uninitialized AMDGPUAS struct

Not sure how this wasn't noticed before.

llvm-svn: 335828

6 years agoAMDGPU: Fix assert on aggregate type kernel arguments
Matt Arsenault [Thu, 28 Jun 2018 10:18:11 +0000 (10:18 +0000)]
AMDGPU: Fix assert on aggregate type kernel arguments

Just fix the crash for now by not doing the optimization since
figuring out how to properly convert the bits for an arbitrary
struct is a pain.

Also fix a crash when there is only an empty struct argument.

llvm-svn: 335827

6 years ago[ELF] - Removed trailing whitespace. NFC.
George Rimar [Thu, 28 Jun 2018 10:12:59 +0000 (10:12 +0000)]
[ELF] - Removed trailing whitespace. NFC.

llvm-svn: 335826

6 years ago[ELF] - Add test case to cover "corrupted CIE (failed to read string)"
George Rimar [Thu, 28 Jun 2018 10:10:02 +0000 (10:10 +0000)]
[ELF] - Add test case to cover "corrupted CIE (failed to read string)"

It was uncovered by our test cases.

llvm-svn: 335824

6 years agoUnify sorted asserts to use the existing atomic pattern
Benjamin Kramer [Thu, 28 Jun 2018 10:03:45 +0000 (10:03 +0000)]
Unify sorted asserts to use the existing atomic pattern

These are all benign races and only visible in !NDEBUG. tsan complains
about it, but a simple atomic bool is sufficient to make it happy.

llvm-svn: 335823

6 years agoRetrieve a function PDB symbol correctly from nested blocks
Pavel Labath [Thu, 28 Jun 2018 10:03:42 +0000 (10:03 +0000)]
Retrieve a function PDB symbol correctly from nested blocks

Summary:
This patch fixes a problem with retrieving a function symbol by an
address in a nested block. In the current implementation of
ResolveSymbolContext function it retrieves a symbol with
PDB_SymType::None and then checks if found symbol's tag equals to
PDB_SymType::Function. So, if nested block's symbol was found,
ResolveSymbolContext does not resolve a function.

Reviewers: asmith, labath, zturner

Reviewed By: asmith, labath

Differential Revision: https://reviews.llvm.org/D47939
Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com>

llvm-svn: 335822

6 years ago[DAGCombiner] Ensure we use the correct CC result type in visitSDIV
Simon Pilgrim [Thu, 28 Jun 2018 09:54:28 +0000 (09:54 +0000)]
[DAGCombiner] Ensure we use the correct CC result type in visitSDIV

We could get away with it for constant folded cases, but not for rL335719.

Thanks to Krzysztof Parzyszek for noticing.

llvm-svn: 335821

6 years ago[SCCP] Mark CFG as preserved.
Florian Hahn [Thu, 28 Jun 2018 09:53:38 +0000 (09:53 +0000)]
[SCCP] Mark CFG as preserved.

SCCP does not change the CFG, so we can mark it as preserved.

Reviewers: dberlin, efriedma, davide

Reviewed By: davide

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

llvm-svn: 335820

6 years ago[ELF] - Add test case to cover "unexpected end of CIE" error.
George Rimar [Thu, 28 Jun 2018 09:34:59 +0000 (09:34 +0000)]
[ELF] - Add test case to cover "unexpected end of CIE" error.

It was uncovered by our test cases.

llvm-svn: 335819

6 years ago[ELF] - Get rid of precompiled elf object in test case.
George Rimar [Thu, 28 Jun 2018 09:29:49 +0000 (09:29 +0000)]
[ELF] - Get rid of precompiled elf object in test case.

We has precompiled object with unsupported FDE version (=2).
It is possible to use llvm-mc instead for this test.

Patch do this change.

llvm-svn: 335818

6 years ago[DAGCombiner] Remove unused variable. NFCI.
Simon Pilgrim [Thu, 28 Jun 2018 09:29:08 +0000 (09:29 +0000)]
[DAGCombiner] Remove unused variable. NFCI.

Noticed in D45806 review.

llvm-svn: 335817

6 years ago[IndVarSimplify] Ignore unreachable users of truncs
Max Kazantsev [Thu, 28 Jun 2018 08:20:03 +0000 (08:20 +0000)]
[IndVarSimplify] Ignore unreachable users of truncs

If a trunc has a user in a block which is not reachable from entry,
we can safely perform trunc elimination as if this user didn't exist.

llvm-svn: 335816

6 years ago[llvm-exegesis] Add partial X87 support.
Clement Courbet [Thu, 28 Jun 2018 07:41:16 +0000 (07:41 +0000)]
[llvm-exegesis] Add partial X87 support.

Summary:
This enables the X86-specific X86FloatingPointStackifierPass, and allow
llvm-exegesis to generate and measure X87 latency/uops for some FP ops.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 335815

6 years ago[Analyzer] Constraint Manager Negates Difference
Adam Balogh [Thu, 28 Jun 2018 07:35:23 +0000 (07:35 +0000)]
[Analyzer] Constraint Manager Negates Difference

If range [m .. n] is stored for symbolic expression A - B, then we can deduce the range for B - A which is [-n .. -m]. This is only true for signed types, unless the range is [0 .. 0].

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

llvm-svn: 335814

6 years agotest: use regex matchers to make test-case robust against register renumberings
Tobias Grosser [Thu, 28 Jun 2018 07:11:48 +0000 (07:11 +0000)]
test: use regex matchers to make test-case robust against register renumberings

Suggested-by: Michael Kruse
llvm-svn: 335813

6 years ago[CMake] Use explicit targets for building Linux runtimes
Petr Hosek [Thu, 28 Jun 2018 05:15:46 +0000 (05:15 +0000)]
[CMake] Use explicit targets for building Linux runtimes

Previously we were using default logic when building Linux runtimes
in Fuchsia toolchain, but that leads to various issues due to how
the CMake logic in compiler-rt for determining the platform support
is implemented. With this change, we will use explicit target for
every provided Linux sysroot.

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

llvm-svn: 335812

6 years ago[DwarfDebug] Remove unused argument (NFC)
Petar Jovanovic [Thu, 28 Jun 2018 04:50:40 +0000 (04:50 +0000)]
[DwarfDebug] Remove unused argument (NFC)

Remove unused ByteStreamer argument from function emitDebugLocValue.

Patch by Nikola Prica.

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

llvm-svn: 335811

6 years agoHandle both Linux and Windows path separator for the resource dir
Petr Hosek [Thu, 28 Jun 2018 03:54:08 +0000 (03:54 +0000)]
Handle both Linux and Windows path separator for the resource dir

The resource dir path used for the multiarch runtimes support is
constructed in a platform independent way and therefore will use
native path separators on each platform. We need to make sure that
the per target runtime directory test handles both to not fail
when the test is being executed on Windows.

llvm-svn: 335810

6 years agoSupport for multiarch runtimes layout
Petr Hosek [Thu, 28 Jun 2018 03:11:52 +0000 (03:11 +0000)]
Support for multiarch runtimes layout

This change adds a support for multiarch style runtimes layout, so in
addition to the existing layout where runtimes get installed to:

lib/clang/$version/lib/$os

Clang now allows runtimes to be installed to:

lib/clang/$version/$target/lib

This also includes libc++, libc++abi and libunwind; today those are
assumed to be in Clang library directory built for host, with the
new layout it is possible to install libc++, libc++abi and libunwind
into the runtime directory built for different targets.

The use of new layout is enabled by setting the
LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both
projects and runtimes layouts. The runtimes CMake build has been further
modified to use the new layout when building runtimes for multiple
targets.

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

llvm-svn: 335809

6 years ago[analyzer] Remove redundant ';'.
Artem Dergachev [Thu, 28 Jun 2018 02:33:16 +0000 (02:33 +0000)]
[analyzer] Remove redundant ';'.

Fixes a compiler warning. No functionan change intended.

llvm-svn: 335808

6 years ago[modules] Do not serialize / deserialize pending new/delete mismatch
Richard Smith [Thu, 28 Jun 2018 01:57:04 +0000 (01:57 +0000)]
[modules] Do not serialize / deserialize pending new/delete mismatch
checks across module boundaries. This was causing us to load constructor
definitions for all consumers of a module with a pending check.

(In one case we saw ~7% of total frontend time spent loading
constructors for this check.)

llvm-svn: 335807

6 years ago[X86] Use PatFrag with hardcoded numbers for FROUND_NO_EXC/FROUND_CURRENT instead...
Craig Topper [Thu, 28 Jun 2018 01:45:44 +0000 (01:45 +0000)]
[X86] Use PatFrag with hardcoded numbers for FROUND_NO_EXC/FROUND_CURRENT instead of ImmLeafs with predicates where one of the two numbers was hardcoded.

This more efficient for the isel table generator since we can use CheckChildInteger instead of MoveChild, CheckPredicate, MoveParent. This reduced the table size by 1-2K.

I wish there was a way to share the values with X86BaseInfo.h and still use a PatFrag like this. These numbers are fixed by the X86 intrinsic spec going back many years and we should never need to change them. So we shouldn't waste table bytes to support sharing.

llvm-svn: 335806

6 years ago[modules] Ensure that an in-class function definition is attached to the
Richard Smith [Thu, 28 Jun 2018 01:07:28 +0000 (01:07 +0000)]
[modules] Ensure that an in-class function definition is attached to the
declaration of the function that ends up in the primary definition of
the class.

... at least for class templates. This is necessary for us to be able to
track when an inline friend function has a definition that needs to be
(lazily) instantiated.

llvm-svn: 335805

6 years ago[X86] Change how we prefer shift by immediate over folding a load into a shift.
Craig Topper [Thu, 28 Jun 2018 00:47:41 +0000 (00:47 +0000)]
[X86] Change how we prefer shift by immediate over folding a load into a shift.

BMI2 added new shift by register instructions that have the ability to fold a load.

Normally without doing anything special isel would prefer folding a load over folding an immediate because the load folding pattern has higher "complexity". This would require an instruction to move the immediate into a register. We would rather fold the immediate instead and have a separate instruction for the load.

We used to enforce this priority by artificially lowering the complexity of the load pattern.

This patch changes this to instead reject the load fold in isProfitableToFoldLoad if there is an immediate. This is more consistent with other binops and feels less hacky.

llvm-svn: 335804

6 years ago[analyzer] Use sufficiently large types for index bounds calculation.
Artem Dergachev [Thu, 28 Jun 2018 00:42:11 +0000 (00:42 +0000)]
[analyzer] Use sufficiently large types for index bounds calculation.

The ProgramState::assumeInBound() API is used by checkers to make an assumption
that a certain array index is within the array's bounds (i.e. is greater than or
equal to 0 and is less than the length of the array). When the type of the
index was unspecified by the caller, it assumed that the type is 'int', which
caused some indices and sizes to truncate during calculations.

Use ArrayIndexTy by default instead, which is used by the analyzer to represent
index types and is currently hardcoded to long long.

Patch by Bevin Hansson!

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

llvm-svn: 335803

6 years ago[libFuzzer] [Tests] [NFC] Change seed for reduce_inputs.test
George Karpenkov [Thu, 28 Jun 2018 00:39:50 +0000 (00:39 +0000)]
[libFuzzer] [Tests] [NFC] Change seed for reduce_inputs.test

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

llvm-svn: 335802

6 years ago[cmake][xcode-toolchain] add support for major Xcode version >= 10
Alex Lorenz [Thu, 28 Jun 2018 00:39:09 +0000 (00:39 +0000)]
[cmake][xcode-toolchain] add support for major Xcode version >= 10

The regex that extracts the Xcode version should support major versions with two
digits.

rdar://41465184

llvm-svn: 335801

6 years ago[analyzer] Add support for pre-C++17 copy elision.
Artem Dergachev [Thu, 28 Jun 2018 00:30:18 +0000 (00:30 +0000)]
[analyzer] Add support for pre-C++17 copy elision.

r335795 adds copy elision information to CFG. This commit allows static analyzer
to elide elidable copy constructors by constructing the objects that were
previously subject to elidable copy directly in the target region of the copy.

The chain of elided constructors may potentially be indefinitely long. This
only happens when the object is being returned from a function which in turn is
returned from another function, etc.

NRVO is not supported yet.

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

llvm-svn: 335800

6 years agoFixup test to compile with -frtti when trying to use typeid() as the PS4 does not...
Douglas Yung [Thu, 28 Jun 2018 00:19:12 +0000 (00:19 +0000)]
Fixup test to compile with -frtti when trying to use typeid() as the PS4 does not have it on by default and it was failing on the PS4 linux bot because of this.

llvm-svn: 335799

6 years ago[CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.
Artem Dergachev [Thu, 28 Jun 2018 00:18:52 +0000 (00:18 +0000)]
[CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.

When a temporary object is materialized and through that obtain lifetime that
is longer than the duration of the full-expression, it does not require a
temporary object destructor; it will be destroyed in a different manner.

Therefore it's not necessary to include CXXBindTemporaryExpr into the
construction context for such temporary in the CFG only to make clients
throw it away.

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

llvm-svn: 335798

6 years ago[CGProfile] Fix unused variable warning.
Michael J. Spencer [Thu, 28 Jun 2018 00:12:04 +0000 (00:12 +0000)]
[CGProfile] Fix unused variable warning.

llvm-svn: 335797

6 years ago[analyzer] Re-enable lifetime extension for temporaries without destructors.
Artem Dergachev [Thu, 28 Jun 2018 00:11:42 +0000 (00:11 +0000)]
[analyzer] Re-enable lifetime extension for temporaries without destructors.

When an object's class provides no destructor, it's less important to
materialize that object properly because we don't have to model the destructor
correctly, so previously we skipped the support for these syntax patterns.

Additionally, fix support for construction contexts of "static temporaries"
(temporaries that are lifetime-extended by static references) because
it turned out that we only had tests for them without destructors, which caused
us to regress when we re-introduced the construction context for such
temporaries.

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

llvm-svn: 335796

6 years ago[CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.
Artem Dergachev [Thu, 28 Jun 2018 00:04:54 +0000 (00:04 +0000)]
[CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.

Before C++17 copy elision was optional, even if the elidable copy/move
constructor had arbitrary side effects. The elidable constructor is present
in the AST, but marked as elidable.

In these cases CFG now contains additional information that allows its clients
to figure out if a temporary object is only being constructed so that to pass
it to an elidable constructor. If so, it includes a reference to the elidable
constructor's construction context, so that the client could elide the
elidable constructor and construct the object directly at its final destination.

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

llvm-svn: 335795

6 years agoAdd support for generating a call graph profile from Branch Frequency Info.
Michael J. Spencer [Wed, 27 Jun 2018 23:58:08 +0000 (23:58 +0000)]
Add support for generating a call graph profile from Branch Frequency Info.

=== Generating the CG Profile ===

The CGProfile module pass simply gets the block profile count for each BB and scans for call instructions.  For each call instruction it adds an edge from the current function to the called function with the current BB block profile count as the weight.

After scanning all the functions, it generates an appending module flag containing the data. The format looks like:
```
!llvm.module.flags = !{!0}

!0 = !{i32 5, !"CG Profile", !1}
!1 = !{!2, !3, !4} ; List of edges
!2 = !{void ()* @a, void ()* @b, i64 32} ; Edge from a to b with a weight of 32
!3 = !{void (i1)* @freq, void ()* @a, i64 11}
!4 = !{void (i1)* @freq, void ()* @b, i64 20}
```

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

llvm-svn: 335794

6 years ago[libFuzzer] [NFC] [Tests] Mark signal handling tests as UNSUPPORTED on Darwin
George Karpenkov [Wed, 27 Jun 2018 23:11:24 +0000 (23:11 +0000)]
[libFuzzer] [NFC] [Tests] Mark signal handling tests as UNSUPPORTED on Darwin

Under load, these tests tend to fail sporadically on our bots.
In my understanding, the signal handling is not guaranteed to happen
within 2 seconds, and the test is inherently flaky.

llvm-svn: 335792

6 years ago[analyzer] Add clangFrontend to target_link_libraries
Heejin Ahn [Wed, 27 Jun 2018 22:05:09 +0000 (22:05 +0000)]
[analyzer] Add clangFrontend to target_link_libraries

Without this, builds with `-DSHARED_LIB=ON` fail.

llvm-svn: 335791

6 years ago[sanitizer] zx_cprng_draw no longer returns any value
Petr Hosek [Wed, 27 Jun 2018 21:25:21 +0000 (21:25 +0000)]
[sanitizer] zx_cprng_draw no longer returns any value

Remove the return value check.

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

llvm-svn: 335790

6 years agoMove some code from PDBFileBuilder to MSFBuilder.
Zachary Turner [Wed, 27 Jun 2018 21:18:15 +0000 (21:18 +0000)]
Move some code from PDBFileBuilder to MSFBuilder.

The code to emit the pieces of the MSF file were actually in
PDBFileBuilder.  Move this to MSFBuilder so that we can
theoretically emit an MSF without having a PDB file.

llvm-svn: 335789

6 years ago[X86] Make folding table checking threadsafe
Benjamin Kramer [Wed, 27 Jun 2018 21:01:53 +0000 (21:01 +0000)]
[X86] Make folding table checking threadsafe

This is a benign race, but tsan likes to complain about it. Just make it
happy.

llvm-svn: 335788

6 years ago[X86] In X86DAGToDAGISel::PreprocessISelDAG, make sure we don't access N after we...
Craig Topper [Wed, 27 Jun 2018 20:58:46 +0000 (20:58 +0000)]
[X86] In X86DAGToDAGISel::PreprocessISelDAG, make sure we don't access N after we delete it.

If we turn X86ISD::AND into ISD::AND, we delete N. But we were continuing onto the next block of code even though N no longer existed.

Just happened to notice it. I assume asan didn't notice it because we explicitly unpoison deleted nodes and give them a DELETE_NODE opcode.

llvm-svn: 335787

6 years ago[RISCV] Add machine function pass to merge base + offset
Sameer AbuAsal [Wed, 27 Jun 2018 20:51:42 +0000 (20:51 +0000)]
[RISCV] Add machine function pass to merge base + offset

Summary:
   In r333455 we added a peephole to fix the corner cases that result
   from separating base + offset lowering of global address.The
   peephole didn't handle some of the cases because it only has a basic
   block view instead of a function level view.

   This patch replaces that logic with a machine function pass. In
   addition to handling the original cases it handles uses of the global
   address across blocks in function and folding an offset from LW\SW
   instruction. This pass won't run for OptNone compilation, so there
   will be a negative impact overall vs the old approach at O0.

Reviewers: asb, apazos, mgrang

Reviewed By: asb

Subscribers: MartinMosbeck, brucehoult, the_o, rogfer01, mgorny, rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, llvm-commits, edward-jones

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

llvm-svn: 335786

6 years ago[llvm-objdump] Add -x --all-headers options
Fangrui Song [Wed, 27 Jun 2018 20:45:11 +0000 (20:45 +0000)]
[llvm-objdump] Add -x --all-headers options

Reviewers: paulsemel, echristo

Subscribers: llvm-commits

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

llvm-svn: 335785

6 years ago[ELF] Use %eiz after disassembler change in r335768
Fangrui Song [Wed, 27 Jun 2018 20:43:23 +0000 (20:43 +0000)]
[ELF] Use %eiz after disassembler change in r335768

llvm-svn: 335784

6 years ago[ScopHelper] Cache ScopExpander results.
Eli Friedman [Wed, 27 Jun 2018 20:35:02 +0000 (20:35 +0000)]
[ScopHelper] Cache ScopExpander results.

The number of SCEV expressions is usually linear in the number of IR
instructions being modeled.  However, a naive SCEV visitor is not. For
an expression like x*x, "x" will be visited twice.  If x is itself an
expression like x*x, that will be visited twice, etc, and the overall
runtime is O(2^N) in the number of SCEV expressions.

To prevent this from happening, add a cache, so we only visit each SCEV
expression once.

Not sure this is the best solution. Maybe we can instead check whether
the SCEV is scop-invariant (in which case we never need to map the
value). But we don't have a utility for that at the moment.

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

llvm-svn: 335783

6 years ago[www] Update cxx_dr_status for recent DR fixes.
Richard Smith [Wed, 27 Jun 2018 20:30:36 +0000 (20:30 +0000)]
[www] Update cxx_dr_status for recent DR fixes.

llvm-svn: 335782

6 years agoDR1687: When overload resolution selects a built-in operator, implicit
Richard Smith [Wed, 27 Jun 2018 20:30:34 +0000 (20:30 +0000)]
DR1687: When overload resolution selects a built-in operator, implicit
conversions are only applied to operands of class type, and the second
standard conversion sequence is not applied.

When diagnosing an invalid builtin binary operator, talk about the
original types rather than the converted types. If these differ by a
user-defined conversion, tell the user what happened.

llvm-svn: 335781

6 years ago[Modules][ObjC] Warn on the use of '@import' in framework headers
Bruno Cardoso Lopes [Wed, 27 Jun 2018 20:29:36 +0000 (20:29 +0000)]
[Modules][ObjC] Warn on the use of '@import' in framework headers

Using @import in framework headers inhibit the use of such headers
when not using modules, this is specially bad for headers that end
up in the SDK (or any other system framework). Add a warning to give
users some indication that this is discouraged.

rdar://problem/39192894

llvm-svn: 335780

6 years agoDR1213: Ignore implicit conversions when determining if an operand of an
Richard Smith [Wed, 27 Jun 2018 20:29:32 +0000 (20:29 +0000)]
DR1213: Ignore implicit conversions when determining if an operand of an
array subscript expression is an array prvalue.

Also apply DR1213 to vector prvalues for consistency.

llvm-svn: 335779

6 years ago[InstCombine] add tests for vector-select-of-binops with 2 variables; NFC
Sanjay Patel [Wed, 27 Jun 2018 20:23:47 +0000 (20:23 +0000)]
[InstCombine] add tests for vector-select-of-binops with 2 variables; NFC

llvm-svn: 335778

6 years agoAnother shot at fixing android r335644 failure
Vlad Tsyrklevich [Wed, 27 Jun 2018 20:00:55 +0000 (20:00 +0000)]
Another shot at fixing android r335644 failure

The android buildbot moves the build outputs to a different directory
and rewrites the executable path, the DSO passed as an argument does not
get re-written. Use rpaths to load the DSO the same way the
test/cfi/cross-dso/ tests do and test the DSO name differently.

llvm-svn: 335777

6 years ago[SymbolFile] Implement GetCompleteObjCClass for .debug_names
Jonas Devlieghere [Wed, 27 Jun 2018 19:58:39 +0000 (19:58 +0000)]
[SymbolFile] Implement GetCompleteObjCClass for .debug_names

When running the test suite with .debug_names a bunch of tests were
failing because GetCompleteObjCClass was not yet implemented for
DebugNamesDWARFIndex. This patch adds the required logic.

We use the .debug_names to find the Objective-C class and then rely on
DW_AT_APPLE_objc_complete_type to find the complete type. If we can't
find it or the attribute is not supported, we return a list of potential
complete types.

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

llvm-svn: 335776

6 years agoDocument the git config for Windows to do line-endings correctly.
Paul Robinson [Wed, 27 Jun 2018 19:58:28 +0000 (19:58 +0000)]
Document the git config for Windows to do line-endings correctly.

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

llvm-svn: 335775

6 years ago[HIP] Fix ordering of device-libs linking
Aaron Enye Shi [Wed, 27 Jun 2018 19:51:42 +0000 (19:51 +0000)]
[HIP] Fix ordering of device-libs linking

Summary:
HIP should link the bitcodes with caller functions before callee functions. Also added lit test to check the ordering of the linked bitcodes is matches.

Reviewers: yaxunl, b-sumner

Reviewed By: yaxunl, b-sumner

Subscribers: cfe-commits, yaxunl, b-sumner, scchan

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

llvm-svn: 335774

6 years ago[DAGCombine] Disable TokenFactor simplifications when optnone.
Nirav Dave [Wed, 27 Jun 2018 19:41:25 +0000 (19:41 +0000)]
[DAGCombine] Disable TokenFactor simplifications when optnone.

llvm-svn: 335773

6 years ago[ADT] drop_begin: use adl_begin/adl_end. NFC.
Michael Kruse [Wed, 27 Jun 2018 19:39:03 +0000 (19:39 +0000)]
[ADT] drop_begin: use adl_begin/adl_end. NFC.

Summary:
The instantiation of the drop_begin function template usually fails because the functions begin() and end() do not exist. Only when using on a container from the std namespace (or `llvm::iterator_range`s of something derived from `std::iterator`), they are matched to std::begin() and std::end() due to Koenig-lookup.

Explicitly use llvm::adl_begin and llvm::adl_end to make drop_begin applicable to anything iterable (including C-style arrays).

A solution for general `llvm::iterator_range`s was already tried in r244620, but got reverted in r244621 due to MSVC not liking it.

Reviewers: dblaikie, grosbach, aaron.ballman, ruiu

Reviewed By: dblaikie, aaron.ballman

Subscribers: aaron.ballman, llvm-commits

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

llvm-svn: 335772

6 years ago[WebAssembly] Try fixing test/CodeGen/WebAssembly/vector_sdiv.ll
Fangrui Song [Wed, 27 Jun 2018 19:35:50 +0000 (19:35 +0000)]
[WebAssembly] Try fixing test/CodeGen/WebAssembly/vector_sdiv.ll

llvm-svn: 335771

6 years ago[clang-tidy/ObjC] Add hashing algorithm acronyms to objc-property-declaration
Ben Hamilton [Wed, 27 Jun 2018 19:13:09 +0000 (19:13 +0000)]
[clang-tidy/ObjC] Add hashing algorithm acronyms to objc-property-declaration

Summary:
This PR adds a few acronyms related to hashing algorithms to the standard
list in `objc-property-declaration`.

Reviewers: Wizard

Reviewed By: Wizard

Subscribers: cfe-commits

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

llvm-svn: 335770

6 years ago[X86] Fix unmatched parenthesis in r335768
Fangrui Song [Wed, 27 Jun 2018 19:12:07 +0000 (19:12 +0000)]
[X86] Fix unmatched parenthesis in r335768

llvm-svn: 335769

6 years ago[X86] Teach the disassembler to use %eiz/%riz instead of NoRegister when the SIB...
Craig Topper [Wed, 27 Jun 2018 19:03:36 +0000 (19:03 +0000)]
[X86] Teach the disassembler to use %eiz/%riz instead of NoRegister when the SIB byte is present, but doesn't encode an index register and there was another shorter encoding that would achieve the same result.

The %eiz/%riz are dummy registers that force the encoder to emit a SIB byte when it normally wouldn't. By emitting them in the disassembly output we ensure that assembling the disassembler output would also produce a SIB byte.

This should match the behavior of objdump from binutils.

llvm-svn: 335768

6 years ago[globalisel][legalizer] Add AtomicOrdering to LegalityQuery and use it in AArch64
Daniel Sanders [Wed, 27 Jun 2018 19:03:21 +0000 (19:03 +0000)]
[globalisel][legalizer] Add AtomicOrdering to LegalityQuery and use it in AArch64

Now that we have the ability to legalize based on MMO's. Add support for
legalizing based on AtomicOrdering and use it to correct the legalization
of the atomic instructions.

Also extend all() to be a variadic template as this ruleset now requires
3 and 4 argument versions.

llvm-svn: 335767

6 years ago[ThinLTO] Fix test
Teresa Johnson [Wed, 27 Jun 2018 19:00:35 +0000 (19:00 +0000)]
[ThinLTO] Fix test

Fix test changes added in r335760. Even though we are invoking llvm-lto2
in single threaded mode, the order of processing the modules in the
backend is apparently not deterministic. Handle the expected debug
messages in any order. (The determinism would be good to fix, but not
related to this change.)

This also undoes the change I made in r335764 to help debug this.

llvm-svn: 335766

6 years ago[HIP] Support flush denormals bitcode
Aaron Enye Shi [Wed, 27 Jun 2018 18:58:55 +0000 (18:58 +0000)]
[HIP] Support flush denormals bitcode

Summary:
Use oclc_daz_opt_on.amdgcn.bc bitcode when option fcuda-flush-denormal-to-zero is enabled, otherwise use oclc_daz_opt_off.amdgcn.bc bitcode. Added lit tests to verify that the correct bitcode is linked when -fcuda-flush-denormal-to-zero option is enabled or disabled.

Reviewers: yaxunl, scchan, b-sumner

Reviewed By: yaxunl, scchan, b-sumner

Subscribers: cfe-commits, yaxunl

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

llvm-svn: 335765

6 years ago[ThinLTO] Modify test to help diagnose bot failures
Teresa Johnson [Wed, 27 Jun 2018 18:36:53 +0000 (18:36 +0000)]
[ThinLTO] Modify test to help diagnose bot failures

I am getting bot failures from r335760 that are difficult to diagnose
since the stderr is getting redirected to FileCheck. Save and dump the
debug output to stderr to help debug the issue.

llvm-svn: 335764

6 years ago[CUDA] Use atexit() to call module destructor.
Artem Belevich [Wed, 27 Jun 2018 18:32:51 +0000 (18:32 +0000)]
[CUDA] Use atexit() to call module destructor.

This matches the way NVCC does it. Doing module cleanup at global
destructor phase used to work, but is, apparently, too late for
the CUDA runtime in CUDA-9.2, which ends up crashing with double-free.

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

llvm-svn: 335763

6 years ago[UBSan] Add silence_unsigned_overflow flag.
Matt Morehouse [Wed, 27 Jun 2018 18:24:46 +0000 (18:24 +0000)]
[UBSan] Add silence_unsigned_overflow flag.

Summary:
Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIO
reports.  This feature, combined with
-fsanitize-recover=unsigned-integer-overflow, is useful for providing
fuzzing signal without the excessive log output.

Helps with https://github.com/google/oss-fuzz/issues/910.

Reviewers: kcc, vsk

Reviewed By: vsk

Subscribers: vsk, kubamracek, Dor1s, llvm-commits

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

llvm-svn: 335762

6 years ago[DAGCombiner] restrict (float)((int) f) --> ftrunc with no-signed-zeros
Sanjay Patel [Wed, 27 Jun 2018 18:16:40 +0000 (18:16 +0000)]
[DAGCombiner] restrict (float)((int) f) --> ftrunc with no-signed-zeros

As noted in the D44909 review, the transform from (fptosi+sitofp) to ftrunc
can produce -0.0 where the original code does not:

#include <stdio.h>

int main(int argc) {
  float x;
  x = -0.8 * argc;
  printf("%f\n", (float)((int)x));
  return 0;
}

$ clang -O0 -mavx fp.c ; ./a.out
0.000000
$ clang -O1 -mavx fp.c ; ./a.out
-0.000000

Ideally, we'd use IR/node flags to predicate the transform, but the IR parser
doesn't currently allow fast-math-flags on the cast instructions. So for now,
just use the function attribute that corresponds to clang's "-fno-signed-zeros"
option.

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

llvm-svn: 335761

6 years ago[ThinLTO] Print names in function import debug messages when available
Teresa Johnson [Wed, 27 Jun 2018 18:03:39 +0000 (18:03 +0000)]
[ThinLTO] Print names in function import debug messages when available

Summary:
Rather than just print the GUID, when it is available in the index,
print the global name as well in the function import thin link debug
messages. Names will be available when the combined index is being
built by the same process, e.g. a linker or "llvm-lto2 run".

Reviewers: davidxl

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, llvm-commits

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

llvm-svn: 335760

6 years ago[Object] Allow iterating over an IRObjectFile's modules
Justin Bogner [Wed, 27 Jun 2018 17:58:32 +0000 (17:58 +0000)]
[Object] Allow iterating over an IRObjectFile's modules

If you've already loaded an IRObjectFile and need access to the
Modules themselves you shouldn't have to reparse a byte stream to do
it. Adds an accessor for the modules in IRObjectFile.

llvm-svn: 335759

6 years ago[MachineOutliner] Don't outline sequences where x16/x17/nzcv are live across
Jessica Paquette [Wed, 27 Jun 2018 17:43:27 +0000 (17:43 +0000)]
[MachineOutliner] Don't outline sequences where x16/x17/nzcv are live across

It isn't safe to outline sequences of instructions where x16/x17/nzcv live
across the sequence.

This teaches the outliner to check whether or not a specific canidate has
x16/x17/nzcv live across it and discard the candidate in the case that that is
true.

https://bugs.llvm.org/show_bug.cgi?id=37573
https://reviews.llvm.org/D47655

llvm-svn: 335758

6 years ago[DebugInfo] Emit ObjC methods as part of interface
Jonas Devlieghere [Wed, 27 Jun 2018 17:31:59 +0000 (17:31 +0000)]
[DebugInfo] Emit ObjC methods as part of interface

As brought up during the discussion of the DWARF5 accelerator tables,
there is currently no way to associate Objective-C methods with the
interface they belong to, other than the .apple_objc accelerator table.

After due consideration we came to the conclusion that it makes more
sense to follow Pavel's suggestion of just emitting this information in
the .debug_info section. One concern was that categories were
emitted in the .apple_names as well, but it turns out that LLDB doesn't
rely on the accelerator tables for this information.

This patch changes the codegen behavior to emit subprograms for
structure types, like we do for C++. This will result in the
DW_TAG_subprogram being nested as a child under its
DW_TAG_structure_type. This behavior is only enabled for DWARF5 and
later, so we can have a unique code path in LLDB with regards to
obtaining the class methods.

This was tested on the LLDB side and doesn't lead to a regression.
There's already code in place to deal with member functions in C++,
which deals with this transparently.

For more background please refer to the discussion on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-June/123986.html

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

llvm-svn: 335757

6 years ago[InstCombine] add more tests for shuffle with different binops; NFC
Sanjay Patel [Wed, 27 Jun 2018 17:21:57 +0000 (17:21 +0000)]
[InstCombine] add more tests for shuffle with different binops; NFC

llvm-svn: 335756

6 years ago[sanitizer] zx_cprng_draw no longer takes the output argument
Petr Hosek [Wed, 27 Jun 2018 16:49:37 +0000 (16:49 +0000)]
[sanitizer] zx_cprng_draw no longer takes the output argument

The zx_cprng_draw system call no longer takes the output argument.

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

llvm-svn: 335755

6 years ago[X86] Use bts/btr/btc for single bit set/clear/complement of a variable bit position
Craig Topper [Wed, 27 Jun 2018 16:47:39 +0000 (16:47 +0000)]
[X86] Use bts/btr/btc for single bit set/clear/complement of a variable bit position

If we are just modifying a single bit at a variable bit position we can use the BT* instructions to make the change instead of shifting a 1(or rotating a -1) and doing a binop. These instruction also ignore the upper bits of their index input so we can also remove an and if one is present on the index.

Fixes PR37938.

llvm-svn: 335754

6 years ago[X86] Add test cases for D48606.
Craig Topper [Wed, 27 Jun 2018 16:47:36 +0000 (16:47 +0000)]
[X86] Add test cases for D48606.

llvm-svn: 335753

6 years agoRevert "[Analyzer] Moved RangeConstraintManager to header. NFC."
Mikhail R. Gadelha [Wed, 27 Jun 2018 16:45:58 +0000 (16:45 +0000)]
Revert "[Analyzer] Moved RangeConstraintManager to header. NFC."

This broke a number of bots.

This reverts commit 5e1a89912d37a21c3b49ccf30600d7f498dffa9c.

llvm-svn: 335752