platform/upstream/llvm.git
6 years agoRecognize all NetBSD architectures in UBSan
Kamil Rytarowski [Sat, 17 Feb 2018 13:35:09 +0000 (13:35 +0000)]
Recognize all NetBSD architectures in UBSan

Summary:
Use uniform accessors for Program Pointer,
Stack Pointer and Frame Pointer.

Remove CPU check in UBSan supported platforms
and rely only on the OS type.

This adds NetBSD support in GetPcSpBp() for:
 - ARM
 - ARM64
 - HPPA
 - PowerPC/PowerPC64
 - SPARC/SPARC64
 - MIPS
 - DEC Alpha AXP
 - DEC VAX
 - M68K and M68010
 - SH3
 - IA64
 - OR1K
 - RISCV

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, ro

Reviewed By: vitalybuka

Subscribers: aemerson, jyknight, sdardis, kubamracek, arichardson, llvm-commits, kristof.beyls, fedor.sergeev, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325431

6 years ago[dwarfdump] Fix spurious verification errors for DW_AT_location attributes
Jonas Devlieghere [Sat, 17 Feb 2018 13:06:37 +0000 (13:06 +0000)]
[dwarfdump] Fix spurious verification errors for DW_AT_location attributes

Verifying any DWARF file that is optimized and contains at least one tag
with a DW_AT_location with a location list offset as a
DW_AT_form_dataXXX results in dwarfdump spuriously claiming that the
location list is invalid.

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

llvm-svn: 325430

6 years ago[DAGCombiner] Remove simplifyShuffleMask - now handled more generally by SimplifyDema...
Simon Pilgrim [Sat, 17 Feb 2018 12:36:56 +0000 (12:36 +0000)]
[DAGCombiner] Remove simplifyShuffleMask - now handled more generally by SimplifyDemandedVectorElts.

llvm-svn: 325429

6 years agoFix signed/unsigned comparison warning in AsmGenMatcher generated code. NFCI.
Simon Pilgrim [Sat, 17 Feb 2018 12:29:47 +0000 (12:29 +0000)]
Fix signed/unsigned comparison warning in AsmGenMatcher generated code. NFCI.

llvm-svn: 325428

6 years ago[DebugInfo] Removed assert on missing CountVarDIE
Sander de Smalen [Sat, 17 Feb 2018 11:06:53 +0000 (11:06 +0000)]
[DebugInfo] Removed assert on missing CountVarDIE

Summary:
The assert for a DISubrange's CountVarDIE to be available fails
when the dbg.value() has been optimized away for any reason.
Having the assert for that is a little heavy, so instead removing
it now in favor of not generating the 'count' expression.

Addresses http://llvm.org/PR36263 .

Reviewers: aprantl, dblaikie, probinson

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits, dstenb

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

llvm-svn: 325427

6 years agoReport fatal error in the case of out of memory
Serge Pavlov [Sat, 17 Feb 2018 10:21:33 +0000 (10:21 +0000)]
Report fatal error in the case of out of memory

This is partial recommit of r325224, reverted in 325227. The relevant
part of original comment is below.

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

Usual programming practice does not require checking result of 'operator
new' because it throws 'std::bad_alloc' in the case of allocation error.
However, LLVM is usually built with exceptions turned off, so 'new' can
return null pointer. This change installs custom new handler, which causes
fatal error in the case of out of memory. The handler is installed
automatically prior to call to 'main' during construction of a static
object defined in 'lib/Support/ErrorHandling.cpp'. If the application does
not use this file, the handler may be installed manually by a call to
'llvm::install_out_of_memory_new_handler', declared in
'include/llvm/Support/ErrorHandling.h".

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

llvm-svn: 325426

6 years ago[AMDGPU] Return true in enableMultipleCopyHints().
Jonas Paulsson [Sat, 17 Feb 2018 10:00:28 +0000 (10:00 +0000)]
[AMDGPU]  Return true in enableMultipleCopyHints().

Enable multiple COPY hints to eliminate more COPYs during register allocation.

Note that this is something all targets should do, see
https://reviews.llvm.org/D38128.

Review: Stanislav Mekhanoshin, Tom Stellard.
llvm-svn: 325425

6 years ago[OMPT] Omissionin in OMPT Formatting
Joachim Protze [Sat, 17 Feb 2018 09:54:10 +0000 (09:54 +0000)]
[OMPT] Omissionin in OMPT Formatting

Applying clang-format to the /runtime/src/ folder

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

llvm-svn: 325424

6 years ago[OMPT] Add interoperability testcase
Joachim Protze [Sat, 17 Feb 2018 09:40:08 +0000 (09:40 +0000)]
[OMPT] Add interoperability testcase

Test whether OMPT-callbacks for two threads that initiate a parallel region are correct.

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

llvm-svn: 325423

6 years ago[OMPT] Update api_calls testcase
Joachim Protze [Sat, 17 Feb 2018 09:40:02 +0000 (09:40 +0000)]
[OMPT] Update api_calls testcase

Only use ompt_ functions when testing OMPT in api_calls testcase.
Add size parameter to print_list.
Fix small bug in implementation of ompt_get_partition_place_nums(): return correct length.

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

llvm-svn: 325422

6 years agoRevert "[MachineCopyPropagation] Extend pass to do COPY source forwarding"
Quentin Colombet [Sat, 17 Feb 2018 03:05:33 +0000 (03:05 +0000)]
Revert "[MachineCopyPropagation] Extend pass to do COPY source forwarding"

This reverts commit r323991.

This commit breaks target that don't model all the register constraints
in TableGen. So far the workaround was to set the
hasExtraXXXRegAllocReq, but it proves that it doesn't cover all the
cases.
For instance, when mutating an instruction (like in the lowering of
COPYs) the isRenamable flag is not properly updated. The same problem
will happen when attaching machine operand from one instruction to
another.

Geoff Berry is working on a fix in https://reviews.llvm.org/D43042.

llvm-svn: 325421

6 years ago[DAG, X86] Revert r324797, r324491, and r324359.
Chandler Carruth [Sat, 17 Feb 2018 02:26:25 +0000 (02:26 +0000)]
[DAG, X86] Revert r324797, r324491, and r324359.

Sadly, r324359 caused at least PR36312. There is a patch out for review
but it seems to be taking a bit and we've already had these crashers in
tree for too long. We're hitting this PR in real code now and are
blocked on shipping new compilers as a consequence so I'm reverting us
back to green.

Sorry for the churn due to the stacked changes that I had to revert. =/

llvm-svn: 325420

6 years ago[InstSimplify] add vector select tests with undef elts in condition; NFC
Sanjay Patel [Sat, 17 Feb 2018 01:18:53 +0000 (01:18 +0000)]
[InstSimplify] add vector select tests with undef elts in condition; NFC

llvm-svn: 325419

6 years ago[WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.
Sam Clegg [Sat, 17 Feb 2018 00:44:21 +0000 (00:44 +0000)]
[WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.

We already have isa<> for this, and these methods were simply
duplicating those redundantly.

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

llvm-svn: 325418

6 years ago[X86] Turn selects with constant condition into vector shuffles during DAG combine
Craig Topper [Sat, 17 Feb 2018 00:30:30 +0000 (00:30 +0000)]
[X86] Turn selects with constant condition into vector shuffles during DAG combine

Summary:
Currently we convert to shuffles during lowering. This moves it to DAG combine so hopefully we can get it done before type legalization has to extend the condition.

I believe in some cases we're creating SHRUNKBLENDs that end up with constant conditions because we see the extended on the condition and think its a dynamic selelect before DAG combine gets a chance to constant fold the extend. We could add combines to turn SHRUNKBLENDs with constant condition back to vselect. But it seemed like it might be better to just send them to shuffles as early as possible so they never get a chance to become SHRUNKBLENDs. This the reason some tests went from blends controlled by a constant pool load to just move.

Some of the constant pool entries changed because the sign_extend introduced by type legalization turned undef elements in select condition into 0s. While the select->shuffle used -1 in the shuffle mask. So now the shuffle lowering can do what it wants with them.

I'll remove the lowering code as a follow up. We might be able to simplify some of the pre-checks for SHRUNKBLEND as the FIXME there says.

Reviewers: spatel, RKSimon, efriedma, zvi, andreadb

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 325417

6 years agoUse toString to print out garbage-collected sections.
Rui Ueyama [Sat, 17 Feb 2018 00:09:49 +0000 (00:09 +0000)]
Use toString to print out garbage-collected sections.

Currently, archive file name is missing in this message. In general,
we should avoid constructing strings in an ad-hoc manner and instead
use toString() to get consistent output strings.

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

llvm-svn: 325416

6 years ago[WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.
Sam Clegg [Fri, 16 Feb 2018 23:50:23 +0000 (23:50 +0000)]
[WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.

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

llvm-svn: 325415

6 years ago[WebAssembly] Remove unneeded Chunk::getFileName() method. NFC.
Sam Clegg [Fri, 16 Feb 2018 23:46:51 +0000 (23:46 +0000)]
[WebAssembly] Remove unneeded Chunk::getFileName() method. NFC.

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

llvm-svn: 325414

6 years agoRemove "--full-shutdown" and instead use an environment variable LLD_IN_TEST.
Rui Ueyama [Fri, 16 Feb 2018 23:41:48 +0000 (23:41 +0000)]
Remove "--full-shutdown" and instead use an environment variable LLD_IN_TEST.

We are running lld tests with "--full-shutdown" option because we don't
want to call _exit() in lld if it is running tests. Regular shutdown
is needed for leak sanitizer.

This patch changes the way how we tell lld that it is running tests.
Now "--full-shutdown" is removed, and LLD_IN_TEST environment variable
is used instead.

This patch enables full shutdown on all ports, e.g. ELF, COFF and wasm.
Previously, we enabled it only for ELF.

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

llvm-svn: 325413

6 years ago[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 16 Feb 2018 23:40:07 +0000 (23:40 +0000)]
[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 325412

6 years ago[ThinLTO] Allow indexing to request backend to ignore the module
Vitaly Buka [Fri, 16 Feb 2018 23:38:22 +0000 (23:38 +0000)]
[ThinLTO] Allow indexing to request backend to ignore the module

Summary:
Gold plugin does not add pass to ThinLTO modules without useful symbols.
In this case ThinLTO can't create corresponding index file and some features, like CFI,
cannot be processes by backed correctly without index.
Given that we don't need the backed output we can request it to avoid
processing the module. This is implemented by this patch using new
"SkipModuleByDistributedBackend" flag.

Reviewers: pcc, tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 325411

6 years ago[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set
Vitaly Buka [Fri, 16 Feb 2018 23:34:16 +0000 (23:34 +0000)]
[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set

Summary:
ThinLTO compilation may decide not to split module and keep at as regular LTO.
In this can this module already processed during indexing and already a part of
merged object file. So here we can just skip it.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 325410

6 years ago[clangd] Rename some protocol field to lower case
Marc-Andre Laperle [Fri, 16 Feb 2018 23:12:26 +0000 (23:12 +0000)]
[clangd] Rename some protocol field to lower case

Summary:
Also fixes a GCC compilation error.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 325409

6 years agoAMDGPU: Remove unused private member of AMDGPUTargetELFStreamer
Konstantin Zhuravlyov [Fri, 16 Feb 2018 23:04:11 +0000 (23:04 +0000)]
AMDGPU: Remove unused private member of AMDGPUTargetELFStreamer

llvm-svn: 325408

6 years agoRun these tests, the errors were old and not valid anymore.
Eric Christopher [Fri, 16 Feb 2018 23:02:28 +0000 (23:02 +0000)]
Run these tests, the errors were old and not valid anymore.

llvm-svn: 325407

6 years agoDo not print out "no input files" twice.
Rui Ueyama [Fri, 16 Feb 2018 22:58:19 +0000 (22:58 +0000)]
Do not print out "no input files" twice.

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

llvm-svn: 325406

6 years agoUse wasm-ld instead of "lld -flavor wasm".
Rui Ueyama [Fri, 16 Feb 2018 22:58:02 +0000 (22:58 +0000)]
Use wasm-ld instead of "lld -flavor wasm".

Invoking lld as ld.lld, ld.ld64, lld-link or wasm-ld is preferred
than invoking lld as lld and pass an -flavor option. We have "lld"
file mostly for historical reasons.

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

llvm-svn: 325405

6 years agoAMDGPU/LLD: Remove the use of binary file from one of the AMDGPU tests
Konstantin Zhuravlyov [Fri, 16 Feb 2018 22:55:36 +0000 (22:55 +0000)]
AMDGPU/LLD: Remove the use of binary file from one of the AMDGPU tests

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

llvm-svn: 325404

6 years agoRemove an unused function.
Eric Christopher [Fri, 16 Feb 2018 22:46:47 +0000 (22:46 +0000)]
Remove an unused function.

llvm-svn: 325403

6 years agoSilence an unsigned vs signed compare warning.
Eric Christopher [Fri, 16 Feb 2018 22:46:45 +0000 (22:46 +0000)]
Silence an unsigned vs signed compare warning.

llvm-svn: 325402

6 years ago[GISel]: Make GlobalISelEmitter rule prioritization compatible with selectionDAG
Aditya Nandakumar [Fri, 16 Feb 2018 22:37:15 +0000 (22:37 +0000)]
[GISel]: Make GlobalISelEmitter rule prioritization compatible with selectionDAG

This patch changes GlobalISelEmitter to rank patterns similar to how the
DAG does it (ie it computes a score for a pattern and adds the added
complexity to it).
This is so that the decision tree for GISelSelector remains compatible
with that of SelectionDAG.

https://reviews.llvm.org/D43270

llvm-svn: 325401

6 years agoAMDGPU: Update elf flags in amdgpu-elf-flags.s
Konstantin Zhuravlyov [Fri, 16 Feb 2018 22:35:36 +0000 (22:35 +0000)]
AMDGPU: Update elf flags in amdgpu-elf-flags.s

This is required after r325399:
  - EF_AMDGPU_ARCH_GCN got removed
  - In the test, EF_AMDGPU_ARCH_GCN is replaced with EF_AMDGPU_MACH_AMDGCN_GFX803

llvm-svn: 325400

6 years agoAMDGPU: Bring elf flags in sync with the spec
Konstantin Zhuravlyov [Fri, 16 Feb 2018 22:33:59 +0000 (22:33 +0000)]
AMDGPU: Bring elf flags in sync with the spec

- Add MACH flags
- Add XNACK flag
- Add reserved flags
- Minor cleanups in docs

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

llvm-svn: 325399

6 years ago[Constant] add floating-point helpers for normal/finite-nz; NFC
Sanjay Patel [Fri, 16 Feb 2018 22:32:54 +0000 (22:32 +0000)]
[Constant] add floating-point helpers for normal/finite-nz; NFC

...and delete the equivalent local functiona from InstCombine.

These might be useful to other InstCombine files or other passes
and makes FP queries more similar to integer constant queries.

llvm-svn: 325398

6 years agoMake sure we invoke ld64.lld and ld-wasm in the build directory.
Rui Ueyama [Fri, 16 Feb 2018 22:19:38 +0000 (22:19 +0000)]
Make sure we invoke ld64.lld and ld-wasm in the build directory.

llvm-svn: 325397

6 years ago[COFF] Add support for ARM64 secrel relocations for add/load instructions
Martin Storsjo [Fri, 16 Feb 2018 22:02:38 +0000 (22:02 +0000)]
[COFF] Add support for ARM64 secrel relocations for add/load instructions

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

llvm-svn: 325396

6 years ago[clangd] Implement textDocument/hover
Marc-Andre Laperle [Fri, 16 Feb 2018 21:38:15 +0000 (21:38 +0000)]
[clangd] Implement textDocument/hover

Summary: Implemention of textDocument/hover as described in LSP definition.

This patch adds a basic Hover implementation.  When hovering a variable,
function, method or namespace, clangd will return a text containing the
declaration's scope, as well as the declaration of the hovered entity.
For example, for a variable:

  Declared in class Foo::Bar

  int hello = 2

For macros, the macro definition is returned.

This patch doesn't include:

- markdown support (the client I use doesn't support it yet)
- range support (optional in the Hover response)
- comments associated to variables/functions/classes

They are kept as future work to keep this patch simpler.

I added tests in XRefsTests.cpp.  hover.test contains one simple
smoketest to make sure the feature works from a black box perspective.

Reviewers: malaperle, krasimir, bkramer, ilya-biryukov

Subscribers: sammccall, mgrang, klimek, rwols, ilya-biryukov, arphaman, cfe-commits

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

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Signed-off-by: William Enright <william.enright@polymtl.ca>
llvm-svn: 325395

6 years ago[X86] In lowerVSELECTtoVectorShuffle, don't map undef select condition to undef in...
Craig Topper [Fri, 16 Feb 2018 21:36:29 +0000 (21:36 +0000)]
[X86] In lowerVSELECTtoVectorShuffle, don't map undef select condition to undef in shuffle mask.

Undef in select condition means we should pick the element from one side or the other. An undef in a shuffle mask means pick any element from either source or worse.

I suspect by the time we get here most of the undefs in a constant vector have been removed by other things, but doing this for safety.

llvm-svn: 325394

6 years agoAMDGPU: Bring processors and features in sync with the spec
Konstantin Zhuravlyov [Fri, 16 Feb 2018 21:26:25 +0000 (21:26 +0000)]
AMDGPU: Bring processors and features in sync with the spec

- Remove gfx800
- Make iceland gfx802
- Add xnack to gfx902

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

llvm-svn: 325393

6 years agoRevert an accidental change to where "-flavor GNU" was used by intention.
Rui Ueyama [Fri, 16 Feb 2018 21:24:01 +0000 (21:24 +0000)]
Revert an accidental change to where "-flavor GNU" was used by intention.

llvm-svn: 325392

6 years ago[OPENMP] Do not emit messages for templates in declare target
Alexey Bataev [Fri, 16 Feb 2018 21:23:23 +0000 (21:23 +0000)]
[OPENMP] Do not emit messages for templates in declare target
constructs.

The compiler may emit some extra warnings for functions, that are
implicit specialization of the templates, declared in the target region.

llvm-svn: 325391

6 years agoReplace -flavor {gnu,darwin} with ld64.lld or ld.lld.
Rui Ueyama [Fri, 16 Feb 2018 21:16:57 +0000 (21:16 +0000)]
Replace -flavor {gnu,darwin} with ld64.lld or ld.lld.

llvm-svn: 325390

6 years agoTry again to fix the build.
Zachary Turner [Fri, 16 Feb 2018 21:10:34 +0000 (21:10 +0000)]
Try again to fix the build.

This doesn't repro with clang or MSVC so I'm just blindly
guessing.

llvm-svn: 325389

6 years agoTry to fix broken build with some compilers.
Zachary Turner [Fri, 16 Feb 2018 20:58:25 +0000 (20:58 +0000)]
Try to fix broken build with some compilers.

llvm-svn: 325388

6 years agoRemove `else` after `break`.
Rui Ueyama [Fri, 16 Feb 2018 20:53:53 +0000 (20:53 +0000)]
Remove `else` after `break`.

llvm-svn: 325387

6 years agoFix emission of PDB string table.
Zachary Turner [Fri, 16 Feb 2018 20:46:04 +0000 (20:46 +0000)]
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

6 years agoRemove useless comment - seems to be a copy+paste typo. NFCI
Simon Pilgrim [Fri, 16 Feb 2018 20:41:06 +0000 (20:41 +0000)]
Remove useless comment - seems to be a copy+paste typo. NFCI

llvm-svn: 325385

6 years agoUse write32le instead of write32<little>.
Rui Ueyama [Fri, 16 Feb 2018 20:38:15 +0000 (20:38 +0000)]
Use write32le instead of write32<little>.

llvm-svn: 325384

6 years agoRefactor wasm/WriterUtil.{cpp,h}.
Rui Ueyama [Fri, 16 Feb 2018 20:38:00 +0000 (20:38 +0000)]
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

6 years ago[WebAssebmly] Remove unneeded cast. NFC.
Sam Clegg [Fri, 16 Feb 2018 20:26:15 +0000 (20:26 +0000)]
[WebAssebmly] Remove unneeded cast. NFC.

llvm-svn: 325382

6 years ago[clang-include-fixer] Use add_clang_tool instead add_clang_executable
Petr Hosek [Fri, 16 Feb 2018 20:25:45 +0000 (20:25 +0000)]
[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

6 years agoELF: Stop collecting a list of symbols in ArchiveFile.
Peter Collingbourne [Fri, 16 Feb 2018 20:23:54 +0000 (20:23 +0000)]
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

6 years agoDon't depend on "call foo" producing a X86_64_PC32.
Rafael Espindola [Fri, 16 Feb 2018 20:05:58 +0000 (20:05 +0000)]
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

6 years ago[AArch64] Fix BITCAST lowering crash
Evandro Menezes [Fri, 16 Feb 2018 20:00:57 +0000 (20:00 +0000)]
[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

6 years agoStyle fix. NFC.
Rui Ueyama [Fri, 16 Feb 2018 19:53:29 +0000 (19:53 +0000)]
Style fix. NFC.

llvm-svn: 325377

6 years ago[WebAssembly] Fix bug is function signature checking
Sam Clegg [Fri, 16 Feb 2018 19:45:41 +0000 (19:45 +0000)]
[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

6 years ago[MS] Make constexpr static data members implicitly inline
Reid Kleckner [Fri, 16 Feb 2018 19:44:47 +0000 (19:44 +0000)]
[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

6 years ago[Documentation] Fix Sphinx error. Limit text width to 80 characters.
Eugene Zelenko [Fri, 16 Feb 2018 19:31:28 +0000 (19:31 +0000)]
[Documentation] Fix Sphinx error. Limit text width to 80 characters.

llvm-svn: 325374

6 years ago[OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.
Alexey Bataev [Fri, 16 Feb 2018 19:16:54 +0000 (19:16 +0000)]
[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

6 years agoAMDGPU/SI: Extend promoting alloca to vector to arrays of up to 16 elements
Changpeng Fang [Fri, 16 Feb 2018 19:14:17 +0000 (19:14 +0000)]
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

6 years ago[X86] Only reorder srl/and on last DAG combiner run
Craig Topper [Fri, 16 Feb 2018 18:51:09 +0000 (18:51 +0000)]
[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

6 years ago[WebAssembly] Fix typos in comment. NFC.
Sam Clegg [Fri, 16 Feb 2018 18:37:32 +0000 (18:37 +0000)]
[WebAssembly] Fix typos in comment. NFC.

Patch by Nicholas Wilson!

llvm-svn: 325370

6 years ago[OPENMP] Fix parsing of the directives with inner directives.
Alexey Bataev [Fri, 16 Feb 2018 18:36:44 +0000 (18:36 +0000)]
[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

6 years ago[X86] Remove call to ShrinkDemandedCosntant from the SHRUNKBLEND creation code.
Craig Topper [Fri, 16 Feb 2018 18:34:46 +0000 (18:34 +0000)]
[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

6 years ago[WebAssembly] MC: Make explicit our current lack of support for relocations against...
Sam Clegg [Fri, 16 Feb 2018 18:06:05 +0000 (18:06 +0000)]
[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

6 years ago[InstCombine] clean up fdiv-with-fdiv folds; NFCI
Sanjay Patel [Fri, 16 Feb 2018 17:52:32 +0000 (17:52 +0000)]
[InstCombine] clean up fdiv-with-fdiv folds; NFCI

llvm-svn: 325366

6 years ago[InstCombine] add FMF to better show current fdiv fold behavior; NFC
Sanjay Patel [Fri, 16 Feb 2018 17:46:50 +0000 (17:46 +0000)]
[InstCombine] add FMF to better show current fdiv fold behavior; NFC

llvm-svn: 325365

6 years agoClean up 'target' attribute diagnostics
Erich Keane [Fri, 16 Feb 2018 17:31:59 +0000 (17:31 +0000)]
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

6 years agoFix signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Fri, 16 Feb 2018 17:26:59 +0000 (17:26 +0000)]
Fix signed/unsigned comparison warning. NFCI.

llvm-svn: 325363

6 years ago[ThinLTO] Fix data race in test #2
Eugene Leviant [Fri, 16 Feb 2018 17:25:03 +0000 (17:25 +0000)]
[ThinLTO] Fix data race in test #2

Switched to the right option (-thinlto-threads)

llvm-svn: 325362

6 years ago[ThinLTO] Fix data race in test
Eugene Leviant [Fri, 16 Feb 2018 16:56:33 +0000 (16:56 +0000)]
[ThinLTO] Fix data race in test

llvm-svn: 325361

6 years agoSimplify RelocationBaseSection::addReloc.
Rafael Espindola [Fri, 16 Feb 2018 16:53:04 +0000 (16:53 +0000)]
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

6 years agoFix signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Fri, 16 Feb 2018 16:52:50 +0000 (16:52 +0000)]
Fix signed/unsigned comparison warning. NFCI.

llvm-svn: 325359

6 years ago[InstCombine] remove redundant debug info setting; NFC
Sanjay Patel [Fri, 16 Feb 2018 16:42:04 +0000 (16:42 +0000)]
[InstCombine] remove redundant debug info setting; NFC

The IRBuilder sets debuginfo in Insert(), so this was duplicating what already happened.

llvm-svn: 325358

6 years ago[clangd] Include timestamps in log messages.
Sam McCall [Fri, 16 Feb 2018 16:41:42 +0000 (16:41 +0000)]
[clangd] Include timestamps in log messages.

llvm-svn: 325357

6 years ago[JumpThreading] PR36133 enable/disable DominatorTree for LVI analysis
Brian M. Rzycki [Fri, 16 Feb 2018 16:35:17 +0000 (16:35 +0000)]
[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

6 years agoAMDGPU/SI: Turn off GPR Indexing Mode immediately after the interested instruction.
Changpeng Fang [Fri, 16 Feb 2018 16:31:30 +0000 (16:31 +0000)]
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

6 years ago[SelectionDAG] Enable SimplifyDemandedVectorElts support for simplifying shuffle...
Simon Pilgrim [Fri, 16 Feb 2018 16:22:14 +0000 (16:22 +0000)]
[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

6 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Fri, 16 Feb 2018 16:13:20 +0000 (16:13 +0000)]
[InstCombine] reduce code duplication; NFC

llvm-svn: 325353

6 years agoUse Token::isOneOf method in Parser.
Frederich Munch [Fri, 16 Feb 2018 16:07:33 +0000 (16:07 +0000)]
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

6 years ago[ARM] Add tests for the vcvtr builtins
Sjoerd Meijer [Fri, 16 Feb 2018 16:01:08 +0000 (16:01 +0000)]
[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

6 years ago[X86][SSE] Allow float domain crossing if we are merging 2 or more shuffles and the...
Simon Pilgrim [Fri, 16 Feb 2018 14:57:25 +0000 (14:57 +0000)]
[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

6 years ago[PowerPC] Fix transform in table gen file causing UB
Nemanja Ivanovic [Fri, 16 Feb 2018 14:49:01 +0000 (14:49 +0000)]
[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

6 years ago[clangd] remove redundant ';' introduced in r325343
Eric Liu [Fri, 16 Feb 2018 14:47:08 +0000 (14:47 +0000)]
[clangd] remove redundant ';' introduced in r325343

llvm-svn: 325346

6 years agoAdd initial XRay support for NetBSD
Kamil Rytarowski [Fri, 16 Feb 2018 14:45:20 +0000 (14:45 +0000)]
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

6 years ago[clangd] collect symbol #include & insert #include in global code completion.
Eric Liu [Fri, 16 Feb 2018 14:15:55 +0000 (14:15 +0000)]
[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

6 years ago[Coroutines] Use target-agnostic size_t in test
Brian Gesiak [Fri, 16 Feb 2018 14:11:27 +0000 (14:11 +0000)]
[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

6 years ago[mips] Remove codegen support from some 16 bit instructions
Simon Dardis [Fri, 16 Feb 2018 13:34:23 +0000 (13:34 +0000)]
[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

6 years agoShorten socket names in TestPlatformProcessConnect
Pavel Labath [Fri, 16 Feb 2018 12:57:35 +0000 (12:57 +0000)]
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

6 years agoRe-enable lang/objc/modules/TestObjCModules
Jonas Devlieghere [Fri, 16 Feb 2018 12:33:10 +0000 (12:33 +0000)]
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

6 years ago[SelectionDAG] Add initial SimplifyDemandedVectorElts support for simplifying VSELECT...
Simon Pilgrim [Fri, 16 Feb 2018 12:21:08 +0000 (12:21 +0000)]
[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

6 years ago[clangd] Assert path is absolute when assigning to URIForFile.
Ilya Biryukov [Fri, 16 Feb 2018 12:20:47 +0000 (12:20 +0000)]
[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

6 years ago[clang-format] Enable google text proto formatting in R"proto('s
Krasimir Georgiev [Fri, 16 Feb 2018 12:10:06 +0000 (12:10 +0000)]
[clang-format] Enable google text proto formatting in R"proto('s

llvm-svn: 325336

6 years agoRevert r325321 "[Sema] Take into account the current context when checking the"
Hans Wennborg [Fri, 16 Feb 2018 12:06:32 +0000 (12:06 +0000)]
Revert r325321 "[Sema] Take into account the current context when checking the"

This broke the Chromium build, see https://crbug.com/813017

> accessibility of a class member.
>
> This fixes PR32898.
>
> rdar://problem/33737747
>
> Differential revision: https://reviews.llvm.org/D36918

llvm-svn: 325335

6 years agoFix paralelization of remote tests
Pavel Labath [Fri, 16 Feb 2018 11:39:38 +0000 (11:39 +0000)]
Fix paralelization of remote tests

Since we now can run multiple tests from the same directory at once, we
need to include the test name in the remote test directory instead.

I'm not sure if the test_number in the remote path is necessary anymore
(or even if it was ever necessary), but I choose to leave it in for now.

llvm-svn: 325334

6 years ago[ELF] Extend symbol-order-warnings test case for ICF
James Henderson [Fri, 16 Feb 2018 10:49:57 +0000 (10:49 +0000)]
[ELF] Extend symbol-order-warnings test case for ICF

Reviewed by: rafael

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

There is some discussion as to the exact behaviour of combining ICF and
--symbol-ordering-file, but it seems beneficial to warn when attempting
to order the removed symbol regardless of the preferred approach.

llvm-svn: 325333

6 years ago[ELF] - Fix comment. NFC.
George Rimar [Fri, 16 Feb 2018 10:46:50 +0000 (10:46 +0000)]
[ELF] - Fix comment. NFC.

Addresses forgotten comment for D43071.

llvm-svn: 325332

6 years ago[ELF] - Support COPY, INFO, OVERLAY output sections attributes.
George Rimar [Fri, 16 Feb 2018 10:42:58 +0000 (10:42 +0000)]
[ELF] - Support COPY, INFO, OVERLAY output sections attributes.

This is PR36298.

(COPY), (INFO), (OVERLAY) all have the same effect:
section should be marked as non-allocatable.

(https://www.eecs.umich.edu/courses/eecs373/readings/Linker.pdf,
3.6.8.1 Output Section Type)

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

llvm-svn: 325331

6 years ago[Transforms] Propagate TBAA info in SROA
Ivan A. Kosarev [Fri, 16 Feb 2018 10:10:29 +0000 (10:10 +0000)]
[Transforms] Propagate TBAA info in SROA

Now that we have the new TBAA metadata format that is capable of
representing accesses to aggregates, we can propagate TBAA access
tags from memory setting and transferring intrinsics to load and
store instructions and vice versa.

Since SROA produces lots of new loads and stores on optimized
builds, this change significantly decreases the share of
undecorated memory accesses on such builds.

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

llvm-svn: 325329

6 years agoEnsure that Elf_Rel addends are always written for dynamic relocations
Alexander Richardson [Fri, 16 Feb 2018 10:01:17 +0000 (10:01 +0000)]
Ensure that Elf_Rel addends are always written for dynamic relocations

Summary:
This follows up on r321889 where writing of Elf_Rel addends was partially
moved to RelocationBaseSection. This patch ensures that the addends are
always written to the output section when a input section uses RELA but the
output is REL.

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

llvm-svn: 325328