OSDN Git Service

android-x86/external-llvm.git
6 years agoFix llvm-special-case-list-fuzzer regexp exception
Vlad Tsyrklevich [Fri, 27 Oct 2017 19:15:13 +0000 (19:15 +0000)]
Fix llvm-special-case-list-fuzzer regexp exception

Summary:
Original oss-fuzz report:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3727#c2

The minimized test case that causes this failure:
5b 5b 5b 3d 47 53 00 5b  3d 5d 5b 5d 0a     [[[=GS.[=][].

Note the string "=GS\x00". The failure happens because the code is
searching the string against an array of known collated names. "GS\x00"
is a hit, but since len takes into account an extra NUL byte, indexing
into cp->name[len] goes one byte past it's allocated memory. Fix this to
use a strlen(cp->name) comparison to account for NUL bytes in the input.

Reviewers: pcc

Reviewed By: pcc

Subscribers: hctim, kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316786 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp
Krzysztof Parzyszek [Fri, 27 Oct 2017 18:52:28 +0000 (18:52 +0000)]
[Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp

Making sure that an instruction has fewer operands than required, then
attempting to access one out of range is going to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316785 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] Add tests for inserting all-bits (-1) into a vector
Simon Pilgrim [Fri, 27 Oct 2017 18:14:12 +0000 (18:14 +0000)]
[X86][SSE] Add tests for inserting all-bits (-1) into a vector

We should be able to do this by re-materializing an all-bits vector and then blending with it

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316779 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoELF: Add support for emitting dynamic relocations in the Android relocation packing...
Peter Collingbourne [Fri, 27 Oct 2017 17:49:40 +0000 (17:49 +0000)]
ELF: Add support for emitting dynamic relocations in the Android relocation packing format.

The Android relocation packing format is a more compact
format for dynamic relocations in executables and DSOs
that is based on delta encoding and SLEBs. An overview
of the format can be found in the Android source code:
https://android.googlesource.com/platform/bionic/+/refs/heads/master/tools/relocation_packer/src/delta_encoder.h

This patch implements relocation packing using that format.

This implementation uses a more intelligent algorithm for compressing
relative relocations than Android's own relocation packer. As a
result it can generally create smaller relocation sections than
that packer. If I link Chromium for Android targeting ARM32 I get a
.rel.dyn of size 174693 bytes, as compared to 371832 bytes with gold
and the Android packer.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316775 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][F16C] Fix btver2 AGU pipe scheduling
Simon Pilgrim [Fri, 27 Oct 2017 16:34:58 +0000 (16:34 +0000)]
[X86][F16C] Fix btver2 AGU pipe scheduling

Use the store AGU for stores, and the load AGU needs to be the first pipe for loads

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316771 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LoopPredication] Handle the case when the guard and the latch IV have different...
Artur Pilipenko [Fri, 27 Oct 2017 14:46:17 +0000 (14:46 +0000)]
[LoopPredication] Handle the case when the guard and the latch IV have different offsets

This is a follow up change for D37569.

Currently the transformation is limited to the case when:
 * The loop has a single latch with the condition of the form: ++i <pred> latchLimit, where <pred> is u<, u<=, s<, or s<=.
 * 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 of the form i u< guardLimit.

This patch enables the transform in the case when the latch is

 latchStart + i <pred> latchLimit, where <pred> is u<, u<=, s<, or s<=.

And the guard is

 guardStart + i u< guardLimit

Reviewed By: anna

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316768 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Fix -Wunused-private-field warning on lld-x86_64-darwin13.
Clement Courbet [Fri, 27 Oct 2017 13:34:41 +0000 (13:34 +0000)]
[CodeGen] Fix -Wunused-private-field warning on lld-x86_64-darwin13.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316765 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen][ExpandMemCmp][NFC] Simplify load sequence generation.
Clement Courbet [Fri, 27 Oct 2017 12:34:18 +0000 (12:34 +0000)]
[CodeGen][ExpandMemCmp][NFC] Simplify load sequence generation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316763 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LLVM-C] Publicly expose getters of MetadataType, TokenType
whitequark [Fri, 27 Oct 2017 11:51:40 +0000 (11:51 +0000)]
[LLVM-C] Publicly expose getters of MetadataType, TokenType

Patch by Robert Widmann.

Expose getters for MetadataType and TokenType publicly in the C API.
Discovered a need for these while trying to wrap the intrinsics API.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316762 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix BB after r316756 "[llvm-dwarfdump] - Teach verifier to report broken DWARF expres...
George Rimar [Fri, 27 Oct 2017 10:58:04 +0000 (10:58 +0000)]
Fix BB after r316756 "[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions."

Bot:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/6255

Changed format of this message by mistake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316757 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions.
George Rimar [Fri, 27 Oct 2017 10:42:04 +0000 (10:42 +0000)]
[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions.

Patch improves next things:

* Fixes assert/crash in getOpDesc when giving it a invalid expression op code.
* DWARFExpression::print() called DWARFExpression::Operation::getEndOffset() which
  returned and used uninitialized field EndOffset. Patch fixes that.
* Teaches verifier to verify DW_AT_location and error out on broken expressions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316756 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDAG: Fold fma (fneg x), K, y -> fma x, -K, y
Matt Arsenault [Fri, 27 Oct 2017 09:06:07 +0000 (09:06 +0000)]
DAG: Fold fma (fneg x), K, y -> fma x, -K, y

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316753 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen][ExpandMemcmp][NFC] Make tests more complete.
Clement Courbet [Fri, 27 Oct 2017 08:33:51 +0000 (08:33 +0000)]
[CodeGen][ExpandMemcmp][NFC] Make tests more complete.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316749 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GVN][NFC] Refactor loop iteration with foreach
Max Kazantsev [Fri, 27 Oct 2017 08:19:35 +0000 (08:19 +0000)]
[GVN][NFC] Refactor loop iteration with foreach

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316748 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agollvm/CodeGen/GlobalISel/InstructionSelectorImpl.h: Fix -fmodules build introduced...
NAKAMURA Takumi [Fri, 27 Oct 2017 05:45:11 +0000 (05:45 +0000)]
llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h: Fix -fmodules build introduced in rL316715.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316743 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert rL316568 because of sudden performance drop on ARM
Max Kazantsev [Fri, 27 Oct 2017 04:17:44 +0000 (04:17 +0000)]
Revert rL316568 because of sudden performance drop on ARM

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316739 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd subclass data to the FoldingSetNode for MemIntrinsicSDNodes.
Sean Fertile [Fri, 27 Oct 2017 04:02:51 +0000 (04:02 +0000)]
Add subclass data to the FoldingSetNode for MemIntrinsicSDNodes.

Not having the subclass data on an MemIntrinsicSDNodes means it was possible
to try to fold 2 nodes with the same operands but differing MMO flags. This
would trip an assertion when trying to refine the alignment between the 2
MachineMemOperands.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316737 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 27 Oct 2017 01:09:08 +0000 (01:09 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316724 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PDB] Handle an empty globals hash table with no buckets
Reid Kleckner [Fri, 27 Oct 2017 00:45:51 +0000 (00:45 +0000)]
[PDB] Handle an empty globals hash table with no buckets

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316722 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[CGP] Merge empty case blocks if no extra moves are added."
Balaram Makam [Fri, 27 Oct 2017 00:35:18 +0000 (00:35 +0000)]
Revert "[CGP] Merge empty case blocks if no extra moves are added."

This reverts commit r316711. The domtree isn't getting updated correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316721 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] MC: Don't allow zero sized data segments
Sam Clegg [Fri, 27 Oct 2017 00:08:55 +0000 (00:08 +0000)]
[WebAssembly] MC: Don't allow zero sized data segments

This ensures that each segment has a unique address.
Without this, consecutive zero sized symbols would
end up with the same address and the linker cannot
map symbols to unique data segments.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316717 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoInstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member...
David Blaikie [Thu, 26 Oct 2017 23:39:54 +0000 (23:39 +0000)]
InstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member function to expose the debug name

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316715 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMCCodePadder.h: Include definition of type for use with DenseMap
David Blaikie [Thu, 26 Oct 2017 23:39:52 +0000 (23:39 +0000)]
MCCodePadder.h: Include definition of type for use with DenseMap

Pointer traits require a full definition of a type to function
correctly, so the header must be included rather than only a forward
declaration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316714 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CGP] Merge empty case blocks if no extra moves are added.
Balaram Makam [Thu, 26 Oct 2017 22:34:01 +0000 (22:34 +0000)]
[CGP] Merge empty case blocks if no extra moves are added.

Summary:
Currently we skip merging when extra moves may be added in the header of switch instead of the case block, if the case block is used as an incoming
block of a PHI. If all the incoming values of the PHIs are non-constants and the destination block is dominated by the switch block then extra moves are likely not added by ISel, so there is no need to skip merging in this case.

Reviewers: efriedma, junbuml, davidxl, hfinkel, qcolombet

Reviewed By: efriedma

Subscribers: dberlin, kuhar, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316711 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SimplifyIndVars] Shorten code by using SCEV helper [NFC]
Philip Reames [Thu, 26 Oct 2017 22:02:16 +0000 (22:02 +0000)]
[SimplifyIndVars] Shorten code by using SCEV helper [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316709 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Honor -mfloat-abi for libcall calling convention
Eli Friedman [Thu, 26 Oct 2017 21:42:32 +0000 (21:42 +0000)]
[ARM] Honor -mfloat-abi for libcall calling convention

As far as I can tell, this matches gcc: -mfloat-abi determines the
calling convention for all functions except those explicitly defined as
soft-float in the ARM RTABI.

This change only affects cases where the user specifies -mfloat-abi to
override the default calling convention derived from the target triple.

Fixes https://bugs.llvm.org//show_bug.cgi?id=34530.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316708 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSupport/reg*: Roll some non-modular headers into their singular uses
David Blaikie [Thu, 26 Oct 2017 21:32:58 +0000 (21:32 +0000)]
Support/reg*: Roll some non-modular headers into their singular uses

These headers have static variables in them, which would easily create
ODR violations if the header was included in another header, and the
constants were used by an inline function, for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316706 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDo not add discriminator encoding for debug intrinsics.
Dehao Chen [Thu, 26 Oct 2017 21:20:52 +0000 (21:20 +0000)]
Do not add discriminator encoding for debug intrinsics.

Summary: There are certain requirements for debug location of debug intrinsics, e.g. the scope of the DILocalVariable should be the same as the scope of its debug location. As a result, we should not add discriminator encoding for debug intrinsics.

Reviewers: dblaikie, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, aprantl, bjope, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316703 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Improve handling of UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG to support 64-bit...
Craig Topper [Thu, 26 Oct 2017 21:12:03 +0000 (21:12 +0000)]
[X86] Improve handling of UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG to support 64-bit extensions.

If the extend type is 64-bits, emit a 32-bit -> 64-bit extend after the UDIVREM8_ZEXT_HREG/UDIVREM8_SEXT_HREG operation.

This gives a shorter encoding for the second extend in the sext case, and allows us to completely remove the second extend in the zext case.

This also adds known bit and num sign bits support for UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316702 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Teach the assembly parser to warn on duplicate registers in gather instructions.
Craig Topper [Thu, 26 Oct 2017 21:03:54 +0000 (21:03 +0000)]
[X86] Teach the assembly parser to warn on duplicate registers in gather instructions.

Fixes PR32238.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316700 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LICM] Restructure implicit exit handling to be more clear [NFCI]
Philip Reames [Thu, 26 Oct 2017 21:00:15 +0000 (21:00 +0000)]
[LICM] Restructure implicit exit handling to be more clear [NFCI]

When going to explain this to someone else, I got tripped up by the complicated meaning of IsKnownNonEscapingObject in load-store promotion.  Extract a helper routine and clarify naming/scopes to make this a bit more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316699 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[TableGen] Use Twine instead of std::string concatenation in two calls to PrintFatalE...
Craig Topper [Thu, 26 Oct 2017 20:49:36 +0000 (20:49 +0000)]
[TableGen] Use Twine instead of std::string concatenation in two calls to PrintFatalError.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316697 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSupport/reg*.h: Make headers include their dependencies
David Blaikie [Thu, 26 Oct 2017 20:23:11 +0000 (20:23 +0000)]
Support/reg*.h: Make headers include their dependencies

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316696 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GISel]: Missed checking if it's okay to create a G_CONSTANT of DstTy in the legaliza...
Aditya Nandakumar [Thu, 26 Oct 2017 20:13:54 +0000 (20:13 +0000)]
[GISel]: Missed checking if it's okay to create a G_CONSTANT of DstTy in the legalizationCombiner

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316694 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[COFF] Support ordinals in def files with space between @ and the number
Martin Storsjo [Thu, 26 Oct 2017 20:11:32 +0000 (20:11 +0000)]
[COFF] Support ordinals in def files with space between @ and the number

Both GNU ld and MS link.exe support declaring ordinals this way.

A test will be added in lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316690 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] use an insert op to put one variable element into a constant of vectors
Sanjay Patel [Thu, 26 Oct 2017 18:27:55 +0000 (18:27 +0000)]
[x86] use an insert op to put one variable element into a constant of vectors

Instead of loading (a potential ton of) scalar constants, load those as a vector and then insert into it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316685 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[docs] Fix a small typo
Vedant Kumar [Thu, 26 Oct 2017 17:58:05 +0000 (17:58 +0000)]
[docs] Fix a small typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316682 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Commit missing fence-barrier test
Konstantin Zhuravlyov [Thu, 26 Oct 2017 17:54:09 +0000 (17:54 +0000)]
AMDGPU: Commit missing fence-barrier test

This should have been committed with memory model implementation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316680 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoClear LastMappingSymbols and LastEMS(Info) when resetting the ARM(AArch64)ELFStreamer
Yichao Yu [Thu, 26 Oct 2017 17:36:43 +0000 (17:36 +0000)]
Clear LastMappingSymbols and LastEMS(Info) when resetting the ARM(AArch64)ELFStreamer

Summary:
This causes a segfault on ARM when (I think) the pass manager is used multiple times.

Reset set the (last) current section to NULL without saving the corresponding LastEMSInfo back into the map. The next use of the streamer then save the LastEMSInfo for the NULL section leaving the LastEMSInfo mapping for the last current section (the one that was there before the reset) NULL which cause the LastEMSInfo to be set to NULL when the section is being used again.

The reuse of the section (pointer) might mean that the map was holding dangling pointers previously which is why I went for clearing the map and resetting the info, making it as similar to the state right after the constructor run as possible. The AArch64 one doesn't have segfault (since LastEMS isn't a pointer) but it seems to have the same issue.

The segfault is likely caused by https://reviews.llvm.org/D30724 which turns LastEMSInfo into a pointer. As mentioned above, it seems that the actual issue was older though.

No test is included since the test is believed to be too complicated for such an obvious fix and not worth doing.

Reviewers: llvm-commits, shankare, t.p.northover, peter.smith, rengolin

Reviewed By: rengolin

Subscribers: mgorny, aemerson, rengolin, javed.absar, kristof.beyls

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316679 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[dsymutil] Check AttrInfo.Name validity before using it
Keno Fischer [Thu, 26 Oct 2017 17:31:33 +0000 (17:31 +0000)]
[dsymutil] Check AttrInfo.Name validity before using it

Summary:
This upstreams a patch from the osxcross [1] toolchain.
It appears that llvm-dsymutil crashes at this place during GCC
bootstrap. Adding the check here seems reasonable, since it operates
on arbitrary input DWARF, not necessarily generated by the LLVM
toolchain, and it seems the un-mangled name need not necessarily exist.

Patch by Thomas Pöchtrager

[1] https://github.com/tpoechtrager/osxcross

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D39336

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316678 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DynamicLibrary] Fix build on musl libc
Keno Fischer [Thu, 26 Oct 2017 16:44:13 +0000 (16:44 +0000)]
[DynamicLibrary] Fix build on musl libc

Summary:
On musl libc, stdin/out/err are defined as `FILE* const` globals,
and their address is not implicitly convertible to void *,
or at least gcc 6 doesn't allow it, giving errors like:

```
error: cannot initialize return object of type 'void *' with an rvalue of type 'FILE *const *' (aka '_IO_FILE *const *')
    EXPLICIT_SYMBOL(stderr);
    ^~~~~~~~~~~~~~~~~~~~~~~
```

Add an explicit cast to fix that problem.

Reviewers: marsupial, krytarowski, dim
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D39297

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316672 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MachineModuleInfoImpls] Replace qsort with array_pod_sort
Mandeep Singh Grang [Thu, 26 Oct 2017 16:07:20 +0000 (16:07 +0000)]
[MachineModuleInfoImpls] Replace qsort with array_pod_sort

Summary:
This seems to be the only place in llvm we directly call qsort. We can replace
this with a call to array_pod_sort. Also minor cleanup of the sorting function.

Reviewers: bkramer, Eugene.Zelenko, rafael

Reviewed By: bkramer

Subscribers: efriedma, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316671 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReapply r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockInto...
Balaram Makam [Thu, 26 Oct 2017 15:04:53 +0000 (15:04 +0000)]
Reapply r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.

Summary: This reverts r316612 to reapply r316582. The buildbot failure was unrelated to this commit.

Reviewers:

Subscribers:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316669 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRepresent runtime preemption in the IR.
Sean Fertile [Thu, 26 Oct 2017 15:00:26 +0000 (15:00 +0000)]
Represent runtime preemption in the IR.

Currently we do not represent runtime preemption in the IR, which has several
drawbacks:

  1) The semantics of GlobalValues differ depending on the object file format
     you are targeting (as well as the relocation-model and -fPIE value).
  2) We have no way of disabling inlining of run time interposable functions,
     since in the IR we only know if a function is link-time interposable.
     Because of this llvm cannot support elf-interposition semantics.
  3) In LTO builds of executables we will have extra knowledge that a symbol
     resolved to a local definition and can't be preemptable, but have no way to
     propagate that knowledge through the compiler.

This patch adds preemptability specifiers to the IR with the following meaning:

dso_local --> means the compiler may assume the symbol will resolve to a
 definition within the current linkage unit and the symbol may be accessed
 directly even if the definition is not within this compilation unit.

dso_preemptable --> means that the compiler must assume the GlobalValue may be
replaced with a definition from outside the current linkage unit at runtime.

To ease transitioning dso_preemptable is treated as a 'default' in that
low-level codegen will still do the same checks it did previously to see if a
symbol should be accessed indirectly. Eventually when IR producers emit the
specifiers on all Globalvalues we can change dso_preemptable to mean 'always
access indirectly', and remove the current logic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316668 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Handle s_buffer_load_dword hazard on SI
Marek Olsak [Thu, 26 Oct 2017 14:43:02 +0000 (14:43 +0000)]
AMDGPU: Handle s_buffer_load_dword hazard on SI

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316666 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LSV] Avoid adding vectors of pointers as candidates
Bjorn Pettersson [Thu, 26 Oct 2017 13:59:15 +0000 (13:59 +0000)]
[LSV] Avoid adding vectors of pointers as candidates

Summary:
We no longer add vectors of pointers as candidates for
load/store vectorization. It does not seem to work anyway,
but without this patch we can end up in asserts when trying
to create casts between an integer type and the pointer of
vectors type.

The test case I've added used to assert like this when trying to
cast between i64 and <2 x i16*>:
opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 Vectorizer::vectorizeStoreChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: nhaehnle, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316665 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LSV] Skip all non-byte sizes, not only less than eight bits
Bjorn Pettersson [Thu, 26 Oct 2017 13:42:55 +0000 (13:42 +0000)]
[LSV] Skip all non-byte sizes, not only less than eight bits

Summary:
The code comments indicate that no effort has been spent on
handling load/stores when the size isn't a multiple of the
byte size correctly. However, the code only avoided types
smaller than 8 bits. So for example a load of an i28 could
still be considered as a candidate for vectorization.

This patch adjusts the code to behave according to the code
comment.

The test case used to hit the following assert when
trying to use "cast" an i32 to i28 using CreateBitOrPointerCast:

opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 (anonymous namespace)::Vectorizer::vectorizeLoadChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316663 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Fix (dis)assembly of abs.fmt for micromips
Simon Dardis [Thu, 26 Oct 2017 11:36:54 +0000 (11:36 +0000)]
[mips] Fix (dis)assembly of abs.fmt for micromips

These instructions were previously marked as codegen only preventing
them from being assembled as microMIPS or disassembled.

Reviewers: atanasyan, abeserminji

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316656 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIt's a test to demonstrate wrong disassembler with 0x67 prefix
Andrew V. Tischenko [Thu, 26 Oct 2017 11:14:43 +0000 (11:14 +0000)]
It's a test to demonstrate wrong disassembler with 0x67 prefix

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316655 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Fix PR35071
Simon Dardis [Thu, 26 Oct 2017 10:58:36 +0000 (10:58 +0000)]
[mips] Fix PR35071

PR35071 exposed the fact that MipsInstrInfo::removeBranch did not walk past
debug instructions when removing branches for the control flow optimizer, which
lead to duplicated conditional branches. If the target of the branch was a
removable block, only the conditional branch in the terminating position would
have it's MBB operands updated, leaving the first branch with a dangling MBB
operand. The MIPS long branch pass would then trigger an assertion when
attempting to examine the instruction with dangling MBB operand.

This resolves PR35071.

Thanks to Alex Richardson for reporting the issue!

Reviewers: atanasyan

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316654 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdate my email addresses, NFC.
Simon Dardis [Thu, 26 Oct 2017 10:16:54 +0000 (10:16 +0000)]
Update my email addresses, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316651 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1
Hiroshi Inoue [Thu, 26 Oct 2017 09:01:51 +0000 (09:01 +0000)]
[PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1

Currently a record-form instruction is used for comparison of "greater than -1" and "less than 1" by modifying the predicate (e.g. LT 1 into LE 0) in addition to the naive case of comparison against 0.
This patch also enables emitting a record-form instruction for "less than or equal to -1" (i.e. "less than 0") and "greater than or equal to 1" (i.e. "greater than 0") to increase the optimization opportunities.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316647 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTidy up CountingFunctionInserter a little. NFC.
Hans Wennborg [Thu, 26 Oct 2017 08:29:08 +0000 (08:29 +0000)]
Tidy up CountingFunctionInserter a little. NFC.

Use StringRef for CountingFunctionName, remove erroneous comment
copied from InstructionNamer, and drop some trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316644 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser][TableGen] Add VariantID argument to the generated mnemonic spell check...
Craig Topper [Thu, 26 Oct 2017 06:46:41 +0000 (06:46 +0000)]
[AsmParser][TableGen] Add VariantID argument to the generated mnemonic spell check function so it can use the correct table based on variant.

I'm considering implementing the mnemonic spell checker for x86, and that would require the separate intel and att variants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316641 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser][TableGen] Make the generated mnemonic spell checker function a file local...
Craig Topper [Thu, 26 Oct 2017 06:46:40 +0000 (06:46 +0000)]
[AsmParser][TableGen] Make the generated mnemonic spell checker function a file local static function.

Also only emit in targets that specificially request it. This is required so we don't get an unused static function error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316640 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Use correct type for return value of ComputeAvailableFeatures in the AsmParser...
Craig Topper [Thu, 26 Oct 2017 06:46:38 +0000 (06:46 +0000)]
[X86] Use correct type for return value of ComputeAvailableFeatures in the AsmParser. NFC

There aren't enough used bits to make this a functional change, but we should fix it for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316639 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Transforms] Revert r316630 changes in Scalar/MergeICmps.cpp to fix broken build...
Eugene Zelenko [Thu, 26 Oct 2017 01:25:14 +0000 (01:25 +0000)]
[Transforms] Revert r316630 changes in Scalar/MergeICmps.cpp to fix broken build bots (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316634 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Thu, 26 Oct 2017 00:55:39 +0000 (00:55 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316630 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAttempt to unbreak the expensive-checks-win bot
Matthew Simpson [Wed, 25 Oct 2017 22:46:34 +0000 (22:46 +0000)]
Attempt to unbreak the expensive-checks-win bot

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316625 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-land "[dwarfdump] Add -lookup option"
Jonas Devlieghere [Wed, 25 Oct 2017 21:56:41 +0000 (21:56 +0000)]
Re-land "[dwarfdump] Add -lookup option"

Add the option to lookup an address in the debug information and print
out the file, function, block and line table details.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316619 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix CodeGen/AMDGPU/fcanonicalize-elimination.ll on FreeBSD 11.0
Alexander Richardson [Wed, 25 Oct 2017 21:44:21 +0000 (21:44 +0000)]
Fix CodeGen/AMDGPU/fcanonicalize-elimination.ll on FreeBSD 11.0

Summary:
On FreeBSD11.0 the FileCheck NOT string "1.0" will be matched by
`.amd_amdgpu_isa "amdgcn-unknown-freebsd11.0--gfx802"` at the end of the
file. Add a CHECK for that directive to avoid failing the test.

Reviewers: rampitec, kzhuravl

Reviewed By: rampitec, kzhuravl

Subscribers: emaste, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits, krytarowski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316616 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SCEV] Fix an assertion failure in the max backedge taken count
Sanjoy Das [Wed, 25 Oct 2017 21:41:00 +0000 (21:41 +0000)]
[SCEV] Fix an assertion failure in the max backedge taken count

Max backedge taken count is always expected to be a constant; and this is
usually true by construction -- it is a SCEV expression with constant inputs.
However, if the max backedge expression ends up being computed to be a udiv with
a constant zero denominator[0], SCEV does not fold the result to a constant
since there is no constant it can fold it to (SCEV has no representation for
"infinity" or "undef").

However, in computeMaxBECountForLT we already know the denominator is positive,
and thus at least 1; and we can use this fact to avoid dividing by zero.

[0]: We can end up with a constant zero denominator if the signed range of the
stride is more precise than the unsigned range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316615 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd a comment to clarify a future change
Sanjoy Das [Wed, 25 Oct 2017 21:40:59 +0000 (21:40 +0000)]
Add a comment to clarify a future change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316614 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoO...
Balaram Makam [Wed, 25 Oct 2017 21:32:54 +0000 (21:32 +0000)]
Revert r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.

Summary: This reverts commit r316582. It looks like this commit broke tests on one buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/5719

. . .
Failing Tests (1):
    LLVM :: Transforms/CalledValuePropagation/simple-arguments.ll

Reviewers:

Subscribers:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316612 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd FileVerifier::isCFIProtected().
Mitch Phillips [Wed, 25 Oct 2017 21:21:16 +0000 (21:21 +0000)]
Add FileVerifier::isCFIProtected().

Add a CFI protection check that is implemented by building a graph and inspecting the output to deduce if the indirect CF instruction is CFI protected. Also added the output of this instruction to printIndirectInstructions().

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316610 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoHexagon: Fold a single-use textual header into its use
David Blaikie [Wed, 25 Oct 2017 19:52:21 +0000 (19:52 +0000)]
Hexagon: Fold a single-use textual header into its use

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316604 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMake the combiner check if shifts are legal before creating them
Aditya Nandakumar [Wed, 25 Oct 2017 18:49:18 +0000 (18:49 +0000)]
Make the combiner check if shifts are legal before creating them

Summary: Make sure shifts are legal/specified by the legalizerinfo before creating it

Reviewers: qcolombet, dsanders, rovka, t.p.northover

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316602 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Account for negative offset when limiting max deviation
Krzysztof Parzyszek [Wed, 25 Oct 2017 18:46:40 +0000 (18:46 +0000)]
[Hexagon] Account for negative offset when limiting max deviation

In getOffsetRange, Max can be set to 0 to force the extender replacement
to be at or below the original value. This would cause the new offset to
be non-negative, which is preferred for memory instructions (to reduce
the likelihood of it getting constant-extended due to predication). The
problem happens when the range is shifted by an offset (present in the
instruction being examined) and the offset is negative. The entire range
for the allowable deviation will then be strictly negative. This creates
a problem, since 0 is assumed to be a valid deviation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316601 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove dead function declaration.
Peter Collingbourne [Wed, 25 Oct 2017 17:42:00 +0000 (17:42 +0000)]
Remove dead function declaration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316597 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[cmake] Restrict resource file usage to Windows build hosts
Shoaib Meenai [Wed, 25 Oct 2017 17:11:28 +0000 (17:11 +0000)]
[cmake] Restrict resource file usage to Windows build hosts

Resource file compilation requires a working resource compiler.
Unfortunately, llvm-rc isn't quite there yet [1], and cmake's rc
invocation only works on Windows [2]. Until both those issues are
addressed, disable resource file usage on non-Windows build hosts, to
unblock Windows cross-compilation. This is also consistent with the
existing comment, which says "If *on Windows* and building with MSVC".

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118433.html
[2] https://public.kitware.com/pipermail/cmake/2017-October/066441.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316594 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add avx512vpopcntdq to Knights Mill
Craig Topper [Wed, 25 Oct 2017 17:10:32 +0000 (17:10 +0000)]
[X86] Add avx512vpopcntdq to Knights Mill

As indicated by Table 1-1 in Intel Architecture Instruction Set Extensions and Future Features Programming Reference from October 2017.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316592 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Cleanup memory legalizer load/store tests
Konstantin Zhuravlyov [Wed, 25 Oct 2017 17:04:46 +0000 (17:04 +0000)]
AMDGPU: Cleanup memory legalizer load/store tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316590 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/NFC: Rename memory legalizer tests:
Konstantin Zhuravlyov [Wed, 25 Oct 2017 16:45:28 +0000 (16:45 +0000)]
AMDGPU/NFC: Rename memory legalizer tests:

  - memory-legalizer-atomic-load.ll -> memory-legalizer-load.ll
  - memory-legalizer-atomic-store.ll -> memory-legalizer-store.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316586 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.
Balaram Makam [Wed, 25 Oct 2017 14:55:48 +0000 (14:55 +0000)]
[Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.

Summary: For some irreducible CFG the domtree nodes might be dead, do not update domtree for dead nodes.

Reviewers: kuhar, dberlin, hfinkel

Reviewed By: kuhar

Subscribers: llvm-commits, mcrosier

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316582 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDon't try to use a non-existent header on FreeBSD/mips.
John Baldwin [Wed, 25 Oct 2017 14:53:16 +0000 (14:53 +0000)]
Don't try to use a non-existent header on FreeBSD/mips.

Reviewers: dim

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316581 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd CalledValuePropagation pass
Matthew Simpson [Wed, 25 Oct 2017 13:40:08 +0000 (13:40 +0000)]
Add CalledValuePropagation pass

This patch adds a new pass for attaching !callees metadata to indirect call
sites. The pass propagates values to call sites by performing an IPSCCP-like
analysis using the generic sparse propagation solver. For indirect call sites
having a small set of possible callees, the attached metadata indicates what
those callees are. The metadata can be used to facilitate optimizations like
intersecting the function attributes of the possible callees, refining the call
graph, performing indirect call promotion, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316576 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Clean up some whitespace (NFC).
Simon Dardis [Wed, 25 Oct 2017 13:35:53 +0000 (13:35 +0000)]
[mips] Clean up some whitespace (NFC).

Also test that my email address was updated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316575 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[inlineasm] Fix crash when number of matched input constraint operands overflows...
Daniil Fukalov [Wed, 25 Oct 2017 12:51:32 +0000 (12:51 +0000)]
[inlineasm] Fix crash when number of matched input constraint operands overflows signed char

In a case when number of output constraint operands that has matched input operands
doesn't fit to signed char, TargetLowering::ParseConstraints() can try to access
ConstraintOperands (that is std::vector) with negative index.

Reviewers: rampitec, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316574 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM GlobalISel] Remove redundant testcases. NFC
Diana Picus [Wed, 25 Oct 2017 12:22:21 +0000 (12:22 +0000)]
[ARM GlobalISel] Remove redundant testcases. NFC

Remove the G_FADD testcases from arm-legalizer.mir, they are covered by
arm-legalizer-fp.mir (I probably forgot to delete them when I created
that test).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316573 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM GlobalISel] Update test after r316479. NFC
Diana Picus [Wed, 25 Oct 2017 12:22:16 +0000 (12:22 +0000)]
[ARM GlobalISel] Update test after r316479. NFC

No need to check register classes in the register block anymore, since
we can now much more conveniently check them at their def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316572 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM GlobalISel] Fix call opcodes
Diana Picus [Wed, 25 Oct 2017 11:42:40 +0000 (11:42 +0000)]
[ARM GlobalISel] Fix call opcodes

We were generating BLX for all the calls, which was incorrect in most
cases. Update ARMCallLowering to generate BL for direct calls, and BLX,
BX_CALL or BMOVPCRX_CALL for indirect calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316570 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM GlobalISel] Split test into 3. NFC
Diana Picus [Wed, 25 Oct 2017 11:21:15 +0000 (11:21 +0000)]
[ARM GlobalISel] Split test into 3. NFC

Separate the test cases that deal with calls from the rest of the IR
Translator tests.

We split into 2 different files, one for testing parameter and result
lowering, and one for testing the various different kinds of calls that
can occur (BL, BLX, BX_CALL etc).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316569 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SCEV] Enhance SCEVFindUnsafe for division
Max Kazantsev [Wed, 25 Oct 2017 11:07:43 +0000 (11:07 +0000)]
[SCEV] Enhance SCEVFindUnsafe for division

This patch allows SCEVFindUnsafe algorithm to tread division by any non-positive
value as safe. Previously, it could only recognize non-zero constants.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316568 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-land "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"
Clement Courbet [Wed, 25 Oct 2017 11:02:09 +0000 (11:02 +0000)]
Re-land "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"

Compute the actual decomposition only after deciding whether to expand
of not. Else, it's easy to make the compiler OOM with:
`memcpy(dst, src, 0xffffffffffffffff);`, which typically happens if
someone mistakenly passes a negative value. Add a test.

This reverts commit f8fc02fbd4ab33383c010d33675acf9763d0bd44.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316567 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwarfdump] - Fix array out of bounds access crash.
George Rimar [Wed, 25 Oct 2017 10:23:49 +0000 (10:23 +0000)]
[llvm-dwarfdump] - Fix array out of bounds access crash.

This fixes possible out of bound access in
DWARFDie::getFirstChild()
which might happen when .debug_info section is corrupted,
like shown in testcase.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316566 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] OrCombineToBFI function
Sam Parker [Wed, 25 Oct 2017 08:37:33 +0000 (08:37 +0000)]
[ARM] OrCombineToBFI function

Extract the functionality to combine OR to BFI into its own function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316563 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Swap cmp operands for automatic shifts
Sam Parker [Wed, 25 Oct 2017 08:33:06 +0000 (08:33 +0000)]
[ARM] Swap cmp operands for automatic shifts

Swap the compare operands if the lhs is a shift and the rhs isn't,
as in arm and T2 the shift can be performed by the compare for its
second operand.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316562 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MachineScheduler] Minor refactoring.
Jonas Paulsson [Wed, 25 Oct 2017 08:23:33 +0000 (08:23 +0000)]
[MachineScheduler]  Minor refactoring.

Duplicated code found in three places put into a new static function:

/// Given a Count of resource usage and a Latency value, return true if a
/// SchedBoundary becomes resource limited.
static bool checkResourceLimit(unsigned LFactor, unsigned Count,
                               unsigned Latency) {
  return (int)(Count - (Latency * LFactor)) > (int)LFactor;
}

Review: Florian Hahn, Matthias Braun
https://reviews.llvm.org/D39235

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316560 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Add support for dllimport of values and functions
Martin Storsjo [Wed, 25 Oct 2017 07:25:18 +0000 (07:25 +0000)]
[AArch64] Add support for dllimport of values and functions

Previously, the dllimport attribute did the right thing in terms
of treating it as a pointer to a value, but this makes sure the
names get mangled properly, and calls to such functions load the
function from the __imp_ pointer.

This is based on SVN r212431 and r212430 where the same was
implemented for ARM.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316555 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDAG: Fix creating select with wrong condition type
Matt Arsenault [Wed, 25 Oct 2017 07:14:07 +0000 (07:14 +0000)]
DAG: Fix creating select with wrong condition type

This code added in r297930 assumed that it could create
a select with a condition type that is just an integer
bitcast of the selected type. For AMDGPU any vselect is
going to be scalarized (although the vector types are legal),
and all select conditions must be i1 (the same as getSetCCResultType).

This logic doesn't really make sense to me, but there's
never really been a consistent policy in what the select
condition mask type is supposed to be. Try to extend
the logic for skipping the transform for condition types
that aren't setccs. It doesn't seem quite right to me though,
but checking conditions that seem more sensible (like whether the
vselect is going to be expanded) doesn't work since this
seems to depend on that also.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316554 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Add max-mix-insts subtarget feature
Matt Arsenault [Wed, 25 Oct 2017 07:00:51 +0000 (07:00 +0000)]
AMDGPU: Add max-mix-insts subtarget feature

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316553 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IRCE] Fix intersection between signed and unsigned ranges
Max Kazantsev [Wed, 25 Oct 2017 06:47:39 +0000 (06:47 +0000)]
[IRCE] Fix intersection between signed and unsigned ranges

IRCE for unsigned latch conditions was temporarily disabled by rL314881. The motivating
example contained an unsigned latch condition and a signed range check. One of the safe
iteration ranges was `[1, SINT_MAX + 1]`. Its right border was incorrectly interpreted as a negative
value in `IntersectRange` function, this lead to a miscompile under which we deleted a range check
without inserting a postloop where it was needed.

This patch brings back IRCE for unsigned latch conditions. Now we treat range intersection more
carefully. If the latch condition was unsigned, we only try to consider a range check for deletion if:
1. The range check is also unsigned, or
2. Safe iteration range of the range check lies within `[0, SINT_MAX]`.
The same is done for signed latch.

Values from `[0, SINT_MAX]` are unambiguous, these values are non-negative under any interpretation,
and all values of a range intersected with such range are also non-negative.

We also use signed/unsigned min/max functions for range intersection depending on type of the
latch condition.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316552 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MemDep] DBG intrinsics don't impact abort limit for call site dependence analysis
Mikael Holmen [Wed, 25 Oct 2017 06:15:32 +0000 (06:15 +0000)]
[MemDep] DBG intrinsics don't impact abort limit for call site dependence analysis

Summary:
Memory dependence analysis no longer counts DbgInfoIntrinsics towards the
limit where to abort the analysis. Before, a bunch of calls to dbg.value
could affect the generated code, meaning that with -g we could generate
different code than without.

Reviewers: chandlerc, Prazek, davide, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316551 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IRCE] Smarter detection of empty ranges using SCEV
Max Kazantsev [Wed, 25 Oct 2017 06:10:02 +0000 (06:10 +0000)]
[IRCE] Smarter detection of empty ranges using SCEV

For a SCEV range, this patch replaces the naive emptiness check for SCEV ranges
which looks like `Begin == End` with a SCEV check. The range is guaranteed to be
empty of `Begin >= End`. We should filter such ranges out and do not try to perform
IRCE for them.

For example, we can get such range when intersecting range `[A, B)` and `[C, D)`
where `A < B < C < D`. The resulting range is `[max(A, C), min(B, D)) = [C, B)`.
This range is empty, but its `Begin` does not match with `End`.

Making IRCE for an empty range is basically safe but unprofitable because we
never actually get into the main loop where the range checks are supposed to
be eliminated. This patch uses SCEV mechanisms to treat loops with proved
`Begin >= End` as empty.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316550 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAssembly tests require x86 target.
Peter Collingbourne [Wed, 25 Oct 2017 04:24:20 +0000 (04:24 +0000)]
Assembly tests require x86 target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316546 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ThinLTO] Make test for promoted names more specific
Teresa Johnson [Wed, 25 Oct 2017 03:41:31 +0000 (03:41 +0000)]
[ThinLTO] Make test for promoted names more specific

With r314527, promoted values get a suffix that is a decimal value of
the module hash instead of hex. Change the regex to match only decimal
suffix values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316544 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agollvm-readobj: Add support for reading relocations in the Android packed format.
Peter Collingbourne [Wed, 25 Oct 2017 03:37:12 +0000 (03:37 +0000)]
llvm-readobj: Add support for reading relocations in the Android packed format.

This is in preparation for testing lld's upcoming relocation packing
feature (D39152). I have verified that this implementation correctly
unpacks the relocations from a Chromium DSO built with gold and the
Android relocation packer for ARM32 and ARM64.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316543 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCheck special-case-list regex before insertion.
Mitch Phillips [Tue, 24 Oct 2017 23:56:12 +0000 (23:56 +0000)]
Check special-case-list regex before insertion.

Summary:
Checks that the supplied regex to SpecialCaseList::Matcher::insert(..) is non-empty.

Reported by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3688

Verified that this fixes the provided assertion failure (built with {asan, fuzzer}):
```
mitchp@mitchp2:~/llvm-build/git-fuzz$ ninja llvm-special-case-list-fuzzer[12/12] Linking CXX executable bin/llvm-special-case-list-fuzzer
mitchp@mitchp2:~/llvm-build/git-fuzz$ bin/llvm-special-case-list-fuzzer ~/Downloads/clusterfuzz-testcase-6748633157337088
INFO: Seed: 1697404507
INFO: Loaded 1 modules   (18581 inline 8-bit counters): 18581 [0x9e9f60, 0x9ee7f5),
INFO: Loaded 1 PC tables (18581 PCs): 18581 [0x9ee7f8,0xa37148),
bin/llvm-special-case-list-fuzzer: Running 1 inputs 1 time(s) each.
Running: /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088
Executed /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088 in 0 ms
***
*** NOTE: fuzzing was not performed, you have only
***       executed the target code on a fixed set of inputs.
***
mitchp@mitchp2:~/llvm-build/git-fuzz$

```

Reviewers: kcc, vsk

Reviewed By: vsk

Subscribers: vsk, llvm-commits, vlad.tsyrklevich

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316537 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoImplement salavageDebugInfo functionality for SelectionDAG.
Adrian Prantl [Tue, 24 Oct 2017 22:55:12 +0000 (22:55 +0000)]
Implement salavageDebugInfo functionality for SelectionDAG.

Similar to how llvm::salvagDebugInfo hooks into InstCombine, this adds
a hook that can be invoked before an SDNode that is associated with an
SDDbgValue is erased to capture the effect of the deleted node in a
DIExpression.

The motivating example is an SDDebugValue attached to an ADD operation
that gets folded into a LOAD+OFFSET operation.

rdar://problem/32121503

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316525 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd Triple::isOSUnknown
Sam Clegg [Tue, 24 Oct 2017 22:48:19 +0000 (22:48 +0000)]
Add Triple::isOSUnknown

Subscribers: aheejin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316524 91177308-0d34-0410-b5e6-96231b3b80d8