platform/upstream/llvm.git
7 years ago[analyzer] PthreadLockChecker: Add printState() method for self-debugging.
Artem Dergachev [Tue, 10 Oct 2017 11:49:09 +0000 (11:49 +0000)]
[analyzer] PthreadLockChecker: Add printState() method for self-debugging.

This method injects additional information into program state dumps,
describing states of mutexes tracked by the checker.

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

llvm-svn: 315298

7 years ago[llvm-dwarfdump] Print type names in DW_AT_type DIEs
Jonas Devlieghere [Tue, 10 Oct 2017 11:24:41 +0000 (11:24 +0000)]
[llvm-dwarfdump] Print type names in DW_AT_type DIEs

This patch adds printing for DW_AT_type DIEs like it is already the case
for DW_AT_specification DIEs. This is a rather naive approach and only a
start. We should have pretty printers for different languages.

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

llvm-svn: 315297

7 years ago[analyzer] Implement pointer arithmetic on constants
Gabor Horvath [Tue, 10 Oct 2017 11:01:49 +0000 (11:01 +0000)]
[analyzer] Implement pointer arithmetic on constants

Patch by: Rafael Stahl!

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

llvm-svn: 315296

7 years ago[AsmParser] Add DiagnosticString to register classes in tablegen
Oliver Stannard [Tue, 10 Oct 2017 11:00:40 +0000 (11:00 +0000)]
[AsmParser] Add DiagnosticString to register classes in tablegen

This allows a DiagnosticType and/or DiagnosticString to be associated
with a RegisterClass in tablegen, so that we can emit diagnostics in the
assembler when a register operand is incorrect.

DiagnosticType creates a predictable enum value, which gets returned as
the error code when an operand does not match, and can be used by the
assembly parser to map to a user-facing diagnostic. DiagnosticString
creates an anonymous enum value (currently based on the tablegen class
name), and a function to map from enum values to strings will be
generated. Both of these work the same was as they do for AsmOperand.

This isn't used by any targets yet, but has one (positive) side-effect.
It improves the diagnostic codes returned by validateOperandClass - we
always want to emit the diagnostic that relates to the expected operand
class, but this wasn't always being done when the expected and actual
classes were completely different (token/register/custom). This causes a
few AArch64 diagnostics to be improved, as Match_InvalidOperand was
being returned instead of a specific diagnostic type.

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

llvm-svn: 315295

7 years ago[SCCP] Fix mem-sanitizer failure introduced by r315288.
Florian Hahn [Tue, 10 Oct 2017 10:33:45 +0000 (10:33 +0000)]
[SCCP] Fix mem-sanitizer failure introduced by r315288.

llvm-svn: 315294

7 years ago[ELF] Set Dot initially to --image-base value when using linker scripts
James Henderson [Tue, 10 Oct 2017 10:09:35 +0000 (10:09 +0000)]
[ELF] Set Dot initially to --image-base value when using linker scripts

When parsing linker scripts, LLD previously started with a '.' value of 0,
regardless of the internal default image base for the target, and regardless of
switches such as --image-base. It seems reasonable to use a different image base
value when using linker scripts and --image-base is specified, since otherwise the
switch has no effect. This change does this, as well as removing unnecessary
initialisation of Dot where it is not used.

The default image base should not be used when processing linker
scripts, because this will change the behaviour for existing linker script users,
and potentially result in invalid output being produced, as a subsequent assignment
to Dot could move the location counter backwards. Instead, we maintain the existing
behaviour of starting from 0 if --image-base is not specified.

Reviewers: ruiu

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

llvm-svn: 315293

7 years ago[LLD] Fix findOrphanPos to consistently ignore "dead" OutputSection's
Andrew Ng [Tue, 10 Oct 2017 10:05:52 +0000 (10:05 +0000)]
[LLD] Fix findOrphanPos to consistently ignore "dead" OutputSection's

When findOrphanPos does the reverse search to find the OutputSection
preceding the orphan's insertion point, look for a live OutputSection
and ignore "dead" OutputSection's. This matches the behaviour of the
forward search performed earlier in this function.

Added test which without the above fix fails as a result of an orphan
executable section being incorrectly placed in a non-executable segment.

Differential Review: https://reviews.llvm.org/D38690

llvm-svn: 315292

7 years ago[X86][SKYLAKE] Update regression test to differentiate between HASWELL and SKYLAKE...
Gadi Haber [Tue, 10 Oct 2017 09:53:18 +0000 (09:53 +0000)]
[X86][SKYLAKE] Update regression test to differentiate between HASWELL and SKYLAKE scheduling.<NFC>

NFC.
Updated 6 regression tests to differentiate between HASWELL and SKYLAKE scheduling information.

The fix is in preparation of a patch to update the information of the Skylake Client scheduling to include the appropriate load and store latencies.

Reviewers: zvi, RKSimon
Differential Revision: https://reviews.llvm.org/D38685

Change-Id: Ifc6b98d9eaf266913698f24c766fd994fc977555
llvm-svn: 315291

7 years ago[clang-refactor] Fix clang-tidy misc-move-const-arg warning.
Haojian Wu [Tue, 10 Oct 2017 09:48:38 +0000 (09:48 +0000)]
[clang-refactor] Fix clang-tidy misc-move-const-arg warning.

NFC

llvm-svn: 315290

7 years ago[CodeGen] Do not construct complete LValue base info in trivial cases
Ivan A. Kosarev [Tue, 10 Oct 2017 09:39:32 +0000 (09:39 +0000)]
[CodeGen] Do not construct complete LValue base info in trivial cases

Besides obvious code simplification, avoiding explicit creation
of LValueBaseInfo objects makes it easier to make TBAA
information to be part of such objects.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

llvm-svn: 315289

7 years ago[SCCP] Propagate integer range info for parameters in IPSCCP.
Florian Hahn [Tue, 10 Oct 2017 09:32:38 +0000 (09:32 +0000)]
[SCCP] Propagate integer range info for parameters in IPSCCP.

Summary:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to `ret i32 2` with
this change

  source_filename = "sccp.c"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"

  ; Function Attrs: norecurse nounwind readnone uwtable
  define i32 @main() local_unnamed_addr #0 {
  entry:
    %call = tail call fastcc i32 @f(i32 1)
    %call1 = tail call fastcc i32 @f(i32 47)
    %add3 = add nsw i32 %call, %call1
    ret i32 %add3
  }

  ; Function Attrs: noinline norecurse nounwind readnone uwtable
  define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
  entry:
    %c1 = icmp sle i32 %x, 100

    %cmp = icmp sgt i32 %x, 300
    %. = select i1 %cmp, i32 1, i32 2
    ret i32 %.
  }

  attributes #1 = { noinline }

Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

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

llvm-svn: 315288

7 years agoRevert "Revert r315214 since diff -Z isn't portable, this is breaking:"
Ilya Biryukov [Tue, 10 Oct 2017 09:08:47 +0000 (09:08 +0000)]
Revert "Revert r315214 since diff -Z isn't portable, this is breaking:"

This reverts commit r315242 and restores r315214.

To fix original failure, replaced non-portable `diff -Z` with portable
alternative: `diff -b`.

llvm-svn: 315287

7 years agoFix small nits in clang-refactor doc.
Haojian Wu [Tue, 10 Oct 2017 09:00:56 +0000 (09:00 +0000)]
Fix small nits in clang-refactor doc.

llvm-svn: 315286

7 years agoFix for PR34888.
Nemanja Ivanovic [Tue, 10 Oct 2017 08:46:10 +0000 (08:46 +0000)]
Fix for PR34888.

The issue is that we assume operand zero of the input to the add instruction
is a register. In this case, the input comes from inline assembly and
operand zero is not a register thereby causing a crash.
The code will bail anyway if the input instruction doesn't have the right
opcode. So do that check first and let short-circuiting prevent the crash.

llvm-svn: 315285

7 years ago[clangd] Fix compilation on gcc.
Ilya Biryukov [Tue, 10 Oct 2017 08:40:57 +0000 (08:40 +0000)]
[clangd] Fix compilation on gcc.

llvm-svn: 315284

7 years agoSILoadStoreOptimizer.cpp: Fix build; Clang doesn't like "using anonymous struct"...
NAKAMURA Takumi [Tue, 10 Oct 2017 08:30:53 +0000 (08:30 +0000)]
SILoadStoreOptimizer.cpp: Fix build; Clang doesn't like "using anonymous struct" since rL315256.

llvm-svn: 315283

7 years agoMCWinCOFFObjectWriter.h: Fix modules build in rL315257.
NAKAMURA Takumi [Tue, 10 Oct 2017 08:30:45 +0000 (08:30 +0000)]
MCWinCOFFObjectWriter.h: Fix modules build in rL315257.

llvm-svn: 315282

7 years agoRe-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Tue, 10 Oct 2017 08:00:45 +0000 (08:00 +0000)]
Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

(fixed stability issues)

This reverts commit d6492333d3b478a1d88163315002022f8d5e58dc.

llvm-svn: 315281

7 years ago[ELF] - Improve "has non-ABS reloc" error.
George Rimar [Tue, 10 Oct 2017 07:55:07 +0000 (07:55 +0000)]
[ELF] - Improve "has non-ABS reloc" error.

It did not contain information about relocation type and symbol.

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

llvm-svn: 315280

7 years agoIgnore all duplicate frame index expression
Bjorn Steinbrink [Tue, 10 Oct 2017 07:46:17 +0000 (07:46 +0000)]
Ignore all duplicate frame index expression

Some passes might duplicate calls to llvm.dbg.declare creating
duplicate frame index expression which currently trigger an assertion
which is meant to catch erroneous, overlapping fragment declarations.
But identical frame index expressions are just redundant and don't
actually conflict with each other, so we can be more lenient and just
ignore the duplicates.

Reviewers: aprantl, rnk

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 315279

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