platform/upstream/llvm.git
6 years agoCommit missing fixes for tool_file_rename
Reid Kleckner [Sat, 23 Sep 2017 01:04:42 +0000 (01:04 +0000)]
Commit missing fixes for tool_file_rename

llvm-svn: 314051

6 years ago[Support] Rename tool_output_file to ToolOutputFile, NFC
Reid Kleckner [Sat, 23 Sep 2017 01:03:17 +0000 (01:03 +0000)]
[Support] Rename tool_output_file to ToolOutputFile, NFC

This class isn't similar to anything from the STL, so it shouldn't use
the STL naming conventions.

llvm-svn: 314050

6 years ago[CodeGen] Fix build bots which uses old Clang broken in r314046. (NFC)
Eugene Zelenko [Fri, 22 Sep 2017 23:55:32 +0000 (23:55 +0000)]
[CodeGen] Fix build bots which uses old Clang broken in r314046. (NFC)

llvm-svn: 314049

6 years ago[lsan] Add __lsan_default_options
Vitaly Buka [Fri, 22 Sep 2017 23:49:49 +0000 (23:49 +0000)]
[lsan] Add __lsan_default_options

For consistency with asan, msan, tsan and ubsan.

llvm-svn: 314048

6 years agoFix up clang-tidy after clang r314037.
Richard Smith [Fri, 22 Sep 2017 23:47:20 +0000 (23:47 +0000)]
Fix up clang-tidy after clang r314037.

llvm-svn: 314047

6 years ago[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What...
Eugene Zelenko [Fri, 22 Sep 2017 23:46:57 +0000 (23:46 +0000)]
[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 314046

6 years agoImplement trampoline step-through for Windows-x86.
Stephane Sezer [Fri, 22 Sep 2017 23:41:41 +0000 (23:41 +0000)]
Implement trampoline step-through for Windows-x86.

Summary:
This is required to be able to step through calls to external functions
that are not properly marked with __declspec(dllimport). When a call
like this is emitted, the linker will inject a trampoline to produce an
indirect call through the IAT.

Reviewers: zturner, jingham

Reviewed By: jingham

Subscribers: sas, jingham, lldb-commits

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

llvm-svn: 314045

6 years ago[X86] [MC] fixed non optimal encoding of instruction memory operand (PR24038).
Konstantin Belochapka [Fri, 22 Sep 2017 23:37:48 +0000 (23:37 +0000)]
[X86] [MC] fixed non optimal encoding of instruction memory operand (PR24038).
Fixed suboptimal encoding of instruction memory operand when assembler is used to select 32 bit fixup rather than 8 bit immediate for encoding memory offset value.
Differential Revision: https://reviews.llvm.org/D38117

llvm-svn: 314044

6 years agoFix uninteneded fallthrough detected by GCC warning
Reid Kleckner [Fri, 22 Sep 2017 23:19:52 +0000 (23:19 +0000)]
Fix uninteneded fallthrough detected by GCC warning

llvm-svn: 314043

6 years ago[Analyzer] Fix minor errors in python scripts.
George Karpenkov [Fri, 22 Sep 2017 22:58:46 +0000 (22:58 +0000)]
[Analyzer] Fix minor errors in python scripts.

llvm-svn: 314042

6 years ago[lsan] Deadly signal handler for lsan
Vitaly Buka [Fri, 22 Sep 2017 22:57:48 +0000 (22:57 +0000)]
[lsan] Deadly signal handler for lsan

Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, dberris, kubamracek, krytarowski

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

llvm-svn: 314041

6 years ago[sanitizer] Replace thread id with GetThreadSelf
Vitaly Buka [Fri, 22 Sep 2017 22:36:21 +0000 (22:36 +0000)]
[sanitizer] Replace thread id with GetThreadSelf

This allows to avoid constructor parameter

llvm-svn: 314040

6 years ago[sanitizer] Move ScopedErrorReportLock into libcdep version
Vitaly Buka [Fri, 22 Sep 2017 22:36:11 +0000 (22:36 +0000)]
[sanitizer] Move ScopedErrorReportLock into libcdep version

llvm-svn: 314039

6 years agoInitial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Jason Molenda [Fri, 22 Sep 2017 22:34:53 +0000 (22:34 +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.  Both devices pass the testsuite without
any errors or failures.

I have seen some instability with the armv7 test runs, I may submit additional patches
to address this.  arm64 looks good.

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: 314038

6 years agoDR1113: anonymous namespaces formally give their contents internal linkage.
Richard Smith [Fri, 22 Sep 2017 22:21:44 +0000 (22:21 +0000)]
DR1113: anonymous namespaces formally give their contents internal linkage.

This doesn't affect our code generation in any material way -- we already give
such declarations internal linkage from a codegen perspective -- but it has
some subtle effects on code validity.

We suppress the 'L' (internal linkage) marker for mangled names in anonymous
namespaces, because it is redundant (the information is already carried by the
namespace); this deviates from GCC's behavior if a variable or function in an
anonymous namespace is redundantly declared 'static' (where GCC does include
the 'L'), but GCC's behavior is incoherent because such a declaration can be
validly declared with or without the 'static'.

We still deviate from the standard in one regard here: extern "C" declarations
in anonymous namespaces are still granted external linkage. Changing those does
not appear to have been an intentional consequence of the standard change in
DR1113.

llvm-svn: 314037

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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