153836 Commits

Author SHA1 Message Date
Andrew V. Tischenko
384007e569 The current version of LLVM X86 disassembler incorrectly interprets some possible sets of x86 prefixes. This patch is the first step to close PR7709 and PR17697. There will be next patch(es) to close relative PRs.
Differential Revision: https://reviews.llvm.org/D36788

M    lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
M    lib/Target/X86/Disassembler/X86DisassemblerDecoder.h
A    test/MC/Disassembler/X86/prefixes-i386.s
A    test/MC/Disassembler/X86/prefixes-x86_64.s
M    test/MC/Disassembler/X86/prefixes.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311882 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 10:43:14 +00:00
Gadi Haber
b123fd02f9 [X86][Haswell] Updating HSW instruction scheduling information
This patch completely replaces the instruction scheduling information for the Haswell architecture target by modifying the file X86SchedHaswell.td located under the X86 Target.
We used the scheduling information retrieved from the Haswell architects in order to replace and modify the existing scheduling.
The patch continues the scheduling replacement effort started with the SNB target in r307529 and r310792.
Information includes latency, number of micro-Ops and used ports by each HSW instruction.

Please expect some performance fluctuations due to code alignment effects.

Reviewers: RKSimon, zvi, aymanmus, craig.topper, m_zuckerman, igorb, dim, chandlerc, aaboud

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311879 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 10:04:16 +00:00
NAKAMURA Takumi
d60caed503 Prune whitespaces in blank lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 07:48:37 +00:00
NAKAMURA Takumi
ef15f2cc89 Untabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 06:47:47 +00:00
Craig Topper
038b487112 [X86] Use getUnpackl helper to create an ISD::VECTOR_SHUFFLE instead of using X86ISD::UNPCKL in reduceVMULWidth.
This runs fairly early, we should use target independent nodes if possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 05:14:38 +00:00
Craig Topper
5aa44202c0 [X86] Add an early out to combineLoopMAddPattern and combineLoopSADPattern when SSE2 is disabled.
Without this the madd.ll and sad.ll test cases both throw assertions if you run them with SSE2 disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 04:29:08 +00:00
Lang Hames
68a7b2d85a [Error] Add a handleExpected utility.
handleExpected is similar to handleErrors, but takes an Expected<T> as its first
input value and a fallback functor as its second, followed by an arbitary list
of error handlers (equivalent to the handler list of handleErrors). If the first
input value is a success value then it is returned from handleErrors
unmodified. Otherwise the contained error(s) are passed to handleErrors, along
with the handlers. If handleErrors returns success (indicating that all errors
have been handled) then handleExpected runs the fallback functor and returns its
result. If handleErrors returns a failure value then the failure value is
returned and the fallback functor is never run.

This simplifies the process of re-trying operations that return Expected values.
Without this utility such retry logic is cumbersome as the internal Error must
be explicitly extracted from the Expected value, inspected to see if its
handleable and then consumed:

enum FooStrategy { Aggressive, Conservative };
Expected<Foo> tryFoo(FooStrategy S);

Expected<Foo> Result;
(void)!!Result; // "Check" Result so that it can be safely overwritten.
if (auto ValOrErr = tryFoo(Aggressive))
  Result = std::move(ValOrErr);
else {
  auto Err = ValOrErr.takeError();
  if (Err.isA<HandleableError>()) {
    consumeError(std::move(Err));
    Result = tryFoo(Conservative);
  } else
    return std::move(Err);
}

with handleExpected, this can be re-written as:

auto Result =
  handleExpected(
    tryFoo(Aggressive),
    []() { return tryFoo(Conservative); },
    [](HandleableError&) { /* discard to handle */ });



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 03:36:46 +00:00
Dehao Chen
3607b8f0f2 revert r310985 which breaks for the following case:
struct string {
  ~string();
};
void f2();
void f1(int) { f2(); }
void run(int c) {
  string body;
  while (true) {
    if (c)
      f1(c);
    else
      f1(c);
  }
}

Will recommit once the issue is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 22:22:39 +00:00
Petar Jovanovic
8679b1f292 [mips] Generate NMADD and NMSUB instructions when fneg node is present
This patch enables generation of NMADD and NMSUB instructions when fneg node
is present. These instructions are currently only generated if fsub node is
present.

Patch by Stanislav Ocovaj.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311862 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 21:07:24 +00:00
Javed Absar
3009eea8bb [ARM] Tidy-up condition-code support functions
Move condition code support functions to Utils and remove code duplication.

Reviewed by: @fhahn, @asb
Differential Revision: https://reviews.llvm.org/D37179



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 20:38:28 +00:00
Craig Topper
af63a49b5d [AVX512] Add more patterns for using masked moves for subvector extracts of the lowest subvector. This time with bitcasts between the vselect and the extract.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 19:03:36 +00:00
Sanjay Patel
3d4355f5e5 [DAGCombiner] allow undef shuffle operands when eliminating bitcasts (PR34111)
As noted in the FIXME, this could be improved more, but this is the smallest fix
that helps:
https://bugs.llvm.org/show_bug.cgi?id=34111


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 17:29:30 +00:00
Sanjay Patel
0ba3b8e232 [x86] add haddps test for PR34111; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311852 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 17:15:49 +00:00
Javed Absar
75f84acf16 [ARM] Tidy-up ARMAsmParser. NFC.
Simplify getDRegFromQReg function

Reviewed by: @fhahn, @asb
Differential Revision: https://reviews.llvm.org/D37118



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 14:46:57 +00:00
Ayal Zaks
a183d6cf2a [LV] Fix PR34248 - recommit D32871 after revert r311304
Original commit r311077 of D32871 was reverted in r311304 due to failures
reported in PR34248.

This recommit fixes PR34248 by restricting the packing of predicated scalars
into vectors only when vectorizing, avoiding doing so when unrolling w/o
vectorizing. Added a test derived from the reproducer of PR34248.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 12:55:46 +00:00
Jatin Bhateja
6e17a3e9db [X86] Adding more tests for horizontal [F]HADD/[F]SUB for AVX512 vectors types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311847 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 12:43:25 +00:00
Craig Topper
395cdbc9b5 [X86] Add a target-specific DAG combine to combine extract_subvector from all zero/one build_vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 05:39:57 +00:00
Craig Topper
523f16bcdc [X86] Use getOnesVector instead of using DAG.getConstant(-1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27 03:26:04 +00:00
Davide Italiano
ba48d7b486 [NewGVN] Use auto when the type is obvious NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311838 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 22:31:10 +00:00
Craig Topper
2368d9f73d [AVX512] Add patterns to match masked extract_subvector with bitcasts between the vselect and the extract_subvector. Remove the late DAG combine.
We used to do a late DAG combine to move the bitcasts out of the way, but I'm starting to think that it's better to canonicalize extract_subvector's type to match the type of its input. I've seen some cases where we've formed two different extract_subvector from the same node where one had a bitcast and the other didn't.

Add some more test cases to ensure we've also got most of the zero masking covered too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311837 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 22:24:57 +00:00
Don Hinton
1adb5a9cb5 [Dominators] Remove redundant explicit template instantiation.
Summary:
Remove redundant explicit template instantiation.

This was reported by Andrew Kelley building release_50 with gcc7.2.0 on MacOS: duplicate symbol llvm::DominatorTreeBase.

Reviewers: kuhar, andrewrk, davide, hans

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311835 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 21:08:51 +00:00
Jatin Bhateja
4b94f747ff [X86] Adding a test for horizontal [f]add/[f]sub for avx512 vector type 16x32.
Differential Revision: https://reviews.llvm.org/D37183

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311834 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 19:02:49 +00:00
Jatin Bhateja
9d2ff1a85a [DAGCombiner] Extending pattern detection for vector shuffle.
Summary:
If all the operands of a BUILD_VECTOR extract elements from same vector then split the
vector efficiently based on the maximum vector access index.

This will also fix PR 33784

Reviewers: zvi, delena, RKSimon, thakis

Reviewed By: RKSimon

Subscribers: chandlerc, eladcohen, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 19:02:36 +00:00
Jatin Bhateja
afa978fffd Revert rL311247 : To rectify commit message.
Summary: This reverts commit rL311247.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 19:02:17 +00:00
Daniel Berlin
7824530ee0 NewGVN: Fix PR33204 - We need to add memory users when we bypass memorydefs for loads, not just when we do it for stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311829 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 07:37:11 +00:00
Craig Topper
a490e81d57 [X86] Qualify the RMW INC/DEC patterns with NotSlowIncDec.
We were suppressing most uses of INC/DEC, but this one seems to have been missed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311828 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 06:24:25 +00:00
Petr Hosek
67092e6ede Revert "[llvm] Add symbol table support to llvm-objcopy"
This reverts commit r311826 because it's failing on llvm-i686-linux-RA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311827 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 03:22:25 +00:00
Petr Hosek
087e2cd838 [llvm] Add symbol table support to llvm-objcopy
This change adds support for SHT_SYMTAB sections.

Patch by Jake Ehrlich

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311826 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 03:18:41 +00:00
Petr Hosek
7a0f013908 [llvm-objcopy] New layout algorithm that lays out segments first
The current file layout algorithm in llvm-objcopy is simple but
difficult to reason about. It also makes it very complicated to support
nested segments and to support segments that have offsets that come
before a point after the program headers. To support these cases and
simplify one of the most critical parts llvm-objcopy I rewrote the
layout algorithm. Laying out segments first solves most of the issues
encountered by the previous algorithm.

Patch by Jake Ehrlich

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311825 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 01:32:20 +00:00
Hiroshi Yamauchi
1020c414d8 Add options to dump block frequency/branch probability info in text.
Summary:
Add options -print-bfi/-print-bpi that dump block frequency and branch
probability info like -view-block-freq-propagation-dags and
-view-machine-block-freq-propagation-dags do but in text.

This is useful when the graph is very large and complex (the dot command
crashes, lines/edges too close to tell apart, hard to navigate without textual
search) or simply when text is preferred.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311822 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-26 00:31:00 +00:00
Craig Topper
69d4710ed0 [AVX512] Add patterns to use masked moves to implement masked extract_subvector of the lowest subvector.
This only supports 32 and 64 bit element sizes for now. But we could probably do 16 and 8-bit elements with BWI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311821 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 23:34:59 +00:00
Craig Topper
e0707b12d1 [AVX512] Add additional test cases for masked extract subvector.
This includes tests for extracting 128-bits from a 256-bit vector and zero masking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311820 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 23:34:57 +00:00
Craig Topper
cb02fcfc43 [X86] Add patterns to show more failures to use TBM instructions when we're trying to check flags.
We can probably add patterns to fix some of them. But the ones that use 'and' as their root node emit a X86ISD::CMP node in front of the 'and' and then pattern matching that to 'test' instruction. We can't use a tablegen pattern to fix that because we can't remap the cmp result to the flag output of a TBM instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311819 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 23:34:55 +00:00
Chandler Carruth
ac54edee6f [x86] Teach the backend to fold more read-modify-write memory operands
to instructions.

These can't be reasonably matched in tablegen due to the handling of
flags, so we have to do this in C++ code. We only did it for `inc` and
`dec` historically, this starts fleshing that out to more interesting
instructions. Notably, this handles transfering operands to `add` and
`sub`.

Currently this forces them into a register. The next patch will add
support for keeping immediate operands as immediates. Then I'll extend
this beyond just `add` and `sub`.

I'm not super thrilled by the repeated switches in the code but
everything else I tried was really ugly or problematic.

Many thanks to Craig Topper for the suggestions about where to even
begin here and how to make this stuff work.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311806 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 22:50:52 +00:00
Davide Italiano
5cf0f4679c [Verifier] Diagnose invalid DIType references instead of crashing.
Fixes PR34325.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311805 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 22:08:15 +00:00
Davide Italiano
ce5cab1140 [Inliner] Only compute fully inline cost when remarks are enabled.
Prior to this change (and after r311371), we computed it
unconditionally, causin gsevere compile time regressions (in some
cases, 5 to 10x).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 22:01:42 +00:00
Matt Morehouse
cd698b8c34 Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
This reverts r311801 due to a bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311803 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 22:01:21 +00:00
Matt Morehouse
8d5696051c [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311801 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 21:18:29 +00:00
Sanjay Patel
34ce329ff4 [utils] add aarch64 target as an option
I don't know enough to add a custom scrubber for AArch64, so I just re-used ARM.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 19:33:18 +00:00
Kostya Serebryany
df54667cf4 [sanitizer-coverage] extend fsanitize-coverage=pc-table with flags for every PC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311794 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 19:29:47 +00:00
Sanjay Patel
0588b413e4 [x86] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311793 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 19:25:03 +00:00
Haicheng Wu
33be26f893 [InlineCost] Small changes to early exit condition. NFC.
Change the early exit condition from Cost > Threshold to Cost >= Threshold
because the inline condition is Cost < Threshold.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311791 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 19:00:33 +00:00
Craig Topper
ef9c2d804e [InstCombine] Don't fall back to only calling computeKnownBits if the upper bit of Add/Sub is demanded.
Just create an all 1s demanded mask and continue recursing like normal. The recursive calls should be able to handle an all 1s mask and do the right thing.

The only time we should care about knowing whether the upper bit was demanded is when we need to know if we should clear the NSW/NUW flags.

Now that we have a consistent path through the code for all cases, use KnownBits::computeForAddSub to compute the known bits at the end since we already have the LHS and RHS.

My larger goal here is to move the code that turns add into xor if only 1 bit is demanded and no bits below it are non-zero from InstCombiner::OptAndOp to here. This will allow it to be more general instead of just looking for 'add' and 'and' with constant RHS.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311789 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 18:39:40 +00:00
Craig Topper
3ec9576f37 [InstCombine] Add tests to show missed opportunities to combine bit tests hidden by a sign compare and a truncate. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 17:14:35 +00:00
Florian Hahn
f360477df5 [LoopInterchange] Skip zext instructions when looking for induction var.
Summary:
SimplifyIndVar may introduce zext instructions to widen arguments of the
loop exit check. They should not prevent us from splitting the loop at
the induction variable, but maybe the check should be more conservative,
e.g. making sure it only extends arguments used by a comparison?

Reviewers: karthikthecool, mcrosier, mzolotukhin

Reviewed By: mcrosier

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311783 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 16:52:29 +00:00
David Blaikie
7cd5c43854 Fix unused-lambda-capture warning by using default capture-by-ref
Since the lambda isn't escaped (via a std::function or similar) it's
fine/better to use default capture-by-ref to provide semantics similar
to language-level nested scopes (if/for/while/etc).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311782 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 16:46:07 +00:00
Matt Morehouse
2cfe1040ad Fix buildbot breakage from r311763. Remove unused lambda capture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 16:19:26 +00:00
David Green
6e7a4adfcf [gold] Fix up a new test to allow it to pass on non x86 builds.
Fix a test that is failing on a downstream ARM/AArch64
bootstrap. We just need add an elf_x86_64 parameter to
gold.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311780 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 16:14:56 +00:00
Michael Kruse
f29303de23 Normlize to LF line endings.
Commit r297442 introduced mixed CRLF/LF line endings to two files.
Normalize to to LF-only line endings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311774 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 12:38:53 +00:00
Amjad Aboud
513af851dd [InstCombine] Consider more cases where SimplifyDemandedUseBits does not convert AShr to LShr.
There are cases where AShr have better chance to be optimized than LShr, especially when the demanded bits are not known to be Zero, and also known to be similar to the sign bit.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311773 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 11:07:54 +00:00