platform/upstream/llvm.git
6 years ago[WebAssembly] Register wasm passes with the PassRegistry
Jacob Gravelle [Fri, 30 Mar 2018 20:36:58 +0000 (20:36 +0000)]
[WebAssembly] Register wasm passes with the PassRegistry

Summary:
This exposes WebAssembly passes for use on the command line (as
arguments to -print-before and the like).

Reviewers: dschuff, sunfish

Subscribers: MatzeB, jfb, sbc100, llvm-commits, aheejin

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

llvm-svn: 328901

6 years agoMinor cleanup in __kmp_atfork_child()
Jonathan Peyton [Fri, 30 Mar 2018 19:55:11 +0000 (19:55 +0000)]
Minor cleanup in __kmp_atfork_child()

This change removes the unnecessary lock operation on __kmp_initz_lock inside
the __kmp_atfork_child() function for Linux; the lock variable is initialized
in the same function later.

Patch by Hansang Bae

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

llvm-svn: 328900

6 years ago[Hexagon] Fix testcase
Krzysztof Parzyszek [Fri, 30 Mar 2018 19:46:28 +0000 (19:46 +0000)]
[Hexagon] Fix testcase

llvm-svn: 328899

6 years ago[Hexagon] Reduce excessive indentation in .s output
Krzysztof Parzyszek [Fri, 30 Mar 2018 19:30:28 +0000 (19:30 +0000)]
[Hexagon] Reduce excessive indentation in .s output

llvm-svn: 328898

6 years ago[Hexagon] Avoid creating invalid offsets in packetizer
Krzysztof Parzyszek [Fri, 30 Mar 2018 19:28:37 +0000 (19:28 +0000)]
[Hexagon] Avoid creating invalid offsets in packetizer

Two memory instructions with a dependency only on the address register
between the two (the first one of them being post-incrememnt) can be
packetized together after the offset on the second was updated to the
incremement value. Make sure that the new offset is valid for the
instruction.

llvm-svn: 328897

6 years ago[analyzer] Track null or undef values through pointer arithmetic.
Artem Dergachev [Fri, 30 Mar 2018 19:27:42 +0000 (19:27 +0000)]
[analyzer] Track null or undef values through pointer arithmetic.

Pointer arithmetic on null or undefined pointers results in null or undefined
pointers. This is obvious for undefined pointers; for null pointers it follows
from our incorrect-but-somehow-working approach that declares that 0 (Loc)
doesn't necessarily represent a pointer of numeric address value 0, but instead
it represents any pointer that will cause a valid "null pointer dereference"
issue when dereferenced.

For now we've been seeing through pointer arithmetic at the original dereference
expression, i.e. in bugreporter::getDerefExpr(), but not during further
investigation of the value's origins in bugreporter::trackNullOrUndefValue().
The patch fixes it.

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

llvm-svn: 328896

6 years ago[CFG] [analyzer] Work around a disappearing CXXBindTemporaryExpr.
Artem Dergachev [Fri, 30 Mar 2018 19:25:39 +0000 (19:25 +0000)]
[CFG] [analyzer] Work around a disappearing CXXBindTemporaryExpr.

Sometimes template instantiation causes CXXBindTemporaryExpr to be missing in
its usual spot. In CFG, temporary destructors work by relying on
CXXBindTemporaryExprs, so they won't work in this case.

Avoid the crash and notify the clients that we've encountered an unsupported AST
by failing to provide the ill-formed construction context for the temporary.

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

llvm-svn: 328895

6 years ago[lldb-dotest] Don't swallow error exit codes.
Davide Italiano [Fri, 30 Mar 2018 19:24:08 +0000 (19:24 +0000)]
[lldb-dotest] Don't swallow error exit codes.

llvm-svn: 328894

6 years ago[CFG] [analyzer] Avoid modeling C++17 constructors that aren't fully supported.
Artem Dergachev [Fri, 30 Mar 2018 19:21:18 +0000 (19:21 +0000)]
[CFG] [analyzer] Avoid modeling C++17 constructors that aren't fully supported.

Not enough work has been done so far to ensure correctness of construction
contexts in the CFG when C++17 copy elision is in effect, so for now we
should drop construction contexts in the CFG and in the analyzer when
they seem different from what we support anyway.

This includes initializations with conditional operators and return values
across multiple stack frames.

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

llvm-svn: 328893

6 years ago[X86][BtVer2] Fixed the number of micro opcodes for AVX vector converts and
Andrea Di Biagio [Fri, 30 Mar 2018 18:53:47 +0000 (18:53 +0000)]
[X86][BtVer2] Fixed the number of micro opcodes for AVX vector converts and
VSQRT instructions.

There were still a few AVX instructions with an incorrect number of opcodes.
These should be fixed now.

llvm-svn: 328892

6 years agoRemove unused CHECK lines leftover from r306928.
Eli Friedman [Fri, 30 Mar 2018 18:39:28 +0000 (18:39 +0000)]
Remove unused CHECK lines leftover from r306928.

The RUN lines were removed, but the corresponding CHECK lines never
went away.

llvm-svn: 328891

6 years agoDataFlowSanitizer: wrappers of functions with local linkage should have the same...
Peter Collingbourne [Fri, 30 Mar 2018 18:37:55 +0000 (18:37 +0000)]
DataFlowSanitizer: wrappers of functions with local linkage should have the same linkage as the function being wrapped

This patch resolves link errors when the address of a static function is taken, and that function is uninstrumented by DFSan.

This change resolves bug 36314.

Patch by Sam Kerner!

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

llvm-svn: 328890

6 years agoELF: Try to create last thunk section at ThunkSectionSpacing bytes before the end.
Peter Collingbourne [Fri, 30 Mar 2018 18:32:24 +0000 (18:32 +0000)]
ELF: Try to create last thunk section at ThunkSectionSpacing bytes before the end.

Now that we have the ability to create short thunks, it is beneficial
for thunk sections to be surrounded by ThunkSectionSpacing bytes
of code on both sides in order to increase the likelihood that the
distance from the thunk to the target will be sufficiently small to
allow for the creation of a short thunk. This is currently the case
for most thunks that we create, except for the last one, which could,
depending on the size of the output section, potentially appear near
the end and therefore have a relatively small amount of code after it.

This patch moves the last thunk section to ThunkSectionSpacing bytes
before the end of the output section, as long as the section is larger
than 2*ThunkSectionSpacing bytes. It reduces the size of Chromium
for Android's .text section by 32KB.

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

llvm-svn: 328889

6 years ago[OPENMP] Added emission of offloading data sections for declare target
Alexey Bataev [Fri, 30 Mar 2018 18:31:07 +0000 (18:31 +0000)]
[OPENMP] Added emission of offloading data sections for declare target
variables.

Added emission of the offloading data sections for the variables within
declare target regions + fixes emission of the declare target variables
marked as declare target not within the declare target region.

llvm-svn: 328888

6 years ago[MIR] Adding support for Named Virtual Registers in MIR.
Puyan Lotfi [Fri, 30 Mar 2018 18:15:54 +0000 (18:15 +0000)]
[MIR] Adding support for Named Virtual Registers in MIR.

llvm-svn: 328887

6 years ago[X86][BtVer2] Fix the number of uOps for horizontal operations.
Andrea Di Biagio [Fri, 30 Mar 2018 18:15:30 +0000 (18:15 +0000)]
[X86][BtVer2] Fix the number of uOps for horizontal operations.

llvm-svn: 328886

6 years ago[NVPTX] Enable StructuredCFG for NVPTX
Tim Shen [Fri, 30 Mar 2018 17:51:03 +0000 (17:51 +0000)]
[NVPTX] Enable StructuredCFG for NVPTX

Summary:
Make NVPTX require structured CFG. Added a temporary flag to
"roll back" the behavior for easy deployment.

Combined with D45008, this fixes several internal Nvidia GPU test
failures that we suspect to be ptxas miscompiles (PR27738).

Reviewers: jlebar

Subscribers: jholewinski, sanjoy, llvm-commits, hiraditya

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

llvm-svn: 328885

6 years ago[BlockPlacement] Disable block placement tail duplciation in structured CFG.
Tim Shen [Fri, 30 Mar 2018 17:51:00 +0000 (17:51 +0000)]
[BlockPlacement] Disable block placement tail duplciation in structured CFG.

Summary:
Tail duplication easily breaks the structure of CFG, e.g. duplicating on
a region entry. If the structure is intended to be preserved, then we
may want to configure tail duplication, or disable it for structured
CFG. From our benchmark results disabling it doesn't cause performance
regression.

Notice that this currently affects AMDGPU backend. In the next patch, I
also plan to turn on requiresStructuredCFG for NVPTX.

All unit tests still pass.

Reviewers: jlebar, arsenm

Subscribers: jholewinski, sanjoy, wdng, tpr, hiraditya, llvm-commits

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

llvm-svn: 328884

6 years ago[LLVM-C] Finish exception instruction bindings - Round 2
Robert Widmann [Fri, 30 Mar 2018 17:49:53 +0000 (17:49 +0000)]
[LLVM-C] Finish exception instruction bindings - Round 2

Summary:
Previous revision caused a leak in the echo test that got caught by the ASAN bots because of missing free of the handlers array and was reverted in r328759.  Resubmitting the patch with that correction.

Add support for cleanupret, catchret, catchpad, cleanuppad and catchswitch and their associated accessors.

Test is modified from SimplifyCFG because it contains many diverse usages of these instructions.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits, vlad.tsyrklevich

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

llvm-svn: 328883

6 years agoFix Windows buildbots.
Rui Ueyama [Fri, 30 Mar 2018 17:49:51 +0000 (17:49 +0000)]
Fix Windows buildbots.

llvm-svn: 328882

6 years agoFix some signed / unsigned conversion problems.
Zachary Turner [Fri, 30 Mar 2018 17:28:35 +0000 (17:28 +0000)]
Fix some signed / unsigned conversion problems.

llvm-svn: 328881

6 years agoImprove error message for an unknown --plugin-opt.
Rui Ueyama [Fri, 30 Mar 2018 17:22:44 +0000 (17:22 +0000)]
Improve error message for an unknown --plugin-opt.

Before:

  $ ld.lld --plugin-opt=-foo
  ld.lld: --Unknown command line argument '-abc'

After:

  $ ld.lld --plugin-opt=-foo
  ld.lld: --plugin-opt: ld.lld --Unknown command line argument '-abc'

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

llvm-svn: 328880

6 years ago[lld-link] Add comment explaining that /FIXED behavior is correct despite contradicti...
Nico Weber [Fri, 30 Mar 2018 17:17:04 +0000 (17:17 +0000)]
[lld-link] Add comment explaining that /FIXED behavior is correct despite contradicting MSDN.

Also add a test for /FIXED.
https://reviews.llvm.org/D45087

llvm-svn: 328879

6 years ago[llvm-pdbutil] Dig deeper into the PDB and DBI streams when explaining.
Zachary Turner [Fri, 30 Mar 2018 17:16:50 +0000 (17:16 +0000)]
[llvm-pdbutil] Dig deeper into the PDB and DBI streams when explaining.

This will show more detail when using `llvm-pdbutil explain` on an
offset in the DBI or PDB streams.  Specifically, it will dig into
individual header fields and substreams to give a more precise
description of what the byte represents.

llvm-svn: 328878

6 years ago[lld-link] Let /PROFILE imply /OPT:REF /OPT:NOICF /INCREMENTAL:NO /FIXED:NO
Nico Weber [Fri, 30 Mar 2018 17:14:50 +0000 (17:14 +0000)]
[lld-link] Let /PROFILE imply /OPT:REF /OPT:NOICF /INCREMENTAL:NO /FIXED:NO

/FIXED:NO is always the default, so that part needs no work.

Also test the interaction of /ORDER: with /INCREMENTAL.

https://reviews.llvm.org/D45091

llvm-svn: 328877

6 years ago[WebAssembly] Refactor tablegen for store instructions (NFC)
Derek Schuff [Fri, 30 Mar 2018 17:02:50 +0000 (17:02 +0000)]
[WebAssembly] Refactor tablegen for store instructions (NFC)

Summary: Add patterns similar to loads.

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

llvm-svn: 328876

6 years agoRevert "peel loops with runtime small trip counts"
Krzysztof Parzyszek [Fri, 30 Mar 2018 16:55:44 +0000 (16:55 +0000)]
Revert "peel loops with runtime small trip counts"

This reverts commit r328854, it breaks some Hexagon tests.

llvm-svn: 328875

6 years ago[AMDGPU] Fixed some instructions latencies
Stanislav Mekhanoshin [Fri, 30 Mar 2018 16:19:13 +0000 (16:19 +0000)]
[AMDGPU] Fixed some instructions latencies

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

llvm-svn: 328874

6 years ago[WebAssembly] Error if both --export-table and --import-table are specified.
Rui Ueyama [Fri, 30 Mar 2018 16:06:14 +0000 (16:06 +0000)]
[WebAssembly] Error if both --export-table and --import-table are specified.

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

llvm-svn: 328873

6 years ago[SelectionDAG] Removing FABS folding from DAGCombiner
Sanjay Patel [Fri, 30 Mar 2018 15:42:52 +0000 (15:42 +0000)]
[SelectionDAG] Removing FABS folding from DAGCombiner

The code has bugs dealing with -0.0.

Since D44550 introduced FABS pattern folding in InstCombine,
this patch removes the now-redundant code that causes
https://bugs.llvm.org/show_bug.cgi?id=36600.

Patch by Mikhail Dvoretckii!

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

llvm-svn: 328872

6 years ago[clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames
Ben Hamilton [Fri, 30 Mar 2018 15:38:45 +0000 (15:38 +0000)]
[clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

Summary:
In D43121, @Typz introduced logic to avoid indenting 2-or-more
argument ObjC selectors too far to the right if the first component
of the selector was longer than the others.

This had a small side effect of causing wrapped ObjC selectors with
exactly 1 argument to not obey IndentWrappedFunctionNames:

```
- (aaaaaaaaaa)
aaaaaaaaaa;
```

This diff fixes the issue by ensuring we align wrapped 1-argument
ObjC selectors correctly:

```
- (aaaaaaaaaa)
    aaaaaaaaaa;
```

Test Plan: New tests added. Test failed before change, passed
  after change. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, klimek, Typz, jolesiak

Reviewed By: djasper, jolesiak

Subscribers: cfe-commits, Typz

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

llvm-svn: 328871

6 years ago[Hexagon] Recognize and handle :endloop01
Krzysztof Parzyszek [Fri, 30 Mar 2018 15:29:47 +0000 (15:29 +0000)]
[Hexagon] Recognize and handle :endloop01

llvm-svn: 328870

6 years ago[Hexagon] Fix printing :mem_noshuf on compiler-generated packets
Krzysztof Parzyszek [Fri, 30 Mar 2018 15:09:05 +0000 (15:09 +0000)]
[Hexagon] Fix printing :mem_noshuf on compiler-generated packets

llvm-svn: 328869

6 years ago[Hexagon] Fix flags for store-related intrinsics
Krzysztof Parzyszek [Fri, 30 Mar 2018 14:57:01 +0000 (14:57 +0000)]
[Hexagon] Fix flags for store-related intrinsics

llvm-svn: 328868

6 years ago[X86][BtVer2] Add missing ReadAfterLd to RM variants of AVX horizontal adds and
Andrea Di Biagio [Fri, 30 Mar 2018 14:48:08 +0000 (14:48 +0000)]
[X86][BtVer2] Add missing ReadAfterLd to RM variants of AVX horizontal adds and
most vector logic instructions.

Fixed a few InstRW that forgot to specify a ReadAfterLd for the register input
operand.

llvm-svn: 328867

6 years ago[Hexagon] Remove unused scheduling classes
Krzysztof Parzyszek [Fri, 30 Mar 2018 14:34:32 +0000 (14:34 +0000)]
[Hexagon] Remove unused scheduling classes

llvm-svn: 328866

6 years ago[X86][BtVer2] Add tests that show how ReadAfterLd is missing for some
Andrea Di Biagio [Fri, 30 Mar 2018 14:29:33 +0000 (14:29 +0000)]
[X86][BtVer2] Add tests that show how ReadAfterLd is missing for some
instructions.

In the Btver2 model, there are a few InstRW overrides that don't specify a
ReadAfterLd for the register input operand.

As a result, a few AVX variants of horizontal operations and most vector logic
operations with a folded memory operand don't have a ReadAdvance info associated
to their input register operands.

llvm-svn: 328865

6 years ago[Hexagon] Pass pointer to SelectionDAG to dump functions
Krzysztof Parzyszek [Fri, 30 Mar 2018 14:29:15 +0000 (14:29 +0000)]
[Hexagon] Pass pointer to SelectionDAG to dump functions

llvm-svn: 328864

6 years agoSimplify test more.
Nico Weber [Fri, 30 Mar 2018 13:48:11 +0000 (13:48 +0000)]
Simplify test more.

llvm-svn: 328863

6 years agoSimplify test.
Nico Weber [Fri, 30 Mar 2018 13:44:15 +0000 (13:44 +0000)]
Simplify test.

As of rL215127, FileCheck has an -allow-empty flag,
so this could be used instead of writing a dummy line.
But it looks like the log is never empty now, so not
even that is needed.

llvm-svn: 328862

6 years ago[X86] Add llvm-mca tests for r328834.
Andrea Di Biagio [Fri, 30 Mar 2018 13:38:37 +0000 (13:38 +0000)]
[X86] Add llvm-mca tests for r328834.

Verify that the ReadAfterLd is correctly applied to FMA and 4-ops variable blend
instructions.

As Craig pointed out in D44726, some Intel models still have to be fixed.

llvm-svn: 328861

6 years ago[analyzer] Remove the unused method declaration in `ValistChecker.cpp`.
Henry Wong [Fri, 30 Mar 2018 13:37:50 +0000 (13:37 +0000)]
[analyzer] Remove the unused method declaration in `ValistChecker.cpp`.

Summary: `getVariableNameFromRegion()` seems useless.

Reviewers: xazax.hun, george.karpenkov

Reviewed By: xazax.hun

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

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

llvm-svn: 328860

6 years ago[X86] Add tests to verify the presence of "ReadAfterLd" after r328823.
Andrea Di Biagio [Fri, 30 Mar 2018 11:44:48 +0000 (11:44 +0000)]
[X86] Add tests to verify the presence of "ReadAfterLd" after r328823.

This change adds a couple of tests to verify the change introduced by revision
328823 ([X86] Correct the placement of ReadAfterLd in BEXTR and BZHI).

llvm-svn: 328859

6 years agoRevert "[LLVM-C] Finish exception instruction bindings"
Vlad Tsyrklevich [Fri, 30 Mar 2018 06:21:28 +0000 (06:21 +0000)]
Revert "[LLVM-C] Finish exception instruction bindings"

This reverts commit r328759. It was causing LSan failures on sanitizer-x86_64-linux-bootstrap

llvm-svn: 328858

6 years ago[Modules] Improve fixit for framework private module maps
Bruno Cardoso Lopes [Fri, 30 Mar 2018 05:17:58 +0000 (05:17 +0000)]
[Modules] Improve fixit for framework private module maps

The wrong source range was being provided in some case, fix that to get
a better fixit.

rdar://problem/38520199

llvm-svn: 328857

6 years ago[AMDGPU] Fix the SDWA Peephole phase to handle src for dst:UNUSED_PRESERVE.
Michael Bedy [Fri, 30 Mar 2018 05:03:36 +0000 (05:03 +0000)]
[AMDGPU] Fix the SDWA Peephole phase to handle src for dst:UNUSED_PRESERVE.

Summary:
The phase attempts to transform operations that extract a portion of a value
into an SDWA src operand in cases where that value is used only once. It
was not prepared for this use to be the preserved portion of a value for
dst:UNUSED_PRESERVE, resulting in a crash or assert.

This change either rejects the illegal SDWA attempt, or in the case where
dst:WORD_1 and the src_sel would be WORD_0, removes the unneeded
extract instruction.

Reviewers: arsenm, #amdgpu

Reviewed By: arsenm, #amdgpu

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

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

llvm-svn: 328856

6 years ago[Hexagon] add missing lit config file
Ikhlas Ajbar [Fri, 30 Mar 2018 03:32:24 +0000 (03:32 +0000)]
[Hexagon] add missing lit config file

llvm-svn: 328855

6 years agopeel loops with runtime small trip counts
Ikhlas Ajbar [Fri, 30 Mar 2018 03:05:34 +0000 (03:05 +0000)]
peel loops with runtime small trip counts

For Hexagon, peeling loops with small runtime trip count is beneficial for our
benchmarks. We set PeelCount in HexagonTargetInfo.cpp and we use PeelCount set
by the target for computing the desired peel count.

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

llvm-svn: 328854

6 years agoAdding UNSUPPORTED: system-windows at George's request until the problem can be debugged.
Douglas Yung [Fri, 30 Mar 2018 01:29:07 +0000 (01:29 +0000)]
Adding UNSUPPORTED: system-windows at George's request until the problem can be debugged.

llvm-svn: 328853

6 years agoRe-implement --just-symbols as a regular object file.
Rui Ueyama [Fri, 30 Mar 2018 01:15:36 +0000 (01:15 +0000)]
Re-implement --just-symbols as a regular object file.

I tried a few different designs to find a way to implement it without
too much hassle and settled down with this. Unlike before, object files
given as arguments for --just-symbols are handled as object files, with
an exception that their section tables are handled as if they were all
null.

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

llvm-svn: 328852

6 years ago[MachineCopyPropagation] Handle COPY with overlapping source/dest.
Eli Friedman [Fri, 30 Mar 2018 00:56:03 +0000 (00:56 +0000)]
[MachineCopyPropagation] Handle COPY with overlapping source/dest.

MachineCopyPropagation::CopyPropagateBlock has a bunch of special
handling for COPY instructions. This handling assumes that COPY
instructions do not modify the source of the copy; this is wrong if
the COPY destination overlaps the source.

To fix the bug, check explicitly for this situation, and fall back to
the generic instruction handling.

This bug can't happen for most register classes because they don't
have this sort of overlap, but there are a few register classes
where this is possible. The testcase uses the AArch64 QQQQ register
class.

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

llvm-svn: 328851

6 years ago[IR] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
Eugene Zelenko [Fri, 30 Mar 2018 00:47:31 +0000 (00:47 +0000)]
[IR] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).

llvm-svn: 328850

6 years ago[ASan] Disable new ASan error reporting tests on various ARMs.
Alex Shlyapnikov [Fri, 30 Mar 2018 00:03:36 +0000 (00:03 +0000)]
[ASan] Disable new ASan error reporting tests on various ARMs.

As many other ASan tests already, has to disable these failing tests on
arm, armhf and aarch64 configs.

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

llvm-svn: 328849

6 years agoStyle update. NFC.
Rafael Espindola [Thu, 29 Mar 2018 23:32:54 +0000 (23:32 +0000)]
Style update. NFC.

Rename 3 functions to start with lowercase letters. Don't repeat the
name in the comments.

llvm-svn: 328848

6 years agoAdd missing REQUIRES: arm.
Peter Collingbourne [Thu, 29 Mar 2018 23:08:32 +0000 (23:08 +0000)]
Add missing REQUIRES: arm.

llvm-svn: 328847

6 years agoELF: Add support for short thunks on ARM.
Peter Collingbourne [Thu, 29 Mar 2018 22:43:52 +0000 (22:43 +0000)]
ELF: Add support for short thunks on ARM.

A short thunk uses a direct branch (b or b.w) instruction, and is used
when the target has the same thumbness as the thunk and is within
direct branch range (32MB for ARM, 16MB for Thumb-2). Reduces the
size of Chromium for Android's .text section by around 160KB.

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

llvm-svn: 328846

6 years agoHoist MethodVFTableLocation out of MicrosoftVTableContext, NFC
Reid Kleckner [Thu, 29 Mar 2018 22:42:24 +0000 (22:42 +0000)]
Hoist MethodVFTableLocation out of MicrosoftVTableContext, NFC

This allows forward declaring it so that we can add it to
MicrosoftMangleContext::mangleVirtualMemPtrThunk without including
VTableBuilder.h. That saves a hashtable lookup when emitting virtual
member pointer functions.

It also shortens a really long type name. This struct has "VFtable" in
the name, so it seems pretty unlikely that someone will assume it is
generally useful for non-MS C++ ABI stuff.

llvm-svn: 328845

6 years agoFix some layering in StripNonLineTableDebugInfo, moving its declaration from IPO...
David Blaikie [Thu, 29 Mar 2018 22:42:08 +0000 (22:42 +0000)]
Fix some layering in StripNonLineTableDebugInfo, moving its declaration from IPO.h to Utils.h to match its implementation

llvm-svn: 328844

6 years agoDo not use template for check{Int,UInt,IntUInt,Alignment}.
Rui Ueyama [Thu, 29 Mar 2018 22:40:52 +0000 (22:40 +0000)]
Do not use template for check{Int,UInt,IntUInt,Alignment}.

Template is just unnecessary.

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

llvm-svn: 328843

6 years agoRemove unused header to fix layering.
David Blaikie [Thu, 29 Mar 2018 22:35:59 +0000 (22:35 +0000)]
Remove unused header to fix layering.

llvm-svn: 328842

6 years agoELF: Allow thunks to change size. NFCI.
Peter Collingbourne [Thu, 29 Mar 2018 22:32:13 +0000 (22:32 +0000)]
ELF: Allow thunks to change size. NFCI.

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

llvm-svn: 328841

6 years agoRemove unused headers to fix layering
David Blaikie [Thu, 29 Mar 2018 22:31:39 +0000 (22:31 +0000)]
Remove unused headers to fix layering

llvm-svn: 328840

6 years agollvm-c: Split Utils out of Scalar.h
David Blaikie [Thu, 29 Mar 2018 22:31:38 +0000 (22:31 +0000)]
llvm-c: Split Utils out of Scalar.h

To fix layering (so that Scalar.h, a libScalarOpts header, isn't
included from Utils - which libScalarOpts depends on).

llvm-svn: 328839

6 years agoRemove some unneeded #includes to fix layering
David Blaikie [Thu, 29 Mar 2018 22:31:36 +0000 (22:31 +0000)]
Remove some unneeded #includes to fix layering

llvm-svn: 328838

6 years ago[analyzer] Fix target triple for autorelease-write-checker test
George Karpenkov [Thu, 29 Mar 2018 22:28:04 +0000 (22:28 +0000)]
[analyzer] Fix target triple for autorelease-write-checker test

llvm-svn: 328837

6 years agoSet dso_local on cfi_slowpath.
Rafael Espindola [Thu, 29 Mar 2018 22:08:01 +0000 (22:08 +0000)]
Set dso_local on cfi_slowpath.

llvm-svn: 328836

6 years ago[analyzer] Better pretty-printing of regions in exploded graph
George Karpenkov [Thu, 29 Mar 2018 22:07:58 +0000 (22:07 +0000)]
[analyzer] Better pretty-printing of regions in exploded graph

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

llvm-svn: 328835

6 years ago[X86] Add ReadAfterLds to some 3 src instructions
Craig Topper [Thu, 29 Mar 2018 22:03:05 +0000 (22:03 +0000)]
[X86] Add ReadAfterLds to some 3 src instructions

Sometimes the operand comes after the memory operand so we need 5 ReadDefaults first.

I suspect we also need to do something for the mask operand for masked avx512 instructions? I'm not sure if the mask should be ReadAfterLd or not since it can mask faults. If it shouldn't be ReadAfterLd then we're probably wrong for zero masking instructions already.

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

llvm-svn: 328834

6 years agoTypo fix: epilouge->epilogue. NFC.
Eric Christopher [Thu, 29 Mar 2018 21:59:04 +0000 (21:59 +0000)]
Typo fix: epilouge->epilogue. NFC.

llvm-svn: 328833

6 years agoAMDGPU: Fix build warning in release
Matt Arsenault [Thu, 29 Mar 2018 21:44:44 +0000 (21:44 +0000)]
AMDGPU: Fix build warning in release

llvm-svn: 328832

6 years agoAMDGPU: Support realigning stack
Matt Arsenault [Thu, 29 Mar 2018 21:30:06 +0000 (21:30 +0000)]
AMDGPU: Support realigning stack

While the stack access instructions don't care about
alignment > 4, some transformations on the pointer calculation
do make assumptions based on knowing the low bits of a pointer
are 0. If a stack object ends up being accessed through its
absolute address (relative to the kernel scratch wave offset),
the addressing expression may depend on the stack frame being
properly aligned. This was breaking in a testcase due to the
add->or combine.

I think some of the SP/FP handling logic is still backwards,
and overly simplistic to support all of the stack features.
Code which tries to modify the SP with inline asm for example
or variable sized objects will probably require redoing this.

llvm-svn: 328831

6 years agoAdd msan custom mapping options.
Evgeniy Stepanov [Thu, 29 Mar 2018 21:18:17 +0000 (21:18 +0000)]
Add msan custom mapping options.

Similarly to https://reviews.llvm.org/D18865 this adds options to provide custom mapping for msan.
As discussed in http://lists.llvm.org/pipermail/llvm-dev/2018-February/121339.html

Patch by vit9696(at)avp.su.

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

llvm-svn: 328830

6 years ago[AArch64]: Add support for parsing rN registers.
Manoj Gupta [Thu, 29 Mar 2018 21:11:15 +0000 (21:11 +0000)]
[AArch64]: Add support for parsing rN registers.

Summary:
Allow rN registers to be simply parsed as correspoing xN registers.
The "register ... asm("rN")" is an command to the
compiler's register allocator, not an operand to any individual assembly
instruction. GCC documents this syntax as "...the name of the register
that should be used."

This is needed to support the changes in Linux kernel (see
https://lkml.org/lkml/2018/3/1/268 )

Note: This will add support only for the limited use case of
register ... asm("rN"). Any other uses that make rN leak into assembly
are not supported.

Reviewers: kristof.beyls, rengolin, peter.smith, t.p.northover

Reviewed By: peter.smith

Subscribers: javed.absar, eraman, cfe-commits, srhines

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

llvm-svn: 328829

6 years ago[X86] Remove ReadAfterLd from BMI and TBM instructions that don't have a register...
Craig Topper [Thu, 29 Mar 2018 21:03:53 +0000 (21:03 +0000)]
[X86] Remove ReadAfterLd from BMI and TBM instructions that don't have a register operand in their memory form

The memory form of these instructions only read an input from memory. They don't have any register operands.

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

llvm-svn: 328828

6 years ago[analyzer] Path-insensitive checker for writes into an auto-releasing pointer
George Karpenkov [Thu, 29 Mar 2018 20:55:34 +0000 (20:55 +0000)]
[analyzer] Path-insensitive checker for writes into an auto-releasing pointer

from the wrong auto-releasing pool, as such writes may crash.

rdar://25301111

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

llvm-svn: 328827

6 years ago[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
Eugene Zelenko [Thu, 29 Mar 2018 20:51:59 +0000 (20:51 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).

llvm-svn: 328826

6 years agoMark __cfi_check as dso_local.
Rafael Espindola [Thu, 29 Mar 2018 20:51:30 +0000 (20:51 +0000)]
Mark __cfi_check as dso_local.

llvm-svn: 328825

6 years agoTry to fix sanitizer-x86_64-linux-fast bot due to change in r328820.
Kevin Enderby [Thu, 29 Mar 2018 20:49:24 +0000 (20:49 +0000)]
Try to fix sanitizer-x86_64-linux-fast bot due to change in r328820.

llvm-svn: 328824

6 years ago[X86] Correct the placement of ReadAfterLd in BEXTR and BZHI. Add dedicated SchedRW...
Craig Topper [Thu, 29 Mar 2018 20:41:39 +0000 (20:41 +0000)]
[X86] Correct the placement of ReadAfterLd in BEXTR and BZHI. Add dedicated SchedRW for BEXTR/BZHI.

These instructions have the memory operand before the register operand. So we need to put ReadDefault for all the load ops first. Then the ReadAfterLd

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

llvm-svn: 328823

6 years ago[NFC][LICM] Rearrange checks to have the cheap bail out first
Philip Reames [Thu, 29 Mar 2018 20:32:15 +0000 (20:32 +0000)]
[NFC][LICM] Rearrange checks to have the cheap bail out first

llvm-svn: 328822

6 years agoAMDGPU: Increase default stack alignment
Matt Arsenault [Thu, 29 Mar 2018 20:22:04 +0000 (20:22 +0000)]
AMDGPU: Increase default stack alignment

8 and 16-byte values are common, so increase the default
alignment to avoid realigning the stack in most functions.

llvm-svn: 328821

6 years agoFor llvm-nm and Mach-O files that are fully stripped, special case a redacted LC_MAIN
Kevin Enderby [Thu, 29 Mar 2018 20:04:29 +0000 (20:04 +0000)]
For llvm-nm and Mach-O files that are fully stripped, special case a redacted LC_MAIN

As a further refinement on:

r328274 - For llvm-nm and Mach-O files also use function starts info in some cases when printing symbols

we want to special case a redacted LC_MAIN so it is easier to find.

rdar://38978929

llvm-svn: 328820

6 years ago[clangd] Fix repeated word typo. NFC
Fangrui Song [Thu, 29 Mar 2018 20:03:16 +0000 (20:03 +0000)]
[clangd] Fix repeated word typo. NFC

llvm-svn: 328819

6 years agoAMDGPU: Fix selection error on constant loads with < 4 byte alignment
Matt Arsenault [Thu, 29 Mar 2018 19:59:28 +0000 (19:59 +0000)]
AMDGPU: Fix selection error on constant loads with < 4 byte alignment

llvm-svn: 328818

6 years agoSimplify. NFC.
Rui Ueyama [Thu, 29 Mar 2018 19:51:53 +0000 (19:51 +0000)]
Simplify. NFC.

llvm-svn: 328817

6 years agoFix an accidental circular dependence
Philip Reames [Thu, 29 Mar 2018 19:22:12 +0000 (19:22 +0000)]
Fix an accidental circular dependence

llvm-svn: 328816

6 years ago[Mips] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Thu, 29 Mar 2018 19:05:26 +0000 (19:05 +0000)]
[Mips] Change std::sort to llvm::sort in response to r327219

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

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

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: sdardis, RKSimon, dsanders, atanasyan

Reviewed By: atanasyan

Subscribers: atanasyan, arichardson, llvm-commits

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

llvm-svn: 328815

6 years agoTry to fix a couple tests for Windows.
Paul Robinson [Thu, 29 Mar 2018 18:59:33 +0000 (18:59 +0000)]
Try to fix a couple tests for Windows.

llvm-svn: 328814

6 years ago[SLPVectorizer] Add tests related to PR30787, NFCI.
Dinar Temirbulatov [Thu, 29 Mar 2018 18:57:03 +0000 (18:57 +0000)]
[SLPVectorizer] Add tests related to PR30787, NFCI.

llvm-svn: 328813

6 years ago[MSF] Default to FPM2, and always mark FPM pages allocated.
Zachary Turner [Thu, 29 Mar 2018 18:34:15 +0000 (18:34 +0000)]
[MSF] Default to FPM2, and always mark FPM pages allocated.

There are two FPMs in an MSF file, the idea being that for
incremental updates you can write to the alternate one and then
atomically swap them on commit.  LLVM defaulted to using FPM1
on the first commit, but this differs from Microsoft's behavior
which is to default to using FPM2 on the first commit.  To
eliminate some byte-level file differences, this patch changes
LLVM's default to also be FPM2.

Additionally, LLVM was trying to be "smart" about marking FPM
pages allocated.  In addition to marking every page belonging
to the alternate FPM as unallocated, LLVM also marked pages at
the end of the main FPM which were not needed as unallocated.

In order to match the behavior of Microsoft-generated PDBs, we
now always mark every FPM block as allocated, regardless of
whether it is in the main FPM or the alt FPM, and regardless of
whether or not it describes blocks which are actually in the file.

This has the side benefit of simplifying our code.

llvm-svn: 328812

6 years agoExit early from a loop. NFC.
Rui Ueyama [Thu, 29 Mar 2018 18:29:12 +0000 (18:29 +0000)]
Exit early from a loop. NFC.

This patch fixes an issue introduced in r328810 which made the algorithm
to always run the loop O(n^2) times, though we can break early. The
output remains the same.

llvm-svn: 328811

6 years agoRefactor Writer::checkNoOverlappingSections. NFC.
Rui Ueyama [Thu, 29 Mar 2018 18:24:01 +0000 (18:24 +0000)]
Refactor Writer::checkNoOverlappingSections. NFC.

This patch rewrites the function to remove lambda callbacks and use
of template. The algorithm is the same as before.

llvm-svn: 328810

6 years agoGeneralize NRVO to cover C structs.
Akira Hatanaka [Thu, 29 Mar 2018 17:56:24 +0000 (17:56 +0000)]
Generalize NRVO to cover C structs.

This commit generalizes NRVO to cover C structs (both trivial and
non-trivial structs).

rdar://problem/33599681

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

llvm-svn: 328809

6 years ago[PDB] Print some more details when explaining MSF fields.
Zachary Turner [Thu, 29 Mar 2018 17:45:34 +0000 (17:45 +0000)]
[PDB] Print some more details when explaining MSF fields.

When we determine that a field belongs to an MSF super block or
the free page map, we wouldn't print any additional information.

With this patch, we now print the value of the field (for super
block fields) or the allocation status of the specified byte (in
the case of offsets in the FPM).

llvm-svn: 328808

6 years ago[Sema] Make deprecation fix-it replace all multi-parameter ObjC method slots.
Volodymyr Sapsai [Thu, 29 Mar 2018 17:34:09 +0000 (17:34 +0000)]
[Sema] Make deprecation fix-it replace all multi-parameter ObjC method slots.

Deprecation replacement can be any text but if it looks like a name of
ObjC method and has the same number of arguments as original method,
replace all slot names so after applying a fix-it you have valid code.

rdar://problem/36660853

Reviewers: aaron.ballman, erik.pilkington, rsmith

Reviewed By: erik.pilkington

Subscribers: cfe-commits, jkorous-apple

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

llvm-svn: 328807

6 years ago[IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to CodeGen...
Craig Topper [Thu, 29 Mar 2018 17:21:10 +0000 (17:21 +0000)]
[IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to CodeGen layer.

Currently EVT is in the IR layer only because of Function.cpp needing a very small piece of the functionality of EVT::getEVTString(). The rest of EVT is used in codegen making CodeGen a better place for it.

The previous code converted a Type* to EVT and then called getEVTString. This was only expected to handle the primitive types from Type*. Since there only a few primitive types, we can just print them as strings directly.

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

llvm-svn: 328806

6 years agoReapply "[DWARFv5] Emit file 0 to the line table."
Paul Robinson [Thu, 29 Mar 2018 17:16:41 +0000 (17:16 +0000)]
Reapply "[DWARFv5] Emit file 0 to the line table."

DWARF v5 specifies that the root file (also given in the DW_AT_name
attribute of the compilation unit DIE) should be emitted explicitly to
the line table's list of files.  This makes the line table more
independent of the .debug_info section.
We emit the new syntax only for DWARF v5 and later.

Fixes the bug found by asan. Also XFAIL the new test for Darwin, which
is stuck on DWARF v2, and fix up other tests so they stop failing on
Windows.  Last but not least, don't break "clang -g" of an assembler
file that has .file directives in it.

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

llvm-svn: 328805

6 years ago[PDB] Fix a bug in the explain subcommand.
Zachary Turner [Thu, 29 Mar 2018 17:11:14 +0000 (17:11 +0000)]
[PDB] Fix a bug in the explain subcommand.

We were trying to dig into the super block fields and print a
description of the field at the specified offset, but we were
printing the wrong field due to an off-by-one-field-error.

llvm-svn: 328804

6 years ago[ADT] NFC: Fix bogus StringSwitch rule-of-five boilerplate
David Zarzycki [Thu, 29 Mar 2018 16:51:28 +0000 (16:51 +0000)]
[ADT] NFC: Fix bogus StringSwitch rule-of-five boilerplate

Now that 'Str' is constant, the rule-of-file logic needs updating.

Reported by: vit9696@avp.su
Reviewed by: jordan_rose@apple.com

llvm-svn: 328803

6 years agoRemove unused function.
Zachary Turner [Thu, 29 Mar 2018 16:46:47 +0000 (16:46 +0000)]
Remove unused function.

llvm-svn: 328802