Commit Graph

286472 Commits

Author SHA1 Message Date
Kostya Kortchinsky 2c5f944015 [sanitizer] Remove empty Symbolizer PrepareForSandboxing
Summary:
`Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently
has been for a while (D10213). Remove it, and shuffle things around so that the
platform specific code is now in `PlatformPrepareForSandboxing`.

This allows to have one less symbolizer dependency in a common file, which
helps for the upcoming split.

Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not
be used anywhere.

Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr

Reviewed By: alekseyshl

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 329094
2018-04-03 18:07:22 +00:00
Jonas Devlieghere 4fad76ccde [dsymutil] Apply recursion workaround for threading
The DwarfLinker can have some very deep recursion that can max out the
(significantly smaller) stack when using threads. We don't want this
limitation when we only have a single thread. We already have this
workaround for the architecture-related threading. This patch applies
the same workaround to the parallel analysis and cloning.

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

llvm-svn: 329093
2018-04-03 18:01:18 +00:00
Rui Ueyama cc013f62c1 Make fetchIfLazy only fetch an object file. NFC.
Previously, fetchIfLazy did more than the name says. Now, setting
to UsedInRegularObj is moved to another function.

llvm-svn: 329092
2018-04-03 18:01:18 +00:00
Alexey Bataev d5b1f7892f [SLP] Fixed formatting, NFC.
llvm-svn: 329091
2018-04-03 17:48:14 +00:00
Sam McCall ba3c02e461 [clangd] synthesize fix message when the diagnostic doesn't provide one.
Summary:
Currently if a fix is attached directly to a diagnostic, we repeat the
diagnostic message as the fix message. From eyeballing the top diagnostics,
it seems describing the textual replacement would be much clearer.

e.g.
error: use of undeclared identifier 'goo'; did you mean 'foo'?
action before: use of undeclared identifier 'goo'; did you mean 'foo'?
action after: change 'goo' to 'foo'

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329090
2018-04-03 17:35:57 +00:00
Alexey Bataev f7226ed67d [DEBUGINFO] Add option that allows to disable emission of flags in .loc directives.
Summary:
Some targets do not support extended format of .loc directive and
support only simple format: .loc <FileID> <Line> <Column>. Patch adds
MCAsmInfo flag and option that allows emit .loc directive without
additional flags.

Reviewers: echristo

Subscribers: llvm-commits

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

llvm-svn: 329089
2018-04-03 17:28:55 +00:00
Bob Haarman 8c63bafdd3 [lld] fix data race in ELF/ICF.cpp
Summary:
r328610 fixed a data race in the COFF linker. This change makes a
similar fix to the ELF linker.

Reviewers: ruiu, pcc, rnk

Reviewed By: ruiu

Subscribers: emaste, llvm-commits, arichardson

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

llvm-svn: 329088
2018-04-03 17:27:39 +00:00
Daniel Neilson 901acfab0c [InstCombine] Fold compare of int constant against a splatted vector of ints
Summary:
Folding patterns like:
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %ext = extractelement <4 x i8> %insvec, i32 0
  %cond = icmp eq i32 %ext, 0

Combined with existing rules, this allows us to fold patterns like:
  %insvec = insertelement <4 x i8> undef, i8 %val, i32 0
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %cond = icmp eq i8 %val, 0

When we construct a splat vector via a shuffle, and bitcast the vector into an integer type for comparison against an integer constant. Then we can simplify the the comparison to compare the splatted value against the integer constant.

Reviewers: spatel, anna, mkazantsev

Reviewed By: spatel

Subscribers: efriedma, rengolin, llvm-commits

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

llvm-svn: 329087
2018-04-03 17:26:20 +00:00
George Rimar 1ef746ba21 [ELF] - Eliminate Lazy class.
Patch removes Lazy class which
is just an excessive layer.

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

llvm-svn: 329086
2018-04-03 17:16:52 +00:00
Alexey Bataev 428e9d9d87 [SLP] Fix PR36481: vectorize reassociated instructions.
Summary:
If the load/extractelement/extractvalue instructions are not originally
consecutive, the SLP vectorizer is unable to vectorize them. Patch
allows reordering of such instructions.

Patch does not support reordering of the repeated instruction, this must
be handled in the separate patch.

Reviewers: RKSimon, spatel, hfinkel, mkuper, Ayal, ashahid

Subscribers: llvm-commits

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

llvm-svn: 329085
2018-04-03 17:14:47 +00:00
Eric Christopher be1e262190 Remove a stale comment cut and pasted from another file.
llvm-svn: 329084
2018-04-03 17:07:05 +00:00
Andrea Di Biagio 8dabf4f145 [llvm-mca] Move the logic that prints register file statistics to its own view. NFCI
Before this patch, the "BackendStatistics" view was responsible for printing the
register file usage (as well as many other statistics).

Now users can enable register file usage statistics using the command line flag
`-register-file-stats`. By default, the tool doesn't print register file
statistics.

llvm-svn: 329083
2018-04-03 16:46:23 +00:00
Alexey Bataev df989c54cf Recommit "[SLP] Fix issues with debug output in the SLP vectorizer."
The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
errs() rather than dbgs().

llvm-svn: 329082
2018-04-03 16:40:33 +00:00
Florian Hahn b79217077d [LoopInterchange] Update tests so DA can handle access after D35430.
I have taken the opportunity to simplify some tests slightly and move
parts around.

It also brings back a few IR checks for interchangable loops.

Reviewers: karthikthecool, sebpop, grosser

Reviewed By: sebpop

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

llvm-svn: 329081
2018-04-03 16:37:58 +00:00
Alexey Bataev 976aff148a [SLP] Added tests for checks of reordering of the repeated instructions,
NFC.

llvm-svn: 329080
2018-04-03 16:31:26 +00:00
Krzysztof Parzyszek 9fa6ffe290 [Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329079
2018-04-03 16:06:36 +00:00
Krzysztof Parzyszek 45ac73f71a [Hexagon] Remove unneeded attributes from lit test
llvm-svn: 329078
2018-04-03 16:05:20 +00:00
Krzysztof Parzyszek 3163610010 [Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329077
2018-04-03 15:59:10 +00:00
Puyan Lotfi 764b386e20 Adding optional Name parameter to createVirtualRegister and createGenericVirtualRegister.
llvm-svn: 329076
2018-04-03 15:53:49 +00:00
Marshall Clow 082229eb0f Implement P0754R2: The <version> header.
llvm-svn: 329075
2018-04-03 15:48:24 +00:00
Andrea Di Biagio fbf37cc6c6 [llvm-mca] Remove redundant include from BackendStatistics.h. NFC
Also use llvm::DenseMap for Histograms (instead of std::map).

llvm-svn: 329074
2018-04-03 15:36:15 +00:00
Haojian Wu dc62da4e0b [clang-tidy] Check for sizeof that call functions
Summary:
A common mistake that I have found in our codebase is calling a function to get an integer or enum that represents the type such as:

```
int numBytes = numElements * sizeof(x.GetType());
```

So this extends the `sizeof` check to check for these cases. There is also a `WarnOnSizeOfCall` option so it can be disabled.

Patch by Paul Fultz II!

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

Reviewed By: alexfh

Subscribers: lebedev.ri, xazax.hun, jkorous-apple, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 329073
2018-04-03 15:10:24 +00:00
Guansong Zhang e47fbc9da8 [OpenMP] enable bc file compilation using the latest clang
Summary: adding cuda-rdc flag to allow extern global data

Reviewers: grokos

Reviewed By: grokos

Subscribers: gregrodgers, mgorny, openmp-commits

Tags: #openmp

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

llvm-svn: 329072
2018-04-03 15:01:34 +00:00
Benjamin Kramer 2fc3b18922 Revert "[SLP] Fix PR36481: vectorize reassociated instructions."
This reverts commit r328980 and r329046. Makes the vectorizer crash.

llvm-svn: 329071
2018-04-03 14:40:33 +00:00
Ben Hamilton 9dc7816346 [clang-format/ObjC] Do not detect "[]" as ObjC method expression
Summary:
The following C++ code was being detected by
`guessLanguage()` as Objective-C:

  #define FOO(...) auto bar = [] __VA_ARGS__;

This was because `[] __VA_ARGS__` is not currently detected as a C++
lambda expression (it has no parens or braces), so
`TokenAnnotator::parseSquare()` incorrectly treats the opening square
as an ObjC method expression.

We have two options to fix this:

1. Parse `[] __VA_ARGS__` explicitly as a C++ lambda
2. Make it so `[]` is never parsed as an Objective-C method expression

This diff implements option 2, which causes the `[` to be parsed
as `TT_ArraySubscriptLSquare` instead of `TT_ObjCMethodExpr`.

Note that when I fixed this, it caused one change in formatting
behavior, where the following was implicitly relying on the `[`
being parsed as `TT_ObjCMethodExpr`:

  A<int * []> a;

becomes:

  A<int *[]> a;

with `Style.PointerAlignment = Middle`.

I don't really know what the desired format is for this syntax; the
test was added by Janusz Sobczak and integrated by @djasper in
b511fe9818
.

I went ahead and changed the test for now.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

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

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits, djasper

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

llvm-svn: 329070
2018-04-03 14:07:11 +00:00
Ben Hamilton 1915d2ac4f [clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal
Summary:
D44816 attempted to fix a few cases where `clang-format` incorrectly
inserted a space before the closing brace of an Objective-C dictionary
literal.

This revealed there were still a few cases where we inserted a space
after the opening brace of an Objective-C dictionary literal.

This fixes the formatting to be consistent and adds more tests.

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

Reviewers: djasper, jolesiak, krasimir

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 329069
2018-04-03 14:07:09 +00:00
Andrea Di Biagio 823e5f90db [MC] Fix -Wmissing-field-initializer warning after r329067.
This should fix the problem reported by the lld buildbots:
 - Builder lld-x86_64-darwin13, Build #19782
 - Builder lld-perf-testsuite, Build #1419

llvm-svn: 329068
2018-04-03 13:52:26 +00:00
Andrea Di Biagio 9da4d6db33 [MC][Tablegen] Allow the definition of processor register files in the scheduling model for llvm-mca
This patch allows the description of register files in processor scheduling
models. This addresses PR36662.

A new tablegen class named 'RegisterFile' has been added to TargetSchedule.td.
Targets can optionally describe register files for their processors using that
class. In particular, class RegisterFile allows to specify:
 - The total number of physical registers.
 - Which target registers are accessible through the register file.
 - The cost of allocating a register at register renaming stage.

Example (from this patch - see file X86/X86ScheduleBtVer2.td)

  def FpuPRF : RegisterFile<72, [VR64, VR128, VR256], [1, 1, 2]>

Here, FpuPRF describes a register file for MMX/XMM/YMM registers. On Jaguar
(btver2), a YMM register definition consumes 2 physical registers, while MMX/XMM
register definitions only cost 1 physical register.

The syntax allows to specify an empty set of register classes.  An empty set of
register classes means: this register file models all the registers specified by
the Target.  For each register class, users can specify an optional register
cost. By default, register costs default to 1.  A value of 0 for the number of
physical registers means: "this register file has an unbounded number of
physical registers".

This patch is structured in two parts.

* Part 1 - MC/Tablegen *

A first part adds the tablegen definition of RegisterFile, and teaches the
SubtargetEmitter how to emit information related to register files.

Information about register files is accessible through an instance of
MCExtraProcessorInfo.
The idea behind this design is to logically partition the processor description
which is only used by external tools (like llvm-mca) from the processor
information used by the llvm machine schedulers.
I think that this design would make easier for targets to get rid of the extra
processor information if they don't want it.

* Part 2 - llvm-mca related *

The second part of this patch is related to changes to llvm-mca.

The main differences are:
 1) class RegisterFile now needs to take into account the "cost of a register"
when allocating physical registers at register renaming stage.
 2) Point 1. triggered a minor refactoring which lef to the removal of the
"maximum 32 register files" restriction.
 3) The BackendStatistics view has been updated so that we can print out extra
details related to each register file implemented by the processor.

The effect of point 3. is also visible in tests register-files-[1..5].s.

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

llvm-svn: 329067
2018-04-03 13:36:24 +00:00
Sanjay Patel d96a363855 [LangRef] fix description and examples of fptrunc
As noted in PR36966:
https://bugs.llvm.org/show_bug.cgi?id=36966

The old description doesn't match what we do in code, 
so this just fixes the documentation to avoid confusion.

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

llvm-svn: 329065
2018-04-03 13:05:20 +00:00
Hiroshi Inoue 08a1775f28 [PowerPC] reorder entries in P9InstrResources.td in alphabetical order; NFC
Reorder entries added in my previous commit (rL328969) to keep alphabetical order.

llvm-svn: 329064
2018-04-03 12:49:42 +00:00
George Rimar 1fc9f39bd5 [ELF] - Check that output sections fit in address space.
Added checks to test that we do not produce
output where VA of sections overruns the address
space available.

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

llvm-svn: 329063
2018-04-03 12:39:28 +00:00
George Rimar 8fcd04b786 [ELF] - Fix the comment. NFC.
llvm-svn: 329062
2018-04-03 12:28:53 +00:00
George Rimar bc1d58a6b1 [ELF] - Relax checks for R_386_8/R_386_16 relocations.
This fixes PR36927.

The issue is next. Imagine we have -Ttext 0x7c and code below.

.code16
.global _start
_start:
movb $_start+0x83,%ah

So we have R_386_8 relocation and _start at 0x7C.
Addend is 0x83 == 131. We will sign extend it to 0xffffffffffffff83.

Now, 0xffffffffffffff83 + 0x7c gives us 0xFFFFFFFFFFFFFFFF.
Techically 0x83 + 0x7c == 0xFF, we do not exceed 1 byte value, but
currently LLD errors out, because we use checkUInt<8>.

Let's try to use checkInt<8> now and the following code to see if it can help (no):
main.s:
.byte foo

input.s:
.globl foo
.hidden foo
foo = 0xff

Here, foo is 0xFF. And addend is 0x0. Final value is 0x00000000000000FF.
Again, it fits one byte well, but with checkInt<8>,
we would error out it, so we can't use it.

What we want to do is to check that the result fits 1 byte well.
Patch changes the check to checkIntUInt to fix the issue.

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

llvm-svn: 329061
2018-04-03 12:19:04 +00:00
George Rimar bfbeecdc5d [ELF] - Simplify createFiles. NFCI.
Groups paired options together.

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

llvm-svn: 329060
2018-04-03 12:06:29 +00:00
George Rimar c6735c23d2 [ELF] - X86_64: don't allow 8/16 bit dynamic relocations.
Having 8/16 bits dynamic relocations is incorrect.

Both gold and bfd (built from latest sources) disallow
that too.

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

llvm-svn: 329059
2018-04-03 11:58:23 +00:00
George Rimar 624e163f53 [ELF] - Remove dead declaration. NFC.
llvm-svn: 329058
2018-04-03 10:40:39 +00:00
Chandler Carruth ff2f4fcd51 [x86] Fix a pretty obvious think-o with my asm scrubbing. You have to in
fact use regular expression syntax to use regular expressions.

Should restore the bots. Sorry for the noise on this test.

Thanks to Philip for spotting the bug!

llvm-svn: 329057
2018-04-03 10:28:56 +00:00
Chandler Carruth 44a791a57a [x86] Clean up and enhance a test around eflags copying.
This adds the basic test cases from all the EFLAGS bugs in more direct
forms. It also switches to generated check lines, and includes both
32-bit and 64-bit variations.

No functionality changing here, just setting things up to have a nice
clean asm diff in my EFLAGS patch.

llvm-svn: 329056
2018-04-03 10:04:37 +00:00
Chandler Carruth 6646becd0c [x86] Extend my goofy SP offset scrubbing for llc test cases to actually
do explicit scrubbing of the offsets of stack spills and reloads.

You can always turn this off in order to test specific stack slot usage.
We were already hiding most of this, but the new logic hides it more
generically. Notably, we should effectively hide stack slot churn in
functions that have a frame pointer now, and should also hide it when
changing a function from stack pointer to frame pointer. That transition
already changes enough to be clearly noticed in the test case diff,
showing *every* spill and reload is really noisy without benefit. See
the test case I ran this on as a classic example.

llvm-svn: 329055
2018-04-03 09:57:05 +00:00
Alexander Potapenko ac70668cff MSan: introduce the conservative assembly handling mode.
The default assembly handling mode may introduce false positives in the
cases when MSan doesn't understand that the assembly call initializes
the memory pointed to by one of its arguments.

We introduce the conservative mode, which initializes the first
|sizeof(type)| bytes for every |type*| pointer passed into the
assembly statement.

llvm-svn: 329054
2018-04-03 09:50:06 +00:00
Simon Dardis a826ca7079 [clangd][cmake] Provide libatomic when there is no native support for 64bit atomics
This addresses a persistent failure on clang-cmake-mips buildbot.

Reviewers: ioeric

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

llvm-svn: 329053
2018-04-03 09:40:07 +00:00
Hans Wennborg 729eb0b2f8 UsersManual.rst: update text for /GX- to match r328708
llvm-svn: 329052
2018-04-03 09:28:21 +00:00
Serguei Katkov 2ace8dc1c3 [SCEV] Fix PR36974.
The patch changes the usage of dominate to properlyDominate
to satisfy the condition !(a < a) while using std::max.

It is actually NFC due to set data structure is used to keep
the Loops and no two identical loops can be in collection.
So in reality there is no difference between usage of
dominate and properlyDominate in this particular case.
However it might be changed so it is better to fix it.

llvm-svn: 329051
2018-04-03 07:29:00 +00:00
Eric Christopher b0c403d7ae Add a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.
Useful when looking for indirect calls/jmps the need mitigation
via retpoline or other mitigations for Spectre v2.

Feedback, extension, additional patches welcome.

llvm-svn: 329050
2018-04-03 07:01:33 +00:00
Craig Topper 9b6a65b9ef [X86] Reduce number of OpPrefix bits in TSFlags to 2. NFCI
TSFlag doesn't need to disambiguate NoPrfx from PS. So shift the encodings so PS is NoPrfx|0x4.

llvm-svn: 329049
2018-04-03 06:37:04 +00:00
Craig Topper 7d522b6eee [X86][TableGen] Add a missing error check to make sure EVEX instructions use one PS/PD/XS/XD prefixes.
llvm-svn: 329048
2018-04-03 06:37:01 +00:00
Max Kazantsev c01e47b43f [SCEV] Make computeExitLimit more simple and more powerful
Current implementation of `computeExitLimit` has a big piece of code
the only purpose of which is to prove that after the execution of this
block the latch will be executed. What it currently checks is actually a
subset of situations where the exiting block dominates latch.

This patch replaces all these checks for simple particular cases with
domination check over loop's latch which is the only necessary condition
of taking the exiting block into consideration. This change allows to
calculate exact loop taken count for simple loops like

  for (int i = 0; i < 100; i++) {
    if (cond) {...} else {...}
    if (i > 50) break;
    . . .
  }

Differential Revision: https://reviews.llvm.org/D44677
Reviewed By: efriedma

llvm-svn: 329047
2018-04-03 05:57:19 +00:00
Chandler Carruth 597bfd8448 [SLP] Fix issues with debug output in the SLP vectorizer.
The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
`errs()` rather than `dbgs()`.

llvm-svn: 329046
2018-04-03 05:27:28 +00:00
Craig Topper 95dade523a [TableGen] Use llvm::cast instead of static_cast so that the cast will be checked. NFC
llvm-svn: 329045
2018-04-03 05:10:12 +00:00
Rafael Espindola 95f8d303ab Use OffsetMap in getSectionPiece.
OffsetMap maps to a SectionPiece index, but we were not taking
advantage of that in getSectionPiece.

With this patch both getOffset and getSectionPiece use OffsetMap and
the binary search is moved to findSectionPiece.

llvm-svn: 329044
2018-04-03 04:06:14 +00:00