platform/upstream/llvm.git
7 years ago[DAGCombiner] add helper function for and-of-setcc folds; NFC
Sanjay Patel [Tue, 28 Mar 2017 19:58:46 +0000 (19:58 +0000)]
[DAGCombiner] add helper function for and-of-setcc folds; NFC

This is just a cut and paste followed by clang-format. Clean up to follow.

llvm-svn: 298938

7 years ago[libc++] Add a key function for bad_function_call
Shoaib Meenai [Tue, 28 Mar 2017 19:33:31 +0000 (19:33 +0000)]
[libc++] Add a key function for bad_function_call

Summary:
bad_function_call is currently an empty class, so any object files using
that class will end up with their own copy of its typeinfo, typeinfo
name and vtable, leading to unnecessary duplication that has to be
resolved by the dynamic linker. Instead, give bad_function_call a key
function and put a definition for that key function in libc++ itself, to
centralize the typeinfo and vtable.

This is consistent with the behavior for other exception classes. The
key functions are defined in libc++ rather than libc++abi since the
class is defined in the libc++ versioning namespace, so ABI
compatibility with libstdc++ is not a concern.

Guard this change behind an ABI macro, since it isn't backwards
compatible (i.e., clients built against the new libc++ headers wouldn't
be able to run against an older libc++ library).

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, cfe-commits

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

llvm-svn: 298937

7 years agoAdd support for -fno-builtin to LTO and ThinLTO to libLTO
Mehdi Amini [Tue, 28 Mar 2017 18:55:44 +0000 (18:55 +0000)]
Add support for -fno-builtin to LTO and ThinLTO to libLTO

Reviewers: tejohnson, pcc

Subscribers: Prazek, dexonsmith, llvm-commits

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

llvm-svn: 298936

7 years ago[AMDGPU] Split -amdgpu-early-inline-all option
Stanislav Mekhanoshin [Tue, 28 Mar 2017 18:23:24 +0000 (18:23 +0000)]
[AMDGPU] Split -amdgpu-early-inline-all option

Previously it was covered by the internalization. It turns out we cannot
run internalizer in FE, it break separate compilation tests. Thus early
inliner gets its own option.

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

llvm-svn: 298935

7 years agoDo not set entsize for .gnu.hash.
Rui Ueyama [Tue, 28 Mar 2017 18:11:52 +0000 (18:11 +0000)]
Do not set entsize for .gnu.hash.

.gnu.hash happen to contain only 32-bit integers for 32-bit arch,
but the section contents are not uniform array members, so setting
entsize doesn't make much sense. This behavior seems to have been
blindly copied from GNU linkers.

llvm-svn: 298934

7 years ago[x86] use VPMOVMSK to replace memcmp libcalls for 32-byte equality
Sanjay Patel [Tue, 28 Mar 2017 17:23:49 +0000 (17:23 +0000)]
[x86] use VPMOVMSK to replace memcmp libcalls for 32-byte equality

Follow-up to:
https://reviews.llvm.org/rL298775

llvm-svn: 298933

7 years agoRevert "Dont emit Mapping symbols for sections that contain only data."
Weiming Zhao [Tue, 28 Mar 2017 17:15:11 +0000 (17:15 +0000)]
Revert "Dont emit Mapping symbols for sections that contain only data."

It breaks some lld tests.

This reverts commit 3a50eea6d9732ab40e9a7aebe6be777b53a8b35c.

llvm-svn: 298932

7 years ago[SDAG] Deal with deleted node in PromoteIntShiftOp
Nirav Dave [Tue, 28 Mar 2017 17:09:49 +0000 (17:09 +0000)]
[SDAG] Deal with deleted node in PromoteIntShiftOp

Deal with case that initial node is deleted during dag-combine leading
to an assertional failure in promoteIntShiftOp.

Fixes PR32420.

Reviewers: spatel, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 298931

7 years agoAdd reproducer test for pr32449. NFC.
Zvi Rackover [Tue, 28 Mar 2017 16:45:23 +0000 (16:45 +0000)]
Add reproducer test for pr32449. NFC.

llvm-svn: 298930

7 years ago[X86][AVX2] Add support for combining v16i16 shuffles to VPBLENDW
Simon Pilgrim [Tue, 28 Mar 2017 16:40:38 +0000 (16:40 +0000)]
[X86][AVX2] Add support for combining v16i16 shuffles to VPBLENDW

llvm-svn: 298929

7 years ago[AVX-512] Fix accidental uses of AH/BH/CH/DH after copies to/from mask registers
Craig Topper [Tue, 28 Mar 2017 16:35:29 +0000 (16:35 +0000)]
[AVX-512] Fix accidental uses of AH/BH/CH/DH after copies to/from mask registers

We've had several bugs(PR32256, PR32241) recently that resulted from usages of AH/BH/CH/DH either before or after a copy to/from a mask register.

This ultimately occurs because we create COPY_TO_REGCLASS with VK1 and GR8. Then in CopyToFromAsymmetricReg in X86InstrInfo we find a 32-bit super register for the GR8 to emit the KMOV with. But as these tests are demonstrating, its possible for the GR8 register to be a high register and we end up doing an accidental extra or insert from bits 15:8.

I think the best way forward is to stop making copies directly between mask registers and GR8/GR16. Instead I think we should restrict to only copies between mask registers and GR32/GR64 and use EXTRACT_SUBREG/INSERT_SUBREG to handle the conversion from GR32 to GR16/8 or vice versa.

Unfortunately, this complicates fastisel a bit more now to create the subreg extracts where we used to create GR8 copies. We can probably make a helper function to bring down the repitition.

This does result in KMOVD being used for copies when BWI is available because we don't know the original mask register size. This caused a lot of deltas on tests because we have to split the checks for KMOVD vs KMOVW based on BWI.

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

llvm-svn: 298928

7 years ago[analyzer] Fix symbolication for unknown unary increment/decrement results.
Artem Dergachev [Tue, 28 Mar 2017 15:57:12 +0000 (15:57 +0000)]
[analyzer] Fix symbolication for unknown unary increment/decrement results.

If the value is known, but we cannot increment it, conjure a symbol to
represent the result of the operation based on the operator expression,
not on the sub-expression.

In particular, no longer crash on comparing a result of a LocAsInteger increment
to a constant integer.

rdar://problem/31067356

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

llvm-svn: 298927

7 years ago[x86] add separate check prefix for SSE; NFC
Sanjay Patel [Tue, 28 Mar 2017 15:55:50 +0000 (15:55 +0000)]
[x86] add separate check prefix for SSE; NFC

We want to check each test on each target, so we need another prefix
when SSE and AVX diverge (as they will if we handle 32-byte and higher).

llvm-svn: 298926

7 years ago[X86][SSE] Refactored shuffle BLEND combining to make future 16i16 support easier...
Simon Pilgrim [Tue, 28 Mar 2017 15:50:23 +0000 (15:50 +0000)]
[X86][SSE] Refactored shuffle BLEND combining to make future 16i16 support easier. NFCI.

Call the matchVectorShuffleAsBlend test as early as possible.

llvm-svn: 298925

7 years ago[analyzer] When creating a temporary object, properly copy the value into it.
Artem Dergachev [Tue, 28 Mar 2017 15:43:26 +0000 (15:43 +0000)]
[analyzer] When creating a temporary object, properly copy the value into it.

Adjustments should be considered properly; we should copy the unadjusted object
over the whole temporary base region. If the unadjusted object is no longer
available in the Environment, invalidate the temporary base region, and then
copy the adjusted object into the adjusted sub-region of the temporary region.

This fixes a regression introduced by r288263, that caused various
false positives, due to copying only adjusted object into the adjusted region;
the rest of the base region therefore remained undefined.
Before r288263, the adjusted value was copied over the unadjusted region,
which is incorrect, but accidentally worked better due to how region store
disregards compound value bindings to non-base regions.

An additional test machinery is introduced to make sure that despite making
two binds, we only notify checkers once for both of them, without exposing
the partially copied objects.

This fix is a hack over a hack. The proper fix would be to model C++ temporaries
in the CFG, and after that dealing with adjustments would no longer be
necessary, and the values we need would no longer disappear from the
Environment.

rdar://problem/30658168

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

llvm-svn: 298924

7 years ago[SDAG] Avoid deleted SDNodes PromoteIntBinOp
Nirav Dave [Tue, 28 Mar 2017 15:41:12 +0000 (15:41 +0000)]
[SDAG] Avoid deleted SDNodes PromoteIntBinOp

Reorder work in PromoteIntBinOp to prevent stale (deleted) nodes from
being used.

Fixes PR32340 and PR32345.

Reviewers: hfinkel, dbabokin

Subscribers: llvm-commits

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

llvm-svn: 298923

7 years ago[libunwind] Add sphinx docs
Jonathan Roelofs [Tue, 28 Mar 2017 15:21:43 +0000 (15:21 +0000)]
[libunwind] Add sphinx docs

https://reviews.llvm.org/D31375

llvm-svn: 298922

7 years agoclangToolingRefactor: Add libdeps upon clangFormat in r298913.
NAKAMURA Takumi [Tue, 28 Mar 2017 14:18:10 +0000 (14:18 +0000)]
clangToolingRefactor: Add libdeps upon clangFormat in r298913.

llvm-svn: 298921

7 years ago[SDAG] Fix Stale SDNode usage in visitAND
Nirav Dave [Tue, 28 Mar 2017 14:11:20 +0000 (14:11 +0000)]
[SDAG] Fix Stale SDNode usage in visitAND

Reorder CombineTo Calls to prevent potential use of deleted node.
Fixes PR32372.

Reviewers: jnspaulsson, RKSimon, uweigand, jonpa

Reviewed By: jonpa

Subscribers: jonpa, llvm-commits

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

llvm-svn: 298920

7 years agoTry to unbreak buildbots after r298913.
Eric Liu [Tue, 28 Mar 2017 13:56:19 +0000 (13:56 +0000)]
Try to unbreak buildbots after r298913.

llvm-svn: 298919

7 years ago[x86] add AVX2 run to show 256-bit opportunity; NFC
Sanjay Patel [Tue, 28 Mar 2017 13:46:50 +0000 (13:46 +0000)]
[x86] add AVX2 run to show 256-bit opportunity; NFC

llvm-svn: 298918

7 years agoFix signed/unsigned comparison warning
Simon Pilgrim [Tue, 28 Mar 2017 13:40:09 +0000 (13:40 +0000)]
Fix signed/unsigned comparison warning

llvm-svn: 298917

7 years ago[SDAG] Minor cleanup of variable usage. NFC.
Nirav Dave [Tue, 28 Mar 2017 13:39:50 +0000 (13:39 +0000)]
[SDAG] Minor cleanup of variable usage. NFC.

llvm-svn: 298916

7 years agoFix for bug https://llvm.org/bugs/show_bug.cgi?id=30889
Andrey Churbanov [Tue, 28 Mar 2017 13:35:42 +0000 (13:35 +0000)]
Fix for bug https://llvm.org/bugs/show_bug.cgi?id=30889
Condition adjusted for Debug assertion.

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

llvm-svn: 298915

7 years ago[X86][SSE] Begin merging vector shuffle to BLEND for lowering and combining.
Simon Pilgrim [Tue, 28 Mar 2017 13:05:48 +0000 (13:05 +0000)]
[X86][SSE] Begin merging vector shuffle to BLEND for lowering and combining.

Split off matchVectorShuffleAsBlend from lowerVectorShuffleAsBlend for reuse in combining.

llvm-svn: 298914

7 years agoAdded `applyAtomicChanges` function.
Eric Liu [Tue, 28 Mar 2017 13:05:32 +0000 (13:05 +0000)]
Added `applyAtomicChanges` function.

Summary: ... which applies a set of `AtomicChange`s on code.

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 298913

7 years ago[ASTMatchers] add typeAliasTemplateDecl matcher.
Eric Liu [Tue, 28 Mar 2017 12:56:47 +0000 (12:56 +0000)]
[ASTMatchers] add typeAliasTemplateDecl matcher.

Reviewers: hokein, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aaron.ballman, cfe-commits, klimek

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

llvm-svn: 298912

7 years agoWdocumentation fix
Simon Pilgrim [Tue, 28 Mar 2017 12:29:09 +0000 (12:29 +0000)]
Wdocumentation fix

llvm-svn: 298911

7 years ago[X86][SSE] Set second operand to undef instead of first operand in unary shuffle...
Simon Pilgrim [Tue, 28 Mar 2017 12:16:42 +0000 (12:16 +0000)]
[X86][SSE] Set second operand to undef instead of first operand in unary shuffle combines.

Copy isn't necessary after the matchVectorShuffleWithUNPCK refactor and undef value will make some future undef/zero handling easier.

llvm-svn: 298910

7 years agoStrip trailing whitespace
Simon Pilgrim [Tue, 28 Mar 2017 11:15:17 +0000 (11:15 +0000)]
Strip trailing whitespace

llvm-svn: 298909

7 years ago[AArch64] [Assembler] option to disable negative immediate conversions
Sanne Wouda [Tue, 28 Mar 2017 10:02:56 +0000 (10:02 +0000)]
[AArch64] [Assembler] option to disable negative immediate conversions

Summary:
Similar to the ARM target in https://reviews.llvm.org/rL298380, this
patch adds identical infrastructure for disabling negative immediate
conversions, and converts the existing aliases to the new infrastucture.

Reviewers: rengolin, javed.absar, olista01, SjoerdMeijer, samparker

Reviewed By: samparker

Subscribers: samparker, aemerson, llvm-commits

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

llvm-svn: 298908

7 years ago[GlobalISel][X86] support G_FRAME_INDEX instruction selection.
Igor Breger [Tue, 28 Mar 2017 09:35:06 +0000 (09:35 +0000)]
[GlobalISel][X86] support G_FRAME_INDEX instruction selection.

    Summary:
    G_LOAD/G_STORE, add alternative RegisterBank mapping.
    For G_LOAD, Fast and Greedy mode choose the same RegisterBank mapping (GprRegBank ) for the G_GLOAD + G_FADD , can't get rid of cross register bank copy GprRegBank->VecRegBank.

    Reviewers: zvi, rovka, qcolombet, ab

    Reviewed By: zvi

    Subscribers: llvm-commits, dberris, kristof.beyls, eladcohen, guyblank

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

llvm-svn: 298907

7 years ago[InstCombine] For select rule, use positive check of constant int for select operand...
Anna Thomas [Tue, 28 Mar 2017 09:32:24 +0000 (09:32 +0000)]
[InstCombine] For select rule, use positive check of constant int for select operand. NFCI

llvm-svn: 298906

7 years agoFileManager: mark virtual file entries as valid entries
Erik Verbruggen [Tue, 28 Mar 2017 09:18:05 +0000 (09:18 +0000)]
FileManager: mark virtual file entries as valid entries

The getVirtualFile method would create entries for e.g. libclang's
CXUnsavedFile but not mark them as valid. The effect is that a lookup
through getFile where the file name is not exactly matching the virtual
file (e.g. through mixing slashes and backslashes on Windows) would
result in a normal file "lookup", and re-using the file entry found
by using the UniqueID, and overwrite the file entry fields. Because the
lookup involves opening the file, and moving it into the file entry, the
file is now open. The SourceManager keys its buffers on the UniqueID
(which is still the same), so it will find an already loaded buffer.
Because only the loading a buffer from disk will close the file, the
FileEntry will hold on to an open file for as long as the FileManager
is around. As the FileManager will only get destroyed at a reparse,
you can't safe to the "leaked" and locked file on Windows.

llvm-svn: 298905

7 years agorename instcombine test file. NFC
Anna Thomas [Tue, 28 Mar 2017 08:34:07 +0000 (08:34 +0000)]
rename instcombine test file. NFC

llvm-svn: 298904

7 years ago[libclang] Fix crash in member access code completion with implicit base
Erik Verbruggen [Tue, 28 Mar 2017 07:22:21 +0000 (07:22 +0000)]
[libclang] Fix crash in member access code completion with implicit base

If there is an unresolved member access AST node, and the base is
implicit, do not access/use it for generating candidate overloads for
code completion results.

Fixes PR31093.

llvm-svn: 298903

7 years ago[AMDGPU] Update SI scheduler colorHighLatenciesGroups
Valery Pykhtin [Tue, 28 Mar 2017 07:19:48 +0000 (07:19 +0000)]
[AMDGPU] Update SI scheduler colorHighLatenciesGroups

Depends on rL298896: MachineScheduler/ScheduleDAG: Add support for GetSubGraph

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298902

7 years agoDont emit Mapping symbols for sections that contain only data.
Weiming Zhao [Tue, 28 Mar 2017 05:40:36 +0000 (05:40 +0000)]
Dont emit Mapping symbols for sections that contain only data.

Summary:
Dont emit mapping symbols for sections that contain only data.

Patched by Shankar Easwaran <shankare@codeaurora.org>

Reviewers: rengolin, peter.smith, weimingz, kparzysz, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, llvm-commits

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

llvm-svn: 298901

7 years ago[APInt] Reformat tc functions to put opening curly braces on the end of the previous...
Craig Topper [Tue, 28 Mar 2017 05:32:55 +0000 (05:32 +0000)]
[APInt] Reformat tc functions to put opening curly braces on the end of the previous line. NFC

llvm-svn: 298900

7 years ago[APInt] Remove an anonymous namespace around static functions. NFC
Craig Topper [Tue, 28 Mar 2017 05:32:53 +0000 (05:32 +0000)]
[APInt] Remove an anonymous namespace around static functions. NFC

llvm-svn: 298899

7 years ago[APInt] Combine variable declaration and initialization where possible in the tc...
Craig Topper [Tue, 28 Mar 2017 05:32:52 +0000 (05:32 +0000)]
[APInt] Combine variable declaration and initialization where possible in the tc functions. NFCI

llvm-svn: 298898

7 years ago[APInt] Use 'unsigned' instead of 'unsigned int' in the interface to the APInt tc...
Craig Topper [Tue, 28 Mar 2017 05:32:48 +0000 (05:32 +0000)]
[APInt] Use 'unsigned' instead of 'unsigned int' in the interface to the APInt tc functions. This is more consistent with the rest of the codebase. NFC

llvm-svn: 298897

7 years agoMachineScheduler/ScheduleDAG: Add support for GetSubGraph
Valery Pykhtin [Tue, 28 Mar 2017 05:12:31 +0000 (05:12 +0000)]
MachineScheduler/ScheduleDAG: Add support for GetSubGraph

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298896

7 years agoCodeGen : Check LLVM_ENABLE_DUMP definition for dumpMachineInstrRangeWithSlotIndex.
Junmo Park [Tue, 28 Mar 2017 04:14:25 +0000 (04:14 +0000)]
CodeGen : Check LLVM_ENABLE_DUMP definition for dumpMachineInstrRangeWithSlotIndex.

Summary:
Add missing check routine for dumpMachineInstrRangeWithSlotIndex including LLVM_DUMP_METHOD.

Reviewers: bkramer

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

llvm-svn: 298895

7 years ago[APInt] Move the single word cases of the bitwise operators inline.
Craig Topper [Tue, 28 Mar 2017 04:00:47 +0000 (04:00 +0000)]
[APInt] Move the single word cases of the bitwise operators inline.

llvm-svn: 298894

7 years agoUse BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests.
Gor Nishanov [Tue, 28 Mar 2017 02:51:45 +0000 (02:51 +0000)]
Use BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests.

FIXME: ActOnReturnStmt expects a scope that is inside of the function, due
  to CheckJumpOutOfSEHFinally(*this, ReturnLoc, *CurScope->getFnParent());
  S.getCurScope()->getFnParent() == nullptr at ActOnFinishFunctionBody when
  CoroutineBodyStmt is built. Figure it out and fix it.
llvm-svn: 298893

7 years agoReland "[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)"
Weiming Zhao [Mon, 27 Mar 2017 23:57:44 +0000 (23:57 +0000)]
Reland "[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)"

Re-land of r298714 which got reverted in r298868.
It looks like the current lit tests won't run for Apple.
Possible reason is the libname is different. (need to update
the base_lib variable of lit.cfg)

llvm-svn: 298892

7 years ago[coroutines] Handle get_return_object_on_allocation_failure
Gor Nishanov [Mon, 27 Mar 2017 23:36:59 +0000 (23:36 +0000)]
[coroutines] Handle get_return_object_on_allocation_failure

Summary:
If promise_type has get_return_object_on_allocation_failure defined,
check if an allocation function returns nullptr, and if so,
return the result of get_return_object_on_allocation_failure().

Reviewers: rsmith, EricWF

Reviewed By: EricWF

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 298891

7 years agoRevert "[asan] Delay creation of asan ctor."
Alex Shlyapnikov [Mon, 27 Mar 2017 23:11:50 +0000 (23:11 +0000)]
Revert "[asan] Delay creation of asan ctor."

Speculative revert. Some libfuzzer tests are affected.

This reverts commit r298731.

llvm-svn: 298890

7 years agoRevert "[asan] Put ctor/dtor in comdat."
Alex Shlyapnikov [Mon, 27 Mar 2017 23:11:47 +0000 (23:11 +0000)]
Revert "[asan] Put ctor/dtor in comdat."

Speculative revert, some libfuzzer tests are affected.

This reverts commit r298756.

llvm-svn: 298889

7 years agoRemove an oddly unnecessary temporary.
Eric Christopher [Mon, 27 Mar 2017 22:40:51 +0000 (22:40 +0000)]
Remove an oddly unnecessary temporary.

llvm-svn: 298888

7 years ago[ARM] Mark falky test unsupported until we find the cause
Renato Golin [Mon, 27 Mar 2017 22:38:43 +0000 (22:38 +0000)]
[ARM] Mark falky test unsupported until we find the cause

llvm-svn: 298887

7 years ago[libfuzzer] Remove XFAIL for OutOfMemory test.
Juergen Ributzka [Mon, 27 Mar 2017 22:33:05 +0000 (22:33 +0000)]
[libfuzzer] Remove XFAIL for OutOfMemory test.

This test is now passing on Darwin.

See rdar://problem/31282257.

llvm-svn: 298886

7 years agoImprove machine schedulers for in-order processors
Javed Absar [Mon, 27 Mar 2017 20:46:37 +0000 (20:46 +0000)]
Improve machine schedulers for in-order processors

This patch enables schedulers to specify instructions that
cannot be issued with any other instructions.
It also fixes BeginGroup/EndGroup.

Reviewed by: Andrew Trick
Differential Revision: https://reviews.llvm.org/D30744

llvm-svn: 298885

7 years agoFix missing sanitizer platform include
Francis Ricci [Mon, 27 Mar 2017 20:22:02 +0000 (20:22 +0000)]
Fix missing sanitizer platform include

llvm-svn: 298884

7 years agoAdd the error handling for Mach-O dyld compact lazy bind, weak bind and
Kevin Enderby [Mon, 27 Mar 2017 20:09:23 +0000 (20:09 +0000)]
Add the error handling for Mach-O dyld compact lazy bind, weak bind and
rebase entry errors and test cases for each of the error checks.

Also verified with Nick Kledzik that a BIND_OPCODE_SET_ADDEND_SLEB
opcode is legal in a lazy bind table, so code that had that as an error
check was removed.

With MachORebaseEntry and MachOBindEntry classes now returning
an llvm::Error in all cases for malformed input the variables Malformed
and logic to set use them is no longer needed and has been removed
from those classes.

Also in a few places, removed the redundant Done assignment to true
when also calling moveToEnd() as it does that assignment.

This only leaves the dyld compact export entries left to have
error handling yet to be added for the dyld compact info.

llvm-svn: 298883

7 years ago[LV] Transform truncations of non-primary induction variables
Matthew Simpson [Mon, 27 Mar 2017 20:07:38 +0000 (20:07 +0000)]
[LV] Transform truncations of non-primary induction variables

The vectorizer tries to replace truncations of induction variables with new
induction variables having the smaller type. After r295063, this optimization
was applied to all integer induction variables, including non-primary ones.
When optimizing the truncation of a non-primary induction variable, we still
need to transform the new induction so that it has the correct start value.
This should fix PR32419.

Reference: https://bugs.llvm.org/show_bug.cgi?id=32419
llvm-svn: 298882

7 years ago[APInt] Move operator=(uint64_t) inline as its pretty simple and is often used with...
Craig Topper [Mon, 27 Mar 2017 20:07:31 +0000 (20:07 +0000)]
[APInt] Move operator=(uint64_t) inline as its pretty simple and is often used with small constants that the compiler can optimize.

While there recognize that we only need to clearUnusedBits on the single word case.

llvm-svn: 298881

7 years agoAdd [[clang::suppress(rule, ...)]] attribute
Matthias Gehre [Mon, 27 Mar 2017 19:45:24 +0000 (19:45 +0000)]
Add [[clang::suppress(rule, ...)]] attribute

Summary:
This patch implements parsing of [[clang::suppress(rule, ...)]]
and [[gsl::suppress(rule, ...)]] attributes.

C++ Core Guidelines depend heavily on tool support for
rule enforcement. They also propose a way to suppress
warnings [1] which is by annotating any ancestor in AST
with the C++11 attribute [[gsl::suppress(rule1,...)]].
To have a mechanism to suppress non-C++ Core
Guidelines specific, an additional spelling of [[clang::suppress]]
is defined.

For example, to suppress the warning cppcoreguidelines-slicing,
one could do
```
[[clang::suppress("cppcoreguidelines-slicing")]]
void f() { ... code that does slicing ... }
```
or
```
void g() {
  Derived b;
  [[clang::suppress("cppcoreguidelines-slicing")]]
  Base a{b};
  [[clang::suppress("cppcoreguidelines-slicing")]] {
    doSomething();
    Base a2{b};
  }
}
```

This parsing can then be used by clang-tidy, which includes multiple
C++ Core Guidelines rules, to suppress warnings (see
https://reviews.llvm.org/D24888).
For the exact naming of the rule in the attribute, there
are different possibilities, which will be defined in the
corresponding clang-tidy patch.

Currently, clang-tidy supports suppressing of warnings through "//
NOLINT" comments. There are some advantages that the attribute has:
- Suppressing specific warnings instead of all warnings
- Suppressing warnings in a block (namespace, function, compound
  statement)
- Code formatting may split a statement into multiple lines,
  thus a "// NOLINT" comment may be on the wrong line

I'm looking forward to your comments!

[1] https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#inforce-enforcement

Reviewers: alexfh, aaron.ballman, rsmith

Subscribers: cfe-commits

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

llvm-svn: 298880

7 years agoFix comment in lsan_linux.cc
Francis Ricci [Mon, 27 Mar 2017 19:44:11 +0000 (19:44 +0000)]
Fix comment in lsan_linux.cc

llvm-svn: 298879

7 years agoMove lsan allocator cache from lsan_common_linux to lsan_linux
Francis Ricci [Mon, 27 Mar 2017 19:42:37 +0000 (19:42 +0000)]
Move lsan allocator cache from lsan_common_linux to lsan_linux

Having this function in common seems to trigger a lot of unrelated
test failures. Given that this isn't really common code anyway,
move this to a new linux-specific lsan file.

llvm-svn: 298878

7 years agoEncapsulate FPOptions and use it consistently
Adam Nemet [Mon, 27 Mar 2017 19:17:25 +0000 (19:17 +0000)]
Encapsulate FPOptions and use it consistently

Sema holds the current FPOptions which is adjusted by 'pragma STDC
FP_CONTRACT'.  This then gets propagated into expression nodes as they are
built.

This encapsulates FPOptions so that this propagation happens opaquely rather
than directly with the fp_contractable on/off bit.  This allows controlled
transitioning of fp_contractable to a ternary value (off, on, fast).  It will
also allow adding more fast-math flags later.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

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

llvm-svn: 298877

7 years agoIn FileSpec::Equal, short-cut GetNormalizedPath.
Jim Ingham [Mon, 27 Mar 2017 19:12:25 +0000 (19:12 +0000)]
In FileSpec::Equal, short-cut GetNormalizedPath.

GetNormalizedPath seems to be slow, so it's worth
shortcutting it if possible.  This change does so
when the filenames and not equal and we can tell
GetNormalizedPath would not make them equal.

Also added a test for "." final component since that
was missing.

llvm-svn: 298876

7 years ago[TableGen] Print #nnn as a name of an non-native reg unit with id nnn
Krzysztof Parzyszek [Mon, 27 Mar 2017 19:08:24 +0000 (19:08 +0000)]
[TableGen] Print #nnn as a name of an non-native reg unit with id nnn

When using -debug with -gen-register-info, tablegen will crash when
trying to print a name of a non-native register unit. This patch only
affects the debug information generated while running llvm-tblgen,
and has no impact on the compilable code coming out of it.

llvm-svn: 298875

7 years agoFix the Xcode project for OpenBSD additions.
Jim Ingham [Mon, 27 Mar 2017 19:03:11 +0000 (19:03 +0000)]
Fix the Xcode project for OpenBSD additions.

llvm-svn: 298874

7 years ago[powerpc] deactivate ManyThreadsTest asan test on powerpc64
Bill Seurer [Mon, 27 Mar 2017 18:36:06 +0000 (18:36 +0000)]
[powerpc] deactivate ManyThreadsTest asan test on powerpc64

This test case occassionally hangs when run on powerpc.  This is also a
problem on AArch64 (see https://bugs.llvm.org/show_bug.cgi?id=24389).
Reactivate this when the problem is fixed.

This could also be related to the same problem as with the tests
ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, and several
others that do not run reliably on powerpc.

llvm-svn: 298873

7 years ago[AMDGPU] SISched: Detect dependency types between blocks
Valery Pykhtin [Mon, 27 Mar 2017 18:22:39 +0000 (18:22 +0000)]
[AMDGPU] SISched: Detect dependency types between blocks

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298872

7 years ago[Support] Avoid concurrency hazard in signal handler registration
Bruno Cardoso Lopes [Mon, 27 Mar 2017 18:21:31 +0000 (18:21 +0000)]
[Support] Avoid concurrency hazard in signal handler registration

Several static functions from the signal API can be invoked
simultaneously; RemoveFileOnSignal for instance can be called indirectly
by multiple parallel loadModule() invocations, which might lead to
the assertion:

Assertion failed: (NumRegisteredSignals < array_lengthof(RegisteredSignalInfo) && "Out of space for signal handlers!"),
  function RegisterHandler, file /llvm/lib/Support/Unix/Signals.inc, line 105.

RemoveFileOnSignal calls RegisterHandlers(), which isn't currently
mutex protected, leading to the behavior above. This potentially affect
a few other users of RegisterHandlers() too.

rdar://problem/30381224

llvm-svn: 298871

7 years ago[APInt] Move operator&=(uint64_t) inline and use memset to clear the upper words.
Craig Topper [Mon, 27 Mar 2017 18:16:17 +0000 (18:16 +0000)]
[APInt] Move operator&=(uint64_t) inline and use memset to clear the upper words.

This method is pretty new and probably isn't use much in the code base so this should have a negligible size impact. The OR and XOR operators are already inline.

llvm-svn: 298870

7 years ago[GlobalISel][AArch64] Extract a variable out of an NDEBUG block. NFC.
Ahmed Bougacha [Mon, 27 Mar 2017 18:14:20 +0000 (18:14 +0000)]
[GlobalISel][AArch64] Extract a variable out of an NDEBUG block. NFC.

r298863 used PtrReg, but that's never defined in release builds. Fix it.

llvm-svn: 298869

7 years agoRevert "[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)"
Juergen Ributzka [Mon, 27 Mar 2017 18:08:37 +0000 (18:08 +0000)]
Revert "[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)"

This broke GreenDragon: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29505/consoleFull

llvm-svn: 298868

7 years ago[APInt] Use memset in setAllBits.
Craig Topper [Mon, 27 Mar 2017 17:50:54 +0000 (17:50 +0000)]
[APInt] Use memset in setAllBits.

llvm-svn: 298867

7 years agoRemove redundant check for nullptr.
Adrian Prantl [Mon, 27 Mar 2017 17:36:31 +0000 (17:36 +0000)]
Remove redundant check for nullptr.

llvm-svn: 298866

7 years agoRemove unneccessary virtual destructor from DwarfExpression.
Adrian Prantl [Mon, 27 Mar 2017 17:34:04 +0000 (17:34 +0000)]
Remove unneccessary virtual destructor from DwarfExpression.

llvm-svn: 298865

7 years ago[GlobalISel][AArch64] Fold FI into LDR/STR ui addressing mode.
Ahmed Bougacha [Mon, 27 Mar 2017 17:31:56 +0000 (17:31 +0000)]
[GlobalISel][AArch64] Fold FI into LDR/STR ui addressing mode.

A majority of loads and stores at O0 access an alloca.

It's trivial to fold the G_FRAME_INDEX into the instruction; do it.

llvm-svn: 298864

7 years ago[GlobalISel][AArch64] Fold G_GEP into LDR/STR ui addressing mode.
Ahmed Bougacha [Mon, 27 Mar 2017 17:31:52 +0000 (17:31 +0000)]
[GlobalISel][AArch64] Fold G_GEP into LDR/STR ui addressing mode.

We're not to the point of supporting the load/store patterns yet
(because they extensively use PatFrags).

But in the meantime, we can implement some of the simplest addressing
modes.

llvm-svn: 298863

7 years ago[GlobalISel][AArch64] Select store of zero to WZR/XZR.
Ahmed Bougacha [Mon, 27 Mar 2017 17:31:48 +0000 (17:31 +0000)]
[GlobalISel][AArch64] Select store of zero to WZR/XZR.

These occur very frequently, and are quite trivial to catch.

llvm-svn: 298862

7 years ago[AMDGPU] SISched: Update colorEndsAccordingToDependencies
Valery Pykhtin [Mon, 27 Mar 2017 17:26:40 +0000 (17:26 +0000)]
[AMDGPU] SISched: Update colorEndsAccordingToDependencies

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298861

7 years ago[sanitizers] Upgrade ios min version to 8
Kuba Mracek [Mon, 27 Mar 2017 17:16:47 +0000 (17:16 +0000)]
[sanitizers] Upgrade ios min version to 8

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

llvm-svn: 298860

7 years ago[sanitizers] Avoid using -fomit-frame-pointer on Darwin
Kuba Mracek [Mon, 27 Mar 2017 17:14:48 +0000 (17:14 +0000)]
[sanitizers] Avoid using -fomit-frame-pointer on Darwin

On Darwin, we're having multiple issues with using -fomit-frame-pointer in the AddressSanitizer and ThreadSanitizer runtimes, so we're actually not using -fomit-frame-pointer in the our builds of the sanitizer dylibs. This patch just pushes our internal change upstream.

The issues are usually with debuggers, profilers and other tools that unwind the stack (crash reporter), which are often simply not able to get a stack trace. And crashlogs that don't contain a stack trace are a huge problem.

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

llvm-svn: 298859

7 years ago[APInt] Move the >64 bit case for flipAllBits out of line.
Craig Topper [Mon, 27 Mar 2017 17:10:21 +0000 (17:10 +0000)]
[APInt] Move the >64 bit case for flipAllBits out of line.

This is more consistent with what we do for other operations. This shrinks the opt binary on my build by ~72k.

llvm-svn: 298858

7 years ago[AMDGPU] Fix SI scheduler LiveOut Refcount issue
Valery Pykhtin [Mon, 27 Mar 2017 17:06:36 +0000 (17:06 +0000)]
[AMDGPU] Fix SI scheduler LiveOut Refcount issue

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298857

7 years ago[GlobalISel][AArch64] Select CBZ.
Ahmed Bougacha [Mon, 27 Mar 2017 16:35:31 +0000 (16:35 +0000)]
[GlobalISel][AArch64] Select CBZ.

CBZ/CBNZ represent a substantial portion of all conditional branches.
Look through G_ICMP to select them.

We can't use tablegen yet because the existing patterns match an
AArch64ISD node.

llvm-svn: 298856

7 years ago[GlobalISel] Add a 'getConstantVRegVal' helper.
Ahmed Bougacha [Mon, 27 Mar 2017 16:35:27 +0000 (16:35 +0000)]
[GlobalISel] Add a 'getConstantVRegVal' helper.

Use it to compare immediate operands.

llvm-svn: 298855

7 years ago[GlobalISel][AArch64] Use proper constant types in test. NFC.
Ahmed Bougacha [Mon, 27 Mar 2017 16:35:23 +0000 (16:35 +0000)]
[GlobalISel][AArch64] Use proper constant types in test. NFC.

llvm-svn: 298854

7 years agoLook through CXXBindTemporaryExprs when checking CXXFunctionCastExprs
Daniel Jasper [Mon, 27 Mar 2017 16:29:41 +0000 (16:29 +0000)]
Look through CXXBindTemporaryExprs when checking CXXFunctionCastExprs
for unused values.

This fixes a regression caused by r298676, where constructor calls to
classes with non-trivial dtor were marked as unused if the first
argument is an initializer list. This is inconsistent (as the test
shows) and also warns on a reasonbly common code pattern where people
just call constructors to create and immediately destroy an object.

llvm-svn: 298853

7 years ago[AMDGPU][MC] Fix for Bug 28207 + LIT tests
Dmitry Preobrazhensky [Mon, 27 Mar 2017 15:57:17 +0000 (15:57 +0000)]
[AMDGPU][MC] Fix for Bug 28207 + LIT tests

Enabled clamp and omod for v_cvt_* opcodes which have src0 of an integer type

Reviewers: vpykhtin, arsenm

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

llvm-svn: 298852

7 years ago[AArch64] Mark mrs of TPIDR_EL0 (thread pointer) as not having side effects.
Chad Rosier [Mon, 27 Mar 2017 15:52:38 +0000 (15:52 +0000)]
[AArch64] Mark mrs of TPIDR_EL0 (thread pointer) as not having side effects.

Among other things, this allows Machine LICM to hoist a costly 'mrs'
instruction from within a loop.

Differential Revision: http://reviews.llvm.org/D31151

llvm-svn: 298851

7 years ago[ARM] Add a driver option for +no-neg-immediates
Sanne Wouda [Mon, 27 Mar 2017 15:34:52 +0000 (15:34 +0000)]
[ARM] Add a driver option for +no-neg-immediates

Reviewers: olista01, rengolin, javed.absar, samparker

Reviewed By: samparker

Subscribers: samparker, llvm-commits, aemerson

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

llvm-svn: 298850

7 years agoUse pthreads for thread-local lsan allocator cache on darwin
Francis Ricci [Mon, 27 Mar 2017 14:07:50 +0000 (14:07 +0000)]
Use pthreads for thread-local lsan allocator cache on darwin

Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 298848

7 years agoDisable use_tls_dynamic on 32-bit linux
Francis Ricci [Mon, 27 Mar 2017 14:06:49 +0000 (14:06 +0000)]
Disable use_tls_dynamic on 32-bit linux

Summary:
This test fails with a false negative due to an unrelated change.
Since we expect a number of false negatives on 32-bit lsan,
disable this test on linux-i386 and linux-i686.

Reviewers: kubamracek, m.ostapenko, kcc

Subscribers: llvm-commits

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

llvm-svn: 298847

7 years ago[AMDGPU] Get address space mapping by target triple environment
Yaxun Liu [Mon, 27 Mar 2017 14:04:01 +0000 (14:04 +0000)]
[AMDGPU] Get address space mapping by target triple environment

As we introduced target triple environment amdgiz and amdgizcl, the address
space values are no longer enums. We have to decide the value by target triple.

The basic idea is to use struct AMDGPUAS to represent address space values.
For address space values which are not depend on target triple, use static
const members, so that they don't occupy extra memory space and is equivalent
to a compile time constant.

Since the struct is lightweight and cheap, it can be created on the fly at
the point of usage. Or it can be added as member to a pass and created at
the beginning of the run* function.

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

llvm-svn: 298846

7 years ago[InstCombine] Avoid incorrect folding of select into phi nodes when incoming element...
Anna Thomas [Mon, 27 Mar 2017 13:52:51 +0000 (13:52 +0000)]
[InstCombine] Avoid incorrect folding of select into phi nodes when incoming element is a vector type

Summary:
We are incorrectly folding selects into phi nodes when the incoming value of a phi
node is a constant vector. This optimization is done in `FoldOpIntoPhi` when the
select condition is a phi node with constant incoming values.
Without the fix, we are miscompiling (i.e. incorrectly folding the
select into the phi node) when the vector contains non-zero
elements.
This patch fixes the miscompile and we will correctly fold based on the
select vector operand (see added test cases).

Reviewers: majnemer, sanjoy, spatel

Subscribers: llvm-commits

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

llvm-svn: 298845

7 years agoCorrect OptionCategoryCompare() in the command line library.
Daniel Sanders [Mon, 27 Mar 2017 13:43:24 +0000 (13:43 +0000)]
Correct OptionCategoryCompare() in the command line library.

Summary:
It should return <0, 0, or >0 for less-than, equal, and greater-than like
strcmp() (according to the history, it used to be implemented with
strcmp()) but it actually returned 0, or 1 for not-equal and equal.

Reviewers: qcolombet

Reviewed By: qcolombet

Subscribers: qcolombet, llvm-commits

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

llvm-svn: 298844

7 years ago[tablegen] Use categories on options that only matter to one emitter.
Daniel Sanders [Mon, 27 Mar 2017 13:15:13 +0000 (13:15 +0000)]
[tablegen] Use categories on options that only matter to one emitter.

Summary:
The categories are emitted in a strange order in this patch due to a bug in the
CommandLine library.

Reviewers: ab

Reviewed By: ab

Subscribers: ab, llvm-commits

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

llvm-svn: 298843

7 years agoPublish one more parser RAII for external use.
Vassil Vassilev [Mon, 27 Mar 2017 13:11:32 +0000 (13:11 +0000)]
Publish one more parser RAII for external use.

llvm-svn: 298842

7 years agoADT: Add range helpers for pointer_ and pointee_iterator
Justin Bogner [Mon, 27 Mar 2017 12:56:12 +0000 (12:56 +0000)]
ADT: Add range helpers for pointer_ and pointee_iterator

llvm-svn: 298841

7 years ago[X86][AVX2] bugzilla bug 21281 Performance regression in vector interleave in AVX2
Gadi Haber [Mon, 27 Mar 2017 12:13:37 +0000 (12:13 +0000)]
[X86][AVX2] bugzilla bug 21281 Performance regression in vector interleave in AVX2
This is a patch for an on-going bugzilla bug 21281 on the generated X86 code for a matrix transpose8x8 subroutine which requires vector interleaving. The generated code in AVX2 is currently non-optimal and requires 60 instructions as opposed to only 40 instructions generated for AVX1.
 The patch includes a fix for the AVX2 case where vector unpack instructions use less operations than the vector blend operations available in AVX2.
 In this case using vector unpack instructions is more efficient.

Reviewers:
zvi
delena
igorb
craig.topper
guyblank
eladcohen
m_zuckerman
aymanmus
RKSimon

llvm-svn: 298840

7 years agoMark *pass tests as UNUSUPPORTED instead of XFAIL on old compilers
Marshall Clow [Mon, 27 Mar 2017 10:44:33 +0000 (10:44 +0000)]
Mark *pass tests as UNUSUPPORTED instead of XFAIL on old compilers

llvm-svn: 298839

7 years ago[OpenCL] Extended mapping of parcing CodeGen arguments
Egor Churaev [Mon, 27 Mar 2017 10:38:01 +0000 (10:38 +0000)]
[OpenCL] Extended mapping of parcing CodeGen arguments

Summary: Enable cl_mad_enamle and cl_no_signed_zeros options when user turns on cl_unsafe_math_optimizations or cl_fast_relaxed_math options.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 298838