platform/upstream/llvm.git
6 years agoNew option -z keep-text-section-prefix to keep text sections with prefixes separate.
Sriraman Tallam [Tue, 8 May 2018 23:19:50 +0000 (23:19 +0000)]
New option -z keep-text-section-prefix to keep text sections with prefixes separate.

Separate output sections for selected text section prefixes to enable TLB optimizations and for readablilty.

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

llvm-svn: 331823

6 years agoPartially revert r331456: [clang-tidy] Remove AnalyzeTemporaryDtors option.
Roman Lebedev [Tue, 8 May 2018 23:15:58 +0000 (23:15 +0000)]
Partially revert r331456: [clang-tidy] Remove AnalyzeTemporaryDtors option.

That broke every single .clang-tidy config out there
which happened to specify AnalyzeTemporaryDtors option:

YAML:5:24: error: unknown key 'AnalyzeTemporaryDtors'
AnalyzeTemporaryDtors: false
                       ^~~~~
Error parsing <...>/.clang-tidy: Invalid argument

More so, that error isn't actually a error, the
clang-tidy does not exit with $? != 0, it continues
with the default config.

Surely this breakage isn't the intended behavior.
But if it is, feel free to revert this commit.

llvm-svn: 331822

6 years agoMC: Remove dead code. NFCI.
Peter Collingbourne [Tue, 8 May 2018 22:59:05 +0000 (22:59 +0000)]
MC: Remove dead code. NFCI.

We should never emit an SHT_DYNSYM into an object file.

llvm-svn: 331821

6 years ago[globalisel] Correct r331816 to check the opcode before calling getOperand().
Daniel Sanders [Tue, 8 May 2018 22:58:35 +0000 (22:58 +0000)]
[globalisel] Correct r331816 to check the opcode before calling getOperand().

Fix a silly mistake in my pre-commit changes for r331816. It should check what
opcode the insn is before extracting the operands.

NFC at the moment since the caller already checked the opcode.

llvm-svn: 331820

6 years ago[GlobalISel][Legalizer] More concise and faster widenScalar, NFC
Roman Tereshin [Tue, 8 May 2018 22:53:09 +0000 (22:53 +0000)]
[GlobalISel][Legalizer] More concise and faster widenScalar, NFC

Refactoring LegalizerHelper::widenScalar member function reducing its
size by approximately a factor of 2 and (hopefuly) making it more
straightforward and regular by introducing widenScalarSrc and
widenScalarDst helper methods.

The new widenScalar* methods mutate the instructions in place instead
of recreating them from scratch and removing the originals. The
compile time implications of this were measured on sqlite3
amalgamation, targeting AArch64 in -O0:

LegalizerHelper::widenScalar: > 25% faster
Legalizer::runOnMachineFunction: ~ 4.0 - 4.5% faster

Also adding MachineOperand::setCImm and refactoring out
MachineIRBuilder::recordInsertion methods to make the change possible.

Reviewers: aditya_nandakumar, bogner, javed.absar, t.p.northover, ab, dsanders, arsenm

Reviewed By: aditya_nandakumar

Subscribers: wdng, rovka, kristof.beyls, llvm-commits

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

llvm-svn: 331819

6 years agoRevert "Emit an error when mixing <stdatomic.h> and <atomic>"
Volodymyr Sapsai [Tue, 8 May 2018 22:50:35 +0000 (22:50 +0000)]
Revert "Emit an error when mixing <stdatomic.h> and <atomic>"

It reverts commit r331379 because turned out `__ALLOW_STDC_ATOMICS_IN_CXX__`
doesn't work well in practice.

llvm-svn: 331818

6 years agoAdd support for LTO plugin option obj-path
Rumeet Dhindsa [Tue, 8 May 2018 22:37:57 +0000 (22:37 +0000)]
Add support for LTO plugin option obj-path

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

llvm-svn: 331817

6 years ago[globalisel] Add a combiner helpers for extending loads and use them in a pre-legaliz...
Daniel Sanders [Tue, 8 May 2018 22:26:39 +0000 (22:26 +0000)]
[globalisel] Add a combiner helpers for extending loads and use them in a pre-legalize combiner for AArch64

Summary: Depends on D45541

Reviewers: ab, aditya_nandakumar, bogner, rtereshin, volkan, rovka, javed.absar, aemerson

Reviewed By: aemerson

Subscribers: aemerson, rengolin, mgorny, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 331816

6 years ago[X86] Mark builtins 'const' where possible
Craig Topper [Tue, 8 May 2018 22:01:43 +0000 (22:01 +0000)]
[X86] Mark builtins 'const' where possible

I attempted to go through all the builtins and marked them const if they didn't touch memory or other hidden state.

I don't know how to test this or if it really matters.

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

llvm-svn: 331814

6 years agoRevert "[X86][CET] Shadow stack fix for setjmp/longjmp"
Jessica Paquette [Tue, 8 May 2018 22:00:57 +0000 (22:00 +0000)]
Revert "[X86][CET] Shadow stack fix for setjmp/longjmp"

This reverts commit 30962eca38ef02666ebcdded72a94f2cd0292d68.

This commit has been causing test asan failures on a build bot.

http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/45108/

Original commit: https://reviews.llvm.org/D46181

llvm-svn: 331813

6 years agoFix float->int conversion warnings when near barriers.
Erich Keane [Tue, 8 May 2018 21:26:21 +0000 (21:26 +0000)]
Fix float->int conversion warnings when near barriers.

As Eli brought up here: https://reviews.llvm.org/D46535
I'd previously messed up this fix by missing conversions
that are just slightly outside the range.  This patch fixes
this by no longer ignoring the return value of
convertToInteger.  Additionally, one of the error messages
wasn't very sensical (mentioning out of range value, when it
really was not), so it was cleaned up as well.

llvm-svn: 331812

6 years ago[HIP] Add hip offload kind
Yaxun Liu [Tue, 8 May 2018 21:02:12 +0000 (21:02 +0000)]
[HIP] Add hip offload kind

There are quite differences in HIP action builder and action job creation,
which justifies to define a separate offload kind.

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

llvm-svn: 331811

6 years agoAdd a mno-outline flag to disable the MachineOutliner
Jessica Paquette [Tue, 8 May 2018 20:58:32 +0000 (20:58 +0000)]
Add a mno-outline flag to disable the MachineOutliner

Since we're working on turning the MachineOutliner by default under -Oz for
AArch64, it makes sense to have an -mno-outline flag available. This currently
doesn't do much (it basically just undoes -moutline).

When the MachineOutliner is on by default under AArch64, this flag should
set -mllvm -enable-machine-outliner=never.

llvm-svn: 331810

6 years ago[AsmPrinter] Allow emitting codeview for any windows target
Martin Storsjo [Tue, 8 May 2018 20:56:04 +0000 (20:56 +0000)]
[AsmPrinter] Allow emitting codeview for any windows target

Before SVN r244158, codeview debug info was emitted always
emitted for msvc if debug info was enabled, but that commit
added a module flag.

Since it's still restricted by the flag, we can allow it
for any target if the user requests it, not only msvc (and
windows-itanium, added in SVN r287567).

Add a test for emitting it for a mingw target.

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

llvm-svn: 331809

6 years ago[llvm-rc] Add support for all missing dialog controls
Martin Storsjo [Tue, 8 May 2018 20:55:58 +0000 (20:55 +0000)]
[llvm-rc] Add support for all missing dialog controls

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

llvm-svn: 331808

6 years ago[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets
Martin Storsjo [Tue, 8 May 2018 20:55:23 +0000 (20:55 +0000)]
[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets

-dwarf-column-info is omitted if -gcodeview is specified for msvc
targets at the moment, but since -gcodeview is an option that can be
specified for any target, there's little reason to restrict this
handling to msvc targets.

This allows getting proper codeview debug info by passing -gcodeview
for e.g. MinGW targets as well.

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

llvm-svn: 331807

6 years agoChange -foutline to -moutline
Jessica Paquette [Tue, 8 May 2018 20:53:19 +0000 (20:53 +0000)]
Change -foutline to -moutline

Nitpicky, but the MachineOutliner is a machine-level pass, and so we should
reflect that by using "m" instead of "n".

Figured we should get this in before people get used to the letter f. :)

llvm-svn: 331806

6 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Tue, 8 May 2018 20:24:45 +0000 (20:24 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 331805

6 years agoUpdate ThinLTO Indexing logic
Rumeet Dhindsa [Tue, 8 May 2018 20:12:07 +0000 (20:12 +0000)]
Update ThinLTO Indexing logic

Instead of writing empty index for file, this patch tracks the state of files in ObjectToIndexFileState. If the files are not indexed , only then we emit the empty files

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

llvm-svn: 331803

6 years agoAdd missing newlines to cl::extrahelp uses
Stephane Sezer [Tue, 8 May 2018 19:46:29 +0000 (19:46 +0000)]
Add missing newlines to cl::extrahelp uses

llvm-svn: 331802

6 years ago[Coverage] Take filenames into account when loading function records.
Max Moroz [Tue, 8 May 2018 19:26:51 +0000 (19:26 +0000)]
[Coverage] Take filenames into account when loading function records.

Summary:
Don't skip functions with the same name but from different files.

That change makes it possible to generate code coverage reports from
different binaries compiled from different sources even if there are functions
with non-unique names. Without that change, code coverage for such functions is
missing except of the first function processed.

Reviewers: vsk, morehouse

Reviewed By: vsk

Subscribers: llvm-commits, kcc

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

llvm-svn: 331801

6 years agoChanging constants in a test (NFC)
Daniel Neilson [Tue, 8 May 2018 19:08:12 +0000 (19:08 +0000)]
Changing constants in a test (NFC)

Summary:
Changing the lengths of the atomic memory intrinsics in a test to make sure
that they don't get lowered into loads/stores if/when expansion of these
occurs in selectiondag.

llvm-svn: 331800

6 years ago[LV] Fix for PR37248, Broadcast codegen incorrectly assumed vector loop body is singl...
Hideki Saito [Tue, 8 May 2018 18:57:34 +0000 (18:57 +0000)]
[LV] Fix for PR37248, Broadcast codegen incorrectly assumed vector loop body is single basic block

Summary:
Broadcast code generation emitted instructions in pre-header, while the instruction they are dependent on in the vector loop body.
This resulted in an IL verification error ---- value used before defined.

Reviewers: rengolin, fhahn, hfinkel

Reviewed By: rengolin, fhahn

Subscribers: dcaballe, Ka-Ka, llvm-commits

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

llvm-svn: 331799

6 years ago[AMDGPU] Provide machine -> name mapping
Tim Renouf [Tue, 8 May 2018 18:53:04 +0000 (18:53 +0000)]
[AMDGPU] Provide machine -> name mapping

Summary:
AMDGPU stores a numerical code for the particular GPU variant in EFlags
in the ELF file. This commit provides a mapping from that number into
the machine name for use by objdump-type tools.

Change-Id: Id37fc0bebad443bd89c0080985ce298c4e7e9319

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

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

llvm-svn: 331798

6 years ago[Power9]Legalize and emit code for truncate and convert QP to HW and Byte
Lei Huang [Tue, 8 May 2018 18:52:06 +0000 (18:52 +0000)]
[Power9]Legalize and emit code for truncate and convert QP to HW and Byte

Legalize and emit code for truncate and convert float128 to (un)signed short
and (un)signed char.

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

llvm-svn: 331797

6 years agoAMDGPU: Fix broken check lines in test
Matt Arsenault [Tue, 8 May 2018 18:43:44 +0000 (18:43 +0000)]
AMDGPU: Fix broken check lines in test

llvm-svn: 331796

6 years agoAMDGPU: Don't use undef in a test
Matt Arsenault [Tue, 8 May 2018 18:43:34 +0000 (18:43 +0000)]
AMDGPU: Don't use undef in a test

llvm-svn: 331795

6 years ago[docs] Fix a typo in KaleidoscopeJIT tutorial
Stephane Sezer [Tue, 8 May 2018 18:43:27 +0000 (18:43 +0000)]
[docs] Fix a typo in KaleidoscopeJIT tutorial

Summary: Just a missing end quote.

Reviewers: lhames

Subscribers: llvm-commits

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

llvm-svn: 331794

6 years agoAMDGPU: Fix broken dynamic vector indexing for packed types
Matt Arsenault [Tue, 8 May 2018 18:43:25 +0000 (18:43 +0000)]
AMDGPU: Fix broken dynamic vector indexing for packed types

The intention of this was to multiply by 16, not shift by 16.

llvm-svn: 331793

6 years agoDAG: Use correct shift width type
Matt Arsenault [Tue, 8 May 2018 18:43:05 +0000 (18:43 +0000)]
DAG: Use correct shift width type

llvm-svn: 331792

6 years ago[sanitizer] Read file to InternalMmapVectorNoCtor
Vitaly Buka [Tue, 8 May 2018 18:35:11 +0000 (18:35 +0000)]
[sanitizer] Read file to InternalMmapVectorNoCtor

llvm-svn: 331791

6 years ago[Power9]Legalize and emit code for truncate and convert Quad-Precision to Word
Lei Huang [Tue, 8 May 2018 18:34:00 +0000 (18:34 +0000)]
[Power9]Legalize and emit code for truncate and convert Quad-Precision to Word

Legalize and emit code for:

  * xscvqpswz : VSX Scalar truncate & Convert Quad-Precision to Signed Word
  * xscvqpuwz : VSX Scalar truncate & Convert Quad-Precision to Unsigned Word

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

llvm-svn: 331790

6 years ago[sanitizer] Close fd on ReadFromFile error
Vitaly Buka [Tue, 8 May 2018 18:32:53 +0000 (18:32 +0000)]
[sanitizer] Close fd on ReadFromFile error

llvm-svn: 331789

6 years agoAMDGPU: Use eraseFromParent to delete am instruction when it is no longer needed.
Changpeng Fang [Tue, 8 May 2018 18:32:35 +0000 (18:32 +0000)]
AMDGPU: Use eraseFromParent to delete am instruction when it is no longer needed.

Reviewer: Nicolai

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

llvm-svn: 331788

6 years ago[Power9]Legalize and emit code for truncate and convert QP to DW
Lei Huang [Tue, 8 May 2018 18:23:31 +0000 (18:23 +0000)]
[Power9]Legalize and emit code for truncate and convert QP to DW

Legalize and emit code for:

  * xscvqpsdz : VSX Scalar truncate & Convert Quad-Precision to Signed Dword
  * xscvqpudz : VSX Scalar truncate & Convert Quad-Precision to Unsigned Dword

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

llvm-svn: 331787

6 years ago[lit] Fix running tests that require 'examples'.
Zachary Turner [Tue, 8 May 2018 18:20:10 +0000 (18:20 +0000)]
[lit] Fix running tests that require 'examples'.

Differential Revision: https://reviews.llvm.org/D46514
Patch by Nikolai Kosjar.

llvm-svn: 331786

6 years ago[sanitizer] Fix InternalMmapVectorNoCtor reserve and resize
Vitaly Buka [Tue, 8 May 2018 17:59:44 +0000 (17:59 +0000)]
[sanitizer] Fix InternalMmapVectorNoCtor reserve and resize
Remap on reserve of more than the current size.
Don't remap on downsize.

llvm-svn: 331784

6 years ago[CodeGenPrepare] Move Extension Instructions Through Logical And Shift Instructions
Guozhi Wei [Tue, 8 May 2018 17:58:32 +0000 (17:58 +0000)]
[CodeGenPrepare] Move Extension Instructions Through Logical And Shift Instructions

CodeGenPrepare pass move extension instructions close to load instructions in different BB, so they can be combined later. But the extension instructions can't move through logical and shift instructions in current implementation. This patch enables this enhancement, so we can eliminate more extension instructions.

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

llvm-svn: 331783

6 years agoRefactor BitcodeCompiler::add(). NFC.
Rui Ueyama [Tue, 8 May 2018 17:50:54 +0000 (17:50 +0000)]
Refactor BitcodeCompiler::add(). NFC.

This change makes it explicit that the main loop iterates over a
parallel array, Syms and ObjSyms.

llvm-svn: 331780

6 years agoFix a bug that a copy of a large vector was created. NFC.
Rui Ueyama [Tue, 8 May 2018 17:50:43 +0000 (17:50 +0000)]
Fix a bug that a copy of a large vector was created. NFC.

llvm-svn: 331779

6 years ago[PowerPC] Unify handling for conversion of FP_TO_INT feeding a store
Lei Huang [Tue, 8 May 2018 17:36:40 +0000 (17:36 +0000)]
[PowerPC] Unify handling for conversion of FP_TO_INT feeding a store

Existing DAG combine only handles conversions for FP_TO_SINT:
"{f32, f64} x { i32, i16 }"

This patch simplifies the code to handle:
"{ FP_TO_SINT, FP_TO_UINT } x { f64, f32 } x { i64, i32, i16, i8 }"

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

llvm-svn: 331778

6 years agoAdd support to object files for accessing the .debug_types section
Greg Clayton [Tue, 8 May 2018 17:19:24 +0000 (17:19 +0000)]
Add support to object files for accessing the .debug_types section

In an effort to make the .debug_types patch smaller, breaking out the part that reads the .debug_types from object files into a separate patch

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

llvm-svn: 331777

6 years ago[llvm-objcopy] Fix exit code
Alexander Shaposhnikov [Tue, 8 May 2018 17:12:54 +0000 (17:12 +0000)]
[llvm-objcopy] Fix exit code

Set the exit code to 1 if no arguments are specified.

Test plan: make check-all

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

llvm-svn: 331776

6 years ago[AMDGPU] Added checks for dpp_ctrl value
Stanislav Mekhanoshin [Tue, 8 May 2018 16:53:02 +0000 (16:53 +0000)]
[AMDGPU] Added checks for dpp_ctrl value

- Report error for invalid dpp_ctrl values.
- Changed the way it is reported, now the error will be emitted into
  asm and will work with release build as well.
- Added dpp_ctrl value verifier for codegen.
- Added symbolic constants for dpp_ctrl.

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

llvm-svn: 331775

6 years ago[ELF][MIPS] Fix test case in attempt to restore Windows build-bot. NFC
Simon Atanasyan [Tue, 8 May 2018 16:11:40 +0000 (16:11 +0000)]
[ELF][MIPS] Fix test case in attempt to restore Windows build-bot. NFC

llvm-svn: 331774

6 years ago[X86] Tag PCONFIG instruction with WriteSystem scheduler class
Simon Pilgrim [Tue, 8 May 2018 15:55:14 +0000 (15:55 +0000)]
[X86] Tag PCONFIG instruction with WriteSystem scheduler class

llvm-svn: 331773

6 years ago[ELF][MIPS] Fix calculation of GP relative relocations in case of relocatable output
Simon Atanasyan [Tue, 8 May 2018 15:34:06 +0000 (15:34 +0000)]
[ELF][MIPS] Fix calculation of GP relative relocations in case of relocatable output

Some MIPS relocations depend on "gp" value. By default, this value has
0x7ff0 offset from a .got section. But relocatable files produced by a
compiler or a linker might redefine this default value and we have to
use it for a calculation of the relocation result. When we generate EXE
or DSO it's trivial. Generating a relocatable output is more difficult
case because the linker does calculate relocations in this case and
cannot store individual "gp" values used by each input object file.
As a workaround we add the "gp" value to the relocation addend.

This fixes https://llvm.org/pr31149

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

llvm-svn: 331772

6 years ago[mips][msa] Pattern match the splat.d instruction
Stefan Maksimovic [Tue, 8 May 2018 15:12:29 +0000 (15:12 +0000)]
[mips][msa] Pattern match the splat.d instruction

Introduced a new pattern for matching splat.d explicitly.

Both splat.d and splati.d can now be generated from the @llvm.mips.splat.d
intrinsic depending on whether an immediate value has been passed.

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

llvm-svn: 331771

6 years ago[X86] Split off WriteIMul64 from WriteIMul schedule class (PR36931)
Simon Pilgrim [Tue, 8 May 2018 14:55:16 +0000 (14:55 +0000)]
[X86] Split off WriteIMul64 from WriteIMul schedule class (PR36931)

This fixes a couple of BtVer2 missing instructions that weren't been handled in the override.

NOTE: There are still a lot of overrides that still need cleaning up!
llvm-svn: 331770

6 years ago[llvm][x86] SandyBridge/IvyBridge don't support BMI1/BMI2
Simon Pilgrim [Tue, 8 May 2018 14:20:25 +0000 (14:20 +0000)]
[llvm][x86] SandyBridge/IvyBridge don't support BMI1/BMI2

llvm-svn: 331769

6 years ago[OPENMP, NVPTX] Fix linkage of the global entries.
Alexey Bataev [Tue, 8 May 2018 14:16:57 +0000 (14:16 +0000)]
[OPENMP, NVPTX] Fix linkage of the global entries.

The linkage of the global entries must be weak to enable support of
redefinition of the same target regions in multiple compilation units.

llvm-svn: 331768

6 years ago[X86] Split WriteIDiv into div/idiv 8/16/32/64 implementations (PR36930)
Simon Pilgrim [Tue, 8 May 2018 13:51:45 +0000 (13:51 +0000)]
[X86] Split WriteIDiv into div/idiv 8/16/32/64 implementations (PR36930)

I've created the necessary classes but there are still a lot of overrides that need cleaning up.

NOTE: The Znver1 model was missing some div/idiv variants in the instregex patterns and wasn't setting the resource cycles at all in the overrides.
llvm-svn: 331767

6 years ago[OpenCL] Factor out language version printing
Sven van Haastregt [Tue, 8 May 2018 13:47:43 +0000 (13:47 +0000)]
[OpenCL] Factor out language version printing

Generate a printable OpenCL language version number in a single place
and select between the OpenCL C or OpenCL C++ version accordingly.

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

llvm-svn: 331766

6 years ago[llvm-mca][x86] Add div/idiv, mul/imul and inc/dec/neg/nop instruction tests
Simon Pilgrim [Tue, 8 May 2018 13:30:58 +0000 (13:30 +0000)]
[llvm-mca][x86] Add div/idiv, mul/imul and inc/dec/neg/nop instruction tests

llvm-svn: 331765

6 years ago[test] Re-enable TestUnicodeSymbols
Jonas Devlieghere [Tue, 8 May 2018 13:28:34 +0000 (13:28 +0000)]
[test] Re-enable TestUnicodeSymbols

Re-enable TestUnicodeSymbols now that we use the in-tree dsymutil. This
was disabled because the hashing of unicode symbols was out of sync
between llvm (dsymutil) and lldb.

llvm-svn: 331764

6 years ago[clang-tidy] Profile is a per-AST (per-TU) data.
Roman Lebedev [Tue, 8 May 2018 13:14:21 +0000 (13:14 +0000)]
[clang-tidy] Profile is a per-AST (per-TU) data.

Summary:
As discussed in D45931, currently, profiling output of clang-tidy is somewhat not great.
It outputs one profile at the end of the execution, and that profile contains the data
from the last TU that was processed. So if the tool run on multiple TU's, the data is
not accumulated, it is simply discarded.

It would be nice to improve this.

This differential is the first step - make this profiling info per-TU,
and output it after the tool has finished processing each TU.
In particular, when `ClangTidyASTConsumer` destructor runs.

Next step will be to add a CSV (JSON?) printer to store said profiles under user-specified directory prefix.

Reviewers: alexfh, sbenza

Reviewed By: alexfh

Subscribers: Eugene.Zelenko, mgorny, xazax.hun, mgrang, klimek, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 331763

6 years ago[ASTImporter] Properly import SourceLocations of Attrs
Aleksei Sidorin [Tue, 8 May 2018 12:45:21 +0000 (12:45 +0000)]
[ASTImporter] Properly import SourceLocations of Attrs

Patch by Rafael Stahl!

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

llvm-svn: 331762

6 years ago[llvm-rc] Update a stale comment. NFC.
Martin Storsjo [Tue, 8 May 2018 12:33:54 +0000 (12:33 +0000)]
[llvm-rc] Update a stale comment. NFC.

The tokenizer handles comments since SVN r315207.

llvm-svn: 331761

6 years ago[X86] Add vector masked load/store scheduler classes (PR32857)
Simon Pilgrim [Tue, 8 May 2018 12:17:55 +0000 (12:17 +0000)]
[X86] Add vector masked load/store scheduler classes (PR32857)

Split off from existing vector load/store classes to remove InstRW overrides.

llvm-svn: 331760

6 years ago[ASTMatchers] Overload isConstexpr for ifStmts
Gabor Horvath [Tue, 8 May 2018 11:53:32 +0000 (11:53 +0000)]
[ASTMatchers] Overload isConstexpr for ifStmts

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

llvm-svn: 331759

6 years ago[AArch64][SVE] Asm: Support for LD1R load-and-replicate scalar instructions.
Sander de Smalen [Tue, 8 May 2018 10:46:55 +0000 (10:46 +0000)]
[AArch64][SVE] Asm: Support for LD1R load-and-replicate scalar instructions.

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

Reviewed By: fhahn

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

llvm-svn: 331758

6 years ago[X86] Add SchedWriteFTest/SchedWriteVecTest TEST scheduler classes
Simon Pilgrim [Tue, 8 May 2018 10:28:03 +0000 (10:28 +0000)]
[X86] Add SchedWriteFTest/SchedWriteVecTest TEST scheduler classes

Split off from SchedWriteVecLogic to remove InstRW overrides.

llvm-svn: 331757

6 years ago[mips] Mark various memory instructions as being in microMIPS (NFC)
Simon Dardis [Tue, 8 May 2018 10:16:21 +0000 (10:16 +0000)]
[mips] Mark various memory instructions as being in microMIPS (NFC)

Reviewers: atanasyan, abeserminji, smaksimovic

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

llvm-svn: 331756

6 years ago[AArch64] Disallow vector operand if FPR128 Q register is required.
Sander de Smalen [Tue, 8 May 2018 10:01:04 +0000 (10:01 +0000)]
[AArch64] Disallow vector operand if FPR128 Q register is required.

Patch https://reviews.llvm.org/D41445 changed the behaviour of 'isReg()'
to also return 'true' if the parsed register operand is a vector
register. Code in the AsmMatcher checks if a register is a subclass of the
expected register class. However, even though both parsed registers map
to the same physical register, the 'v' register is of kind 'NeonVector',
where 'q' is of type Scalar, where isSubclass() does not distinguish
between the two cases.

The solution is to use an AsmOperand instead of the register directly,
and use the PredicateMethod to distinguish the two operands.

This fixes for example:
  ldr v0, [x0]    // 'v0' is an invalid operand for this instruction
  ldr q0, [x0]    // valid

Reviewers: aemerson, Gerolf, SjoerdMeijer, javed.absar

Reviewed By: aemerson

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

llvm-svn: 331755

6 years ago[mips] Correct clo/clz predicates
Simon Dardis [Tue, 8 May 2018 09:50:37 +0000 (09:50 +0000)]
[mips] Correct clo/clz predicates

Reviewers: smaksimovic, abeserminji, atanasyan

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

llvm-svn: 331754

6 years agoFix 'not all control paths return a value' MSVC warnings. NFCI.
Simon Pilgrim [Tue, 8 May 2018 09:40:32 +0000 (09:40 +0000)]
Fix 'not all control paths return a value' MSVC warnings. NFCI.

llvm-svn: 331753

6 years ago[LLD][ELF][AArch64] Increase test coverage of AArch64ErrataFix [NFC]
Peter Smith [Tue, 8 May 2018 09:36:24 +0000 (09:36 +0000)]
[LLD][ELF][AArch64] Increase test coverage of AArch64ErrataFix [NFC]

In the recognise test convert some ST1 multiple structure to ST1 single
structure to test the isST1SingleOpcode() function.

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

llvm-svn: 331752

6 years ago[LLD][ELF] Add test cases to improve code coverage of Thunks [NFC]
Peter Smith [Tue, 8 May 2018 09:26:06 +0000 (09:26 +0000)]
[LLD][ELF] Add test cases to improve code coverage of Thunks [NFC]

Add two test cases to improve the code coverage of ThunkSection creation
when there are no existing ThunkSections in range. There are two test
cases, one where a new section can be created and another to trigger the
"InputSection too large for range extension thunk" error message. A recent
code coverage report showed that this section of code wasn't covered by a
test case.

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

llvm-svn: 331751

6 years ago[clang-format] Add raw string formatting to release notes
Krasimir Georgiev [Tue, 8 May 2018 09:25:12 +0000 (09:25 +0000)]
[clang-format] Add raw string formatting to release notes

Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits

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

llvm-svn: 331750

6 years ago[X86] Mark all byval parameters as aliased
Jeremy Morse [Tue, 8 May 2018 09:18:01 +0000 (09:18 +0000)]
[X86] Mark all byval parameters as aliased

This is a fix for PR30290: by marking all byval stack slots as being aliased,
the instruction scheduler is more conservative about rescheduling memory
accesses to such stack slots as an LLVM Value* might alias it. This fixes
errors such as in the patched test case, where reads and writes to a data
structure are illegally mixed.

This could be fixed better in the future with better analysis for the
instruction scheduler to know what Values alias what stack slots.

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

llvm-svn: 331749

6 years ago[X86][CET] Shadow stack fix for setjmp/longjmp
Alexander Ivchenko [Tue, 8 May 2018 09:04:07 +0000 (09:04 +0000)]
[X86][CET] Shadow stack fix for setjmp/longjmp

This patch adds a shadow stack fix when compiling
setjmp/longjmp with the shadow stack enabled. This
allows setjmp/longjmp to work correctly with CET.

Patch by mike.dvoretsky

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

llvm-svn: 331748

6 years ago[llvm-rc] Don't strictly require quotes around external file names
Martin Storsjo [Tue, 8 May 2018 08:47:37 +0000 (08:47 +0000)]
[llvm-rc] Don't strictly require quotes around external file names

Regardless of what docs may say, existing resource files in the
wild can use this syntax.

Rename a file used in an existing test, to make it usable for unquoted
paths.

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

llvm-svn: 331747

6 years agoObject: Find terminator correctly when reading long filenames in GNU archives (PR37244)
Hans Wennborg [Tue, 8 May 2018 08:22:58 +0000 (08:22 +0000)]
Object: Find terminator correctly when reading long filenames in GNU archives (PR37244)

The code was previously relying on there being a null terminator
somewhere in (or after) the string table, something made less likely by
r330786.

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

llvm-svn: 331746

6 years ago[C++2a] Implement operator<=>: Fix another bug in the code gen tests.
Eric Fiselier [Tue, 8 May 2018 07:56:05 +0000 (07:56 +0000)]
[C++2a] Implement operator<=>: Fix another bug in the code gen tests.

Sorry for the failures. I'm quite new at writing code gen tests, and
I'm not sure the best way to make them portable.

llvm-svn: 331745

6 years ago[test] Replace undef with true/false to make test case less fragile
Tobias Grosser [Tue, 8 May 2018 07:24:05 +0000 (07:24 +0000)]
[test] Replace undef with true/false to make test case less fragile

This test case does not require undef to be present in branch
conditions. Replace these undef values with true/false values to clarify
the control-flow required to reach the loop under testing.

llvm-svn: 331744

6 years ago[x86] Introduce the encl[u|s|v] intrinsics
Gabor Buella [Tue, 8 May 2018 07:12:34 +0000 (07:12 +0000)]
[x86] Introduce the encl[u|s|v] intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 331743

6 years ago[x86] Introduce the enclv instruction
Gabor Buella [Tue, 8 May 2018 07:11:05 +0000 (07:11 +0000)]
[x86] Introduce the enclv instruction

Summary:
and use the -msgx flag as a requirement
for the SGX instructions.

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 331742

6 years ago[LCSSA] Do not remove used PHI nodes in formLCSSAForInstructions
Bjorn Pettersson [Tue, 8 May 2018 06:59:47 +0000 (06:59 +0000)]
[LCSSA] Do not remove used PHI nodes in formLCSSAForInstructions

Summary:
In formLCSSAForInstructions we speculatively add new PHI
nodes, that sometimes ends up without having any uses. It
has been discovered that sometimes an added PHI node can
appear as being unused in one iteration of the Worklist,
although it can end up being used by a PHI node added in
a later iteration. We now check, a second time, that the
PHI node still is unused before we remove it. This avoids
an assert about "Trying to remove a phi with uses." for the
added test case.

Reviewers: davide, mzolotukhin, mattd, dberlin

Reviewed By: mzolotukhin, dberlin

Subscribers: dberlin, mzolotukhin, davide, bjope, uabelho, llvm-commits

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

llvm-svn: 331741

6 years ago[x86] Introduce the pconfig intrinsic
Gabor Buella [Tue, 8 May 2018 06:49:41 +0000 (06:49 +0000)]
[x86] Introduce the pconfig intrinsic

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 331740

6 years ago[x86] Introduce the pconfig instruction
Gabor Buella [Tue, 8 May 2018 06:47:36 +0000 (06:47 +0000)]
[x86] Introduce the pconfig instruction

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 331739

6 years ago[DebugInfo] Accept `S` in augmentation strings in CIE.
Fangrui Song [Tue, 8 May 2018 06:21:12 +0000 (06:21 +0000)]
[DebugInfo] Accept `S` in augmentation strings in CIE.

glibc libc.a(sigaction.o) compiled from sysdeps/unix/sysv/linux/x86_64/sigaction.c uses "zRS".

llvm-svn: 331738

6 years ago[asan] Fix bug introduced by r331647
Walter Lee [Tue, 8 May 2018 05:58:57 +0000 (05:58 +0000)]
[asan] Fix bug introduced by r331647

unmap_shadow_on_exit was inadvertently flipped for non-RTEMS.

llvm-svn: 331737

6 years ago[sanitizer] Add InternalMmapVector::swap
Vitaly Buka [Tue, 8 May 2018 04:57:08 +0000 (04:57 +0000)]
[sanitizer] Add InternalMmapVector::swap

llvm-svn: 331736

6 years ago[sanitizer] Fix error checking in ThreadLister
Vitaly Buka [Tue, 8 May 2018 04:56:57 +0000 (04:56 +0000)]
[sanitizer] Fix error checking in ThreadLister

llvm-svn: 331735

6 years agoRevert "[sanitizer] Be more accurate when calculating the previous instruction addres...
Igor Kudrin [Tue, 8 May 2018 04:39:00 +0000 (04:39 +0000)]
Revert "[sanitizer] Be more accurate when calculating the previous instruction address on ARM."

This reverts commit r331626 because it causes build bot failures:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/5069

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

llvm-svn: 331734

6 years agoReally test type lookup in TestCppTypeLookup.py
Frederic Riss [Tue, 8 May 2018 03:08:46 +0000 (03:08 +0000)]
Really test type lookup in TestCppTypeLookup.py

Summary:
... and fix one bug found this way. Currently, the test works not because
types are looked up correctly, but because by injecting local variables
we also materialize the types for Clang. If we disable the local variable
injection, then one check fails.

The reason of the failure is that FindTypes is run with max_matches==1
and this value is passed down to the symbol lookup functions. When the
search is performed only on the basename (like it's the case for an
entity defined in the root namespace), then the search will stop after
having found one match on the basename. But that match might be in a
namespace, we were really just looking up the basename in the accelerator
tables.

The solution is to not pass max_matches down, but to search without a
limit and let RemoveMismatchedTypes do its job afterwards. Note the
patch includes 2 hunks with the same change, but only the latter is
tested. I couldn't find a way to create a testcase for the other
branch of the if ('image lookup -t' allows me to get there, but it
only ever returns one type anyway).

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 331719

6 years ago[MachineVerifier][GlobalISel] Verifying generic extends and truncates
Roman Tereshin [Tue, 8 May 2018 02:48:15 +0000 (02:48 +0000)]
[MachineVerifier][GlobalISel] Verifying generic extends and truncates

Making sure we don't truncate / extend pointers, don't try to change
vector topology or bitcast vectors to scalars or back, and most
importantly, don't extend to a smaller type or truncate to a large
one.

Reviewers: qcolombet t.p.northover aditya_nandakumar

Reviewed By: qcolombet

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 331718

6 years ago[CMake] Pass additional CMake flags in Fuchsia cache files
Petr Hosek [Tue, 8 May 2018 02:47:13 +0000 (02:47 +0000)]
[CMake] Pass additional CMake flags in Fuchsia cache files

This allows passing additional CMake flags to builtins and runtimes
build through Fuchsia cache files.

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

llvm-svn: 331717

6 years ago[C++2a] operator<=>: Fix incorrect use of Twine.
Eric Fiselier [Tue, 8 May 2018 02:28:47 +0000 (02:28 +0000)]
[C++2a] operator<=>: Fix incorrect use of Twine.

llvm-svn: 331713

6 years ago[MIRParser][GlobalISel] Parsing vector pointer types (<M x pA>)
Roman Tereshin [Tue, 8 May 2018 02:02:50 +0000 (02:02 +0000)]
[MIRParser][GlobalISel] Parsing vector pointer types (<M x pA>)

MIParser wasn't able to parse LLTs like `<4 x p0>`, fixing that.

Reviewers: qcolombet t.p.northover aditya_nandakumar

Reviewed By: qcolombet

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 331712

6 years ago[XRay][compiler-rt] Add llvm-mca assembler annotations for XRay (NFC)
Dean Michael Berris [Tue, 8 May 2018 01:57:51 +0000 (01:57 +0000)]
[XRay][compiler-rt] Add llvm-mca assembler annotations for XRay (NFC)

This change adds some assembler comments to facilitate analysis with
llvm-mca. In particular, we're interested in identifying and later
optimising (reducing) the cost of the key functions in the XRay
implementation using both static analysis (with llvm-mca, etc.) and
dynamic analysis (perf profiling, etc.) of microbenchmarks.

llvm-svn: 331711

6 years ago[dfsan] update the abilist for the sanitizer coverage; also remove the fuzz target...
Kostya Serebryany [Tue, 8 May 2018 01:52:40 +0000 (01:52 +0000)]
[dfsan] update the abilist for the sanitizer coverage; also remove the fuzz target from this list

llvm-svn: 331710

6 years ago[NewPM] Emit inliner NoDefinition missed optimization remark
Teresa Johnson [Tue, 8 May 2018 01:45:46 +0000 (01:45 +0000)]
[NewPM] Emit inliner NoDefinition missed optimization remark

Summary: Makes this consistent with the old PM.

Reviewers: eraman

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 331709

6 years agoAdd a CIE with length 0 unconditionally.
Fangrui Song [Tue, 8 May 2018 01:19:16 +0000 (01:19 +0000)]
Add a CIE with length 0 unconditionally.

Summary: This is not technically required, but glibc unwind-dw2-fde.c classify_object_over_fdes expects there is a CIE record length 0 as a terminator.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 331708

6 years ago[C++2a] Implement operator<=>: Address bugs and post-commit review comments after...
Eric Fiselier [Tue, 8 May 2018 00:52:19 +0000 (00:52 +0000)]
[C++2a] Implement operator<=>: Address bugs and post-commit review comments after r331677.

This patch addresses some mostly trivial post-commit review comments received
on r331677.

Additionally, this patch fixes an assertion in `getNarrowingKind` caused by
the use of an uninitialized value from `checkThreeWayNarrowingConversion`.

llvm-svn: 331707

6 years agoMove test input file into same directory as test. NFC
Richard Trieu [Tue, 8 May 2018 00:29:21 +0000 (00:29 +0000)]
Move test input file into same directory as test.  NFC

llvm-svn: 331706

6 years ago[WebAssembly] MC: Use existing MCSymbol.Index field rather than inventing extra mapping
Sam Clegg [Tue, 8 May 2018 00:08:21 +0000 (00:08 +0000)]
[WebAssembly] MC: Use existing MCSymbol.Index field rather than inventing extra mapping

MCSymbol has getIndex/setIndex which are implementation defined
and on other platforms are used to store the symbol table
index.  It makes sense to use this rather than invent a new
mapping.

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

llvm-svn: 331705

6 years ago[MC] ELFObjectWriter: Removing unneeded variable and cast
Sam Clegg [Mon, 7 May 2018 23:52:17 +0000 (23:52 +0000)]
[MC] ELFObjectWriter: Removing unneeded variable and cast

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

llvm-svn: 331704

6 years agoRename a local variable whose scope is very narrow. NFC.
Rui Ueyama [Mon, 7 May 2018 23:43:48 +0000 (23:43 +0000)]
Rename a local variable whose scope is very narrow. NFC.

llvm-svn: 331703

6 years agoRevert r330742: Let TableGen write output only if it changed, instead of doing so...
Chandler Carruth [Mon, 7 May 2018 23:41:48 +0000 (23:41 +0000)]
Revert r330742: Let TableGen write output only if it changed, instead of doing so in cmake.

This change causes us to re-run tablegen for every single target on
every single build. This is much, much worse than the problem being
fixed AFAICT.

On my system, it makes a clean rebuild of `llc` with nothing changed go
from .5s to over 8s. On systems with less parallelism, slower file
systems, or high process startup overhead this will be even more
extreme.

The only way I see this could be a win is in clean builds where we churn
the filesystem. But I think incremental rebuild is more important, and
so if we want to re-instate this, it needs to be done in a way that
doesn't trigger constant re-runs of tablegen.

llvm-svn: 331702