platform/upstream/llvm.git
6 years agoMachineVerifier: Improve register operand checks
Matthias Braun [Tue, 28 Nov 2017 03:54:20 +0000 (03:54 +0000)]
MachineVerifier: Improve register operand checks

This fixes cases where we wouldn't perform various register operand
checks just because we didn't happen to have a definition in the
MCInstrDesc. This changes the code to only skip the tests that actually
depend on the MCInstrDesc definition.

This makes the machine verifier spot the problem from
https://llvm.org/PR33071 after the pass that actually caused it.

llvm-svn: 319141

6 years agoMachineVerifier: Improve PHI operand checking
Matthias Braun [Tue, 28 Nov 2017 03:54:19 +0000 (03:54 +0000)]
MachineVerifier: Improve PHI operand checking

Additional checks for phi operands:
- first operand should be a virtual register def. It should not be
  tied, implicit, internalread, earlyclobber or a read.
- The other operands should be register/mbb operands next to each other
- The register operands should not be implicit, internalread,
  earlyclobber, debug or tied.
- We can perform most of the PHI checks even for unreachable blocks.

llvm-svn: 319140

6 years agolit: Bring back -Dtool=xxx feature lost in r313928
Matthias Braun [Tue, 28 Nov 2017 03:23:07 +0000 (03:23 +0000)]
lit: Bring back -Dtool=xxx feature lost in r313928

llvm-svn: 319139

6 years agoFactor out common code to Common/Strings.cpp.
Rui Ueyama [Tue, 28 Nov 2017 02:15:26 +0000 (02:15 +0000)]
Factor out common code to Common/Strings.cpp.

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

llvm-svn: 319138

6 years agoUse FILE_FLAG_DELETE_ON_CLOSE for TempFile on windows.
Rafael Espindola [Tue, 28 Nov 2017 01:41:22 +0000 (01:41 +0000)]
Use FILE_FLAG_DELETE_ON_CLOSE for TempFile on windows.

We won't see the temp file no more.

llvm-svn: 319137

6 years ago[X86] Make zero extend from v16i1/v8i1 to v16i8/v8i16/v16i16 not scalarize under...
Craig Topper [Tue, 28 Nov 2017 01:36:33 +0000 (01:36 +0000)]
[X86] Make zero extend from v16i1/v8i1 to v16i8/v8i16/v16i16 not scalarize under AVX512.

llvm-svn: 319136

6 years ago[X86] Add command line without AVX512BW/AVX512VL to bitcast-int-to-vector-bool-zext.ll.
Craig Topper [Tue, 28 Nov 2017 01:36:31 +0000 (01:36 +0000)]
[X86] Add command line without AVX512BW/AVX512VL to bitcast-int-to-vector-bool-zext.ll.

llvm-svn: 319135

6 years agoMove code. NFC.
Rafael Espindola [Tue, 28 Nov 2017 01:34:20 +0000 (01:34 +0000)]
Move code. NFC.

This moves the TempFile implementation so that it can use system
specific code.

llvm-svn: 319134

6 years agoReland r319090, "COFF: Do not create SectionChunks for discarded comdat sections...
Peter Collingbourne [Tue, 28 Nov 2017 01:30:07 +0000 (01:30 +0000)]
Reland r319090, "COFF: Do not create SectionChunks for discarded comdat sections." with a fix for debug sections.

If /debug was not specified, readSection will return a null
pointer for debug sections. If the debug section is associative with
another section, we need to make sure that the section returned from
readSection is not a null pointer before adding it as an associative
section.

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

llvm-svn: 319133

6 years agoRemove some duplicated code in UUID.cpp
Stephane Sezer [Tue, 28 Nov 2017 01:26:07 +0000 (01:26 +0000)]
Remove some duplicated code in UUID.cpp

Summary: Formatting needs to be done only once. Ran check-lldb and nothing changes.

Reviewers: clayborg, davide

Reviewed By: clayborg, davide

Subscribers: zturner, davide, lldb-commits

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

llvm-svn: 319132

6 years agoThis reverts commit r319096 and r319097.
Rafael Espindola [Tue, 28 Nov 2017 01:25:38 +0000 (01:25 +0000)]
This reverts commit r319096 and r319097.

Revert "[SROA] Propagate !range metadata when moving loads."
Revert "[Mem2Reg] Clang-format unformatted parts of this file. NFCI."

Davide says they broke a bot.

llvm-svn: 319131

6 years agoARM: Fix PR32578
Matthias Braun [Tue, 28 Nov 2017 01:17:52 +0000 (01:17 +0000)]
ARM: Fix PR32578

https://llvm.org/PR32578

I simplified and converted the reproducer into a lit test.

Patch by Vedant Kumar!

llvm-svn: 319130

6 years ago[WebAssembly] Add options for using the nontrapping-fptoint feature.
Dan Gohman [Tue, 28 Nov 2017 01:13:45 +0000 (01:13 +0000)]
[WebAssembly] Add options for using the nontrapping-fptoint feature.

This adds ways to control use of WebAssembly's new nontrapping-fptoint
feature.

llvm-svn: 319129

6 years ago[WebAssembly] Fix trapping behavior in fptosi/fptoui.
Dan Gohman [Tue, 28 Nov 2017 01:13:40 +0000 (01:13 +0000)]
[WebAssembly] Fix trapping behavior in fptosi/fptoui.

This adds code to protect WebAssembly's `trunc_s` family of opcodes
from values outside their domain. Even though such conversions have
full undefined behavior in C/C++, LLVM IR's `fptosi` and `fptoui` do
not, and only return undef.

This also implements the proposed non-trapping float-to-int conversion
feature and uses that instead when available.

llvm-svn: 319128

6 years agoStore the real binding of shared symbols.
Rafael Espindola [Tue, 28 Nov 2017 01:04:51 +0000 (01:04 +0000)]
Store the real binding of shared symbols.

Currently we mark every shared symbol as STB_WEAK.

That is a hack to make it easy to decide when a .so is needed or not
because of a reference to a given symbol.

That hack leaks when we create copy relocations as shown by the update
to relocation-copy-alias.s.

This patch stores the original binding when we first read a shared
symbol. We still have to update the binding to weak if we see a weak
undef, but I find the logic easier to read where it is now.

llvm-svn: 319127

6 years agoSROA: Avoid creating a fragment expression that covers the entire variable.
Adrian Prantl [Tue, 28 Nov 2017 00:57:53 +0000 (00:57 +0000)]
SROA: Avoid creating a fragment expression that covers the entire variable.

Fixes PR35416.

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

llvm-svn: 319126

6 years agoMove getVariableSize from Verifier.cpp into DIVariable::getSize() (NFC)
Adrian Prantl [Tue, 28 Nov 2017 00:57:51 +0000 (00:57 +0000)]
Move getVariableSize from Verifier.cpp into DIVariable::getSize() (NFC)

llvm-svn: 319125

6 years ago[X86] Remove unnecessary fp<->int setOperationAction lines from a hasVLX block. NFCI
Craig Topper [Tue, 28 Nov 2017 00:41:12 +0000 (00:41 +0000)]
[X86] Remove unnecessary fp<->int setOperationAction lines from a hasVLX block. NFCI

These lines all exist identically either under SSE2, AVX2 or AVX512. Given that VLX implies all of those, these aren't providing anything new.

llvm-svn: 319124

6 years agoInsert padding before the __cxa_exception header to ensure the thrown
Akira Hatanaka [Tue, 28 Nov 2017 00:36:29 +0000 (00:36 +0000)]
Insert padding before the __cxa_exception header to ensure the thrown
object is sufficiently aligned.

r303175 annotated field unwindHeader of __cxa_exception with attribute
'aligned' to ensure the thrown object following the __cxa_exception
header was sufficiently aligned. This caused changes in the field
offsets of __cxa_exception relative to the start of the thrown object,
which was an ABI breaking change for some clients.

Instead of annotating field unwindHeader, this commit inserts extra
space before the header. This ensures the thrown object following the
header is sufficiently aligned without changing the field offsets, thus
avoiding any ABI breakages.

rdar://problem/25364625
rdar://problem/35556163

llvm-svn: 319123

6 years ago[X86] Remove duplicate calls to setOperationAction. NFCI
Craig Topper [Tue, 28 Nov 2017 00:16:42 +0000 (00:16 +0000)]
[X86] Remove duplicate calls to setOperationAction. NFCI

These same calls exist a few lines down.

llvm-svn: 319122

6 years agoAdd an F_Delete flag.
Rafael Espindola [Tue, 28 Nov 2017 00:12:44 +0000 (00:12 +0000)]
Add an F_Delete flag.

For now this only changes the handle Access.

llvm-svn: 319121

6 years ago[DAGCombiner] Don't combine aext(setcc) if the setcc is already using the target...
Craig Topper [Mon, 27 Nov 2017 23:51:40 +0000 (23:51 +0000)]
[DAGCombiner] Don't combine aext(setcc) if the setcc is already using the target's preferred result type.

With AVX512 vXi1 types are legal so we shouldn't be extending them.

This change is similar to existing code in the zext(setcc) combine.

llvm-svn: 319120

6 years ago[DAGCombiner] Use EVT::changeVectorElementTypeToInteger() instead of implementing...
Craig Topper [Mon, 27 Nov 2017 23:51:31 +0000 (23:51 +0000)]
[DAGCombiner] Use EVT::changeVectorElementTypeToInteger() instead of implementing manually.

llvm-svn: 319119

6 years agoAdd OpenFlags to the create(Unique|Temporary)File interfaces.
Rafael Espindola [Mon, 27 Nov 2017 23:44:11 +0000 (23:44 +0000)]
Add OpenFlags to the create(Unique|Temporary)File interfaces.

This will allow a future F_Delete flag to be specified when we want
the file to be automatically deleted on close.

llvm-svn: 319117

6 years ago[clang-cl] Alias /Wall to -Weverything
Reid Kleckner [Mon, 27 Nov 2017 23:42:20 +0000 (23:42 +0000)]
[clang-cl] Alias /Wall to -Weverything

cl interprets this option to mean enable every supported warning, which
is what Clang's -Weverything flag does.

llvm-svn: 319116

6 years ago[msan] Avoid shadowing a variable in common interceptors.
Evgeniy Stepanov [Mon, 27 Nov 2017 23:25:38 +0000 (23:25 +0000)]
[msan] Avoid shadowing a variable in common interceptors.

"offset" declared in a macro may shadow a variable with the same name
in the caller which is used in a macro argument. We are quite lucky
that it does not actually happen, but rename the variable anyway to
be on the safe side.

llvm-svn: 319115

6 years ago[TSan] Do not run cond_cancel.c test on ppc64.
Matt Morehouse [Mon, 27 Nov 2017 23:20:47 +0000 (23:20 +0000)]
[TSan] Do not run cond_cancel.c test on ppc64.

After r319004, the expected failure on ppc64 manifests as an infinite
loop.

llvm-svn: 319114

6 years agoRename `Symtab` private memory to avoid confusion with global `Symtab`
Sam Clegg [Mon, 27 Nov 2017 23:16:06 +0000 (23:16 +0000)]
Rename `Symtab` private memory to avoid confusion with global `Symtab`

This is also consistent with SymVector that exists in COFF port
and soon to be added to the wasm port.

Split off as part of https://reviews.llvm.org/D40371

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

llvm-svn: 319113

6 years agoFix typo in test name
Sam Clegg [Mon, 27 Nov 2017 23:09:19 +0000 (23:09 +0000)]
Fix typo in test name

llvm-svn: 319112

6 years agoAdd an option to misc-move-const-arg to not diagnose on trivially copyable types.
Aaron Ballman [Mon, 27 Nov 2017 22:59:33 +0000 (22:59 +0000)]
Add an option to misc-move-const-arg to not diagnose on trivially copyable types.

Patch by Oleg Smolsky

llvm-svn: 319111

6 years ago[X86] Teach getSetCCResultType to handle more than just SimpleVTs when looking at...
Craig Topper [Mon, 27 Nov 2017 22:56:10 +0000 (22:56 +0000)]
[X86] Teach getSetCCResultType to handle more than just SimpleVTs when looking at larger than 512-bit vectors.

Which VTs are considered simple is determined by the superset of the legal types of all targets in LLVM. If we're looking at VTs that are going to be split down to 512-bits we should allow any VT not just simple ones since the simple list changes over time as new targets are added.

llvm-svn: 319110

6 years ago[CMake] Pass LLVM_HOST_TRIPLE to external projects
Petr Hosek [Mon, 27 Nov 2017 22:50:48 +0000 (22:50 +0000)]
[CMake] Pass LLVM_HOST_TRIPLE to external projects

LLVM runtimes rely on LLVM_HOST_TRIPLE being set in their builds
and tests so make sure it's being passed down.

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

llvm-svn: 319109

6 years agoConsistent use of <internal> when displaying internal symbol names
Sam Clegg [Mon, 27 Nov 2017 22:49:16 +0000 (22:49 +0000)]
Consistent use of <internal> when displaying internal symbol names

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

llvm-svn: 319108

6 years ago[CMake][runtimes] Support monorepo layout with runtimes build
Petr Hosek [Mon, 27 Nov 2017 22:31:11 +0000 (22:31 +0000)]
[CMake][runtimes] Support monorepo layout with runtimes build

We introduce a new variable LLVM_ENABLE_RUNTIMES which works
similarly to LLVM_ENABLE_PROJECTS and allows specifying runtimes
that will be enabled in the runtimes build.

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

llvm-svn: 319107

6 years agoFix problems with r'890 when building on machines where sizeof(size_t) != sizeof...
Marshall Clow [Mon, 27 Nov 2017 22:27:22 +0000 (22:27 +0000)]
Fix problems with r'890 when building on machines where sizeof(size_t) != sizeof(unsigned long long) and C++03

llvm-svn: 319106

6 years ago[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading
Michal Gorny [Mon, 27 Nov 2017 22:23:09 +0000 (22:23 +0000)]
[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading

Prevent unloading shared libraries on Linux when dlclose() is called.
This is necessary since command-line option parsing API relies on
registering the global option instances in the option parser instance
which can be loaded in a different shared library.

Given that we can't reliably remove those options when a library is
unloaded, the parser ends up containing dangling references. Since glibc
has relatively complex library unloading rules, some of the LLVM
libraries can be unloaded while others (including the Support library)
stay loaded causing quite a mayhem. To reliably prevent that, just
forbid unloading all libraries -- it's a very bad idea anyway.

While the issue arguably happens only with BUILD_SHARED_LIBS, it may
affect any library reusing llvm::cl interface.

Based on patch provided Ross Hayward on https://bugs.gentoo.org/617154.
Previously hit by Fedora back in Feb 2016:
https://lists.freedesktop.org/archives/mesa-dev/2016-February/107242.html

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

llvm-svn: 319105

6 years agoFixed the ability to recursively get an attribute value from a DWARFDie.
Greg Clayton [Mon, 27 Nov 2017 22:12:44 +0000 (22:12 +0000)]
Fixed the ability to recursively get an attribute value from a DWARFDie.

The previous implementation would only look 1 DW_AT_specification or DW_AT_abstract_origin deep. This means DWARFDie::getName() would fail in certain cases. I ran into such a case while creating a tool that used the LLVM DWARF parser to generate a symbolication format so I have seen this in the wild.

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

llvm-svn: 319104

6 years ago[X86] Remove lines that set v8f32 FP_ROUND/FP_EXTEND to Legal under AVX512. NFCI
Craig Topper [Mon, 27 Nov 2017 22:01:17 +0000 (22:01 +0000)]
[X86] Remove lines that set v8f32 FP_ROUND/FP_EXTEND to Legal under AVX512. NFCI

We don't do this for narrow vectors under AVX or SSE features. We also don't set them to Expand like we do for many vectors op. Nor does TargetLoweringBase.cpp. This leads me to believe these default to Legal.

llvm-svn: 319103

6 years ago[WebAssemby] Enable "-mthread-model single" by default, for now.
Dan Gohman [Mon, 27 Nov 2017 21:39:16 +0000 (21:39 +0000)]
[WebAssemby] Enable "-mthread-model single" by default, for now.

The WebAssembly standard does not yet have threads, and while it's in the
process of being standardized, it'll take some time for it to make it
through and be available in all popular implementations. With increasing
numbers of people using the LLVM wasm backend through LLVM directly rather
than through Emscripten, it's increasingly important to have friendly
defaults.

See also https://bugs.llvm.org/show_bug.cgi?id=35411

llvm-svn: 319101

6 years agoRevert r319090, "COFF: Do not create SectionChunks for discarded comdat sections."
Peter Collingbourne [Mon, 27 Nov 2017 21:37:51 +0000 (21:37 +0000)]
Revert r319090, "COFF: Do not create SectionChunks for discarded comdat sections."

Caused test failures in check-cfi on Windows.
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/20284

llvm-svn: 319100

6 years ago[scudo] Workaround for uninitialized Bionic globals
Kostya Kortchinsky [Mon, 27 Nov 2017 21:34:43 +0000 (21:34 +0000)]
[scudo] Workaround for uninitialized Bionic globals

Summary:
Bionic doesn't initialize its globals early enough. This causes issues when
trying to access them from a preinit_array (b/25751302) or from another
constructor called before the libc one (b/68046352). __progname is initialized
after the other globals, so we can check its value to know if calling
`getauxval` is safe.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, llvm-commits

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

llvm-svn: 319099

6 years agoadd new check to find OSSpinlock usage
Yan Zhang [Mon, 27 Nov 2017 21:30:10 +0000 (21:30 +0000)]
add new check to find OSSpinlock usage

Summary:
This check finds the use of methods related to OSSpinlock in Objective-C code, which should be deprecated due to livelock issues.
The following method call will be detected:

- OSSpinlockLock()
- OSSpinlockTry()
- OSSpinlockUnlcok()

Reviewers: hokein, benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits, mgorny

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

llvm-svn: 319098

6 years ago[Mem2Reg] Clang-format unformatted parts of this file. NFCI.
Davide Italiano [Mon, 27 Nov 2017 21:25:52 +0000 (21:25 +0000)]
[Mem2Reg] Clang-format unformatted parts of this file. NFCI.

llvm-svn: 319097

6 years ago[SROA] Propagate !range metadata when moving loads.
Davide Italiano [Mon, 27 Nov 2017 21:25:13 +0000 (21:25 +0000)]
[SROA] Propagate !range metadata when moving loads.

This tries to propagate !range metadata to a pre-existing load
when a load is optimized out. This is done instead of adding an
assume because converting loads to and from assumes creates a
lot of IR.

Patch by Ariel Ben-Yehuda.

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

llvm-svn: 319096

6 years agoMark UUID::GetByteSize() const
Stephane Sezer [Mon, 27 Nov 2017 21:16:37 +0000 (21:16 +0000)]
Mark UUID::GetByteSize() const

Summary:
This method doesn't modify anything in the object it's called on so we
can mark it const to make it usable in a const context.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 319095

6 years ago[PartiallyInlineLibCalls][x86] add TTI hook to allow sqrt inlining to depend on arg...
Sanjay Patel [Mon, 27 Nov 2017 21:15:43 +0000 (21:15 +0000)]
[PartiallyInlineLibCalls][x86] add TTI hook to allow sqrt inlining to depend on arg rather than result

This should fix PR31455:
https://bugs.llvm.org/show_bug.cgi?id=31455

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

llvm-svn: 319094

6 years agoAdd release note about TargetRegistry change from r318352
Daniel Sanders [Mon, 27 Nov 2017 21:12:55 +0000 (21:12 +0000)]
Add release note about TargetRegistry change from r318352

llvm-svn: 319093

6 years ago[AMDGPU] Update test nullptr.ll to use amdgiz environment
Yaxun Liu [Mon, 27 Nov 2017 20:48:21 +0000 (20:48 +0000)]
[AMDGPU] Update test nullptr.ll to use amdgiz environment

This test needs to be manually updated since it is difficult to do it with script.

Addr space 6 to 23 are only used by r600, therefore only check them for r600.

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

llvm-svn: 319092

6 years agoRevert commit removing allocator support from packaged_task. Will investigate further
Marshall Clow [Mon, 27 Nov 2017 20:47:54 +0000 (20:47 +0000)]
Revert commit removing allocator support from packaged_task. Will investigate further

llvm-svn: 319091

6 years agoCOFF: Do not create SectionChunks for discarded comdat sections.
Peter Collingbourne [Mon, 27 Nov 2017 20:42:34 +0000 (20:42 +0000)]
COFF: Do not create SectionChunks for discarded comdat sections.

With this change, instead of creating a SectionChunk for each section
in the object file, we only create them when we encounter a prevailing
comdat section.

Also change how symbol resolution occurs between comdat symbols. Now
only the comdat leader participates in comdat resolution, and not any
other external associated symbols. This is more in line with how COFF
semantics are defined, and should allow for a more straightforward
implementation of non-ANY comdat types.

On my machine, this change reduces our runtime linking a release
build of chrome_child.dll with /nopdb from 5.65s to 4.54s (median of
50 runs).

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

llvm-svn: 319090

6 years agoUse LIST_SEPARATOR rather than escaping in ExternalProject_Add
Petr Hosek [Mon, 27 Nov 2017 20:41:53 +0000 (20:41 +0000)]
Use LIST_SEPARATOR rather than escaping in ExternalProject_Add

Escaping ; in list arguments passed to ExternalProject_Add doesn't seem
to be working in newer versions of CMake (see
https://public.kitware.com/Bug/view.php?id=16137 for more details). Use
a custom LIST_SEPARATOR instead which is the officially supported way.

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

llvm-svn: 319089

6 years ago[CMake][Fuchsia] Disable terminfo database in Fuchsia toolchain
Petr Hosek [Mon, 27 Nov 2017 20:29:13 +0000 (20:29 +0000)]
[CMake][Fuchsia] Disable terminfo database in Fuchsia toolchain

It's used to determine whether terminal supports colors, but within LLVM
it's only used in handful of places and in Clang it's only used in AST
dumper, otherwise Clang relies on the -fcolor-diagnostics flag which we
pass explicitly from our build system anyway. This eliminates one of the
shared libraries dependencies making the toolchain less reliant on the
host environment.

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

llvm-svn: 319088

6 years ago[PowerPC] Remove redundant TOC saves
Zaara Syeda [Mon, 27 Nov 2017 20:26:36 +0000 (20:26 +0000)]
[PowerPC] Remove redundant TOC saves

This patch adds a peep hole optimization to remove any redundant toc save
instructions added as part of the call sequence for indirect calls. It removes
any toc saves within a function that are dominated by another toc save.

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

llvm-svn: 319087

6 years agoRename MCTargetOptionsCommandFlags.h to .def as it is not a normal/modular header...
David Blaikie [Mon, 27 Nov 2017 19:55:16 +0000 (19:55 +0000)]
Rename MCTargetOptionsCommandFlags.h to .def as it is not a normal/modular header as much as it is for stamping out some global/static variables

llvm-svn: 319086

6 years ago[SelectionDAG] Add a debug message when vector_shuffle nodes are created.
Craig Topper [Mon, 27 Nov 2017 19:54:57 +0000 (19:54 +0000)]
[SelectionDAG] Add a debug message when vector_shuffle nodes are created.

We print a debug message when most nodes are created, but getVectorShuffle was missing.

llvm-svn: 319085

6 years agoFix for file renaming in LLVM (CommandFlags.h -> CommandFlags.def)
David Blaikie [Mon, 27 Nov 2017 19:54:06 +0000 (19:54 +0000)]
Fix for file renaming in LLVM (CommandFlags.h -> CommandFlags.def)

llvm-svn: 319084

6 years ago[fuchsia] Update Fuchsia with a new mmap implementation.
Kostya Kortchinsky [Mon, 27 Nov 2017 19:53:53 +0000 (19:53 +0000)]
[fuchsia] Update Fuchsia with a new mmap implementation.

Summary:
    Now that the sanitizer_common interface for MmapNoAccess / MmapFixed
    have been refactored to allow a more OO-esque access pattern, update the
    Fuchsia mmap implementation to take advantage of this.

    Previously MmapNoAccess / MmapFixed relied on a global allocator_vmar,
    since the sanitizer_allocator only called MmapNoAccess once.  Now, we
    create a new VMAR per ReservedAddressRange object.

    This allows the sanitizer allocator to work in tandem with the Scudo
    secondary allocator.

    This is part 4 of a 4 part changeset:
    * part 1 https://reviews.llvm.org/D38593
    * part 2 https://reviews.llvm.org/D38592
    * part 3 https://reviews.llvm.org/D38593

Reviewers: mcgrathr, cryptoad

Reviewed By: cryptoad

Subscribers: alekseyshl, mcgrathr, kubamracek, mehdi_amini

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

llvm-svn: 319083

6 years agoRename CommandFlags.h -> CommandFlags.def
David Blaikie [Mon, 27 Nov 2017 19:43:58 +0000 (19:43 +0000)]
Rename CommandFlags.h -> CommandFlags.def

Since this isn't a real header - it includes static functions and had
external linkage variables (though this change makes them static, since
that's what they should be) so can't be included more than once in a
program.

llvm-svn: 319082

6 years agoFix -Werror build for signed/unsigned comparison with use of explicit unsigned literals
David Blaikie [Mon, 27 Nov 2017 19:43:57 +0000 (19:43 +0000)]
Fix -Werror build for signed/unsigned comparison with use of explicit unsigned literals

llvm-svn: 319081

6 years agoImplement LWG#2921 and LWG#2976 - removing allocator support from packaged_task.
Marshall Clow [Mon, 27 Nov 2017 19:43:28 +0000 (19:43 +0000)]
Implement LWG#2921 and LWG#2976 - removing allocator support from packaged_task.

llvm-svn: 319080

6 years ago[OPENMP] Codegen for `distribute parallel for simd` directive.
Alexey Bataev [Mon, 27 Nov 2017 19:38:58 +0000 (19:38 +0000)]
[OPENMP] Codegen for `distribute parallel for simd` directive.

Initial codegen for `#pragma omp distribute parallel for simd` directive
and its clauses.

llvm-svn: 319079

6 years ago[OPENMP] Codegen for `distribute parallel for simd` directive.
Alexey Bataev [Mon, 27 Nov 2017 19:38:52 +0000 (19:38 +0000)]
[OPENMP] Codegen for `distribute parallel for simd` directive.

Added proper codegen for `distribute parallel for simd` directive.

llvm-svn: 319078

6 years agoSwitch CPU names not recognized by GNU assembler
Pirama Arumuga Nainar [Mon, 27 Nov 2017 19:18:39 +0000 (19:18 +0000)]
Switch CPU names not recognized by GNU assembler

Summary:
Switch CPU names not recognized by GNU assembler to a close CPU that it
does recognize.  In this patch, kryo, falkor and saphira all get
replaced by cortex-a57 when invoking the assembler.  In addition, krait
was already being replaced by cortex-a15.

Reviewers: weimingz

Subscribers: srhines, cfe-commits

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

llvm-svn: 319077

6 years agoRevert r319069 - [cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading
Michal Gorny [Mon, 27 Nov 2017 19:18:36 +0000 (19:18 +0000)]
Revert r319069 - [cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading

This breaks one of the unit tests. Need to find a good solution.

llvm-svn: 319076

6 years agoInliner: Don't mark notail calls with the 'tail' attribute
Arnold Schwaighofer [Mon, 27 Nov 2017 19:03:40 +0000 (19:03 +0000)]
Inliner: Don't mark notail calls with the 'tail' attribute

enum TailCallKind { TCK_None = 0, TCK_Tail = 1, TCK_MustTail = 2,
                    TCK_NoTail = 3 };

TCK_NoTail is greater than TCK_Tail so taking the min does not do the
correct thing.

rdar://35639547

llvm-svn: 319075

6 years agoFix PR#35438 - bitset constructor does not zero unused bits
Marshall Clow [Mon, 27 Nov 2017 19:03:30 +0000 (19:03 +0000)]
Fix PR#35438 - bitset constructor does not zero unused bits

llvm-svn: 319074

6 years agoAdd opt-viewer testing
Adam Nemet [Mon, 27 Nov 2017 19:00:29 +0000 (19:00 +0000)]
Add opt-viewer testing

Detects whether we have the Python modules (pygments, yaml) required by
opt-viewer and hooks this up to REQUIRES.

This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer
testing).

It's also related to https://github.com/apple/swift/pull/12938 and the idea is
to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake.

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

llvm-svn: 319073

6 years ago[opt-viewer] Fix option name
Adam Nemet [Mon, 27 Nov 2017 19:00:22 +0000 (19:00 +0000)]
[opt-viewer] Fix option name

llvm-svn: 319072

6 years ago[llvm-objcopy] Add --strip-all-gnu and change --strip-all
Jake Ehrlich [Mon, 27 Nov 2017 18:56:01 +0000 (18:56 +0000)]
[llvm-objcopy] Add --strip-all-gnu and change --strip-all

GNU's --strip-all doesn't strip as aggressively as it could in general.
Currently llvm-objcopy copies the exact behavoir of GNU's --strip-all.
eu-strip is used as a drop in replacement for GNU strip/objcopy in many many
places without issue. eu-strip removes non-allocated sections and keeps
.gnu.warning* sections. Because --strip-all will likely be the most widely
used stripping option we should make --strip-all as aggressive as it can safely
be. Since we have evidence from eu-strip that this is a safe option we should
allow it. For those that might still have an issue afterwards I've added
--strip-all-gnu as an exact drop in replacement for GNU's --strip-all as well.

llvm-svn: 319071

6 years ago[BinaryStream] Support growable streams.
Zachary Turner [Mon, 27 Nov 2017 18:48:37 +0000 (18:48 +0000)]
[BinaryStream] Support growable streams.

The existing library assumed that a stream's length would never
change.  This makes some things simpler, but it's not flexible
enough for what we need, especially for writable streams where
what you really want is for each call to write to actually append.

llvm-svn: 319070

6 years ago[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading
Michal Gorny [Mon, 27 Nov 2017 18:34:52 +0000 (18:34 +0000)]
[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading

Prevent unloading shared libraries on Linux when dlclose() is called.
This is necessary since command-line option parsing API relies on
registering the global option instances in the option parser instance
which can be loaded in a different shared library.

Given that we can't reliably remove those options when a library is
unloaded, the parser ends up containing dangling references. Since glibc
has relatively complex library unloading rules, some of the LLVM
libraries can be unloaded while others (including the Support library)
stay loaded causing quite a mayhem. To reliably prevent that, just
forbid unloading all libraries -- it's a very bad idea anyway.

While the issue arguably happens only with BUILD_SHARED_LIBS, it may
affect any library reusing llvm::cl interface.

Based on patch provided Ross Hayward on https://bugs.gentoo.org/617154.
Previously hit by Fedora back in Feb 2016:
https://lists.freedesktop.org/archives/mesa-dev/2016-February/107242.html

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

llvm-svn: 319069

6 years ago[X86] Remove an unused isel pattern that looked for pshufd with v4f32 type.
Craig Topper [Mon, 27 Nov 2017 18:25:54 +0000 (18:25 +0000)]
[X86] Remove an unused isel pattern that looked for pshufd with v4f32 type.

I don't believe our current lowering/combining would ever produce such a node. We only produce integer typed pshufds.

llvm-svn: 319068

6 years ago[InstCombine] use 'auto' with 'dyn_cast'; NFC
Sanjay Patel [Mon, 27 Nov 2017 18:19:32 +0000 (18:19 +0000)]
[InstCombine] use 'auto' with 'dyn_cast'; NFC

llvm-svn: 319067

6 years ago[X86] Teach combineX86ShuffleChain that AllowIntDomain requires at least SSE2.
Craig Topper [Mon, 27 Nov 2017 18:15:14 +0000 (18:15 +0000)]
[X86] Teach combineX86ShuffleChain that AllowIntDomain requires at least SSE2.

I don't have a good test case for this at the moment. I was playing around with a change in legalizing and triggered this code to produce a PSHUFD with sse1 only.

llvm-svn: 319066

6 years ago[X86][AVX512] Tag AVX512 PACKSS/PACKUS/PMADDWD/PMADDUBSW instructions with SSE_PACK...
Simon Pilgrim [Mon, 27 Nov 2017 18:14:18 +0000 (18:14 +0000)]
[X86][AVX512] Tag AVX512 PACKSS/PACKUS/PMADDWD/PMADDUBSW instructions with SSE_PACK/SSE_PMADD schedule classes

llvm-svn: 319065

6 years ago[Hexagon] Implement HexagonSubtarget::isHVXVectorType
Krzysztof Parzyszek [Mon, 27 Nov 2017 18:12:16 +0000 (18:12 +0000)]
[Hexagon] Implement HexagonSubtarget::isHVXVectorType

llvm-svn: 319064

6 years ago[X86] Add avx512bw command lines to vselect-packss.ll
Craig Topper [Mon, 27 Nov 2017 18:00:49 +0000 (18:00 +0000)]
[X86] Add avx512bw command lines to vselect-packss.ll

This shows several places where we fail to use masked move or blendm.

llvm-svn: 319063

6 years ago[clang-tidy] Rename qualified references to check class + support inconsistent names
Alexander Kornienko [Mon, 27 Nov 2017 17:59:26 +0000 (17:59 +0000)]
[clang-tidy] Rename qualified references to check class + support inconsistent names

llvm-svn: 319062

6 years agoDelete obsolete function mergeUseListsImpl
Jonas Hahnfeld [Mon, 27 Nov 2017 17:55:47 +0000 (17:55 +0000)]
Delete obsolete function mergeUseListsImpl

mergeUseLists is implemented iteratively since r243590.

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

llvm-svn: 319061

6 years agoBuild more sanitizers for NetBSD
Kamil Rytarowski [Mon, 27 Nov 2017 17:54:26 +0000 (17:54 +0000)]
Build more sanitizers for NetBSD

Summary:
Enable for NetBSD:

 - MSan,
 - TSan,
 - LSan.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, dvyukov, vitalybuka

Reviewed By: eugenis

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

Tags: #sanitizers

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

llvm-svn: 319060

6 years ago[X86] Make getSetCCResultType return vXi1 for any vXi32/vXi64 vector over 512 bits...
Craig Topper [Mon, 27 Nov 2017 17:51:55 +0000 (17:51 +0000)]
[X86] Make getSetCCResultType return vXi1 for any vXi32/vXi64 vector over 512 bits long when AVX512 is enabled.

Similar for vXi16/vXi8 with BWI.

Any vector larger than 512 bits will be split to 512 bits during legalization. But without this we will fold sexts with them before that making it difficult to recover leading to scalarization.

llvm-svn: 319059

6 years ago[analyzer] pr34766: Fix a crash on explicit std::initializer_list constructor.
Artem Dergachev [Mon, 27 Nov 2017 17:37:09 +0000 (17:37 +0000)]
[analyzer] pr34766: Fix a crash on explicit std::initializer_list constructor.

We didn't support the following syntax:

  (std::initializer_list<int>){12}

which suddenly produces CompoundLiteralExpr that contains
CXXStdInitializerListExpr.

Lift the assertion and instead pass the value through CompoundLiteralExpr
transparently, as it doesn't add much.

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

llvm-svn: 319058

6 years ago[polly] Set up .arcconfig to point to new Diffusion PLO repository
Ben Hamilton [Mon, 27 Nov 2017 17:34:03 +0000 (17:34 +0000)]
[polly] Set up .arcconfig to point to new Diffusion PLO repository

Summary: We want to automatically copy the appropriate mailing list
for review requests to the polly repository.

For context, see the proposal and discussion here:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/056032.html

Similar to D40179, I set up a new Diffusion repository with callsign
"PLO" for polly:

https://reviews.llvm.org/source/polly/

This explicitly updates polly's .arcconfig to point to the new C
repository in Diffusion, which will let us use Herald rule H270.

llvm-svn: 319056

6 years ago[analyzer] pr34404: Fix a crash on modeling pointers to indirect members.
Artem Dergachev [Mon, 27 Nov 2017 17:31:16 +0000 (17:31 +0000)]
[analyzer] pr34404: Fix a crash on modeling pointers to indirect members.

We were crashing whenever a C++ pointer-to-member was taken, that was pointing
to a member of an anonymous structure field within a class, eg.

  struct A {
    struct {
     int x;
    };
  };
  // ...
  &A::x;

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

llvm-svn: 319055

6 years ago[X86][SSE] Fix roundpd instructions to correctly use IIC_SSE_ROUNDPD_* itineraries
Simon Pilgrim [Mon, 27 Nov 2017 17:29:49 +0000 (17:29 +0000)]
[X86][SSE] Fix roundpd instructions to correctly use IIC_SSE_ROUNDPD_* itineraries

llvm-svn: 319054

6 years ago[clang] Set up .arcconfig to point to new Diffusion C repository
Ben Hamilton [Mon, 27 Nov 2017 17:21:24 +0000 (17:21 +0000)]
[clang] Set up .arcconfig to point to new Diffusion C repository

Summary:
We want to automatically copy cfe-commits@ on review requests
to the clang repository.

Similar to D40179, I set up a new Diffusion repository with callsign
"C" for clang:

https://reviews.llvm.org/source/clang/

This explicitly updates clang's .arcconfig to point to the new C
repository in Diffusion, which will let us use Herald rule H268.

Reviewers: klimek, sammccall

Reviewed By: klimek

Subscribers: dlj, bkramer

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

llvm-svn: 319052

6 years agoAdd a missing test.
Rafael Espindola [Mon, 27 Nov 2017 17:18:09 +0000 (17:18 +0000)]
Add a missing test.

We were not testing that we correctly handled a .o with a weak symbol
after a .so.

llvm-svn: 319051

6 years ago[AMDGPU][MC][DISASSEMBLER][GFX9] Corrected decoding of GLOBAL/SCRATCH opcodes
Dmitry Preobrazhensky [Mon, 27 Nov 2017 17:14:35 +0000 (17:14 +0000)]
[AMDGPU][MC][DISASSEMBLER][GFX9] Corrected decoding of GLOBAL/SCRATCH opcodes

See bug 35433: https://bugs.llvm.org/show_bug.cgi?id=35433

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

Reviewers: artem.tamazov, SamWot, arsenm
llvm-svn: 319050

6 years ago[Power9] Improvements to vector extract with variable index exploitation
Zaara Syeda [Mon, 27 Nov 2017 17:11:03 +0000 (17:11 +0000)]
[Power9] Improvements to vector extract with variable index exploitation

This patch extends on to rL307174 to not use the power9 vector extract with
variable index instructions when extracting word element 1. For such cases,
the existing selection of MFVSRWZ provides a better sequence.

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

llvm-svn: 319049

6 years agoRemove custom TimePoint-formatting code
Pavel Labath [Mon, 27 Nov 2017 17:06:42 +0000 (17:06 +0000)]
Remove custom TimePoint-formatting code

This was a temporary thing, until llvm has proper support for formatting
time. That time has come, so we can remove the relevant code. There
should be no change in the format of the time.

llvm-svn: 319048

6 years ago[XRay] Fix typo in docs. NFC
Fangrui Song [Mon, 27 Nov 2017 16:59:26 +0000 (16:59 +0000)]
[XRay] Fix typo in docs. NFC

Reviewers: dberris

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

llvm-svn: 319047

6 years ago[OPENMP] Improve handling of cancel directives in target-based
Alexey Bataev [Mon, 27 Nov 2017 16:54:08 +0000 (16:54 +0000)]
[OPENMP] Improve handling of cancel directives in target-based
constructs, NFC.

Improved handling of cancel|cancellation point directives inside
target-based for directives.

llvm-svn: 319046

6 years ago[X86][AVX512] Tag AVX512 sqrt instructions with SSE_SQRT schedule classes
Simon Pilgrim [Mon, 27 Nov 2017 16:43:18 +0000 (16:43 +0000)]
[X86][AVX512] Tag AVX512 sqrt instructions with SSE_SQRT schedule classes

llvm-svn: 319045

6 years ago[llvm-dwarfdump] Display DW_AT_high_pc as absolute value
Jonas Devlieghere [Mon, 27 Nov 2017 16:40:46 +0000 (16:40 +0000)]
[llvm-dwarfdump] Display DW_AT_high_pc as absolute value

DWARF4 relative DW_AT_high_pc values are now displayed as absolute
addresses. The relative value is only shown when explicitly dumping the
forms, i.e. in show-form or verbose mode.

```
DW_AT_low_pc (0x0000000000000049)
DW_AT_high_pc (0x00000019)
```

becomes

```
DW_AT_low_pc (0x0000000000000049)
DW_AT_high_pc (0x0000000000000062)
```

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

rdar://35416943

llvm-svn: 319044

6 years ago[InstSimplify] use m_APFloat to simplify fcmp folds; NFCI
Sanjay Patel [Mon, 27 Nov 2017 16:37:09 +0000 (16:37 +0000)]
[InstSimplify] use m_APFloat to simplify fcmp folds; NFCI

llvm-svn: 319043

6 years agoFix failure on C++03 bots
Marshall Clow [Mon, 27 Nov 2017 16:17:19 +0000 (16:17 +0000)]
Fix failure on C++03 bots

llvm-svn: 319042

6 years ago[InstSimplify] add fcmp with negative constant tests; NFC
Sanjay Patel [Mon, 27 Nov 2017 16:08:34 +0000 (16:08 +0000)]
[InstSimplify] add fcmp with negative constant tests; NFC

This is a superset of the tests proposed with D40012 to show another potential improvement.

llvm-svn: 319041

6 years ago[clang-tools-extra] Fix small typo in docs/ReleaseNotes.rst
Ben Hamilton [Mon, 27 Nov 2017 15:58:26 +0000 (15:58 +0000)]
[clang-tools-extra] Fix small typo in docs/ReleaseNotes.rst

Summary:
This is mainly a test diff to check the new Herald rule I
added in LLVM Phabricator to automatically Cc: cfe-commits on all
clang-tools-extra diffs.

Reviewers: Wizard, hokein, klimek

Reviewed By: Wizard

Subscribers: dlj, bkramer, sammccall

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

llvm-svn: 319040

6 years ago[clang-tools-extra] Set up .arcconfig to point to new Diffusion CTE repository
Ben Hamilton [Mon, 27 Nov 2017 15:58:25 +0000 (15:58 +0000)]
[clang-tools-extra] Set up .arcconfig to point to new Diffusion CTE repository

Summary:
I'm testing out a new Diffusion repository `CTE`:

https://reviews.llvm.org/source/clang-tools-extra/

This explicitly updates clang-tools-extra's `.arcconfig` to point to
the new `CTE` repository in Diffusion, which will let us set up Herald
rules, etc.

Reviewers: klimek, sammccall

Reviewed By: sammccall

Subscribers: bkramer, dlj

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

llvm-svn: 319039

6 years agoImplement LWG#2948: unique_ptr does not define operator<< for stream output
Marshall Clow [Mon, 27 Nov 2017 15:51:36 +0000 (15:51 +0000)]
Implement LWG#2948: unique_ptr does not define operator<< for stream output

llvm-svn: 319038