Commit Graph

282949 Commits

Author SHA1 Message Date
Zachary Turner 8826d24576 Try again to fix the build.
This doesn't repro with clang or MSVC so I'm just blindly
guessing.

llvm-svn: 325389
2018-02-16 21:10:34 +00:00
Zachary Turner 10a748aa1e Try to fix broken build with some compilers.
llvm-svn: 325388
2018-02-16 20:58:25 +00:00
Rui Ueyama 61dc84a4db Remove `else` after `break`.
llvm-svn: 325387
2018-02-16 20:53:53 +00:00
Zachary Turner cafd476836 Fix emission of PDB string table.
This was originally reported as a bug with the symptom being "cvdump
crashes when printing an LLD-linked PDB that has an S_FILESTATIC record
in it". After some additional investigation, I determined that this was
a symptom of a larger problem, and in fact the real problem was in the
way we emitted the global PDB string table. As evidence of this, you can
take any lld-generated PDB, run cvdump -stringtable on it, and it would
return no results.

My hypothesis was that cvdump could not *find* the string table to begin
with. Normally it would do this by looking in the "named stream map",
finding the string /names, and using its value as the stream index. If
this lookup fails, then cvdump would fail to load the string table.

To test this hypothesis, I looked at the name stream map generated by a
link.exe PDB, and I emitted exactly those bytes into an LLD-generated
PDB. Suddenly, cvdump could read our string table!

This code has always been hacky and we knew there was something we
didn't understand. After all, there were some comments to the effect of
"we have to emit strings in a specific order, otherwise things don't
work". The key to fixing this was finally understanding this.

The way it works is that it makes use of a generic serializable hash map
that maps integers to other integers. In this case, the "key" is the
offset into a buffer, and the value is the stream number. If you index
into the buffer at the offset specified by a given key, you find the
name. The underlying cause of all these problems is that we were using
the identity function for the hash. i.e. if a string's offset in the
buffer was 12, the hash value was 12. Instead, we need to hash the
string *at that offset*. There is an additional catch, in that we have
to compute the hash as a uint32 and then truncate it to uint16.

Making this work is a little bit annoying, because we use the same hash
table in other places as well, and normally just using the identity
function for the hash function is actually what's desired. I'm not
totally happy with the template goo I came up with, but it works in any
case.

The reason we never found this bug through our own testing is because we
were building a /parallel/ hash table (in the form of an
llvm::StringMap<>) and doing all of our lookups and "real" hash table
work against that. I deleted all of that code and now everything goes
through the real hash table. Then, to test it, I added a unit test which
adds 7 strings and queries the associated values. I test every possible
insertion order permutation of these 7 strings, to verify that it really
does work as expected.

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

llvm-svn: 325386
2018-02-16 20:46:04 +00:00
Simon Pilgrim c2ee69035c Remove useless comment - seems to be a copy+paste typo. NFCI
llvm-svn: 325385
2018-02-16 20:41:06 +00:00
Rui Ueyama e351c3a438 Use write32le instead of write32<little>.
llvm-svn: 325384
2018-02-16 20:38:15 +00:00
Rui Ueyama 1184253891 Refactor wasm/WriterUtil.{cpp,h}.
Summary:
 - Makes code more in line with LLVM style (e.g. const char * -> StringRef)
 - Do not use formatv since we can construct message just by `+`
 - Replace some odd types such as `const StringRef` with more common type
 - Do not use default arguments if they are not necessary

Reviewers: sbc100

Subscribers: jfb, aheejin, llvm-commits, sunfish

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

llvm-svn: 325383
2018-02-16 20:38:00 +00:00
Sam Clegg b2f6e1c2f2 [WebAssebmly] Remove unneeded cast. NFC.
llvm-svn: 325382
2018-02-16 20:26:15 +00:00
Petr Hosek 330a00c41e [clang-include-fixer] Use add_clang_tool instead add_clang_executable
This makes it possible to include clang-include-fixer as distribution
component when building Clang based toolchain using CMake.

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

llvm-svn: 325381
2018-02-16 20:25:45 +00:00
Peter Collingbourne 09e04af42f ELF: Stop collecting a list of symbols in ArchiveFile.
There seems to be no reason to collect this list of symbols.

Also fix a bug where --exclude-libs would apply to all symbols that
appear in an archive's symbol table, even if the relevant archive
member was not added to the link.

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

llvm-svn: 325380
2018-02-16 20:23:54 +00:00
Rafael Espindola f931c179ca Don't depend on "call foo" producing a X86_64_PC32.
Newer versions of the gnu assembler produce a X86_64_PLT32 for
calls. There is a change under review in llvm to do the same, so update
the tests to not depend on it.

We can still produce a R_X86_64_PC32 with ".long foo - .".

llvm-svn: 325379
2018-02-16 20:05:58 +00:00
Evandro Menezes 10ae20d80c [AArch64] Fix BITCAST lowering crash
The data type is assumed to be a vector, but sometimes it is not, leading
to an assertion.

Add simple test-case to verify this.

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

llvm-svn: 325378
2018-02-16 20:00:57 +00:00
Rui Ueyama 7b9ed65666 Style fix. NFC.
llvm-svn: 325377
2018-02-16 19:53:29 +00:00
Sam Clegg fe78ccf1a1 [WebAssembly] Fix bug is function signature checking
This bug effected undefined symbols that were resolved by
existing defined symbols.  We were skipping the signature
check in this case.

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

llvm-svn: 325376
2018-02-16 19:45:41 +00:00
Reid Kleckner d23e73cda9 [MS] Make constexpr static data members implicitly inline
This handles them exactly the same way that we handle const integral
static data members with inline definitions, which is what MSVC does.

As a follow-up, now that we have a way to mark variables inline in the
AST, we should consider marking them implicitly inline there instead of
only treating them as inline in CodeGen. Unfortunately, this breaks a
lot of dllimport test cases, so that is future work for now.

Fixes PR36125.

llvm-svn: 325375
2018-02-16 19:44:47 +00:00
Eugene Zelenko a84485ed8d [Documentation] Fix Sphinx error. Limit text width to 80 characters.
llvm-svn: 325374
2018-02-16 19:31:28 +00:00
Alexey Bataev 9a75738b2b [OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.
Compiler erroneously returned wrong data-sharing attributes for the
constant variables if they have explictly specified attributes.

llvm-svn: 325373
2018-02-16 19:16:54 +00:00
Changpeng Fang ba92059ca9 AMDGPU/SI: Extend promoting alloca to vector to arrays of up to 16 elements
Summary:
  This patch extends the promotion of alloca to vector to the arrays of up to 16 elements. Also we introduce
an option, -disable-promote-alloca-to-vector, to switch promotion to vector off, if needed.

Reviewers:
  arsenm

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

llvm-svn: 325372
2018-02-16 19:14:17 +00:00
Craig Topper de565fc73e [X86] Only reorder srl/and on last DAG combiner run
This seems to interfere with a target independent brcond combine that looks for the (srl (and X, C1), C2) pattern to enable TEST instructions. Once we flip, that combine doesn't fire and we end up exposing it to the X86 specific BT combine which causes us to emit a BT instruction. BT has lower throughput than TEST.

We could try to make the brcond combine aware of the alternate pattern, but since the flip was just a code size reduction and not likely to enable other combines, it seemed easier to just delay it until after lowering.

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

llvm-svn: 325371
2018-02-16 18:51:09 +00:00
Sam Clegg 3d1f4b954d [WebAssembly] Fix typos in comment. NFC.
Patch by Nicholas Wilson!

llvm-svn: 325370
2018-02-16 18:37:32 +00:00
Alexey Bataev 96dae81d7f [OPENMP] Fix parsing of the directives with inner directives.
The parsing may lead to compiler hanging because of the incorrect
processing of inner OpenMP pragmas.

llvm-svn: 325369
2018-02-16 18:36:44 +00:00
Craig Topper 79bd39db80 [X86] Remove call to ShrinkDemandedCosntant from the SHRUNKBLEND creation code.
We only run this code if know the condition isn't a constant vector. ShrinkDemandedConstant isn't going to find any different.

llvm-svn: 325368
2018-02-16 18:34:46 +00:00
Sam Clegg b7a5469c7e [WebAssembly] MC: Make explicit our current lack of support for relocations against unnamed temporary symbols.
Add an explicit check before looking up symbol in SymbolIndices.
This was previously silently succeeding and returning zero for such
unnamed temporaries.

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

llvm-svn: 325367
2018-02-16 18:06:05 +00:00
Sanjay Patel 91bb775087 [InstCombine] clean up fdiv-with-fdiv folds; NFCI
llvm-svn: 325366
2018-02-16 17:52:32 +00:00
Sanjay Patel 870fbda805 [InstCombine] add FMF to better show current fdiv fold behavior; NFC
llvm-svn: 325365
2018-02-16 17:46:50 +00:00
Erich Keane 29636aaaa6 Clean up 'target' attribute diagnostics
There were a few issues previously with the target
attribute diagnostics implementation that lead to the
attribute being added to the AST despite having an error
in it.

This patch changes that, and adds a test to ensure it
does not get added to the AST.

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

llvm-svn: 325364
2018-02-16 17:31:59 +00:00
Simon Pilgrim 1b81064d1e Fix signed/unsigned comparison warning. NFCI.
llvm-svn: 325363
2018-02-16 17:26:59 +00:00
Eugene Leviant 8c83b9b8c5 [ThinLTO] Fix data race in test #2
Switched to the right option (-thinlto-threads)

llvm-svn: 325362
2018-02-16 17:25:03 +00:00
Eugene Leviant c9724d9149 [ThinLTO] Fix data race in test
llvm-svn: 325361
2018-02-16 16:56:33 +00:00
Rafael Espindola b960325989 Simplify RelocationBaseSection::addReloc.
Now that we have R_ADDEND, UseSymVA was redundant. We only want to
write the symbol virtual address when using an expression other than
R_ADDEND.

llvm-svn: 325360
2018-02-16 16:53:04 +00:00
Simon Pilgrim 5d005a359e Fix signed/unsigned comparison warning. NFCI.
llvm-svn: 325359
2018-02-16 16:52:50 +00:00
Sanjay Patel e16b0cfba9 [InstCombine] remove redundant debug info setting; NFC
The IRBuilder sets debuginfo in Insert(), so this was duplicating what already happened.

llvm-svn: 325358
2018-02-16 16:42:04 +00:00
Sam McCall a90f257b35 [clangd] Include timestamps in log messages.
llvm-svn: 325357
2018-02-16 16:41:42 +00:00
Brian M. Rzycki f1a7df5ef2 [JumpThreading] PR36133 enable/disable DominatorTree for LVI analysis
Summary:
The LazyValueInfo pass caches a copy of the DominatorTree when available.
Whenever there are pending DominatorTree updates within JumpThreading's
DeferredDominance object we cannot use the cached DT for LVI analysis.
This commit adds the new methods enableDT() and disableDT() to LVI.
JumpThreading also sets the appropriate usage model before calling LVI
analysis methods.

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

Reviewers: sebpop, dberlin, kuhar

Reviewed by: sebpop, kuhar

Subscribers: uabelho, llvm-commits, aprantl, hiraditya, a.elovikov

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

llvm-svn: 325356
2018-02-16 16:35:17 +00:00
Changpeng Fang da38b5fd49 AMDGPU/SI: Turn off GPR Indexing Mode immediately after the interested instruction.
Summary:
  In the current implementation of GPR Indexing Mode when the index is of non-uniform, the s_set_gpr_idx_off instruction
is incorrectly inserted after the loop. This will lead the instructions with vgpr operands (v_readfirstlane for example) to read incorrect
vgpr.
 In this patch, we fix the issue by inserting s_set_gpr_idx_on/off immediately around the interested instruction.

Reviewers:
  rampitec

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

llvm-svn: 325355
2018-02-16 16:31:30 +00:00
Simon Pilgrim ff53a4a234 [SelectionDAG] Enable SimplifyDemandedVectorElts support for simplifying shuffle masks
Based off the DemandedElts mask the and UNDEF elements returned from the SimplifyDemandedVectorElts calls to the shuffle operands, we can attempt to simplify the shuffle mask.

I had to be very conservative here as accepting post-legalized shuffle masks could cause problems for targets that legalize UNDEF mask elements back to inrange values (PowerPC), similarly combining to identity shuffle masks could cause too much UNDEF information to disappear for later combines.

llvm-svn: 325354
2018-02-16 16:22:14 +00:00
Sanjay Patel 65da14d6c8 [InstCombine] reduce code duplication; NFC
llvm-svn: 325353
2018-02-16 16:13:20 +00:00
Frederich Munch af2aee930f Use Token::isOneOf method in Parser.
Summary: Easier to read and possibly optimize.

Reviewers: rsmith, sepavloff

Reviewed By: sepavloff

Subscribers: sepavloff, cfe-commits

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

llvm-svn: 325352
2018-02-16 16:07:33 +00:00
Sjoerd Meijer e145c1d44f [ARM] Add tests for the vcvtr builtins
This adds Sema and Codegen tests for the vcvtr builtins
(because they were missing).

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

llvm-svn: 325351
2018-02-16 16:01:08 +00:00
Simon Pilgrim 4e2f757dc1 [X86][SSE] Allow float domain crossing if we are merging 2 or more shuffles and the root started as a float domain shuffle
llvm-svn: 325349
2018-02-16 14:57:25 +00:00
Nemanja Ivanovic 6cf41b028d [PowerPC] Fix transform in table gen file causing UB
Running a bootstrap build with UBSan produces a number of instances where
we have signed integer overflow due to this transform. Change the type to
long to prevent this UB on 64-bit build machines.

llvm-svn: 325347
2018-02-16 14:49:01 +00:00
Eric Liu e44533b7f1 [clangd] remove redundant ';' introduced in r325343
llvm-svn: 325346
2018-02-16 14:47:08 +00:00
Kamil Rytarowski bab5252789 Add initial XRay support for NetBSD
Summary:
Reuse the existing FreeBSD code as it is.

Sponsored by <The NetBSD Foundation>

Reviewers: dberris, rnk, vitalybuka

Reviewed By: dberris

Subscribers: mclow.lists, emaste, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325345
2018-02-16 14:45:20 +00:00
Eric Liu c5105f9e3c [clangd] collect symbol #include & insert #include in global code completion.
Summary:
o Collect suitable #include paths for index symbols. This also does smart mapping
for STL symbols and IWYU pragma (code borrowed from include-fixer).
o For global code completion, add a command for inserting new #include in each code
completion item.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, mgorny, ilya-biryukov, jkorous-apple, hintonda, cfe-commits

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

llvm-svn: 325343
2018-02-16 14:15:55 +00:00
Brian Gesiak 521b13b001 [Coroutines] Use target-agnostic size_t in test
Summary:
Fix a test failure on ARM hosts that was caused by a difference in the type of
size_t, by using a target-agnostic definiton.

Test Plan:
```
clang -cc1 -internal-isystem build/lib/clang/7.0.0/include -nostdsysteminc \
      -std=c++14 -fcoroutines-ts -verify clang/test/SemaCXX/coroutines.cpp \
      -fcxx-exceptions -fexceptions \
      -triple armeb-none-eabi
```

llvm-svn: 325342
2018-02-16 14:11:27 +00:00
Simon Dardis b8ae30ecec [mips] Remove codegen support from some 16 bit instructions
These instructions conflict with their full length variants
for the purposes of FastISel as they cannot be distingushed
based on the number and type of operands and predicates.

Reviewers: atanasyan

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

llvm-svn: 325341
2018-02-16 13:34:23 +00:00
Pavel Labath 1c7211d754 Shorten socket names in TestPlatformProcessConnect
The test was generating long unix socket names, and the addition of a
new folder in the previous patch pushed it over the limit (although
linux has a fairly generous limit for path names, this does not apply to
unix sockets).

Modify the test to use a shorter name instead.

llvm-svn: 325340
2018-02-16 12:57:35 +00:00
Jonas Devlieghere 1a584e898b Re-enable lang/objc/modules/TestObjCModules
The reason this test was disabled is no longer relevant. However, it
didn't turn into an unexpected success because of a syntax error in the
test itself. This commit fixes that and re-enables the test.

llvm-svn: 325339
2018-02-16 12:33:10 +00:00
Simon Pilgrim 0ffde50f9c [SelectionDAG] Add initial SimplifyDemandedVectorElts support for simplifying VSELECT operands
This just adds a basic pass through - we can add constant selection mask handling in a future patch to fully match InstCombine.

llvm-svn: 325338
2018-02-16 12:21:08 +00:00
Ilya Biryukov 7d60d20d57 [clangd] Assert path is absolute when assigning to URIForFile.
Summary:
The assertion will point directly to misbehaving code, so that
debugging related problems (like the one fixed by r325029) is easier.

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 325337
2018-02-16 12:20:47 +00:00