platform/upstream/llvm.git
5 years agoRemoved extra ; after function definition
Kristof Umann [Tue, 2 Jul 2019 13:25:41 +0000 (13:25 +0000)]
Removed extra ; after function definition

llvm-svn: 364923

5 years ago[clang-tidy] Extend TransformerClangTidyCheck to support adding includes.
Yitzhak Mandelbaum [Tue, 2 Jul 2019 13:25:07 +0000 (13:25 +0000)]
[clang-tidy] Extend TransformerClangTidyCheck to support adding includes.

Summary:
This revision implements support for the `AddedIncludes` field in
RewriteRule cases; that is, it supports specifying the addition of include
directives in files modified by the clang tidy check.

Reviewers: ilya-biryukov, gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 364922

5 years ago[NFC][TargetLowering] Some preparatory cleanups around 'prepareUREMEqFold()' from...
Roman Lebedev [Tue, 2 Jul 2019 13:21:23 +0000 (13:21 +0000)]
[NFC][TargetLowering] Some preparatory cleanups around 'prepareUREMEqFold()' from D63963

llvm-svn: 364921

5 years ago[APIntTest] multiplicativeInverse(): clarify test
Roman Lebedev [Tue, 2 Jul 2019 13:21:17 +0000 (13:21 +0000)]
[APIntTest] multiplicativeInverse(): clarify test

Clarify that multiplicative inverse exists for all odd numbers,
and does not exist for all even numbers (including 0).

llvm-svn: 364920

5 years agoFix line endings (NFC)
Paul Robinson [Tue, 2 Jul 2019 13:13:36 +0000 (13:13 +0000)]
Fix line endings (NFC)

llvm-svn: 364919

5 years ago[docs][llvm-readelf] Delete old llvm-readelf.md
James Henderson [Tue, 2 Jul 2019 13:11:34 +0000 (13:11 +0000)]
[docs][llvm-readelf] Delete old llvm-readelf.md

This was accidentally missed when committing r364800.

llvm-svn: 364918

5 years ago[LibTooling] Extend `RewriteRule` with support for adding includes.
Yitzhak Mandelbaum [Tue, 2 Jul 2019 13:11:04 +0000 (13:11 +0000)]
[LibTooling] Extend `RewriteRule` with support for adding includes.

Summary:
This revision allows users to specify the insertion of an included directive (at
the top of the file being rewritten) as part of a rewrite rule.  These
directives are bundled with `RewriteRule` cases, so that different cases can
potentially result in different include actions.

Reviewers: ilya-biryukov, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 364917

5 years ago[Object/invalid.test] - Convert Object/corrupt.test to YAML and merge the result...
George Rimar [Tue, 2 Jul 2019 12:58:37 +0000 (12:58 +0000)]
[Object/invalid.test] - Convert Object/corrupt.test to YAML and merge the result into invalid.test

Object/corrupt.test has the same purpose as Object/invalid.test:
it tests the behavior on invalid inputs.

In this patch I converted it to YAML, merged into invalid.test,
added comments and removed a few precompiled binaries.

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

llvm-svn: 364916

5 years ago[InstCombine] Shift amount reassociation: fixup constantexpr handling (PR42484)
Roman Lebedev [Tue, 2 Jul 2019 12:54:48 +0000 (12:54 +0000)]
[InstCombine] Shift amount reassociation: fixup constantexpr handling (PR42484)

I was actually wondering if there was some nicer way than m_Value()+cast,
but apparently what i was really "subconsciously" thinking about
was correctness issue.

hasNoUnsignedWrap()/hasNoUnsignedWrap() exist for Instruction,
not for BinaryOperator, so let's just use m_Instruction(),
thus both avoiding a cast, and a crash.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42484,
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15587

llvm-svn: 364915

5 years agoAttempt to fix buildbot failures with MSVC
Kristof Umann [Tue, 2 Jul 2019 12:40:29 +0000 (12:40 +0000)]
Attempt to fix buildbot failures with MSVC

llvm-svn: 364914

5 years ago[ELF] Only allow the binding of SharedSymbol to change for the first undef ref
Fangrui Song [Tue, 2 Jul 2019 11:37:21 +0000 (11:37 +0000)]
[ELF] Only allow the binding of SharedSymbol to change for the first undef ref

Fixes PR42442

t.o has a STB_GLOBAL undef ref to f
t2.so has a STB_WEAK undef ref to f
t1.so defines f

ld.lld t.o t1.so t2.so currently sets the binding of `f` to STB_WEAK.
This is not correct because there exists a STB_GLOBAL undef ref from a
regular object. The problem is that resolveUndefined() doesn't check
if the undef ref is seen for the first time:

    if (isShared() || isLazy() || (isUndefined() && Other.Binding != STB_WEAK))
      Binding = Other.Binding;

The isShared() condition should be `isShared() && !Referenced`
where Referenced is set to true after an undef ref is seen.

In practice, when linking a pthread program with glibc:

    // a.o
    #include <pthread.h>
    pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
    int main() { pthread_mutex_unlock(&mu); }

{clang,gcc} -fuse-ld=lld a.o -lpthread # libpthread.so is linked before libgcc_s.so.1

The weak undef pthread_mutex_unlock in libgcc_s.so.1 makes the result
weak, which diverges from GNU linkers where STB_DEFAULT is used:

    23: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND pthread_mutex_lock

(Note, if -pthread is used instead, libpthread.so will be linked **after**
libgcc_s.so.1 . lld sets the binding to the expected STB_GLOBAL)

Similar linking sequences (ld.lld t.o t1.so t2.so) appear to be used by
Go, which cause a build error https://github.com/golang/go/issues/31912.

Reviewed By: grimar, ruiu

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

llvm-svn: 364913

5 years ago[llvm] [Support] Clean PrintStackTrace() ptr arithmetic up
Michal Gorny [Tue, 2 Jul 2019 11:32:03 +0000 (11:32 +0000)]
[llvm] [Support] Clean PrintStackTrace() ptr arithmetic up

Use '%tu' modifier for pointer arithmetic since we are using C++11
already.  Prefer static_cast<> over C-style cast.  Remove unnecessary
conversion of result, and add const qualifier to converted pointers,
to silence the following warning:

  In file included from /home/mgorny/llvm-project/llvm/lib/Support/Signals.cpp:220:0:
  /home/mgorny/llvm-project/llvm/lib/Support/Unix/Signals.inc: In function ‘void llvm::sys::PrintStackTrace(llvm::raw_ostream&)’:
  /home/mgorny/llvm-project/llvm/lib/Support/Unix/Signals.inc:546:53: warning: cast from type ‘const void*’ to type ‘char*’ casts away qualifiers [-Wcast-qual]
                                         (char*)dlinfo.dli_saddr));
                                                       ^~~~~~~~~

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

llvm-svn: 364912

5 years ago[IDF] Generalize IDFCalculator to be used with Clang's CFG
Kristof Umann [Tue, 2 Jul 2019 11:30:12 +0000 (11:30 +0000)]
[IDF] Generalize IDFCalculator to be used with Clang's CFG

I'm currently working on a GSoC project that aims to improve the the bug reports
of the analyzer. The main heuristic I plan to use is to explain values that are
a control dependency of the bug location better.

01 bool b = messyComputation();
02 int i = 0;
03 if (b) // control dependency of the bug site, let's explain why we assume val
04        // to be true
05   10 / i; // warn: division by zero

Because of this, I'd like to generalize IDFCalculator so that I could use it for
Clang's CFG: D62883.

In detail:

* Rename IDFCalculator to IDFCalculatorBase, make it take a general CFG node
  type as a template argument rather then strictly BasicBlock (but preserve
  ForwardIDFCalculator and ReverseIDFCalculator)
* Move IDFCalculatorBase from llvm/include/llvm/Analysis to
  llvm/include/llvm/Support (but leave the BasicBlock variants in
  llvm/include/llvm/Analysis)
* clang-format the file since this patch messes up git blame anyways
* Change typedef to using
* Add the new type ChildrenGetterTy, and store an instance of it in
  IDFCalculatorBase. This is important because I'll have to specialize it for
  Clang's CFG to filter out nullpointer successors, similarly to D62507.

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

llvm-svn: 364911

5 years ago[ARM] MVE: allow soft-float ABI to pass vector types.
Simon Tatham [Tue, 2 Jul 2019 11:26:11 +0000 (11:26 +0000)]
[ARM] MVE: allow soft-float ABI to pass vector types.

Passing a vector type over the soft-float ABI involves it being split
into four GPRs, so the first thing that has to happen at the start of
the function is to recombine those into a vector register. The ABI
types all vectors as v2f64, so we need to support BUILD_VECTOR for
that type, which I do in this patch by allowing it to be expanded in
terms of INSERT_VECTOR_ELT, and writing an ISel pattern for that in
turn. Similarly, I provide a rule for EXTRACT_VECTOR_ELT so that a
returned vector can be marshalled back into GPRs.

While I'm here, I've also added ISD::UNDEF to the list of operations
we turn back on in `setAllExpand`, because I noticed that otherwise it
gets expanded into a BUILD_VECTOR with explicit zero inputs, leading
to pointless machine instructions to zero out a vector register that's
about to have every lane overwritten of in any case.

Reviewers: dmgreen, ostannard

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 364910

5 years ago[ARM] Stop using scalar FP instructions in integer-only MVE mode.
Simon Tatham [Tue, 2 Jul 2019 11:26:00 +0000 (11:26 +0000)]
[ARM] Stop using scalar FP instructions in integer-only MVE mode.

If you compile with `-mattr=+mve` (enabling integer MVE instructions
but not floating-point ones), then the scalar FP //registers// exist
and it's legal to move things in and out of them, load and store them,
but it's not legal to do arithmetic on them.

In D60708, the calls to `addRegisterClass` in ARMISelLowering that
enable use of the scalar FP registers became conditionalised on
`Subtarget->hasFPRegs()` instead of `Subtarget->hasVFP2Base()`, so
that loads, stores and moves of those registers would work. But I
didn't realise that that would also enable all the operations on those
types by default.

Now, if the target doesn't have basic VFP, we follow up those
`addRegisterClass` calls by turning back off all the nontrivial
operations you can perform on f32 and f64. That causes several
knock-on failures, which are fixed by allowing the `VMOVDcc` and
`VMOVScc` instructions to be selected even if all you have is
`HasFPRegs`, and adjusting several checks for 'is this a double in a
single-precision-only world?' to the more general 'is this any FP type
we can't do arithmetic on?'. Between those, the whole of the
`float-ops.ll` and `fp16-instructions.ll` tests can now run in
MVE-without-FP mode and generate correct-looking code.

One odd side effect is that I had to relax the check lines in that
test so that they permit test functions like `add_f` to be generated
as tailcalls to software FP library functions, instead of ordinary
calls. Doing that is entirely legal, but the mystery is why this is
the first RUN line that's needed the relaxation: on the usual kind of
non-FP target, no tailcalls ever seem to be generated. Going by the
llc messages, I think `SoftenFloatResult` must be perturbing the code
generation in some way, but that's as much as I can guess.

Reviewers: dmgreen, ostannard

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 364909

5 years agogn build: Merge r364866
Nico Weber [Tue, 2 Jul 2019 11:20:40 +0000 (11:20 +0000)]
gn build: Merge r364866

llvm-svn: 364908

5 years ago[yaml2obj] - An attempt to fix a ppc64be build bot after r364898
George Rimar [Tue, 2 Jul 2019 11:02:09 +0000 (11:02 +0000)]
[yaml2obj] - An attempt to fix a ppc64be build bot after r364898

I guess the problem is because of endianess of
the bytes tested by "od" tool. I changed the Content
sequence as it does not actually matter.

llvm-svn: 364907

5 years ago[X86] resolveTargetShuffleInputsAndMask - add repeated input handling.
Simon Pilgrim [Tue, 2 Jul 2019 10:53:17 +0000 (10:53 +0000)]
[X86] resolveTargetShuffleInputsAndMask - add repeated input handling.

We were relying on combineX86ShufflesRecursively to handle this - this patch gets it done earlier which should make it easier for other code to use resolveTargetShuffleInputsAndMask.

llvm-svn: 364906

5 years ago[test/Object] - Fix build bot.
George Rimar [Tue, 2 Jul 2019 10:47:13 +0000 (10:47 +0000)]
[test/Object] - Fix build bot.

Fixed mistype in the test case.

BB: http://lab.llvm.org:8011/builders/lld-x86_64-ubuntu-fast/builds/2720/steps/test-check-all/logs/stdio
llvm-svn: 364905

5 years ago[clang][ArgumentAdjusters] Do not add fsyntax-only if already exists
Kadir Cetinkaya [Tue, 2 Jul 2019 10:45:53 +0000 (10:45 +0000)]
[clang][ArgumentAdjusters] Do not add fsyntax-only if already exists

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 364904

5 years ago[Object/invalid.test] - Convert 3 more sub-tests to YAML
George Rimar [Tue, 2 Jul 2019 10:30:06 +0000 (10:30 +0000)]
[Object/invalid.test] - Convert 3 more sub-tests to YAML

This allows to remove 3 more precompiled binaries from the inputs.

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

llvm-svn: 364903

5 years ago[mips] Mark P5600 scheduling model as complete
Simon Atanasyan [Tue, 2 Jul 2019 10:22:14 +0000 (10:22 +0000)]
[mips] Mark P5600 scheduling model as complete

llvm-svn: 364902

5 years agoclang-cl: Make /d1reportAllClassLayout actually work and improve test
Nico Weber [Tue, 2 Jul 2019 10:22:11 +0000 (10:22 +0000)]
clang-cl: Make /d1reportAllClassLayout actually work and improve test

See review thread for r301567.

llvm-svn: 364901

5 years ago[mips] Add missing schedinfo for FPU load/store/conv instructions
Simon Atanasyan [Tue, 2 Jul 2019 10:22:06 +0000 (10:22 +0000)]
[mips] Add missing schedinfo for FPU load/store/conv instructions

llvm-svn: 364900

5 years ago[mips] Map SNOP, NOP to the P5600Nop scheduler resource
Simon Atanasyan [Tue, 2 Jul 2019 10:21:59 +0000 (10:21 +0000)]
[mips] Map SNOP, NOP to the P5600Nop scheduler resource

llvm-svn: 364899

5 years ago[yaml2obj] - Allow overriding sh_offset field from the YAML.
George Rimar [Tue, 2 Jul 2019 10:20:12 +0000 (10:20 +0000)]
[yaml2obj] - Allow overriding sh_offset field from the YAML.

Some of our test cases are using objects which
has sections with a broken sh_offset field.

There was no way to set it from YAML until this patch.

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

llvm-svn: 364898

5 years ago[NFC][InstCombine] Revisit tests for "redundant shift input masking" (PR42456)
Roman Lebedev [Tue, 2 Jul 2019 10:02:25 +0000 (10:02 +0000)]
[NFC][InstCombine] Revisit tests for "redundant shift input masking" (PR42456)

llvm-svn: 364897

5 years ago[DWARF] Simplify dumping of a .debug_addr section.
Igor Kudrin [Tue, 2 Jul 2019 09:57:28 +0000 (09:57 +0000)]
[DWARF] Simplify dumping of a .debug_addr section.

This patch removes the part which tried to interpret addresses
in that section as offsets and simplifies the remaining code.

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

llvm-svn: 364896

5 years ago[clang][Driver][ARM] NFC: Remove unused function parameter
Alexandros Lamprineas [Tue, 2 Jul 2019 09:45:24 +0000 (09:45 +0000)]
[clang][Driver][ARM] NFC: Remove unused function parameter

Removes a vector reference that was added by D62998, since the
preexisting function parameter is sufficient.

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

llvm-svn: 364895

5 years ago[NFC][InstCombine] Add tests for "redundant shift input masking" (PR42456)
Roman Lebedev [Tue, 2 Jul 2019 09:27:34 +0000 (09:27 +0000)]
[NFC][InstCombine] Add tests for "redundant shift input masking" (PR42456)

https://bugs.llvm.org/show_bug.cgi?id=42456
https://rise4fun.com/Alive/Vf1p

llvm-svn: 364894

5 years ago[clangd] Collect the refs when the main file is header.
Haojian Wu [Tue, 2 Jul 2019 09:16:21 +0000 (09:16 +0000)]
[clangd] Collect the refs when the main file is header.

Summary:
Previously, we only collect refs of the symbols which are declared in
the preamble and referenced in the main file, it works well when the
main file is .cpp file.

However, when the main file is .h file (when opening a .h file in the
editor), we don't collect refs of the symbol declared in this file, so we miss
these refs in our dynamic index.

A typical scenario:

1. Open Foo.h (which contains class Foo)
2. Open Foo.cpp, call find references for Foo

And we only get refs from Foo.cpp.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 364893

5 years ago[Sanitizers] Remove obsolete OpenFile from sanitizer_solaris.cc
Rainer Orth [Tue, 2 Jul 2019 08:40:29 +0000 (08:40 +0000)]
[Sanitizers] Remove obsolete OpenFile from sanitizer_solaris.cc

I noticed that the instance of OpenFile in sanitizer_solaris.cc is no
longer needed.

Removed as follows, tested on x86_64-pc-solaris2.11.

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

llvm-svn: 364892

5 years ago[ASTImporter] Make headers self-contained
Benjamin Kramer [Tue, 2 Jul 2019 08:01:41 +0000 (08:01 +0000)]
[ASTImporter] Make headers self-contained

llvm-svn: 364891

5 years ago[DWARF] Add one more type unit test
Pavel Labath [Tue, 2 Jul 2019 07:57:08 +0000 (07:57 +0000)]
[DWARF] Add one more type unit test

This test passes already, but it seems interesting to test that we can
jump between type units in different dwo files nonetheless.

llvm-svn: 364890

5 years ago[ASTImporter] Structural eq: handle DependentScopeDeclRefExpr
Gabor Marton [Tue, 2 Jul 2019 07:36:39 +0000 (07:36 +0000)]
[ASTImporter] Structural eq: handle DependentScopeDeclRefExpr

Summary:
Structural equivalence did not handle dependent template args properly
when the arg contained a DependentScopeDeclRefExpr.

Reviewers: a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 364889

5 years ago[TailDuplicator] Fix copy instruction emitting into the wrong block.
Amara Emerson [Tue, 2 Jul 2019 06:04:46 +0000 (06:04 +0000)]
[TailDuplicator] Fix copy instruction emitting into the wrong block.

The code for duplicating instructions could sometimes try to emit copies
intended to deal with unconstrainable register classes to the tail block of the
original instruction, rather than before the newly cloned instruction in the
predecessor block.

This was exposed by GlobalISel on arm64.

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

llvm-svn: 364888

5 years ago[X86] Add PreprocessISelDAG support for turning ISD::FP_TO_SINT/UINT into X86ISD...
Craig Topper [Tue, 2 Jul 2019 05:53:37 +0000 (05:53 +0000)]
[X86] Add PreprocessISelDAG support for turning ISD::FP_TO_SINT/UINT into X86ISD::CVTTP2SI/CVTTP2UI and to reduce the number of isel patterns.

llvm-svn: 364887

5 years ago[PowerPC] Implement the areMemAccessesTriviallyDisjoint hook
QingShan Zhang [Tue, 2 Jul 2019 03:28:52 +0000 (03:28 +0000)]
[PowerPC] Implement the areMemAccessesTriviallyDisjoint hook
After implemented this hook, we will model the memory dependency in the scheduling dependency graph more precise,
and will have more opportunity to reorder the load/stores, as they didn't have the dependency at some condition

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

llvm-svn: 364886

5 years agoUpdate status of papers for upcoming WG21 meeting. NFC
Marshall Clow [Tue, 2 Jul 2019 03:23:06 +0000 (03:23 +0000)]
Update status of papers for upcoming WG21 meeting. NFC

llvm-svn: 364885

5 years agoUse new '__libcpp_is_constant_evaluated' call to remove an '#ifdef' from the bit...
Marshall Clow [Tue, 2 Jul 2019 03:21:16 +0000 (03:21 +0000)]
Use new '__libcpp_is_constant_evaluated' call to remove an '#ifdef' from the bit code. NFC

llvm-svn: 364884

5 years ago[DAGCombiner] Exploiting more about the transformation of TransformFPLoadStorePair...
Zi Xuan Wu [Tue, 2 Jul 2019 02:54:52 +0000 (02:54 +0000)]
[DAGCombiner] Exploiting more about the transformation of TransformFPLoadStorePair function

For a given floating point load / store pair, if the load value isn't used by any other operations,
then consider transforming the pair to integer load / store operations if the target deems the transformation profitable.

And we can exploiting much more when there are other operation nodes with chain operand between the load/store pair
so long as we keep the chain ordering original. We only replace the register used to load/store from float to integer.

I only add testcase in ARM because the TLI.isDesirableToTransformToIntegerOp hook is only enabled in ARM target.

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

llvm-svn: 364883

5 years ago[analyzer] exploded-graph-rewriter: Implement a dark color scheme.
Artem Dergachev [Tue, 2 Jul 2019 02:17:56 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Implement a dark color scheme.

Addresses a popular request. Activated via --dark.

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

llvm-svn: 364882

5 years ago[analyzer] exploded-graph-rewriter: Improve program point dumps.
Artem Dergachev [Tue, 2 Jul 2019 02:17:53 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Improve program point dumps.

- Take advantage of the stmt_point_kind.
- Dump block IDs for BlockEntrance nodes.
- Don't dump huge compound statements on PurgeDeadSymbols nodes.
- Rename Edge to BlockEdge for consistency.
- Tweak colors.

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

llvm-svn: 364881

5 years ago[analyzer] exploded-graph-rewriter: Add support for objects under construction.
Artem Dergachev [Tue, 2 Jul 2019 02:17:50 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Add support for objects under construction.

This trait is Environment-like, so there was a chance to re-use a lot of code.

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

llvm-svn: 364880

5 years agoMark the newly added '__libcpp_is_constant_evaluated' as 'inline', since it can be...
Marshall Clow [Tue, 2 Jul 2019 00:20:06 +0000 (00:20 +0000)]
Mark the newly added '__libcpp_is_constant_evaluated' as 'inline', since it can be included multiple times by multiple headers, and we don't want 'duplicate definition' errors.

llvm-svn: 364879

5 years agoRevert Remove scudo standalone tests from check-all
Reid Kleckner [Mon, 1 Jul 2019 23:53:16 +0000 (23:53 +0000)]
Revert Remove scudo standalone tests from check-all

This reverts r364877 (git commit dfae3705b75e6b5e1e163c78ab2df705a3388d89)

This didn't solve my problem so I've reverted it.

llvm-svn: 364878

5 years agoRemove scudo standalone tests from check-all
Reid Kleckner [Mon, 1 Jul 2019 23:29:59 +0000 (23:29 +0000)]
Remove scudo standalone tests from check-all

They appear to fail to link in various 32-bit configurations for unknown
reasons. This change was already reverted, and it seems preferable to me
to make forward progress and remove this once the problems are fully
understood.

llvm-svn: 364877

5 years agoRevert Recommit [PowerPC] Update P9 vector costs for insert/extract element
Jordan Rupprecht [Mon, 1 Jul 2019 23:29:46 +0000 (23:29 +0000)]
Revert Recommit [PowerPC] Update P9 vector costs for insert/extract element

This reverts r364557 (git commit 9f7f5858fe46b8e706e87a83e2fd0a2678be619e)

This crashes as reported on the commit thread. Repro instructions TBD.

llvm-svn: 364876

5 years ago[analyzer] Support kfree in MallocChecker
Nathan Huckleberry [Mon, 1 Jul 2019 23:29:10 +0000 (23:29 +0000)]
[analyzer] Support kfree in MallocChecker

Summary:
kmalloc is freed with kfree in the linux kernel. kmalloc support was
added in r204832, but kfree was not. Adding kfree fixes incorrectly
detected memory leaks.

Reviewers: NoQ, nickdesaulniers, dcoughlin, Szelethus

Reviewed By: NoQ, Szelethus

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, cfe-commits

Tags: #clang

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

llvm-svn: 364875

5 years ago[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.3
Julian Lettner [Mon, 1 Jul 2019 23:23:18 +0000 (23:23 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.3

Remove unnecessary computation of mangled SP for x86_64 architecture.

Reviewed By: dvyukov

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

llvm-svn: 364874

5 years agoAdd a private call '__libcpp_is_constant_evaluated' which 'works' for old language...
Marshall Clow [Mon, 1 Jul 2019 23:16:46 +0000 (23:16 +0000)]
Add a private call '__libcpp_is_constant_evaluated' which 'works' for old language versions and w/o any compiler support. 'Working', in this case, means that it returns false in those cases.

llvm-svn: 364873

5 years ago[cmake] With utils disabled, don't build tblgen in cross mode
Keno Fischer [Mon, 1 Jul 2019 23:15:07 +0000 (23:15 +0000)]
[cmake] With utils disabled, don't build tblgen in cross mode

Summary:
In cross mode, we build a separate NATIVE tblgen that runs on the
host and is used during the build. Separately, we have a flag that
disables building all executables in utils/. Of course generally,
this doesn't turn off tblgen, since we need that during the build.
In cross mode, however, that tblegen is useless since we never
actually use it. Furthermore, it can be actively problematic if the
cross toolchain doesn't like building executables for whatever reason.
And even if building executables works fine, we can at least save
compile time by omitting it from the target build. There's two changes
needed to make this happen:
- Stop creating a dependency from the native tool to the target tool.
  No such dependency is required for a correct build, so I'm not entirely
  sure why it was there in the first place.
- If utils were disabled on the CMake command line and we're in cross mode,
  respect that by excluding it from the install target (using EXCLUDE_FROM_ALL).

Reviewers: smeenai
Differential Revision: https://reviews.llvm.org/D64032

llvm-svn: 364872

5 years ago[analyzer] exploded-graph-rewriter: NFC: Add a forgotten test file.
Artem Dergachev [Mon, 1 Jul 2019 23:06:08 +0000 (23:06 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Add a forgotten test file.

This fell off of r364865.

llvm-svn: 364871

5 years ago[analyzer] Fix invalidation when returning into a ctor initializer.
Artem Dergachev [Mon, 1 Jul 2019 23:02:18 +0000 (23:02 +0000)]
[analyzer] Fix invalidation when returning into a ctor initializer.

Due to RVO the target region of a function that returns an object by
value isn't necessarily a temporary object region; it may be an
arbitrary memory region. In particular, it may be a field of a bigger
object.

Make sure we don't invalidate the bigger object when said function is
evaluated conservatively.

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

llvm-svn: 364870

5 years ago[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.
Artem Dergachev [Mon, 1 Jul 2019 23:02:14 +0000 (23:02 +0000)]
[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.

The NonnullGlobalConstants checker models the rule "it doesn't make sense
to make a constant global pointer and initialize it to null"; it makes sure
that whatever it's initialized with is known to be non-null.

Ironically, annotating the type of the pointer as _Nonnull breaks the checker.

Fix handling of the _Nonnull annotation so that it was instead one more reason
to believe that the value is non-null.

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

llvm-svn: 364869

5 years ago[analyzer] CStringChecker: Modernize to use CallDescriptions.
Artem Dergachev [Mon, 1 Jul 2019 23:02:10 +0000 (23:02 +0000)]
[analyzer] CStringChecker: Modernize to use CallDescriptions.

This patch uses the new CDF_MaybeBuiltin flag to handle C library functions.
It's mostly an NFC/refactoring pass, but it does fix a bug in handling memset()
when it expands to __builtin___memset_chk() because the latter has
one more argument and memset() handling code was trying to match
the exact number of arguments. Now the code is deduplicated and there's
less room for mistakes.

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

llvm-svn: 364868

5 years ago[analyzer] NFC: CallDescription: Implement describing C library functions.
Artem Dergachev [Mon, 1 Jul 2019 23:02:07 +0000 (23:02 +0000)]
[analyzer] NFC: CallDescription: Implement describing C library functions.

When matching C standard library functions in the checker, it's easy to forget
that they are often implemented as macros that are expanded to builtins.

Such builtins would have a different name, so matching the callee identifier
would fail, or may sometimes have more arguments than expected, so matching
the exact number of arguments would fail, but this is fine as long as we have
all the arguments that we need in their respective places.

This patch adds a set of flags to the CallDescription class so that to handle
various special matching rules, and adds the first flag into this set,
which enables a more fuzzy matching for functions that
may be implemented as compiler builtins.

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

llvm-svn: 364867

5 years ago[analyzer] NFC: Add a convenient CallDescriptionMap class.
Artem Dergachev [Mon, 1 Jul 2019 23:02:03 +0000 (23:02 +0000)]
[analyzer] NFC: Add a convenient CallDescriptionMap class.

It encapsulates the procedure of figuring out whether a call event
corresponds to a function that's modeled by a checker.

Checker developers no longer need to worry about performance of
lookups into their own custom maps.

Add unittests - which finally test CallDescription itself as well.

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

llvm-svn: 364866

5 years ago[analyzer] exploded-graph-rewriter: Add support for dynamic types.
Artem Dergachev [Mon, 1 Jul 2019 23:01:59 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Add support for dynamic types.

Slightly cleanup emission of horizontal lines and unhardcode the title
for generic maps.

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

llvm-svn: 364865

5 years ago[analyzer] exploded-graph-rewriter: Implement program point tags.
Artem Dergachev [Mon, 1 Jul 2019 23:01:55 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Implement program point tags.

Keep them on a separate line for more visibility.

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

llvm-svn: 364864

5 years agoUpdate status for bit operations
Marshall Clow [Mon, 1 Jul 2019 23:00:34 +0000 (23:00 +0000)]
Update status for bit operations

llvm-svn: 364863

5 years agoBit Operations: P0556, P0553 and P1355. Reviewed as: https://reviews.llvm.org/D51262
Marshall Clow [Mon, 1 Jul 2019 23:00:32 +0000 (23:00 +0000)]
Bit Operations: P0556, P0553 and P1355. Reviewed as: https://reviews.llvm.org/D51262

llvm-svn: 364862

5 years ago[PGO] Update ICP pass for recent byval type changes
Reid Kleckner [Mon, 1 Jul 2019 22:43:39 +0000 (22:43 +0000)]
[PGO] Update ICP pass for recent byval type changes

Fixes verifier errors encountered in PR42413.

Reviewers: xur, t.p.northover, inglorion, gbiv, george.burgess.iv

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

llvm-svn: 364861

5 years ago[lldb] [lldbsuite] Use a unique class name for TestValueVarUpdate
Stella Stamenova [Mon, 1 Jul 2019 22:12:55 +0000 (22:12 +0000)]
[lldb] [lldbsuite] Use a unique class name for TestValueVarUpdate

It looks like when this test was added, it was based on TestHelloWorld and it ended up with the same class name. This is an issue because the logs associated with the tests use the class name as the identifier for the file and if two tests have the same name their logs overwrite each other. On non-windows, this just means we lose one of the logs, but on Windows this means that one of the tests will fail occasionally because the file are locked by the other test.

llvm-svn: 364860

5 years agoAMDGPU: Correct properties for adjcallstack* pseudos
Matt Arsenault [Mon, 1 Jul 2019 22:01:05 +0000 (22:01 +0000)]
AMDGPU: Correct properties for adjcallstack* pseudos

These should be SALU writes, and these are lowered to instructions
that def SCC.

llvm-svn: 364859

5 years agoFix broken C++ mode comment
Matt Arsenault [Mon, 1 Jul 2019 22:00:59 +0000 (22:00 +0000)]
Fix broken C++ mode comment

llvm-svn: 364858

5 years ago[InstCombine][NFCI] Update test cases in onehot_merge.ll
Huihui Zhang [Mon, 1 Jul 2019 22:00:32 +0000 (22:00 +0000)]
[InstCombine][NFCI] Update test cases in onehot_merge.ll

Use both one bit and signbit shifting to check for one bit merge.

Reviewers: lebedev.ri, spatel, efriedma, craig.topper

Reviewed By: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 364857

5 years ago[InstCombine] reduce more checks for power-of-2-or-zero using ctpop
Sanjay Patel [Mon, 1 Jul 2019 22:00:00 +0000 (22:00 +0000)]
[InstCombine] reduce more checks for power-of-2-or-zero using ctpop

Extends the transform from:
rL364341
...to include another (more common?) pattern that tests whether a
value is a power-of-2 (including or excluding zero).

llvm-svn: 364856

5 years agoFix breakage introduced by D60974
JF Bastien [Mon, 1 Jul 2019 21:57:31 +0000 (21:57 +0000)]
Fix breakage introduced by D60974

D60974 added tests which incorrectly assume that llvm-readelf is available. This is a bad assumption, it should instead declare the dependency explicitly in the tests.

llvm-svn: 364855

5 years ago[Reproducer] Assert on unexpected packet
Jonas Devlieghere [Mon, 1 Jul 2019 21:25:34 +0000 (21:25 +0000)]
[Reproducer] Assert on unexpected packet

I'm not able to reproduce the reproducer flakiness we're seeing on
GreenDragon. I want to add this assert to find out if the GDB remote
packets are somehow getting out of sync when this happens.

llvm-svn: 364852

5 years ago[X86] Use v4i32 vzloads instead of v2i64 for vpmovzx/vpmovsx patterns where only...
Craig Topper [Mon, 1 Jul 2019 21:25:11 +0000 (21:25 +0000)]
[X86] Use v4i32 vzloads instead of v2i64 for vpmovzx/vpmovsx patterns where only 32-bits are loaded.

v2i64 vzload defines a 64-bit memory access. It doesn't look like
we have any coverage for this either way.

Also remove some vzload usages where the instruction loads only
16-bits.

llvm-svn: 364851

5 years ago[mips] Add missing schedinfo for MIPSeh_return[32|64] instructions
Simon Atanasyan [Mon, 1 Jul 2019 21:25:04 +0000 (21:25 +0000)]
[mips] Add missing schedinfo for MIPSeh_return[32|64] instructions

llvm-svn: 364850

5 years ago[mips] Add virtualization ASE to P5600 scheduling definitions
Simon Atanasyan [Mon, 1 Jul 2019 21:24:58 +0000 (21:24 +0000)]
[mips] Add virtualization ASE to P5600 scheduling definitions

llvm-svn: 364849

5 years ago[mips] Add missing schedinfo for LONG_BRANCH_* instructions
Simon Atanasyan [Mon, 1 Jul 2019 21:24:51 +0000 (21:24 +0000)]
[mips] Add missing schedinfo for LONG_BRANCH_* instructions

llvm-svn: 364848

5 years ago[X86] Remove several bad load folding isel patterns for VPMOVZX/VPMOVSX.
Craig Topper [Mon, 1 Jul 2019 21:23:38 +0000 (21:23 +0000)]
[X86] Remove several bad load folding isel patterns for VPMOVZX/VPMOVSX.

These patterns all matched a v2i64 vzload which only loads 64-bits
to instructions that load a full 128-bits.

llvm-svn: 364847

5 years agoRevert [SLP] Look-ahead operand reordering heuristic.
Jordan Rupprecht [Mon, 1 Jul 2019 21:10:43 +0000 (21:10 +0000)]
Revert [SLP] Look-ahead operand reordering heuristic.

This reverts r364478 (git commit 574cb0eb3a7ac95e62d223a60bef891171dfe321)

The patch is causing compilation timeouts.

llvm-svn: 364846

5 years ago[Core] Generalize ValueObject::IsRuntimeSupportValue
Alex Langford [Mon, 1 Jul 2019 20:36:33 +0000 (20:36 +0000)]
[Core] Generalize ValueObject::IsRuntimeSupportValue

Summary:
Instead of falling back to ObjCLanguageRuntime, we should be falling
back to every loaded language runtime. This makes ValueObject more
language agnostic.

Reviewers: labath, compnerd, JDevlieghere, davide

Subscribers: lldb-commits

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

llvm-svn: 364845

5 years ago[NFC][InstCombine] More commutative tests for "shift direction in bittest" (PR42466)
Roman Lebedev [Mon, 1 Jul 2019 20:33:56 +0000 (20:33 +0000)]
[NFC][InstCombine] More commutative tests for "shift direction in bittest" (PR42466)

'and' is commutative, if we don't want to touch shift-of-const,
we still need to check the other hand of 'and'.

llvm-svn: 364844

5 years agoTesting commit access through minor formatting change
Nilanjana Basu [Mon, 1 Jul 2019 20:27:37 +0000 (20:27 +0000)]
Testing commit access through minor formatting change

llvm-svn: 364843

5 years agoEnsure bitset's string constructor doesn't poison the overload set.
Eric Fiselier [Mon, 1 Jul 2019 19:59:34 +0000 (19:59 +0000)]
Ensure bitset's string constructor doesn't poison the overload set.

llvm-svn: 364842

5 years agoGlobalISel: Try to widen merges with other merges
Matt Arsenault [Mon, 1 Jul 2019 19:36:10 +0000 (19:36 +0000)]
GlobalISel: Try to widen merges with other merges

If the requested source type an be used as a merge source type, create
a merge of merges. This avoids creating large, illegal extensions and
bit-ops directly to the result type.

llvm-svn: 364841

5 years agoImplement P0646R1: Erase-Like Algorithms Should Return size_type. Reviewed as https...
Marshall Clow [Mon, 1 Jul 2019 19:22:00 +0000 (19:22 +0000)]
Implement P0646R1: Erase-Like Algorithms Should Return size_type. Reviewed as https://reviews.llvm.org/D58332, and then updated because I rewrote a couple of those routines to eliminate some UB. Thanks to Zoe for tghe patch.

llvm-svn: 364840

5 years agoAMDGPU: Revert accidental change to test
Matt Arsenault [Mon, 1 Jul 2019 19:09:57 +0000 (19:09 +0000)]
AMDGPU: Revert accidental change to test

llvm-svn: 364839

5 years ago[X86] Correct v4f32->v2i64 cvt(t)ps2(u)qq memory isel patterns
Craig Topper [Mon, 1 Jul 2019 19:01:37 +0000 (19:01 +0000)]
[X86] Correct v4f32->v2i64 cvt(t)ps2(u)qq memory isel patterns

These instructions only read 64-bits of memory so we shouldn't
allow a full vector width load to be pattern matched in case it
is marked volatile.

Instead allow vzload or scalar_to_vector+load.

Also add a DAG combine to turn full vector loads into vzload when
used by one of these instructions if the load isn't volatile.

This fixes another case for PR42079

llvm-svn: 364838

5 years agoFixed two issues in clang-tidy -help.
Alexander Kornienko [Mon, 1 Jul 2019 18:55:10 +0000 (18:55 +0000)]
Fixed two issues in clang-tidy -help.

HeaderFilter -> HeaderFilterRegex

llvm-svn: 364837

5 years agoAMDGPU/GlobalISel: Handle more input argument intrinsics
Matt Arsenault [Mon, 1 Jul 2019 18:50:50 +0000 (18:50 +0000)]
AMDGPU/GlobalISel: Handle more input argument intrinsics

llvm-svn: 364836

5 years agoAMDGPU/GlobalISel: Lower kernarg segment ptr intrinsics
Matt Arsenault [Mon, 1 Jul 2019 18:49:01 +0000 (18:49 +0000)]
AMDGPU/GlobalISel: Lower kernarg segment ptr intrinsics

llvm-svn: 364835

5 years agoAMDGPU/GlobalISel: Legalize workgroup ID intrinsics
Matt Arsenault [Mon, 1 Jul 2019 18:47:22 +0000 (18:47 +0000)]
AMDGPU/GlobalISel: Legalize workgroup ID intrinsics

llvm-svn: 364834

5 years agoAMDGPU/GlobalISel: Legalize workitem ID intrinsics
Matt Arsenault [Mon, 1 Jul 2019 18:45:36 +0000 (18:45 +0000)]
AMDGPU/GlobalISel: Legalize workitem ID intrinsics

Tests don't cover the masked input path since non-kernel arguments
aren't lowered yet.

Test is copied directly from the existing test, with 2 additions.

llvm-svn: 364833

5 years agoAMDGPU/GlobalISel: Custom lower control flow intrinsics
Matt Arsenault [Mon, 1 Jul 2019 18:40:23 +0000 (18:40 +0000)]
AMDGPU/GlobalISel: Custom lower control flow intrinsics

Replace the brcond for the 2 cases that act as branches. For now
follow how the current system works, although I think we can
eventually get rid of the pseudos.

llvm-svn: 364832

5 years agoAMDGPU/GlobalISel: Handle 16-bit SALU min/max
Matt Arsenault [Mon, 1 Jul 2019 18:33:37 +0000 (18:33 +0000)]
AMDGPU/GlobalISel: Handle 16-bit SALU min/max

This needs to be extended to s32, and expanded into cmp+select.  This
is relying on the fact that widenScalar happens to leave the
instruction in place, but this isn't a guaranteed property of
LegalizerHelper.

llvm-svn: 364831

5 years agoAMDGPU/GlobalISel: Lower SALU min/max to cmp+select
Matt Arsenault [Mon, 1 Jul 2019 18:30:45 +0000 (18:30 +0000)]
AMDGPU/GlobalISel: Lower SALU min/max to cmp+select

Use a change observer to apply a register bank to the newly created
intermediate result register.

llvm-svn: 364830

5 years ago[X86] Avoid SFB - Fix inconsistent codegen with/without debug info(2)
Robert Lougher [Mon, 1 Jul 2019 18:28:21 +0000 (18:28 +0000)]
[X86] Avoid SFB - Fix inconsistent codegen with/without debug info(2)

The function findPotentialBlockers may consider debug info instructions as
potential blockers and may stop searching for a store-load pair prematurely.

This patch corrects this and tests the cases where the store is separated
from the load by more than InspectionLimit debug instructions.

Patch by Chris Dawson.

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

llvm-svn: 364829

5 years agoAMDGPU/GlobalISel: Add tests for add legalization
Matt Arsenault [Mon, 1 Jul 2019 18:26:47 +0000 (18:26 +0000)]
AMDGPU/GlobalISel: Add tests for add legalization

llvm-svn: 364828

5 years agoAMDGPU/GlobalISel: Legalize s16 add/sub/mul
Matt Arsenault [Mon, 1 Jul 2019 18:18:55 +0000 (18:18 +0000)]
AMDGPU/GlobalISel: Legalize s16 add/sub/mul

If this is scalar, promote to s32. Use a new observer class to assign
the register bank of newly created registers.

llvm-svn: 364827

5 years ago[lldb] [lldbsuite] Use a unique class name for TestBacktraceAll
Stella Stamenova [Mon, 1 Jul 2019 18:13:20 +0000 (18:13 +0000)]
[lldb] [lldbsuite] Use a unique class name for TestBacktraceAll

It looks like when this test was added, it was based on TestBreakAfterJoin and it ended up with the same class name. This is an issue because the logs associated with the tests use the class name as the identifier for the file and if two tests have the same name their logs overwrite each other. On non-windows, this just means we lose one of the logs, but on Windows this means that one of the tests will fail occasionally because the file are locked by the other test.

llvm-svn: 364826

5 years agoAMDGPU/GlobalISel: Fix allowing non-boolean conditions for G_SELECT
Matt Arsenault [Mon, 1 Jul 2019 18:13:12 +0000 (18:13 +0000)]
AMDGPU/GlobalISel: Fix allowing non-boolean conditions for G_SELECT

The condition register bank must be scc or vcc so that a copy will be
inserted, which will be lowered to a compare.

Currently greedy unnecessarily forces using a VCC select.

llvm-svn: 364825

5 years ago[NFC][InstCombine] Add tests for "shift direction in bittest" (PR42466)
Roman Lebedev [Mon, 1 Jul 2019 18:11:32 +0000 (18:11 +0000)]
[NFC][InstCombine] Add tests for "shift direction in bittest" (PR42466)

https://rise4fun.com/Alive/8O1
https://bugs.llvm.org/show_bug.cgi?id=42466

llvm-svn: 364824

5 years ago[TSan] Fix initialized and declared ‘extern’ warning
Julian Lettner [Mon, 1 Jul 2019 18:06:31 +0000 (18:06 +0000)]
[TSan] Fix initialized and declared ‘extern’ warning

Avoid the following warning which fails a bot (via -Werror).

```
/tmp/gotsan.JfrpVPu7pG/gotsan.cc:10456:25: error: ‘_tsan_pointer_chk_guard’ initialized and declared ‘extern’ [-Werror]
extern "C" __tsan::uptr _tsan_pointer_chk_guard = 0;
                        ^~~~~~~~~~~~~~~~~~~~~~~
```

llvm-svn: 364823

5 years agoGlobalISel: Verify G_MERGE_VALUES operand sizes
Matt Arsenault [Mon, 1 Jul 2019 18:01:35 +0000 (18:01 +0000)]
GlobalISel: Verify G_MERGE_VALUES operand sizes

llvm-svn: 364822