platform/upstream/llvm.git
6 years ago[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisit...
Henry Wong [Mon, 23 Apr 2018 14:41:17 +0000 (14:41 +0000)]
[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisitors.h`.

Summary: `TaintBugVisitor` is a universal visitor, and many checkers rely on it, such as `ArrayBoundCheckerV2.cpp`, `DivZeroChecker.cpp` and `VLASizeChecker.cpp`. Moving `TaintBugVisitor` to `BugReporterVisitors.h` enables other checker can also track where `tainted` value came from.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC

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

llvm-svn: 330596

6 years ago[index] Fix methods that take a shared_ptr to just take a reference.
Benjamin Kramer [Mon, 23 Apr 2018 14:30:21 +0000 (14:30 +0000)]
[index] Fix methods that take a shared_ptr to just take a reference.

There is no ownership here, passing a shared_ptr just adds confusion. No
functionality change intended.

llvm-svn: 330595

6 years ago[LLVM-C] DIBuilderBindings for Subrange and Arrays
Robert Widmann [Mon, 23 Apr 2018 14:29:33 +0000 (14:29 +0000)]
[LLVM-C] DIBuilderBindings for Subrange and Arrays

Summary: Move Go bindings for subranges and DINode arrays.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 330594

6 years agoSort a target list a bit better.
Nico Weber [Mon, 23 Apr 2018 14:28:49 +0000 (14:28 +0000)]
Sort a target list a bit better.

llvm-svn: 330593

6 years ago[DEBUGINFO, NVPTX] Add the test for the debug info of the local
Alexey Bataev [Mon, 23 Apr 2018 14:00:53 +0000 (14:00 +0000)]
[DEBUGINFO, NVPTX] Add the test for the debug info of the local
variables, NFC.

llvm-svn: 330592

6 years ago[LLVM-C] Finish Up Scope Bindings
Robert Widmann [Mon, 23 Apr 2018 13:51:43 +0000 (13:51 +0000)]
[LLVM-C] Finish Up Scope Bindings

Summary: Adds bindings for Module and NameSpace scopes and LLVMDIBuilderCreateForwardDecl, a counterpart to LLVMDIBuilderCreateReplaceableCompositeType.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 330591

6 years ago[doc] Removed obsolete -count-aa from AliasAnalysis documentation
Marianne Mailhot-Sarrasin [Mon, 23 Apr 2018 13:45:28 +0000 (13:45 +0000)]
[doc] Removed obsolete -count-aa from AliasAnalysis documentation

Summary:
This patch removes references to AliasAnalysisCounter pass from the AliasAnalysis documentation. That pass have been eliminated in 2015, at revision trunk@247167.

Reviewed By: hfinkel

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

llvm-svn: 330590

6 years ago[analyzer] CStringChecker.cpp - Code refactoring on bug report.
Henry Wong [Mon, 23 Apr 2018 13:36:51 +0000 (13:36 +0000)]
[analyzer] CStringChecker.cpp - Code refactoring on bug report.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

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

llvm-svn: 330589

6 years ago[X86] Remove instregex matching from CLAC/STAC.
Simon Pilgrim [Mon, 23 Apr 2018 13:24:17 +0000 (13:24 +0000)]
[X86] Remove instregex matching from CLAC/STAC.

Note - noticed this as the STAC case as it was unintentionally matching against *STACK* pseudo instructions.

llvm-svn: 330588

6 years agoList cpp file only once (was added in 147117 and 147117 as build fix each).
Nico Weber [Mon, 23 Apr 2018 13:11:51 +0000 (13:11 +0000)]
List cpp file only once (was added in 147117 and 147117 as build fix each).

llvm-svn: 330587

6 years agoAMDGPU: Fix SDWA peephole for V_AND_B32
Nicolai Haehnle [Mon, 23 Apr 2018 13:06:03 +0000 (13:06 +0000)]
AMDGPU: Fix SDWA peephole for V_AND_B32

Summary:
Found by inspection. We care about the operand that *doesn't*
contain the immediate.

I believe this is currently not hit because we fold 0xff / 0xffff
immediates only later.

Change-Id: Ic3cf8538bc7da5eff3200d96eccf9d339e6345a7

Reviewers: arsenm, rampitec

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

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

llvm-svn: 330586

6 years agoAMDGPU: Fix a corner case crash in SIOptimizeExecMasking
Nicolai Haehnle [Mon, 23 Apr 2018 13:05:50 +0000 (13:05 +0000)]
AMDGPU: Fix a corner case crash in SIOptimizeExecMasking

Summary:
See the new test case; this is really unlikely to happen with real code,
but I ran into this while attempting to bugpoint-reduce a different issue.

Change-Id: I9ade1dc1aa8fd9c4d9fc83661d7b80e310b5c4a6

Reviewers: arsenm, rampitec

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

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

llvm-svn: 330585

6 years agoConsistently sort add_subdirectory calls in lib/Target/*/CMakeLists.txt
Nico Weber [Mon, 23 Apr 2018 12:49:34 +0000 (12:49 +0000)]
Consistently sort add_subdirectory calls in lib/Target/*/CMakeLists.txt

llvm-svn: 330584

6 years ago[AArch64][SVE] Asm: Support for contiguous, non-faulting LDNF1 (scalar+imm) load...
Sander de Smalen [Mon, 23 Apr 2018 12:43:19 +0000 (12:43 +0000)]
[AArch64][SVE] Asm: Support for contiguous, non-faulting LDNF1 (scalar+imm) load instructions

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: rengolin

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330583

6 years ago[LoopRotate] Fix incorrect SCEV invalidation in loop rotation
Max Kazantsev [Mon, 23 Apr 2018 12:33:31 +0000 (12:33 +0000)]
[LoopRotate] Fix incorrect SCEV invalidation in loop rotation

LoopRotate only invalidates innermost loops while the changes that it makes may
also affert any of this parents. With patch rL329047, SCEV becomes much smarter
about calculation of exit counts for outer loops, so we cannot assume that they are
not affected.

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

llvm-svn: 330582

6 years ago[X86] Remove unnecessary MMX reg-mem InstRW scheduler overrides.
Simon Pilgrim [Mon, 23 Apr 2018 11:57:15 +0000 (11:57 +0000)]
[X86] Remove unnecessary MMX reg-mem InstRW scheduler overrides.

llvm-svn: 330581

6 years agoFix tests after changes to clang-format in r330573.
Manuel Klimek [Mon, 23 Apr 2018 11:47:59 +0000 (11:47 +0000)]
Fix tests after changes to clang-format in r330573.

We do now both:
- stop reformatting a sequence after a closing brace in more cases, in
  order to not misindent after an incorrect closing brace
- format the closing brace when formatting the line containing the
  opening brace

llvm-svn: 330580

6 years ago[OpenCL] Reject virtual functions for OpenCL C++
Sven van Haastregt [Mon, 23 Apr 2018 11:23:47 +0000 (11:23 +0000)]
[OpenCL] Reject virtual functions for OpenCL C++

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

llvm-svn: 330579

6 years agollgs-tests: Increase packet time out
Pavel Labath [Mon, 23 Apr 2018 11:22:44 +0000 (11:22 +0000)]
llgs-tests: Increase packet time out

The default packet timeout of 1 second is a bit too small for these
tests, particularly as they are working in ack-mode, which means they
need to fit twice as many packets into the timeslot.

This does not seem to be a problem on the bots, but for some people
these tests are timing out regularly. I can't be sure increasing this
will solve their problem, but this does seem like a likely culprit.

llvm-svn: 330578

6 years ago[LoopUnroll] Fix potentially incorrect SCEV invalidation in UnrollRuntime
Max Kazantsev [Mon, 23 Apr 2018 10:39:38 +0000 (10:39 +0000)]
[LoopUnroll] Fix potentially incorrect SCEV invalidation in UnrollRuntime

Current runtime unrolling invalidates parent loop saying that it might have changed
after the inner loop has changed, but it doesn't bother to do the same to its parents.
With patch rL329047, SCEV becomes much smarter about calculation of exit counts for
outer loops. We might need to invalidate not only the immediate parent, but also
any of its parents as well.

There is no clear evidence that there is some miscompile happening because of this
(at least I don't have such test), but the common sense says that the current code
is wrong.

Differential Revision: https://reviews.llvm.org/D45940
Reviewed By: chandlerc

llvm-svn: 330577

6 years ago[LoopSimplify] Fix incorrect SCEV invalidation
Max Kazantsev [Mon, 23 Apr 2018 10:32:37 +0000 (10:32 +0000)]
[LoopSimplify] Fix incorrect SCEV invalidation

In the function `simplifyOneLoop` we optimistically assume that changes in the
inner loop only affect this very loop and have no impact on its parents. In fact,
after rL329047 has been merged, we can now calculate exit counts for outer
loops which may depend on inner loops. Thus, we need to invalidate all parents
when we do something to a loop.

There is an evidence of incorrect behavior of `simplifyOneLoop`: when we insert
`SE->verify()` check in the end of this funciton, it fails on a bunch of existing
test, in particular:

    LLVM :: Transforms/LoopUnroll/peel-loop-not-forced.ll
    LLVM :: Transforms/LoopUnroll/peel-loop-pgo.ll
    LLVM :: Transforms/LoopUnroll/peel-loop.ll
    LLVM :: Transforms/LoopUnroll/peel-loop2.ll

Note that previously we have fixed issues of this variety, see rL328483.
This patch makes this function invalidate the outermost loop properly.

Differential Revision: https://reviews.llvm.org/D45937
Reviewed By: chandlerc

llvm-svn: 330576

6 years ago[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident
Mikhail Maltsev [Mon, 23 Apr 2018 10:08:46 +0000 (10:08 +0000)]
[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident

The test case in the original patch was overly contrained and
failed on PPC targets.

llvm-svn: 330575

6 years ago[clang-format] Fix clang-tidy readability problems, NFCI
Krasimir Georgiev [Mon, 23 Apr 2018 10:02:59 +0000 (10:02 +0000)]
[clang-format] Fix clang-tidy readability problems, NFCI

llvm-svn: 330574

6 years agoFormat closing braces when reformatting the line containing the opening brace.
Manuel Klimek [Mon, 23 Apr 2018 09:34:26 +0000 (09:34 +0000)]
Format closing braces when reformatting the line containing the opening brace.

This required a couple of yaks to be shaved:
1. MatchingOpeningBlockLineIndex was misused to also store the
   closing index; instead, use a second variable, as this doesn't
   work correctly for "} else {".
2. We needed to change the API of AffectedRangeManager to not
   use iterators; we always passed in begin / end for the whole
   container before, so there was no mismatch in generality.
3. We need an extra check to discontinue formatting at the top
   level, as we now sometimes change the indent of the closing
   brace, but want to bail out immediately afterwards, for
   example:
     void f() {
       if (a) {
     }
     void g();
   Previously:
     void f() {
       if (a) {
     }
     void g();
   Now:
     void f() {
       if (a) {
       }
     void g();

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

llvm-svn: 330573

6 years ago[Solaris] __float128 is supported on Solaris/x86
Rainer Orth [Mon, 23 Apr 2018 09:28:08 +0000 (09:28 +0000)]
[Solaris] __float128 is supported on Solaris/x86

When rebasing https://reviews.llvm.org/D40898 with GCC 5.4 on Solaris 11.4, I ran
into a few instances of

In file included from /vol/llvm/src/compiler-rt/local/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc:19:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/string:40:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:64:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_pair.h:59:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/move.h:57:
/usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/type_traits:311:39: error: __float128 is not supported on this target

  struct __is_floating_point_helper<__float128>
                                    ^

during make check-all.  The line above is inside

#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)

  template<>
    struct __is_floating_point_helper<__float128>
    : public true_type { };

#endif

While the libstdc++ header indicates support for __float128, clang does not, but
should.  The following patch implements this and fixed those errors.

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

llvm-svn: 330572

6 years agoUse special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEna...
Andrew V. Tischenko [Mon, 23 Apr 2018 09:22:30 +0000 (09:22 +0000)]
Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature.
Differential Revision: https://reviews.llvm.org/D45619

llvm-svn: 330571

6 years agoFix BNF nits in TableGen language reference.
Simon Tatham [Mon, 23 Apr 2018 09:15:47 +0000 (09:15 +0000)]
Fix BNF nits in TableGen language reference.

Summary:
In the course of writing an experimental ANTLR grammar based on this
document, I found three errors in the documented BNF:

SimpleValues of dag type are allowed to have no operands at all after
the initial DagArg specifying the operator. For example, the value
(outs) is extremely common in backends; an example in the test suite
is test/TableGen/AsmVariant.td line 30. But the BNF doesn't allow
DagArgList to expand to the empty string (it must contain at least one
DagArg), and therefore the DagArgList specifying the operands in the
dag-shaped production for SimpleValue should be optional.

In the production for BodyItem with a 'let' and an optional RangeList,
the RangeList should have braces around it if it's present, matching
code such as "let E{7-0} = ..." on test/TableGen/BitsInit.td line 42.
Those braces aren't included in the RangeList nonterminal itself, so
instead they need to be part of the optional segment of the BodyItem
production.

Finally, the identifier after 'defm' should be optional. Again, this
is very common in the real back end .td files; an example in the test
suite is in test/TableGen/defmclass.td line 49.

Reviewers: rengolin, nhaehnle, stoklund

Reviewed By: nhaehnle

Subscribers: llvm-commits

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

llvm-svn: 330570

6 years agoRevert "[clang-format] Improve Incomplete detection for (text) protos"
Krasimir Georgiev [Mon, 23 Apr 2018 08:50:36 +0000 (08:50 +0000)]
Revert "[clang-format] Improve Incomplete detection for (text) protos"

This reverts commit r330016.
The incomplete detection has too many false positives, picking up typos
for hard failures and refusing to format anything in that case.

llvm-svn: 330569

6 years ago[CMake] Gate 'dsymutil' dependency
Jonas Devlieghere [Mon, 23 Apr 2018 08:44:06 +0000 (08:44 +0000)]
[CMake] Gate 'dsymutil' dependency

Only add `dsymutil` as a test dependency when this is not a stand-alone
build (LLDB_BUILT_STANDALONE).

llvm-svn: 330568

6 years agoTest commit access.
Simon Tatham [Mon, 23 Apr 2018 08:41:53 +0000 (08:41 +0000)]
Test commit access.

Should be a harmless trimming of trailing whitespace from a
documentation file.

(There are other instances of trailing whitespace in this file alone.
I've only fixed one of them, on the basis that that way the rest are
still available for other people's commit-access tests :-)

llvm-svn: 330567

6 years ago[Atomics] warn about atomic accesses using libcalls
Tim Northover [Mon, 23 Apr 2018 08:16:24 +0000 (08:16 +0000)]
[Atomics] warn about atomic accesses using libcalls

If an atomic variable is misaligned (and that suspicion is why Clang emits
libcalls at all) the runtime support library will have to use a lock to safely
access it, with potentially very bad performance consequences. There's a very
good chance this is unintentional so it makes sense to issue a warning.

Also give it a named group so people can promote it to an error, or disable it
if they really don't care.

llvm-svn: 330566

6 years ago[AArch64][SVE] Asm: Support for structured ST2, ST3 and ST4 (scalar+imm) store instru...
Sander de Smalen [Mon, 23 Apr 2018 07:50:35 +0000 (07:50 +0000)]
[AArch64][SVE] Asm: Support for structured ST2, ST3 and ST4 (scalar+imm) store instructions.

Reviewers: fhahn, rengolin, javed.absar, SjoerdMeijer, t.p.northover, echristo, evandro, huntergr

Reviewed By: rengolin

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330565

6 years ago[PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.
Chandler Carruth [Mon, 23 Apr 2018 06:58:36 +0000 (06:58 +0000)]
[PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.

The condition this was asserting doesn't actually hold. I've added
comments to explain why, removed the assert, and added a fun test case
reduced out of 403.gcc.

llvm-svn: 330564

6 years ago[X86] Add VEX_WIG to VEX encoded version of VCMPPSY/VCMPPDY.
Craig Topper [Mon, 23 Apr 2018 04:50:01 +0000 (04:50 +0000)]
[X86] Add VEX_WIG to VEX encoded version of VCMPPSY/VCMPPDY.

llvm-svn: 330563

6 years agoupdate readability-identifier-naming-objc test to use interface ivar. Implementation...
Yan Zhang [Mon, 23 Apr 2018 01:05:02 +0000 (01:05 +0000)]
update readability-identifier-naming-objc test to use interface ivar. Implementation ivars are not supported in 32-bits OS.

Reviewers: alexfh, chandlerc

Subscribers: klimek, cfe-commits

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

llvm-svn: 330562

6 years ago[XRay] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Mon, 23 Apr 2018 00:49:25 +0000 (00:49 +0000)]
[XRay] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

llvm-svn: 330561

6 years ago[PM/LoopUnswitch] Fix comment typo. NFC.
Chandler Carruth [Mon, 23 Apr 2018 00:48:42 +0000 (00:48 +0000)]
[PM/LoopUnswitch] Fix comment typo. NFC.

llvm-svn: 330560

6 years agoupdate test to use ivar in implementation instead of class extension
Yan Zhang [Mon, 23 Apr 2018 00:15:15 +0000 (00:15 +0000)]
update test to use ivar in implementation instead of class extension

Summary: using ivar in class extension is not supported in 32-bit architecture of MacOS.

Reviewers: alexfh, hokein

Reviewed By: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 330559

6 years ago[X86][Znver1] Remove unnecessary BMI1 ANDN InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 21:37:08 +0000 (21:37 +0000)]
[X86][Znver1] Remove unnecessary BMI1 ANDN InstRW overrides.

llvm-svn: 330558

6 years ago[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677
Jonathan Coe [Sun, 22 Apr 2018 20:51:05 +0000 (20:51 +0000)]
[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677

Summary:
In cindex.py, Cursor.result_type called into the wrong libclang
function, causing cursors for ObjC method declarations to return invalid
result types. Fixes Bug 36677.

Reviewers: jbcoe, rsmith

Reviewed By: jbcoe

Subscribers: cfe-commits, llvm-commits

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

Patch by kjteske (Kyle Teske).

llvm-svn: 330557

6 years ago[llvm-mca][X86] Add BMI/LZCNT/POPCNT resource tests to all relevant models
Simon Pilgrim [Sun, 22 Apr 2018 20:42:24 +0000 (20:42 +0000)]
[llvm-mca][X86] Add BMI/LZCNT/POPCNT resource tests to all relevant models

The SandyBridge BMI tests are actually run on IvyBridge as that's the first lowest CPU that actually support the ISAs (but still use the SandyBridge model).

llvm-svn: 330556

6 years ago[LLVM-C] Add DIBuilder Bindings For Variable Creation
Robert Widmann [Sun, 22 Apr 2018 19:24:44 +0000 (19:24 +0000)]
[LLVM-C] Add DIBuilder Bindings For Variable Creation

Summary: Wrap LLVMDIBuilderCreateAutoVariable, LLVMDIBuilderCreateParameterVariable, LLVMDIBuilderCreateExpression, and move and correct LLVMDIBuilderInsertDeclareBefore and LLVMDIBuilderInsertDeclareAtEnd from the Go bindings to the C bindings.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: harlanhaskins, whitequark

Subscribers: llvm-commits

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

llvm-svn: 330555

6 years ago[X86] Remove unnecessary WriteFBlend/WriteBlend InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 18:35:53 +0000 (18:35 +0000)]
[X86] Remove unnecessary WriteFBlend/WriteBlend InstRW overrides.

Fixed a lot of the default classes which were being completely overridden.

llvm-svn: 330554

6 years ago[X86] Remove unnecessary WriteFMul/WriteFRcp/WriteFRsqrt InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 18:09:50 +0000 (18:09 +0000)]
[X86] Remove unnecessary WriteFMul/WriteFRcp/WriteFRsqrt InstRW overrides.

llvm-svn: 330553

6 years ago[X86] Remove unnecessary CVT instrw overrides.
Simon Pilgrim [Sun, 22 Apr 2018 17:54:58 +0000 (17:54 +0000)]
[X86] Remove unnecessary CVT instrw overrides.

llvm-svn: 330552

6 years agoTest commit access.
Andres Freund [Sun, 22 Apr 2018 17:53:34 +0000 (17:53 +0000)]
Test commit access.

Remove trailing whitespace.

llvm-svn: 330551

6 years ago[PatternMatch] allow undef elements when matching a vector zero
Sanjay Patel [Sun, 22 Apr 2018 17:07:44 +0000 (17:07 +0000)]
[PatternMatch] allow undef elements when matching a vector zero

This is the last step in getting constant pattern matchers to allow
undef elements in constant vectors.

I'm adding a dedicated m_ZeroInt() function and building m_Zero() from
that. In most cases, calling code can be updated to use m_ZeroInt()
directly when there's no need to match pointers, but I'm leaving that
efficiency optimization as a follow-up step because it's not always
clear when that's ok.

There are just enough icmp folds in InstSimplify that can be used for
integer or pointer types, that we probably still want a generic m_Zero()
for those cases. Otherwise, we could eliminate it (and possibly add a
m_NullPtr() as an alias for isa<ConstantPointerNull>()).

We're conservatively returning a full zero vector (zeroinitializer) in
InstSimplify/InstCombine on some of these folds (see diffs in InstSimplify),
but I'm not sure if that's actually necessary in all cases. We may be
able to propagate an undef lane instead. One test where this happens is
marked with 'TODO'.

llvm-svn: 330550

6 years ago[X86][SkylakeServer] Remove unnecessary PMULLD instrw overrides.
Simon Pilgrim [Sun, 22 Apr 2018 16:51:12 +0000 (16:51 +0000)]
[X86][SkylakeServer] Remove unnecessary PMULLD instrw overrides.

llvm-svn: 330549

6 years ago[X86][Atom] Remove unnecessary scalar/vector load/move instrw overrides.
Simon Pilgrim [Sun, 22 Apr 2018 16:49:35 +0000 (16:49 +0000)]
[X86][Atom] Remove unnecessary scalar/vector load/move instrw overrides.

llvm-svn: 330548

6 years ago[InstCombine] add vector test with undef elts; NFC
Sanjay Patel [Sun, 22 Apr 2018 15:59:14 +0000 (15:59 +0000)]
[InstCombine] add vector test with undef elts; NFC

llvm-svn: 330547

6 years ago[X86] Fix (completely overridden) WriteFHAdd/WritePHAdd classes to allow us to remove...
Simon Pilgrim [Sun, 22 Apr 2018 15:25:59 +0000 (15:25 +0000)]
[X86] Fix (completely overridden) WriteFHAdd/WritePHAdd classes to allow us to remove unnecessary instrw overrides.

llvm-svn: 330546

6 years ago[X86][MMX][SSE] Tag missed PHADD/PHSUB instructions with WritePHAdd
Simon Pilgrim [Sun, 22 Apr 2018 15:02:23 +0000 (15:02 +0000)]
[X86][MMX][SSE] Tag missed PHADD/PHSUB instructions with WritePHAdd

llvm-svn: 330545

6 years ago[X86] Remove unnecessary WriteFVarBlend/WriteVarBlend InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 14:43:12 +0000 (14:43 +0000)]
[X86] Remove unnecessary WriteFVarBlend/WriteVarBlend InstRW overrides.

This also fixes some of the ReadAfterLd issues due to InstRW.

llvm-svn: 330544

6 years ago[InstSimplify, InstCombine] add vector tests with undef elts; NFC
Sanjay Patel [Sun, 22 Apr 2018 14:19:37 +0000 (14:19 +0000)]
[InstSimplify, InstCombine] add vector tests with undef elts; NFC

llvm-svn: 330543

6 years ago[X86] Fix WriteMPSAD/WritePSADBW values to allow us to remove unnecessary instrw...
Simon Pilgrim [Sun, 22 Apr 2018 10:39:16 +0000 (10:39 +0000)]
[X86] Fix WriteMPSAD/WritePSADBW values to allow us to remove unnecessary instrw overrides.

llvm-svn: 330542

6 years ago[X86][SandyBridge] Remove unnecessary WritePOPCNTLd overrides by fixing load latency.
Simon Pilgrim [Sun, 22 Apr 2018 10:03:52 +0000 (10:03 +0000)]
[X86][SandyBridge] Remove unnecessary WritePOPCNTLd overrides by fixing load latency.

llvm-svn: 330541

6 years ago[llvm-mca][X86] Add POPCNT resource test
Simon Pilgrim [Sun, 22 Apr 2018 09:58:00 +0000 (09:58 +0000)]
[llvm-mca][X86] Add POPCNT resource test

llvm-svn: 330540

6 years ago[test] Fix MC/ELF/nocompression.s
Jonas Devlieghere [Sun, 22 Apr 2018 08:46:27 +0000 (08:46 +0000)]
[test] Fix MC/ELF/nocompression.s

Unbreak the linux build bots:
  http://lab.llvm.org:8011/builders/clang-lld-x86_64-2stage/builds/5165/
  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/28775
  http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/8227

llvm-svn: 330539

6 years ago[lli] Fix syntax error: missing ';'
Jonas Devlieghere [Sun, 22 Apr 2018 08:35:00 +0000 (08:35 +0000)]
[lli] Fix syntax error: missing ';'

Fixes build issue on the windows bots:
  error C2143: syntax error: missing ';'

llvm-svn: 330538

6 years ago[lli] Make error handling more consistent.
Jonas Devlieghere [Sun, 22 Apr 2018 08:02:11 +0000 (08:02 +0000)]
[lli] Make error handling more consistent.

Makes error handling more consistent by using the helpers in support.

llvm-svn: 330537

6 years ago[llvm-mc] Make error handling more consistent.
Jonas Devlieghere [Sun, 22 Apr 2018 08:01:35 +0000 (08:01 +0000)]
[llvm-mc] Make error handling more consistent.

Makes error handling more consistent by using the helpers in support.

llvm-svn: 330536

6 years ago[Support] Fix prefix logic in WithColor.
Jonas Devlieghere [Sun, 22 Apr 2018 08:01:01 +0000 (08:01 +0000)]
[Support] Fix prefix logic in WithColor.

When a prefix is passed, we need to print a colon a space after it, not
just the prefix.

llvm-svn: 330535

6 years ago[X86] Remove an unnecessary HANDLE_OPTIONAL line from the disassembler operand proces...
Craig Topper [Sun, 22 Apr 2018 06:40:37 +0000 (06:40 +0000)]
[X86] Remove an unnecessary HANDLE_OPTIONAL line from the disassembler operand processing.

llvm-svn: 330534

6 years ago[X86] Change TB to PS on LFENCE instruction.
Craig Topper [Sun, 22 Apr 2018 03:15:02 +0000 (03:15 +0000)]
[X86] Change TB to PS on LFENCE instruction.

This matches the other FENCE instructions.

llvm-svn: 330533

6 years ago[X86] Remove OpSizeIgnore, it's not implemented any differently than OpSizeFixed.
Craig Topper [Sun, 22 Apr 2018 01:24:58 +0000 (01:24 +0000)]
[X86] Remove OpSizeIgnore, it's not implemented any differently than OpSizeFixed.

llvm-svn: 330532

6 years ago[X86] Remove DATA32_PREFIX. Hack the printing for DATA16_PREFIX to print 'data32...
Craig Topper [Sun, 22 Apr 2018 00:52:02 +0000 (00:52 +0000)]
[X86] Remove DATA32_PREFIX. Hack the printing for DATA16_PREFIX to print 'data32' in 16-bit mode. Hack the asm parser to convert 'data32' to 'data16' in 16-bit mode.

Improve the error messages to match GNU assembler.

This also allows us to remove the hack from the disassembler table building.

llvm-svn: 330531

6 years agoAdd tests for llvm-bcanalyzer stream types
Brian Gesiak [Sun, 22 Apr 2018 00:04:35 +0000 (00:04 +0000)]
Add tests for llvm-bcanalyzer stream types

Summary:
Add tests for the improved stream type detection added to
`llvm-bcanalyzer` in https://reviews.llvm.org/D41979.

Test Plan: `check-clang`

Reviewers: pcc, aprantl, mehdi_amini, george.karpenkov

Reviewed By: aprantl

Subscribers: cfe-commits, a.sidorin

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

llvm-svn: 330530

6 years ago[bcanalyzer] Recognize more stream types
Brian Gesiak [Sat, 21 Apr 2018 23:52:04 +0000 (23:52 +0000)]
[bcanalyzer] Recognize more stream types

Summary:
`llvm-bcanalyzer` prints out the stream type of the file it is
analyzing. If the file begins with the LLVM IR magic number, it reports
a stream type of "LLVM IR". However, any other bitstream format is
reported as "unknown".

Add some checks for two other common bitstream formats: Clang AST
files, which begin with 'CPCH', and Clang serialized diagnostics, which
begin with 'DIAG'.

Test Plan: `check-llvm`

Reviewers: pcc, aprantl, mehdi_amini, davide, george.karpenkov, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, bruno, davide, llvm-commits

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

llvm-svn: 330529

6 years agoRevert r330492: [clang-tidy] add new check to find out objc ivars which do not have...
Chandler Carruth [Sat, 21 Apr 2018 23:27:34 +0000 (23:27 +0000)]
Revert r330492: [clang-tidy] add new check to find out objc ivars which do not have prefix '_'

This commit has been breaking most bots for a day now. There is a fix
proposed in https://reviews.llvm.org/D45912 but when I applied that
I just got different errors. Reverting to get our bots back to green.

llvm-svn: 330528

6 years ago[X86] Strip unnecessary prefetch + vector move/load instrw overrides from scheduler...
Simon Pilgrim [Sat, 21 Apr 2018 21:59:36 +0000 (21:59 +0000)]
[X86] Strip unnecessary prefetch + vector move/load instrw overrides from scheduler models.

llvm-svn: 330527

6 years ago[Support] Add optional prefix to convenience helpers in WithColor.
Jonas Devlieghere [Sat, 21 Apr 2018 21:36:11 +0000 (21:36 +0000)]
[Support] Add optional prefix to convenience helpers in WithColor.

Several tools prefix the error/warning/note output with the name of the
tool. One such tool is LLD for example. This commit adds as an optional
'Prefix' argument to the convenience helpers.

llvm-svn: 330526

6 years ago[X86] Strip unnecessary WriteCvtF2I instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 21:16:44 +0000 (21:16 +0000)]
[X86] Strip unnecessary WriteCvtF2I instrw overrides from scheduler models.

llvm-svn: 330525

6 years ago[tools] Use WithColor for printing errors.
Jonas Devlieghere [Sat, 21 Apr 2018 21:11:59 +0000 (21:11 +0000)]
[tools] Use WithColor for printing errors.

Use convenience helpers in WithColor to print errors, warnings and notes
in a few more tools.

llvm-svn: 330524

6 years ago[X86] Strip unnecessary broadcast/shuffle256 instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 20:45:12 +0000 (20:45 +0000)]
[X86] Strip unnecessary broadcast/shuffle256 instrw overrides from scheduler models.

llvm-svn: 330523

6 years ago[X86][AVX] VPERM2F128/VINSERTF128 should be a shuffle256 schedule like VPERM2I128...
Simon Pilgrim [Sat, 21 Apr 2018 20:04:24 +0000 (20:04 +0000)]
[X86][AVX] VPERM2F128/VINSERTF128 should be a shuffle256 schedule like VPERM2I128/VINSERTI128

llvm-svn: 330522

6 years ago[X86] Strip unnecessary vector integer math, shift-imm, extend, shuffle, pack/unpack...
Simon Pilgrim [Sat, 21 Apr 2018 19:11:55 +0000 (19:11 +0000)]
[X86] Strip unnecessary vector integer math, shift-imm, extend, shuffle, pack/unpack instruction instrw overrides from scheduler models.

llvm-svn: 330521

6 years ago[X86] Add DAG combine to turn (trunc (srl (mul ext, ext), 16) into PMULHW/PMULHUW.
Craig Topper [Sat, 21 Apr 2018 18:39:21 +0000 (18:39 +0000)]
[X86] Add DAG combine to turn (trunc (srl (mul ext, ext), 16) into PMULHW/PMULHUW.

Ultimately I want to use this to remove the intrinsics for these instructions.

llvm-svn: 330520

6 years ago[X86] Add test cases that show the current codegen for (trunc (srl (mul ext, ext...
Craig Topper [Sat, 21 Apr 2018 18:39:20 +0000 (18:39 +0000)]
[X86] Add test cases that show the current codegen for (trunc (srl (mul ext, ext), 16)). NFC

A future patch will turn this into MULHU/MULHS.

llvm-svn: 330519

6 years ago[lit] Generate a single lit cfg file for tests that require dotest.py
Jonas Devlieghere [Sat, 21 Apr 2018 18:23:04 +0000 (18:23 +0000)]
[lit] Generate a single lit cfg file for tests that require dotest.py

The current way that the lit configuration is generated for the LLDB
tests that run using dotest causes cmake to fail when using a generator
which supports multiple configurations (such as Visual Studio). The
failure is because file GENERATE will create a file *per possible
configuration* resulting in the same lit configuration file being
overwritten multiple times.

To fix the issue, we need to create a single lit file that is agnostic
of the configurations and can be used for any configuration.

Patch by: Stella Stamenova

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

llvm-svn: 330518

6 years ago[X86] Add SchedWrites for LDMXCSR/STMXCSR.
Craig Topper [Sat, 21 Apr 2018 18:07:36 +0000 (18:07 +0000)]
[X86] Add SchedWrites for LDMXCSR/STMXCSR.

llvm-svn: 330517

6 years ago[InstSimplify] move tests for shifts; NFC
Sanjay Patel [Sat, 21 Apr 2018 16:58:00 +0000 (16:58 +0000)]
[InstSimplify] move tests for shifts; NFC

llvm-svn: 330516

6 years ago[InstSimplify] move/add/regenerate checks for tests; NFC
Sanjay Patel [Sat, 21 Apr 2018 16:23:47 +0000 (16:23 +0000)]
[InstSimplify] move/add/regenerate checks for tests; NFC

llvm-svn: 330515

6 years ago[X86][Haswell] Strip unnecessary WriteFAdd/WriteFHAdd instruction instrw overrides.
Simon Pilgrim [Sat, 21 Apr 2018 16:20:28 +0000 (16:20 +0000)]
[X86][Haswell] Strip unnecessary WriteFAdd/WriteFHAdd instruction instrw overrides.

llvm-svn: 330514

6 years ago[X86][Broadwell] Remove unnecessary VORPD/VORPS instrw override - missed in D45629
Simon Pilgrim [Sat, 21 Apr 2018 16:17:47 +0000 (16:17 +0000)]
[X86][Broadwell] Remove unnecessary VORPD/VORPS instrw override - missed in D45629

llvm-svn: 330513

6 years ago[llvm-mca][X86] Add AVX2 resource tests
Simon Pilgrim [Sat, 21 Apr 2018 16:12:42 +0000 (16:12 +0000)]
[llvm-mca][X86] Add AVX2 resource tests

llvm-svn: 330512

6 years ago[clang-tidy] Customize FileCheck prefix in check_clang-tidy.py
Zinovy Nis [Sat, 21 Apr 2018 15:23:56 +0000 (15:23 +0000)]
[clang-tidy] Customize FileCheck prefix in check_clang-tidy.py

The patch introduces a new command line option '-check-suffix' for check_clang_tidy.py
to allow multiple %check_clang_tidy% in a single test file.

Sample:

// RUN: %check_clang_tidy -check-suffix=FLAG-1 %s misc-unused-using-decls %t -- -- <options-set-1>
// RUN: %check_clang_tidy -check-suffix=FLAG-2 %s misc-unused-using-decls %t -- -- <options-set-2>
...
+// CHECK-MESSAGES-FLAG-1: :[[@LINE-4]]:10: warning: using decl 'B' is unused [misc-unused-using-decls]
+// CHECK-MESSAGES-FLAG-2: :[[@LINE-7]]:10: warning: using decl 'A' is unused [misc-unused-using-decls]
+// CHECK-FIXES-FLAG-1-NOT: using a::A;$
+// CHECK-FIXES-FLAG-2-NOT: using a::B;$

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

llvm-svn: 330511

6 years ago[X86] Strip unnecessary WriteFRcp/WriteFRsqrt instruction instrw overrides from sched...
Simon Pilgrim [Sat, 21 Apr 2018 15:16:59 +0000 (15:16 +0000)]
[X86] Strip unnecessary WriteFRcp/WriteFRsqrt instruction instrw overrides from scheduler models.

The required the default skylake schedules to be updated - these were being completely overriden by the InstRW and the existing values not used at all.

llvm-svn: 330510

6 years ago[clang-apply-replacements] Make clang-apply-replacements installable
Zinovy Nis [Sat, 21 Apr 2018 15:01:33 +0000 (15:01 +0000)]
[clang-apply-replacements] Make clang-apply-replacements installable

Add a new target for install: install-clang-apply-replacements.
So if you need clang-tidy and clang-apply-replacements tools only,
you may build and install only these tools:

    make install-clang-tidy install-clang-apply-replacements

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

llvm-svn: 330509

6 years ago[X86] Strip unnecessary WriteFShuffle instruction instrw overrides from scheduler...
Simon Pilgrim [Sat, 21 Apr 2018 14:56:56 +0000 (14:56 +0000)]
[X86] Strip unnecessary WriteFShuffle instruction instrw overrides from scheduler models.

llvm-svn: 330508

6 years ago[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink
Petr Pavlu [Sat, 21 Apr 2018 14:35:18 +0000 (14:35 +0000)]
[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink

Fix testing of clang_File_tryGetRealPathName() in
LibclangReparseTest.FileName when executing in an environment which has
TMPDIR set to a symbolic link that points to an actual directory. The
test would fail because the name returned by
clang_File_tryGetRealPathName() has the symlink resolved but the test
compared it to the original filename of a temporary file.

The patch addresses the problem by checking only that the value returned
by clang_File_tryGetRealPathName() ends with "main.cpp".

Additionally, the patch makes the previous assertion in the test that
checks result of clang_getFileName() stricter. It newly verifies that
the name returned by the function is exactly same as what was given to
clang_parseTranslationUnit()/clang_getFile().

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

llvm-svn: 330507

6 years ago[llvm-mca][X86] Add SSE resource tests to all models
Simon Pilgrim [Sat, 21 Apr 2018 14:16:57 +0000 (14:16 +0000)]
[llvm-mca][X86] Add SSE resource tests to all models

llvm-svn: 330506

6 years ago[X86][SandyBridge] Strip unnecessary MOVQ/CVT instruction instrw overrides.
Simon Pilgrim [Sat, 21 Apr 2018 14:03:40 +0000 (14:03 +0000)]
[X86][SandyBridge] Strip unnecessary MOVQ/CVT instruction instrw overrides.

llvm-svn: 330505

6 years agoTemporarily skip Go TestExpressions on FreeBSD as it hangs
Ed Maste [Sat, 21 Apr 2018 13:59:07 +0000 (13:59 +0000)]
Temporarily skip Go TestExpressions on FreeBSD as it hangs

llvm.org/pr37194

llvm-svn: 330504

6 years ago[X86] Strip unnecessary MMX instruction instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 12:15:42 +0000 (12:15 +0000)]
[X86] Strip unnecessary MMX instruction instrw overrides from scheduler models.

llvm-svn: 330503

6 years ago[llvm-mca][X86] Add MMX resource tests
Simon Pilgrim [Sat, 21 Apr 2018 11:28:59 +0000 (11:28 +0000)]
[llvm-mca][X86] Add MMX resource tests

llvm-svn: 330502

6 years ago[X86] Strip unnecessary x87 instruction instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 11:25:02 +0000 (11:25 +0000)]
[X86] Strip unnecessary x87 instruction instrw overrides from scheduler models.

llvm-svn: 330501

6 years agoFreeBSD: propagate error to user if memory access fails
Ed Maste [Sat, 21 Apr 2018 11:23:56 +0000 (11:23 +0000)]
FreeBSD: propagate error to user if memory access fails

Previously, an attempt to read an unreadable address reported zeros.
Now, if DoReadMemory or DoWriteMemory encounters error then return 0
(bytes read or written) so that the error is reported to the user.

llvm.org/pr37190

llvm-svn: 330500

6 years ago[llvm-mca][X86] Add X87 resource tests
Simon Pilgrim [Sat, 21 Apr 2018 10:36:19 +0000 (10:36 +0000)]
[llvm-mca][X86] Add X87 resource tests

llvm-svn: 330499

6 years ago[X86][X87] Add missing fldlg2 schedule test
Simon Pilgrim [Sat, 21 Apr 2018 10:35:04 +0000 (10:35 +0000)]
[X86][X87] Add missing fldlg2 schedule test

llvm-svn: 330498

6 years ago[PowerPC] fix incorrect vectorization of abs() on POWER9
Hiroshi Inoue [Sat, 21 Apr 2018 09:32:17 +0000 (09:32 +0000)]
[PowerPC] fix incorrect vectorization of abs() on POWER9

Vectorized loops with abs() returns incorrect results on POWER9. This patch fixes it.
For example the following code returns negative result if input values are negative though it sums up the absolute value of the inputs.

int vpx_satd_c(const int16_t *coeff, int length) {
  int satd = 0;
  for (int i = 0; i < length; ++i) satd += abs(coeff[i]);
  return satd;
}

This problem causes test failures for libvpx.
For vector absolute and vector absolute difference on POWER9, LLVM generates VABSDUW (Vector Absolute Difference Unsigned Word) instruction or variants.
Since these instructions are for unsigned integers, we need adjustment for signed integers.
For abs(sub(a, b)), we generate VABSDUW(a+0x80000000, b+0x80000000). Otherwise, abs(sub(-1, 0)) returns 0xFFFFFFFF(=-1) instead of 1. For abs(a), we generate VABSDUW(a+0x80000000, 0x80000000).

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

llvm-svn: 330497