platform/upstream/llvm.git
7 years agoRemove unneeded typename from test
Roger Ferrer Ibanez [Tue, 10 Oct 2017 07:42:19 +0000 (07:42 +0000)]
Remove unneeded typename from test

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

llvm-svn: 315278

7 years ago[clang-tidy] Use a more efficient map for the virtual near miss check.
Benjamin Kramer [Tue, 10 Oct 2017 07:21:51 +0000 (07:21 +0000)]
[clang-tidy] Use a more efficient map for the virtual near miss check.

DenseMap performs better here. No functionality change intended.

llvm-svn: 315277

7 years ago[ASTMatchers] Don't create a copy of a std::set when iterating over it.
Benjamin Kramer [Tue, 10 Oct 2017 07:21:34 +0000 (07:21 +0000)]
[ASTMatchers] Don't create a copy of a std::set when iterating over it.

This is a bit awkward because lookup returns a copy instead of a
reference. No functionality change intended.

llvm-svn: 315276

7 years ago[RISCV] Fix build after r315254
Alex Bradbury [Tue, 10 Oct 2017 07:19:18 +0000 (07:19 +0000)]
[RISCV] Fix build after r315254

createELFObjectWriter now takes a std::unique_ptr<MCELFObjectTargetWriter>
rather than a MCELFObjectTargetWriter*.

llvm-svn: 315275

7 years ago[AVX512] Add patterns to commute integer comparison instructions during isel.
Craig Topper [Tue, 10 Oct 2017 06:36:46 +0000 (06:36 +0000)]
[AVX512] Add patterns to commute integer comparison instructions during isel.

This enables broadcast loads to be commuted and allows normal loads to be folded without the peephole pass.

llvm-svn: 315274

7 years ago[COFF] Don't error out on relocations to discarded sections in .eh_frame
Martin Storsjo [Tue, 10 Oct 2017 06:05:29 +0000 (06:05 +0000)]
[COFF] Don't error out on relocations to discarded sections in .eh_frame

This allows linking code with dwarf exception handling.

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

llvm-svn: 315273

7 years ago Renable r314928
Xinliang David Li [Tue, 10 Oct 2017 05:07:54 +0000 (05:07 +0000)]
 Renable r314928

 Eliminate inttype phi with inttoptr/ptrtoint.

 This version fixed a bug in finding the matching
 phi -- the order of the incoming blocks may be
 different (triggered in self build on Windows).
 A new test case is added.

llvm-svn: 315272

7 years agoMake a local variable name shorter. NFC.
Rui Ueyama [Tue, 10 Oct 2017 04:53:14 +0000 (04:53 +0000)]
Make a local variable name shorter. NFC.

llvm-svn: 315271

7 years agoSimplify.
Rui Ueyama [Tue, 10 Oct 2017 04:45:48 +0000 (04:45 +0000)]
Simplify.

llvm-svn: 315270

7 years agoRemove dead function.
Rui Ueyama [Tue, 10 Oct 2017 03:58:32 +0000 (03:58 +0000)]
Remove dead function.

llvm-svn: 315269

7 years agoAdd comments.
Rui Ueyama [Tue, 10 Oct 2017 03:58:18 +0000 (03:58 +0000)]
Add comments.

llvm-svn: 315268

7 years agoAdd more comments.
Rui Ueyama [Tue, 10 Oct 2017 03:40:57 +0000 (03:40 +0000)]
Add more comments.

llvm-svn: 315267

7 years agoAdd comment to InputSectionBase::File.
Rui Ueyama [Tue, 10 Oct 2017 03:22:29 +0000 (03:22 +0000)]
Add comment to InputSectionBase::File.

This patch also moves declarations so that related declarations next
to each other.

llvm-svn: 315266

7 years agoRemove dead function.
Rui Ueyama [Tue, 10 Oct 2017 03:01:41 +0000 (03:01 +0000)]
Remove dead function.

llvm-svn: 315265

7 years ago[MC] Properly diagnose badly scoped .cfi_ directives
Reid Kleckner [Tue, 10 Oct 2017 01:49:21 +0000 (01:49 +0000)]
[MC] Properly diagnose badly scoped .cfi_ directives

Removes two report_fatal_errors.

Implement this by removing EmitCFICommon, and do the checking in
getCurrentDwarfFrameInfo. Have the callers check for null before
dereferencing it.

llvm-svn: 315264

7 years agoGive a test a triple
Reid Kleckner [Tue, 10 Oct 2017 01:34:31 +0000 (01:34 +0000)]
Give a test a triple

llvm-svn: 315263

7 years ago[SEH] Use reportError instead of report_fatal_error for bad directives
Reid Kleckner [Tue, 10 Oct 2017 01:26:25 +0000 (01:26 +0000)]
[SEH] Use reportError instead of report_fatal_error for bad directives

This makes the .seh_ directives slightly more usable from standalone
assembly files.

This removes a large number of report_fatal_errors and recovers from the
error by ignoring the directive.

llvm-svn: 315262

7 years ago[Sema][ObjC] Preserve syntactic sugar when removing
Akira Hatanaka [Tue, 10 Oct 2017 01:24:33 +0000 (01:24 +0000)]
[Sema][ObjC] Preserve syntactic sugar when removing
ARCReclaimReturnedObject cast.

This is a follow-up to r314370.

Rather than throwing away the enclosing parentheses, this commit walks
down the expression until an ARCReclaimReturnedObject cast is found and
removes just the cast, preserving the syntactic sugar expressions
(parens and casts) that were visited up to that point.

rdar://problem/34705720

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

llvm-svn: 315261

7 years ago[MC] Plumb unique_ptr<MCWasmObjectTargetWriter> through createWasmObjectWriter
Lang Hames [Tue, 10 Oct 2017 01:15:10 +0000 (01:15 +0000)]
[MC] Plumb unique_ptr<MCWasmObjectTargetWriter> through createWasmObjectWriter
to WasmObjectWriter's constructor.

Fixes the same ownership issue for COFF that r315245 did for MachO:
WasmObjectWriter takes ownership of its MCWasmObjectTargetWriter, so we want to
pass this through to the constructor via a unique_ptr, rather than a raw ptr.

llvm-svn: 315260

7 years ago[MC] Suppress .Lcfi labels when emitting textual assembly
Reid Kleckner [Tue, 10 Oct 2017 00:57:36 +0000 (00:57 +0000)]
[MC] Suppress .Lcfi labels when emitting textual assembly

Summary:
This suppresses the generation of .Lcfi labels in our textual assembler.
It was annoying that this generated cascading .Lcfi labels:
  llc foo.ll -o - | llvm-mc | llvm-mc

After three trips through MCAsmStreamer, we'd have three labels in the
output when none are necessary. We should only bother creating the
labels and frame data when making a real object file.

This supercedes D38605, which moved the entire .seh_ implementation into
MCObjectStreamer.

This has the advantage that we do more checking when emitting textual
assembly, as a minor efficiency cost. Outputting textual assembly is not
performance critical, so this shouldn't matter.

Reviewers: majnemer, MatzeB

Subscribers: qcolombet, nemanjai, javed.absar, eraman, hiraditya, JDevlieghere, llvm-commits

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

llvm-svn: 315259

7 years agoFix Wasm build after r315254
Reid Kleckner [Tue, 10 Oct 2017 00:52:40 +0000 (00:52 +0000)]
Fix Wasm build after r315254

llvm-svn: 315258

7 years ago[MC] Plumb unique_ptr<MCWinCOFFObjectTargetWriter> through
Lang Hames [Tue, 10 Oct 2017 00:50:29 +0000 (00:50 +0000)]
[MC] Plumb unique_ptr<MCWinCOFFObjectTargetWriter> through
createWinCOFFObjectWriter to WinCOFFObjectWriter's constructor.

Fixes the same ownership issue for COFF that r315245 did for MachO:
WinCOFFObjectWriter takes ownership of its MCWinCOFFObjectTargetWriter, so we
want to pass this through to the constructor via a unique_ptr, rather than a
raw ptr.

llvm-svn: 315257

7 years ago[Modules TS] Avoid computing the linkage of the enclosing DeclContext for a declarati...
Richard Smith [Tue, 10 Oct 2017 00:49:38 +0000 (00:49 +0000)]
[Modules TS] Avoid computing the linkage of the enclosing DeclContext for a declaration in the global module.

This works around a language issue where adding a typedef name for linkage
purposes changes the linkage of an already-defined class after it becomes
complete.

llvm-svn: 315256

7 years agoR13575: Fix USR mangling for function pointer types
Jan Korous [Tue, 10 Oct 2017 00:35:16 +0000 (00:35 +0000)]
R13575: Fix USR mangling for function pointer types

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

llvm-svn: 315255

7 years ago[MC] Plumb unique_ptr<MCELFObjectTargetWriter> through createELFObjectWriter to
Lang Hames [Mon, 9 Oct 2017 23:53:15 +0000 (23:53 +0000)]
[MC] Plumb unique_ptr<MCELFObjectTargetWriter> through createELFObjectWriter to
ELFObjectWriter's constructor.

Fixes the same ownership issue for ELF that r315245 did for MachO:
ELFObjectWriter takes ownership of its MCELFObjectTargetWriter, so we want to
pass this through to the constructor via a unique_ptr, rather than a raw ptr.

llvm-svn: 315254

7 years agoRename OptimizationDiagnosticInfo.h to OptimizationRemarkEmitter.h
Adam Nemet [Mon, 9 Oct 2017 23:49:08 +0000 (23:49 +0000)]
Rename OptimizationDiagnosticInfo.h to OptimizationRemarkEmitter.h

Polly version of r315249 on LLVM trunk.

llvm-svn: 315253

7 years agoFix typos in documentation
Jan Korous [Mon, 9 Oct 2017 23:45:20 +0000 (23:45 +0000)]
Fix typos in documentation

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

llvm-svn: 315252

7 years ago[Modules TS] Module ownership semantics for redeclarations.
Richard Smith [Mon, 9 Oct 2017 23:42:09 +0000 (23:42 +0000)]
[Modules TS] Module ownership semantics for redeclarations.

When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

llvm-svn: 315251

7 years ago[Analyzer] Do not segfault on unexpected call_once implementation
George Karpenkov [Mon, 9 Oct 2017 23:20:46 +0000 (23:20 +0000)]
[Analyzer] Do not segfault on unexpected call_once implementation

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

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

llvm-svn: 315250

7 years agoRename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.*
Adam Nemet [Mon, 9 Oct 2017 23:19:02 +0000 (23:19 +0000)]
Rename OptimizationDiagnosticInfo.* to OptimizationRemarkEmitter.*

Sync it up with the name of the class actually defined here.  This has been
bothering me for a while...

llvm-svn: 315249

7 years ago[llvm-rc] Try again to fix errors on big endian systems.
Zachary Turner [Mon, 9 Oct 2017 22:59:40 +0000 (22:59 +0000)]
[llvm-rc] Try again to fix errors on big endian systems.

llvm-svn: 315248

7 years ago[ubsan] Fix Asan internal alloc corruption in PR33221 test.
Evgeniy Stepanov [Mon, 9 Oct 2017 22:52:13 +0000 (22:52 +0000)]
[ubsan] Fix Asan internal alloc corruption in PR33221 test.

MAP_FIXED discards the existing mapping at the given address.

llvm-svn: 315247

7 years agoFix LLDB build for Android.
Eugene Zemtsov [Mon, 9 Oct 2017 22:43:35 +0000 (22:43 +0000)]
Fix LLDB build for Android.

Currently libstdc++ on Android doesn't support std::to_string().

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

llvm-svn: 315246

7 years ago[MC] Plumb unique_ptr<MCMachObjectTargetWriter> through createMachObjectWriter
Lang Hames [Mon, 9 Oct 2017 22:38:13 +0000 (22:38 +0000)]
[MC] Plumb unique_ptr<MCMachObjectTargetWriter> through createMachObjectWriter
to MCObjectWriter's constructor.

MCObjectWriter takes ownership of its MCMachObjectTargetWriter argument -- this
patch plumbs that ownership relationship through the constructor (which
previously took raw MCMachObjectTargetWriter*) and the createMachObjectWriter
function.

llvm-svn: 315245

7 years ago[DWARF] DW_TAG_imported_unit is not a unit type.
Jonas Devlieghere [Mon, 9 Oct 2017 22:33:53 +0000 (22:33 +0000)]
[DWARF] DW_TAG_imported_unit is not a unit type.

As pointed out by David in D38453 and confirmed with the DWARF mailing
list, DW_TAG_imported_unit is not a valid unit type.

llvm-svn: 315244

7 years ago[llvm-objdump] Use initializer list for scoped xar api constructors
Francis Ricci [Mon, 9 Oct 2017 20:27:14 +0000 (20:27 +0000)]
[llvm-objdump] Use initializer list for scoped xar api constructors

llvm-svn: 315243

7 years agoRevert r315214 since diff -Z isn't portable, this is breaking:
Bruno Cardoso Lopes [Mon, 9 Oct 2017 20:22:05 +0000 (20:22 +0000)]
Revert r315214 since diff -Z isn't portable, this is breaking:

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

llvm-svn: 315242

7 years agoPR13575: Fix test
Jan Korous [Mon, 9 Oct 2017 20:17:28 +0000 (20:17 +0000)]
PR13575: Fix test

Ignore OS-specific mangled name.

llvm-svn: 315241

7 years ago[GISel]: Fix generation of illegal COPYs during CallLowering
Aditya Nandakumar [Mon, 9 Oct 2017 20:07:43 +0000 (20:07 +0000)]
[GISel]: Fix generation of illegal COPYs during CallLowering

We end up creating COPY's that are either truncating/extending and this
should be illegal.

https://reviews.llvm.org/D37640

Patch for X86 and ARM by igorb, rovka

llvm-svn: 315240

7 years agoAdd a helper to build Copy instructions in MachineIRBuilder
Aditya Nandakumar [Mon, 9 Oct 2017 20:07:41 +0000 (20:07 +0000)]
Add a helper to build Copy instructions in MachineIRBuilder

llvm-svn: 315239

7 years agoAMDGPU: Add read_exec_lo/hi builtins
Matt Arsenault [Mon, 9 Oct 2017 20:06:37 +0000 (20:06 +0000)]
AMDGPU: Add read_exec_lo/hi builtins

llvm-svn: 315238

7 years ago[X86] Unsigned saturation subtraction canonicalization [the backend part]
Zvi Rackover [Mon, 9 Oct 2017 20:01:10 +0000 (20:01 +0000)]
[X86] Unsigned saturation subtraction canonicalization [the backend part]

Summary:
On behalf of julia.koval@intel.com

The patch transforms canonical version of unsigned saturation, which is sub(max(a,b),a) or sub(a,min(a,b)) to special psubus insturuction on targets, which support it(8bit and 16bit uints).
umax(a,b) - b -> subus(a,b)
a - umin(a,b) -> subus(a,b)

There is also extra case handled, when right part of sub is 32 bit and can be truncated, using UMIN(this transformation was discussed in https://reviews.llvm.org/D25987).

The example of special case code:

```
void foo(unsigned short *p, int max, int n) {

  int i;
  unsigned m;
  for (i = 0; i < n; i++) {
    m = *--p;
    *p = (unsigned short)(m >= max ? m-max : 0);
  }
}
```
Max in this example is truncated to max_short value, if it is greater than m, or just truncated to 16 bit, if it is not. It is vaid transformation, because if max > max_short, result of the expression will be zero.

Here is the table of types, I try to support, special case items are bold:

| Size | 128 | 256 | 512
| -----  | -----  | -----   | -----
| i8 | v16i8 | v32i8 | v64i8
| i16 | v8i16 | v16i16 | v32i16
| i32 | | **v8i32** | **v16i32**
| i64 | | | **v8i64**

Reviewers: zvi, spatel, DavidKreitzer, RKSimon

Reviewed By: zvi

Subscribers: llvm-commits

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

llvm-svn: 315237

7 years agoPR13575: Fix USR mangling for fixed-size arrays
Jan Korous [Mon, 9 Oct 2017 19:51:33 +0000 (19:51 +0000)]
PR13575: Fix USR mangling for fixed-size arrays

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

llvm-svn: 315236

7 years agoImplement mem_fence on ptx
Jeroen Ketema [Mon, 9 Oct 2017 19:43:04 +0000 (19:43 +0000)]
Implement mem_fence on ptx

PTX does not differentiate between read and write fences. Hence, these a
lowered to a mem_fence call. The mem_fence function compiles to the
“member.cta” instruction, which commits all outstanding reads and writes
of a thread such that these become visible to all other threads in the same
CTA (i.e., work-group). The instruction does not differentiate between
global and local memory. Hence, the flags parameter is ignored, except
for deciding whether a “member.cta” instruction should be issued at all.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315235

7 years ago[libc++] Support Microsoft ABI without vcruntime headers
Shoaib Meenai [Mon, 9 Oct 2017 19:25:17 +0000 (19:25 +0000)]
[libc++] Support Microsoft ABI without vcruntime headers

The vcruntime headers are hairy and clash with both libc++ headers
themselves and other libraries. libc++ normally deals with the clashes
by deferring to the vcruntime headers and silencing its own definitions,
but for clients which don't want to depend on vcruntime headers, it's
desirable to support the opposite, i.e. have libc++ provide its own
definitions.

Certain operator new/delete replacement scenarios are not currently
supported in this mode, which requires some tests to be marked XFAIL.
The added documentation has more details.

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

llvm-svn: 315234

7 years ago[SLP] Add test for reversed load, NFC.
Alexey Bataev [Mon, 9 Oct 2017 19:08:15 +0000 (19:08 +0000)]
[SLP] Add test for reversed load, NFC.

llvm-svn: 315232

7 years agoTesting commit access.
Hamza Sood [Mon, 9 Oct 2017 19:07:09 +0000 (19:07 +0000)]
Testing commit access.

llvm-svn: 315231

7 years agoFix some C++ value / reference semantics issues.
Zachary Turner [Mon, 9 Oct 2017 18:50:29 +0000 (18:50 +0000)]
Fix some C++ value / reference semantics issues.

Some functions were taking Twine's not by const&, these are all
fixed to take by const&.  We also had a case where some functions
were overloaded to accept by const& and &&.  Now there is only
one version which accepts by value and move's the value.

llvm-svn: 315229

7 years agoMake ptx barrier work irrespective of the cl_mem_fence_flags
Jeroen Ketema [Mon, 9 Oct 2017 18:36:48 +0000 (18:36 +0000)]
Make ptx barrier work irrespective of the cl_mem_fence_flags

This generates a "bar.sync 0” instruction, which not only causes the
threads to wait, but does acts as a memory fence, as required by
OpenCL. The fence does not differentiate between local and global
memory. Unfortunately, there is no similar instruction which does
not include a memory fence. Hence, we cannot optimize the case
where neither CLK_LOCAL_MEM_FENCE nor CLK_GLOBAL_MEM_FENCE is
passed.

llvm-svn: 315228

7 years ago[sanitizer] Don't intercept signal and sigaction on Fuchsia
Petr Hosek [Mon, 9 Oct 2017 18:29:52 +0000 (18:29 +0000)]
[sanitizer] Don't intercept signal and sigaction on Fuchsia

Fuchsia doesn't support signals, so don't use interceptors for signal or
sigaction.

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

llvm-svn: 315227

7 years ago[globalisel] Add support for ValueType operands in patterns.
Daniel Sanders [Mon, 9 Oct 2017 18:14:53 +0000 (18:14 +0000)]
[globalisel] Add support for ValueType operands in patterns.

It's rare but there are a small number of patterns like this:
    (set i64:$dst, (add i64:$src1, i64:$src2))
These should be equivalent to register classes except they shouldn't check for
a specific register bank.

This doesn't occur in AArch64/ARM/X86 but does occasionally come up in other
in-tree targets such as BPF.

llvm-svn: 315226

7 years ago[MC] Use a unique_ptr<MCAssembler> for MCObjectStreamer's Assembler member.
Lang Hames [Mon, 9 Oct 2017 18:11:04 +0000 (18:11 +0000)]
[MC] Use a unique_ptr<MCAssembler> for MCObjectStreamer's Assembler member.

Removes manual new/delete.

llvm-svn: 315225

7 years ago[InstCombine] fix formatting; NFC
Sanjay Patel [Mon, 9 Oct 2017 17:54:46 +0000 (17:54 +0000)]
[InstCombine] fix formatting; NFC

llvm-svn: 315223

7 years agoFix after r315079
Adrian McCarthy [Mon, 9 Oct 2017 17:50:01 +0000 (17:50 +0000)]
Fix after r315079

Microsoft's debug implementation of std::copy checks if the destination is an
array and then does some bounds checking.  This was causing an assertion
failure in fs::rename_internal which copies to a buffer of the appropriate
size but that's type-punned to an array of length 1 for API compatibility
reasons.

Fix is to make make the destination a pointer rather than an array.

llvm-svn: 315222

7 years agoUpdate ABISysV_arm64::RegisterIsVolatile to accept registers prefixed with r
Stephane Sezer [Mon, 9 Oct 2017 17:49:32 +0000 (17:49 +0000)]
Update ABISysV_arm64::RegisterIsVolatile to accept registers prefixed with r

Summary:
While the specification says that the 64bit registers are prefixed with
`x`, it seems that many people still use `r`. Until recently, we had been using
the `r` prefix instead of the `x` prefix in ds2. This caused lldb to fail during
unwinding. I think it's reasonable to check for a register prefixed with `r`,
since some people still choose to use `r`.

Reviewers: sas, fjricci, clayborg

Reviewed By: sas, clayborg

Subscribers: aemerson, javed.absar, kristof.beyls

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

Change by Alex Langford <apl@fb.com>

llvm-svn: 315221

7 years ago[ubsan] Disable one test on Android.
Evgeniy Stepanov [Mon, 9 Oct 2017 17:45:03 +0000 (17:45 +0000)]
[ubsan] Disable one test on Android.

llvm-svn: 315220

7 years agoAMDGPU: Fix missing declaration for __builtin_amdgcn_dispatch_ptr
Matt Arsenault [Mon, 9 Oct 2017 17:44:18 +0000 (17:44 +0000)]
AMDGPU: Fix missing declaration for __builtin_amdgcn_dispatch_ptr

llvm-svn: 315219

7 years ago[dsymutil] Emit valid debug locations when no symbol flags are set
Francis Ricci [Mon, 9 Oct 2017 17:27:47 +0000 (17:27 +0000)]
[dsymutil] Emit valid debug locations when no symbol flags are set

Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.

Reviewers: aprantl, friss, JDevlieghere

Subscribers: llvm-commits

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

llvm-svn: 315218

7 years ago[SLP] Test for wrongly vectorized set of extractelements, NFC.
Alexey Bataev [Mon, 9 Oct 2017 17:14:03 +0000 (17:14 +0000)]
[SLP] Test for wrongly vectorized set of extractelements, NFC.

llvm-svn: 315217

7 years agoLimit CFI blacklist entries to specific CFI mode
Vlad Tsyrklevich [Mon, 9 Oct 2017 17:11:44 +0000 (17:11 +0000)]
Limit CFI blacklist entries to specific CFI mode

Summary:
Since D37924 and D37925 were merged, it's now possible to specify
individual sanitizers or CFI modes in sanitizer blacklists. Update the
CFI blacklist entries to only apply to cfi-unrelated-cast checks.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: kcc

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

llvm-svn: 315216

7 years agoMake the cfi target available on more platforms.
Peter Collingbourne [Mon, 9 Oct 2017 17:07:47 +0000 (17:07 +0000)]
Make the cfi target available on more platforms.

On non-Linux targets it just installs the blacklist.

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

llvm-svn: 315215

7 years ago[clangd] Added a command-line arg to mirror clangd input into a file.
Ilya Biryukov [Mon, 9 Oct 2017 16:58:16 +0000 (16:58 +0000)]
[clangd] Added a command-line arg to mirror clangd input into a file.

Summary: The arg is useful for debugging and creating test cases.

Reviewers: bkramer, krasimir

Reviewed By: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 315214

7 years ago[clangd] Added a test for r315212.
Ilya Biryukov [Mon, 9 Oct 2017 16:53:00 +0000 (16:53 +0000)]
[clangd] Added a test for r315212.

llvm-svn: 315213

7 years agoSet PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.
Ilya Biryukov [Mon, 9 Oct 2017 16:52:12 +0000 (16:52 +0000)]
Set PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.

Summary:
It was previsouly set only in ASTUnit, but it should be set for all client of
PrecompiledPreamble.

Reviewers: erikjv, bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 315212

7 years ago[clangd] Added move-only function helpers.
Ilya Biryukov [Mon, 9 Oct 2017 16:26:26 +0000 (16:26 +0000)]
[clangd] Added move-only function helpers.

Summary:
They are now used in ClangdScheduler instead of deferred std::async
computations.
The results of `std::async` are much less effective and do not provide
a good abstraction for similar purposes, i.e. for storing additional callbacks
to clangd async tasks. The actual callback API will follow a bit later.

Reviewers: klimek, bkramer, sammccall, krasimir

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 315210

7 years ago[TableGen] remove make_range where not necessary
Javed Absar [Mon, 9 Oct 2017 16:21:25 +0000 (16:21 +0000)]
[TableGen] remove make_range where not necessary

llvm-svn: 315209

7 years ago[llvm-rc] Have the tokenizer discard single & block comments.
Zachary Turner [Mon, 9 Oct 2017 15:46:13 +0000 (15:46 +0000)]
[llvm-rc] Have the tokenizer discard single & block comments.

This allows rc files to have comments.  Eventually we should
just use clang's c preprocessor, but that's a bit larger
effort for minimal gain, and this is straightforward.

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

llvm-svn: 315207

7 years ago[DAG] combine assertsexts around a trunc
Sanjay Patel [Mon, 9 Oct 2017 15:22:20 +0000 (15:22 +0000)]
[DAG] combine assertsexts around a trunc

This was a suggested follow-up to:
D37017 / https://reviews.llvm.org/rL313577

llvm-svn: 315206

7 years ago[AArch64] Improve codegen for inverted overflow checking intrinsics
Amara Emerson [Mon, 9 Oct 2017 15:15:09 +0000 (15:15 +0000)]
[AArch64] Improve codegen for inverted overflow checking intrinsics

E.g. if we have a (xor(overflow-bit), 1) where overflow-bit comes from an
intrinsic like llvm.sadd.with.overflow then we can kill the xor and use the
inverted condition code for the CSEL.

rdar://28495949

Reviewed By: kristof.beyls

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

llvm-svn: 315205

7 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Mon, 9 Oct 2017 15:01:58 +0000 (15:01 +0000)]
[x86] regenerate test checks; NFC

llvm-svn: 315204

7 years ago[AArch64] fix typos in test assertions
Sanjay Patel [Mon, 9 Oct 2017 01:29:54 +0000 (01:29 +0000)]
[AArch64] fix typos in test assertions

llvm-svn: 315203

7 years ago[X86] Remove a setLoadExtAction from the AVX512 section that uses an AVX512BW type...
Craig Topper [Mon, 9 Oct 2017 01:05:16 +0000 (01:05 +0000)]
[X86] Remove a setLoadExtAction from the AVX512 section that uses an AVX512BW type and is alraedy present in the AVX512BW section.

llvm-svn: 315202

7 years ago[X86] Enable extended comparison predicate support for SETUEQ/SETONE when targeting...
Craig Topper [Mon, 9 Oct 2017 01:05:15 +0000 (01:05 +0000)]
[X86] Enable extended comparison predicate support for SETUEQ/SETONE when targeting AVX instructions.

We believe that despite AMD's documentation, that they really do support all 32 comparision predicates under AVX.

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

llvm-svn: 315201

7 years ago[DWARFDIE] Rewrite `operator !=` using `operator ==`. NFCI.
Davide Italiano [Mon, 9 Oct 2017 00:18:45 +0000 (00:18 +0000)]
[DWARFDIE] Rewrite `operator !=` using `operator ==`. NFCI.

llvm-svn: 315200

7 years ago[SymbolFile/DWARF] Simplify two functions. NFCI.
Davide Italiano [Mon, 9 Oct 2017 00:11:49 +0000 (00:11 +0000)]
[SymbolFile/DWARF] Simplify two functions. NFCI.

llvm-svn: 315199

7 years agoCertain versions of clang require an explicit initialization for literal const members.
Benjamin Kramer [Sun, 8 Oct 2017 21:28:47 +0000 (21:28 +0000)]
Certain versions of clang require an explicit initialization for literal const members.

include/clang/Lex/PreprocessorLexer.h:79:3: error: constructor for
'clang::PreprocessorLexer' must explicitly initialize the const member
'FID'

llvm-svn: 315197

7 years agoRemove unused variables. No functionality change.
Benjamin Kramer [Sun, 8 Oct 2017 21:23:02 +0000 (21:23 +0000)]
Remove unused variables. No functionality change.

llvm-svn: 315196

7 years ago[X86][SSE] Don't call combineTo inside combineX86ShufflesRecursively. NFCI.
Simon Pilgrim [Sun, 8 Oct 2017 20:58:14 +0000 (20:58 +0000)]
[X86][SSE] Don't call combineTo inside combineX86ShufflesRecursively. NFCI.

Return the combined shuffle from combineX86ShufflesRecursively and perform the combineTo in the caller.

Makes it easier for future patches to use this in functions that aren't actually shuffles themselves.

llvm-svn: 315195

7 years agoMake SourceLocation, QualType and friends have constexpr constructors.
Benjamin Kramer [Sun, 8 Oct 2017 20:53:36 +0000 (20:53 +0000)]
Make SourceLocation, QualType and friends have constexpr constructors.

No functionality change intended.

llvm-svn: 315194

7 years agotravis: Make sure we report failure even if only earlier checked files fail
Jan Vesely [Sun, 8 Oct 2017 20:07:58 +0000 (20:07 +0000)]
travis: Make sure we report failure even if only earlier checked files fail

for loop would only report status of the last command
v2: return '1'
    call test instead of '['

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315193

7 years agocheck_external_calls.sh: Print number of calls in tested file.
Jan Vesely [Sun, 8 Oct 2017 20:07:56 +0000 (20:07 +0000)]
check_external_calls.sh: Print number of calls in tested file.

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315192

7 years agoptx: Use __clc_nextafter to implement nextafter
Jan Vesely [Sun, 8 Oct 2017 19:34:00 +0000 (19:34 +0000)]
ptx: Use __clc_nextafter to implement nextafter

using clang builtin results in external library call

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315191

7 years agoDo not include clc_nextafter header globally
Jan Vesely [Sun, 8 Oct 2017 19:33:58 +0000 (19:33 +0000)]
Do not include clc_nextafter header globally

Drop unused clc/math/clc_nextafter.h header

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315190

7 years agomath/nextafter: Use custom declaration inc file
Jan Vesely [Sun, 8 Oct 2017 19:33:55 +0000 (19:33 +0000)]
math/nextafter: Use custom declaration inc file

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315189

7 years agomath/binary_decl.inc: Do not declare mixed float/double functions
Jan Vesely [Sun, 8 Oct 2017 19:33:53 +0000 (19:33 +0000)]
math/binary_decl.inc: Do not declare mixed float/double functions

fmin/fmax only need vector/scalar mix

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315188

7 years agoTidyup with clang-format. NFCI.
Simon Pilgrim [Sun, 8 Oct 2017 19:24:30 +0000 (19:24 +0000)]
Tidyup with clang-format. NFCI.

llvm-svn: 315187

7 years ago[X86][SSE] Add test case for PR27708
Simon Pilgrim [Sun, 8 Oct 2017 19:18:10 +0000 (19:18 +0000)]
[X86][SSE] Add test case for PR27708

llvm-svn: 315186

7 years agoRemove unused variables. No functionality change.
Benjamin Kramer [Sun, 8 Oct 2017 19:11:02 +0000 (19:11 +0000)]
Remove unused variables. No functionality change.

llvm-svn: 315185

7 years ago[X86] Regenerate fast-isel-select-pseudo-cmov.ll to prepare for D38609.
Craig Topper [Sun, 8 Oct 2017 17:54:50 +0000 (17:54 +0000)]
[X86] Regenerate fast-isel-select-pseudo-cmov.ll to prepare for D38609.

llvm-svn: 315184

7 years ago[TableGen] Simplify, add range_loop in CodeGenSchedule
Javed Absar [Sun, 8 Oct 2017 17:23:30 +0000 (17:23 +0000)]
[TableGen] Simplify, add range_loop in CodeGenSchedule

llvm-svn: 315183

7 years ago[X86] getTargetConstantBitsFromNode - add support for decoding scalar constants
Simon Pilgrim [Sun, 8 Oct 2017 17:21:18 +0000 (17:21 +0000)]
[X86] getTargetConstantBitsFromNode - add support for decoding scalar constants

llvm-svn: 315182

7 years ago[X86] Prefer MOVSS/SD over BLENDI during legalization. Remove BLENDI versions of...
Craig Topper [Sun, 8 Oct 2017 16:57:23 +0000 (16:57 +0000)]
[X86] Prefer MOVSS/SD over BLENDI during legalization. Remove BLENDI versions of scalar arithmetic patterns

Summary:
We currently disable some converting of shuffles to MOVSS/MOVSD during legalization if SSE41 is enabled. But later during shuffle combining we go back to prefering MOVSS/MOVSD.

Additionally we have patterns that look for BLENDIs to detect scalar arithmetic operations. I believe due to the combining using MOVSS/MOVSD these are unnecessary.

Interestingly, we still codegen blend instructions even though lowering/isel emit movss/movsd instructions. Turns out machine CSE commutes them to blend, and then commuting those blends back into blends that are equivalent to the original movss/movsd.

This patch fixes the inconsistency in legalization to prefer MOVSS/MOVSD. The one test change was caused by this change. The problem is that we have integer types and are mostly selecting integer instructions except for the shufps. This shufps forced the execution domain, but the vpblendw couldn't have its domain changed with a naive instruction swap. We could fix this by special casing VPBLENDW based on the immediate to widen the element type.

The rest of the patch is removing all the excess scalar patterns.

Long term we should probably add isel patterns to make MOVSS/MOVSD emit blends directly instead of relying on the double commute. We may also want to consider emitting movss/movsd for optsize. I also wonder if we should still use the VEX encoded blendi instructions even with AVX512. Blends have better throughput, and that may outweigh the register constraint.

Reviewers: RKSimon, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 315181

7 years agoMake more constructors constexpr or use =default.
Benjamin Kramer [Sun, 8 Oct 2017 15:59:35 +0000 (15:59 +0000)]
Make more constructors constexpr or use =default.

This lets the compiler reason about the type more easily. No
functionality change intended.

llvm-svn: 315180

7 years ago[AArch64][GlobalISel] Add a test case for G_PHI of p0 instruction selection.
Amara Emerson [Sun, 8 Oct 2017 15:29:35 +0000 (15:29 +0000)]
[AArch64][GlobalISel] Add a test case for G_PHI of p0 instruction selection.

llvm-svn: 315179

7 years ago[AArch64][GlobalISel] Add a test case for G_PHI of p0 regbank selection.
Amara Emerson [Sun, 8 Oct 2017 15:29:31 +0000 (15:29 +0000)]
[AArch64][GlobalISel] Add a test case for G_PHI of p0 regbank selection.

llvm-svn: 315178

7 years ago[AArch64][GlobalISel] Make G_PHI of p0 types legal.
Amara Emerson [Sun, 8 Oct 2017 15:29:11 +0000 (15:29 +0000)]
[AArch64][GlobalISel] Make G_PHI of p0 types legal.

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

llvm-svn: 315177

7 years ago[X86][XOP] Add XOP oddshuffles tests
Simon Pilgrim [Sun, 8 Oct 2017 12:58:15 +0000 (12:58 +0000)]
[X86][XOP] Add XOP oddshuffles tests

XOP codegen is often different to generic AVX - thank you vpperm!

llvm-svn: 315176

7 years ago[X86][SKX] Adding the scheduling information for the SKX target.
Gadi Haber [Sun, 8 Oct 2017 12:52:54 +0000 (12:52 +0000)]
[X86][SKX] Adding the scheduling information for the SKX target.

Adding the scheduling information for the SkylakeServer (SKX) target.

This patch adds the instruction scheduling information for the SkylakeServer (SKX) architecture target by adding the file X86SchedSkylakeServer.td located under the X86 Target.
We used the scheduling information retrieved from the Skylake architects in order to create the file.
The scheduling information includes latency, number of micro-Ops and used ports by each SKL instruction.

The patch continues the scheduling replacement and insertion effort started with the SNB target in r310792, the HSW target in r311879 and the SkylakeClient (SKL) target in rL313613.

Please expect some performance fluctuations due to code alignment effects.

Reviewers: zvi, RKSimon, craig.topper, chandlerc, aymanmu
Differential Revision: https://reviews.llvm.org/D38443

Change-Id: I5c228fcc09e9e5a99b6116e62b356c4f9b971185
llvm-svn: 315175

7 years ago[X86] Add missing entries in 'MemoryFoldTable2Addr' to get complete form of the table.
Ayman Musa [Sun, 8 Oct 2017 09:46:50 +0000 (09:46 +0000)]
[X86] Add missing entries in 'MemoryFoldTable2Addr' to get complete form of the table.

Get the folding table 'MemoryFoldTable2Addr' to a complete state as part of the process explained in https://reviews.llvm.org/D38028

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

llvm-svn: 315174

7 years ago[X86][TableGen] Recommitting the X86 memory folding tables TableGen backend while...
Ayman Musa [Sun, 8 Oct 2017 09:20:32 +0000 (09:20 +0000)]
[X86][TableGen] Recommitting the X86 memory folding tables TableGen backend while disabling it by default.

After the original commit ([[ https://reviews.llvm.org/rL304088 | rL304088 ]]) was reverted, a discussion in llvm-dev was opened on 'how to accomplish this task'.
In the discussion we concluded that the best way to achieve our goal (which is to automate the folding tables and remove the manually maintained tables) is:

 # Commit the tablegen backend disabled by default.

 # Proceed with an incremental updating of the manual tables - while checking the validity of each added entry.

 # Repeat previous step until we reach a state where the generated and the manual tables are identical. Then we can safely remove the manual tables and include the generated tables instead.

 # Schedule periodical (1 week/2 weeks/1 month) runs of the pass:

   - if changes appear (new entries):
      - make sure the entries are legal
      - If they are not, mark them as illegal to folding
   - Commit the changes (if there are any).

CMake flag added for this purpose is "X86_GEN_FOLD_TABLES". Building with this flags will run the pass and emit the X86GenFoldTables.inc file under build/lib/Target/X86/ directory which is a good reference for any developer who wants to take part in the effort of completing the current folding tables.

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

llvm-svn: 315173