platform/upstream/llvm.git
6 years agoGlobalISel: fewerElementsVector for a few more trivial ops
Matt Arsenault [Fri, 25 Jan 2019 04:03:38 +0000 (04:03 +0000)]
GlobalISel: fewerElementsVector for a few more trivial ops

llvm-svn: 352165

6 years agoAMDGPU/GlobalISel: Legalize smulh/umulh and scalarize mul
Matt Arsenault [Fri, 25 Jan 2019 03:23:04 +0000 (03:23 +0000)]
AMDGPU/GlobalISel: Legalize smulh/umulh and scalarize mul

llvm-svn: 352162

6 years ago[HotColdSplit] Describe the pass in more detail, NFC
Vedant Kumar [Fri, 25 Jan 2019 03:22:38 +0000 (03:22 +0000)]
[HotColdSplit] Describe the pass in more detail, NFC

llvm-svn: 352161

6 years ago[HotColdSplit] Split more aggressively before/after cold invokes
Vedant Kumar [Fri, 25 Jan 2019 03:22:23 +0000 (03:22 +0000)]
[HotColdSplit] Split more aggressively before/after cold invokes

While a cold invoke itself and its unwind destination can't be
extracted, code which unconditionally executes before/after the invoke
may still be profitable to extract.

With cost model changes from D57125 applied, this gives a 3.5% increase
in split text across LNT+externals on arm64 at -Os.

llvm-svn: 352160

6 years agoDefine the _fltused symbol in one lldb test as well, post-r352076.
James Y Knight [Fri, 25 Jan 2019 03:21:23 +0000 (03:21 +0000)]
Define the _fltused symbol in one lldb test as well, post-r352076.

llvm-svn: 352159

6 years agoRemove a warning in DynamicLoaderDarwin::UpdateImageLoadAddress
Jason Molenda [Fri, 25 Jan 2019 03:01:48 +0000 (03:01 +0000)]
Remove a warning in DynamicLoaderDarwin::UpdateImageLoadAddress
when the binary loaded in memory has a section that we cannot find
in the on-disk version.  I added this warning out of an overabundance
of caution originally, but I've never seen an instance of it being
hit in the past few years, and there are some changes for the shared
cache on darwin systems where a segment is added when the shared
cache is constructed so we're now hitting this warning.  I've decided
to remove it altogether.

<rdar://problem/46889346>

llvm-svn: 352158

6 years agoGlobalISel: Support fewerElementsVector for icmp/fcmp
Matt Arsenault [Fri, 25 Jan 2019 02:59:34 +0000 (02:59 +0000)]
GlobalISel: Support fewerElementsVector for icmp/fcmp

Also legalize 64-bit compares for AMDGPU

llvm-svn: 352157

6 years ago[AArch64] Make the test for rsr and rsr64 stricter
Petr Hosek [Fri, 25 Jan 2019 02:42:30 +0000 (02:42 +0000)]
[AArch64] Make the test for rsr and rsr64 stricter

ACLE specifies that return type for rsr and rsr64 is uint32_t and
uint64_t respectively. D56852 change the return type of rsr64 from
unsigned long to unsigned long long which at least on Linux doesn't
match uint64_t, but the test isn't strict enough to detect that
because compiler implicitly converts unsigned long long to uint64_t,
but it breaks other uses such as printf with PRIx64 type specifier.
This change makes the test stricter enforcing that the return type
of rsr and rsr64 builtins is what is actually specified in ACLE.

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

llvm-svn: 352156

6 years agoGlobalISel: Implement fewerElementsVector for extensions
Matt Arsenault [Fri, 25 Jan 2019 02:36:32 +0000 (02:36 +0000)]
GlobalISel: Implement fewerElementsVector for extensions

llvm-svn: 352155

6 years agoEnhance support for NetBSD in SafeStack
Kamil Rytarowski [Fri, 25 Jan 2019 02:18:01 +0000 (02:18 +0000)]
Enhance support for NetBSD in SafeStack

Summary:
Always try to detect and call internal or real libc symbols instead of
locally installed interceptors.

This covers:
 - GetTid()
 - TgKill()
 - Mmap()
 - Munmap()
 - Mprotect()

This cherry-picks code from sanitizer_common/sanitizer_netbsd.cc.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 352154

6 years agoRevert "[AArch64] Use LL for 64-bit intrinsic arguments"
Petr Hosek [Fri, 25 Jan 2019 02:16:29 +0000 (02:16 +0000)]
Revert "[AArch64] Use LL for 64-bit intrinsic arguments"

This reverts commit r351740: this broke on platforms where unsigned long
long isn't the same as uint64_t which is what ACLE specifies for the
return value of rsr64.

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

llvm-svn: 352153

6 years agohwasan: If we split the entry block, move static allocas back into the entry block.
Peter Collingbourne [Fri, 25 Jan 2019 02:08:46 +0000 (02:08 +0000)]
hwasan: If we split the entry block, move static allocas back into the entry block.

Otherwise they are treated as dynamic allocas, which ends up increasing
code size significantly. This reduces size of Chromium base_unittests
by 2MB (6.7%).

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

llvm-svn: 352152

6 years ago[hwasan] Madvise away thread aux data
Evgeniy Stepanov [Fri, 25 Jan 2019 02:05:48 +0000 (02:05 +0000)]
[hwasan] Madvise away thread aux data

Summary:
Release memory pages for thread data (allocator cache, stack allocations
ring buffer, etc) when a thread exits. We can not simply munmap them
because this memory is custom allocated within a limited address range,
and it needs to stay "reserved".

This change alters thread storage layout by putting the ring buffer
before Thread instead of after it. This makes it possible to find the
start of the thread aux allocation given only the Thread pointer.

Reviewers: kcc, pcc

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 352151

6 years ago[hwasan] Implement print_module_map flag.
Evgeniy Stepanov [Fri, 25 Jan 2019 02:05:25 +0000 (02:05 +0000)]
[hwasan] Implement print_module_map flag.

Reviewers: kcc, pcc

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 352150

6 years ago[analyzer] Port RetainSummaryManager to the new AnyCall interface, decouple ARCMT...
George Karpenkov [Fri, 25 Jan 2019 01:24:04 +0000 (01:24 +0000)]
[analyzer] Port RetainSummaryManager to the new AnyCall interface, decouple ARCMT from the analyzer

rdar://19694750

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

llvm-svn: 352149

6 years ago[analysis] Introduce an AnyCall helper class, for abstraction over different callables
George Karpenkov [Fri, 25 Jan 2019 01:23:51 +0000 (01:23 +0000)]
[analysis] Introduce an AnyCall helper class, for abstraction over different callables

A lot of code, particularly in the analyzer, has to perform a lot of
duplication to handle functions/ObjCMessages/destructors/constructors in
a generic setting.
The analyzer already has a CallEvent helper class abstracting over such
calls, but it's not always suitable, since it's tightly coupled to other
analyzer classes (ExplodedNode, ProgramState, etc.) and it's not always
possible to construct.

This change introduces a very simple, very lightweight helper class to
do simple generic operations over callables.

In future, parts of CallEvent could be changed to use this class to
avoid some duplication.

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

llvm-svn: 352148

6 years ago[AST] Add a method to get a call type from an ObjCMessageExpr
George Karpenkov [Fri, 25 Jan 2019 01:23:37 +0000 (01:23 +0000)]
[AST] Add a method to get a call type from an ObjCMessageExpr

Due to references, expression type does not always correspond to an
expected method return type (e.g. for a method returning int & the
expression type of the call would still be int).
We have a helper method for getting the expected type on CallExpr, but
not on ObjCMessageExpr.

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

llvm-svn: 352147

6 years agogn build: Set is_clang to true in stage2 toolchains.
Peter Collingbourne [Fri, 25 Jan 2019 01:18:55 +0000 (01:18 +0000)]
gn build: Set is_clang to true in stage2 toolchains.

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

llvm-svn: 352146

6 years ago[libFuzzer][MSVC] Disable exceptions in MSVC headers
Jonathan Metzman [Fri, 25 Jan 2019 01:10:57 +0000 (01:10 +0000)]
[libFuzzer][MSVC] Disable exceptions in MSVC headers

Summary:
Disable exceptions in MSVC headers using -D_HAS_EXCEPTIONS=0
to silence compiler warning instead of using /Ehsc.

Reviewers: rnk, morehouse, metzman

Reviewed By: rnk, morehouse, metzman

Subscribers: rnk, morehouse, mgorny

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

llvm-svn: 352144

6 years agoGlobalISel: Add convenience mutatations to scalarize
Matt Arsenault [Fri, 25 Jan 2019 00:51:00 +0000 (00:51 +0000)]
GlobalISel: Add convenience mutatations to scalarize

llvm-svn: 352143

6 years agosimplify COFF module assembly test and move it to Object
Bob Haarman [Fri, 25 Jan 2019 00:33:05 +0000 (00:33 +0000)]
simplify COFF module assembly test and move it to Object

Reviewers: pcc, rnk

Subscribers: llvm-commits

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

llvm-svn: 352142

6 years agogn build: Build clang with -fno-strict-aliasing, make building with gcc much quieter
Nico Weber [Fri, 25 Jan 2019 00:29:17 +0000 (00:29 +0000)]
gn build: Build clang with -fno-strict-aliasing, make building with gcc much quieter

- gcc doesn't understand -Wstring-conversion, so pass that only to clang
- disable a few gcc warnings that are noisy and also disabled in the cmake build
- -Wstrict-aliasing pointed out that the cmake build builds clang with
  -fno-strict-aliasing, so do that too

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

llvm-svn: 352141

6 years agoTry to address Windows bot failure after r352080
Vedant Kumar [Fri, 25 Jan 2019 00:15:16 +0000 (00:15 +0000)]
Try to address Windows bot failure after r352080

See the bot error message reported in https://reviews.llvm.org/D57082.

Avoid trying to match full class names in -debug-pass-manager output,
because they aren't portable.

llvm-svn: 352138

6 years agoGlobalISel: Add helper to LLT to get a scalar or vector
Matt Arsenault [Fri, 25 Jan 2019 00:10:49 +0000 (00:10 +0000)]
GlobalISel: Add helper to LLT to get a scalar or vector

llvm-svn: 352136

6 years ago[GlobalISel][AArch64] Avoid unused variable warning for variable only used in assert
Benjamin Kramer [Thu, 24 Jan 2019 23:45:07 +0000 (23:45 +0000)]
[GlobalISel][AArch64] Avoid unused variable warning for variable only used in assert

llvm-svn: 352133

6 years ago[PowerPC] Exploit store instructions that store a single vector element
Nemanja Ivanovic [Thu, 24 Jan 2019 23:44:28 +0000 (23:44 +0000)]
[PowerPC] Exploit store instructions that store a single vector element

This patch exploits the instructions that store a single element from a vector
to preform a (store (extract_elt)). We already have code that does this with
ISA 3.0 instructions that were added to handle i8/i16 types. However, we had
never exploited the existing ones that handle f32/f64/i32/i64 types.

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

llvm-svn: 352131

6 years agoRegBankSelect: Fix use after free in r352123
Matt Arsenault [Thu, 24 Jan 2019 23:42:01 +0000 (23:42 +0000)]
RegBankSelect: Fix use after free in r352123

llvm-svn: 352130

6 years ago[GlobalISel][AArch64] Avoid unused function warnings in Release builds
Benjamin Kramer [Thu, 24 Jan 2019 23:39:47 +0000 (23:39 +0000)]
[GlobalISel][AArch64] Avoid unused function warnings in Release builds

llvm-svn: 352129

6 years agopdbutil: Remove unused variables
David Blaikie [Thu, 24 Jan 2019 23:13:20 +0000 (23:13 +0000)]
pdbutil: Remove unused variables

llvm-svn: 352128

6 years ago[x86] move half-size shuffle mask creation to helper; NFC
Sanjay Patel [Thu, 24 Jan 2019 23:12:36 +0000 (23:12 +0000)]
[x86] move half-size shuffle mask creation to helper; NFC

As noted in D57156, we want to check at least part of
this pattern earlier (in combining), so this will allow
the code to be shared instead of duplicated.

llvm-svn: 352127

6 years ago[GISel]: Change how CSE is enabled by default for each pass
Aditya Nandakumar [Thu, 24 Jan 2019 23:11:25 +0000 (23:11 +0000)]
[GISel]: Change how CSE is enabled by default for each pass

https://reviews.llvm.org/D57178

Now add a hook in TargetPassConfig to query if CSE needs to be
enabled. By default this hook returns false only for O0 opt level but
this can be overridden by the target.
As a consequence of the default of enabled for non O0, a few tests
needed to be updated to not use CSE (by passing in -O0) to the run
line.

reviewed by: arsenm

llvm-svn: 352126

6 years ago[clang-format] square parens with one token are not Objective-C message sends
Alex Lorenz [Thu, 24 Jan 2019 23:07:58 +0000 (23:07 +0000)]
[clang-format] square parens with one token are not Objective-C message sends

The commit r322690 introduced support for ObjC detection in header files.
Unfortunately some C headers that use designated initializers are now
incorrectly detected as Objective-C.
This commit fixes it by ensuring that `[ token ]` is not annotated as an
Objective-C message send.

rdar://45504376

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

llvm-svn: 352125

6 years agoSuppress unused capture warning in CheckCopy
Jessica Paquette [Thu, 24 Jan 2019 22:51:31 +0000 (22:51 +0000)]
Suppress unused capture warning in CheckCopy

Werror bots didn't like the lambda + assert thing in my previous commit.

Capture everything to suppress the error.

Example failure here:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/29393

llvm-svn: 352124

6 years agoRegBankSelect: Support some more complex part mappings
Matt Arsenault [Thu, 24 Jan 2019 22:47:04 +0000 (22:47 +0000)]
RegBankSelect: Support some more complex part mappings

llvm-svn: 352123

6 years agoAdd UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin
Jim Ingham [Thu, 24 Jan 2019 22:43:44 +0000 (22:43 +0000)]
Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin

We use UUID::fromOptionalData to read UUID's from the Mach-O files, so UUID's
of all 0's are invalid UUID's.
We also get uuid's from debugserver, which need to match the file UUID's.  So
we need an API that treats "000000000" as invalid as well.  Added that and use it.

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

llvm-svn: 352122

6 years ago[elfabi] Add support for reading dynamic symbols from binaries
Armando Montanez [Thu, 24 Jan 2019 22:39:21 +0000 (22:39 +0000)]
[elfabi] Add support for reading dynamic symbols from binaries

This patch adds initial support for reading dynamic symbols from ELF binaries. Currently, STT_NOTYPE, STT_OBJECT, STT_FUNC, and STT_TLS are explicitly supported. Other symbol types are mapped to ELFSymbolType::Unknown to improve signal/noise ratio.

Symbols must meet two criteria to be read into in an ELFStub:

 - The symbol's binding must be STB_GLOBAL or STB_WEAK.
 - The symbol's visibility must be STV_DEFAULT or STV_PROTECTED.

This filters out symbols that aren't of interest during compile-time linking against a shared object.

This change uses DT_HASH and DT_GNU_HASH to determine the size of .dynsym. Using hash tables to determine the number of symbols in .dynsym allows llvm-elfabi to work on binaries without relying on section headers.

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

llvm-svn: 352121

6 years ago[clang-cl] Ignore space-separated /AI arguments
Reid Kleckner [Thu, 24 Jan 2019 22:26:51 +0000 (22:26 +0000)]
[clang-cl] Ignore space-separated /AI arguments

The /AI flag is for #using directives, which I don't think we support.
This is consistent with how the /I flag is handled by MSVC.  Add a test
for it.

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

llvm-svn: 352119

6 years ago[PDB] Increase TPI hash bucket count.
Zachary Turner [Thu, 24 Jan 2019 22:25:55 +0000 (22:25 +0000)]
[PDB] Increase TPI hash bucket count.

PDBs contain several serialized hash tables. In the microsoft-pdb
repo published to support LLVM implementing PDB support, the
provided initializes the bucket count for the TPI and IPI streams
to the maximum size. This occurs in tpi.cpp L33 and tpi.cpp L398.
In the LLVM code for generating PDBs, these streams are created with
minimum number of buckets. This difference makes LLVM generated
PDBs slower for when used for debugging.

Patch by C.J. Hebert
Differential Revision: https://reviews.llvm.org/D56942

llvm-svn: 352117

6 years ago[Process/NetBSD] Add missing linkage to -lutil
Michal Gorny [Thu, 24 Jan 2019 22:20:47 +0000 (22:20 +0000)]
[Process/NetBSD] Add missing linkage to -lutil

Add missing linkage to fix build failure with LLD:

  ld: error: undefined symbol: kinfo_getvmmap
  >>> referenced by NativeProcessNetBSD.cpp
  >>>               NativeProcessNetBSD.cpp.o:(lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache()) in archive lib/liblldbPluginProcessNetBSD.a

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

llvm-svn: 352116

6 years agoAdd unittests to the Xcode gtest target.
Jim Ingham [Thu, 24 Jan 2019 22:03:36 +0000 (22:03 +0000)]
Add unittests to the Xcode gtest target.

A handful of test files had been added to lldb, but not to the
appropriate target in the Xcode project.  So they weren't being
run in the Xcode gtest run.  Add them here.

llvm-svn: 352114

6 years ago[GlobalISel][AArch64] Add isel support for FP16 vector @llvm.ceil
Jessica Paquette [Thu, 24 Jan 2019 22:00:41 +0000 (22:00 +0000)]
[GlobalISel][AArch64] Add isel support for FP16 vector @llvm.ceil

This patch adds support for vector @llvm.ceil intrinsics when full 16 bit
floating point support isn't available.

To do this, this patch...

- Implements basic isel for G_UNMERGE_VALUES
- Teaches the legalizer about 16 bit floats
- Teaches AArch64RegisterBankInfo to respect floating point registers on
  G_BUILD_VECTOR and G_UNMERGE_VALUES
- Teaches selectCopy about 16-bit floating point vectors

It also adds

- A legalizer test for the 16-bit vector ceil which verifies that we create a
  G_UNMERGE_VALUES and G_BUILD_VECTOR when full fp16 isn't supported
- An instruction selection test which makes sure we lower to G_FCEIL when
  full fp16 is supported
- A test for selecting G_UNMERGE_VALUES

And also updates arm64-vfloatintrinsics.ll to show that the new ceiling types
work as expected.

https://reviews.llvm.org/D56682

llvm-svn: 352113

6 years agoallow COFF .def directive in module assembly when using ThinLTO
Bob Haarman [Thu, 24 Jan 2019 21:41:03 +0000 (21:41 +0000)]
allow COFF .def directive in module assembly when using ThinLTO

Summary:
Using COFF's .def directive in module assembly used to crash ThinLTO
with "this directive only supported on COFF targets" when getting
symbol information in ModuleSymbolTable.  This change allows
ModuleSymbolTable to process such code and adds a test to verify that
the .def directive has the desired effect on the native object file,
with and without ThinLTO.

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

Reviewers: rnk, pcc, vlad.tsyrklevich

Subscribers: mehdi_amini, eraman, hiraditya, dexonsmith, llvm-commits

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

llvm-svn: 352112

6 years agoRemove NO_DEBUGINFO_TESTCASE from testcase.
Adrian Prantl [Thu, 24 Jan 2019 21:32:32 +0000 (21:32 +0000)]
Remove NO_DEBUGINFO_TESTCASE from testcase.

This makes it easier to exclude the test n bots that test earlier
DWARF formats, also it feels like this is the better decision for this
testcase anyway.

llvm-svn: 352111

6 years agoDefine the _fltused symbol in a couple tests post-r352076.
James Y Knight [Thu, 24 Jan 2019 21:31:43 +0000 (21:31 +0000)]
Define the _fltused symbol in a couple tests post-r352076.

Normally it's defined by MSCRT, but these tests are standalone, so
they need to define it themselves.

llvm-svn: 352110

6 years ago[Analysis] Fix isSafeToLoadUnconditionally handling of volatile.
Eli Friedman [Thu, 24 Jan 2019 21:31:13 +0000 (21:31 +0000)]
[Analysis] Fix isSafeToLoadUnconditionally handling of volatile.

A volatile operation cannot be used to prove an address points to normal
memory.  (LangRef was recently updated to state it explicitly.)

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

llvm-svn: 352109

6 years ago[WebAssembly] Add WebAssemblyImportModule to pragma-attribute-supported-attributes...
Dan Gohman [Thu, 24 Jan 2019 21:20:03 +0000 (21:20 +0000)]
[WebAssembly] Add WebAssemblyImportModule to pragma-attribute-supported-attributes-list.test

llvm-svn: 352108

6 years ago[libFuzzer] more agressive value profiling and CMP tracing for switch statements
Kostya Serebryany [Thu, 24 Jan 2019 21:08:54 +0000 (21:08 +0000)]
[libFuzzer] more agressive value profiling and CMP tracing for switch statements

llvm-svn: 352107

6 years ago[WebAssembly] Add an import_module function attribute
Dan Gohman [Thu, 24 Jan 2019 21:08:30 +0000 (21:08 +0000)]
[WebAssembly] Add an import_module function attribute

This adds a C/C++ attribute which corresponds to the LLVM IR wasm-import-module
attribute. It allows code to specify an explicit import module.

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

llvm-svn: 352106

6 years ago[WebAssembly] Add a __wasi__ target macro
Dan Gohman [Thu, 24 Jan 2019 21:05:11 +0000 (21:05 +0000)]
[WebAssembly] Add a __wasi__ target macro

This adds a `__wasi__` macro for the wasi OS, similar to `__linux__` etc. for
other OS's.

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

llvm-svn: 352105

6 years agoLimit dyld image suffixes guessed by guessLibraryShortName()
Michael Trent [Thu, 24 Jan 2019 20:59:44 +0000 (20:59 +0000)]
Limit dyld image suffixes guessed by guessLibraryShortName()

Summary:
guessLibraryShortName() separates a full Mach-O dylib install name path
into a short name and a dyld image suffix. The short name is the name
of the dylib without its path or extension. The dyld image suffix is a
string used by dyld to load variants of dylibs if available at runtime;
for example, "when binding this process, load 'debug' variants of all
required dylibs." dyld knows exactly what the image suffix is, but
by convention diagnostic tools such as llvm-nm attempt to guess suffix
names by looking at the install name path.

These dyld image suffixes are separated from the short name by a '_'
character. Because the '_' character is commonly used to separate words
in filenames guessLibraryShortName() cannot reliably separate a dylib's
short name from an arbitrary image suffix; imagine if both the short
name and the suffix contains an '_' character! To better deal with this
ambiguity, guessLibraryShortName() will recognize only "_debug" and
"_profile" as valid Suffix values. Calling code needs to be tolerant of
guessLibraryShortName() guessing incorrectly.

The previous implementation of guessLibraryShortName() did not allow
'_' characters to appear in short names. When present, the short name
would be  truncated, e.g., "libcompiler_rt" => "libcompiler". This
change allows "libcompiler_rt" and "libcompiler_rt_debug" to both be
recognized as "libcompiler_rt".

rdar://47412244

Reviewers: kledzik, lhames, pete

Reviewed By: pete

Subscribers: llvm-commits

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

llvm-svn: 352104

6 years ago[Scalar] Clarify the constructor from APInt and document through a test.
Davide Italiano [Thu, 24 Jan 2019 20:55:12 +0000 (20:55 +0000)]
[Scalar] Clarify the constructor from APInt and document through a test.

I want to add 512-bits support but I first want to make sure I'm
not breaking anything obvious. This is the first of a series of commit
adding tests. The first oddity found is that Scalar from APInt(s)
always constructed signed. Maybe at some point we want to revisit
this, but at least now we have a test to document how the API behaves.

<rdar://problem/46886288>

llvm-svn: 352103

6 years agoAdd a triple to this test so it passes for targets where alignof(double)
Richard Smith [Thu, 24 Jan 2019 20:52:56 +0000 (20:52 +0000)]
Add a triple to this test so it passes for targets where alignof(double)
really should be equal to alignof(float).

llvm-svn: 352102

6 years ago[WebAssembly] Support __float128
Dan Gohman [Thu, 24 Jan 2019 20:33:28 +0000 (20:33 +0000)]
[WebAssembly] Support __float128

This enables support for the "__float128" keyword.

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

llvm-svn: 352100

6 years ago[WebAssembly] Factor commonality between wasm32 and wasm64 in test/Preprocessor/init.c
Dan Gohman [Thu, 24 Jan 2019 20:31:11 +0000 (20:31 +0000)]
[WebAssembly] Factor commonality between wasm32 and wasm64 in test/Preprocessor/init.c

Use the -check-prefixes= feature to merge most of the WEBASSEMBLY32 and
WEBASSEMBLY64 test checks into a shared WEBASSEMBLY test check.

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

llvm-svn: 352099

6 years agoFix a compiler error introduced in r352093.
Haojian Wu [Thu, 24 Jan 2019 20:30:48 +0000 (20:30 +0000)]
Fix a compiler error introduced in r352093.

llvm-svn: 352098

6 years agoMark awk.pass.cpp as XFAIL for NetBSD
Kamil Rytarowski [Thu, 24 Jan 2019 20:26:02 +0000 (20:26 +0000)]
Mark awk.pass.cpp as XFAIL for NetBSD

Reported on the NetBSD 8 build bot.

llvm-svn: 352097

6 years agogn build: Merge r351990
Nico Weber [Thu, 24 Jan 2019 20:19:18 +0000 (20:19 +0000)]
gn build: Merge r351990

llvm-svn: 352096

6 years agoOnly check the dwarf version when using the dwarf category
Adrian Prantl [Thu, 24 Jan 2019 20:09:17 +0000 (20:09 +0000)]
Only check the dwarf version when using the dwarf category

llvm-svn: 352094

6 years ago[LICM] Cleanup duplicated code. [NFCI]
Alina Sbirlea [Thu, 24 Jan 2019 19:57:30 +0000 (19:57 +0000)]
[LICM] Cleanup duplicated code. [NFCI]

llvm-svn: 352093

6 years ago[MemorySSA +LICM CFHoist] Solve PR40317.
Alina Sbirlea [Thu, 24 Jan 2019 19:48:35 +0000 (19:48 +0000)]
[MemorySSA +LICM CFHoist] Solve PR40317.

Summary:
MemorySSA needs updating each time an instruction is moved.
LICM and control flow hoisting re-hoists instructions, thus needing another update when re-moving those instructions.
Pending cleanup: the MSSA update is duplicated, should be moved inside moveInstructionBefore.

Reviewers: jnspaulsson

Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits

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

llvm-svn: 352092

6 years agoTest cases for demanded elements on vector GEPs
Philip Reames [Thu, 24 Jan 2019 19:35:28 +0000 (19:35 +0000)]
Test cases for demanded elements on vector GEPs

This is the first part of splitting apart https://reviews.llvm.org/D57140 into usuable pieces.  Landing the tests in advance of posting a review specifically for the demanded elements part.

llvm-svn: 352091

6 years ago[NFC][clang] Test updates for CreateAlignmentAssumption() changes in D54653
Roman Lebedev [Thu, 24 Jan 2019 19:32:49 +0000 (19:32 +0000)]
[NFC][clang] Test updates for CreateAlignmentAssumption() changes in D54653

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

llvm-svn: 352090

6 years ago[IRBuilder] Remove positivity check from CreateAlignmentAssumption()
Roman Lebedev [Thu, 24 Jan 2019 19:32:48 +0000 (19:32 +0000)]
[IRBuilder] Remove positivity check from CreateAlignmentAssumption()

Summary:
An alignment should be non-zero positive power-of-two, anything and everything else is UB.
We should not have that check for all these prerequisites here, it's just UB.
Also, that was likely confusing middle-end passes.

While there, `CreateIntCast()` should be called with `/*isSigned*/ false`.
Think about it, there are two explanations: "An alignment should be positive",
therefore the sign bit is unset, so `zext` and `sext` is equivalent.
Or a second one: you have `i2 0b10` - a valid alignment,
now you `sext` it: `i2 0b110` - no longer valid alignment.

Reviewers: craig.topper, jyknight, hfinkel, erichkeane, rjmccall

Reviewed By: hfinkel, rjmccall

Subscribers: hfinkel, llvm-commits

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

llvm-svn: 352089

6 years ago[clang-tidy] Rename the absl duration helper functions; NFC
Hyrum Wright [Thu, 24 Jan 2019 19:23:50 +0000 (19:23 +0000)]
[clang-tidy] Rename the absl duration helper functions; NFC

llvm-svn: 352088

6 years agoD14686: 'Protect against overloaded comma in random_shuffle and improve tests' I...
Marshall Clow [Thu, 24 Jan 2019 19:20:19 +0000 (19:20 +0000)]
D14686: 'Protect against overloaded comma in random_shuffle and improve tests' I had to cut back on the tests with this, because they were not C++03 friendly. Thanks to gribozavr for the patch

llvm-svn: 352087

6 years agoUnbreak windows bots
Adrian Prantl [Thu, 24 Jan 2019 19:16:45 +0000 (19:16 +0000)]
Unbreak windows bots

llvm-svn: 352086

6 years agoDisable LSan on NetBSD
Kamil Rytarowski [Thu, 24 Jan 2019 19:15:53 +0000 (19:15 +0000)]
Disable LSan on NetBSD

This no longer builds after refactoring and needs restoration.
Additionally the checked in support was incomplete.

llvm-svn: 352085

6 years agoAdd a priority field to availability attributes to prioritize explicit
Alex Lorenz [Thu, 24 Jan 2019 19:14:39 +0000 (19:14 +0000)]
Add a priority field to availability attributes to prioritize explicit
attributes from declaration over attributes from '#pragma clang attribute'

Before this commit users had an issue when using #pragma clang attribute with
availability attributes:

The explicit attribute that's specified next to the declaration is not
guaranteed to be preferred over the attribute specified in the pragma.

This commit fixes this by introducing a priority field to the availability
attribute to control how they're merged. Attributes with higher priority are
applied over attributes with lower priority for the same platform. The
implicitly inferred attributes are given the lower priority. This ensures that:

- explicit attributes are preferred over all other attributes.
- implicitly inferred attributes that are inferred from an explicit attribute
  are discarded if there's an explicit attribute or an attribute specified
  using a #pragma for the same platform.
- implicitly inferred attributes that are inferred from an attribute in the
  #pragma are not used if there's an explicit, explicit #pragma, or an
  implicit attribute inferred from an explicit attribute for the declaration.

This is the resulting ranking:

`platform availability > platform availability from pragma > inferred availability > inferred availability from pragma`

rdar://46390243

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

llvm-svn: 352084

6 years ago[libcxx] Portability fix: unordered_set and unordered_multiset iterators are not...
Louis Dionne [Thu, 24 Jan 2019 19:09:22 +0000 (19:09 +0000)]
[libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same

The unordered_set and unordered_multiset iterators are specified in the standard as follows:

using iterator             = implementation-defined; // see [container.requirements]
using const_iterator       = implementation-defined; // see [container.requirements]
using local_iterator       = implementation-defined; // see [container.requirements]
using const_local_iterator = implementation-defined; // see [container.requirements]

The pairs iterator/const_iterator and local_iterator/const_local_iterator
are not required to be the same. The reasonable requirement would be that
iterator can convert to const_iterator and local_iterator can convert to
const_local_iterator. This patch weakens the check and makes the test
more portable.

Reviewed as https://reviews.llvm.org/D56493.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 352083

6 years agoFix broken export table if .rdata is merged with .text.
Rui Ueyama [Thu, 24 Jan 2019 19:02:31 +0000 (19:02 +0000)]
Fix broken export table if .rdata is merged with .text.

Previously, we assumed that .rdata is zero-filled, so when writing
an COFF import table, we didn't write anything if the data is zero.
That assumption was wrong because .rdata can be merged with .text.
If .rdata is merged with .text, they are initialized with 0xcc which
is a trap instruction.

This patch removes that assumption from code.

Should be merged to 8.0 branch as this is a regression.

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

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

llvm-svn: 352082

6 years ago[X86] Regenerate SBB test to fix buildbots.
Simon Pilgrim [Thu, 24 Jan 2019 18:57:48 +0000 (18:57 +0000)]
[X86] Regenerate SBB test to fix buildbots.

Some local WIP code unexpectedly managed to get in the way.

llvm-svn: 352081

6 years ago[HotColdSplit] Move splitting earlier in the pipeline
Vedant Kumar [Thu, 24 Jan 2019 18:55:49 +0000 (18:55 +0000)]
[HotColdSplit] Move splitting earlier in the pipeline

Performing splitting early has several advantages:

  - Inhibiting inlining of cold code early improves code size. Compared
    to scheduling splitting at the end of the pipeline, this cuts code
    size growth in half within the iOS shared cache (0.69% to 0.34%).

  - Inhibiting inlining of cold code improves compile time. There's no
    need to inline split cold functions, or to inline as much *within*
    those split functions as they are marked `minsize`.

  - During LTO, extra work is only done in the pre-link step. Less code
    must be inlined during cross-module inlining.

An additional motivation here is that the most common cold regions
identified by the static/conservative splitting heuristic can (a) be
found before inlining and (b) do not grow after inlining. E.g.
__assert_fail, os_log_error.

The disadvantages are:

  - Some opportunities for splitting out cold code may be missed. This
    gap can potentially be narrowed by adding a worklist algorithm to the
    splitting pass.

  - Some opportunities to reduce code size may be lost (e.g. store
    sinking, when one side of the CFG diamond is split). This does not
    outweigh the code size benefits of splitting earlier.

On net, splitting early in the pipeline has substantial code size
benefits, and no major effects on memory locality or performance. We
measured memory locality using ktrace data, and consistently found that
10% fewer pages were needed to capture 95% of text page faults in key
iOS benchmarks. We measured performance on frequency-stabilized iOS
devices using LNT+externals.

This reverses course on the decision made to schedule splitting late in
r344869 (D53437).

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

llvm-svn: 352080

6 years ago[FileManager] Revert r347205 to avoid PCH file-descriptor leak.
Sam McCall [Thu, 24 Jan 2019 18:55:24 +0000 (18:55 +0000)]
[FileManager] Revert r347205 to avoid PCH file-descriptor leak.

Summary:
r347205 fixed a bug in FileManager: first calling
getFile(shouldOpen=false) and then getFile(shouldOpen=true) results in
the file not being open.

Unfortunately, some code was (inadvertently?) relying on this bug: when
building with a PCH, the file entries are obtained first by passing
shouldOpen=false, and then later shouldOpen=true, without any intention
of reading them. After r347205, they do get unneccesarily opened.
Aside from extra operations, this means they need to be closed. Normally
files are closed when their contents are read. As these files are never
read, they stay open until clang exits. On platforms with a low
open-files limit (e.g. Mac), this can lead to spurious file-not-found
errors when building large projects with PCH enabled, e.g.
  https://bugs.chromium.org/p/chromium/issues/detail?id=924225

Fixing the callsites to pass shouldOpen=false when the file won't be
read is not quite trivial (that info isn't available at the direct
callsite), and passing shouldOpen=false is a performance regression (it
results in open+fstat pairs being replaced by stat+open).

So an ideal fix is going to be a little risky and we need some fix soon
(especially for the llvm 8 branch).
The problem addressed by r347205 is rare and has only been observed in
clangd. It was present in llvm-7, so we can live with it for now.

Reviewers: bkramer, thakis

Subscribers: ilya-biryukov, ioeric, kadircet, cfe-commits

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

llvm-svn: 352079

6 years ago[CMake] Remove duplicated cache variable. NFC.
Alex Langford [Thu, 24 Jan 2019 18:52:19 +0000 (18:52 +0000)]
[CMake] Remove duplicated cache variable. NFC.

llvm-svn: 352078

6 years ago[x86] rename VectorShuffle -> Shuffle; NFC
Sanjay Patel [Thu, 24 Jan 2019 18:52:12 +0000 (18:52 +0000)]
[x86] rename VectorShuffle -> Shuffle; NFC

This wasn't consistent within the file, so made it harder to search.
Standardize on the shorter name to save some typing.

llvm-svn: 352077

6 years agoFix emission of _fltused for MSVC.
James Y Knight [Thu, 24 Jan 2019 18:34:00 +0000 (18:34 +0000)]
Fix emission of _fltused for MSVC.

It should be emitted when any floating-point operations (including
calls) are present in the object, not just when calls to printf/scanf
with floating point args are made.

The difference caused by this is very subtle: in static (/MT) builds,
on x86-32, in a program that uses floating point but doesn't print it,
the default x87 rounding mode may not be set properly upon
initialization.

This commit also removes the walk of the types pointed to by pointer
arguments in calls. (To assist in opaque pointer types migration --
eventually the pointee type won't be available.)

That latter implies that it will no longer consider a call like
`scanf("%f", &floatvar)` as sufficient to emit _fltused on its
own. And without _fltused, `scanf("%f")` will abort with error R6002. This
new behavior is unlikely to bite anyone in practice (you'd have to
read a float, and do nothing with it!), and also, is consistent with
MSVC.

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

llvm-svn: 352076

6 years ago[X86] Add PR25858 test cases
Simon Pilgrim [Thu, 24 Jan 2019 18:30:45 +0000 (18:30 +0000)]
[X86] Add PR25858 test cases

llvm-svn: 352075

6 years agolld/coff: Rename two tests from .s to .test
Nico Weber [Thu, 24 Jan 2019 18:30:33 +0000 (18:30 +0000)]
lld/coff: Rename two tests from .s to .test

llvm-svn: 352074

6 years agoRename test directory
Adrian Prantl [Thu, 24 Jan 2019 18:24:17 +0000 (18:24 +0000)]
Rename test directory

llvm-svn: 352073

6 years agoAdd decorator support for the DWARF version produced by the compiler
Adrian Prantl [Thu, 24 Jan 2019 18:24:14 +0000 (18:24 +0000)]
Add decorator support for the DWARF version produced by the compiler
and mark up some tests failing in
  http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/

llvm-svn: 352072

6 years ago[PPC64] Reland r351978 'Sort .toc sections accessed with small code model ...'
Sean Fertile [Thu, 24 Jan 2019 18:17:40 +0000 (18:17 +0000)]
[PPC64] Reland r351978 'Sort .toc sections accessed with small code model ...'

Guessing that the slashes used in the scripts SECTION command was causing the
windows related failures in the added test.

Original commit message:
Small code model global variable access on PPC64 has a very limited range of
addressing. The instructions the relocations are used on add an offset in the
range [-0x8000, 0x7FFC] to the toc pointer which points to .got +0x8000, giving
an addressable range of [.got, .got + 0xFFFC]. While user code can be recompiled
with medium and large code models when the binary grows too large for small code
model, there are small code model relocations in the crt files and libgcc.a
which are typically shipped with the distros, and the ABI dictates that linkers
must allow linking of relocatable object files using different code models.

To minimze the chance of relocation overflow, any file that contains a small
code model relocation should have its .toc section placed closer to the .got
then any .toc from a file without small code model relocations.

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

llvm-svn: 352071

6 years agoUntabify.
Rui Ueyama [Thu, 24 Jan 2019 18:17:17 +0000 (18:17 +0000)]
Untabify.

llvm-svn: 352070

6 years agoRevert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of...
Julian Lettner [Thu, 24 Jan 2019 18:04:21 +0000 (18:04 +0000)]
Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls"

This reverts commit cea84ab93aeb079a358ab1c8aeba6d9140ef8b47.

llvm-svn: 352069

6 years agoPartial support of SHT_GROUP without flag
Serge Guelton [Thu, 24 Jan 2019 17:56:08 +0000 (17:56 +0000)]
Partial support of SHT_GROUP without flag

This does *not* implement full SHT_GROUP semantic, yet it is a simple step forward:
Sections within a group are still considered valid, but they do not behave as
specified by the standard in case of garbage collection.

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

llvm-svn: 352068

6 years ago[SelectionDAGBuilder] Simplify HasSideEffect calculation. NFC.
Nirav Dave [Thu, 24 Jan 2019 17:56:03 +0000 (17:56 +0000)]
[SelectionDAGBuilder] Simplify HasSideEffect calculation. NFC.

llvm-svn: 352067

6 years ago[InlineAsm] Don't calculate registers for inline asm memory operands. NFCI.
Nirav Dave [Thu, 24 Jan 2019 17:47:18 +0000 (17:47 +0000)]
[InlineAsm] Don't calculate registers for inline asm memory operands. NFCI.

llvm-svn: 352066

6 years agoMark another test as flaky
Kamil Rytarowski [Thu, 24 Jan 2019 17:17:55 +0000 (17:17 +0000)]
Mark another test as flaky

Reported on the NetBSD 8 buildbot.

llvm-svn: 352064

6 years ago[x86] add low/high undef half shuffle mask helpers; NFC
Sanjay Patel [Thu, 24 Jan 2019 17:05:02 +0000 (17:05 +0000)]
[x86] add low/high undef half shuffle mask helpers; NFC

This is the most common usage for isUndefInRange,
so make the code slightly less duplicated and more
readable.

llvm-svn: 352063

6 years ago[RS4GC] Expand/standardize tests introduced in rL352059
Philip Reames [Thu, 24 Jan 2019 16:45:23 +0000 (16:45 +0000)]
[RS4GC] Expand/standardize tests introduced in rL352059

Write a couple of variations on vector geps w/both scalars and vectors live over safepoints.  Use update_test_checks to show all the IR.

llvm-svn: 352062

6 years ago[RS4GC] Be slightly less conservative for gep vector_base, scalar_idx
Philip Reames [Thu, 24 Jan 2019 16:34:00 +0000 (16:34 +0000)]
[RS4GC] Be slightly less conservative for gep vector_base, scalar_idx

After submitting https://reviews.llvm.org/D57138, I realized it was slightly more conservative than needed. The scalar indices don't appear to be a problem on a vector gep, we even had a test for that.

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

llvm-svn: 352061

6 years agoFix failing buildbots
Gabor Marton [Thu, 24 Jan 2019 16:27:21 +0000 (16:27 +0000)]
Fix failing buildbots

Fix remaining unittest errors caused by
__attribute__((no_caller_saved_registers))
Related commit which caused the buildbots to fail:
rL352050

llvm-svn: 352060

6 years ago[RS4GC] Avoid crashing on gep scalar_base, vector_idx
Philip Reames [Thu, 24 Jan 2019 16:08:18 +0000 (16:08 +0000)]
[RS4GC] Avoid crashing on gep scalar_base, vector_idx

This is an alternative to https://reviews.llvm.org/D57103.  After discussion, we dedicided to check this in as a temporary workaround, and pursue a true fix under the original thread.

The issue at hand is that the base rewriting algorithm doesn't consider the fact that GEPs can turn a scalar input into a vector of outputs. We had handling for scalar GEPs and fully vector GEPs (i.e. all vector operands), but not the scalar-base + vector-index forms. A true fix here requires treating GEP analogously to extractelement or shufflevector.

This patch is merely a workaround. It simply hides the crash at the cost of some ugly code gen for this presumable very rare pattern.

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

llvm-svn: 352059

6 years ago[CMake] Get back some variables used in AddLLVM.cmake
Stefan Granitz [Thu, 24 Jan 2019 16:02:21 +0000 (16:02 +0000)]
[CMake] Get back some variables used in AddLLVM.cmake

This fixes 'gtest/gtest.h' file not found when building unit tests after r351863.

llvm-svn: 352058

6 years ago[scudo] Tuning changes based on feedback from current use
Kostya Kortchinsky [Thu, 24 Jan 2019 15:56:54 +0000 (15:56 +0000)]
[scudo] Tuning changes based on feedback from current use

Summary:
This tunes several of the default parameters used within the allocator:
- disable the deallocation type mismatch on Android by default; this
  was causing too many issues with third party libraries;
- change the default `SizeClassMap` to `Dense`, it caches less entries
  and is way more memory efficient overall;
- relax the timing of the RSS checks, 10 times per second was too much,
  lower it to 4 times (every 250ms), and update the test so that it
  passes with the new default.

Reviewers: eugenis

Reviewed By: eugenis

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

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

llvm-svn: 352057

6 years ago[TargetLowering] Rename getExpandedFixedPointMultiplication to expandFixedPointMul...
Simon Pilgrim [Thu, 24 Jan 2019 15:46:54 +0000 (15:46 +0000)]
[TargetLowering] Rename getExpandedFixedPointMultiplication to expandFixedPointMul. NFCI.

Match the (much shorter) name used in various legalization methods.

llvm-svn: 352056

6 years agoFix failing buildbots
Gabor Marton [Thu, 24 Jan 2019 15:42:20 +0000 (15:42 +0000)]
Fix failing buildbots

Related commit which caused the buildbots to fail:
rL352050

llvm-svn: 352055

6 years ago[CPU-Dispatch] Make pentium_iii_no_xmm_regs and pentium_iii alias.
Erich Keane [Thu, 24 Jan 2019 15:28:57 +0000 (15:28 +0000)]
[CPU-Dispatch] Make pentium_iii_no_xmm_regs and pentium_iii alias.

I discovered that in ICC (where this list comes from), that the two
pentium_iii versions were actually identical despite the two different
names (despite them implying a difference). Because of this, they ended
up having identical manglings, which obviously caused problems when used
together.

This patch makes pentium_iii_no_xmm_regs an alias for pentium_iii so
that it can still be used, but has the same meaning as ICC. However, we
still prohibit using the two together which is different (albeit better)
behavior.

Change-Id: I4f3c9a47e48490c81525c8a3d23ed4201921b288
llvm-svn: 352054

6 years ago[SelectionDAGBuilder] Fuse inline asm input operand loops passes. NFCI.
Nirav Dave [Thu, 24 Jan 2019 15:15:32 +0000 (15:15 +0000)]
[SelectionDAGBuilder] Fuse inline asm input operand loops passes. NFCI.

llvm-svn: 352053

6 years ago[Docs] Add information about unit tests to the testing guide
Michael Platings [Thu, 24 Jan 2019 15:11:26 +0000 (15:11 +0000)]
[Docs] Add information about unit tests to the testing guide

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

llvm-svn: 352052

6 years ago[X86] Add missing isReg() guards in FixupSetCCs pass.
Nirav Dave [Thu, 24 Jan 2019 15:04:17 +0000 (15:04 +0000)]
[X86] Add missing isReg() guards in FixupSetCCs pass.

llvm-svn: 352051