platform/upstream/llvm.git
6 years agoFix typo in declaring code-block snippet
Simon Pilgrim [Thu, 17 May 2018 16:58:42 +0000 (16:58 +0000)]
Fix typo in declaring code-block snippet

llvm-svn: 332630

6 years ago[lit, lldbsuite] Disable tests that are failing because of pr21765 and pr24489
Stella Stamenova [Thu, 17 May 2018 16:58:00 +0000 (16:58 +0000)]
[lit, lldbsuite] Disable tests that are failing because of pr21765 and pr24489

Summary: These three tests are failing on Windows and looking into the failures, they could be mapped to pr21765 and pr24489

Reviewers: asmith, labath, zturner

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 332629

6 years ago[CMake] Make optimizing sanitizer builds optional
Chris Bieneman [Thu, 17 May 2018 16:55:29 +0000 (16:55 +0000)]
[CMake] Make optimizing sanitizer builds optional

This behavior has been the default for a long time, so the default value is On, however this can make it difficult to debug sanitizer failures, so we should have an option to turn it off.

llvm-svn: 332628

6 years ago[llvm-mca] Add an example showing how to get Intel assembly syntax
Andrea Di Biagio [Thu, 17 May 2018 16:48:53 +0000 (16:48 +0000)]
[llvm-mca] Add an example showing how to get Intel assembly syntax

Patch by Jeff Muizelaar.

llvm-svn: 332627

6 years ago[X86] Split WriteCMOV + WriteCMOV2 scheduler classes
Simon Pilgrim [Thu, 17 May 2018 16:47:30 +0000 (16:47 +0000)]
[X86] Split WriteCMOV + WriteCMOV2 scheduler classes

Handle SNB+ targets which treat CMOVA/CMOVBE specially due to partial EFLAGS handling.

llvm-svn: 332626

6 years agoAMDGPU/SI: Handle infinite loop for the structurizer to work with CFG with infinite...
Changpeng Fang [Thu, 17 May 2018 16:45:01 +0000 (16:45 +0000)]
AMDGPU/SI: Handle infinite loop for the structurizer to work with CFG with infinite loops.

Summary:
  The current StructurizeCFG pass only works for CFG with one exit. AMDGPUUnifyDivergentExitNodes combines multiple "return" blocks and/or "unreachable" blocks
to one exit block for the Structurizer to work. However, infinite loop is another kind of special "exit", and if we don't handle it, the case of multiple exits will prevent the structurizer from working.

In this work, for each infinite loop, we add a dummy edge to the "return" block, and thus the AMDGPUUnifyDivergentExitNodes pass will work with infinite loops.
This will make CFG with infinite loops be structurized.

Reviewer:
  nhaehnle

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

llvm-svn: 332625

6 years ago[mips] Add support for Global INValidate ASE
Petar Jovanovic [Thu, 17 May 2018 16:30:32 +0000 (16:30 +0000)]
[mips] Add support for Global INValidate ASE

This includes

  Instructions: ginvi, ginvt,

  Assembler directives: .set ginv, .set noginv, .module ginv, .module noginv

  Attribute: ginv

  .MIPS.abiflags: GINV (0x20000)

Patch by Vladimir Stefanovic.

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

llvm-svn: 332624

6 years ago[InstCombine] Propagate the nsw/nuw flags from the add in the 'shifty' abs pattern...
Craig Topper [Thu, 17 May 2018 16:29:52 +0000 (16:29 +0000)]
[InstCombine] Propagate the nsw/nuw flags from the add in the 'shifty' abs pattern to the sub in the select version.

According to alive this is valid. I'm hoping to use this to make an assumption that the sign bit is zero after this sequence. The only way it wouldn't be is if the input was INT__MIN, but by preserving the flags we can make doing this to INT_MIN UB.

The nuw flags is weird because it creates such a contradiction that the original number would have to be positive meaning we could remove the select entirely, but we don't get that far.

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

llvm-svn: 332623

6 years ago[llvm-mca][X86] Add CMOV test files
Simon Pilgrim [Thu, 17 May 2018 16:29:12 +0000 (16:29 +0000)]
[llvm-mca][X86] Add CMOV test files

llvm-svn: 332622

6 years ago[CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.
Justin Lebar [Thu, 17 May 2018 16:15:07 +0000 (16:15 +0000)]
[CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.

Summary:
Previously this triggered a -Wundefined-internal warning.  But it's not
an undefined variable -- any variable of this form is a pointer to the
base of GPU core's shared memory.

Reviewers: tra

Subscribers: sanjoy, rsmith

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

llvm-svn: 332621

6 years agoDisable a failing clang-move test on windows.
Eric Liu [Thu, 17 May 2018 16:13:36 +0000 (16:13 +0000)]
Disable a failing clang-move test on windows.

This was broken by r332590 but is likely caused by a bug in clang-move.

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/12007

I don't have a windows machine to effectively debug the issue, so I'll investigate
further but for now disable the failing test on windows to unbreak build bots.

llvm-svn: 332620

6 years ago[CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.
Justin Lebar [Thu, 17 May 2018 16:12:42 +0000 (16:12 +0000)]
[CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.

Reviewers: rsmith

Subscribers: sanjoy, cfe-commits, tra

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

llvm-svn: 332619

6 years agoFileSpec objects that resolve to "." should have "." in m_filename and m_directory...
Greg Clayton [Thu, 17 May 2018 16:12:38 +0000 (16:12 +0000)]
FileSpec objects that resolve to "." should have "." in m_filename and m_directory empty.

After switching to LLVM normalization, if we init FileSpec with "." we would end up with m_directory being NULL and m_filename being "".

This patch fixes this by allowing the path to be normalized and if it normalized to nothing, set it to m_filename.

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

llvm-svn: 332618

6 years ago[RISCV] Set isReMaterializable on ADDI and LUI instructions
Alex Bradbury [Thu, 17 May 2018 15:51:37 +0000 (15:51 +0000)]
[RISCV] Set isReMaterializable on ADDI and LUI instructions

The isReMaterlizable flag is somewhat confusing, unlike most other instruction
flags it is currently interpreted as a hint (mightBeRematerializable would be
a better name). While LUI is always rematerialisable, for an instruction like
ADDI it depends on its operands. TargetInstrInfo::isTriviallyReMaterializable
will call TargetInstrInfo::isReallyTriviallyReMaterializable, which in turn
calls TargetInstrInfo::isReallyTriviallyReMaterializableGeneric. We rely on
the logic in the latter to pick out instances of ADDI that really are
rematerializable.

The isReMaterializable flag does make a difference on a variety of test
programs. The recently committed remat.ll test case demonstrates how stack
usage is reduce and a unnecessary lw/sw can be removed. Stack usage in the
Proc0 function in dhrystone reduces from 192 bytes to 112 bytes.

For the sake of completeness, this patch also implements
RISCVRegisterInfo::isConstantPhysReg. Although this is called from a number of
places, it doesn't seem to result in different codegen for any programs I've
thrown at it. However, it is called in the rematerialisation codepath and it
seems sensible to implement something correct here.

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

llvm-svn: 332617

6 years ago[X86][BtVer2] ADC/SBB take 2cy on an ALU pipe, not 1cy like ADD/SUB
Simon Pilgrim [Thu, 17 May 2018 15:43:23 +0000 (15:43 +0000)]
[X86][BtVer2] ADC/SBB take 2cy on an ALU pipe, not 1cy like ADD/SUB

llvm-svn: 332616

6 years ago[llvm-mca] Hide unrelated flags from the -help output.
Andrea Di Biagio [Thu, 17 May 2018 15:35:14 +0000 (15:35 +0000)]
[llvm-mca] Hide unrelated flags from the -help output.

llvm-svn: 332615

6 years agoFix __uuidof handling on non-type template parameter in C++17
Nico Weber [Thu, 17 May 2018 15:26:37 +0000 (15:26 +0000)]
Fix __uuidof handling on non-type template parameter in C++17

Clang used to pass the base lvalue of a non-type template parameter
to the template instantiation phase when the base part is __uuidof
and it's running in C++17 mode.
However, that drops its LValuePath, and unintentionally transforms
&__uuidof(...) to __uuidof(...).

This CL fixes that by passing whole expr. Fixes PR24986.

https://reviews.llvm.org/D46820?id=146557
Patch from Taiju Tsuiki <tzik@chromium.org>!

llvm-svn: 332614

6 years ago[COFF] Add /Brepro and /TIMESTAMP options.
Zachary Turner [Thu, 17 May 2018 15:11:01 +0000 (15:11 +0000)]
[COFF] Add /Brepro and /TIMESTAMP options.

Previously we would always write a hash of the binary into the
PE file, for reproducible builds.  This breaks AppCompat, which
is a feature of Windows that relies on the timestamp in the PE
header being set to a real value (or at the very least, a value
that satisfies certain properties).

To address this, we put the old behavior of writing the hash
behind the /Brepro flag, which mimics MSVC linker behavior.  We
also match MSVC default behavior, which is to write an actual
timestamp to the PE header.  Finally, we add the /TIMESTAMP
option (an lld extension) so that the user can specify the exact
value to be used in case he/she manually constructs a value which
is both reproducible and satisfies AppCompat.

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

llvm-svn: 332613

6 years agoSecond attempt to fix clang-move tests broken by r332590 on windows
Eric Liu [Thu, 17 May 2018 14:59:15 +0000 (14:59 +0000)]
Second attempt to fix clang-move tests broken by r332590 on windows

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/12010

Add back a path conversion removed in a previous attempt. I removed it
because it didn't seem necessary. Added it back to see if this would fix
the bot.

llvm-svn: 332612

6 years ago[llvm-exegesis] Remove redudant explicit template instantiations.
Clement Courbet [Thu, 17 May 2018 14:37:31 +0000 (14:37 +0000)]
[llvm-exegesis] Remove redudant explicit template instantiations.

llvm-svn: 332611

6 years agoIn thin and full LTO + CFI, direct function calls may go through jump table
Dmitry Mikulin [Thu, 17 May 2018 14:29:07 +0000 (14:29 +0000)]
In thin and full LTO + CFI, direct function calls may go through jump table
entries to reach the target. Since these calls don't require type checks,
we can short-circuit them to their real targets.

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

llvm-svn: 332610

6 years ago[clang-tidy] Add a flag to enable alpha checkers
Alexander Kornienko [Thu, 17 May 2018 14:04:27 +0000 (14:04 +0000)]
[clang-tidy] Add a flag to enable alpha checkers

Summary: The alpha checkers can already be enabled using the clang driver, this allows them to be enabled using the clang-tidy as well. This can make it easier to test the alpha checkers with projects which already support the compile_commands.json. It will also allow more people to give feedback and patches about the alpha checkers since they can run it as part of clang tidy checks.

Reviewers: aaron.ballman, hokein, ilya-biryukov, alexfh, lebedev.ri, xbolva00

Reviewed By: aaron.ballman, alexfh, lebedev.ri, xbolva00

Subscribers: xbolva00, NoQ, dcoughlin, lebedev.ri, xazax.hun, cfe-commits

Patch by Paul Fultz II!

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

llvm-svn: 332609

6 years ago[llvm-exegesis] Write out inconsistencies to a file.
Clement Courbet [Thu, 17 May 2018 13:41:28 +0000 (13:41 +0000)]
[llvm-exegesis] Write out inconsistencies to a file.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 332608

6 years ago[Hexagon] Use addAliasForDirective for data directives
Alex Bradbury [Thu, 17 May 2018 13:21:18 +0000 (13:21 +0000)]
[Hexagon] Use addAliasForDirective for data directives

Data directives such as .word, .half, .hword are currently parsed using
HexagonAsmParser::ParseDirectiveValue which effectively duplicates logic from
AsmParser::parseDirectiveValue. This patch deletes that duplicated logic in
favour of using addAliasForDirective.

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

llvm-svn: 332607

6 years ago[AArch64] Correct inline assembly test case for S modifier [NFC]
Peter Smith [Thu, 17 May 2018 13:17:33 +0000 (13:17 +0000)]
[AArch64] Correct inline assembly test case for S modifier [NFC]

The existing test for the AArch64 inline assembly constraint S uses the
A and L modifiers. These modifiers were implemented in the original
AArch64 backend but were not carried forward to the merged backend. The
A is associated with ADRP and does nothing, the L is associated with
:lo12: . Given that A and L are not supported by GCC and not supported
by the new implementation of constraint S in LLVM (see D46745) I've
altered the test to put :lo12: directly in the string so that A and L
are not needed.

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

llvm-svn: 332606

6 years ago[X86] Split WriteADC/WriteADCRMW scheduler classes
Simon Pilgrim [Thu, 17 May 2018 12:43:42 +0000 (12:43 +0000)]
[X86] Split WriteADC/WriteADCRMW scheduler classes

For integer ALU instructions taking eflags as an input (ADC/SBB/ADCX/ADOX)

llvm-svn: 332605

6 years ago[llvm-exegesis] Disable failing ARM assembler tests.
Clement Courbet [Thu, 17 May 2018 12:41:56 +0000 (12:41 +0000)]
[llvm-exegesis] Disable failing ARM assembler tests.

llvm-svn: 332604

6 years agoAttempt to fix clang-move tests broken by r332590 on windows
Eric Liu [Thu, 17 May 2018 12:40:50 +0000 (12:40 +0000)]
Attempt to fix clang-move tests broken by r332590 on windows

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/12007

llvm-svn: 332603

6 years ago[llvm-mca] add flag -all-views and flag -all-stats.
Andrea Di Biagio [Thu, 17 May 2018 12:27:03 +0000 (12:27 +0000)]
[llvm-mca] add flag -all-views and flag -all-stats.

Flag -all-views enables all the views.
Flag -all-stats enables all the views that print hardware statistics.

llvm-svn: 332602

6 years ago[llvm-exegesis] Analysis: detect clustering inconsistencies.
Clement Courbet [Thu, 17 May 2018 12:25:18 +0000 (12:25 +0000)]
[llvm-exegesis] Analysis: detect clustering inconsistencies.

Summary:
Warn on instructions that should have the same performance
characteristics according to the sched model but actually
differ in their benchmarks.

Next step: Make the display nicer to browse, I was thinking maybe html.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 332601

6 years ago[llvm-exegesis] Disable the tests failing on buildbots while we investigate.
Clement Courbet [Thu, 17 May 2018 11:55:08 +0000 (11:55 +0000)]
[llvm-exegesis] Disable the tests failing on buildbots while we investigate.

llvm-svn: 332600

6 years ago[SystemZ] Commenting (NFC)
Jonas Paulsson [Thu, 17 May 2018 11:53:56 +0000 (11:53 +0000)]
[SystemZ]  Commenting (NFC)

Some minor commenting in scheduler files.

Review: Ulrich Weigand
llvm-svn: 332599

6 years agoUse dotted format of version tuple for availability diagnostics
Jan Korous [Thu, 17 May 2018 11:51:49 +0000 (11:51 +0000)]
Use dotted format of version tuple for availability diagnostics

E. g. use "10.11" instead of "10_11".

We are maintaining backward compatibility by parsing underscore-delimited version tuples but no longer keep track of the separator and using dot format for output.

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

rdar://problem/39845032

llvm-svn: 332598

6 years ago[llvm-exegesis][NFC] Remove dead function.
Clement Courbet [Thu, 17 May 2018 11:51:49 +0000 (11:51 +0000)]
[llvm-exegesis][NFC] Remove dead function.

llvm-svn: 332597

6 years ago[DWARF] Have HashedNameToDIE store a DataExtractor by value
Pavel Labath [Thu, 17 May 2018 11:36:08 +0000 (11:36 +0000)]
[DWARF] Have HashedNameToDIE store a DataExtractor by value

Summary:
The DataExtractors are cheap to copy so there is no reason to store them
by reference. Also, in my upcoming indexing refactor I am planning to
remove the apple tables data extractor members from the SymbolFileDWARF
class, so there will not be a DataExtractor with a suitable lifetime to
refer to.

Reviewers: clayborg, JDevlieghere

Subscribers: aprantl, lldb-commits

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

llvm-svn: 332596

6 years ago[llvm-mca][X86] Add ADX test files
Simon Pilgrim [Thu, 17 May 2018 11:32:38 +0000 (11:32 +0000)]
[llvm-mca][X86] Add ADX test files

llvm-svn: 332595

6 years agoFix r332592 : X86 tests should use the X86 target, not the native targets.
Clement Courbet [Thu, 17 May 2018 11:31:24 +0000 (11:31 +0000)]
Fix r332592 : X86 tests should use the X86 target, not the native targets.

llvm-svn: 332594

6 years agoCodeGen: Fix invalid bitcast for lifetime.start/end
Yaxun Liu [Thu, 17 May 2018 11:16:35 +0000 (11:16 +0000)]
CodeGen: Fix invalid bitcast for lifetime.start/end

lifetime.start/end expects pointer argument in alloca address space.
However in C++ a temporary variable is in default address space.

This patch changes API CreateMemTemp and CreateTempAlloca to
get the original alloca instruction and pass it lifetime.start/end.

It only affects targets with non-zero alloca address space.

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

llvm-svn: 332593

6 years agoreland r332579: [llvm-exegesis] Update to cover latency through another opcode.
Clement Courbet [Thu, 17 May 2018 10:52:18 +0000 (10:52 +0000)]
reland r332579: [llvm-exegesis] Update to cover latency through another opcode.

Restructuring the code to measure latency and uops.
The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
It now uses BitVector instead of Graph for performance reasons.

https://reviews.llvm.org/D46821

(with fixed ARM tests)

Authored by Guillaume Chatelet

llvm-svn: 332592

6 years ago[X86][SNB] Minor scheduler cleanup
Simon Pilgrim [Thu, 17 May 2018 10:36:29 +0000 (10:36 +0000)]
[X86][SNB] Minor scheduler cleanup

Merge 2 instregex and explain the VMOVDQArr/MOVDQArr difference

llvm-svn: 332591

6 years agoAdd vfs::FileSystem::getRealPath
Eric Liu [Thu, 17 May 2018 10:26:23 +0000 (10:26 +0000)]
Add vfs::FileSystem::getRealPath

Summary: And change `FileManager::getCanonicalName` to use getRealPath.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 332590

6 years ago[ELF] - Do not crash when do --gc-sections for non-allocatable metadata sections.
George Rimar [Thu, 17 May 2018 10:00:34 +0000 (10:00 +0000)]
[ELF] - Do not crash when do --gc-sections for non-allocatable metadata sections.

Currently, LLD marks all non-allocatable sections except SHF_REL[A] as Live
when doing GC.

This can be a reason of the crash when SHF_LINK_ORDER sections
are involved, because their parents can be dead.

We should do GC for them correctly. The patch implements it.

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

llvm-svn: 332589

6 years ago[ASTImporter] Fix missing implict CXXRecordDecl
Gabor Marton [Thu, 17 May 2018 09:46:07 +0000 (09:46 +0000)]
[ASTImporter] Fix missing implict CXXRecordDecl

Summary:
Implicit CXXRecordDecl is not added to its DeclContext during import, but in
the original AST it is. This patch fixes this.

Reviewers: xazax.hun, a.sidorin, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 332588

6 years ago[libclang] Allow skipping function bodies in preamble only
Ivan Donchevskii [Thu, 17 May 2018 09:24:37 +0000 (09:24 +0000)]
[libclang] Allow skipping function bodies in preamble only

Second attempt. Fix line endings and warning.

As an addition to CXTranslationUnit_SkipFunctionBodies, provide the
new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble,
which constraints the skipping of functions bodies to the preamble
only. Function bodies in the main file are not affected if this
option is set.

Skipping function bodies only in the preamble is what clangd already
does and the introduced flag implements it for libclang clients.

Patch by Nikolai Kosjar.

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

llvm-svn: 332587

6 years ago[Frontend] Avoid running plugins during code completion parse
Ivan Donchevskii [Thu, 17 May 2018 09:21:07 +0000 (09:21 +0000)]
[Frontend] Avoid running plugins during code completion parse

Second attempt. Proper line endings.

The parsing that is done for code completion is a special case that will
discard any generated diagnostics, so avoid running plugins for this
case in the first place to avoid performance penalties due to the
plugins.

A scenario for this is for example libclang with extra plugins like tidy.

Patch by Nikolai Kosjar

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

llvm-svn: 332586

6 years agoRevert https://reviews.llvm.org/D46050 and https://reviews.llvm.org/D45815
Ivan Donchevskii [Thu, 17 May 2018 09:15:22 +0000 (09:15 +0000)]
Revert https://reviews.llvm.org/D46050 and https://reviews.llvm.org/D45815

Windows line endings.
Requires proper resubmission.

llvm-svn: 332585

6 years ago[AArch64][SVE] Asm: Support for structured ST2, ST3 and ST4 (scalar+scalar) store...
Sander de Smalen [Thu, 17 May 2018 09:05:41 +0000 (09:05 +0000)]
[AArch64][SVE] Asm: Support for structured ST2, ST3 and ST4 (scalar+scalar) store instructions.

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

Reviewed By: SjoerdMeijer

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

llvm-svn: 332584

6 years agoRequire DominatorTree when requiring/preserving LoopInfo in the old pass manager
Mikael Holmen [Thu, 17 May 2018 09:05:40 +0000 (09:05 +0000)]
Require DominatorTree when requiring/preserving LoopInfo in the old pass manager

Summary:
Require DominatorTree when requiring/preserving LoopInfo in the old pass manager

BreakCriticalEdges tries to keep LoopInfo and DominatorTree updated if they
exist. However, since commit r321653 and r321805, to update LoopInfo we
must have a DominatorTree, or we will hit an assert.

To fix this we now make a couple of passes that only required/preserved
LoopInfo also require DominatorTree.

This solves PR37334.

Reviewers: eli.friedman, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

llvm-svn: 332583

6 years ago[clang-format] Fix putting ObjC message arguments in one line for multiline receiver
Jacek Olesiak [Thu, 17 May 2018 08:35:15 +0000 (08:35 +0000)]
[clang-format] Fix putting ObjC message arguments in one line for multiline receiver

Summary:
Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.:
```
[[object block:^{
  return 42;
}] aa:42 bb:42];
```
will be formatted:
```
[[object block:^{
  return 42;
}] aa:42
   bb:42];
```
even though arguments could fit into one line. This change fixes this behavior.

Test Plan:
make -j12 FormatTests && tools/clang/unittests/Format/FormatTests

Reviewers: benhamilton, djasper

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

llvm-svn: 332582

6 years ago[Analysis] Only use _unlocked stdio functions on linux
Martin Storsjo [Thu, 17 May 2018 08:16:08 +0000 (08:16 +0000)]
[Analysis] Only use _unlocked stdio functions on linux

The existing comment said that the functions were available only
on GNU/Linux (and on certain Android versions), but only checked
T.isGNUEnvironment() which also is true on MinGW (for arch-windows-gnu
triplets), which doesn't have such functions.

Existing checks in the initialize function in TargetLibraryInfo.cpp
also use only T.isOSLinux() to check for glibc features.

This fixes use of stdio on MinGW.

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

llvm-svn: 332581

6 years agoRevert r332579 "[llvm-exegesis] Update to cover latency through another opcode."
Clement Courbet [Thu, 17 May 2018 08:12:29 +0000 (08:12 +0000)]
Revert r332579 "[llvm-exegesis] Update to cover latency through another opcode."

The revision failed to update the ARM tests.

llvm-svn: 332580

6 years ago[llvm-exegesis] Update to cover latency through another opcode.
Clement Courbet [Thu, 17 May 2018 07:38:21 +0000 (07:38 +0000)]
[llvm-exegesis] Update to cover latency through another opcode.

    Restructuring the code to measure latency and uops.
    The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
    It now uses BitVector instead of Graph for performance reasons.

    https://reviews.llvm.org/D46821

    Authored by Guillaume Chatelet

llvm-svn: 332579

6 years ago[libclang] Allow skipping function bodies in preamble only
Ivan Donchevskii [Thu, 17 May 2018 07:31:29 +0000 (07:31 +0000)]
[libclang] Allow skipping function bodies in preamble only

As an addition to CXTranslationUnit_SkipFunctionBodies, provide the
new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble,
which constraints the skipping of functions bodies to the preamble
only. Function bodies in the main file are not affected if this
option is set.

Skipping function bodies only in the preamble is what clangd already
does and the introduced flag implements it for libclang clients.

Patch by Nikolai Kosjar.

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

llvm-svn: 332578

6 years ago[SROA] Handle PHI with multiple duplicate predecessors
Bjorn Pettersson [Thu, 17 May 2018 07:21:41 +0000 (07:21 +0000)]
[SROA] Handle PHI with multiple duplicate predecessors

Summary:
The verifier accepts PHI nodes with multiple entries for the
same basic block, as long as the value is the same.

As seen in PR37203, SROA did not handle such PHI nodes properly
when speculating loads over the PHI, since it inserted multiple
loads in the predecessor block and changed the PHI into having
multiple entries for the same basic block, but with different
values.

This patch teaches SROA to reuse the same speculated load for
each PHI duplicate entry in such situations.

Resolves: https://bugs.llvm.org/show_bug.cgi?id=37203

Reviewers: uabelho, chandlerc, hfinkel, bkramer, efriedma

Reviewed By: efriedma

Subscribers: dberlin, efriedma, llvm-commits

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

llvm-svn: 332577

6 years agoFix rL332458: [AST] Added a helper to extract a user-friendly text of a comment.
Clement Courbet [Thu, 17 May 2018 06:46:15 +0000 (06:46 +0000)]
Fix rL332458: [AST] Added a helper to extract a user-friendly text of a comment.

Older gcc versions do not support raw string literals within macros.

llvm-svn: 332576

6 years ago[SROA] pr37267: fix assertion failure in integer widening
Hiroshi Inoue [Thu, 17 May 2018 06:32:17 +0000 (06:32 +0000)]
[SROA] pr37267: fix assertion failure in integer widening

The current integer widening does not support rewriting partial split slices in rewriteIntegerStore (and rewriteIntegerLoad).
This patch adds explicit checks for this case in isIntegerWideningViableForSlice.
Before r322533, splitting is allowed only for the whole-alloca slice and hence the above case is implicitly rejected by another check `if (DL.getTypeStoreSize(ValueTy) > Size)` because whole-alloca slice is larger than the partition.

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

llvm-svn: 332575

6 years ago[RISCV] Add support for .half, .hword, .word, .dword directives
Alex Bradbury [Thu, 17 May 2018 05:58:08 +0000 (05:58 +0000)]
[RISCV] Add support for .half, .hword, .word, .dword directives

These directives are recognised by gas. Support is added through the use of
addAliasForDirective.

Also match RISC-V gcc in preferring .half and .word for 16-bit and 32-bit data
directives.

llvm-svn: 332574

6 years ago[X86] Add OptForSize to a couple load folding patterns. Remove some bad FIXME comments.
Craig Topper [Thu, 17 May 2018 05:41:11 +0000 (05:41 +0000)]
[X86] Add OptForSize to a couple load folding patterns. Remove some bad FIXME comments.

The FIXME comments were about preventing load folding to avoid a partial xmm update. But these instructions use GPR as input when the load isn't folded. This won't help prevent a partial xmm update.

llvm-svn: 332573

6 years ago[ELF] PowerOpen ABI -> Power Architecture 64-bit v2 ABI. NFC
Fangrui Song [Thu, 17 May 2018 05:34:29 +0000 (05:34 +0000)]
[ELF] PowerOpen ABI -> Power Architecture 64-bit v2 ABI. NFC

Reviewers: sfertile, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 332572

6 years ago[libcxx] [test] Remove unused local typedef in test/std/numerics/rand/rand.eng/rand...
Billy Robert O'Neal III [Thu, 17 May 2018 04:59:34 +0000 (04:59 +0000)]
[libcxx] [test] Remove unused local typedef in test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp

llvm-svn: 332571

6 years ago[CMake] Support building shared library for Fuchsia
Petr Hosek [Thu, 17 May 2018 03:39:03 +0000 (03:39 +0000)]
[CMake] Support building shared library for Fuchsia

Fuchsia uses ELF as a file format and LLD as the linker so we can
use the same implementation as other ELF based platforms.

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

llvm-svn: 332570

6 years ago[Thumb2] fix typo in test from r332548
Sanjay Patel [Thu, 17 May 2018 03:24:25 +0000 (03:24 +0000)]
[Thumb2] fix typo in test from r332548

llvm-svn: 332569

6 years agoAdd void casts to suppress nodiscard on linear_congruential_engine.
Billy Robert O'Neal III [Thu, 17 May 2018 02:58:26 +0000 (02:58 +0000)]
Add void casts to suppress nodiscard on linear_congruential_engine.

llvm-svn: 332567

6 years agoMark test with "REQUIRES: shell" since it directly invokes "sh" and was failing on...
Douglas Yung [Thu, 17 May 2018 01:36:25 +0000 (01:36 +0000)]
Mark test with "REQUIRES: shell" since it directly invokes "sh" and was failing on Windows.

llvm-svn: 332563

6 years ago[AMDGPU] Move lsr test. NFC.
Stanislav Mekhanoshin [Thu, 17 May 2018 01:30:51 +0000 (01:30 +0000)]
[AMDGPU] Move lsr test. NFC.

llvm-svn: 332562

6 years ago[WebAssembly] Fix the opcode number for i64.load16_u.
Dan Gohman [Thu, 17 May 2018 00:14:13 +0000 (00:14 +0000)]
[WebAssembly] Fix the opcode number for i64.load16_u.

Fixes PR37488.

llvm-svn: 332561

6 years ago[CodeGen] Use MachineInstr::getOperand(0) instead of gets the defs iterator_range...
Craig Topper [Wed, 16 May 2018 23:39:27 +0000 (23:39 +0000)]
[CodeGen] Use MachineInstr::getOperand(0) instead of gets the defs iterator_range and calling begin. NFC

Defs are well defined to come first in MachineInstr operand list. No need for a more complex indirection.

llvm-svn: 332559

6 years ago[libFuzzer] rename a test from .c to .cpp
Kostya Serebryany [Wed, 16 May 2018 23:38:53 +0000 (23:38 +0000)]
[libFuzzer] rename a test from .c to .cpp

llvm-svn: 332558

6 years ago[asan] Add a magic shadow value for shadw gap
Walter Lee [Wed, 16 May 2018 23:36:01 +0000 (23:36 +0000)]
[asan] Add a magic shadow value for shadw gap

This gives us something to insert into the shadow gap for systems that
don't have memory protection turned on there (i.e. on Myriad).

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

llvm-svn: 332557

6 years agoRevert 332511 after reverting llvm revision 332508.
Greg Clayton [Wed, 16 May 2018 23:32:45 +0000 (23:32 +0000)]
Revert 332511 after reverting llvm revision 332508.

llvm-svn: 332556

6 years agoRevert 332508 as it caused problems in the clang test suite.
Greg Clayton [Wed, 16 May 2018 23:29:36 +0000 (23:29 +0000)]
Revert 332508 as it caused problems in the clang test suite.

llvm-svn: 332555

6 years ago[libFuzzer] add an experimental flag -focus_function: libFuzzer will try to focus...
Kostya Serebryany [Wed, 16 May 2018 23:26:37 +0000 (23:26 +0000)]
[libFuzzer] add an experimental flag -focus_function: libFuzzer will try to focus on inputs that trigger that function

llvm-svn: 332554

6 years ago[asan] Restore check removed by r332033
Walter Lee [Wed, 16 May 2018 23:23:56 +0000 (23:23 +0000)]
[asan] Restore check removed by r332033

Needed by fiber handling code, and possibly other code paths.

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

llvm-svn: 332553

6 years ago[STLExtras] Add size() for ranges, and remove distance()
Vedant Kumar [Wed, 16 May 2018 23:20:42 +0000 (23:20 +0000)]
[STLExtras] Add size() for ranges, and remove distance()

r332057 introduced distance() for ranges. Based on post-commit feedback,
this renames distance() to size(). The new size() is also only enabled
when the operation is O(1).

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

llvm-svn: 332551

6 years ago[Hexagon] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:49:08 +0000 (22:49 +0000)]
[Hexagon] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332550

6 years ago[PowerPC] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:48:48 +0000 (22:48 +0000)]
[PowerPC] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332549

6 years ago[Thumb] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:47:51 +0000 (22:47 +0000)]
[Thumb] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332548

6 years ago[Thumb] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:47:42 +0000 (22:47 +0000)]
[Thumb] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332547

6 years ago[analyzer] Extend ObjCAutoreleaseWriteChecker to catch block declarations with autore...
George Karpenkov [Wed, 16 May 2018 22:47:05 +0000 (22:47 +0000)]
[analyzer] Extend ObjCAutoreleaseWriteChecker to catch block declarations with autoreleasing variables

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

llvm-svn: 332546

6 years ago[ASTMatchers] Introduce a blockDecl matcher for matching block declarations
George Karpenkov [Wed, 16 May 2018 22:47:03 +0000 (22:47 +0000)]
[ASTMatchers] Introduce a blockDecl matcher for matching block declarations

Blocks can be matched just as well as functions or Objective-C methods.

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

llvm-svn: 332545

6 years ago[analyzer] Change the warning message for GCD antipattern checker
George Karpenkov [Wed, 16 May 2018 22:46:47 +0000 (22:46 +0000)]
[analyzer] Change the warning message for GCD antipattern checker

llvm-svn: 332544

6 years agoCondition usage of locale stdlib functions on Android API version
Peter Collingbourne [Wed, 16 May 2018 22:40:12 +0000 (22:40 +0000)]
Condition usage of locale stdlib functions on Android API version

Some *_l functions were not available in some versions of Bionic. This CL
checks that the NDK version supports the functions, and if not, falls back
on the corresponding functions that don't take a locale.

Patch by Tom Anderson!

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

llvm-svn: 332543

6 years ago[NFC] WebAssembly build break #2
JF Bastien [Wed, 16 May 2018 22:31:42 +0000 (22:31 +0000)]
[NFC] WebAssembly build break #2

Summary:
Same as r332530, move WasmSymbol::dump to an implementation file to avoid linker
issues when the dump function is seen in the header, doesn't get eliminated, and
then linking fails because of the missing dependency.

<rdar://problem/40258137>

Reviewers: sbc100, ncw, paquette, vsk, dschuff

Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 332542

6 years ago[ORC] Rewrite the VSO symbol table yet again. Update related utilities.
Lang Hames [Wed, 16 May 2018 22:24:30 +0000 (22:24 +0000)]
[ORC] Rewrite the VSO symbol table yet again. Update related utilities.

VSOs now track dependencies for materializing symbols. Each symbol must have its
dependencies registered with the VSO prior to finalization. Usually this will
involve registering the dependencies returned in
AsynchronousSymbolQuery::ResolutionResults for queries made while linking the
symbols being materialized.

Queries against symbols are notified that a symbol is ready once it and all of
its transitive dependencies are finalized, allowing compilation work to be
broken up and moved between threads without queries returning until their
symbols fully safe to access / execute.

Related utilities (VSO, MaterializationUnit, MaterializationResponsibility) are
updated to support dependence tracking and more explicitly track responsibility
for symbols from the point of definition until they are finalized.

llvm-svn: 332541

6 years ago[X86] Update SNB/generic scheduler tests missed from rL332536
Simon Pilgrim [Wed, 16 May 2018 22:24:22 +0000 (22:24 +0000)]
[X86] Update SNB/generic scheduler tests missed from rL332536

llvm-svn: 332540

6 years ago[ARM] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:20:33 +0000 (22:20 +0000)]
[ARM] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332539

6 years ago[ARM] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:20:26 +0000 (22:20 +0000)]
[ARM] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332538

6 years ago[ARM] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 22:20:11 +0000 (22:20 +0000)]
[ARM] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332537

6 years ago[X86][SNB] Remove unnecessary CVT InstRW overrides
Simon Pilgrim [Wed, 16 May 2018 22:14:29 +0000 (22:14 +0000)]
[X86][SNB] Remove unnecessary CVT InstRW overrides

llvm-svn: 332536

6 years ago[WebAssembly] Remove unused headers in MCWasmObjectWriter
Sam Clegg [Wed, 16 May 2018 22:13:18 +0000 (22:13 +0000)]
[WebAssembly] Remove unused headers in MCWasmObjectWriter

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

llvm-svn: 332535

6 years ago[AArch64] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 21:57:57 +0000 (21:57 +0000)]
[AArch64] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332534

6 years ago[ARM] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 21:57:19 +0000 (21:57 +0000)]
[ARM] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332533

6 years ago[ARM] preserve test intent by removing undef
Sanjay Patel [Wed, 16 May 2018 21:57:00 +0000 (21:57 +0000)]
[ARM] preserve test intent by removing undef

We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.

llvm-svn: 332532

6 years ago[InstCombine] Fix the signature of fgets_unlocked.
Benjamin Kramer [Wed, 16 May 2018 21:45:39 +0000 (21:45 +0000)]
[InstCombine] Fix the signature of fgets_unlocked.

It returns a pointer, not an int. This miscompiles all code that uses
the return value of fgets.

llvm-svn: 332531

6 years ago[NFC] WebAssembly build fix
JF Bastien [Wed, 16 May 2018 21:24:03 +0000 (21:24 +0000)]
[NFC] WebAssembly build fix

Summary:
r332305 added a use of llvm::wasm::toString in llvm::object::WasmSymbol::print,
which is in a header file. It also moves toString to BinaryFormat. This has the
unintended side-effect that any inclusion of Object/Wasm.h now relies on
toString, and needs to required_libraries = BinaryFormat. Thankfully most builds
don't fail with this because print just isn't used and gets eliminated, dropping
the required dependency in the process. Not all builds are so lucky.

Fix this issue by moving print to the corresponding .cpp file.

<rdar://problem/40258137>

Reviewers: sbc100, ncw, paquette

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 332530

6 years ago[MachineOutliner] Don't outline instructions that modify SP.
Eli Friedman [Wed, 16 May 2018 21:20:16 +0000 (21:20 +0000)]
[MachineOutliner] Don't outline instructions that modify SP.

This breaks the code which saves and restores LR, so we can't outline
without doing something more complicated for stack adjustment.

Found by inspection; we get lucky in most cases because getMemOpInfo
only handles STRWpost, not any other pre/post-increment forms. But it
hits a couple of artificial testcases in the tree.

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

llvm-svn: 332529

6 years ago_WIN32 straggler I missed in r331127; no-op in practice
Nico Weber [Wed, 16 May 2018 21:13:56 +0000 (21:13 +0000)]
_WIN32 straggler I missed in r331127; no-op in practice

llvm-svn: 332528

6 years agoAdd support for ThinLTO plugin option thinlto-object-suffix-replace
Rumeet Dhindsa [Wed, 16 May 2018 21:04:08 +0000 (21:04 +0000)]
Add support for ThinLTO plugin option thinlto-object-suffix-replace

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

llvm-svn: 332527

6 years ago[Hexagon] Fix the order of operands when selecting QCAT
Krzysztof Parzyszek [Wed, 16 May 2018 21:02:43 +0000 (21:02 +0000)]
[Hexagon] Fix the order of operands when selecting QCAT

llvm-svn: 332526

6 years ago[Hexagon] Mark HVX vector predicate bitwise ops as legal, add patterns
Krzysztof Parzyszek [Wed, 16 May 2018 21:00:24 +0000 (21:00 +0000)]
[Hexagon] Mark HVX vector predicate bitwise ops as legal, add patterns

llvm-svn: 332525