platform/upstream/llvm.git
7 years agoDeflake the "xpc-race.mm" test.
Kuba Mracek [Fri, 22 Sep 2017 18:49:56 +0000 (18:49 +0000)]
Deflake the "xpc-race.mm" test.

llvm-svn: 314014

7 years ago[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing
Vedant Kumar [Fri, 22 Sep 2017 18:42:28 +0000 (18:42 +0000)]
[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing

This un-breaks a lit workflow where you run lit tests from a test
sub-directory within clang without first building clang-func-mapping.

llvm-svn: 314013

7 years agoMove code to a helper function. NFC.
Rafael Espindola [Fri, 22 Sep 2017 18:40:14 +0000 (18:40 +0000)]
Move code to a helper function. NFC.

Part of a patch by Jake Ehrlich!

llvm-svn: 314012

7 years ago[clang] Fix printf fixit for objc specific types
Alexander Shaposhnikov [Fri, 22 Sep 2017 18:36:06 +0000 (18:36 +0000)]
[clang] Fix printf fixit for objc specific types

For the triple thumbv7-apple-ios8.0.0 ssize_t is long and size_t is unsigned long,
while NSInteger is int and NSUinteger is unsigned int. Following
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
Clang catches it and insert a cast to long, for example
 printf("%zd", getNSInteger())
will be replaced with
 printf("%zd", (long)getNSInteger())
but since the underlying type of ssize_t is long the specifier "%zd" is not getting replaced.
This diff changes this behavior to enable replacing the specifier "%zd" with the correct one.

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

Test plan: make check-all

llvm-svn: 314011

7 years agollvm-ar: align the first archive member consistently.
Rafael Espindola [Fri, 22 Sep 2017 18:36:00 +0000 (18:36 +0000)]
llvm-ar: align the first archive member consistently.

Before we were aligning the member after the symbol table to 4 but
other members to 8.

llvm-svn: 314010

7 years agobindings: expose Linkage to the python bindings
Saleem Abdulrasool [Fri, 22 Sep 2017 18:35:09 +0000 (18:35 +0000)]
bindings: expose Linkage to the python bindings

Add Python bindings for the 'clang_getCursorLinkage', and tests to
validate the functionality.

Patch by Masud Rahman!

llvm-svn: 314009

7 years ago[sanitizer] Move report locking code from asan into common
Vitaly Buka [Fri, 22 Sep 2017 18:32:05 +0000 (18:32 +0000)]
[sanitizer] Move report locking code from asan into common

llvm-svn: 314008

7 years ago[asan] Fix unlocking order for CommonSanitizerReportMutex and reporting_thread_tid_
Vitaly Buka [Fri, 22 Sep 2017 18:31:51 +0000 (18:31 +0000)]
[asan] Fix unlocking order for CommonSanitizerReportMutex and reporting_thread_tid_

llvm-svn: 314007

7 years ago[sanitizer] Move CommonSanitizerReportMutex from _print.cc to _common.cc
Vitaly Buka [Fri, 22 Sep 2017 18:31:37 +0000 (18:31 +0000)]
[sanitizer] Move CommonSanitizerReportMutex from _print.cc to _common.cc

llvm-svn: 314006

7 years ago[XRay] support conditional return on PPC.
Tim Shen [Fri, 22 Sep 2017 18:30:02 +0000 (18:30 +0000)]
[XRay] support conditional return on PPC.

Summary: Conditional returns were not taken into consideration at all. Implement them by turning them into jumps and normal returns. This means there is a slightly higher performance penalty for conditional returns, but this is the best we can do, and it still disturbs little of the rest.

Reviewers: dberris, echristo

Subscribers: sanjoy, nemanjai, hiraditya, kbarton, llvm-commits

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

llvm-svn: 314005

7 years ago[TableGen] Replace InfoByHwMode::getAsString with writeToStream
Krzysztof Parzyszek [Fri, 22 Sep 2017 18:29:37 +0000 (18:29 +0000)]
[TableGen] Replace InfoByHwMode::getAsString with writeToStream

Also add operator<< for use with raw_ostream to InfoByHwMode and its
derived classes.

Recommitting r313989 with the fix for unresolved references: explicitly
define the operator<< in namespace llvm.

llvm-svn: 314004

7 years ago[TargetTransformInfo] Handle intrinsic call in getInstructionLatency()
Guozhi Wei [Fri, 22 Sep 2017 18:25:53 +0000 (18:25 +0000)]
[TargetTransformInfo] Handle intrinsic call in getInstructionLatency()

Usually an intrinsic is a simple target instruction, it should have a small latency. A real function call has much larger latency. So handle the intrinsic call in function getInstructionLatency().

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

llvm-svn: 314003

7 years ago[Coverage] Add an option to emit limited coverage info
Vedant Kumar [Fri, 22 Sep 2017 18:23:04 +0000 (18:23 +0000)]
[Coverage] Add an option to emit limited coverage info

Add an option to emit limited coverage info for unused decls. It's just a
cl::opt for now to allow us to experiment quickly.

When building llc, this results in an 84% size reduction in the llvm_covmap
section, and a similar size reduction in the llvm_prf_names section. In
practice I expect the size reduction to be roughly quadratic with the size of
the program.

The downside is that coverage for headers will no longer be complete. This will
make the line/function/region coverage metrics incorrect, since they will be
artificially high. One mitigation would be to somehow disable those metrics
when using limited-coverage=true.

This is related to: llvm.org/PR34533 (make SourceBasedCodeCoverage scale)

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

llvm-svn: 314002

7 years agoFix windows buildbot broken by r313999
Francis Ricci [Fri, 22 Sep 2017 18:17:26 +0000 (18:17 +0000)]
Fix windows buildbot broken by r313999

llvm-svn: 314001

7 years agollvm-ar: Don't add an unnecessary alignment in gnu mode.
Rafael Espindola [Fri, 22 Sep 2017 18:16:13 +0000 (18:16 +0000)]
llvm-ar: Don't add an unnecessary alignment in gnu mode.

This is mostly for getting stricter testing in preparation for future
changes.

llvm-svn: 314000

7 years agoRemoved platform-specific ifdefs from sanitizer_procmaps.h
Francis Ricci [Fri, 22 Sep 2017 17:48:24 +0000 (17:48 +0000)]
Removed platform-specific ifdefs from sanitizer_procmaps.h

Summary: Removed platform-specific ifdefs for linux, mac, freebsd and netbsd from sanitizer_procmaps.h

Patch by Yicheng Wang <yichengfb@fb.com>

Reviewers: kcc, kubamracek, alekseyshl, fjricci, vitalybuka

Reviewed By: fjricci, vitalybuka

Subscribers: vitalybuka, emaste, krytarowski, llvm-commits

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

llvm-svn: 313999

7 years ago [Falkor] Add falkor CPU to host detection
Balaram Makam [Fri, 22 Sep 2017 17:46:36 +0000 (17:46 +0000)]
[Falkor] Add falkor CPU to host detection

    This returns "falkor" for Falkor CPU.

llvm-svn: 313998

7 years ago[index] Generate class & metaclass manglings for objc
Dave Lee [Fri, 22 Sep 2017 16:58:57 +0000 (16:58 +0000)]
[index] Generate class & metaclass manglings for objc

Summary:
ObjC classes have two associated symbols, one for the class and one for the
metaclass.

This change overloads `CodegenNameGenerator::getAllManglings` to produce both
class and metaclass symbols.

While this function is called by `clang_Cursor_getCXXManglings`, it's only
called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is
unchanged.

Reviewers: arphaman, abdulras, alexshap, compnerd

Reviewed By: compnerd

Subscribers: compnerd

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

llvm-svn: 313997

7 years agoRemove trailing whitespace. NFCI.
Simon Pilgrim [Fri, 22 Sep 2017 16:57:28 +0000 (16:57 +0000)]
Remove trailing whitespace. NFCI.

llvm-svn: 313996

7 years ago[OPENMP] Handle re-declaration of captured variables in CodeGen.
Alexey Bataev [Fri, 22 Sep 2017 16:56:13 +0000 (16:56 +0000)]
[OPENMP] Handle re-declaration of captured variables in CodeGen.

If the captured variable has re-declaration we may end up with the
situation where the captured variable is the re-declaration while the
referenced variable is the canonical declaration (or vice versa). In
this case we may generate wrong code. Patch fixes this situation.

llvm-svn: 313995

7 years agoCheck vector elements for equivalence in the HexagonVectorLoopCarriedReuse pass
Pranav Bhandarkar [Fri, 22 Sep 2017 16:43:31 +0000 (16:43 +0000)]
Check vector elements for equivalence in the HexagonVectorLoopCarriedReuse pass

If the two instructions being compared for equivalence have corresponding operands
that are integer constants, then check their values to determine equivalence.

Patch by Suyog Sarda!

llvm-svn: 313993

7 years ago[Atomic][X8664] set max atomic inline width according to the target
Wei Mi [Fri, 22 Sep 2017 16:30:00 +0000 (16:30 +0000)]
[Atomic][X8664] set max atomic inline width according to the target

This is to fix PR31620. MaxAtomicInlineWidth is set to 128 for x86_64. However
for target without cx16 support, 128 atomic operation will generate __sync_*
libcalls. The patch set MaxAtomicInlineWidth to 64 if the target doesn't support
cx16.

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

llvm-svn: 313992

7 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Fri, 22 Sep 2017 16:26:17 +0000 (16:26 +0000)]
Fix unused variable warning. NFCI.

llvm-svn: 313991

7 years agoRevert "[TableGen] Replace InfoByHwMode::getAsString with writeToStream"
Krzysztof Parzyszek [Fri, 22 Sep 2017 16:18:35 +0000 (16:18 +0000)]
Revert "[TableGen] Replace InfoByHwMode::getAsString with writeToStream"

This reverts commit r313989: it breaks Windows bots.

llvm-svn: 313990

7 years ago[TableGen] Replace InfoByHwMode::getAsString with writeToStream
Krzysztof Parzyszek [Fri, 22 Sep 2017 16:06:35 +0000 (16:06 +0000)]
[TableGen] Replace InfoByHwMode::getAsString with writeToStream

Also add operator<< for use with raw_ostream to InfoByHwMode and its
derived classes.

llvm-svn: 313989

7 years ago[SCEV] Generalize folding of trunc(x)+n*trunc(y) into folding m*trunc(x)+n*trunc(y)
Daniel Neilson [Fri, 22 Sep 2017 15:47:57 +0000 (15:47 +0000)]
[SCEV] Generalize folding of trunc(x)+n*trunc(y) into folding m*trunc(x)+n*trunc(y)

Summary:
A SCEV such as:
 {%v2,+,((-1 * (trunc i64 (-1 * %v1) to i32)) + (-1 * (trunc i64 %v1 to i32)))}<%loop>

can be folded into, simply, {%v2,+,0}. However, the current code in ::getAddExpr()
will not try to apply the simplification m*trunc(x)+n*trunc(y) -> trunc(trunc(m)*x+trunc(n)*y)
because it only keys off having a non-multiplied trunc as the first term in the simplification.

This patch generalizes this code to try to do a more generic fold of these trunc
expressions.

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 313988

7 years ago[scudo] Scudo thread specific data refactor, part 1
Kostya Kortchinsky [Fri, 22 Sep 2017 15:35:37 +0000 (15:35 +0000)]
[scudo] Scudo thread specific data refactor, part 1

Summary:
We are going through an overhaul of Scudo's TSD, to allow for new platforms
to be integrated more easily, and make the code more sound.

This first part is mostly renaming, preferring some shorter names, correcting
some comments. I removed `getPrng` and `getAllocatorCache` to directly access
the members, there was not really any benefit to them (and it was suggested by
Dmitry in D37590).

The only functional change is in `scudo_tls_android.cpp`: we enforce bounds to
the `NumberOfTSDs` and most of the logic in `getTSDAndLockSlow` is skipped if we
only have 1 TSD.

Reviewers: alekseyshl, dvyukov, kcc

Reviewed By: dvyukov

Subscribers: llvm-commits, srhines

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

llvm-svn: 313987

7 years ago[x86] remove unnecessary OS specifier from test
Sanjay Patel [Fri, 22 Sep 2017 14:38:57 +0000 (14:38 +0000)]
[x86] remove unnecessary OS specifier from test

llvm-svn: 313986

7 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Fri, 22 Sep 2017 14:30:52 +0000 (14:30 +0000)]
[x86] auto-generate complete checks; NFC

llvm-svn: 313985

7 years ago[x86] update test to use FileCheck; NFC
Sanjay Patel [Fri, 22 Sep 2017 14:29:47 +0000 (14:29 +0000)]
[x86] update test to use FileCheck; NFC

llvm-svn: 313984

7 years ago[TableGen] Return StringRef from ValueTypeByHwMode::getMVTName
Simon Pilgrim [Fri, 22 Sep 2017 13:32:26 +0000 (13:32 +0000)]
[TableGen] Return StringRef from ValueTypeByHwMode::getMVTName

Avoid unnecessary std::string creations during TypeSetByHwMode::writeToStream.

Found during investigations into PR28222

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

llvm-svn: 313983

7 years ago[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant...
Alexander Ivchenko [Fri, 22 Sep 2017 13:21:39 +0000 (13:21 +0000)]
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments

Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:

before (20 bytes)
    <foo>:
    test $0x1,%dil
    mov $0x307e,%ax
    mov $0xffff,%cx
    cmovne %ax,%cx
    movzwl %cx,%eax
    retq

after (18 bytes)
    <foo>:
    test $0x1,%dil
    mov $0x307e,%ecx
    mov $0xffff,%eax
    cmovne %ecx,%eax
    retq

Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 313982

7 years agoRework loop predication pass
Artur Pilipenko [Fri, 22 Sep 2017 13:13:57 +0000 (13:13 +0000)]
Rework loop predication pass

We've found a serious issue with the current implementation of loop predication.
The current implementation relies on SCEV and this turned out to be problematic.
To fix the problem we had to rework the pass substantially. We have had the
reworked implementation in our downstream tree for a while. This is the initial
patch of the series of changes to upstream the new implementation.

For now the transformation is limited to the following case:
  * The loop has a single latch with either ult or slt icmp condition.
  * The step of the IV used in the latch condition is 1.
  * The IV of the latch condition is the same as the post increment IV of the guard condition.
  * The guard condition is ult.

See the review or the LoopPredication.cpp header for the details about the
problem and the new implementation.

Reviewed By: sanjoy, mkazantsev

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

llvm-svn: 313981

7 years agoRemove the default clause from a fully-covering switch
Nemanja Ivanovic [Fri, 22 Sep 2017 12:26:00 +0000 (12:26 +0000)]
Remove the default clause from a fully-covering switch
to appease bots that use a compiler that warns about this
and use -Werror.

llvm-svn: 313980

7 years ago[ARM] Fix assembly and disassembly for VMRS/VMSR
Andre Vieira [Fri, 22 Sep 2017 12:17:42 +0000 (12:17 +0000)]
[ARM] Fix assembly and disassembly for VMRS/VMSR

Reviewed by: t.p.northover
Differential Revision: https://reviews.llvm.org/D36306

llvm-svn: 313979

7 years agoRecommit r310809 with a fix for the spill problem
Nemanja Ivanovic [Fri, 22 Sep 2017 11:50:25 +0000 (11:50 +0000)]
Recommit r310809 with a fix for the spill problem

This patch re-commits the patch that was pulled out due to a
problem it caused, but with a fix for the problem. The fix
was reviewed separately by Eric Christopher and Hal Finkel.

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

llvm-svn: 313978

7 years agopolly-update-format after change in clang-format. NFC.
Michael Kruse [Fri, 22 Sep 2017 11:30:26 +0000 (11:30 +0000)]
polly-update-format after change in clang-format. NFC.

r313963 changed the sorting of using-declarations.

llvm-svn: 313976

7 years agoAdd Cross Translation Unit support library
Gabor Horvath [Fri, 22 Sep 2017 11:11:01 +0000 (11:11 +0000)]
Add Cross Translation Unit support library

This patch introduces a class that can help to build tools that require cross
translation unit facilities. This class allows function definitions to be loaded
from external AST files based on an index. In order to use this functionality an
index is required. The index format is a flat text file but it might be
replaced with a different solution in the near future. USRs are used as names to
look up the functions definitions. This class also does caching to avoid
redundant loading of AST files.

Right now only function defnitions can be loaded using this API because this is
what the in progress cross translation unit feature of the Static Analyzer
requires. In to future this might be extended to classes, types etc.

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

llvm-svn: 313975

7 years ago[asan/lsan] Trying to fix PPC64 and x380x buildbots after r313966
Maxim Ostapenko [Fri, 22 Sep 2017 10:44:28 +0000 (10:44 +0000)]
[asan/lsan] Trying to fix PPC64 and x380x buildbots after r313966

llvm-svn: 313974

7 years ago[analyzer] Add new delete with non-virtual destructor check
Gabor Horvath [Fri, 22 Sep 2017 10:16:33 +0000 (10:16 +0000)]
[analyzer] Add new delete with non-virtual destructor check

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 313973

7 years ago[ARM] Add missing selection patterns for vnmla
Simon Pilgrim [Fri, 22 Sep 2017 09:50:52 +0000 (09:50 +0000)]
[ARM] Add missing selection patterns for vnmla

For the following function:

  double fn1(double d0, double d1, double d2) {
    double a = -d0 - d1 * d2;
    return a;
  }

on ARM, LLVM generates code along the lines of

  vneg.f64  d0, d0
  vmls.f64  d0, d1, d2

i.e., a negate and a multiply-subtract.

The attached patch adds instruction selection patterns to allow it to generate the single instruction

  vnmla.f64  d0, d1, d2

(multiply-add with negation) instead, like GCC does.

Committed on behalf of @gergo- (Gergö Barany)

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

llvm-svn: 313972

7 years ago[dwarfdump] Fix ambiguous call to make_unique
Jonas Devlieghere [Fri, 22 Sep 2017 09:38:52 +0000 (09:38 +0000)]
[dwarfdump] Fix ambiguous call to make_unique

Fix buildbot failures:
 - http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc2015/builds/13153
 - http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/13566

llvm-svn: 313971

7 years ago[obj2yaml] Don't crash for input files without symbol table
Alexander Richardson [Fri, 22 Sep 2017 09:30:40 +0000 (09:30 +0000)]
[obj2yaml] Don't crash for input files without symbol table

Summary: Previously we would dereference Symtab without checking for null.

Reviewers: davide, atanasyan, rafael

Reviewed By: davide, atanasyan

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

llvm-svn: 313970

7 years ago[dwarfdump] Add support for redirecting output to a file
Jonas Devlieghere [Fri, 22 Sep 2017 09:20:57 +0000 (09:20 +0000)]
[dwarfdump] Add support for redirecting output to a file

This patch adds the -o and --out-file options for compatibility with
Darwin's dwarfdump.

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

llvm-svn: 313969

7 years ago[mips] clang-format MipsTargetMachine.cpp
Alexander Richardson [Fri, 22 Sep 2017 08:52:03 +0000 (08:52 +0000)]
[mips] clang-format MipsTargetMachine.cpp

This is my test commit as it only changes two lines

llvm-svn: 313968

7 years ago[asan/lsan] Trying to fix buildbots after r313966
Maxim Ostapenko [Fri, 22 Sep 2017 08:23:16 +0000 (08:23 +0000)]
[asan/lsan] Trying to fix buildbots after r313966

llvm-svn: 313967

7 years ago[asan/lsan] Make LSan compliant with recovery mode when running on top of ASan
Maxim Ostapenko [Fri, 22 Sep 2017 07:11:43 +0000 (07:11 +0000)]
[asan/lsan] Make LSan compliant with recovery mode when running on top of ASan

Don't overwrite exit code in LSan when running on top of ASan in recovery mode
to avoid breakage of users code due to found leaks.

Patch by Slava Barinov.

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

llvm-svn: 313966

7 years ago[AVR] Remove the 'IsN64' argument to 'MCELFObjectWriter'
Dylan McKay [Fri, 22 Sep 2017 06:32:23 +0000 (06:32 +0000)]
[AVR] Remove the 'IsN64' argument to 'MCELFObjectWriter'

This has since been removed.

llvm-svn: 313965

7 years ago[X86] Updating the test case for FMF propagation.
Jatin Bhateja [Fri, 22 Sep 2017 05:48:20 +0000 (05:48 +0000)]
[X86] Updating the test case for FMF propagation.

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

llvm-svn: 313964

7 years ago[clang-format] Ignore case and stable sort using-declarations
Krasimir Georgiev [Fri, 22 Sep 2017 04:48:17 +0000 (04:48 +0000)]
[clang-format] Ignore case and stable sort using-declarations

Summary:
This ignores case while sorting using-declarations, fixing a case where `_` would appear between lowercase and uppercase characters.
It also applies stable sort, so that replacements for the exact same using declarations are not generated.

Reviewers: klimek, alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

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

llvm-svn: 313963

7 years ago[clang-tidy] Fix example in documentation, NFC
Krasimir Georgiev [Fri, 22 Sep 2017 04:37:56 +0000 (04:37 +0000)]
[clang-tidy] Fix example in documentation, NFC

Summary: A fix in documentation.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: JDevlieghere, xazax.hun

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

llvm-svn: 313962

7 years agobpf: initial 32-bit ALU encoding support in assembler
Yonghong Song [Fri, 22 Sep 2017 04:36:36 +0000 (04:36 +0000)]
bpf: initial 32-bit ALU encoding support in assembler

This patch adds instruction patterns for operations in BPF_ALU. After this,
assembler could recognize some 32-bit ALU statement. For example, those listed
int the unit test file.

Separate MOV patterns are unnecessary as MOV is ALU operation that could reuse
ALU encoding infrastructure, this patch removed those redundant patterns.

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 313961

7 years agobpf: add 32bit register set
Yonghong Song [Fri, 22 Sep 2017 04:36:35 +0000 (04:36 +0000)]
bpf: add 32bit register set

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 313960

7 years agobpf: refactor inst patterns with better inheritance
Yonghong Song [Fri, 22 Sep 2017 04:36:34 +0000 (04:36 +0000)]
bpf: refactor inst patterns with better inheritance

Arithmetic and jump instructions, load and store instructions are sharing
the same 8-bit code field encoding,

A better instruction pattern implemention could be the following inheritance
relationships, and each layer only encoding those fields which start to
diverse from that layer. This avoids some redundant code.

  InstBPF -> TYPE_ALU_JMP -> ALU/JMP
  InstBPF -> TYPE_LD_ST -> Load/Store

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 313959

7 years agobpf: refactor inst patterns with more mnemonics
Yonghong Song [Fri, 22 Sep 2017 04:36:32 +0000 (04:36 +0000)]
bpf: refactor inst patterns with more mnemonics

Currently, eBPF backend is using some constant directly in instruction patterns,
This patch replace them with mnemonics and removed some unnecessary temparary
variables.

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 313958

7 years agoClosure types have no name (and can't have a typedef name for linkage
Richard Smith [Fri, 22 Sep 2017 04:33:20 +0000 (04:33 +0000)]
Closure types have no name (and can't have a typedef name for linkage
purposes), so they never formally have linkage.

llvm-svn: 313957

7 years agoAArch64: support SwiftCC properly on AAPCS64
Saleem Abdulrasool [Fri, 22 Sep 2017 04:31:44 +0000 (04:31 +0000)]
AArch64: support SwiftCC properly on AAPCS64

The previous SwiftCC support for AAPCS64 was partially correct.  It
setup swiftself parameters in the proper register but failed to setup
swifterror in the correct register.  This would break compilation of
swift code for non-Darwin AAPCS64 conforming environments.

llvm-svn: 313956

7 years agoGive external linkage and mangling to lambdas inside inline variables and variable...
Richard Smith [Fri, 22 Sep 2017 04:25:05 +0000 (04:25 +0000)]
Give external linkage and mangling to lambdas inside inline variables and variable templates.

This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33

This reinstates r313827, reverted in r313856, with a fix for the 'out-of-bounds
enumeration value' ubsan error in that change.

llvm-svn: 313955

7 years agoDriver: remove support for libstdc++ from CrossWindows
Saleem Abdulrasool [Fri, 22 Sep 2017 04:01:12 +0000 (04:01 +0000)]
Driver: remove support for libstdc++ from CrossWindows

This code path is entirely untested and not really maintained.  The
expected use here is with libc++ only.

llvm-svn: 313954

7 years agoClean up some mistreatment of enumerations.
Richard Smith [Fri, 22 Sep 2017 02:22:32 +0000 (02:22 +0000)]
Clean up some mistreatment of enumerations.

llvm-svn: 313953

7 years agoAdd test cases that weren't committed in r313945.
Akira Hatanaka [Fri, 22 Sep 2017 01:54:36 +0000 (01:54 +0000)]
Add test cases that weren't committed in r313945.

llvm-svn: 313952

7 years agoRename markAsErased to erase, as pointed out in a previous review; NFC
Sanjoy Das [Fri, 22 Sep 2017 01:47:41 +0000 (01:47 +0000)]
Rename markAsErased to erase, as pointed out in a previous review; NFC

llvm-svn: 313951

7 years ago[Analyzer] Static analyzer script for updating reference results
George Karpenkov [Fri, 22 Sep 2017 01:43:12 +0000 (01:43 +0000)]
[Analyzer] Static analyzer script for updating reference results

The script updates reference results from the previous run, and stages them.

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

llvm-svn: 313950

7 years ago[Analyzer] Refactor analyzer testing scripts.
George Karpenkov [Fri, 22 Sep 2017 01:41:16 +0000 (01:41 +0000)]
[Analyzer] Refactor analyzer testing scripts.

 - Exporting needed function for future reuse.
 - Idiomatic python: using with `file as f` instead of `try/finally`.
 - Fixing some indentation issues.
 - No need to reinvent python `multiprocessing.getCPUCount()`
 - Removing a function parameter which is always the same under all invocations.
 - Adding some docstrings.

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

llvm-svn: 313949

7 years agoFix tracking of whether a destructor would be deleted.
Richard Smith [Fri, 22 Sep 2017 01:04:22 +0000 (01:04 +0000)]
Fix tracking of whether a destructor would be deleted.

I've been unable to find any cases whose behavior is actually changed by this,
but only because an implicitly deleted destructor also results in it being
impossible to have a trivial (non-deleted) copy constructor, which the place
where this really matters (choosing whether to pass a class in registers)
happens to also check.

llvm-svn: 313948

7 years agoHexagonVectorLoopCarriedReuse.cpp: Apply LLVM_ATTRIBUTE_UNUSED. [-Wunused-function]
NAKAMURA Takumi [Fri, 22 Sep 2017 01:01:33 +0000 (01:01 +0000)]
HexagonVectorLoopCarriedReuse.cpp: Apply LLVM_ATTRIBUTE_UNUSED. [-Wunused-function]

llvm-svn: 313947

7 years agoReformat.
NAKAMURA Takumi [Fri, 22 Sep 2017 01:01:31 +0000 (01:01 +0000)]
Reformat.

llvm-svn: 313946

7 years agoAdd support for attribute 'noescape'.
Akira Hatanaka [Fri, 22 Sep 2017 00:41:05 +0000 (00:41 +0000)]
Add support for attribute 'noescape'.

The attribute informs the compiler that the annotated pointer parameter
of a function cannot escape and enables IRGen to attach attribute
'nocapture' to parameters that are annotated with the attribute. That is
the only optimization that currently takes advantage of 'noescape', but
there are other optimizations that will be added later that improves
IRGen for ObjC blocks.

This recommits r313722, which was reverted in r313725 because clang
couldn't build compiler-rt. It failed to build because there were
function declarations that were missing 'noescape'. That has been fixed
in r313929.

rdar://problem/19886775

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

llvm-svn: 313945

7 years ago[Analyzer] Log when auto-synthesized body is used.
George Karpenkov [Fri, 22 Sep 2017 00:37:12 +0000 (00:37 +0000)]
[Analyzer] Log when auto-synthesized body is used.

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

llvm-svn: 313944

7 years agoExtend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.
Richard Smith [Fri, 22 Sep 2017 00:11:15 +0000 (00:11 +0000)]
Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.

llvm-svn: 313943

7 years agoFix unused variable warning.
Richard Trieu [Thu, 21 Sep 2017 23:48:01 +0000 (23:48 +0000)]
Fix unused variable warning.

Move function call into debug macro to suppress unused variable warning
in non-debug builds.

llvm-svn: 313942

7 years ago[CodeGen] Fix some Clang-tidy modernize-use-bool-literals and Include What You Use...
Eugene Zelenko [Thu, 21 Sep 2017 23:20:16 +0000 (23:20 +0000)]
[CodeGen] Fix some Clang-tidy modernize-use-bool-literals and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 313941

7 years agoFix a bug in a historic bitcode testcase.
Adrian Prantl [Thu, 21 Sep 2017 23:14:55 +0000 (23:14 +0000)]
Fix a bug in a historic bitcode testcase.

llvm-svn: 313940

7 years agoFix a bug in a historic bitcode testcase. NFC.
Adrian Prantl [Thu, 21 Sep 2017 23:14:52 +0000 (23:14 +0000)]
Fix a bug in a historic bitcode testcase. NFC.

llvm-svn: 313939

7 years agoUpdate for llvm change.
Rafael Espindola [Thu, 21 Sep 2017 23:13:40 +0000 (23:13 +0000)]
Update for llvm change.

llvm-svn: 313938

7 years agoConvert the archive writer to use Error.
Rafael Espindola [Thu, 21 Sep 2017 23:13:36 +0000 (23:13 +0000)]
Convert the archive writer to use Error.

This found one place in lld that was not checking the error.

llvm-svn: 313937

7 years ago[Hexagon] - Fix testcase for the HexagonVectorLoopCarriedReuse pass.
Pranav Bhandarkar [Thu, 21 Sep 2017 23:11:28 +0000 (23:11 +0000)]
[Hexagon] - Fix testcase for the HexagonVectorLoopCarriedReuse pass.

llvm-svn: 313936

7 years agoUse raw_ostream in functions that don't need to seek. NFC.
Rafael Espindola [Thu, 21 Sep 2017 23:06:23 +0000 (23:06 +0000)]
Use raw_ostream in functions that don't need to seek. NFC.

llvm-svn: 313935

7 years agoRevert this patch; I was emailing with Eugene and they have some other changes going
Jason Molenda [Thu, 21 Sep 2017 23:02:56 +0000 (23:02 +0000)]
Revert this patch; I was emailing with Eugene and they have some other changes going
in today and don't want the two changes to confuse the situation with the build bots.
I'll commit tomorrow once they're known good.

llvm-svn: 313934

7 years agoSimplify the logic for truncating UID and GID. NFC.
Rafael Espindola [Thu, 21 Sep 2017 23:00:55 +0000 (23:00 +0000)]
Simplify the logic for truncating UID and GID. NFC.

llvm-svn: 313933

7 years agoInitial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Jason Molenda [Thu, 21 Sep 2017 23:00:19 +0000 (23:00 +0000)]
Initial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Normal customer devices won't be able to run these devices, we're hoping to get
a public facing bot set up at some point.

There will be some smaller follow-on patches.  The changes to tools/lldb-server are
verbose and I'm not thrilled with having to skip all of these tests manually.
There are a few places where I'm making the assumption that "armv7", "armv7k", "arm64"
means it's an ios device, and I need to review & clean these up with an OS check
as well.  (Android will show up as "arm" and "aarch64" so by pure luck they shouldn't
cause problems, but it's not an assumption I want to rely on).

I'll be watching the bots for the rest of today; if any problems are introduced by
this patch I'll revert it - if anyone sees a problem with their bot that I don't
see, please do the same.  I know it's a rather large patch.

One change I had to make specifically for iOS devices was that debugserver can't
create files.  There were several tests that launch the inferior process redirecting
its output to a file, then they retrieve the file.  They were not trying to test
file redirection in these tests, so I rewrote those to write their output to a file
directly.

llvm-svn: 313932

7 years agoRevert "Add a testfile that I missed in a previous commit that added HexagonVectorLoo...
Rafael Espindola [Thu, 21 Sep 2017 22:57:43 +0000 (22:57 +0000)]
Revert "Add a testfile that I missed in a previous commit that added HexagonVectorLoopCarriedReuse pass"

This reverts commit r313926.

It was failing in some bots.

llvm-svn: 313931

7 years agoSimplify error handling. NFC.
Rafael Espindola [Thu, 21 Sep 2017 22:50:52 +0000 (22:50 +0000)]
Simplify error handling. NFC.

llvm-svn: 313930

7 years ago[tsan] Annotate function parameters with attribute 'noescape'.
Akira Hatanaka [Thu, 21 Sep 2017 22:16:50 +0000 (22:16 +0000)]
[tsan] Annotate function parameters with attribute 'noescape'.

This commit annotates the block parameters of the following functions
declared in compiler-rt with 'noescape':

- dispatch_sync
- dispatch_barrier_sync
- dispatch_once
- dispatch_apply

This is needed to commit the patch that adds support for 'noescape' in
clang (see https://reviews.llvm.org/D32210) since these functions are
annotated with 'noescape' in the SDK header files.

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

llvm-svn: 313929

7 years agoResubmit "[lit] Refactor out some more common lit configuration code."
Zachary Turner [Thu, 21 Sep 2017 22:16:40 +0000 (22:16 +0000)]
Resubmit "[lit] Refactor out some more common lit configuration code."

There were two issues, one Python 3 specific related to Unicode,
and another which is that the tool substitution for lld no longer
rejected matches where a / preceded the tool name.

llvm-svn: 313928

7 years ago[Analyzer] Use CC environment variable to select analyzer path in SATestBuild.
George Karpenkov [Thu, 21 Sep 2017 22:12:49 +0000 (22:12 +0000)]
[Analyzer] Use CC environment variable to select analyzer path in SATestBuild.

This change is required to easily test the given checkout of the analyzer,
rather than the one bundled with a system compiler.

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

llvm-svn: 313927

7 years agoAdd a testfile that I missed in a previous commit that
Pranav Bhandarkar [Thu, 21 Sep 2017 21:52:24 +0000 (21:52 +0000)]
Add a testfile that I missed in a previous commit that
added HexagonVectorLoopCarriedReuse pass

llvm-svn: 313926

7 years agoEnable the reuse of values computed in a previous loop iteration.
Pranav Bhandarkar [Thu, 21 Sep 2017 21:48:23 +0000 (21:48 +0000)]
Enable the reuse of values computed in a previous loop iteration.

This patch adds a pass that removes the computation of provably redundant
expressions that have been computed earlier in a previous iteration. It
relies on the use of PHIs to identify loop carried dependences.

This is scalar replacement for vector types.

llvm-svn: 313925

7 years ago[Analyzer] Add simple help to SATestAdd.py
George Karpenkov [Thu, 21 Sep 2017 21:47:33 +0000 (21:47 +0000)]
[Analyzer] Add simple help to SATestAdd.py

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

llvm-svn: 313924

7 years ago[Analyzer] Remove dead code from CmpRuns.py.
George Karpenkov [Thu, 21 Sep 2017 21:47:13 +0000 (21:47 +0000)]
[Analyzer] Remove dead code from CmpRuns.py.

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

llvm-svn: 313923

7 years agoRevert "[lit] Refactor out some more common lit configuration code."
Zachary Turner [Thu, 21 Sep 2017 21:45:45 +0000 (21:45 +0000)]
Revert "[lit] Refactor out some more common lit configuration code."

This is breaking several bots.  I have enough information to
investigate, so I'm reverting to green until I get it figured
out.

llvm-svn: 313922

7 years agoFix a bug in llvm-objdump when disassembling using the wrong default CPU
Kevin Enderby [Thu, 21 Sep 2017 21:45:02 +0000 (21:45 +0000)]
Fix a bug in llvm-objdump when disassembling using the wrong default CPU
in the second slice of a Mach-O universal file.

The code in llvm-objdump in in DisassembleMachO() was getting the default
CPU then incorrectly setting into the global variable used for the -mcpu option
if that was not set.  This caused a second call to DisassembleMachO() to use
the wrong default CPU when disassembling the next slice in a Mach-O universal
file.  And would result in bad disassembly and an error message about an
recognized processor for the target:

% llvm-objdump -d -m -arch all  fat.macho-armv7s-arm64
fat.macho-armv7s-arm64 (architecture armv7s):
(__TEXT,__text) section
armv7:
       0: 60 47  bx r12
fat.macho-armv7s-arm64 (architecture arm64):
'cortex-a7' is not a recognized processor for this target (ignoring processor)
'cortex-a7' is not a recognized processor for this target (ignoring processor)
(__TEXT,__text) section
___multc3:
       0: .long 0x1e620810

rdar://34439149

llvm-svn: 313921

7 years ago[libunwind] Partially revert r297174 to fix build on at least FreeBSD.
John Baldwin [Thu, 21 Sep 2017 21:28:48 +0000 (21:28 +0000)]
[libunwind] Partially revert r297174 to fix build on at least FreeBSD.

The changes in r297174 moved the #include of <link.h> on FreeBSD (and
probably other systems) inside of the open 'libunwind' namespace
causing various system-provided types such as pid_t to be declared in
this namespace rather than the global namespace.  Fix this by moving
the relevant declarations before the 'libunwind' namespace is opened,
but still using the cleaned up declarations from r297174.

Reviewed By: ed, compnerd

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

llvm-svn: 313920

7 years ago[lit] Refactor out some more common lit configuration code.
Zachary Turner [Thu, 21 Sep 2017 21:27:31 +0000 (21:27 +0000)]
[lit] Refactor out some more common lit configuration code.

debuginfo-tests has need to reuse a lot of common configuration
from clang and lld, and in general it seems like all of the
projects which are tightly coupled (e.g. lld, clang, llvm, lldb,
etc) can benefit from knowing about one other.  For example,
lldb needs to know various things about how to run clang in its
test suite.  Since there's a lot of common substitutions and
operations that need to be shared among projects, sinking this
up into LLVM makes sense.

In addition, this patch introduces a function add_tool_substitution
which handles all the dirty intricacies of matching tool names
which was previously copied around the various config files.  This
is now a simple straightforward interface which is hard to mess
up.

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

llvm-svn: 313919

7 years ago[lit] Actually do normalize the case of files in the config map.
Zachary Turner [Thu, 21 Sep 2017 21:27:11 +0000 (21:27 +0000)]
[lit] Actually do normalize the case of files in the config map.

This has gone back and forth, but it seems this is necessary
after all.  realpath is not sufficient because if you have a
file named 'C:\foo.txt', then both realpath('c:\foo.txt') and
realpath(C:\foo.txt') return the string that was passed to them
exactly as is, meaning the case of the drive-letter won't match.

The problem before was not that we were normalizing the case of
items going into the config map, but rather that we were
normalizing the case of something we needed to print.  The value
that is used to key on the config map should never be printed.

llvm-svn: 313918

7 years ago[AArch64] Fix bug in store of vector 0 DAGCombine.
Geoff Berry [Thu, 21 Sep 2017 21:10:06 +0000 (21:10 +0000)]
[AArch64] Fix bug in store of vector 0 DAGCombine.

Summary:
Avoid using XZR/WZR directly as operands to split stores of zero
vectors.  Doing so can lead to the XZR/WZR being used by an instruction
that doesn't allow it (e.g. add).

Fixes bug 34674.

Reviewers: t.p.northover, efriedma, MatzeB

Subscribers: aemerson, rengolin, javed.absar, mcrosier, eraman, llvm-commits, kristof.beyls

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

llvm-svn: 313916

7 years ago[ELF] Fix edge condition in thunk offset calculation
Shoaib Meenai [Thu, 21 Sep 2017 21:04:42 +0000 (21:04 +0000)]
[ELF] Fix edge condition in thunk offset calculation

For ARM thunks, the `movt` half of the relocation was using an incorrect
offset (it was off by 4 bytes). The original intent seems to have been
for the offset to have been relative to the current instruction, in
which case the difference of 4 makes sense. As the code stands, however,
the offset is always calculated relative to the start of the thunk
(`P`), and so the `movw` and `movt` halves should use the same offset.
This requires a very particular offset between the thunk and its target
to be triggered, and it results in the `movt` half of the relocation
being off-by-one.

The tests here use ARM-Thumb interworking thunks, since those are the
only ARM thunks currently implemented. I actually encountered this with
a range extension thunk (having Peter's patches cherry-picked locally),
but the underlying issue is identical.

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

llvm-svn: 313915

7 years ago[libclang] Keep track of TranslationUnit instance when annotating tokens
Jonathan Coe [Thu, 21 Sep 2017 20:48:43 +0000 (20:48 +0000)]
[libclang] Keep track of TranslationUnit instance when annotating tokens

Summary:
Previously the `_tu` was not propagated to the returned cursor, leading to errors when calling any
method on that cursor (e.g. `cursor.referenced`).

Reviewers: jbcoe, rsmith

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by jklaehn (Johann Klähn)

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

llvm-svn: 313913

7 years ago[llvm-readobj] Fix big-endian byte swap in WindowsResourceDumper.
Marek Sokolowski [Thu, 21 Sep 2017 20:36:38 +0000 (20:36 +0000)]
[llvm-readobj] Fix big-endian byte swap in WindowsResourceDumper.

The previous version of dumper implemented UTF-16 byte swap incorrectly
on big-endian machines. This now gets fixed.

Thanks to Bill Seurer for testing the patch locally.

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

llvm-svn: 313912

7 years agoRemove svn-properties for file added in 313909 (NFC)
Erich Keane [Thu, 21 Sep 2017 20:31:01 +0000 (20:31 +0000)]
Remove svn-properties for file added in 313909 (NFC)

llvm-svn: 313911