platform/upstream/llvm.git
7 years ago[test] Enable clang-func-mapping as a test dep with the analyzer
Vedant Kumar [Fri, 22 Sep 2017 22:17:10 +0000 (22:17 +0000)]
[test] Enable clang-func-mapping as a test dep with the analyzer

clang-func-mapping should not be a test dependency when the static
analyzer isn't being built.

llvm-svn: 314036

7 years agoFix unused variable warning in non-debug builds.
Richard Trieu [Fri, 22 Sep 2017 22:16:13 +0000 (22:16 +0000)]
Fix unused variable warning in non-debug builds.

llvm-svn: 314035

7 years agoclang-format plugin: Add missing NL (new line) at EOF (end of file)
Hans Wennborg [Fri, 22 Sep 2017 21:47:39 +0000 (21:47 +0000)]
clang-format plugin: Add missing NL (new line) at EOF (end of file)

clang-format.exe removes trailing new lines at end of file.

However, if no NL is found at EOF one should be added.

Patch by Teodor MICU!

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

llvm-svn: 314033

7 years ago[InstCombine] Teach foldICmpUsingKnownBits to simplify SLE/SGE/ULE/UGE to equality...
Craig Topper [Fri, 22 Sep 2017 21:47:22 +0000 (21:47 +0000)]
[InstCombine] Teach foldICmpUsingKnownBits to simplify SLE/SGE/ULE/UGE to equality comparisons when the min/max ranges intersect in a single value.

This is the inverse of what we do for SGT/SLT/UGT/ULT.

llvm-svn: 314032

7 years ago[InstCombine] Add test cases for known bits simplifications for comparisons that...
Craig Topper [Fri, 22 Sep 2017 21:47:21 +0000 (21:47 +0000)]
[InstCombine] Add test cases for known bits simplifications for comparisons that don't depend on constant RHS. NFC

This shows some missing simplifications for sge/sle/uge/ule relative to their non-equality counterparts.

llvm-svn: 314031

7 years ago[InstCombine] Remove a FIXME from a test that was fixed in r314025.
Craig Topper [Fri, 22 Sep 2017 21:47:20 +0000 (21:47 +0000)]
[InstCombine] Remove a FIXME from a test that was fixed in r314025.

llvm-svn: 314030

7 years ago[CodeGen][ObjC] Build the global block structure before emitting the
Akira Hatanaka [Fri, 22 Sep 2017 21:32:06 +0000 (21:32 +0000)]
[CodeGen][ObjC] Build the global block structure before emitting the
body of global block invoke functions.

This commit fixes an infinite loop in IRGen that occurs when compiling
the following code:

void FUNC2() {
  static void (^const block1)(int) = ^(int a){
    if (a--)
      block1(a);
  };
}

This is how IRGen gets stuck in the infinite loop:

1. GenerateBlockFunction is called to emit the body of "block1".

2. GetAddrOfGlobalBlock is called to get the address of "block1". The
   function calls getAddrOfGlobalBlockIfEmitted to check whether the
   global block has been emitted. If it hasn't been emitted, it then
   tries to emit the body of the block function by calling
   GenerateBlockFunction, which goes back to step 1.

This commit prevents the inifinite loop by building the global block in
GenerateBlockFunction before emitting the body of the block function.

rdar://problem/34541684

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

llvm-svn: 314029

7 years agoFixed broken links in docs.
Ilya Biryukov [Fri, 22 Sep 2017 21:10:37 +0000 (21:10 +0000)]
Fixed broken links in docs.

Replaced references to `llvm.org/klaus` with `git.llvm.org/klaus`.

llvm-svn: 314028

7 years ago[x86] remove over-specified platform from test config
Sanjay Patel [Fri, 22 Sep 2017 21:07:13 +0000 (21:07 +0000)]
[x86] remove over-specified platform from test config

llvm-svn: 314027

7 years ago[PowerPC] Mark P9 scheduling model complete
Stefan Pintilie [Fri, 22 Sep 2017 20:17:25 +0000 (20:17 +0000)]
[PowerPC] Mark P9 scheduling model complete

This patch just adds the missing information to the P9 scheduling model to allow
the model to be marked as complete.

The model has been verified against P9 documentation. The model was verified
with utils/schedcover.py.

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

llvm-svn: 314026

7 years ago[InstCombine] Add constant splat handling to one of the ICMP_SLT/SGT cases in foldICm...
Craig Topper [Fri, 22 Sep 2017 19:54:15 +0000 (19:54 +0000)]
[InstCombine] Add constant splat handling to one of the ICMP_SLT/SGT cases in foldICmpUsingKnownBits.

llvm-svn: 314025

7 years ago[x86] shiftRightAlgebraic -> shiftRightArithmetic; NFC
Sanjay Patel [Fri, 22 Sep 2017 19:49:37 +0000 (19:49 +0000)]
[x86] shiftRightAlgebraic -> shiftRightArithmetic; NFC

x86 re-education camp is in session. The LLVM LangRef agrees with x86 too.
The DAG nodes are undocumented and ambiguous as always. :)

llvm-svn: 314024

7 years ago[x86] swap order of srl (and X, C1), C2 when it saves size
Sanjay Patel [Fri, 22 Sep 2017 19:37:21 +0000 (19:37 +0000)]
[x86] swap order of srl (and X, C1), C2 when it saves size

The (non-)obvious win comes from saving 3 bytes by using the 0x83 'and' opcode variant instead of 0x81.
There are also better improvements based on known-bits that allow us to eliminate the mask entirely.

As noted, this could be extended. There are potentially other wins from always shifting first, but doing
that reveals a tangle of problems in other pattern matching. We do this transform generically in
instcombine, but we often have icmp IR that doesn't match that pattern, so we must account for this
in the backend.

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

llvm-svn: 314023

7 years ago[clang] Fix isExternC matcher docs
Alexander Shaposhnikov [Fri, 22 Sep 2017 19:29:38 +0000 (19:29 +0000)]
[clang] Fix isExternC matcher docs

The wording in the documentation for the matcher isExternC
appears to be misleading since this matcher
is applicable to functions and variables as well.
This diff changes the comment and regenerates the html file.

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

llvm-svn: 314022

7 years agoFix fuchsia builds broken by r313999
Francis Ricci [Fri, 22 Sep 2017 19:22:08 +0000 (19:22 +0000)]
Fix fuchsia builds broken by r313999

llvm-svn: 314021

7 years ago[clangd] Updated gold for completion tests after cfe changes.
Ilya Biryukov [Fri, 22 Sep 2017 19:07:45 +0000 (19:07 +0000)]
[clangd] Updated gold for completion tests after cfe changes.

llvm-svn: 314020

7 years agoSet completion priority of destructors and operators to CCP_Unlikely.
Ilya Biryukov [Fri, 22 Sep 2017 19:07:37 +0000 (19:07 +0000)]
Set completion priority of destructors and operators to CCP_Unlikely.

Summary:
It will move destructors and operators to the end of completion list.
Destructors and operators are currently very high on the completion
list, as they have the same priority as member functions. However,
they are clearly not something users usually choose in completion
lists.

Reviewers: arphaman, erikjv, bkramer, krasimir

Reviewed By: arphaman

Subscribers: eraman, klimek, cfe-commits

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

llvm-svn: 314019

7 years ago[InstCombine] Move the call to isSignBitCheck into getDemandedBitsLHSMask instead...
Craig Topper [Fri, 22 Sep 2017 18:57:23 +0000 (18:57 +0000)]
[InstCombine] Move the call to isSignBitCheck into getDemandedBitsLHSMask instead of calling it outside and passing its result through a flag. NFCI

The result of the isSignBitCheck isn't used anywhere else and this allows us to share the m_APInt call in the likely case that it isn't a sign bit check.

llvm-svn: 314018

7 years ago[InstCombine] Simplify check for RHS being a splat constant in foldICmpUsingKnownBits...
Craig Topper [Fri, 22 Sep 2017 18:57:22 +0000 (18:57 +0000)]
[InstCombine] Simplify check for RHS being a splat constant in foldICmpUsingKnownBits by just checking Op1Min==Op1Max rather than going through m_APInt.

llvm-svn: 314017

7 years ago[InstCombine] Make cases for ICMP_UGT/ICMP_ULT use similar formatting since they...
Craig Topper [Fri, 22 Sep 2017 18:57:20 +0000 (18:57 +0000)]
[InstCombine] Make cases for ICMP_UGT/ICMP_ULT use similar formatting since they use similar code. NFC

llvm-svn: 314016

7 years ago[sanitizer] Replace AddressSanitizer with correct tool name
Vitaly Buka [Fri, 22 Sep 2017 18:50:18 +0000 (18:50 +0000)]
[sanitizer] Replace AddressSanitizer with correct tool name

llvm-svn: 314015

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