platform/upstream/llvm.git
5 years ago[mips] Fix MIPS N32 ABI triples support
Simon Atanasyan [Mon, 17 Sep 2018 21:21:57 +0000 (21:21 +0000)]
[mips] Fix MIPS N32 ABI triples support

Add support mips64(el)-linux-gnuabin32 triples, and set them to N32.
Debian architecture name mipsn32/mipsn32el are also added. Set
UseIntegratedAssembler for N32 if we can detect it.

Patch by YunQiang Su.

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

llvm-svn: 342416

5 years ago[PDB] Make the native reader support enumerators.
Zachary Turner [Mon, 17 Sep 2018 21:08:11 +0000 (21:08 +0000)]
[PDB] Make the native reader support enumerators.

Previously we would dump the names of enum types, but not their
enumerator values.  This adds support for enumerator values.  In
doing so, we have to introduce a general purpose mechanism for
caching symbol indices of field list members.  Unlike global
types, FieldList members do not have a TypeIndex.  So instead,
we identify them by the pair {TypeIndexOfFieldList, IndexInFieldList}.

llvm-svn: 342415

5 years ago[PDB] Make the native reader support modified types.
Zachary Turner [Mon, 17 Sep 2018 21:07:48 +0000 (21:07 +0000)]
[PDB] Make the native reader support modified types.

Previously for cv-qualified types, we would just ignore them
and they would never get printed.  Now we can enumerate them
and cache them like any other symbol type.

llvm-svn: 342414

5 years ago[analyzer] ExplodedGraph printing fixes
George Karpenkov [Mon, 17 Sep 2018 20:46:53 +0000 (20:46 +0000)]
[analyzer] ExplodedGraph printing fixes

Fixes a number of issues:

 - Global variables are not used for communication
 - Trait should be defined on a graph, not on a node
 - Defining the trait on a graph allows us to use a correct allocator,
   no longer crashing while printing trimmed graphs

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

llvm-svn: 342413

5 years ago[MC] Avoid inlining constant symbols with variants.
Nirav Dave [Mon, 17 Sep 2018 20:34:26 +0000 (20:34 +0000)]
[MC] Avoid inlining constant symbols with variants.

Summary:
Defer unnecessary early inlining of constants to symbol
variants. Fixes PR38945.

Reviewers: nickdesaulniers, rnk

Subscribers: nemanjai, hiraditya, llvm-commits

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

llvm-svn: 342412

5 years ago[PPC64] Support relaxing R_PPC64_TLSGD16 in TlsGdtoLe relaxation.
Sean Fertile [Mon, 17 Sep 2018 20:27:02 +0000 (20:27 +0000)]
[PPC64] Support relaxing R_PPC64_TLSGD16 in TlsGdtoLe relaxation.

A General-dynamic tls access can be written using a R_PPC64_TLSGD16 relocation
if the target got entry is within 16 bits of the TOC-base. This patch adds
support for R_PPC64_TLSGD16 by relaxing it the same as a R_PPC64_GOT_TLSGD16_LO.

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

llvm-svn: 342411

5 years ago[PPC64] Helpers for read/write an instr while relocating a half16 type. [NFC]
Sean Fertile [Mon, 17 Sep 2018 20:27:00 +0000 (20:27 +0000)]
[PPC64] Helpers for read/write an instr while relocating a half16 type. [NFC]

There are a growing number of places when we either want to read or write an
instruction when handling a half16 relocation type. On big-endian the buffer
pointer is pointing into the middle of the word we want and on little-endian it
is pointing to the start of the word. These 2 helpers are to simplify reading
and writing in these contexts.

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

llvm-svn: 342410

5 years ago[analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.
Shuai Wang [Mon, 17 Sep 2018 20:10:56 +0000 (20:10 +0000)]
[analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.

Summary:
This is a follow up of D52008 and should make the analyzer being able to handle perfect forwardings in real world cases where forwardings are done through multiple layers of function calls with `std::forward`.

Fixes PR38891.

Reviewers: lebedev.ri, JonasToth, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits

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

llvm-svn: 342409

5 years agoFix build failure caused by D52157
Shuai Wang [Mon, 17 Sep 2018 20:10:33 +0000 (20:10 +0000)]
Fix build failure caused by D52157

llvm-svn: 342408

5 years ago[ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr
Shuai Wang [Mon, 17 Sep 2018 18:48:43 +0000 (18:48 +0000)]
[ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 342407

5 years ago[Loopinfo] Remove one latch-case in getLoopID. NFC.
Michael Kruse [Mon, 17 Sep 2018 18:40:29 +0000 (18:40 +0000)]
[Loopinfo] Remove one latch-case in getLoopID. NFC.

getLoopID has different control flow for two cases: If there is a
single loop latch and for any other number of loop latches (0 and more
than one). The latter case should return the same result if there is
only a single latch. We can save the preceding redundant search for a
latch by handling both cases with the same code.

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

llvm-svn: 342406

5 years ago[MachineOutliner][NFC] Don't map more illegal instrs than you have to
Jessica Paquette [Mon, 17 Sep 2018 18:40:21 +0000 (18:40 +0000)]
[MachineOutliner][NFC] Don't map more illegal instrs than you have to

We were mapping an instruction every time we saw something we couldn't map
before this. Since each illegal mapping is unique, we only have to do this once.

This makes it so that we don't map illegal instructions when the previous
mapped instruction was illegal.

In CTMark (AArch64), this results in 240 fewer instruction mappings on
average over 619 files in total. The largest improvement is 12576 fewer
mappings in one file, and the smallest is 0. The median improvement is 101
fewer mappings.

llvm-svn: 342405

5 years agoRevert "[IRInterpreter] Minor cleanups, add comments. NFCI."
Davide Italiano [Mon, 17 Sep 2018 18:14:38 +0000 (18:14 +0000)]
Revert "[IRInterpreter] Minor cleanups, add comments. NFCI."

This breaks buildbots.

llvm-svn: 342404

5 years ago[clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use FunctionPa...
Shuai Wang [Mon, 17 Sep 2018 17:59:51 +0000 (17:59 +0000)]
[clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use FunctionParmMutationAnalyzer instead.

Reviewers: alexfh, JonasToth, george.karpenkov

Subscribers: xazax.hun, kristof.beyls, chrib, a.sidorin, Szelethus, cfe-commits

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

llvm-svn: 342403

5 years ago[X86ISel] Implement byval lowering for Win64 calling convention
Keno Fischer [Mon, 17 Sep 2018 17:37:14 +0000 (17:37 +0000)]
[X86ISel] Implement byval lowering for Win64 calling convention

Summary:
The IR reference for the `byval` attribute states:

```
This indicates that the pointer parameter should really be passed by value
to the function. The attribute implies that a hidden copy of the pointee is
made between the caller and the callee, so the callee is unable to modify
the value in the caller. This attribute is only valid on LLVM pointer arguments.
```

However, on Win64, this attribute is unimplemented and the raw pointer is
passed to the callee instead. This is problematic, because frontend authors
relying on the implicit hidden copy (as happens for every other calling
convention) will see the passed value silently (if mutable memory) or
loudly (by means of a crash) modified because the callee treats the
location as scratch memory space it is allowed to mutate.

At this point, it's worth taking a step back to understand the context.
In most calling conventions, aggregates that are too large to be passed
in registers, instead get *copied* to the stack at a fixed (computable
from the signature) offset of the stack pointer. At the LLVM, we hide
this hidden copy behind the byval attribute. The caller passes a pointer
to the desired data and the callee receives a pointer, but these pointers
are not the same. In particular, the pointer that the callee receives
points to temporary stack memory allocated as part of the call lowering.
In most calling conventions, this pointer is never realized in registers
or memory. The temporary memory is simply defined by an implicit
offset from the stack pointer at function entry.

Win64, uniquely, works differently. The structure is still passed in
memory, but instead of being stored at an implicit memory offset, the
caller computes a pointer to the temporary memory and passes it to
the callee as a regular pointer (taking up a register, or if all
registers are taken up, an additional stack slot). Presumably, this
was done to allow eliding the copy when passing aggregates through
several functions on the stack.

This explains why ignoring the `byval` attribute mostly works on Win64.
The argument simply gets passed as a pointer and as long as we're ok
with the callee trampling all over that memory, there are no ill effects.
However, it does contradict the documentation of the `byval` attribute
which specifies that there is to be an implicit copy.

Frontends can of course work around this by never emitting the `byval`
attribute for Win64 and creating `alloca`s for the requisite temporary
stack slots (and that does appear to be what frontends are doing).
However, the presence of the `byval` attribute is not a trap for
frontend authors, since it seems to work, but silently modifies the
passed memory contrary to documentation.

I see two solutions:
- Disallow the `byval` attribute in the verifier if using the Win64
  calling convention.
- Make it work by simply emitting a temporary stack copy as we would
  with any other calling convention (frontends can of course always
  not use the attribute if they want to elide the copy).

This patch implements the second option (make it work), though I would
be fine with the first also.

Ref: https://github.com/JuliaLang/julia/issues/28338

Reviewers: rnk

Subscribers: llvm-commits

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

llvm-svn: 342402

5 years agolld-link: Also demangle undefined dllimported symbols.
Nico Weber [Mon, 17 Sep 2018 16:31:20 +0000 (16:31 +0000)]
lld-link: Also demangle undefined dllimported symbols.

dllimported symbols go through an import stub that's called __imp_ followed by
the name the stub points to. Make that work.

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

llvm-svn: 342401

5 years ago[AMDGPU] Initialize instruction itinerary from GCNSubtarget
Stanislav Mekhanoshin [Mon, 17 Sep 2018 16:04:32 +0000 (16:04 +0000)]
[AMDGPU] Initialize instruction itinerary from GCNSubtarget

I need to use it in the GCN codegen.

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

llvm-svn: 342400

5 years agoRevert "[DWARF] reposting r342048, which was reverted in r342056 due to buildbot...
Alexander Kornienko [Mon, 17 Sep 2018 15:40:01 +0000 (15:40 +0000)]
Revert "[DWARF] reposting r342048, which was reverted in r342056 due to buildbot errors. Adjusted 2 test cases for ARM and darwin and fixed a bug with the original change in dsymutil."

This reverts commit r342218. Due to a number of failures under TSAN. An isolated
test case is being worked on.

llvm-svn: 342399

5 years ago[CVP] Handle instructions with no user. No need to create CVPLattice state. This...
Xin Tong [Mon, 17 Sep 2018 15:28:01 +0000 (15:28 +0000)]
[CVP] Handle instructions with no user. No need to create CVPLattice state. This handles terminator instructions and more.

Summary:
I tested this patch by compiling sqlite3.ll (clang -O3 -mllvm -disable-llvm-optzns sqlite3.c.)

 opt -called-value-propagation sqlite3.ll -time-passes -f -o out.ll

 I get 10+% speedup for the pass. I expect some of the gain come from skipping terminator instructions.

    === BEFORE THE PATCH ===
    ===-------------------------------------------------------------------------===
                          ... Pass execution timing report ...
    ===-------------------------------------------------------------------------===
      Total Execution Time: 0.5562 seconds (0.5582 wall clock)

       ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
       0.2485 ( 46.4%)   0.0120 ( 57.7%)   0.2605 ( 46.8%)   0.2615 ( 46.8%)  Bitcode Writer
       0.1607 ( 30.0%)   0.0079 ( 37.7%)   0.1685 ( 30.3%)   0.1693 ( 30.3%)  Called Value Propagation
       0.1262 ( 23.6%)   0.0009 (  4.5%)   0.1271 ( 22.9%)   0.1275 ( 22.8%)  Module Verifier
       0.5353 (100.0%)   0.0209 (100.0%)   0.5562 (100.0%)   0.5582 (100.0%)  Total

    === AFTER THE PATCH ===
    ===-------------------------------------------------------------------------===
                          ... Pass execution timing report ...
    ===-------------------------------------------------------------------------===
      Total Execution Time: 0.5338 seconds (0.5355 wall clock)

       ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
       0.2498 ( 48.6%)   0.0118 ( 59.3%)   0.2615 ( 49.0%)   0.2629 ( 49.1%)  Bitcode Writer
       0.1377 ( 26.8%)   0.0075 ( 37.8%)   0.1452 ( 27.2%)   0.1455 ( 27.2%)  Called Value Propagation
       0.1264 ( 24.6%)   0.0006 (  3.0%)   0.1270 ( 23.8%)   0.1271 ( 23.7%)  Module Verifier
       0.5139 (100.0%)   0.0199 (100.0%)   0.5338 (100.0%)   0.5355 (100.0%)  Total

Reviewers: davide, mssimpso

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 342398

5 years agoRevert "Revert r342183 "[DAGCombine] Fix crash when store merging created an extract_...
Amara Emerson [Mon, 17 Sep 2018 14:40:13 +0000 (14:40 +0000)]
Revert "Revert r342183 "[DAGCombine] Fix crash when store merging created an extract_subvector with invalid index.""

Fixed the assertion failure.

llvm-svn: 342397

5 years ago[DebugInfo] Remove redundant argument. [NFC]
Jonas Devlieghere [Mon, 17 Sep 2018 14:23:47 +0000 (14:23 +0000)]
[DebugInfo] Remove redundant argument. [NFC]

Removes the redundant UnitType parameter from verifyUnitContents. I also
fixed  some formatting issues as I was touching the file.

llvm-svn: 342396

5 years ago[ARM] Cleanup ARM CGP isSupportedValue
Sam Parker [Mon, 17 Sep 2018 13:57:39 +0000 (13:57 +0000)]
[ARM] Cleanup ARM CGP isSupportedValue

isSupportedValue explicitly checked and accepted many types of value,
primarily for debugging reasons. Remove most of these checks and do a
bit of refactoring now that the pass is more stable. This also enables
ZExts to be sources, but this has very little practical benefit at the
moment extend instructions will still be introduced.

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

llvm-svn: 342395

5 years agoFix "not all control paths return a value" MSVC warning. NFCI.
Simon Pilgrim [Mon, 17 Sep 2018 13:56:42 +0000 (13:56 +0000)]
Fix "not all control paths return a value" MSVC warning. NFCI.

llvm-svn: 342394

5 years ago[clang-tidy] fix PR37913, templated exception factory diagnosed correctly
Jonas Toth [Mon, 17 Sep 2018 13:55:10 +0000 (13:55 +0000)]
[clang-tidy] fix PR37913, templated exception factory diagnosed correctly

Summary:
PR37913 documents wrong behaviour for a templated exception factory function.
The check does misidentify dependent types as not derived from std::exception.

The fix to this problem is to ignore dependent types, the analysis works correctly
on the instantiated function.

Reviewers: aaron.ballman, alexfh, hokein, ilya-biryukov

Reviewed By: alexfh

Subscribers: lebedev.ri, nemanjai, mgorny, kbarton, xazax.hun, cfe-commits

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

llvm-svn: 342393

5 years ago[ARM] Disallow icmp with negative imm and overflow
Sam Parker [Mon, 17 Sep 2018 13:48:25 +0000 (13:48 +0000)]
[ARM] Disallow icmp with negative imm and overflow

We allow overflowing instructions if they're decreasing and only used
by an unsigned compare. Add the extra condition that the icmp cannot
be using a negative immediate.

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

llvm-svn: 342392

5 years ago[UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that it can...
Dan Liew [Mon, 17 Sep 2018 13:33:44 +0000 (13:33 +0000)]
[UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that it can run on devices.

Summary:
In order for this test to work the log file needs to be removed from both
from the host and device. To fix this the `rm` `RUN` lines have been
replaced with `RUN: rm` followed by `RUN: %device_rm`.

Initially I tried having it so that `RUN: %run rm` implicitly runs `rm`
on the host as well so that only one `RUN` line is needed. This
simplified writing the test however that had two large drawbacks.

* It's potentially very confusing (e.g. for use of the device scripts outside
  of the lit tests) if asking for `rm` to run on device also causes files
  on the host to be deleted.

* This doesn't work well with the glob patterns used in the test.
  The host shell expands the `%t.log.*` glob pattern and not on the
  device so we could easily miss deleting old log files from previous
  test runs if the corresponding file doesn't exist on the host.

So instead deletion of files on the device and host are explicitly
separate commands.

The command to delete files from a device is provided by a new
substitution `%device_rm` as suggested by Filipe Cabecinhas.

The semantics of `%device_rm` are that:

* It provides a way remove files from a target device when
 the host is not the same as the target. In the case that the
 host and target are the same it is a no-op.

* It interprets shell glob patterns in the context of the device
  file system instead of the host file system.
  This solves the globbing problem provided the argument is quoted so
  that lit's underlying shell doesn't try to expand the glob pattern.

* It supports the `-r` and `-f` flags of the `rm` command,
  with the same semantics.

Right now an implementation of `%device_rm` is provided only for
ios devices. For all other devices a lit warning is emitted and
the `%device_rm` is treated as a no-op. This done to avoid changing
the behaviour for other device types but leaves room for others
to implement `%device_rm`.

The ios device implementation uses the `%run` wrapper to do the work
of removing files on a device.

The `iossim_run.py` script has been fixed so that it just runs `rm`
on the host operating system because the device and host file system
are the same.

rdar://problem/41126835

Reviewers: vsk, kubamracek, george.karpenkov, eugenis

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 342391

5 years agoFix vectorization of canonicalize
Matt Arsenault [Mon, 17 Sep 2018 13:24:30 +0000 (13:24 +0000)]
Fix vectorization of canonicalize

llvm-svn: 342390

5 years agoFix
Idriss Riouak [Mon, 17 Sep 2018 12:58:19 +0000 (12:58 +0000)]
Fix

llvm-svn: 342389

5 years ago[Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains about variabl...
Idriss Riouak [Mon, 17 Sep 2018 12:29:29 +0000 (12:29 +0000)]
[Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains about variable cast to void

Summary:
Hello, i would like to suggest a fix for one of the checks in clang-tidy.The bug was reported in https://bugs.llvm.org/show_bug.cgi?id=32575 where you can find more information.

For example:
```
template <typename T0>
struct S {
  template <typename T>
  void g() const {
    int a;
    (void)a;
  }
};

void f() {
  S<int>().g<int>();
}
```

this piece of code should not trigger any warning by the check modernize-redundant-void-arg but when we execute the following command

```
clang_tidy -checks=-*,modernize-redundant-void-arg test.cpp -- -std=c++11
```

we obtain the following warning:

/Users/eco419/Desktop/clang-tidy.project/void-redundand_2/test.cpp:6:6: warning: redundant void argument list in function declaration [modernize-redundant-void-arg]
    (void)a;
     ^~~~

Reviewers: aaron.ballman, hokein, alexfh, JonasToth

Reviewed By: aaron.ballman, JonasToth

Subscribers: JonasToth, lebedev.ri, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 342388

5 years ago[GVNHoist] Re-enable GVNHoist by default
Alexandros Lamprineas [Mon, 17 Sep 2018 12:24:55 +0000 (12:24 +0000)]
[GVNHoist] Re-enable GVNHoist by default

Rebase rL341954 since https://bugs.llvm.org/show_bug.cgi?id=38912
has been fixed by rL342055.

Precommit testing performed:
* Overnight runs of csmith comparing the output between programs
  compiled with gvn-hoist enabled/disabled.
* Bootstrap builds of clang with UbSan/ASan configurations.

llvm-svn: 342387

5 years agoUse createTemporaryFile in SampleProfTest
Alexander Kornienko [Mon, 17 Sep 2018 12:11:01 +0000 (12:11 +0000)]
Use createTemporaryFile in SampleProfTest

Create a temporary file in the system temporary directory instead of creating a
file in the current directory, which may be not writable. (Fix for an issue
introduced in r342283.)

llvm-svn: 342386

5 years agoAdd descriptions to completed expressions
Raphael Isemann [Mon, 17 Sep 2018 12:06:07 +0000 (12:06 +0000)]
Add descriptions to completed expressions

Summary:
Completing inside the expression command now uses the new description API
to also provide additional information to the user. For now this information
are the types of variables/fields and the signatures of completed function calls.

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 342385

5 years ago[ASTImporter] Fix import of VarDecl init
Gabor Marton [Mon, 17 Sep 2018 12:04:52 +0000 (12:04 +0000)]
[ASTImporter] Fix import of VarDecl init

Summary:
The init expression of a VarDecl is overwritten in the "To" context if we
import a VarDecl without an init expression (and with a definition).  Please
refer to the added tests, especially InitAndDefinitionAreInDifferentTUs.  This
patch fixes the malfunction by importing the whole Decl chain similarly as we
did that in case of FunctionDecls.  We handle the init expression similarly to
a  definition, alas only one init expression will be in the merged ast.

Reviewers: a_sidorin, xazax.hun, r.stahl, a.sidorin

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 342384

5 years ago[OpenCL] Allow blocks to capture arrays in OpenCL
Andrew Savonichev [Mon, 17 Sep 2018 11:19:42 +0000 (11:19 +0000)]
[OpenCL] Allow blocks to capture arrays in OpenCL

Summary: Patch by Egor Churaev

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: asavonic, bader, cfe-commits

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

llvm-svn: 342370

5 years ago[llvm-exegesis] Add predefined floating point values so we can test impact of special...
Guillaume Chatelet [Mon, 17 Sep 2018 11:09:32 +0000 (11:09 +0000)]
[llvm-exegesis] Add predefined floating point values so we can test impact of special values on latency.

Summary: This will be useful to generate many configurations and test instruction regimes (NaN, Inf, subnormal, normal).

Reviewers: courbet

Subscribers: mgorny, tschuett, llvm-commits

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

llvm-svn: 342369

5 years ago[PowerPC] Fix label address calculation for ppc64
Strahinja Petrovic [Mon, 17 Sep 2018 11:03:40 +0000 (11:03 +0000)]
[PowerPC] Fix label address calculation for ppc64

This patch fixes calculating address of label for non-pic ppc64.

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

llvm-svn: 342368

5 years agoMerge two attribute diagnostics into one
Andrew Savonichev [Mon, 17 Sep 2018 10:39:46 +0000 (10:39 +0000)]
Merge two attribute diagnostics into one

Summary:
Merged the recently added `err_attribute_argument_negative` diagnostic
with existing `err_attribute_requires_positive_integer` diagnostic:
the former allows only strictly positive integer, while the latter
also allows zero.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 342367

5 years agoReland r342233: [ThinLTO] Allow setting of maximum cache size with 64-bit number
James Henderson [Mon, 17 Sep 2018 10:21:26 +0000 (10:21 +0000)]
Reland r342233: [ThinLTO] Allow setting of maximum cache size with 64-bit number

The original was reverted due to an apparent build-bot test failure,
but it looks like this is just a flaky test.

Also added a C-interface function for large values, and updated
llvm-lto's --thinlto-cache-max-size-bytes switch to take a type larger
than int.

The maximum cache size in terms of bytes is a 64-bit number. However,
the methods to set it only took unsigned previously, which meant that
the maximum cache size could not be specified above 4GB. That's quite
small compared to the output of some projects, so it makes sense to
provide the ability to set larger values in that field.

We also needed a C-interface function that provides a greater range
than the existing thinlto_codegen_set_cache_size_bytes, which also only
takes an unsigned, so this change also adds
hinlto_codegen_set_cache_size_megabytes.

Reviewed by: mehdi_amini, tejohnson, steven_wu

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

llvm-svn: 342366

5 years ago[Analyzer] Define and use diff_plist in tests, NFC
Mikhail Maltsev [Mon, 17 Sep 2018 10:19:46 +0000 (10:19 +0000)]
[Analyzer] Define and use diff_plist in tests, NFC

This patch defines a new substitution and uses it to reduce
duplication in the Clang Analyzer test cases.

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

llvm-svn: 342365

5 years ago[llvm-objcopy] Add missing alias for --strip-all-gnu
Alexander Shaposhnikov [Mon, 17 Sep 2018 09:45:12 +0000 (09:45 +0000)]
[llvm-objcopy] Add missing alias for --strip-all-gnu

This diff adds -S as an alias for --strip-all-gnu
(for compatibility with binutils' objcopy).

Patch by Dmitry Golovin!

Test plan: make check-all

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

llvm-svn: 342364

5 years ago[clang-Format] Fix indentation of member call after block
Ilya Biryukov [Mon, 17 Sep 2018 07:46:20 +0000 (07:46 +0000)]
[clang-Format] Fix indentation of member call after block

Summary:
before patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
  ([]() -> {
    int b = 32;
    return 3;
  })
      .as();
});
```

after patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
  ([]() -> {
    int b = 32;
    return 3;
  }).as();
});
```

Patch by Anders Karlsson (ank)!

Reviewers: klimek

Reviewed By: klimek

Subscribers: danilaml, acoomans, klimek, cfe-commits

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

llvm-svn: 342363

5 years ago[clangd] Get rid of AST matchers in SymbolCollector. NFC
Eric Liu [Mon, 17 Sep 2018 07:43:49 +0000 (07:43 +0000)]
[clangd] Get rid of AST matchers in SymbolCollector. NFC

Reviewers: ilya-biryukov, kadircet

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 342362

5 years agoFix typo
Fangrui Song [Mon, 17 Sep 2018 07:40:42 +0000 (07:40 +0000)]
Fix typo

llvm-svn: 342361

5 years ago[NFC] Turn unsigned counters into boolean flags
Max Kazantsev [Mon, 17 Sep 2018 06:33:29 +0000 (06:33 +0000)]
[NFC] Turn unsigned counters into boolean flags

llvm-svn: 342360

5 years agoscan-build: Add support of the option --exclude like in scan-build-py
Sylvestre Ledru [Mon, 17 Sep 2018 06:31:46 +0000 (06:31 +0000)]
scan-build: Add support of the option --exclude like in scan-build-py

Summary:
To exclude thirdparty code.

To test:
With /tmp/foo.c

```
void test() {
    int x;
    x = 1; // warn
}
```

```
$ scan-build --exclude non-existing/  --exclude /tmp/ -v gcc -c foo.c

scan-build: Using '/usr/lib/llvm-7/bin/clang' for static analysis
scan-build: Emitting reports for this run to '/tmp/scan-build-2018-09-16-214531-8410-1'.
foo.c:3:3: warning: Value stored to 'x' is never read
  x = 1; // warn
  ^   ~
1 warning generated.
scan-build: File '/tmp/foo.c' deleted: part of an ignored directory.
scan-build: 0 bugs found.
```

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: whisperity, cfe-commits

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

llvm-svn: 342359

5 years ago[Lexer] Add xray_instrument feature
Petr Hosek [Mon, 17 Sep 2018 05:25:47 +0000 (05:25 +0000)]
[Lexer] Add xray_instrument feature

This can be used to detect whether the code is being built with XRay
instrumentation using the __has_feature(xray_instrument) predicate.

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

llvm-svn: 342358

5 years ago[sanitizer_common] Fuchsia now supports .preinit_array
Petr Hosek [Mon, 17 Sep 2018 05:22:26 +0000 (05:22 +0000)]
[sanitizer_common] Fuchsia now supports .preinit_array

Support for .preinit_array has been implemented in Fuchsia's libc,
add Fuchsia to the list of platforms that support this feature.

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

llvm-svn: 342357

5 years ago[XRay] Simplify FDR buffer management
Dean Michael Berris [Mon, 17 Sep 2018 03:09:01 +0000 (03:09 +0000)]
[XRay] Simplify FDR buffer management

Summary:
This change makes XRay FDR mode use a single backing store for the
buffer queue, and have indexes into that backing store instead. We also
remove the reliance on the internal allocator implementation in the FDR
mode logging implementation.

In the process of making this change we found an inconsistency with the
way we're returning buffers to the queue, and how we're setting the
extents. We take the chance to simplify the way we're managing the
extents of each buffer. It turns out we do not need the indirection for
the extents, so we co-host the atomic 64-bit int with the buffer object.
It also seems that we've not been returning the buffers for the thread
running the flush functionality when writing out the files, so we can
run into a situation where we could be missing data.

We consolidate all the allocation routines now into xray_allocator.h,
where we used to have routines defined in xray_buffer_queue.cc.

Reviewers: mboerger, eizan

Subscribers: jfb, llvm-commits

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

llvm-svn: 342356

5 years ago[XRay] Fix FDR initialization
Dean Michael Berris [Mon, 17 Sep 2018 02:49:17 +0000 (02:49 +0000)]
[XRay] Fix FDR initialization

Follow-up to D51606.

llvm-svn: 342355

5 years ago[DebugInfo] Fix build when std::vector::iterator is a pointer
Kristina Brooks [Sun, 16 Sep 2018 22:21:59 +0000 (22:21 +0000)]
[DebugInfo] Fix build when std::vector::iterator is a pointer

std::vector::iterator type may be a pointer, then
iterator::value_type fails to compile since iterator is not a class,
namespace, or enumeration.

Patch by orivej (Orivej Desh)

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

llvm-svn: 342354

5 years ago[NFC] Minor refactoring to setup the stage for supporting pointers in ExprMutationAna...
Shuai Wang [Sun, 16 Sep 2018 21:09:50 +0000 (21:09 +0000)]
[NFC] Minor refactoring to setup the stage for supporting pointers in ExprMutationAnalyzer

llvm-svn: 342353

5 years ago[X86][SSE] Always enable ISD::SRL -> ISD::MULHU for v8i16
Simon Pilgrim [Sun, 16 Sep 2018 20:28:38 +0000 (20:28 +0000)]
[X86][SSE] Always enable ISD::SRL -> ISD::MULHU for v8i16

For constant non-uniform cases we'll never introduce more and/andn/or selects than already occur in generic pre-SSE41 ISD::SRL lowering.

llvm-svn: 342352

5 years agoscan-build: remove trailing whitespaces
Sylvestre Ledru [Sun, 16 Sep 2018 19:51:16 +0000 (19:51 +0000)]
scan-build: remove trailing whitespaces

llvm-svn: 342351

5 years agoAlso manages clang-X as tool for scan-build
Sylvestre Ledru [Sun, 16 Sep 2018 19:36:59 +0000 (19:36 +0000)]
Also manages clang-X as tool for scan-build

Summary:
This will make
scan-build-7 clang-7 -c foo.c &> /dev/null

Reviewers: jroelofs

Subscribers: kristina, cfe-commits

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

llvm-svn: 342350

5 years ago[X86][AVX] Enable ISD::SRL -> ISD::MULHU for v16i16
Simon Pilgrim [Sun, 16 Sep 2018 19:20:47 +0000 (19:20 +0000)]
[X86][AVX] Enable ISD::SRL -> ISD::MULHU for v16i16

Now that rL340913 has landed with improved v16i16 selects as shuffles.

llvm-svn: 342349

5 years ago[DAGCombiner] try to convert pow(x, 1/3) to cbrt(x)
Sanjay Patel [Sun, 16 Sep 2018 16:50:26 +0000 (16:50 +0000)]
[DAGCombiner] try to convert pow(x, 1/3) to cbrt(x)

This is a follow-up suggested in D51630 and originally proposed as an IR transform in D49040.

Copying the motivational statement by @evandro from that patch:
"This transformation helps some benchmarks in SPEC CPU2000 and CPU2006, such as 188.ammp,
447.dealII, 453.povray, and especially 300.twolf, as well as some proprietary benchmarks.
Otherwise, no regressions on x86-64 or A64."

I'm proposing to add only the minimum support for a DAG node here. Since we don't have an
LLVM IR intrinsic for cbrt, and there are no other DAG ways to create a FCBRT node yet, I
don't think we need to worry about DAG builder, legalization, a strict variant, etc. We
should be able to expand as needed when adding more functionality/transforms. For reference,
these are transform suggestions currently listed in SimplifyLibCalls.cpp:

//   * cbrt(expN(X))  -> expN(x/3)
//   * cbrt(sqrt(x))  -> pow(x,1/6)
//   * cbrt(cbrt(x))  -> pow(x,1/9)

Also, given that we bail out on long double for now, there should not be any logical
differences between platforms (unless there's some platform out there that has pow()
but not cbrt()).

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

llvm-svn: 342348

5 years ago[x86] fix uses check in broadcast transform (PR38949)
Sanjay Patel [Sun, 16 Sep 2018 15:41:56 +0000 (15:41 +0000)]
[x86] fix uses check in broadcast transform (PR38949)

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

It's not clear to me that we even need a one-use check in this fold.
Ie, 2 independent loads might be better than a load+dependent shuffle.

Note that the existing re-use tests are not affected. We actually do form a
broadcast node in those tests now because there's no extra use of the
insert_subvector node in those cases. But something later in isel pattern
matching decides that it is not worth using a broadcast for the full load in
those tests:

Legalized selection DAG: %bb.0 'test_broadcast_2f64_4f64_reuse:'
  t7: v2f64,ch = load<(load 16 from %ir.p0)> t0, t2, undef:i64
      t4: i64,ch = CopyFromReg t0, Register:i64 %1
    t10: ch = store<(store 16 into %ir.p1)> t7:1, t7, t4, undef:i64
      t18: v4f64 = insert_subvector undef:v4f64, t7, Constant:i64<0>
    t20: v4f64 = insert_subvector t18, t7, Constant:i64<2>

Becomes:
  t7: v2f64,ch = load<(load 16 from %ir.p0)> t0, t2, undef:i64
      t4: i64,ch = CopyFromReg t0, Register:i64 %1
    t10: ch = store<(store 16 into %ir.p1)> t7:1, t7, t4, undef:i64
    t21: v4f64 = X86ISD::SUBV_BROADCAST t7

ISEL: Starting selection on root node: t21: v4f64 = X86ISD::SUBV_BROADCAST t7
...
  Created node: t27: v4f64 = INSERT_SUBREG IMPLICIT_DEF:v4f64, t7, TargetConstant:i32<7>
  Morphed node: t21: v4f64 = VINSERTF128rr t27, t7, TargetConstant:i8<1>

llvm-svn: 342347

5 years ago[x86] add failure to splat test (PR38949); NFC
Sanjay Patel [Sun, 16 Sep 2018 14:59:04 +0000 (14:59 +0000)]
[x86] add failure to splat test (PR38949); NFC

llvm-svn: 342346

5 years ago[NFC][InstCombine] One more test pattern for comparisons with low-bit-mask.
Roman Lebedev [Sun, 16 Sep 2018 12:51:09 +0000 (12:51 +0000)]
[NFC][InstCombine] One more test pattern for comparisons with low-bit-mask.

https://rise4fun.com/Alive/UGzE <- non-canonical, but has extra uses.

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

llvm-svn: 342345

5 years agoFix -Wdangling-else gcc warning. NFCI.
Simon Pilgrim [Sun, 16 Sep 2018 12:30:41 +0000 (12:30 +0000)]
Fix -Wdangling-else gcc warning. NFCI.

llvm-svn: 342344

5 years ago[NFC][InstCombine] Some more tests for comparisons with low-bit-mask.
Roman Lebedev [Sun, 16 Sep 2018 08:05:06 +0000 (08:05 +0000)]
[NFC][InstCombine] Some more tests for comparisons with low-bit-mask.

https://bugs.llvm.org/show_bug.cgi?id=38123
https://bugs.llvm.org/show_bug.cgi?id=38708

llvm-svn: 342343

5 years ago[ELF] Use llvm::toLower instead of libc call tolower
Fangrui Song [Sat, 15 Sep 2018 23:59:13 +0000 (23:59 +0000)]
[ELF] Use llvm::toLower instead of libc call tolower

tolower() has some overhead because current locale is considered (though in lld the default "C" locale is used which does not matter too much). llvm::toLower is more efficient as it compiles to a compare and a conditional jump, as opposed to a libc call if tolower is used.

Disregarding locale also matches gdb's behavior (gdb/minsyms.h):

    #define SYMBOL_HASH_NEXT(hash, c) \
      ((hash) * 67 + TOLOWER ((unsigned char) (c)) - 113)

where TOLOWER (include/safe-ctype.h) is a macro that uses a lookup table under the hood which is similar to llvm::toLower.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 342342

5 years agoconfigure: Rework support for gfx9+ devices that were added post LLVM 3.9
Jan Vesely [Sat, 15 Sep 2018 22:02:01 +0000 (22:02 +0000)]
configure: Rework support for gfx9+ devices that were added post LLVM 3.9

v2: Fix reference to Vega12/20 enabling commit

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 342341

5 years ago[NFC] cosmetic tweaks to ExprMutationAnalyzer to be more consistent
Shuai Wang [Sat, 15 Sep 2018 21:38:18 +0000 (21:38 +0000)]
[NFC] cosmetic tweaks to ExprMutationAnalyzer to be more consistent
especially considering future changes.

llvm-svn: 342340

5 years ago[llvm-readobj] Make some commonly used short options visibile in -help
Fangrui Song [Sat, 15 Sep 2018 21:27:46 +0000 (21:27 +0000)]
[llvm-readobj] Make some commonly used short options visibile in -help

For people who use llvm-readelf as a replacement of GNU readelf, they would like to see -d -r ... listed in llvm-readelf -help. It also helps understanding the confusing -s (which is unfortunately different in semantics).

Reviewers: phosek, ruiu, echristo

Reviewed By: ruiu, echristo

Subscribers: llvm-commits

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

llvm-svn: 342339

5 years ago.travis: Add llvm-7 build
Jan Vesely [Sat, 15 Sep 2018 20:00:37 +0000 (20:00 +0000)]
.travis: Add llvm-7 build

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 342338

5 years ago.travis: Use source whitelist alias for llvm-6 repository
Jan Vesely [Sat, 15 Sep 2018 20:00:12 +0000 (20:00 +0000)]
.travis: Use source whitelist alias for llvm-6 repository

Fixes issue with unauthenticated packages.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry

llvm-svn: 342337

5 years agoRevert r342148 (and follow-on fix attempts r342154, r342180, r342182, r342193)
Nico Weber [Sat, 15 Sep 2018 19:04:27 +0000 (19:04 +0000)]
Revert r342148 (and follow-on fix attempts r342154, r342180, r342182, r342193)

Many bots buildling with make have been broken for several days, e.g.
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13

llvm-svn: 342336

5 years ago[InstCombine] Support (sub (sext x), (sext y)) --> (sext (sub x, y)) and (sub (zext...
Craig Topper [Sat, 15 Sep 2018 18:54:10 +0000 (18:54 +0000)]
[InstCombine] Support (sub (sext x), (sext y)) --> (sext (sub x, y)) and (sub (zext x), (zext y)) --> (zext (sub x, y))

Summary:
If the sub doesn't overflow in the original type we can move it above the sext/zext.

This is similar to what we do for add. The overflow checking for sub is currently weaker than add, so the test cases are constructed for what is supported.

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342335

5 years agolld-link: Set PDB GUID to hash of PDB contents instead of to a random byte sequence.
Nico Weber [Sat, 15 Sep 2018 18:37:22 +0000 (18:37 +0000)]
lld-link: Set PDB GUID to hash of PDB contents instead of to a random byte sequence.

Previously, lld-link would use a random byte sequence as the PDB GUID. Instead,
use a hash of the PDB file contents.

To not disturb llvm-pdbutil pdb2yaml, the hash generation is an opt-in feature
on InfoStreamBuilder and ldb/COFF/PDB.cpp always sets it.

Since writing the PDB computes this ID which also goes in the exe, the PDB
writing code now must be called before writeBuildId(). writeBuildId() for that
reason is no longer included in the "Code Layout" timer.

Since the PDB GUID is now a function of the PDB contents, the PDB Age is always
set to 1. There was a long comment above loadExistingBuildId (now gone) about
how not changing the GUID and only incrementing the age was important, but
according to the discussion in PR35914 that comment was incorrect.

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

llvm-svn: 342334

5 years agoGive InfoStreamBuilder an opt-in method to write a hash of the PDB as GUID.
Nico Weber [Sat, 15 Sep 2018 18:35:51 +0000 (18:35 +0000)]
Give InfoStreamBuilder an opt-in method to write a hash of the PDB as GUID.

Naively computing the hash after the PDB data has been generated is in practice
as fast as other approaches I tried. I also tried online-computing the hash as
parts of the PDB were written out (https://reviews.llvm.org/D51887; that's also
where all the measuring data is) and computing the hash in parallel
(https://reviews.llvm.org/D51957). This approach here is simplest, without
being slower.

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

llvm-svn: 342333

5 years agolld-link: print demangled symbol names for "undefined symbol" diagnostics
Nico Weber [Sat, 15 Sep 2018 18:27:09 +0000 (18:27 +0000)]
lld-link: print demangled symbol names for "undefined symbol" diagnostics

For this, add a few toString() calls when printing the "undefined symbol"
diagnostics; toString() already does demangling on Windows hosts.

Also make lld::demangleMSVC() (called by toString(Symbol*)) call LLVM's
microsoftDemangle() instead of UnDecorateSymbolName() so that it works on
non-Windows hosts – this makes both updating tests easier and provides a better
user experience for people doing cross-links.

This doesn't yet do the right thing for symbols starting with __imp_, but that
can be improved in a follow-up.

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

llvm-svn: 342332

5 years agoMerge Demangle change in r342330 to libcxxabi.
Nico Weber [Sat, 15 Sep 2018 18:25:49 +0000 (18:25 +0000)]
Merge Demangle change in r342330 to libcxxabi.

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

llvm-svn: 342331

5 years agoUpdate microsoftDemangle() to work more like itaniumDemangle().
Nico Weber [Sat, 15 Sep 2018 18:24:20 +0000 (18:24 +0000)]
Update microsoftDemangle() to work more like itaniumDemangle().

* Use same method of initializing the output stream and its buffer
* Allow a nullptr Status pointer
* Don't print the mangled name on demangling error
* Write to N (if it is non-nullptr)

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

llvm-svn: 342330

5 years ago[lldb-mi] Correct regex in the symbol-list-lines test
Alexander Polyakov [Sat, 15 Sep 2018 17:05:20 +0000 (17:05 +0000)]
[lldb-mi] Correct regex in the symbol-list-lines test

Summary:
The test failed in case of compiling a test suite with
gcc (checked versions are 5.2.0 and 7.3.0) because it
adds one more line entry comparing to clang. It doesn't
break the test's logic, so I just added a regex that matches
this case.

Reviewers: tatyana-krasnukha, aprantl, clayborg

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 342329

5 years ago[X86][SSE] Fix insertps load combine test name
Simon Pilgrim [Sat, 15 Sep 2018 16:57:04 +0000 (16:57 +0000)]
[X86][SSE] Fix insertps load combine test name

The existing test was called extract_lane_insertps_5123 but it was in fact doing a <6,1,2,3> shuffle. I've fixed the name and added the <5,1,2,3> test case as well.

llvm-svn: 342328

5 years ago[X86] Remove an fp->int->fp domain crossing in LowerUINT_TO_FP_i64.
Craig Topper [Sat, 15 Sep 2018 16:23:35 +0000 (16:23 +0000)]
[X86] Remove an fp->int->fp domain crossing in LowerUINT_TO_FP_i64.

Summary: This unfortunately adds a move, but isn't that better than going to the int domain and back?

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 342327

5 years ago[X86] Fold (movmsk (setne (and X, (1 << C)), 0)) -> (movmsk (X << C))
Craig Topper [Sat, 15 Sep 2018 16:23:33 +0000 (16:23 +0000)]
[X86] Fold (movmsk (setne (and X, (1 << C)), 0)) -> (movmsk (X << C))

Summary:
MOVMSK only care about the sign bit so we don't need the setcc to fill the whole element with 0s/1s. We can just shift the bit we're looking for into the sign bit. This saves a constant pool load.

Inspired by PR38840.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 342326

5 years ago[NFC] minor cleanup in PassManagerInternal.h
Fedor Sergeev [Sat, 15 Sep 2018 14:56:12 +0000 (14:56 +0000)]
[NFC] minor cleanup in PassManagerInternal.h

A few changes found necessary for upcoming PassInstrumentation patch:
  - name() methods made const
  - properly forward arguments in AnalysisPassModel::run

Separated out of the main D47858 patch.

llvm-svn: 342325

5 years ago[InstCombine][x86] try harder to convert blendv intrinsic to generic IR (PR38814)
Sanjay Patel [Sat, 15 Sep 2018 14:25:44 +0000 (14:25 +0000)]
[InstCombine][x86] try harder to convert blendv intrinsic to generic IR (PR38814)

Missing optimizations with blendv are shown in:
https://bugs.llvm.org/show_bug.cgi?id=38814

If this works, it's an easier and more powerful solution than adding pattern matching
for a few special cases in the backend. The potential danger with this transform in IR
is that the condition value can get separated from the select, and the backend might
not be able to make a blendv out of it again. I don't think that's too likely, but
I've kept this patch minimal with a 'TODO', so we can test that theory in the wild
before expanding the transform.

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

llvm-svn: 342324

5 years agoFix line endings. NFCI.
Simon Pilgrim [Sat, 15 Sep 2018 14:20:53 +0000 (14:20 +0000)]
Fix line endings. NFCI.

llvm-svn: 342323

5 years ago[OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)
Kelvin Li [Sat, 15 Sep 2018 13:54:15 +0000 (13:54 +0000)]
[OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)

Move declarations for OMPClauseReader, OMPClauseWriter to ASTReader.h
and ASTWriter.h and move implementation to ASTReader.cpp and
ASTWriter.cpp. This change helps generalize the serialization of
OpenMP clauses and will be used in the future implementation of new
OpenMP directives (e.g. requires).

Patch by Patrick Lyster

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

llvm-svn: 342322

5 years ago[InstCombine] Inefficient pattern for high-bits checking 3 (PR38708)
Roman Lebedev [Sat, 15 Sep 2018 12:04:13 +0000 (12:04 +0000)]
[InstCombine] Inefficient pattern for high-bits checking 3 (PR38708)

Summary:
It is sometimes important to check that some newly-computed value
is non-negative and only n bits wide (where n is a variable.)
There are many ways to check that:
https://godbolt.org/z/o4RB8D
The last variant seems best?
(I'm sure there are some other variations i haven't thought of..)

The last (as far i know?) pattern, non-canonical due to the extra use.
https://godbolt.org/z/aCMsPk
https://rise4fun.com/Alive/I6f

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

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342321

5 years ago[XRay] Remove the unused variable
Petr Hosek [Sat, 15 Sep 2018 06:25:17 +0000 (06:25 +0000)]
[XRay] Remove the unused variable

This broke the fdr-single-thread test after FDRLoggingOptions struct
has been removed in r342318.

llvm-svn: 342320

5 years ago[CodeGenPrepare] Preserve debug locs in OptimizeExtractBits
Vedant Kumar [Sat, 15 Sep 2018 04:08:52 +0000 (04:08 +0000)]
[CodeGenPrepare] Preserve debug locs in OptimizeExtractBits

CodeGenPrepare has a transform that sinks {lshr, trunc} pairs to make it
easier for the backend to emit fancy extract-bits instructions (e.g UBFX).

Teach it to preserve debug locations and salvage debug values.

llvm-svn: 342319

5 years ago[XRay] Remove the deprecated __xray_log_init API
Petr Hosek [Sat, 15 Sep 2018 02:55:42 +0000 (02:55 +0000)]
[XRay] Remove the deprecated __xray_log_init API

This API has been deprecated three months ago and shouldn't be used
anymore, all clients should migrate to the new string based API.

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

llvm-svn: 342318

5 years ago[analyzer] Temporary disabling svalbuilder-rearrange-comparisons test
George Karpenkov [Sat, 15 Sep 2018 02:35:06 +0000 (02:35 +0000)]
[analyzer] Temporary disabling svalbuilder-rearrange-comparisons test

As debug printing has changed, and format was not guaranteed to be
stable.
Artem is currently working on a better solution.

llvm-svn: 342317

5 years ago[analyzer] Further printing improvements: use declarations,
George Karpenkov [Sat, 15 Sep 2018 02:34:45 +0000 (02:34 +0000)]
[analyzer] Further printing improvements: use declarations,

skip pointers whenever redundant, use unique prefixes.

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

llvm-svn: 342316

5 years agoGenerate unique identifiers for Decl objects
George Karpenkov [Sat, 15 Sep 2018 02:03:58 +0000 (02:03 +0000)]
Generate unique identifiers for Decl objects

The generated identifier is stable across multiple runs,
and can be a great visualization or debugging aide.

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

llvm-svn: 342315

5 years ago[analyzer] Generate and use stable identifiers for LocationContext
George Karpenkov [Sat, 15 Sep 2018 02:03:36 +0000 (02:03 +0000)]
[analyzer] Generate and use stable identifiers for LocationContext

Those are not created in the allocator.
Since they are created fairly rarely, a counter overhead should not
affect the memory consumption.

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

llvm-svn: 342314

5 years ago[analyzer] Dump reproducible identifiers for statements in exploded graph in store
George Karpenkov [Sat, 15 Sep 2018 02:03:17 +0000 (02:03 +0000)]
[analyzer] Dump reproducible identifiers for statements in exploded graph in store

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

llvm-svn: 342313

5 years ago[analyzer] Use correct end-of-line character when printing statements for exploded...
George Karpenkov [Sat, 15 Sep 2018 02:02:56 +0000 (02:02 +0000)]
[analyzer] Use correct end-of-line character when printing statements for exploded graph

Prevents bad centering.

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

llvm-svn: 342312

5 years agoStmtPrinter: allow customizing the end-of-line character
George Karpenkov [Sat, 15 Sep 2018 02:02:31 +0000 (02:02 +0000)]
StmtPrinter: allow customizing the end-of-line character

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

llvm-svn: 342311

5 years ago[analyzer] Dump unique identifiers for statements in exploded graph
George Karpenkov [Sat, 15 Sep 2018 02:02:09 +0000 (02:02 +0000)]
[analyzer] Dump unique identifiers for statements in exploded graph

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

llvm-svn: 342310

5 years agoSupport generating unique identifiers for Stmt objects
George Karpenkov [Sat, 15 Sep 2018 02:01:47 +0000 (02:01 +0000)]
Support generating unique identifiers for Stmt objects

The generated identifiers are stable across multiple runs, and can be a
great debug or visualization aid.

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

llvm-svn: 342309

5 years ago[analyzer] Skip printing duplicate nodes, even if nodes have multiple predecessors...
George Karpenkov [Sat, 15 Sep 2018 02:01:26 +0000 (02:01 +0000)]
[analyzer] Skip printing duplicate nodes, even if nodes have multiple predecessors/successors

Still generate a node, but leave the redundant field empty.

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

llvm-svn: 342308

5 years ago[modules] Don't bother creating a global module fragment when building a
Richard Smith [Sat, 15 Sep 2018 01:59:39 +0000 (01:59 +0000)]
[modules] Don't bother creating a global module fragment when building a
header module.

llvm-svn: 342307

5 years ago[modules] Support use of -E on modules built from the command line.
Richard Smith [Sat, 15 Sep 2018 01:21:18 +0000 (01:21 +0000)]
[modules] Support use of -E on modules built from the command line.

llvm-svn: 342306

5 years ago[modules] Driver support for precompiling a collection of files as a single
Richard Smith [Sat, 15 Sep 2018 01:21:16 +0000 (01:21 +0000)]
[modules] Driver support for precompiling a collection of files as a single
action.

llvm-svn: 342305

5 years ago[modules] Frontend support for building a header module from a list of
Richard Smith [Sat, 15 Sep 2018 01:21:15 +0000 (01:21 +0000)]
[modules] Frontend support for building a header module from a list of
headaer files.

llvm-svn: 342304