platform/upstream/llvm.git
6 years agoFix layering between llvm-c and Support by factoring out some typedefs into Support
David Blaikie [Tue, 20 Mar 2018 02:14:50 +0000 (02:14 +0000)]
Fix layering between llvm-c and Support by factoring out some typedefs into Support

llvm-c depends on Support, but Support (TargetRegistry) uses some of
llvm-c's typedefs. Move those into a Support header to be used from both
llvm-c and Support.

llvm-svn: 327940

6 years ago[CodeGen] Ignore OpaqueValueExprs that are unique references to their
Akira Hatanaka [Tue, 20 Mar 2018 01:47:58 +0000 (01:47 +0000)]
[CodeGen] Ignore OpaqueValueExprs that are unique references to their
source expressions when iterating over a PseudoObjectExpr's semantic
subexpression list.

Previously the loop in emitPseudoObjectExpr would emit the IR for each
OpaqueValueExpr that was in a PseudoObjectExpr's semantic-form
expression list and use the result when the OpaqueValueExpr later
appeared in other expressions. This caused an assertion failure when
AggExprEmitter tried to copy the result of an OpaqueValueExpr and the
copied type didn't have trivial copy/move constructors or assignment
operators.

This patch adds flag IsUnique to OpaqueValueExpr which indicates it is a
unique reference to its source expression (it is not used in multiple
places). The loop in emitPseudoObjectExpr ignores OpaqueValueExprs that
are unique and CodeGen visitors simply traverse the source expressions
of such OpaqueValueExprs.

rdar://problem/34363596

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

llvm-svn: 327939

6 years ago[RISCV] Preserve stack space for outgoing arguments when the function contain variabl...
Shiva Chen [Tue, 20 Mar 2018 01:39:17 +0000 (01:39 +0000)]
[RISCV] Preserve stack space for outgoing arguments when the function contain variable size objects

E.g.

bar (int x)
{
  char p[x];

  push outgoing variables for foo.
  call foo
}

We need to generate stack adjustment instructions for outgoing arguments by
eliminateCallFramePseudoInstr when the function contains variable size
objects to avoid outgoing variables corrupt the variable size object.

Default hasReservedCallFrame will return !hasFP().
We don't want to generate extra sp adjustment instructions when hasFP()
return true, So We override hasReservedCallFrame as !hasVarSizedObjects().

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

llvm-svn: 327938

6 years ago[X86] Fix the SNB scheduler for BLENDVB.
Craig Topper [Tue, 20 Mar 2018 01:30:21 +0000 (01:30 +0000)]
[X86] Fix the SNB scheduler for BLENDVB.

PBLENDVBrr0 was with the memory version of VBLENDVB and PBLENDVBrm0 was missing.

llvm-svn: 327937

6 years agoRevert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"
Mandeep Singh Grang [Tue, 20 Mar 2018 01:17:18 +0000 (01:17 +0000)]
Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"

This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e.

llvm-svn: 327936

6 years ago[analyzer] Improve performance of NoStoreFuncVisitor
George Karpenkov [Tue, 20 Mar 2018 01:16:46 +0000 (01:16 +0000)]
[analyzer] Improve performance of NoStoreFuncVisitor

Compute modifying frames lazily on demand.

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

llvm-svn: 327935

6 years agoRun dos2unix on a test. NFC.
Rafael Espindola [Tue, 20 Mar 2018 01:06:29 +0000 (01:06 +0000)]
Run dos2unix on a test. NFC.

llvm-svn: 327934

6 years ago[DebugInfoPDB] Add backward support flags to PDB_NameSearchFlags
Aaron Smith [Tue, 20 Mar 2018 01:04:21 +0000 (01:04 +0000)]
[DebugInfoPDB] Add backward support flags to PDB_NameSearchFlags

For NS_CaseInFileNameExt support.

llvm-svn: 327933

6 years agoAllow builtins for Cross-DSO CFI on Android
Petr Hosek [Tue, 20 Mar 2018 00:56:08 +0000 (00:56 +0000)]
Allow builtins for Cross-DSO CFI on Android

This is needed to avoid the test failure in case when compiler-rt
is set as the default runtime library for Clang.

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

llvm-svn: 327932

6 years ago[ELF] Make SectionHeaderOffset less sensitive.
Fangrui Song [Tue, 20 Mar 2018 00:55:39 +0000 (00:55 +0000)]
[ELF] Make SectionHeaderOffset less sensitive.

llvm-svn: 327931

6 years agoObject: Fix handling of @@@ in .symver directive
Vitaly Buka [Tue, 20 Mar 2018 00:45:03 +0000 (00:45 +0000)]
Object: Fix handling of @@@ in .symver directive

Summary:
name@@@nodename is going to be replaced with name@@nodename if symbols is
defined in the assembled file, or name@nodename if undefined.
https://sourceware.org/binutils/docs/as/Symver.html

Fixes PR36623

Reviewers: pcc, espindola

Subscribers: mehdi_amini, hiraditya

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

llvm-svn: 327930

6 years ago[compiler-rt] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Tue, 20 Mar 2018 00:44:59 +0000 (00:44 +0000)]
[compiler-rt] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Reviewers: kcc, rsmith, RKSimon, eugenis

Reviewed By: RKSimon

Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits

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

llvm-svn: 327929

6 years agoObject: Move attribute calculation into RecordStreamer. NFC
Vitaly Buka [Tue, 20 Mar 2018 00:38:33 +0000 (00:38 +0000)]
Object: Move attribute calculation into RecordStreamer. NFC

Summary: Preparation for D44274

Reviewers: pcc, espindola

Subscribers: hiraditya

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

llvm-svn: 327928

6 years ago[SymbolFilePDB] Simplify code with newer methods
Aaron Smith [Tue, 20 Mar 2018 00:34:18 +0000 (00:34 +0000)]
[SymbolFilePDB] Simplify code with newer methods

llvm-svn: 327927

6 years ago[analyzer] Fix the assertion failure when static globals are used in lambda by reference
George Karpenkov [Tue, 20 Mar 2018 00:20:58 +0000 (00:20 +0000)]
[analyzer] Fix the assertion failure when static globals are used in lambda by reference

Also use the opportunity to clean up the code and remove unnecessary duplication.

rdar://37625895

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

llvm-svn: 327926

6 years ago[SymbolFilePDB] Simplify getting the source file path
Aaron Smith [Tue, 20 Mar 2018 00:18:22 +0000 (00:18 +0000)]
[SymbolFilePDB] Simplify getting the source file path

Summary: Replace SymbolFilePDB::GetSourceFileNameForPDBCompiland() with PDBSymbolCompiland::getSourceFileFullPath().

Reviewers: zturner, rnk, lldb-commits

Subscribers: llvm-commits

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

llvm-svn: 327925

6 years agoModernize a test.
Jim Ingham [Mon, 19 Mar 2018 23:15:06 +0000 (23:15 +0000)]
Modernize a test.

llvm-svn: 327924

6 years agoOpenBSD UBsan support missing bits
Vitaly Buka [Mon, 19 Mar 2018 23:12:14 +0000 (23:12 +0000)]
OpenBSD UBsan support missing bits

Summary:
Lost bits since the WIP ticket

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers

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

llvm-svn: 327923

6 years agoRename remotectl_com.apple.internal.xpc.remote.debugserver.plist
Jason Molenda [Mon, 19 Mar 2018 23:07:31 +0000 (23:07 +0000)]
Rename remotectl_com.apple.internal.xpc.remote.debugserver.plist
to com.apple.internal.xpc.remote.debugserver.plist, not sure where
that remotectl_ prefix came from.

<rdar://problem/36751222>

llvm-svn: 327922

6 years agoRemove GnuHashTableSection::getShift2().
Rui Ueyama [Mon, 19 Mar 2018 23:04:13 +0000 (23:04 +0000)]
Remove GnuHashTableSection::getShift2().

Choosing a Shift2 value based on wordsize is cargo-culted from gold.
Assuming that djb hash is a good hash function, choosing bits [4,9]
shouldn't be any worse or better than choosing bits [5,10]. We shouldn't
have copied that behavior that we can't justify in the first place.

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

llvm-svn: 327921

6 years agoallow-multiple-definitions should completely suppress errors instead of making them...
Rui Ueyama [Mon, 19 Mar 2018 23:04:04 +0000 (23:04 +0000)]
allow-multiple-definitions should completely suppress errors instead of making them warnings.

We found that when you pass --allow-multiple-definitions or `-z muldefs`
to GNU linkers, they don't complain about duplicate symbols at all. They
don't even print out warnings on it. We emit warnings in that case.
If you pass --fatal-warnings, that difference results in a link failure.

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

llvm-svn: 327920

6 years ago[SelectionDAG] Transfer DbgValues when integer operations are promoted
Aaron Smith [Mon, 19 Mar 2018 22:58:50 +0000 (22:58 +0000)]
[SelectionDAG] Transfer DbgValues when integer operations are promoted

Summary:
DbgValue nodes were not transferred when integer DAG nodes were promoted. For example, if an i32 add node was promoted to an i64 add node by DAGTypeLegalizer::PromoteIntegerResult(), its DbgValue node was not transferred to the new node. The simple fix is to update SetPromotedInteger() to transfer DbgValues.

Add AArch64/dbg-value-i8.ll to test this change and fix ARM/debug-info-d16-reg.ll which had the wrong DILocalVariable nodes with arg numbers even though they are not for function parameters.

Patch by Se Jong Oh!

Reviewers: vsk, JDevlieghere, aprantl

Reviewed By: JDevlieghere

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

Tags: #debug-info

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

llvm-svn: 327919

6 years agoI didn't see that SocketAddress.cpp was already being pulled
Jason Molenda [Mon, 19 Mar 2018 22:55:19 +0000 (22:55 +0000)]
I didn't see that SocketAddress.cpp was already being pulled
in to debugserver; my re-addition resulted in duplicated
symbols.  Remove my added SocketAddress.cpp, and change the
original one to also be included for the debugserver-mini target.

llvm-svn: 327918

6 years ago[MachineOutliner] AArch64: Emit CFI instructions when outlining calls
Jessica Paquette [Mon, 19 Mar 2018 22:48:40 +0000 (22:48 +0000)]
[MachineOutliner] AArch64: Emit CFI instructions when outlining calls

When outlining calls, the outliner needs to update CFI to ensure that, say,
exception handling works. This commit adds that functionality and adds a test
just for call outlining.

Call outlining stuff in machine-outliner.mir should be moved into
machine-outliner-calls.mir in a later commit.

llvm-svn: 327917

6 years ago[DAGCombiner] Fix type in comment. NFC
Craig Topper [Mon, 19 Mar 2018 22:25:26 +0000 (22:25 +0000)]
[DAGCombiner] Fix type in comment. NFC

llvm-svn: 327916

6 years agoAdd the ios-mini target to the top-level xcodeproj, which builds
Jason Molenda [Mon, 19 Mar 2018 22:04:45 +0000 (22:04 +0000)]
Add the ios-mini target to the top-level xcodeproj, which builds
the debugserver-mini target in debugserver.  Add a new plist
which needs to be installed for debugserver-mini.
<rdar://problem/36751222>

llvm-svn: 327915

6 years ago[X86] Simplify the AVX512 code in LowerTruncate a little.
Craig Topper [Mon, 19 Mar 2018 21:58:02 +0000 (21:58 +0000)]
[X86] Simplify the AVX512 code in LowerTruncate a little.

We don't need to create an ISD::TRUNCATE node to return, we started with one and can return it. Also remove the call to getExtendInVec, the result is just going to be a getNode of that value passed in.

llvm-svn: 327914

6 years agoAdd DWARFUnit.cpp to the correct target.
Jason Molenda [Mon, 19 Mar 2018 21:55:48 +0000 (21:55 +0000)]
Add DWARFUnit.cpp to the correct target.

llvm-svn: 327913

6 years agoAccept any filepath in llvm_check_source_file_list
Serge Guelton [Mon, 19 Mar 2018 21:35:30 +0000 (21:35 +0000)]
Accept any filepath in llvm_check_source_file_list

Cmake function llvm_check_source_file_list currently only accepts paths
relative to current CMAKE_SOURCE_DIR or relative to argument SOURCE_DIR.

Extend it to accept any path, including absolute ones.

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

llvm-svn: 327912

6 years agoFixup test to explicitly use -fexceptions since exceptions are disabled by default...
Douglas Yung [Mon, 19 Mar 2018 21:22:58 +0000 (21:22 +0000)]
Fixup test to explicitly use -fexceptions since exceptions are disabled by default on the PS4 target.

llvm-svn: 327911

6 years ago[PDB] Add a method to get the full path of the source file for PDBSymbolCompiland
Aaron Smith [Mon, 19 Mar 2018 21:20:04 +0000 (21:20 +0000)]
[PDB] Add a method to get the full path of the source file for PDBSymbolCompiland

Summary:
Redefine PDBSymbolCompiland::getSourceFileName() to return the filename (w/o directory) of the source file that is used to compile the compiland. This is because the result returned previously is ambiguous. It could be the filename, relative path or full path of the source file.

Move the implementation of SymbolFilePDB::GetSourceFileNameForPDBCompiland() into a new method PDBSymbolCompiland::getSourceFileFullPath().

Reviewers: zturner, rnk, llvm-commits

Reviewed By: zturner

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

llvm-svn: 327910

6 years ago[PDB] Add exclusive methods to derived symbol class
Aaron Smith [Mon, 19 Mar 2018 21:18:39 +0000 (21:18 +0000)]
[PDB] Add exclusive methods to derived symbol class

Summary: This commit adds two methods to the PDBSymboFunc class used in parsing symbols. getLineNumbers() is used to determine a Function symbol's declaration and getCompilandId() is used to initialize the SymbolContext field sc.comp_unit.

Reviewers: zturner, rnk, llvm-commits

Reviewed By: zturner

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

llvm-svn: 327909

6 years ago[SymbolFilePDB] Remove a few null pointer checks by passing ref
Aaron Smith [Mon, 19 Mar 2018 21:14:19 +0000 (21:14 +0000)]
[SymbolFilePDB] Remove a few null pointer checks by passing ref

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327908

6 years ago[Hexagon] Add REQUIRES: asserts to test/CodeGen/Hexagon/v6vec_inc1.ll
Krzysztof Parzyszek [Mon, 19 Mar 2018 21:05:21 +0000 (21:05 +0000)]
[Hexagon] Add REQUIRES: asserts to test/CodeGen/Hexagon/v6vec_inc1.ll

llvm-svn: 327907

6 years ago[test] Skip flaky tests in TestMiSyntax on Darwin
Vedant Kumar [Mon, 19 Mar 2018 20:50:50 +0000 (20:50 +0000)]
[test] Skip flaky tests in TestMiSyntax on Darwin

These tests tend to time out locally and on our bots.

llvm-svn: 327906

6 years ago[test] Skip flaky TestThreadStates tests on Darwin
Vedant Kumar [Mon, 19 Mar 2018 20:50:49 +0000 (20:50 +0000)]
[test] Skip flaky TestThreadStates tests on Darwin

These tests do not pass/fail consistently, so just skip them.

This is llvm.org/pr15824 & rdar://problem/28557237.

llvm-svn: 327905

6 years agoCleanup of "extern char **environ" declaration
Vitaly Buka [Mon, 19 Mar 2018 20:44:06 +0000 (20:44 +0000)]
Cleanup of "extern char **environ" declaration

llvm-svn: 327904

6 years agoRevert "Support embedding natvis files in PDBs."
Zachary Turner [Mon, 19 Mar 2018 20:41:59 +0000 (20:41 +0000)]
Revert "Support embedding natvis files in PDBs."

This is causing a test failure on a certain bot, so I'm removing
this temporarily until we can figure out the source of the error.

llvm-svn: 327903

6 years ago[clangd] Fix undefined behavior due to misaligned type cast
Jan Korous [Mon, 19 Mar 2018 20:26:18 +0000 (20:26 +0000)]
[clangd] Fix undefined behavior due to misaligned type cast

The current code was casting pointer to a misaligned type which is undefined behavior.
Found by compiling with Undefined Behavior Sanitizer and running tests (check-clang-tools).

llvm-svn: 327902

6 years ago[clangd][nfc] Give name to a magic constant
Jan Korous [Mon, 19 Mar 2018 20:26:15 +0000 (20:26 +0000)]
[clangd][nfc] Give name to a magic constant

llvm-svn: 327901

6 years agoRemove an unused private variable.
Zachary Turner [Mon, 19 Mar 2018 20:22:48 +0000 (20:22 +0000)]
Remove an unused private variable.

llvm-svn: 327900

6 years ago[X86] Replace a couple calls to getExtendInVec with getNode and the appropriate targe...
Craig Topper [Mon, 19 Mar 2018 20:20:22 +0000 (20:20 +0000)]
[X86] Replace a couple calls to getExtendInVec with getNode and the appropriate target independent EXTEND_VECTOR_INREG opcode.

llvm-svn: 327899

6 years ago[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172"
Nirav Dave [Mon, 19 Mar 2018 20:19:46 +0000 (20:19 +0000)]
[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172"

Reland ISel cycle checking improvements after simplifying node id
invariant traversal and correcting typo.

llvm-svn: 327898

6 years ago[ARM, AArch64] Check the no-stack-arg-probe attribute for dynamic stack probes
Martin Storsjo [Mon, 19 Mar 2018 20:06:50 +0000 (20:06 +0000)]
[ARM, AArch64] Check the no-stack-arg-probe attribute for dynamic stack probes

This extends the use of this attribute on ARM and AArch64 from
SVN r325900 (where it was only checked for fixed stack
allocations on ARM/AArch64, but for all stack allocations on X86).

This also adds a testcase for the existing use of disabling the
fixed stack probe with the attribute on ARM and AArch64.

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

llvm-svn: 327897

6 years agoAdd cast to Type*, fix failure from r327894.
Alina Sbirlea [Mon, 19 Mar 2018 20:05:01 +0000 (20:05 +0000)]
Add cast to Type*, fix failure from r327894.

llvm-svn: 327896

6 years agoSupport embedding natvis files in PDBs.
Zachary Turner [Mon, 19 Mar 2018 19:53:51 +0000 (19:53 +0000)]
Support embedding natvis files in PDBs.

Natvis is a debug language supported by Visual Studio for
specifying custom visualizers.  The /NATVIS option is an
undocumented link.exe flag which will take a .natvis file
and "inject" it into the PDB.  This way, you can ship the
debug visualizers for a program along with the PDB, which
is very useful for postmortem debugging.

This is implemented by adding a new "named stream" to the
PDB with a special name of /src/files/<natvis file name>
and simply copying the contents of the xml into this file.

Additionally, we need to emit a single stream named
/src/headerblock which contains a hash table of embedded
files to records describing them.

This patch adds this functionality, including the /NATVIS
option to lld-link.

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

llvm-svn: 327895

6 years agoMake ConstantDataArray::get constructor templated. Will support signed integers.
Alina Sbirlea [Mon, 19 Mar 2018 19:49:28 +0000 (19:49 +0000)]
Make ConstantDataArray::get constructor templated. Will support signed integers.

Summary: Make ConstantDataArray::get() constructors a single templated one.

Reviewers: timshen, rsmith

Subscribers: sanjoy, llvm-commits, jlebar

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

llvm-svn: 327894

6 years ago[ClangASTContext] Remove dead code. NFCI.
Davide Italiano [Mon, 19 Mar 2018 19:35:20 +0000 (19:35 +0000)]
[ClangASTContext] Remove dead code. NFCI.

llvm-svn: 327893

6 years ago[CodeGen] Add funclet token to ARC marker
Shoaib Meenai [Mon, 19 Mar 2018 19:34:39 +0000 (19:34 +0000)]
[CodeGen] Add funclet token to ARC marker

The inline assembly generated for the ARC autorelease elision marker
must have a funclet token if it's emitted inside a funclet, otherwise
the inline assembly (and all subsequent code in the funclet) will be
marked unreachable. r324689 fixed this issue for regular inline assembly
blocks.

Note that clang only emits the marker at -O0, so this only fixes that
case. The optimizations case (where the marker is emitted by the
backend) will be fixed in a separate change.

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

llvm-svn: 327892

6 years ago[AMDGPU] change test to avoid NaN math
Sanjay Patel [Mon, 19 Mar 2018 19:26:22 +0000 (19:26 +0000)]
[AMDGPU] change test to avoid NaN math

llvm-svn: 327891

6 years ago[AMDGPU] adjust tests to be nan-free
Sanjay Patel [Mon, 19 Mar 2018 19:23:53 +0000 (19:23 +0000)]
[AMDGPU] adjust tests to be nan-free

As suggested in D44521 - bitcast to integer for the math,
so we preserve the intent of these tests when NaN math
gets folded away.

llvm-svn: 327890

6 years ago[Power9]Legalize and emit code for quad-precision copySign/abs/nabs/neg/sqrt
Lei Huang [Mon, 19 Mar 2018 19:22:52 +0000 (19:22 +0000)]
[Power9]Legalize and emit code for quad-precision copySign/abs/nabs/neg/sqrt

Legalize and emit code for quad-precision floating point operations:

  * xscpsgnqp
  * xsabsqp
  * xsnabsqp
  * xsnegqp
  * xssqrtqp

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

llvm-svn: 327889

6 years ago[llvm-mca] Remove unused method from ResourceManager. NFC
Andrea Di Biagio [Mon, 19 Mar 2018 19:14:06 +0000 (19:14 +0000)]
[llvm-mca] Remove unused method from ResourceManager. NFC

llvm-svn: 327888

6 years ago[clang-move] Fix the failing test caused by changes in clang-format.
Haojian Wu [Mon, 19 Mar 2018 19:13:03 +0000 (19:13 +0000)]
[clang-move] Fix the failing test caused by changes in clang-format.

llvm-svn: 327887

6 years ago[llvm-mca] Simplify code. NFC
Andrea Di Biagio [Mon, 19 Mar 2018 19:09:38 +0000 (19:09 +0000)]
[llvm-mca] Simplify code. NFC

llvm-svn: 327886

6 years ago[clang-move] Fix move-used-helper-decls.cpp test.
Fangrui Song [Mon, 19 Mar 2018 19:05:53 +0000 (19:05 +0000)]
[clang-move] Fix move-used-helper-decls.cpp test.

llvm-svn: 327885

6 years ago[Hexagon] Add a few more lit tests
Krzysztof Parzyszek [Mon, 19 Mar 2018 19:03:18 +0000 (19:03 +0000)]
[Hexagon] Add a few more lit tests

llvm-svn: 327884

6 years ago[X86] Add JMP16r and JMP32r to Sandybridge scheduler model.
Craig Topper [Mon, 19 Mar 2018 19:00:37 +0000 (19:00 +0000)]
[X86] Add JMP16r and JMP32r to Sandybridge scheduler model.

Fixes PR36010

llvm-svn: 327883

6 years ago[X86] Remove OUT32rr/OUT8rr/OUT32ri/OUT8ri from Sandybridge scheduler model.
Craig Topper [Mon, 19 Mar 2018 19:00:35 +0000 (19:00 +0000)]
[X86] Remove OUT32rr/OUT8rr/OUT32ri/OUT8ri from Sandybridge scheduler model.

PR35590 was already filed for this information being wrong. It's probably better to default to WriteSystem behavior instead of using something completely wrong.

llvm-svn: 327882

6 years ago[X86] Add JCXZ/JECXZ to Sandybridge/Haswell/Broadwell/Skylake scheduler models.
Craig Topper [Mon, 19 Mar 2018 19:00:32 +0000 (19:00 +0000)]
[X86] Add JCXZ/JECXZ to Sandybridge/Haswell/Broadwell/Skylake scheduler models.

JRCXZ was already present, but not the others.

We never codegen this instruction so this doesn't affect much just trying to get them all into a single generated scheduler class in the output.

llvm-svn: 327881

6 years ago[X86] Correct regular expression in Zen scheduler model that was excluding JECXZ...
Craig Topper [Mon, 19 Mar 2018 19:00:29 +0000 (19:00 +0000)]
[X86] Correct regular expression in Zen scheduler model that was excluding JECXZ instruction.

The regex was looking for JECXZ_32 or JECXZ_64, but their is just one instruction called JECXZ. They used to exist as separate instructions, but were merged over 3 years ago.

llvm-svn: 327880

6 years ago[X86] Correct the SchedRW on (V)MOVAPSrr_REV and similar to match their non _REV...
Craig Topper [Mon, 19 Mar 2018 19:00:26 +0000 (19:00 +0000)]
[X86] Correct the SchedRW on (V)MOVAPSrr_REV and similar to match their non _REV counterparts.

llvm-svn: 327879

6 years ago[PowerPC][Power9]Legalize and emit code for quad-precision add/div/mul/sub
Lei Huang [Mon, 19 Mar 2018 18:52:20 +0000 (18:52 +0000)]
[PowerPC][Power9]Legalize and emit code for quad-precision add/div/mul/sub

Legalize and emit code for quad-precision floating point operations:

  * xsaddqp
  * xssubqp
  * xsdivqp
  * xsmulqp

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

llvm-svn: 327878

6 years ago[PowerPC] Make AddrSpaceCast noop
Nemanja Ivanovic [Mon, 19 Mar 2018 18:50:02 +0000 (18:50 +0000)]
[PowerPC] Make AddrSpaceCast noop

PowerPC targets do not use address spaces. As a result, we can get selection
failures with address space casts. This patch makes those casts noops.

Patch by Valentin Churavy.

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

llvm-svn: 327877

6 years agoFix CMake/MSVC when compiler-rt and llvm are built separately
Vitaly Buka [Mon, 19 Mar 2018 18:22:35 +0000 (18:22 +0000)]
Fix CMake/MSVC when compiler-rt and llvm are built separately

Summary:
For some reason CMake can't find the `append` macro if LLVM is built separately and imported via `LLVM_CONFIG_PATH`.

Patch by Loo Rong Jie

Reviewers: rnk, vitalybuka

Reviewed By: rnk, vitalybuka

Subscribers: dberris, mgorny, llvm-commits, #sanitizers

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

llvm-svn: 327876

6 years agoFix for Fix for https://bugs.llvm.org/show_bug.cgi?id=36705.
Andrey Churbanov [Mon, 19 Mar 2018 18:05:15 +0000 (18:05 +0000)]
Fix for Fix for https://bugs.llvm.org/show_bug.cgi?id=36705.

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

llvm-svn: 327875

6 years ago[X86] Add the rest of the TEST with immediate instructions to the scheduler models...
Craig Topper [Mon, 19 Mar 2018 17:58:41 +0000 (17:58 +0000)]
[X86] Add the rest of the TEST with immediate instructions to the scheduler models to match their 8-bit counterpart.

llvm-svn: 327874

6 years ago[OPENMP, NVPTX] Reworked castToType() function, NFC.
Alexey Bataev [Mon, 19 Mar 2018 17:53:56 +0000 (17:53 +0000)]
[OPENMP, NVPTX] Reworked castToType() function, NFC.

Reworked function castToType to use more frontend functionality rather
than the backend.

llvm-svn: 327873

6 years ago[X86] Add MOV16ri*/MOV32ri*/MOV64ri* to scheduler models to match MOV8ri. Correct...
Craig Topper [Mon, 19 Mar 2018 17:46:59 +0000 (17:46 +0000)]
[X86] Add MOV16ri*/MOV32ri*/MOV64ri* to scheduler models to match MOV8ri. Correct SchedRW and itinerary for MOV32ri64.

llvm-svn: 327872

6 years ago[ELF] Add basic support for PPC LE
Zaara Syeda [Mon, 19 Mar 2018 17:40:14 +0000 (17:40 +0000)]
[ELF] Add basic support for PPC LE

This patch adds changes to start supporting the Power 64-Bit ELF V2 ABI.
This includes:
- Changing the ElfSym::GlobalOffsetTable to be named .TOC.
- Creating a GotHeader so the first entry in the .got is .TOC.
- Setting the e_flags to be 1 for ELF V1 and 2 for ELF V2

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

llvm-svn: 327871

6 years ago[ObjC] Allow declaring __weak pointer fields in C structs in ARC.
Akira Hatanaka [Mon, 19 Mar 2018 17:38:40 +0000 (17:38 +0000)]
[ObjC] Allow declaring __weak pointer fields in C structs in ARC.

This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.

This recommits r327206, which was reverted because it caused
module-enabled builders to fail. I discovered that the
CXXRecordDecl::CanPassInRegisters flag wasn't being set correctly in
some cases after I moved it to RecordDecl.

Thanks to Eric Liu for helping me investigate the bug.

rdar://problem/33599681

https://reviews.llvm.org/D44095

llvm-svn: 327870

6 years ago[X86] Remove sse41 specific code from lowering v16i8 multiply
Craig Topper [Mon, 19 Mar 2018 17:31:41 +0000 (17:31 +0000)]
[X86] Remove sse41 specific code from lowering v16i8 multiply

With the SRAs removed from the SSE2 code in D44267, then there doesn't appear to be any advantage to the sse41 code. The punpcklbw instruction and pmovsx seem to have the same latency and throughput on most CPUs. And the SSE41 code requires moving the upper 64-bits into the lower 64-bit before the sign extend can be done. The unpckhbw in sse2 code can do better than that.

llvm-svn: 327869

6 years ago[OPENMP] Fix build with MSVC, NFC.
Alexey Bataev [Mon, 19 Mar 2018 17:18:13 +0000 (17:18 +0000)]
[OPENMP] Fix build with MSVC, NFC.

llvm-svn: 327868

6 years ago[OPENMP, NVPTX] Emit correct thread id.
Alexey Bataev [Mon, 19 Mar 2018 17:04:07 +0000 (17:04 +0000)]
[OPENMP, NVPTX] Emit correct thread id.

We emitted fake thread id for the outined function in NVPTX codegen.
Patch adds emission of the real thread id.

llvm-svn: 327867

6 years ago[X86] Make the multiply and divide itineraries more consistent.
Craig Topper [Mon, 19 Mar 2018 16:38:33 +0000 (16:38 +0000)]
[X86] Make the multiply and divide itineraries more consistent.

Sometimes we used the same itinerary for MEM and REG forms, but that seems inconsistent with our usual usage.

We also used the MUL8 itinerary for MULX32/64 which was also weird.

The test changes are because we were using IIC_IMUL32_RR and IIC_IMUL64_RR instead of IIC_IMUL32_REG/IIC_IMUL64_REG for the 32 and 64 bit multiplies that produce double width result.

llvm-svn: 327866

6 years agoXcode: Include DWARFUnit.{h,cpp} in the build
Vedant Kumar [Mon, 19 Mar 2018 16:24:58 +0000 (16:24 +0000)]
Xcode: Include DWARFUnit.{h,cpp} in the build

This should address a bot failure due to r327809.

llvm-svn: 327865

6 years agoRevert [MachineLICM] This reverts commit rL327856
Zaara Syeda [Mon, 19 Mar 2018 16:19:44 +0000 (16:19 +0000)]
Revert [MachineLICM] This reverts commit rL327856

Failing build bots. Revert the commit now.

llvm-svn: 327864

6 years ago[Driver] Avoid invalidated iterator in insertTargetAndModeArgs
Serge Pavlov [Mon, 19 Mar 2018 16:13:43 +0000 (16:13 +0000)]
[Driver] Avoid invalidated iterator in insertTargetAndModeArgs

Doing an .insert() can potentially invalidate iterators by reallocating the
vector's storage. When all the stars align just right, this causes segfaults
or glibc aborts.

Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082.

Patch by Hector Martin!

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

llvm-svn: 327863

6 years ago[CodeGen] Avoid handling DBG_VALUE in the LivePhysRegs (addUses,removeDefs,stepForward)
Matt Davis [Mon, 19 Mar 2018 16:06:40 +0000 (16:06 +0000)]
[CodeGen] Avoid handling DBG_VALUE in the LivePhysRegs (addUses,removeDefs,stepForward)

Summary:
This patch prevents DBG_VALUE instructions from influencing
LivePhysRegs::stepBackwards and stepForwards.  In at least one case,
specifically branch folding, the stepBackwards logic was having an
influence on code generation.  The result was that certain code
compiled with '-g -O2' would differ from that compiled with '-O2'
alone. It seems that the original logic, accounting for DBG_VALUE,
was influencing the placement of an IMPLICIT_DEF which had a later
impact on how blocks were processed in branch folding.

Reviewers: kparzysz, MatzeB

Reviewed By: kparzysz

Subscribers: bjope, llvm-commits

Tags: #debug-info

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

llvm-svn: 327862

6 years ago[clang-format] Remove empty lines before }[;] // comment
Krasimir Georgiev [Mon, 19 Mar 2018 15:33:40 +0000 (15:33 +0000)]
[clang-format] Remove empty lines before }[;] // comment

Summary:
This addresses bug 36766 and a FIXME in tests about empty lines before
`}[;] // comment` lines.

Subscribers: klimek, cfe-commits

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

llvm-svn: 327861

6 years ago[CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain
Petr Hosek [Mon, 19 Mar 2018 15:19:19 +0000 (15:19 +0000)]
[CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain

Fuchsia already defaults to libc++ and compiler-rt, but we want to use
these as default runtimes even on the host platform.

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

llvm-svn: 327860

6 years ago[demangler] Recopy the demangler from libcxxabi.
Erik Pilkington [Mon, 19 Mar 2018 15:18:23 +0000 (15:18 +0000)]
[demangler] Recopy the demangler from libcxxabi.

Some significant work has gone into libcxxabi's copy of this file:
  - Uses an AST to represent mangled names.
  - Support/bugfixes for many C++ features.
  - Uses LLVM coding style.

llvm-svn: 327859

6 years ago[InstCombine] canonicalize fcmp+select to fabs
Sanjay Patel [Mon, 19 Mar 2018 15:14:30 +0000 (15:14 +0000)]
[InstCombine] canonicalize fcmp+select to fabs

This is complicated by -0.0 and nan. This is based on the DAG patterns
as shown in D44091. I'm hoping that we can just remove those DAG folds
and always rely on IR canonicalization to handle the matching to fabs.

We would still need to delete the broken code from DAGCombiner to fix
PR36600:
https://bugs.llvm.org/show_bug.cgi?id=36600

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

llvm-svn: 327858

6 years agoMove code generation test case to test/CodeGen/
Tobias Grosser [Mon, 19 Mar 2018 15:05:30 +0000 (15:05 +0000)]
Move code generation test case to test/CodeGen/

llvm-svn: 327857

6 years ago[MachineLICM] Add functions to MachineLICM to hoist invariant stores
Zaara Syeda [Mon, 19 Mar 2018 14:52:25 +0000 (14:52 +0000)]
[MachineLICM] Add functions to MachineLICM to hoist invariant stores

This patch adds functions to allow MachineLICM to hoist invariant stores.
Currently, MachineLICM does not hoist any store instructions, however
when storing the same value to a constant spot on the stack, the store
instruction should be considered invariant and be hoisted. The function
isInvariantStore iterates each operand of the store instruction and checks
that each register operand satisfies isCallerPreservedPhysReg. The store
may be fed by a copy, which is hoisted by isCopyFeedingInvariantStore.
This patch also adds the PowerPC changes needed to consider the stack
register as caller preserved.

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

llvm-svn: 327856

6 years ago[X86] Generalize schedule classes to support multiple stages
Simon Pilgrim [Mon, 19 Mar 2018 14:46:07 +0000 (14:46 +0000)]
[X86] Generalize schedule classes to support multiple stages

Currently the WriteResPair style multi-classes take a single pipeline stage and latency, this patch generalizes this to make it easier to create complex schedules with ResourceCycles and NumMicroOps be overriden from their defaults.

This has already been done for the Jaguar scheduler to remove a number of custom schedule classes and adding it to the other x86 targets will make it much tidier as we add additional classes in the future to try and replace so many custom cases.

I've converted some instructions but a lot of the models need a bit of cleanup after the patch has been committed - memory latencies not being consistent, the class not actually being used when we could remove some/all customs, etc. I'd prefer to keep this as NFC as possible so later patches can be smaller and target specific.

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

llvm-svn: 327855

6 years agorun-clang-tidy: forward clang-tidy exit status
Miklos Vajna [Mon, 19 Mar 2018 14:43:59 +0000 (14:43 +0000)]
run-clang-tidy: forward clang-tidy exit status

Exit with a non-zero value in case any of the underlying clang-tidy
invocations exit with a non-zero value.

This is useful in case WarningsAsErrors is enabled for some of the
checks: if any of those checks find something, the exit status now
reflects that.

Also add the ability to use run-clang-tidy.py via lit, and assert that
the exit code is not 0 when modernize-use-auto is triggered
intentionally.

Reviewers: alexfh, aaron.ballman

Reviewed By: aaron.ballman

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

llvm-svn: 327854

6 years ago[x86] put nops into the WriteNop class and customize for Jaguar
Sanjay Patel [Mon, 19 Mar 2018 14:26:50 +0000 (14:26 +0000)]
[x86] put nops into the WriteNop class and customize for Jaguar

1. Given that we already have a classification bucket with 'nop' in the name,
   that's where 'nop' belongs. Right now, it's only used for prefix bytes and 'pause'.
2. Make the latency of this class '1' for Jaguar to tell the scheduler (and presumably
   llvm-mca) how to model the resource requirements better even though a nop has no
   dependencies.

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

llvm-svn: 327853

6 years agoUpdated a usage of createTemporaryFile that does not expect file to be created.
Ilya Biryukov [Mon, 19 Mar 2018 14:20:25 +0000 (14:20 +0000)]
Updated a usage of createTemporaryFile that does not expect file to be created.

Summary:
This fixes a usage of createTemporaryFile in clang repo after
a change in llvm repo.

Reviewers: klimek, bkramer, krasimir, espindola, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 327852

6 years agoChanged createTemporaryFile without FD to actually create a file.
Ilya Biryukov [Mon, 19 Mar 2018 14:19:58 +0000 (14:19 +0000)]
Changed createTemporaryFile without FD to actually create a file.

Summary:
This commit changes semantics of createUniqueFile and
createTemporaryFile variants that do not return file descriptors.
Previously they only checked if files exist, therefore being subject
to race conditions. Now they will create an empty file to avoid them.

Functions that do not create a file are now called
getPotentiallyUniqueTempFileName and getPotentiallyUniqueFileName.

Reviewers: klimek, bkramer, krasimir, JDevlieghere, espindola

Reviewed By: klimek

Subscribers: llvm-commits

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

llvm-svn: 327851

6 years agoTableGen: Explicitly forbid self-references to field members
Nicolai Haehnle [Mon, 19 Mar 2018 14:14:28 +0000 (14:14 +0000)]
TableGen: Explicitly forbid self-references to field members

Summary:
Otherwise, patterns like in the test case produce cryptic error
messages about fields being resolved incompletely.

Change-Id: I713c0191f00fe140ad698675803ab1f8823dc5bd

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 327850

6 years agoTableGen: Check the dynamic type of !cast<Rec>(string)
Nicolai Haehnle [Mon, 19 Mar 2018 14:14:20 +0000 (14:14 +0000)]
TableGen: Check the dynamic type of !cast<Rec>(string)

Summary:
The docs already claim that this happens, but so far it hasn't. As a
consequence, existing TableGen files get this wrong a lot, but luckily
the fixes are all reasonably straightforward.

To make this work with all the existing forms of self-references (since
the true type of a record is only built up over time), the lookup of
self-references in !cast is delayed until the final resolving step.

Change-Id: If5923a72a252ba2fbc81a889d59775df0ef31164

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, javed.absar, llvm-commits

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

llvm-svn: 327849

6 years agoTableGen: Explicitly test some cases of self-references and !cast errors
Nicolai Haehnle [Mon, 19 Mar 2018 14:14:10 +0000 (14:14 +0000)]
TableGen: Explicitly test some cases of self-references and !cast errors

Summary:
These are cases of self-references that exist today in practice. Let's
add tests for them to avoid regressions.

The self-references in PPCInstrInfo.td can be expressed in a simpler
way. Allowing this type of self-reference while at the same time
consistently doing late-resolve even for self-references is problematic
because there are references to fields that aren't in any class. Since
there's no need for this type of self-reference anyway, let's just
remove it.

Change-Id: I914e0b3e1ae7adae33855fac409b536879bc3f62

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: nemanjai, wdng, kbarton, llvm-commits

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

llvm-svn: 327848

6 years agoTableGen: Only fold when some operand made resolve progress
Nicolai Haehnle [Mon, 19 Mar 2018 14:14:04 +0000 (14:14 +0000)]
TableGen: Only fold when some operand made resolve progress

Summary:
Make sure that we always fold immediately, so there's no point in
attempting to re-fold when nothing changes.

Change-Id: I069e1989455b6f2ca8606152f6adc1a5e817f1c8

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 327847

6 years agoTableGen: Remove OpInit::Fold
Nicolai Haehnle [Mon, 19 Mar 2018 14:13:59 +0000 (14:13 +0000)]
TableGen: Remove OpInit::Fold

Summary:
Virtual dispatch is not actually used anywhere.

Change-Id: I9829c5c59920ea27fb9bc17f1442156a3bb09a65

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 327846

6 years agoTableGen: Move GenStrConcat to a helper function in BinOpInit
Nicolai Haehnle [Mon, 19 Mar 2018 14:13:54 +0000 (14:13 +0000)]
TableGen: Move GenStrConcat to a helper function in BinOpInit

Summary:
Make it accessible for more users.

Change-Id: Ib05f09ba14e7942ced5d2f24b205efa285e40cd5

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 327845

6 years agoTableGen: Remove the cast-from-string-to-variable-reference feature
Nicolai Haehnle [Mon, 19 Mar 2018 14:13:37 +0000 (14:13 +0000)]
TableGen: Remove the cast-from-string-to-variable-reference feature

Summary:
Cast-from-string for records isn't going away, but cast-from-string for
variables is a pretty dodgy feature to have, especially when referencing
template arguments. It's doubtful that this ever worked in a reliable
way, and nobody seems to be using it, so let's get rid of it and get
some related cleanups.

Change-Id: I395ac8a43fef4cf98e611f2f552300d21e99b66a

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 327844

6 years agoAMDGPU/GlobalISel: RegBankSelect for basic int ops
Matt Arsenault [Mon, 19 Mar 2018 14:07:23 +0000 (14:07 +0000)]
AMDGPU/GlobalISel: RegBankSelect for basic int ops

llvm-svn: 327843

6 years agoAMDGPU: Don't leave dead illegal VGPR->SGPR copies
Matt Arsenault [Mon, 19 Mar 2018 14:07:15 +0000 (14:07 +0000)]
AMDGPU: Don't leave dead illegal VGPR->SGPR copies

Normally DCE kills these, but at -O0 these get left behind
leaving suspicious looking illegal copies.

Replace with IMPLICIT_DEF to avoid iterator issues.

llvm-svn: 327842

6 years ago[NFC] Fix minor typos in comments
Karl-Johan Karlsson [Mon, 19 Mar 2018 13:48:40 +0000 (13:48 +0000)]
[NFC] Fix minor typos in comments

llvm-svn: 327841