platform/upstream/llvm.git
6 years agoAdd missing include to Visibility.h
Eric Fiselier [Sun, 1 Apr 2018 00:31:14 +0000 (00:31 +0000)]
Add missing include to Visibility.h

llvm-svn: 328923

6 years agoRevert r328845, it caused crbug.com/827810.
Nico Weber [Sat, 31 Mar 2018 18:26:25 +0000 (18:26 +0000)]
Revert r328845, it caused crbug.com/827810.

llvm-svn: 328922

6 years ago[DAGCombine] (float)((int) f) --> ftrunc (PR36617)
Sanjay Patel [Sat, 31 Mar 2018 17:55:44 +0000 (17:55 +0000)]
[DAGCombine] (float)((int) f) --> ftrunc (PR36617)

fptosi / fptoui round towards zero, and that's the same behavior as ISD::FTRUNC,
so replace a pair of casts with the equivalent node. We don't have to account for
special cases (NaN, INF) because out-of-range casts are undefined.

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

llvm-svn: 328921

6 years ago[llvm-rtdyld] Fix the InputFileList cl::opt description: it accepts multiple
Lang Hames [Sat, 31 Mar 2018 16:01:01 +0000 (16:01 +0000)]
[llvm-rtdyld] Fix the InputFileList cl::opt description: it accepts multiple
input files.

llvm-svn: 328920

6 years ago[analyzer] Unroll the loop when it has a unsigned counter.
Henry Wong [Sat, 31 Mar 2018 12:46:46 +0000 (12:46 +0000)]
[analyzer] Unroll the loop when it has a unsigned counter.

Summary:
The original implementation in the `LoopUnrolling.cpp` didn't consider the case where the counter is unsigned. This case is only handled in `simpleCondition()`, but this is not enough, we also need to deal with the unsinged counter with the counter initialization.

Since `IntegerLiteral` is `signed`, there is a `ImplicitCastExpr<IntegralCast>` in `unsigned counter = IntergerLiteral`. This patch add the `ignoringParenImpCasts()` in the `IntegerLiteral` matcher.

Reviewers: szepet, a.sidorin, NoQ, george.karpenkov

Reviewed By: szepet, george.karpenkov

Subscribers: xazax.hun, rnkovacs, cfe-commits, MTC

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

llvm-svn: 328919

6 years ago[X86][Btver2] Add MMX_PSHUFB to the JWritePSHUFB InstRW entries
Simon Pilgrim [Sat, 31 Mar 2018 09:15:54 +0000 (09:15 +0000)]
[X86][Btver2] Add MMX_PSHUFB to the JWritePSHUFB InstRW entries

llvm-svn: 328918

6 years agoFix trailing whitespace. NFCI.
Simon Pilgrim [Sat, 31 Mar 2018 09:14:14 +0000 (09:14 +0000)]
Fix trailing whitespace. NFCI.

llvm-svn: 328917

6 years agoUnbreak the build of the go bindings after r328839.
Benjamin Kramer [Sat, 31 Mar 2018 07:41:25 +0000 (07:41 +0000)]
Unbreak the build of the go bindings after r328839.

llvm-svn: 328916

6 years ago[MIR-Canon] Adding support for local idempotent instruction hoisting.
Puyan Lotfi [Sat, 31 Mar 2018 05:48:51 +0000 (05:48 +0000)]
[MIR-Canon] Adding support for local idempotent instruction hoisting.

llvm-svn: 328915

6 years ago[X86] Add SchedRW for PMULLD
Craig Topper [Sat, 31 Mar 2018 04:54:32 +0000 (04:54 +0000)]
[X86] Add SchedRW for PMULLD

Summary:
It seems many CPUs don't implement this instruction as well as the other vector multiplies. Often using a multi uop flow. Silvermont in particular has a 7 uop flow with 11 cycle throughput. Sandy Bridge implements it as a single uop with 5 cycle latency and 1 cycle throughput. But Haswell and later use 2 uops with 10 cycle latency and 2 cycle throughput.

This patch adds a new X86SchedWritePair we can use to tag this instruction separately. I've provided correct information for Silvermont, Btver2, and Sandy Bridge. I've removed the InstRWs for SandyBridge. I've left Haswell/Broadwell/Skylake InstRWs in place because I wasn't sure how to account for the different load latency between 128 and 256 bits. I also left Znver1 InstRWs in place because the existing values don't match Agner's spreadsheet.

I also left a FIXME in the SandyBridge model because it being used for the "generic" model is too optimistic for the 256/512-bit versions since those are multiple uops on all known CPUs.

Reviewers: RKSimon, GGanesh, courbet

Reviewed By: RKSimon

Subscribers: gchatelet, gbedwell, andreadb, llvm-commits

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

llvm-svn: 328914

6 years ago[analyzer] Hopefully fix the ARM buildbot.
George Karpenkov [Sat, 31 Mar 2018 02:17:15 +0000 (02:17 +0000)]
[analyzer] Hopefully fix the ARM buildbot.

llvm-svn: 328913

6 years ago[analyzer] Fix assertion crash in CStringChecker
George Karpenkov [Sat, 31 Mar 2018 01:20:08 +0000 (01:20 +0000)]
[analyzer] Fix assertion crash in CStringChecker

An offset might be unknown.

rdar://39054939

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

llvm-svn: 328912

6 years ago[analyzer] Cache offset computation for MemRegion
George Karpenkov [Sat, 31 Mar 2018 01:20:07 +0000 (01:20 +0000)]
[analyzer] Cache offset computation for MemRegion

Achieves almost a 200% speedup on the example where the performance of
visitors was problematic.

Performance on sqlite3 is unaffected.

rdar://38818362

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

llvm-svn: 328911

6 years ago[analyzer] Fix liveness calculation for C++17 structured bindings
George Karpenkov [Sat, 31 Mar 2018 01:20:06 +0000 (01:20 +0000)]
[analyzer] Fix liveness calculation for C++17 structured bindings

C++ structured bindings for non-tuple-types are defined in a peculiar
way, where the resulting declaration is not a VarDecl, but a
BindingDecl.
That means a lot of existing machinery stops working.

rdar://36912381

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

llvm-svn: 328910

6 years ago[ThinLTO] Add an option to force summary call edges cold for debugging
Teresa Johnson [Sat, 31 Mar 2018 00:18:08 +0000 (00:18 +0000)]
[ThinLTO] Add an option to force summary call edges cold for debugging

Summary:
Useful to selectively disable importing into specific modules for
debugging/triaging/workarounds.

Reviewers: eraman

Subscribers: inglorion, llvm-commits

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

llvm-svn: 328909

6 years ago[ELF] Simplify read32. NFC
Fangrui Song [Fri, 30 Mar 2018 23:13:00 +0000 (23:13 +0000)]
[ELF] Simplify read32. NFC

llvm-svn: 328908

6 years agoFix a bunch of typoes. NFC
Fangrui Song [Fri, 30 Mar 2018 22:22:31 +0000 (22:22 +0000)]
Fix a bunch of typoes. NFC

llvm-svn: 328907

6 years ago[ASTImporter] Add test helper Fixture
Peter Szecsi [Fri, 30 Mar 2018 22:03:29 +0000 (22:03 +0000)]
[ASTImporter] Add test helper Fixture

Add a helper test Fixture, so we can add tests which can check internal
attributes of AST nodes like getPreviousDecl(), isVirtual(), etc.
This enables us to check if a redeclaration chain is correctly built during
import, if the virtual flag is preserved during import, etc. We cannot check
such attributes with the existing testImport.
Also, this fixture makes it possible to import from several "From" contexts.

We also added several test cases here, some of them are disabled.
We plan to pass the disabled tests in other patches.

Patch by Gabor Marton!

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

llvm-svn: 328906

6 years agoELF: Place ordered sections in the middle of the unordered section list on targets...
Peter Collingbourne [Fri, 30 Mar 2018 21:36:54 +0000 (21:36 +0000)]
ELF: Place ordered sections in the middle of the unordered section list on targets with limited-range branches.

It generally does not matter much where we place sections ordered
by --symbol-ordering-file relative to other sections. But if the
ordered sections are hot (which is the case already for some users
of --symbol-ordering-file, and is increasingly more likely to be
the case once profile-guided section layout lands) and the target
has limited-range branches, it is beneficial to place the ordered
sections in the middle of the output section in order to decrease
the likelihood that a range extension thunk will be required to call
a hot function from a cold function or vice versa.

That is what this patch does. After D44966 it reduces the size of
Chromium for Android's .text section by 60KB.

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

llvm-svn: 328905

6 years agoPrevent data races in concurrent ThinLTO processes.
Ekaterina Romanova [Fri, 30 Mar 2018 21:35:42 +0000 (21:35 +0000)]
Prevent data races in concurrent ThinLTO processes.

Make sure ThinLTO with caching doesn't use non-atomic writes to the cache file (to prevent data races and cache files corruption).

1. Place temp file to the same place where the caching directory is (instead of creating it the directory pointed to by TMP/TEMP variable). This will help to prevent using non-atomic rename and falling back to non-atomic "direct" write to the cache file.
2. if rename failed do not write to the cache file directly (direct write to the file is non-atomic and could cause data race conditions).
3. if cache file doesn't exist (e.g., because 'rename' failed or because some other reasons), bypass using the cache altogether.

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

llvm-svn: 328904

6 years ago[analyzer] Fix test triple in missing-bind-temporary.cpp.
Artem Dergachev [Fri, 30 Mar 2018 21:22:35 +0000 (21:22 +0000)]
[analyzer] Fix test triple in missing-bind-temporary.cpp.

Otherwise the default triple for x86-windows-msvc2015 auto-inserts
__attribute__((thiscall)) to some calls.

Fixes the respective buildbot.

llvm-svn: 328903

6 years agoInitialize Elf Header to zero to ensure that bytes not assigned any value later on...
Rumeet Dhindsa [Fri, 30 Mar 2018 20:49:34 +0000 (20:49 +0000)]
Initialize Elf Header to zero to ensure that bytes not assigned any value later on are initialized properly.

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

llvm-svn: 328902

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