platform/upstream/llvm.git
7 years agoFixed a type conversion error in BitVector.
Zachary Turner [Fri, 21 Apr 2017 20:18:43 +0000 (20:18 +0000)]
Fixed a type conversion error in BitVector.

llvm-svn: 301033

7 years ago[ms] Give -Wmicrosoft-enum-forward-reference a chance to fire in clang-cl, PR32736
Nico Weber [Fri, 21 Apr 2017 20:12:26 +0000 (20:12 +0000)]
[ms] Give -Wmicrosoft-enum-forward-reference a chance to fire in clang-cl, PR32736

clang-cl sets MicrosoftCompat. In that mode, we always give enums a fixed
underlying type, and for enums with fixed underlying type we never enter the
block that tries to emit ext_ms_forward_ref_enum. Fix this by requiring an
explicit underlying type when we're skipping this diagnostic.

We had a test for this warning, but it only ran in C++98 mode. clang-cl always
enables -std=c++14, so MicrosoftCompatibiliy-cxx98.cpp is a fairly useless
test. Fold it into MicrosoftCompatibility.cpp -- that way, the test checks if
-Wmicrosoft-enum-forward-reference can fire in clang-cl builds.

https://reviews.llvm.org/D32369

llvm-svn: 301032

7 years ago[BitVector] Make BitVector store an ArrayRef.
Zachary Turner [Fri, 21 Apr 2017 20:12:08 +0000 (20:12 +0000)]
[BitVector] Make BitVector store an ArrayRef.

This makes certain operations on the underlying storage
easier since we have access to ArrayRef methods such as
drop_front, drop_back, slice, range-based for loops, etc.

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

llvm-svn: 301031

7 years agotypo
Adrian Prantl [Fri, 21 Apr 2017 20:06:41 +0000 (20:06 +0000)]
typo

llvm-svn: 301030

7 years agoAMDGPU/GFX9: Enable FastFMAF32
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:57:53 +0000 (19:57 +0000)]
AMDGPU/GFX9: Enable FastFMAF32

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

llvm-svn: 301029

7 years agoAMDGPU: Temporarily disable packed inlinable literals (v2f16, v2i16)
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:45:22 +0000 (19:45 +0000)]
AMDGPU: Temporarily disable packed inlinable literals (v2f16, v2i16)

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

llvm-svn: 301028

7 years ago[asan] Optimize strchr for strict_string_checks=false
Vitaly Buka [Fri, 21 Apr 2017 19:39:46 +0000 (19:39 +0000)]
[asan] Optimize strchr for strict_string_checks=false

Summary:
strchr interceptor does not need to call strlen if strict_string_checks is not
enabled. Unnecessary strlen calls affect python parser performance.

Reviewers: eugenis, kcc

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 301027

7 years agoAMDGPU: Fix S_PACK_HH_B32_B16
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:35:05 +0000 (19:35 +0000)]
AMDGPU: Fix S_PACK_HH_B32_B16
  - We really ought to zero out lower 16 bits

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

llvm-svn: 301026

7 years ago[AMDGPU] Handle SI_MASKED_UNREACHABLE in instruction emitter
Yaxun Liu [Fri, 21 Apr 2017 19:32:02 +0000 (19:32 +0000)]
[AMDGPU] Handle SI_MASKED_UNREACHABLE in instruction emitter

SI_MASKED_UNREACHABLE does not have machine instruction encoding.
It needs special handling in AMDGPUAsmPrinter::EmitInstruction like some
other pseudo instructions.

This patch fixes compilation failure of RadeonRays.

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

llvm-svn: 301025

7 years agoRevert "X86RegisterInfo: eliminateFrameIndex: Avoid code duplication; NFC"
Matthias Braun [Fri, 21 Apr 2017 19:26:45 +0000 (19:26 +0000)]
Revert "X86RegisterInfo: eliminateFrameIndex: Avoid code duplication; NFC"

It seems we have on situation in a sanitizer enable bootstrap build
where the return instruction has a frame index operand that does not
point to a fixed object and fails the assert added here.

This reverts commit r300923.
This reverts commit r300922.

llvm-svn: 301024

7 years agoAMDGPU: Do not lower fast unsafe div for safe, f32, with fp32 denormals
Konstantin Zhuravlyov [Fri, 21 Apr 2017 19:25:33 +0000 (19:25 +0000)]
AMDGPU: Do not lower fast unsafe div for safe, f32, with fp32 denormals

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

llvm-svn: 301023

7 years ago[cfi] Replace elif with elseif in cmake.
Evgeniy Stepanov [Fri, 21 Apr 2017 19:22:15 +0000 (19:22 +0000)]
[cfi] Replace elif with elseif in cmake.

Apparently, elif() is deprecated.

llvm-svn: 301022

7 years ago[InstCombine] use isSubsetOf() for efficiency
Sanjay Patel [Fri, 21 Apr 2017 19:16:52 +0000 (19:16 +0000)]
[InstCombine] use isSubsetOf() for efficiency

C | ~D == -1
~(C | ~D) == 0
~C & D == 0
D & ~C == 0
D.isSubsetOf(C)

llvm-svn: 301021

7 years ago[CMake] Link unittests only against libLLVM.so, if available.
Michael Kruse [Fri, 21 Apr 2017 19:03:51 +0000 (19:03 +0000)]
[CMake] Link unittests only against libLLVM.so, if available.

We can only link against libLLVM.so or the individual libLLVM*.so
components, but not both of them. Doing so results in these components
exist twice in the programs address space, since it is already contained
in libLLVM.so. The observable effect of this is that command line
switches are registered multiple times (once for each instance),
which is an error.

This fixes llvm.org/PR32735.

Reported-by: Singapuram Sanjay Srivallabh <singapuram.sanjay@gmail.com>
llvm-svn: 301020

7 years ago[AArch64] Improve code generation for logical instructions taking
Akira Hatanaka [Fri, 21 Apr 2017 18:53:12 +0000 (18:53 +0000)]
[AArch64] Improve code generation for logical instructions taking
immediate operands.

This commit adds an AArch64 dag-combine that optimizes code generation
for logical instructions taking immediate operands. The optimization
uses demanded bits to change a logical instruction's immediate operand
so that the immediate can be folded into the immediate field of the
instruction.

This recommits r300932 and r300930, which was causing dag-combine to
loop forever. The problem was that optimizeLogicalImm was returning
true even when there was no change to the immediate node (which happened
when the immediate was all zeros or ones), which caused dag-combine to
push and pop the same node to the work list over and over again without
making any progress.

This commit fixes the bug by returning false early in optimizeLogicalImm
if the immediate is all zeros or ones. Also, it changes the code to
compare the immediate with 0 or Mask rather than calling
countPopulation.

rdar://problem/18231627

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

llvm-svn: 301019

7 years ago[InstCombine] fadd double (sitofp x), y check that the promotion is valid
Artur Pilipenko [Fri, 21 Apr 2017 18:45:25 +0000 (18:45 +0000)]
[InstCombine] fadd double (sitofp x), y check that the promotion is valid

Doing these transformations check that the result of integer addition is representable in the FP type.

(fadd double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
(fadd double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))

This is a fix for https://bugs.llvm.org//show_bug.cgi?id=27036

Reviewed By: andrew.w.kaylor, scanon, spatel

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

llvm-svn: 301018

7 years agoFixup for r301007: Restrict the -D hack to Darwin.
Kuba Mracek [Fri, 21 Apr 2017 18:19:56 +0000 (18:19 +0000)]
Fixup for r301007: Restrict the -D hack to Darwin.

llvm-svn: 301017

7 years ago[cfi] Run tests with and without lld and thinlto.
Evgeniy Stepanov [Fri, 21 Apr 2017 18:11:23 +0000 (18:11 +0000)]
[cfi] Run tests with and without lld and thinlto.

Run tests in all configurations:
(standalone, with devirtualization) * (gold, lld) * (lto, thinlto)

llvm-svn: 301016

7 years ago[scudo] Bypass Quarantine if its size is set to 0
Kostya Kortchinsky [Fri, 21 Apr 2017 18:10:53 +0000 (18:10 +0000)]
[scudo] Bypass Quarantine if its size is set to 0

Summary:
In the current state of things, the deallocation path puts a chunk in the
Quarantine whether it's enabled or not (size of 0). When the Quarantine is
disabled, this results in the header being loaded (and checked) twice, and
stored (and checksummed) once, in `deallocate` and `Recycle`.

This change introduces a `quarantineOrDeallocateChunk` function that has a
fast path to deallocation if the Quarantine is disabled. Even though this is
not the preferred configuration security-wise, this change saves a sizeable
amount of processing for that particular situation (which could be adopted by
low memory devices). Additionally this simplifies a bit `deallocate` and
`reallocate`.

Reviewers: dvyukov, kcc, alekseyshl

Reviewed By: dvyukov

Subscribers: llvm-commits

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

llvm-svn: 301015

7 years ago[BitVector] Add find_last() and find_last_unset().
Zachary Turner [Fri, 21 Apr 2017 18:07:46 +0000 (18:07 +0000)]
[BitVector] Add find_last() and find_last_unset().

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

llvm-svn: 301014

7 years agoCOFF: add support for CONSTANT exports
Saleem Abdulrasool [Fri, 21 Apr 2017 18:05:46 +0000 (18:05 +0000)]
COFF: add support for CONSTANT exports

The CONSTANT export type is marked as obsolete, but link still supports
this.  Furthermore, WinObjC uses this for certain exports.  Add support
for this export type.

llvm-svn: 301013

7 years agoRevert r301010: Bot failures on Windows, NetBSD and even some old Darwin.
Kuba Mracek [Fri, 21 Apr 2017 18:02:22 +0000 (18:02 +0000)]
Revert r301010: Bot failures on Windows, NetBSD and even some old Darwin.

llvm-svn: 301012

7 years ago[tsan] Add a test for "external" API that checks the dup suppression is based on...
Kuba Mracek [Fri, 21 Apr 2017 17:49:19 +0000 (17:49 +0000)]
[tsan] Add a test for "external" API that checks the dup suppression is based on the caller PC

We need to make sure that the "external" API isn't dup'ing all data races into a single one (because the stack might look the same) and suppressing all external races. This works now, so just adding a test for that.

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

llvm-svn: 301011

7 years ago[libFuzzer] Always build libFuzzer
Kuba Mracek [Fri, 21 Apr 2017 17:47:44 +0000 (17:47 +0000)]
[libFuzzer] Always build libFuzzer

There are two reasons why users might want to build libfuzzer:
- To fuzz LLVM itself
- To get the libFuzzer.a archive file, so that they can attach it to their code
This change always builds libfuzzer, and supports the second use case if the specified flag is set.

The point of this patch is to have something that can potentially be shipped with the compiler, and this also ensures that the version of libFuzzer is correct to use with that compiler.

Patch by George Karpenkov.

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

llvm-svn: 301010

7 years ago[tsan] Refactor __tsan_external_read/__tsan_external_write to avoid code duplication
Kuba Mracek [Fri, 21 Apr 2017 17:41:01 +0000 (17:41 +0000)]
[tsan] Refactor __tsan_external_read/__tsan_external_write to avoid code duplication

Let's introduce a ExternalAccess function that has the shared code only once.

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

llvm-svn: 301008

7 years ago[libFuzzer] Changing thread_local to __thread in libFuzzer
Kuba Mracek [Fri, 21 Apr 2017 17:39:50 +0000 (17:39 +0000)]
[libFuzzer] Changing thread_local to __thread in libFuzzer

Old Apple compilers do not support thread_local keyword. This patch adds -Dthread_local=__thread when the compiler doesn't support thread_local.

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

llvm-svn: 301007

7 years agoAdd llvm-cvtres to LLVMBuild.txt
Zachary Turner [Fri, 21 Apr 2017 17:37:31 +0000 (17:37 +0000)]
Add llvm-cvtres to LLVMBuild.txt

It wasn't getting picked up as an implicit project, so it wasn't
being built.

llvm-svn: 301006

7 years ago[AArch64] Refactor instruction selection lowering for addresses. NFCI
Joel Jones [Fri, 21 Apr 2017 17:31:03 +0000 (17:31 +0000)]
[AArch64] Refactor instruction selection lowering for addresses. NFCI

Factor out the common code used for generating addresses into common
templated functions that call overloaded versions of a new function,
getTargetNode.

Tested with make check-llvm with targets AArch64.

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

llvm-svn: 301005

7 years agoAdd empty shell of llvm-cvtres.
Zachary Turner [Fri, 21 Apr 2017 17:30:29 +0000 (17:30 +0000)]
Add empty shell of llvm-cvtres.

This marks the beginning of an effort to port remaining
MSVC toolchain miscellaneous utilities to all platforms.

Currently clang-cl shells out to certain additional tools
such as the IDL compiler, resource compiler, and a few
other tools, but as these tools are Windows-only it
limits the ability of clang to target Windows on other
platforms.  having a full suite of these tools directly
in LLVM should eliminate this constraint.

The current implementation provides no actual functionality,
it is just an empty skeleton executable for the purposes
of making incremental changes.

Differential Revision: https://reviews.llvm.org/D32095
Patch by Eric Beckmann (ecbeckmann@google.com)

llvm-svn: 301004

7 years ago[tsan] Publish the TSan external API in tsan_interface.h
Kuba Mracek [Fri, 21 Apr 2017 17:25:47 +0000 (17:25 +0000)]
[tsan] Publish the TSan external API in tsan_interface.h

Let's make the TSan external API available and commented in the public header:

    void *__tsan_external_register_tag(const char *object_type);
    void __tsan_external_assign_tag(void *addr, void *tag);
    void __tsan_external_read(void *addr, void *caller_pc, void *tag);
    void __tsan_external_write(void *addr, void *caller_pc, void *tag);

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

llvm-svn: 301003

7 years agoARM: don't try to create an i8 -> i32 vpaddl.
Tim Northover [Fri, 21 Apr 2017 17:21:59 +0000 (17:21 +0000)]
ARM: don't try to create an i8 -> i32 vpaddl.

DAG combine was mistakenly assuming that the step-up it was looking at was
always a doubling, but it can sometimes be a larger extension in which case
we'd crash.

llvm-svn: 301002

7 years ago[tsan] Track external API accesses as 1-byte accesses (instead of 8-byte)
Kuba Mracek [Fri, 21 Apr 2017 17:21:18 +0000 (17:21 +0000)]
[tsan] Track external API accesses as 1-byte accesses (instead of 8-byte)

It doesn't really make sense to track them as 8-byte accesses.

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

llvm-svn: 301001

7 years ago[tsan] Ignore memory accesses for libignored modules for "external" races
Kuba Mracek [Fri, 21 Apr 2017 17:18:14 +0000 (17:18 +0000)]
[tsan] Ignore memory accesses for libignored modules for "external" races

On Darwin, the setting ignore_noninstrumented_modules is used to suppress false positives in code that users don't have control of. The recently added "external" API (which can be used to detect races on objects provided by system libraries, but the race is actually user's fault) ignores this flag and it can report issues in non-instrumented modules. This patch fixes that.

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

llvm-svn: 301000

7 years ago[libFuzzer] Check for target(popcnt) capability before usage
Kuba Mracek [Fri, 21 Apr 2017 16:57:37 +0000 (16:57 +0000)]
[libFuzzer] Check for target(popcnt) capability before usage

Older compilers (e.g. LLVM 3.4) do not support the attribute target("popcnt").
In order to support those, this diff check the attribute support using the preprocessor.

Patch by George Karpenkov.

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

llvm-svn: 300999

7 years ago[tsan] Don't report bugs from interceptors called from libignored modules
Kuba Mracek [Fri, 21 Apr 2017 16:44:27 +0000 (16:44 +0000)]
[tsan] Don't report bugs from interceptors called from libignored modules

This patch make sure we don't report deadlocks and other bug types when we're inside an interceptor that was called from a noninstrumented module (when ignore_noninstrumented_modules=1 is set). Adding a testcase that shows that deadlock detection still works on Darwin (to make sure we're not silencing too many reports).

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

llvm-svn: 300998

7 years ago[ValueTracking] Use APInt::setAllBits and APInt::intersects to simplify some code...
Craig Topper [Fri, 21 Apr 2017 16:43:32 +0000 (16:43 +0000)]
[ValueTracking] Use APInt::setAllBits and APInt::intersects to simplify some code. NFC

llvm-svn: 300997

7 years ago[APInt] Add compare/compareSigned methods that return -1, 0, 1. Reimplement slt/ult...
Craig Topper [Fri, 21 Apr 2017 16:13:15 +0000 (16:13 +0000)]
[APInt] Add compare/compareSigned methods that return -1, 0, 1. Reimplement slt/ult and friends using them

Currently sle and ule have to call slt/ult and eq to get the proper answer. This results in extra code for both calls and additional scans of multiword APInts.

This patch replaces slt/ult with a compareSigned/compare that can return -1, 0, or 1 so we can cover all the comparison functions with a single call.

While I was there I removed the activeBits calls and other checks at the start of the slow part of ult. Both of the activeBits calls potentially scan through each of the APInts separately. I can't imagine that's any better than just scanning them in parallel and doing the compares. Now we just share the code with tcCompare.

These changes seem to be good for about a 7-8k reduction on the size of the opt binary on my local x86-64 build.

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

llvm-svn: 300995

7 years agoRemove empty and unused header file.
Juergen Ributzka [Fri, 21 Apr 2017 16:05:01 +0000 (16:05 +0000)]
Remove empty and unused header file.

llvm-svn: 300994

7 years ago[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivale...
Daniel Sanders [Fri, 21 Apr 2017 15:59:56 +0000 (15:59 +0000)]
[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.

Summary:
The SelectionDAG importer now imports rules with Predicate's attached via
Requires, PredicateControl, etc. These predicates are implemented as
bitset's to allow multiple predicates to be tested together. However,
unlike the MC layer subtarget features, each target only pays for it's own
predicates (e.g. AArch64 doesn't have 192 feature bits just because X86
needs a lot).

Both AArch64 and X86 derive at least one predicate from the MachineFunction
or Function so they must re-initialize AvailableFeatures before each
function. They also declare locals in <Target>InstructionSelector so that
computeAvailableFeatures() can use the code from SelectionDAG without
modification.

Reviewers: rovka, qcolombet, aditya_nandakumar, t.p.northover, ab

Reviewed By: rovka

Subscribers: aemerson, rengolin, dberris, kristof.beyls, llvm-commits, igorb

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

llvm-svn: 300993

7 years ago[SimplifyCFG] Fix the determination of PostBB in conditional store merging to handle...
Craig Topper [Fri, 21 Apr 2017 15:53:42 +0000 (15:53 +0000)]
[SimplifyCFG] Fix the determination of PostBB in conditional store merging to handle the targets on the second branch being commuted

Currently we choose PostBB as the single successor of QFB, but its possible that QTB's single successor is QFB which would make QFB the correct choice.

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

llvm-svn: 300992

7 years ago[Clangd] Failed to decode params using 1.x-compatible request message
Benjamin Kramer [Fri, 21 Apr 2017 15:51:23 +0000 (15:51 +0000)]
[Clangd] Failed to decode params using 1.x-compatible request message

textDocument/completion sends a TextDocumentPositionParams message in the 2.x
and 3.x. But in 1.x it was instead a TextDocumentPosition with inlined
parameters. This means that the "uri" field is at the top level and not in
textDocument. Because of this, some clients that maintain compability with 1.x
have both uri and textDocument.uri. Clangd, however, early returns in the
presence of anything but 'textDocument' or 'position' which prevents a client
compatible with both 3.x and 1.x to work correctly. If Clangd was a bit more
permissive (no early return), clients implementing all the versions of the
protocol would work.

Patch by Marc-Andre Laperle!

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

llvm-svn: 300991

7 years ago[Clangd] Support Authority-less URIs
Benjamin Kramer [Fri, 21 Apr 2017 15:51:18 +0000 (15:51 +0000)]
[Clangd] Support Authority-less URIs

Clangd strips URIs by removing the file:// part but some clients can send file:
which is also valid according to RFC 3896. For example, if a client sends
file:///home/user, it gets converted to /home/user but if a client sends
file:/home/user, it is left untouched and problems arise.

Patch by Marc-Andre Laperle!

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

llvm-svn: 300990

7 years ago[ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
Wei Mi [Fri, 21 Apr 2017 15:50:16 +0000 (15:50 +0000)]
[ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
places based on it.

Existing constant hoisting pass will merge a group of contants in a small range
and hoist the const materialization code to the common dominator of their uses.
However, if the uses are all in cold pathes, existing implementation may hoist
the materialization code from cold pathes to a hot place. This may hurt performance.
The patch introduces BFI to the pass and selects the best insertion places based
on it.

The change is controlled by an option consthoist-with-block-frequency which is
off by default for now.

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

llvm-svn: 300989

7 years ago[OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.
Anastasia Stulova [Fri, 21 Apr 2017 15:13:24 +0000 (15:13 +0000)]
[OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.

Check unqualified type for ndrange argument in device_side_enqueue so
device_side_enqueue accept const and volatile qualified ndranges.

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

Patch by Dmitry Borisenkov!

llvm-svn: 300988

7 years ago[AArch64][Falkor] Refine modeling of store-release exclusive instructions.
Chad Rosier [Fri, 21 Apr 2017 14:58:32 +0000 (14:58 +0000)]
[AArch64][Falkor] Refine modeling of store-release exclusive instructions.

llvm-svn: 300987

7 years ago[Mips] Document Mips Backend Relocation Principles
Joel Jones [Fri, 21 Apr 2017 14:49:27 +0000 (14:49 +0000)]
[Mips] Document Mips Backend Relocation Principles

This revision documents the combination of C++ and table-gen code that
handles relocations and addresses.

Thanks for Simon Dardis for the careful reviews.

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

llvm-svn: 300986

7 years ago[clang-format] Replace IncompleteFormat by a struct with Line
Krasimir Georgiev [Fri, 21 Apr 2017 14:35:20 +0000 (14:35 +0000)]
[clang-format] Replace IncompleteFormat by a struct with Line

Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by a struct that also contains a line number.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 300985

7 years ago[AArch64][Falkor] Refine resource needs of STRQ with register offset.
Chad Rosier [Fri, 21 Apr 2017 14:33:13 +0000 (14:33 +0000)]
[AArch64][Falkor] Refine resource needs of STRQ with register offset.

llvm-svn: 300984

7 years ago[clang-format] Clang-tidy cleanup of NamespaceEndCommentFixerTest.cpp, NFC
Krasimir Georgiev [Fri, 21 Apr 2017 14:30:01 +0000 (14:30 +0000)]
[clang-format] Clang-tidy cleanup of NamespaceEndCommentFixerTest.cpp, NFC

llvm-svn: 300983

7 years ago[clang-format] Clang-tidy cleanup of CleanupTest.cpp, NFC
Krasimir Georgiev [Fri, 21 Apr 2017 14:21:21 +0000 (14:21 +0000)]
[clang-format] Clang-tidy cleanup of CleanupTest.cpp, NFC

llvm-svn: 300982

7 years ago[PR32667] -Wdocumentation should allow @param/@returns for fields/variables
Alex Lorenz [Fri, 21 Apr 2017 14:17:49 +0000 (14:17 +0000)]
[PR32667] -Wdocumentation should allow @param/@returns for fields/variables
that have a function/block pointer type

This commit improves the -Wdocumentation warning by making sure that @param and
@returns commands won't trigger warnings when used for fields, variables,
or properties whose type is a function/block pointer type. The
function/block pointer type must be specified directly with the declaration,
and when a typedef is used the warning is still emitted.

In the future we might also want to handle the std::function type as well.

rdar://24978538

llvm-svn: 300981

7 years ago[LV] Model if-converted phi node costs
Matthew Simpson [Fri, 21 Apr 2017 14:14:54 +0000 (14:14 +0000)]
[LV] Model if-converted phi node costs

Phi nodes in non-header blocks are converted to select instructions after
if-conversion. This patch updates the cost model to account for the selects.

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

llvm-svn: 300980

7 years agoRevert r300964 + r300970 - [globalisel][tablegen] Import SelectionDAG's rule predicat...
Daniel Sanders [Fri, 21 Apr 2017 14:09:20 +0000 (14:09 +0000)]
Revert r300964 + r300970 - [globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.

It's causing llvm-clang-x86_64-expensive-checks-win to fail to compile and I
haven't worked out why. Reverting to make it green while I figure it out.

llvm-svn: 300978

7 years ago[InstCombine] prefer xor with -1 because 'not' is easier to understand (PR32706)
Sanjay Patel [Fri, 21 Apr 2017 14:03:54 +0000 (14:03 +0000)]
[InstCombine] prefer xor with -1 because 'not' is easier to understand (PR32706)

This matches the demanded bits behavior in the DAG and should fix:
https://bugs.llvm.org/show_bug.cgi?id=32706

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

llvm-svn: 300977

7 years ago[AArch64][Falkor] Refine loads/stores that require an extra LD pipe.
Chad Rosier [Fri, 21 Apr 2017 13:55:41 +0000 (13:55 +0000)]
[AArch64][Falkor] Refine loads/stores that require an extra LD pipe.

llvm-svn: 300976

7 years ago[AArch64][Falkor] Fix number of microops for WriteSTIdx missed in r300892.
Chad Rosier [Fri, 21 Apr 2017 13:37:01 +0000 (13:37 +0000)]
[AArch64][Falkor] Fix number of microops for WriteSTIdx missed in r300892.

llvm-svn: 300975

7 years ago[AArch64] Fix a few missed pre/post-inc in Falkor.
Chad Rosier [Fri, 21 Apr 2017 13:36:57 +0000 (13:36 +0000)]
[AArch64] Fix a few missed pre/post-inc in Falkor.

llvm-svn: 300974

7 years ago[ARM] GlobalISel: Add support for G_TRUNC
Diana Picus [Fri, 21 Apr 2017 13:16:50 +0000 (13:16 +0000)]
[ARM] GlobalISel: Add support for G_TRUNC

Select them as copies. We only select if both the source and the
destination are on the same register bank, so this shouldn't cause any
trouble.

llvm-svn: 300971

7 years ago[globalisel][tablegen] Try again to fix builds on old MSVC's after r300964
Daniel Sanders [Fri, 21 Apr 2017 12:51:43 +0000 (12:51 +0000)]
[globalisel][tablegen] Try again to fix builds on old MSVC's after r300964

This should fix llvm-clang-x86_64-expensive-checks-win

I reproduced the error using the following code:
namespace llvm {
// Moving this out of the llvm namespace fixes the error.
template<unsigned NumBits> class PredicateBitsetImpl {};
}
namespace {
const unsigned MAX_SUBTARGET_PREDICATES = 11;
// This works on Clang but is broken on MSVC
//     using PredicateBitset = PredicateBitsetImpl<MAX_SUBTARGET_PREDICATES>;
// Some versions emit a syntax error here ("error C2061: syntax error: identifier
// 'PredicateBitsetImpl'") but others accept it and only emit the C3646 below.
//
// This works on Clang and MSVC
using PredicateBitset = llvm::PredicateBitsetImpl<MAX_SUBTARGET_PREDICATES>;

class Foo {
private:
    PredicateBitset A; // error C3646: 'A': unknown override specifier
};
}

llvm-svn: 300970

7 years agoAdd support for openSUSE ARM Triples
Ismail Donmez [Fri, 21 Apr 2017 12:26:43 +0000 (12:26 +0000)]
Add support for openSUSE ARM Triples

Summary: Add support for armv6hl-suse-linux-gnueabi and armv7hl-suse-linux-gnueabi triples used by openSUSE/SUSE.

Reviewers: cfe-commits, rovka, compnerd, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, bkramer, chandlerc

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

llvm-svn: 300969

7 years agoRevert: r300966 - [globalisel][tablegen] Attempt to fix builds on old MSVC's after...
Daniel Sanders [Fri, 21 Apr 2017 12:08:25 +0000 (12:08 +0000)]
Revert: r300966 - [globalisel][tablegen] Attempt to fix builds on old MSVC's after r300964

It didn't fix the builder.

llvm-svn: 300968

7 years ago[ARM] GlobalISel: Make struct arguments fail elegantly
Diana Picus [Fri, 21 Apr 2017 11:53:01 +0000 (11:53 +0000)]
[ARM] GlobalISel: Make struct arguments fail elegantly

The condition in isSupportedType didn't handle struct/array arguments
properly. Fix the check and add a test to make sure we use the fallback
path in this kind of situation. The test deals with some common cases
where the call lowering should error out. There are still some issues
here that need to be addressed (tail calls come to mind), but they can
be addressed in other patches.

llvm-svn: 300967

7 years ago[globalisel][tablegen] Attempt to fix builds on old MSVC's after r300964
Daniel Sanders [Fri, 21 Apr 2017 11:29:29 +0000 (11:29 +0000)]
[globalisel][tablegen] Attempt to fix builds on old MSVC's after r300964

This should fix llvm-clang-x86_64-expensive-checks-win

llvm-svn: 300966

7 years agoGICHelper: remove forgotten isl foreach declarations
Tobias Grosser [Fri, 21 Apr 2017 10:50:33 +0000 (10:50 +0000)]
GICHelper: remove forgotten isl foreach declarations

These should have been dropped in r300323.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 300965

7 years ago[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivale...
Daniel Sanders [Fri, 21 Apr 2017 10:27:20 +0000 (10:27 +0000)]
[globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.

Summary:
The SelectionDAG importer now imports rules with Predicate's attached via
Requires, PredicateControl, etc. These predicates are implemented as
bitset's to allow multiple predicates to be tested together. However,
unlike the MC layer subtarget features, each target only pays for it's own
predicates (e.g. AArch64 doesn't have 192 feature bits just because X86
needs a lot).

Both AArch64 and X86 derive at least one predicate from the MachineFunction
or Function so they must re-initialize AvailableFeatures before each
function. They also declare locals in <Target>InstructionSelector so that
computeAvailableFeatures() can use the code from SelectionDAG without
modification.

Reviewers: rovka, qcolombet, aditya_nandakumar, t.p.northover, ab

Reviewed By: rovka

Subscribers: aemerson, rengolin, dberris, kristof.beyls, llvm-commits, igorb

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

llvm-svn: 300964

7 years agotypo
Clement Courbet [Fri, 21 Apr 2017 09:21:05 +0000 (09:21 +0000)]
typo

llvm-svn: 300963

7 years agoadd skylake
Clement Courbet [Fri, 21 Apr 2017 09:21:01 +0000 (09:21 +0000)]
add skylake

llvm-svn: 300962

7 years agoadd 32 bit tests
Clement Courbet [Fri, 21 Apr 2017 09:20:58 +0000 (09:20 +0000)]
add 32 bit tests

llvm-svn: 300961

7 years agouse repmovsb when optimizing forminsize
Clement Courbet [Fri, 21 Apr 2017 09:20:55 +0000 (09:20 +0000)]
use repmovsb when optimizing forminsize

llvm-svn: 300960

7 years agoRename FastString flag.
Clement Courbet [Fri, 21 Apr 2017 09:20:50 +0000 (09:20 +0000)]
Rename FastString flag.

llvm-svn: 300959

7 years agoadd more tests
Clement Courbet [Fri, 21 Apr 2017 09:20:44 +0000 (09:20 +0000)]
add more tests

llvm-svn: 300958

7 years agoX86 memcpy: use REPMOVSB instead of REPMOVS{Q,D,W} for inline copies
Clement Courbet [Fri, 21 Apr 2017 09:20:39 +0000 (09:20 +0000)]
X86 memcpy: use REPMOVSB instead of REPMOVS{Q,D,W} for inline copies
when the subtarget has fast strings.

This has two advantages:
  - Speed is improved. For example, on Haswell thoughput improvements increase
    linearly with size from 256 to 512 bytes, after which they plateau:
    (e.g. 1% for 260 bytes, 25% for 400 bytes, 40% for 508 bytes).
  - Code is much smaller (no need to handle boundaries).

llvm-svn: 300957

7 years ago[DWARF] - Refactoring: localize handling of relocations in a single place.
George Rimar [Fri, 21 Apr 2017 09:12:18 +0000 (09:12 +0000)]
[DWARF] - Refactoring: localize handling of relocations in a single place.

This is splitted from D32228,
currently DWARF parsers code has few places that applied relocations values manually.
These places has similar duplicated code. Patch introduces separate method that can be
used to obtain relocated value. That helps to reduce code and simplifies things.

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

llvm-svn: 300956

7 years agoRevert r300889, r300906, r300935, r300939
Diana Picus [Fri, 21 Apr 2017 08:21:56 +0000 (08:21 +0000)]
Revert r300889, r300906, r300935, r300939

At least one of the ARM bots is still broken:
Command Output (stderr):
--
/home/buildslave/buildslave/clang-cmake-armv7-a15-full/llvm/projects/compiler-rt/test/asan/TestCases/Posix/strchr.c:31:12: error: expected string not found in input
 // CHECK: strchr.c:[[@LINE-2]]
           ^
<stdin>:3:59: note: scanning from here
==16297==ERROR: AddressSanitizer: SEGV on unknown address 0xb5add000 (pc 0xb6dccaa4 bp 0xbe8c19c8 sp 0xbe8c1570 T0)
                                                          ^
<stdin>:3:59: note: with expression "@LINE-2" equal to "29"
==16297==ERROR: AddressSanitizer: SEGV on unknown address 0xb5add000 (pc 0xb6dccaa4 bp 0xbe8c19c8 sp 0xbe8c1570 T0)
                                                          ^
<stdin>:5:57: note: possible intended match here
 #0 0xb6dccaa3 in strlen /build/glibc-f8FFOS/glibc-2.23/string/../sysdeps/arm/armv6t2/strlen.S:82

Try to fix by reverting r300889 and subsequent fixes:
Revert "[asan] Fix test by removing "The signal is caused" check."
Revert "[asan] Fix test on ppc64le-linux by checking "UNKNOWN memory access""
Revert "[asan] Match BUS and SIGV to fix test on Darwin"
Revert "[asan] Optimize strchr for strict_string_checks=false"

llvm-svn: 300955

7 years agoDelete dead code
Clement Courbet [Fri, 21 Apr 2017 07:40:59 +0000 (07:40 +0000)]
Delete dead code

llvm-svn: 300952

7 years ago[Thumb1] The recently added tADCS and tSBCS pseudo-instructions were missing `Uses...
Artyom Skrobov [Fri, 21 Apr 2017 07:35:21 +0000 (07:35 +0000)]
[Thumb1] The recently added tADCS and tSBCS pseudo-instructions were missing `Uses = [CPSR]`

Summary: Thanks to Oliver Stannard for helping catch this.

Reviewers: olista01, efriedma

Subscribers: llvm-commits, rengolin

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

llvm-svn: 300951

7 years ago[AsmWriter] Eliminate warning. NFC
Serguei Katkov [Fri, 21 Apr 2017 06:14:38 +0000 (06:14 +0000)]
[AsmWriter] Eliminate warning. NFC

This patch eliminates the following warning

lib/IR/AsmWriter.cpp:1128:57: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
                 (StrVal[1] >= '0' && StrVal[1] <= '9')) &&

Reviewers: timshen, rnk, davide
Reviewed By: davide
Subscribers: davide, llvm-commits
Differential Revision: https://reviews.llvm.org/D32337

llvm-svn: 300950

7 years ago[index] Take advantage of 'external_source_symbol' attribute for indexing purposes
Argyrios Kyrtzidis [Fri, 21 Apr 2017 05:42:46 +0000 (05:42 +0000)]
[index] Take advantage of 'external_source_symbol' attribute for indexing purposes

- Ignore decls marked as 'generated_declaration'
- Include the 'defined_in' in the USR for additional namespacing

llvm-svn: 300949

7 years ago[index] For 'transparent' tag typedefs, ignore their tag reference
Argyrios Kyrtzidis [Fri, 21 Apr 2017 05:42:40 +0000 (05:42 +0000)]
[index] For 'transparent' tag typedefs, ignore their tag reference

llvm-svn: 300948

7 years ago[MSSA] Clean up the updater a bit. NFC
George Burgess IV [Fri, 21 Apr 2017 04:54:52 +0000 (04:54 +0000)]
[MSSA] Clean up the updater a bit. NFC

- Mark an internal function static
- Remove the llvm namespace (just holding on to the `using namespace
  llvm;` Works on My Machine(TM))

llvm-svn: 300947

7 years ago[PartialInliner] Fix crash when inlining functions with unreachable blocks.
Davide Italiano [Fri, 21 Apr 2017 04:25:00 +0000 (04:25 +0000)]
[PartialInliner] Fix crash when inlining functions with unreachable blocks.

CodeExtractor looks up the dominator node corresponding to return blocks
when splitting them. If one of these blocks is unreachable, there's no
node in the Dom and CodeExtractor crashes because it doesn't check
for domtree node validity.
In theory, we could add just a check for skipping null DTNodes in
`splitReturnBlock` but the fix I propose here is slightly different. To the
best of my knowledge, unreachable blocks are irrelevant for the algorithm,
therefore we can just skip them when building the candidate set in the
constructor.

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

llvm-svn: 300946

7 years ago[BPI] Add multiplication by scalar operators to BranchProbability
Serguei Katkov [Fri, 21 Apr 2017 03:14:30 +0000 (03:14 +0000)]
[BPI] Add multiplication by scalar operators to BranchProbability

This patch just adds two operators to BranchProbability class:
(BP * scalar) and (BP *= scalar).

Reviewers: junbuml, chandlerc, sanjoy, vsk

Reviewed By: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 300945

7 years agoupdate XFAIL comments with more details
Eric Fiselier [Fri, 21 Apr 2017 03:09:40 +0000 (03:09 +0000)]
update XFAIL comments with more details

llvm-svn: 300944

7 years ago[AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent snprinf
Serguei Katkov [Fri, 21 Apr 2017 02:52:17 +0000 (02:52 +0000)]
[AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent snprinf

This should fix the bug https://bugs.llvm.org/show_bug.cgi?id=12906

To print the FP constant AsmWriter does the following:

  1) convert FP value to String (actually using snprintf function which is locale dependent).
  2) Convert String back to FP Value
  3) Compare original and got FP values. If they are not equal just dump as hex.

The problem happens on the 2nd step when APFloat does not expect group delimiter or
fraction delimiter other than period symbol and so on, which can be produced on the
first step if LLVM library is used in an environment with corresponding locale set.

To fix this issue the locale independent APFloat:toString function is used.
However it prints FP values slightly differently than snprintf does. Specifically
it suppress trailing zeros in significant, use capital E and so on.
It results in 117 test failures during make check.
To avoid this I've also updated APFloat.toString a bit to pass make check at least.

Reviewers: sberg, bogner, majnemer, sanjoy, timshen, rnk

Reviewed By: timshen, rnk

Subscribers: rnk, llvm-commits

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

llvm-svn: 300943

7 years agoMark exception_ptr tests as XFAIL on Windows for now
Eric Fiselier [Fri, 21 Apr 2017 02:13:33 +0000 (02:13 +0000)]
Mark exception_ptr tests as XFAIL on Windows for now

llvm-svn: 300942

7 years agoXFAIL Windows test failures under test/libcxx
Eric Fiselier [Fri, 21 Apr 2017 01:48:02 +0000 (01:48 +0000)]
XFAIL Windows test failures under test/libcxx

This patch XFAIL's a number of tests under test/libcxx when on Windows.
These failures need more investigation or patches to either Clang or libc++
but for now we don't want them to prevent the bot from going green.

llvm-svn: 300941

7 years agoRevert r300932 and r300930.
Akira Hatanaka [Fri, 21 Apr 2017 01:31:50 +0000 (01:31 +0000)]
Revert r300932 and r300930.

It seems that r300930 was creating an infinite loop in dag-combine when
compling the following file:

MultiSource/Benchmarks/MiBench/consumer-typeset/z21.c

llvm-svn: 300940

7 years ago[asan] Fix test by removing "The signal is caused" check.
Vitaly Buka [Fri, 21 Apr 2017 01:16:58 +0000 (01:16 +0000)]
[asan] Fix test by removing "The signal is caused" check.

llvm-svn: 300939

7 years ago[modules] Properly look up the owning module for an instantiation of a merged template.
Richard Smith [Fri, 21 Apr 2017 01:15:13 +0000 (01:15 +0000)]
[modules] Properly look up the owning module for an instantiation of a merged template.

When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

This reinstates r300650, reverted in r300659, with a fix for a regression
reported by Chandler after commit.

llvm-svn: 300938

7 years agoResolve unused local typedef warning in test.
Billy Robert O'Neal III [Fri, 21 Apr 2017 01:10:04 +0000 (01:10 +0000)]
Resolve unused local typedef warning in test.

llvm-svn: 300937

7 years ago[analyzer] Fix assert in ExprEngine::processSwitch
Alexander Shaposhnikov [Fri, 21 Apr 2017 01:05:26 +0000 (01:05 +0000)]
[analyzer] Fix assert in ExprEngine::processSwitch

This diff replaces getTypeSize(CondE->getType()))
with getIntWidth(CondE->getType())) in ExprEngine::processSwitch.
These calls are not equivalent for bool, see ASTContext.cpp
Add a test case.

Test plan:
make check-clang-analysis
make check-clang

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

llvm-svn: 300936

7 years ago[asan] Fix test on ppc64le-linux by checking "UNKNOWN memory access"
Vitaly Buka [Fri, 21 Apr 2017 00:48:43 +0000 (00:48 +0000)]
[asan] Fix test on ppc64le-linux by checking "UNKNOWN memory access"

llvm-svn: 300935

7 years agoFix 'verify-support' available feature
Eric Fiselier [Fri, 21 Apr 2017 00:43:07 +0000 (00:43 +0000)]
Fix 'verify-support' available feature

llvm-svn: 300934

7 years agoDisable LSan on ppc64, some tests are failing.
Alex Shlyapnikov [Fri, 21 Apr 2017 00:36:29 +0000 (00:36 +0000)]
Disable LSan on ppc64, some tests are failing.

llvm-svn: 300933

7 years ago[AArch64] Use suffix ULL to shift a 64-bit value.
Akira Hatanaka [Fri, 21 Apr 2017 00:35:27 +0000 (00:35 +0000)]
[AArch64] Use suffix ULL to shift a 64-bit value.

llvm-svn: 300932

7 years ago[CodeExtractor] Remove an unneeded level of indirection. NFCI.
Davide Italiano [Fri, 21 Apr 2017 00:21:09 +0000 (00:21 +0000)]
[CodeExtractor] Remove an unneeded level of indirection. NFCI.

llvm-svn: 300931

7 years ago[AArch64] Improve code generation for logical instructions taking
Akira Hatanaka [Fri, 21 Apr 2017 00:05:16 +0000 (00:05 +0000)]
[AArch64] Improve code generation for logical instructions taking
immediate operands.

This commit adds an AArch64 dag-combine that optimizes code generation
for logical instructions taking immediate operands. The optimization
uses demanded bits to change a logical instruction's immediate operand
so that the immediate can be folded into the immediate field of the
instruction.

This recommits r300913, which broke bots because I didn't fix a call to
ShrinkDemandedConstant in SIISelLowering.cpp after changing the APIs of
TargetLoweringOpt and TargetLowering.

rdar://problem/18231627

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

llvm-svn: 300930

7 years agoRevert "Enable lsan test suite on Darwin x86_64 builds"
Ahmed Bougacha [Fri, 21 Apr 2017 00:00:59 +0000 (00:00 +0000)]
Revert "Enable lsan test suite on Darwin x86_64 builds"

This reverts commit r300897.

Most LSan/ASan tests are failing on darwin bots.

llvm-svn: 300929

7 years agoRevert r300746 (SCEV analysis for or instructions).
Eli Friedman [Thu, 20 Apr 2017 23:59:05 +0000 (23:59 +0000)]
Revert r300746 (SCEV analysis for or instructions).

There have been multiple reports of this causing problems: a
compile-time explosion on the LLVM testsuite, and a stack
overflow for an opencl kernel.

llvm-svn: 300928

7 years ago[InstCombine] Remove the zextOrTrunc from ShrinkDemandedConstant.
Craig Topper [Thu, 20 Apr 2017 23:58:27 +0000 (23:58 +0000)]
[InstCombine] Remove the zextOrTrunc from ShrinkDemandedConstant.

The demanded mask and the constant should always be the same width for all callers today.

Also stop copying the demanded mask as its passed in. We should avoid allocating memory unless we are going to do something. The final AND to create the new constant will take care of it.

llvm-svn: 300927