platform/upstream/llvm.git
6 years ago[llvm-exegesis] Fix compilation on lld-x86_64-darwin13
Clement Courbet [Wed, 4 Apr 2018 12:01:46 +0000 (12:01 +0000)]
[llvm-exegesis] Fix compilation on lld-x86_64-darwin13

YAMLTraits does not know how to serialize `size_t` portably. Use `int`
instead.

llvm-svn: 329176

6 years ago[llvm-exegesis][NFC] Fix compilation warning.
Clement Courbet [Wed, 4 Apr 2018 12:01:43 +0000 (12:01 +0000)]
[llvm-exegesis][NFC] Fix compilation warning.

llvm-svn: 329175

6 years ago[llvm-exegesis][NFC] Fix a few warnings.
Clement Courbet [Wed, 4 Apr 2018 12:01:38 +0000 (12:01 +0000)]
[llvm-exegesis][NFC] Fix a few warnings.

llvm-svn: 329174

6 years ago[Tablegen] Slightly refactor method SubtargetEmitter::EmitExtraProcessorInfo.
Andrea Di Biagio [Wed, 4 Apr 2018 11:53:13 +0000 (11:53 +0000)]
[Tablegen] Slightly refactor method SubtargetEmitter::EmitExtraProcessorInfo.

This patch moves most of the logic from EmitExtraProcessorInfo to a couple of
helper functions. No functional change intended.

llvm-svn: 329173

6 years ago[llvm-exegesis] Fix build when libpfm is not available.
Clement Courbet [Wed, 4 Apr 2018 11:48:15 +0000 (11:48 +0000)]
[llvm-exegesis] Fix build when libpfm is not available.

llvm-svn: 329172

6 years ago[llvm-exegesis] Fix compilation on some clang versions.
Clement Courbet [Wed, 4 Apr 2018 11:45:53 +0000 (11:45 +0000)]
[llvm-exegesis] Fix compilation on some clang versions.

default initialization of an object of const type 'const llvm::DebugLoc' requires a user-provided default constructor.

llvm-svn: 329171

6 years agoMake helpers static. NFC.
Benjamin Kramer [Wed, 4 Apr 2018 11:45:11 +0000 (11:45 +0000)]
Make helpers static. NFC.

llvm-svn: 329170

6 years agoRe-land r329156 "Add llvm-exegesis tool."
Clement Courbet [Wed, 4 Apr 2018 11:37:06 +0000 (11:37 +0000)]
Re-land r329156 "Add llvm-exegesis tool."

Fixed to depend on and initialize the native target instead of X86.

llvm-svn: 329169

6 years ago[X86][CostModel] Use generic SSE levels instead of particular CPUs for shuffle costs
Simon Pilgrim [Wed, 4 Apr 2018 11:14:12 +0000 (11:14 +0000)]
[X86][CostModel] Use generic SSE levels instead of particular CPUs for shuffle costs

llvm-svn: 329168

6 years ago[libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES when confi...
Simon Dardis [Wed, 4 Apr 2018 11:05:03 +0000 (11:05 +0000)]
[libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES when configuring

When libcxx is built in tree for a host which requires libatomic, LLVM's
configuration steps will determine it is required and add it to
CMAKE_REQUIRED_LIBRARIES. When libcxx is later configured, it tests if it
has C++ atomics without libatomic. The test erroneously passes as libatomic
is already part of the set of required libraries.

In turn, a number of the atomic tests will fail as they require libatomic
but the test suite is configured not to use libatomic.

Address this by always dropping libatomic from the set of required libraries
before determining if LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB is true,
then restoring the set of required libraries.

Reviewers: EricWF

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

llvm-svn: 329167

6 years agoAMDGPU: Dimension-aware image intrinsics
Nicolai Haehnle [Wed, 4 Apr 2018 10:58:54 +0000 (10:58 +0000)]
AMDGPU: Dimension-aware image intrinsics

Summary:
These new image intrinsics contain the texture type as part of
their name and have each component of the address/coordinate as
individual parameters.

This is a preparatory step for implementing the A16 feature, where
coordinates are passed as half-floats or -ints, but the Z compare
value and texel offsets are still full dwords, making it difficult
or impossible to distinguish between A16 on or off in the old-style
intrinsics.

Additionally, these intrinsics pass the 'texfailpolicy' and
'cachectrl' as i32 bit fields to reduce operand clutter and allow
for future extensibility.

v2:
- gather4 supports 2darray images
- fix a bug with 1D images on SI

Change-Id: I099f309e0a394082a5901ea196c3967afb867f04

Reviewers: arsenm, rampitec, b-sumner

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 329166

6 years agoStructurizeCFG: Test for branch divergence correctly
Nicolai Haehnle [Wed, 4 Apr 2018 10:58:15 +0000 (10:58 +0000)]
StructurizeCFG: Test for branch divergence correctly

Fixes cases like the new test @nonuniform. In that test, %cc itself
is a uniform value; however, when reading it after the end of the loop in
basic block %if, its value is effectively non-uniform, so the branch is
non-uniform.

This problem was encountered in
https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change
in itself is not sufficient to fix that bug, as there is another issue
in the AMDGPU backend.

As discovered after committing an earlier version of this change, this
exposes a subtle interaction between this pass and DivergenceAnalysis:
since we remove and re-create branch instructions, we can no longer rely
on DivergenceAnalysis for branches in subregions that were already
processed by the pass.

Explicitly remove branch instructions from DivergenceAnalysis to
avoid dangling pointers as a matter of defensive programming, and
change how we detect non-uniform subregions.

Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4

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

llvm-svn: 329165

6 years agoAMDGPU: Fix copying i1 value out of loop with non-uniform exit
Nicolai Haehnle [Wed, 4 Apr 2018 10:57:58 +0000 (10:57 +0000)]
AMDGPU: Fix copying i1 value out of loop with non-uniform exit

Summary:
When an i1-value is defined inside of a loop and used outside of it, we
cannot simply use the SGPR bitmask from the loop's last iteration.

There are also useful and correct cases of an i1-value being copied between
basic blocks, e.g. when a condition is computed outside of a loop and used
inside it. The concept of dominators is not sufficient to capture what is
going on, so I propose the notion of "lane-dominators".

Fixes a bug encountered in Nier: Automata.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103743
Change-Id: If37b969ddc71d823ab3004aeafb9ea050e45bd9a

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 329164

6 years ago[AArch64] Add patterns matching (fabs (fsub x y)) to (fabd x y)
John Brawn [Wed, 4 Apr 2018 10:12:53 +0000 (10:12 +0000)]
[AArch64] Add patterns matching (fabs (fsub x y)) to (fabd x y)

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

llvm-svn: 329163

6 years ago[ELF] - Cleanup. NFCI.
George Rimar [Wed, 4 Apr 2018 09:39:05 +0000 (09:39 +0000)]
[ELF] - Cleanup. NFCI.

Rename field, added comments.

This is splitted from the D44894.
Requested to be committed as independent cleanup.

llvm-svn: 329162

6 years agoAs we don't use minor version anymore, let's remove it from the release notes too
Sylvestre Ledru [Wed, 4 Apr 2018 09:38:22 +0000 (09:38 +0000)]
As we don't use minor version anymore, let's remove it from the release notes too

llvm-svn: 329161

6 years ago[DAGCombine] Improve ReduceLoadWidth for SRL
Sam Parker [Wed, 4 Apr 2018 09:26:56 +0000 (09:26 +0000)]
[DAGCombine] Improve ReduceLoadWidth for SRL

Recommitting rL321259. Previosuly this caused an issue with PPCBE but
I didn't receieve a reproducer and didn't have the time to follow up.
If the issue appears again, please provide a reproducer so I can fix
it.

Original commit message:

If the SRL node is only used by an AND, we may be able to set the
ExtVT to the width of the mask, making the AND redundant. To support
this, another check has been added in isLegalNarrowLoad which queries
whether the load is valid.

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

llvm-svn: 329160

6 years ago[ELF] - Rename checkSectionOverlap() to checkSections(). NFC.
George Rimar [Wed, 4 Apr 2018 09:24:31 +0000 (09:24 +0000)]
[ELF] - Rename checkSectionOverlap() to checkSections(). NFC.

Renaming was requested in post commit review for D43820.

llvm-svn: 329159

6 years ago[ARM] Do not convert some vmov instructions
Mikhail Maltsev [Wed, 4 Apr 2018 08:54:19 +0000 (08:54 +0000)]
[ARM] Do not convert some vmov instructions

Summary:
Patch https://reviews.llvm.org/D44467 implements conversion of invalid
vmov instructions into valid ones. It turned out that some valid
instructions also get converted, for example

  vmov.i64 d2, #0xff00ff00ff00ff00 ->
  vmov.i16 d2, #0xff00

Such behavior is incorrect because according to the ARM ARM section
F2.7.7 Modified immediate constants in T32 and A32 Advanced SIMD
instructions, "On assembly, the data type must be matched in the table
if possible."

This patch fixes the isNEONmovReplicate check so that the above
instruction is not modified any more.

Reviewers: rengolin, olista01

Reviewed By: rengolin

Subscribers: javed.absar, kristof.beyls, rogfer01, llvm-commits

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

llvm-svn: 329158

6 years agoRevert r329156 "Add llvm-exegesis tool."
Clement Courbet [Wed, 4 Apr 2018 08:22:54 +0000 (08:22 +0000)]
Revert r329156 "Add llvm-exegesis tool."

Breaks a bunch of bots.

llvm-svn: 329157

6 years agoAdd llvm-exegesis tool.
Clement Courbet [Wed, 4 Apr 2018 08:13:32 +0000 (08:13 +0000)]
Add llvm-exegesis tool.

Summary:
[llvm-exegesis][RFC] Automatic Measurement of Instruction Latency/Uops

This is the code corresponding to the RFC "llvm-exegesis Automatic Measurement of Instruction Latency/Uops".

The RFC is available on the LLVM mailing lists as well as the following document
for easier reading:
https://docs.google.com/document/d/1QidaJMJUyQdRrFKD66vE1_N55whe0coQ3h1GpFzz27M/edit?usp=sharing

Subscribers: mgorny, gchatelet, orwant, llvm-commits

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

llvm-svn: 329156

6 years ago[ELF] - Revert r329060 "Simplify createFiles. NFCI."
George Rimar [Wed, 4 Apr 2018 08:13:28 +0000 (08:13 +0000)]
[ELF] - Revert r329060 "Simplify createFiles. NFCI."

Was requested during post commit review.

llvm-svn: 329155

6 years ago[X86] Use the same predicate for the load for PMOVSXBQ and PMOVZXBQ.
Craig Topper [Wed, 4 Apr 2018 07:00:24 +0000 (07:00 +0000)]
[X86] Use the same predicate for the load for PMOVSXBQ and PMOVZXBQ.

These both use a 16-bit load, but one used loadi16_anyext and the other used extloadi32i16. The only difference between them is that loadi16_anyext checked that the load was at least 2 byte aligned and non-volatile. But the alignment doesn't matter here. Just use extloadi32i16 for both.

llvm-svn: 329154

6 years ago[X86] Use loadi16/loadi32 predicates in multiply patterns
Craig Topper [Wed, 4 Apr 2018 07:00:19 +0000 (07:00 +0000)]
[X86] Use loadi16/loadi32 predicates in multiply patterns

llvm-svn: 329153

6 years ago[X86] Remove more dead code left over from the handling of i8/i16 UMUL_LOHI/SMUL_LOHI...
Craig Topper [Wed, 4 Apr 2018 07:00:16 +0000 (07:00 +0000)]
[X86] Remove more dead code left over from the handling of i8/i16 UMUL_LOHI/SMUL_LOHI that is no longer needed. NFC

llvm-svn: 329152

6 years agoFix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.
Eric Fiselier [Wed, 4 Apr 2018 06:31:21 +0000 (06:31 +0000)]
Fix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.

Previously UnaryTransformType nodes were comparing the same node
for structural equivalence. This was due to a typo where T1 was
on both sides of the comparison. This patch corrects that typo.

Unfortunately I couldn't find a way to test this change. It seems
that currently UnaryTransform nodes are never actually checked
for equivalence, only their canonical types are.

None the less, this correction seemed appropriate.

llvm-svn: 329151

6 years ago[SCEV] Prove implications for SCEVUnknown Phis
Max Kazantsev [Wed, 4 Apr 2018 05:46:47 +0000 (05:46 +0000)]
[SCEV] Prove implications for SCEVUnknown Phis

This patch teaches SCEV how to prove implications for SCEVUnknown nodes that are Phis.
If we need to prove `Pred` for `LHS, RHS`, and `LHS` is a Phi with possible incoming values
`L1, L2, ..., LN`, then if we prove `Pred` for `(L1, RHS), (L2, RHS), ..., (LN, RHS)` then we can also
prove it for `(LHS, RHS)`. If both `LHS` and `RHS` are Phis from the same block, it is sufficient
to prove the predicate for values that come from the same predecessor block.

The typical case that it handles is that we sometimes need to prove that `Phi(Len, Len - 1) >= 0`
given that `Len > 0`. The new logic was added to `isImpliedViaOperations` and only uses it and
non-recursive reasoning to prove the facts we need, so it should not hurt compile time a lot.

Differential Revision: https://reviews.llvm.org/D44001
Reviewed By: anna

llvm-svn: 329150

6 years agoFix undefined macro issue in locale tests; Try 2
Eric Fiselier [Wed, 4 Apr 2018 04:48:26 +0000 (04:48 +0000)]
Fix undefined macro issue in locale tests; Try 2

llvm-svn: 329149

6 years agoFix undefined macro issue in locale tests
Eric Fiselier [Wed, 4 Apr 2018 04:39:38 +0000 (04:39 +0000)]
Fix undefined macro issue in locale tests

llvm-svn: 329148

6 years ago[X86] Remove dead code for handling i8/i16 UMUL_LOHI/SMUL_LOHI from X86ISelDAGToDAG...
Craig Topper [Wed, 4 Apr 2018 04:38:55 +0000 (04:38 +0000)]
[X86] Remove dead code for handling i8/i16 UMUL_LOHI/SMUL_LOHI from X86ISelDAGToDAG.cpp. NFC

These are promoted to i16/i32 multiplies by a DAG combine.

llvm-svn: 329147

6 years ago[X86] Remove some code that was only needed when i1 was a legal type. NFC
Craig Topper [Wed, 4 Apr 2018 04:38:54 +0000 (04:38 +0000)]
[X86] Remove some code that was only needed when i1 was a legal type. NFC

llvm-svn: 329146

6 years agoUpdate Clang version on Appveyor bots
Eric Fiselier [Wed, 4 Apr 2018 04:33:09 +0000 (04:33 +0000)]
Update Clang version on Appveyor bots

llvm-svn: 329145

6 years agoTouch up tests for new <version> header; fix module.modulemap.
Eric Fiselier [Wed, 4 Apr 2018 04:21:54 +0000 (04:21 +0000)]
Touch up tests for new <version> header; fix module.modulemap.

This patch does some housekeeping for the new <version> header.
It adds it to the module.modulemap, and the double_include.sh.cpp test.

Additionally it corrects the // UNSUPPORTED options for the libc++
specific test. The header needs to compile under C++03 to support
modules, and it should compile under all available compilers.

llvm-svn: 329144

6 years agoFix locale test data for GLIBC 2.27 and newer.
Eric Fiselier [Wed, 4 Apr 2018 04:00:14 +0000 (04:00 +0000)]
Fix locale test data for GLIBC 2.27 and newer.

GLIBC 2.27 changed the locale data for fr_FR and ru_RU. In particular
they change the decimal and thousands separators used. This patch
makes the locale tests tolerate the updated locales.

llvm-svn: 329143

6 years ago[SimplifyCFG] Teach merge conditional stores to handle cases where the PostBB has...
Craig Topper [Wed, 4 Apr 2018 03:47:17 +0000 (03:47 +0000)]
[SimplifyCFG] Teach merge conditional stores to handle cases where the PostBB has more than 2 predecessors by inserting a new block for the store.

Summary:
Currently merge conditional stores can't handle cases where PostBB (the block we need to move the store to) has more than 2 predecessors.

This patch removes that restriction by creating a new block with only the 2 predecessors we care about and an unconditional branch to the original block. This provides a place to put the store.

Reviewers: efriedma, jmolloy, ABataev

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 329142

6 years agoSplit test/Driver/darwin-sdkroot.c into two tests
Alex Lorenz [Wed, 4 Apr 2018 02:11:20 +0000 (02:11 +0000)]
Split test/Driver/darwin-sdkroot.c into two tests

The test additions in r329110 are Darwin-specific, as they rely
on a code path that is reachabled when driver is invoked without
-target. Instead of making the old test checks Darwin-specific too,
let's simply split it into two files to ensure that the old
checks are still platform-agnostic. Thanks Chandler for
suggesting this!

llvm-svn: 329141

6 years agoFix bad #include path in r329139
Vlad Tsyrklevich [Wed, 4 Apr 2018 01:34:42 +0000 (01:34 +0000)]
Fix bad #include path in r329139

llvm-svn: 329140

6 years agoAdd the ShadowCallStack pass
Vlad Tsyrklevich [Wed, 4 Apr 2018 01:21:16 +0000 (01:21 +0000)]
Add the ShadowCallStack pass

Summary:
The ShadowCallStack pass instruments functions marked with the
shadowcallstack attribute. The instrumented prolog saves the return
address to [gs:offset] where offset is stored and updated in [gs:0].
The instrumented epilog loads/updates the return address from [gs:0]
and checks that it matches the return address on the stack before
returning.

Reviewers: pcc, vitalybuka

Reviewed By: pcc

Subscribers: cryptoad, eugenis, craig.topper, mgorny, llvm-commits, kcc

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

llvm-svn: 329139

6 years agoMinor no-op cmake file style fix.
Nico Weber [Wed, 4 Apr 2018 00:50:22 +0000 (00:50 +0000)]
Minor no-op cmake file style fix.

llvm-svn: 329137

6 years agoReapply r329133 with fix.
Lang Hames [Wed, 4 Apr 2018 00:34:54 +0000 (00:34 +0000)]
Reapply r329133 with fix.

llvm-svn: 329136

6 years agoRevert r329133 "[RuntimeDyld][AArch64] Add some error pluming / generation..."
Lang Hames [Wed, 4 Apr 2018 00:12:12 +0000 (00:12 +0000)]
Revert r329133 "[RuntimeDyld][AArch64] Add some error pluming / generation..."

This broke a number of buildbots. Looking in to it now...

llvm-svn: 329135

6 years ago[MachineOutliner] Test for X86FI->getUsesRedZone() as well as Attribute::NoRedZone
Jessica Paquette [Tue, 3 Apr 2018 23:32:41 +0000 (23:32 +0000)]
[MachineOutliner] Test for X86FI->getUsesRedZone() as well as Attribute::NoRedZone

This commit is similar to r329120, but uses the existing getUsesRedZone() function
in X86MachineFunctionInfo. This teaches the outliner to look at whether or not a
function *truly* uses a redzone instead of just the noredzone attribute on a
function.

Thus, after this commit, it's possible to outline from x86 without using
-mno-red-zone and still get outlining results.

This also adds a new test for the new redzone behaviour.

llvm-svn: 329134

6 years ago[RuntimeDyld][AArch64] Add some error pluming / generation to catch unhandled
Lang Hames [Tue, 3 Apr 2018 23:19:20 +0000 (23:19 +0000)]
[RuntimeDyld][AArch64] Add some error pluming / generation to catch unhandled
relocation types on AArch64.

llvm-svn: 329133

6 years agoFix manifestinput-error.test on Windows 10.
Rui Ueyama [Tue, 3 Apr 2018 23:12:28 +0000 (23:12 +0000)]
Fix manifestinput-error.test on Windows 10.

Patch by Alexandre Ganea.

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

llvm-svn: 329132

6 years ago[AMDGPU] performMinMaxCombine should not optimize patterns of vectors to min3/max3.
Farhana Aleen [Tue, 3 Apr 2018 23:00:30 +0000 (23:00 +0000)]
[AMDGPU] performMinMaxCombine should not optimize patterns of vectors to min3/max3.

Summary: There are no packed instructions for min3 or max3. So, performMinMaxCombine should not optimize vectors of f16 to min3/max3.

Author: FarhanaAleen

Reviewed By: arsenm

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 329131

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Tue, 3 Apr 2018 22:57:17 +0000 (22:57 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Fix typo and simplify matching expression.

llvm-svn: 329130

6 years ago[Hexagon] peel loops with runtime small trip counts
Ikhlas Ajbar [Tue, 3 Apr 2018 22:55:09 +0000 (22:55 +0000)]
[Hexagon] peel loops with runtime small trip counts

Move the check canPeel() to Hexagon Target before setting PeelCount.

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

llvm-svn: 329129

6 years ago[ObjC] Use the name specified by objc_runtime_name instead of the class
Akira Hatanaka [Tue, 3 Apr 2018 22:50:16 +0000 (22:50 +0000)]
[ObjC] Use the name specified by objc_runtime_name instead of the class
identifier.

This patch fixes a few places in CGObjCMac.cpp where the class
identifier was used instead of the name specified by objc_runtime_name.

rdar://problem/37910822

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

llvm-svn: 329128

6 years ago[CUDA] Check initializers of instantiated template variables.
Artem Belevich [Tue, 3 Apr 2018 22:41:06 +0000 (22:41 +0000)]
[CUDA] Check initializers of instantiated template variables.

We were already performing checks on non-template variables,
but the checks on templated ones were missing.

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

llvm-svn: 329127

6 years agoReturn early. NFC.
Rui Ueyama [Tue, 3 Apr 2018 22:39:12 +0000 (22:39 +0000)]
Return early. NFC.

llvm-svn: 329126

6 years agoMerge two `if`s and add a few blank lines. NFC.
Rui Ueyama [Tue, 3 Apr 2018 22:39:04 +0000 (22:39 +0000)]
Merge two `if`s and add a few blank lines. NFC.

llvm-svn: 329125

6 years agoInline a small test file.
Rui Ueyama [Tue, 3 Apr 2018 22:38:56 +0000 (22:38 +0000)]
Inline a small test file.

llvm-svn: 329124

6 years ago'cat' command for internal shell - Support Python 3
Reid Kleckner [Tue, 3 Apr 2018 22:38:25 +0000 (22:38 +0000)]
'cat' command for internal shell - Support Python 3

LLVM Bug Id : 36449

Revision 328563 caused tests to fail under python 3.

This patch modified cat.py file to support both python 2 and 3.
This patch also fixes CRLF issues on Windows.

Patch by Chamal de Silva

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

llvm-svn: 329123

6 years agoAdd the -fsanitize=shadow-call-stack flag
Vlad Tsyrklevich [Tue, 3 Apr 2018 22:33:53 +0000 (22:33 +0000)]
Add the -fsanitize=shadow-call-stack flag

Summary:
Add support for the -fsanitize=shadow-call-stack flag which causes clang
to add ShadowCallStack attribute to functions compiled with that flag
enabled.

Reviewers: pcc, kcc

Reviewed By: pcc, kcc

Subscribers: cryptoad, cfe-commits, kcc

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

llvm-svn: 329122

6 years ago[InstCombine] allow more fmul folds with 'reassoc'
Sanjay Patel [Tue, 3 Apr 2018 22:19:19 +0000 (22:19 +0000)]
[InstCombine] allow more fmul folds with 'reassoc'

The tests marked with 'FIXME' require loosening the check
in SimplifyAssociativeOrCommutative() to optimize completely;
that's still checking isFast() in Instruction::isAssociative().

llvm-svn: 329121

6 years ago[MachineOutliner] Keep track of fns that use a redzone in AArch64FunctionInfo
Jessica Paquette [Tue, 3 Apr 2018 21:56:10 +0000 (21:56 +0000)]
[MachineOutliner] Keep track of fns that use a redzone in AArch64FunctionInfo

This patch adds a hasRedZone() function to AArch64MachineFunctionInfo. It
returns true if the function is known to use a redzone, false if it is known
to not use a redzone, and no value otherwise.

This removes the requirement to pass -mno-red-zone when outlining for AArch64.

https://reviews.llvm.org/D45189

llvm-svn: 329120

6 years agoRevert "MSG"
Farhana Aleen [Tue, 3 Apr 2018 21:51:45 +0000 (21:51 +0000)]
Revert "MSG"

This reverts commit 9a0ce889d1c39c74d69ecad5ce9c875155ae55de.

This was committed by mistake.

llvm-svn: 329119

6 years agoFix bad copy-and-paste in r329108
Vlad Tsyrklevich [Tue, 3 Apr 2018 21:40:27 +0000 (21:40 +0000)]
Fix bad copy-and-paste in r329108

llvm-svn: 329118

6 years agoInline initOffsetMap.
Rafael Espindola [Tue, 3 Apr 2018 21:38:18 +0000 (21:38 +0000)]
Inline initOffsetMap.

In the lld perf builder r328686 had a negative impact in
stalled-cycles-frontend. Somehow that stat is not showing on my
machine, but the attached patch shows an improvement on cache-misses,
which is probably a reasonable proxy.

My working theory is that given a large input the pieces vector is out
of cache by the time initOffsetMap runs.

Both finalizeContents implementation have a convenient location for
initializing the OffsetMap, so this seems the best solution.

llvm-svn: 329117

6 years ago[MachineOutliner][NFC] Make outlined functions have internal linkage
Jessica Paquette [Tue, 3 Apr 2018 21:36:00 +0000 (21:36 +0000)]
[MachineOutliner][NFC] Make outlined functions have internal linkage

The linkage type on outlined functions was private before. This meant that if
you set a breakpoint in an outlined function, the debugger wouldn't be able to
give a sane name to the outlined function.

This commit changes the linkage type to internal and updates any tests that
relied on the prefixes on the names of outlined functions.

llvm-svn: 329116

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Tue, 3 Apr 2018 21:31:50 +0000 (21:31 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 329115

6 years agoMSG
Farhana Aleen [Tue, 3 Apr 2018 21:20:39 +0000 (21:20 +0000)]
MSG

llvm-svn: 329114

6 years agoAdd REQUIRES: darwin-system to test/Driver/darwin-sdkroot.c
Alex Lorenz [Tue, 3 Apr 2018 21:10:26 +0000 (21:10 +0000)]
Add REQUIRES: darwin-system to test/Driver/darwin-sdkroot.c

The test from r329110 is for Darwin only

llvm-svn: 329113

6 years ago[coroutines] Respect alloca alignment requirements when building coroutine frame
Gor Nishanov [Tue, 3 Apr 2018 20:54:20 +0000 (20:54 +0000)]
[coroutines] Respect alloca alignment requirements when building coroutine frame

Summary:
If an alloca need to be stored in the coroutine frame and it has an alignment specified and the alignment does not match the natural alignment of the alloca type. Insert appropriate padding into the coroutine frame to make sure that it gets requested alignment.

For example for a packet type (which natural alignment is 1), but alloca alignment is 8, we may need to insert a padding field with required number of bytes to make sure it is properly aligned.

```
%PackedStruct = type <{ i64 }>
...
  %data = alloca %PackedStruct, align 8
```

If the previous field in the coroutine frame had alignment 2, we would have [6 x i8] inserted before %PackedStruct in the coroutine frame:

```
%f.Frame = type { ..., i16, [6 x i8], %PackedStruct }
```

Reviewers: rnk, lewissbaker, modocache

Reviewed By: modocache

Subscribers: EricWF, llvm-commits

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

llvm-svn: 329112

6 years ago[LoopInterchange] Add remark for calls preventing interchanging.
Florian Hahn [Tue, 3 Apr 2018 20:54:04 +0000 (20:54 +0000)]
[LoopInterchange] Add remark for calls preventing interchanging.

It also updates test/Transforms/LoopInterchange/call-instructions.ll
to use accesses where we can prove dependence after D35430.

Reviewers: sebpop, karthikthecool, blitz.opensource

Reviewed By: sebpop

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

llvm-svn: 329111

6 years ago[driver][darwin] Do not infer -simulator environment for non-simulator SDKs
Alex Lorenz [Tue, 3 Apr 2018 20:50:05 +0000 (20:50 +0000)]
[driver][darwin] Do not infer -simulator environment for non-simulator SDKs

rdar://36369832

llvm-svn: 329110

6 years agoAdd the ShadowCallStack attribute
Vlad Tsyrklevich [Tue, 3 Apr 2018 20:10:40 +0000 (20:10 +0000)]
Add the ShadowCallStack attribute

Summary:
Introduce the ShadowCallStack function attribute. It's added to
functions compiled with -fsanitize=shadow-call-stack in order to mark
functions to be instrumented by a ShadowCallStack pass to be submitted
in a separate change.

Reviewers: pcc, kcc, kubamracek

Reviewed By: pcc, kcc

Subscribers: cryptoad, mehdi_amini, javed.absar, llvm-commits, kcc

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

llvm-svn: 329108

6 years agoInstead of using std::copy, clear the vector first and add new elements. NFC.
Rui Ueyama [Tue, 3 Apr 2018 20:08:45 +0000 (20:08 +0000)]
Instead of using std::copy, clear the vector first and add new elements. NFC.

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

llvm-svn: 329107

6 years agoELF: Use a vector of pairs to sort sections ordered using --symbol-ordering-file.
Peter Collingbourne [Tue, 3 Apr 2018 19:45:10 +0000 (19:45 +0000)]
ELF: Use a vector of pairs to sort sections ordered using --symbol-ordering-file.

This improved performance by 0.5-1% linking Chromium for Android.

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

llvm-svn: 329106

6 years ago[DebugInfoPDB] Add methods used to read function flags
Aaron Smith [Tue, 3 Apr 2018 19:43:40 +0000 (19:43 +0000)]
[DebugInfoPDB] Add methods used to read function flags

The specific function flags are listed in CodeView::FunctionOption.

llvm-svn: 329105

6 years ago[DebugInfoPDB] Add a few missing definitions to PDBTypes.h
Aaron Smith [Tue, 3 Apr 2018 19:41:27 +0000 (19:41 +0000)]
[DebugInfoPDB] Add a few missing definitions to PDBTypes.h

The missing definitions are from cvconst.h shipped with DIA SDK.

Correct the url to MSDN for MemoryTypeEnum and set the underlying
type of PDB_StackFrameType and PDB_MemoryType to uint16_t.

llvm-svn: 329104

6 years agoFix buildbots.
Rui Ueyama [Tue, 3 Apr 2018 18:59:31 +0000 (18:59 +0000)]
Fix buildbots.

r329092 broke buildbots.

llvm-svn: 329103

6 years ago[analyzer] Fix diagnostics in callees of interesting callees.
Artem Dergachev [Tue, 3 Apr 2018 18:52:30 +0000 (18:52 +0000)]
[analyzer] Fix diagnostics in callees of interesting callees.

removeUnneededCalls() is responsible for removing path diagnostic pieces within
functions that don't contain "interesting" events. It makes bug reports
much tidier.

When a stack frame is known to be interesting, the function doesn't descend
into it to prune anything within it, even other callees that are totally boring.

Fix the function to prune boring callees in interesting stack frames.

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

llvm-svn: 329102

6 years agoAdd a test for an issue fixed in r329092.
Rafael Espindola [Tue, 3 Apr 2018 18:35:46 +0000 (18:35 +0000)]
Add a test for an issue fixed in r329092.

We were setting IsUsedInRegularObj in lazy symbols only used from IR.

llvm-svn: 329101

6 years ago[x86] add tests for convert-FP-to-integer with constants; NFC
Sanjay Patel [Tue, 3 Apr 2018 18:34:56 +0000 (18:34 +0000)]
[x86] add tests for convert-FP-to-integer with constants; NFC

We don't constant fold any of these, but we could...but if we
do, we must produce the right answer.

Unlike the IR fptosi instruction or its DAG node counterpart
ISD::FP_TO_SINT, these are not undef for an out-of-range input.

llvm-svn: 329100

6 years agoRevert "Set calling convention for CUDA kernel"
Artem Belevich [Tue, 3 Apr 2018 18:29:31 +0000 (18:29 +0000)]
Revert "Set calling convention for CUDA kernel"

This reverts r328795 which introduced an issue with referencing __global__
function templates. More details in the original review D44747.

llvm-svn: 329099

6 years agoUse Clang when referring to the project and clang when referring to the binary.
Richard Smith [Tue, 3 Apr 2018 18:28:13 +0000 (18:28 +0000)]
Use Clang when referring to the project and clang when referring to the binary.

llvm-svn: 329098

6 years agoRestrict a test using named file descriptors to using the system shell
David Blaikie [Tue, 3 Apr 2018 18:22:14 +0000 (18:22 +0000)]
Restrict a test using named file descriptors to using the system shell

llvm-svn: 329097

6 years agoDisable a test using environment variables that requires a real shell
David Blaikie [Tue, 3 Apr 2018 18:19:52 +0000 (18:19 +0000)]
Disable a test using environment variables that requires a real shell

llvm-svn: 329096

6 years ago[CodeGen]Add NoVRegs property on PostRASink and ShrinkWrap
Jun Bum Lim [Tue, 3 Apr 2018 18:17:34 +0000 (18:17 +0000)]
[CodeGen]Add NoVRegs property on PostRASink and ShrinkWrap

Summary:
This change declare that PostRAMachineSinking and ShrinkWrap require NoVRegs
property, so now the MachineFunctionPass can enforce this check.
These passes are disabled in NVPTX & WebAssembly.

Reviewers: dschuff, jlebar, tra, jgravelle-google, MatzeB, sebpop, thegameg, mcrosier

Reviewed By: dschuff, thegameg

Subscribers: jholewinski, jfb, sbc100, aheejin, sunfish, llvm-commits

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

llvm-svn: 329095

6 years ago[sanitizer] Remove empty Symbolizer PrepareForSandboxing
Kostya Kortchinsky [Tue, 3 Apr 2018 18:07:22 +0000 (18:07 +0000)]
[sanitizer] Remove empty Symbolizer PrepareForSandboxing

Summary:
`Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently
has been for a while (D10213). Remove it, and shuffle things around so that the
platform specific code is now in `PlatformPrepareForSandboxing`.

This allows to have one less symbolizer dependency in a common file, which
helps for the upcoming split.

Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not
be used anywhere.

Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr

Reviewed By: alekseyshl

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

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

llvm-svn: 329094

6 years ago[dsymutil] Apply recursion workaround for threading
Jonas Devlieghere [Tue, 3 Apr 2018 18:01:18 +0000 (18:01 +0000)]
[dsymutil] Apply recursion workaround for threading

The DwarfLinker can have some very deep recursion that can max out the
(significantly smaller) stack when using threads. We don't want this
limitation when we only have a single thread. We already have this
workaround for the architecture-related threading. This patch applies
the same workaround to the parallel analysis and cloning.

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

llvm-svn: 329093

6 years agoMake fetchIfLazy only fetch an object file. NFC.
Rui Ueyama [Tue, 3 Apr 2018 18:01:18 +0000 (18:01 +0000)]
Make fetchIfLazy only fetch an object file. NFC.

Previously, fetchIfLazy did more than the name says. Now, setting
to UsedInRegularObj is moved to another function.

llvm-svn: 329092

6 years ago[SLP] Fixed formatting, NFC.
Alexey Bataev [Tue, 3 Apr 2018 17:48:14 +0000 (17:48 +0000)]
[SLP] Fixed formatting, NFC.

llvm-svn: 329091

6 years ago[clangd] synthesize fix message when the diagnostic doesn't provide one.
Sam McCall [Tue, 3 Apr 2018 17:35:57 +0000 (17:35 +0000)]
[clangd] synthesize fix message when the diagnostic doesn't provide one.

Summary:
Currently if a fix is attached directly to a diagnostic, we repeat the
diagnostic message as the fix message. From eyeballing the top diagnostics,
it seems describing the textual replacement would be much clearer.

e.g.
error: use of undeclared identifier 'goo'; did you mean 'foo'?
action before: use of undeclared identifier 'goo'; did you mean 'foo'?
action after: change 'goo' to 'foo'

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329090

6 years ago[DEBUGINFO] Add option that allows to disable emission of flags in .loc directives.
Alexey Bataev [Tue, 3 Apr 2018 17:28:55 +0000 (17:28 +0000)]
[DEBUGINFO] Add option that allows to disable emission of flags in .loc directives.

Summary:
Some targets do not support extended format of .loc directive and
support only simple format: .loc <FileID> <Line> <Column>. Patch adds
MCAsmInfo flag and option that allows emit .loc directive without
additional flags.

Reviewers: echristo

Subscribers: llvm-commits

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

llvm-svn: 329089

6 years ago[lld] fix data race in ELF/ICF.cpp
Bob Haarman [Tue, 3 Apr 2018 17:27:39 +0000 (17:27 +0000)]
[lld] fix data race in ELF/ICF.cpp

Summary:
r328610 fixed a data race in the COFF linker. This change makes a
similar fix to the ELF linker.

Reviewers: ruiu, pcc, rnk

Reviewed By: ruiu

Subscribers: emaste, llvm-commits, arichardson

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

llvm-svn: 329088

6 years ago[InstCombine] Fold compare of int constant against a splatted vector of ints
Daniel Neilson [Tue, 3 Apr 2018 17:26:20 +0000 (17:26 +0000)]
[InstCombine] Fold compare of int constant against a splatted vector of ints

Summary:
Folding patterns like:
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %ext = extractelement <4 x i8> %insvec, i32 0
  %cond = icmp eq i32 %ext, 0

Combined with existing rules, this allows us to fold patterns like:
  %insvec = insertelement <4 x i8> undef, i8 %val, i32 0
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %cond = icmp eq i8 %val, 0

When we construct a splat vector via a shuffle, and bitcast the vector into an integer type for comparison against an integer constant. Then we can simplify the the comparison to compare the splatted value against the integer constant.

Reviewers: spatel, anna, mkazantsev

Reviewed By: spatel

Subscribers: efriedma, rengolin, llvm-commits

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

llvm-svn: 329087

6 years ago[ELF] - Eliminate Lazy class.
George Rimar [Tue, 3 Apr 2018 17:16:52 +0000 (17:16 +0000)]
[ELF] - Eliminate Lazy class.

Patch removes Lazy class which
is just an excessive layer.

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

llvm-svn: 329086

6 years ago[SLP] Fix PR36481: vectorize reassociated instructions.
Alexey Bataev [Tue, 3 Apr 2018 17:14:47 +0000 (17:14 +0000)]
[SLP] Fix PR36481: vectorize reassociated instructions.

Summary:
If the load/extractelement/extractvalue instructions are not originally
consecutive, the SLP vectorizer is unable to vectorize them. Patch
allows reordering of such instructions.

Patch does not support reordering of the repeated instruction, this must
be handled in the separate patch.

Reviewers: RKSimon, spatel, hfinkel, mkuper, Ayal, ashahid

Subscribers: llvm-commits

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

llvm-svn: 329085

6 years agoRemove a stale comment cut and pasted from another file.
Eric Christopher [Tue, 3 Apr 2018 17:07:05 +0000 (17:07 +0000)]
Remove a stale comment cut and pasted from another file.

llvm-svn: 329084

6 years ago[llvm-mca] Move the logic that prints register file statistics to its own view. NFCI
Andrea Di Biagio [Tue, 3 Apr 2018 16:46:23 +0000 (16:46 +0000)]
[llvm-mca] Move the logic that prints register file statistics to its own view. NFCI

Before this patch, the "BackendStatistics" view was responsible for printing the
register file usage (as well as many other statistics).

Now users can enable register file usage statistics using the command line flag
`-register-file-stats`. By default, the tool doesn't print register file
statistics.

llvm-svn: 329083

6 years agoRecommit "[SLP] Fix issues with debug output in the SLP vectorizer."
Alexey Bataev [Tue, 3 Apr 2018 16:40:33 +0000 (16:40 +0000)]
Recommit "[SLP] Fix issues with debug output in the SLP vectorizer."

The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
errs() rather than dbgs().

llvm-svn: 329082

6 years ago[LoopInterchange] Update tests so DA can handle access after D35430.
Florian Hahn [Tue, 3 Apr 2018 16:37:58 +0000 (16:37 +0000)]
[LoopInterchange] Update tests so DA can handle access after D35430.

I have taken the opportunity to simplify some tests slightly and move
parts around.

It also brings back a few IR checks for interchangable loops.

Reviewers: karthikthecool, sebpop, grosser

Reviewed By: sebpop

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

llvm-svn: 329081

6 years ago[SLP] Added tests for checks of reordering of the repeated instructions,
Alexey Bataev [Tue, 3 Apr 2018 16:31:26 +0000 (16:31 +0000)]
[SLP] Added tests for checks of reordering of the repeated instructions,
NFC.

llvm-svn: 329080

6 years ago[Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Krzysztof Parzyszek [Tue, 3 Apr 2018 16:06:36 +0000 (16:06 +0000)]
[Hexagon] Remove -mhvx-double and the corresponding subtarget feature

Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329079

6 years ago[Hexagon] Remove unneeded attributes from lit test
Krzysztof Parzyszek [Tue, 3 Apr 2018 16:05:20 +0000 (16:05 +0000)]
[Hexagon] Remove unneeded attributes from lit test

llvm-svn: 329078

6 years ago[Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Krzysztof Parzyszek [Tue, 3 Apr 2018 15:59:10 +0000 (15:59 +0000)]
[Hexagon] Remove -mhvx-double and the corresponding subtarget feature

Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329077

6 years agoAdding optional Name parameter to createVirtualRegister and createGenericVirtualRegister.
Puyan Lotfi [Tue, 3 Apr 2018 15:53:49 +0000 (15:53 +0000)]
Adding optional Name parameter to createVirtualRegister and createGenericVirtualRegister.

llvm-svn: 329076

6 years agoImplement P0754R2: The <version> header.
Marshall Clow [Tue, 3 Apr 2018 15:48:24 +0000 (15:48 +0000)]
Implement P0754R2: The <version> header.

llvm-svn: 329075