platform/upstream/llvm.git
6 years ago[SchedModel] Avoid std::string creation for instregex patterns that don't contain...
Simon Pilgrim [Sat, 24 Mar 2018 21:04:20 +0000 (21:04 +0000)]
[SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.

llvm-svn: 328436

6 years ago[X86][SkylakeClient] Merge xmm/ymm instructions instregex entries to reduce regex...
Simon Pilgrim [Sat, 24 Mar 2018 20:40:14 +0000 (20:40 +0000)]
[X86][SkylakeClient] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328435

6 years ago[X86][Broadwell] Merge xmm/ymm instructions instregex entries to reduce regex matches...
Simon Pilgrim [Sat, 24 Mar 2018 19:37:28 +0000 (19:37 +0000)]
[X86][Broadwell] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328434

6 years ago[RISCV] Use init_array instead of ctors for RISCV target, by default
Mandeep Singh Grang [Sat, 24 Mar 2018 18:37:19 +0000 (18:37 +0000)]
[RISCV] Use init_array instead of ctors for RISCV target, by default

Summary:
LLVM defaults to the newer .init_array/.fini_array scheme for static
constructors rather than the less desirable .ctors/.dtors (the UseCtors
flag defaults to false). This wasn't being respected in the RISC-V
backend because it fails to call TargetLoweringObjectFileELF::InitializeELF with the the appropriate
flag for UseInitArray.
This patch fixes this by implementing RISCVELFTargetObjectFile and overriding its Initialize method to call
InitializeELF(TM.Options.UseInitArray).

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: mgorny, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, llvm-commits

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

llvm-svn: 328433

6 years ago[X86][Haswell] Merge xmm/ymm instructions instregex entries to reduce regex matches...
Simon Pilgrim [Sat, 24 Mar 2018 18:36:01 +0000 (18:36 +0000)]
[X86][Haswell] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328432

6 years ago[X86][SandyBridge] Merge xmm/ymm instructions instregex entries to reduce regex match...
Simon Pilgrim [Sat, 24 Mar 2018 18:12:59 +0000 (18:12 +0000)]
[X86][SandyBridge] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328431

6 years ago[Hexagon] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sat, 24 Mar 2018 17:34:37 +0000 (17:34 +0000)]
[Hexagon] Change std::sort to llvm::sort in response to r327219

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

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

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

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: llvm-commits

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

llvm-svn: 328430

6 years ago[AMDGPU] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sat, 24 Mar 2018 17:15:04 +0000 (17:15 +0000)]
[AMDGPU] Change std::sort to llvm::sort in response to r327219

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

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

Reviewers: tstellar, RKSimon, arsenm

Reviewed By: arsenm

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

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

llvm-svn: 328429

6 years ago[llvm-mca] run clang-format on all files.
Andrea Di Biagio [Sat, 24 Mar 2018 16:05:36 +0000 (16:05 +0000)]
[llvm-mca] run clang-format on all files.

This also addresses Simon's review comment in D44839.

llvm-svn: 328428

6 years ago[llvm-mca] Remove unused field in InstrBuilder. NFC
Andrea Di Biagio [Sat, 24 Mar 2018 15:48:25 +0000 (15:48 +0000)]
[llvm-mca] Remove unused field in InstrBuilder. NFC

llvm-svn: 328427

6 years ago[InstCombine] peek through FP casts for sign-bit compares (PR36682)
Sanjay Patel [Sat, 24 Mar 2018 15:45:02 +0000 (15:45 +0000)]
[InstCombine] peek through FP casts for sign-bit compares (PR36682)

This pattern came up in PR36682:
https://bugs.llvm.org/show_bug.cgi?id=36682
https://godbolt.org/g/LhuD9A

Equality checks are planned as a follow-up enhancement.

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

llvm-svn: 328426

6 years ago[InstCombine] fix formatting; NFC
Sanjay Patel [Sat, 24 Mar 2018 15:41:59 +0000 (15:41 +0000)]
[InstCombine] fix formatting; NFC

llvm-svn: 328425

6 years ago[X86][AES] Ensure we're testing both non-VEX/VEX variants of AES instructions on...
Simon Pilgrim [Sat, 24 Mar 2018 15:05:12 +0000 (15:05 +0000)]
[X86][AES] Ensure we're testing both non-VEX/VEX variants of AES instructions on AVX targets

Add skylake server tests as well

llvm-svn: 328424

6 years ago[X86][SSE] Ensure we're testing both non-VEX/VEX variants of SSE instructions on...
Simon Pilgrim [Sat, 24 Mar 2018 14:51:52 +0000 (14:51 +0000)]
[X86][SSE] Ensure we're testing both non-VEX/VEX variants of SSE instructions on AVX targets

And ensure we don't use later instruction sets in SSE schedule tests

llvm-svn: 328423

6 years ago[InstCombine] add multi-use/vector tests for intrinsic shrinking; NFC
Sanjay Patel [Sat, 24 Mar 2018 14:45:41 +0000 (14:45 +0000)]
[InstCombine] add multi-use/vector tests for intrinsic shrinking; NFC

llvm-svn: 328422

6 years ago[X86][AVX1] Ensure we don't use later instruction sets in AVX1 schedule tests
Simon Pilgrim [Sat, 24 Mar 2018 13:47:48 +0000 (13:47 +0000)]
[X86][AVX1] Ensure we don't use later instruction sets in AVX1 schedule tests

llvm-svn: 328421

6 years ago[X86][AVX2] Ensure we don't use later instruction sets in AVX2 schedule tests
Simon Pilgrim [Sat, 24 Mar 2018 13:47:01 +0000 (13:47 +0000)]
[X86][AVX2] Ensure we don't use later instruction sets in AVX2 schedule tests

llvm-svn: 328420

6 years ago[ELF] - Do not ignore discarding of .rela.plt/.rela.dyn, allow doing custom layout...
George Rimar [Sat, 24 Mar 2018 13:10:19 +0000 (13:10 +0000)]
[ELF] - Do not ignore discarding of .rela.plt/.rela.dyn, allow doing custom layout for them.

Currently when we build input sections list in linker script
we ignore all rel[a] sections. That was done to support
scripts like .rela.dyn : { *(.rela.data) } for emit relocs.

Though as a result following scripts were also silently ignored:

/DISCARD/ : { *(.rela.plt)
/DISCARD/ : { *(.rela.dyn)

and we produced output with this sections. That is not ideal.
The solution this patch suggests is simple: do not ignore synthetic
rel[a] sections. That way we can enable common discarding logic
for them and report a proper error.

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

llvm-svn: 328419

6 years ago[clang-tidy] Enable Python 3 support for add_new_check.py
Jonathan Coe [Sat, 24 Mar 2018 10:49:17 +0000 (10:49 +0000)]
[clang-tidy] Enable Python 3 support for add_new_check.py

Summary: In Python 3, filters are lazily evaluated and strings are not bytes.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 328418

6 years ago[sanitizer] Fix Darwin build
Vitaly Buka [Sat, 24 Mar 2018 08:13:18 +0000 (08:13 +0000)]
[sanitizer] Fix Darwin build

llvm-svn: 328417

6 years ago[X86] Add a new disassembler opcode map for 3DNow. Stop treating 3DNow as an attribute.
Craig Topper [Sat, 24 Mar 2018 07:48:54 +0000 (07:48 +0000)]
[X86] Add a new disassembler opcode map for 3DNow. Stop treating 3DNow as an attribute.

This reduces the size of llvm-mc by at least 150k since we no longer have to multiply the attribute across 7 tables.

llvm-svn: 328416

6 years agoMmap interceptor providing mprotect support
Vitaly Buka [Sat, 24 Mar 2018 07:45:24 +0000 (07:45 +0000)]
Mmap interceptor providing mprotect support

Summary:
- Intercepting mprotect calls.
- Fixing forgotten flag check.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

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

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

llvm-svn: 328415

6 years ago[sanitizer] Fix strlcpy and strlcat interceptors on Darwin
Vitaly Buka [Sat, 24 Mar 2018 07:31:59 +0000 (07:31 +0000)]
[sanitizer] Fix strlcpy and strlcat interceptors on Darwin

llvm-svn: 328414

6 years ago[X86] Use unique_ptr to simplify memory management. NFC
Craig Topper [Sat, 24 Mar 2018 07:15:47 +0000 (07:15 +0000)]
[X86] Use unique_ptr to simplify memory management. NFC

llvm-svn: 328413

6 years ago[X86] Use X86_INSTR_MRM_MAPPING macro instead of listing all MRM_C0-MRM_FF format...
Craig Topper [Sat, 24 Mar 2018 07:15:46 +0000 (07:15 +0000)]
[X86] Use X86_INSTR_MRM_MAPPING macro instead of listing all MRM_C0-MRM_FF format encodings. NFC

llvm-svn: 328412

6 years ago[X86] Remove an unnecessary switch around two other switches. NFC
Craig Topper [Sat, 24 Mar 2018 07:15:45 +0000 (07:15 +0000)]
[X86] Remove an unnecessary switch around two other switches. NFC

The outer switch only had one valid block so didn't provide any value.

llvm-svn: 328411

6 years ago[X86] Merge the Has3DNow0F0FOpcode TSFlag into the OpMap encoding. NFC
Craig Topper [Sat, 24 Mar 2018 06:04:12 +0000 (06:04 +0000)]
[X86] Merge the Has3DNow0F0FOpcode TSFlag into the OpMap encoding. NFC

The 3DNow instructions are encoded a little weird, but we can still represent it as an opcode map.

llvm-svn: 328410

6 years ago[C++17] Fix class template argument deduction for default constructors without an...
Zhihao Yuan [Sat, 24 Mar 2018 04:32:11 +0000 (04:32 +0000)]
[C++17] Fix class template argument deduction for default constructors without an initializer

Summary:
As the title says, this makes following code compile:

```
template<typename> struct Foo {};
Foo() -> Foo<void>;

Foo f; // ok
```

Thanks Nicolas Lesser for coining the fix.

Reviewers: rsmith, lichray

Reviewed By: rsmith, lichray

Subscribers: lichray, cfe-commits

Tags: #clang

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

llvm-svn: 328409

6 years agoAdd REQUIRES lines for the targets being checked in this test.
Eric Christopher [Sat, 24 Mar 2018 02:56:58 +0000 (02:56 +0000)]
Add REQUIRES lines for the targets being checked in this test.

llvm-svn: 328408

6 years ago[HWASan] Fix use-after-free.cc test on x86-64
Alex Shlyapnikov [Sat, 24 Mar 2018 02:10:49 +0000 (02:10 +0000)]
[HWASan] Fix use-after-free.cc test on x86-64

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

llvm-svn: 328407

6 years ago[analyzer] Do not crash in CallEvent.getReturnType()
George Karpenkov [Sat, 24 Mar 2018 01:53:12 +0000 (01:53 +0000)]
[analyzer] Do not crash in CallEvent.getReturnType()

When the call expression is not available.

llvm-svn: 328406

6 years ago[X86] Add a DAG combine to simplify PMULDQ/PMULUDQ nodes
Craig Topper [Sat, 24 Mar 2018 01:52:01 +0000 (01:52 +0000)]
[X86] Add a DAG combine to simplify PMULDQ/PMULUDQ nodes

These nodes only use the lower 32 bits of their inputs so we can use SimplifyDemandedBits to simplify them.

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

llvm-svn: 328405

6 years ago[ODRHash] Support pointer and reference types.
Richard Trieu [Sat, 24 Mar 2018 00:52:44 +0000 (00:52 +0000)]
[ODRHash] Support pointer and reference types.

llvm-svn: 328404

6 years agoRemove duplicated const qualifier.
Alex Shlyapnikov [Sat, 24 Mar 2018 00:40:51 +0000 (00:40 +0000)]
Remove duplicated const qualifier.

llvm-svn: 328403

6 years agoAdd a SectionBase::getVA helper. NFC.
Rafael Espindola [Sat, 24 Mar 2018 00:35:11 +0000 (00:35 +0000)]
Add a SectionBase::getVA helper. NFC.

There were a few too many places duplicating this.

llvm-svn: 328402

6 years agoDo not add a dummy entry to SharedFile::Verdefs. NFC.
Rui Ueyama [Sat, 24 Mar 2018 00:25:24 +0000 (00:25 +0000)]
Do not add a dummy entry to SharedFile::Verdefs. NFC.

Previously, we used 0 as an alias for VER_NDX_GLOBAL and had a dummy
entry in SharedFile::Verdefs so that the access to the array is within
its boundary. But that's not straightforwad. We can just stop doing both.

llvm-svn: 328401

6 years agoAllow FDE references outside the +/-2GB range supported by PC relative
Eric Christopher [Sat, 24 Mar 2018 00:07:38 +0000 (00:07 +0000)]
Allow FDE references outside the +/-2GB range supported by PC relative
offsets for code models other than small/medium. For JIT application,
memory layout is less controlled and can result in truncations
otherwise.

Patch based on one by Olexa Bilaniuk!

llvm-svn: 328400

6 years agoRemove unused header from EntryExitInstrumenter
David Blaikie [Sat, 24 Mar 2018 00:06:14 +0000 (00:06 +0000)]
Remove unused header from EntryExitInstrumenter

Fixes layering, since Transforms/Utils doesn't depend on CodeGen, so
shouldn't include headers from it.

llvm-svn: 328399

6 years ago[X86] Correct the value AdSizeX in X86II enum. NFC
Craig Topper [Sat, 24 Mar 2018 00:02:46 +0000 (00:02 +0000)]
[X86] Correct the value AdSizeX in X86II enum. NFC

Should be NFC since nothing used the enum value. The instruction descriptions are generated from tablegen which had the correct value.

llvm-svn: 328398

6 years agoFix layering by moving ValueTypes.h from CodeGen to IR
David Blaikie [Fri, 23 Mar 2018 23:58:31 +0000 (23:58 +0000)]
Fix layering by moving ValueTypes.h from CodeGen to IR

ValueTypes.h is implemented in IR already.

llvm-svn: 328397

6 years agoFix layering of CodeGen/TargetOpcodes.def by moving it to Support
David Blaikie [Fri, 23 Mar 2018 23:58:27 +0000 (23:58 +0000)]
Fix layering of CodeGen/TargetOpcodes.def by moving it to Support

It's also used by utils/TableGen so needs to reside somewhere common to
TableGen and CodeGen.

llvm-svn: 328396

6 years agoFix layering of MachineValueType.h by moving it from CodeGen to Support
David Blaikie [Fri, 23 Mar 2018 23:58:25 +0000 (23:58 +0000)]
Fix layering of MachineValueType.h by moving it from CodeGen to Support

This is used by llvm tblgen as well as by LLVM Targets, so the only
common place is Support for now. (maybe we need another target for these
sorts of things - but for now I'm at least making them correct & we can
make them better if/when people have strong feelings)

llvm-svn: 328395

6 years agoFix layering by moving Support/CodeGenCWrappers.h to Target
David Blaikie [Fri, 23 Mar 2018 23:58:21 +0000 (23:58 +0000)]
Fix layering by moving Support/CodeGenCWrappers.h to Target

This includes llvm-c/TargetMachine.h which is logically part of
libTarget (since libTarget implements llvm-c/TargetMachine.h's
functions).

llvm-svn: 328394

6 years agoFix layering by moving X86DisassemblerDecoderCommon to Support
David Blaikie [Fri, 23 Mar 2018 23:58:20 +0000 (23:58 +0000)]
Fix layering by moving X86DisassemblerDecoderCommon to Support

This is used from llvm tblgen and the X86Disassembler - the only common
library (apart from TableGen, which probably doesn't make sense to have
as a dependency from a release tool (rather than a use-while-building-llvm
tool) of LLVM)

llvm-svn: 328393

6 years agoMove TargetLoweringObjectFile from CodeGen to Target to fix layering
David Blaikie [Fri, 23 Mar 2018 23:58:19 +0000 (23:58 +0000)]
Move TargetLoweringObjectFile from CodeGen to Target to fix layering

It's implemented in Target & include from other Target headers, so the
header should be in Target.

llvm-svn: 328392

6 years agoMove a Repl access.
Rafael Espindola [Fri, 23 Mar 2018 23:55:49 +0000 (23:55 +0000)]
Move a Repl access.

Since SectionBase::getOutputSection handles ICF replaces and
SectionBase::getOffset was handling it in some cases, it is more
consistent to have getOffset always handle it.

llvm-svn: 328391

6 years agoDrop redundant ->Repl.
Rafael Espindola [Fri, 23 Mar 2018 23:53:01 +0000 (23:53 +0000)]
Drop redundant ->Repl.

SectionBase::getOutputSection handles replacement sections, so this
code doesn't have to.

llvm-svn: 328390

6 years agoAdd support for __attribute__(trivial_abi).
Jim Ingham [Fri, 23 Mar 2018 23:44:52 +0000 (23:44 +0000)]
Add support for __attribute__(trivial_abi).

<rdar://problem/36035075>, <rdar://problem/36035039>

llvm-svn: 328389

6 years agoPartially Revert "Workaround GCC bug PR78489 - SFINAE order is not respected."
Eric Fiselier [Fri, 23 Mar 2018 23:42:30 +0000 (23:42 +0000)]
Partially Revert "Workaround GCC bug PR78489 - SFINAE order is not respected."

This partially reverts commit r328261. The GCC bug has been fixed in
trunk and has never existed in a released version. Therefore the changes
to variant are unneeded.

However, the additional tests have been left in place.

llvm-svn: 328388

6 years ago[GuardWidening] Group code by class [NFC]
Philip Reames [Fri, 23 Mar 2018 23:41:47 +0000 (23:41 +0000)]
[GuardWidening] Group code by class [NFC]

llvm-svn: 328387

6 years ago[X86] Fix Windows `i1 zeroext` conventions to use i8 instead of i32
Reid Kleckner [Fri, 23 Mar 2018 23:38:53 +0000 (23:38 +0000)]
[X86] Fix Windows `i1 zeroext` conventions to use i8 instead of i32

Both GCC and MSVC only look at the low byte of a boolean when it is
passed.

llvm-svn: 328386

6 years ago[HWASan] Port HWASan to Linux x86-64 (compiler-rt)
Alex Shlyapnikov [Fri, 23 Mar 2018 23:38:04 +0000 (23:38 +0000)]
[HWASan] Port HWASan to Linux x86-64 (compiler-rt)

Summary:
Porting HWASan to Linux x86-64, first of the three patches, compiler-rt part.

The approach is similar to ARM case, trap signal is used to communicate
memory tag check failure. int3 instruction is used to generate a signal,
access parameters are stored in nop [eax + offset] instruction immediately
following the int3 one

Had to add HWASan init on malloc because, due to much less interceptors
defined (most other sanitizers intercept much more and get initalized
via one of those interceptors or don't care about malloc), HWASan was not
initialized yet when libstdc++ was trying to allocate memory for its own
fixed-size heap, which led to CHECK-fail in AllocateFromLocalPool.

Also added the CHECK() failure handler with more detailed message and
stack reporting.

Reviewers: eugenis

Subscribers: kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 328385

6 years ago[libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer.
Matt Morehouse [Fri, 23 Mar 2018 23:35:28 +0000 (23:35 +0000)]
[libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer.

Summary:
Disables certain CMP optimizations to improve fuzzing signal under -O1
and -O2.

Switches all fuzzer tests to -O2 except for a few leak tests where the
leak is optimized out under -O2.

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 328384

6 years agoRemove CommandObjectStats.cpp & CleanUpTest.cpp from
Jason Molenda [Fri, 23 Mar 2018 23:32:16 +0000 (23:32 +0000)]
Remove CommandObjectStats.cpp & CleanUpTest.cpp from
installing in the man page directory.

llvm-svn: 328383

6 years agoPut CommandObjectStats.cpp in lldb-core target, remove CommandObjectStats.h from...
Jason Molenda [Fri, 23 Mar 2018 22:50:23 +0000 (22:50 +0000)]
Put CommandObjectStats.cpp in lldb-core target, remove CommandObjectStats.h from targets.

llvm-svn: 328382

6 years agoRemove "FIXME" from a comment.
Rui Ueyama [Fri, 23 Mar 2018 22:48:17 +0000 (22:48 +0000)]
Remove "FIXME" from a comment.

A bug in BFD linker is not our FIXME item.

llvm-svn: 328381

6 years agoChange for an LLVM header file move
David Blaikie [Fri, 23 Mar 2018 22:16:59 +0000 (22:16 +0000)]
Change for an LLVM header file move

llvm-svn: 328380

6 years agoFix Layering, move instrumentation transform headers into Instrumentation subdirectory
David Blaikie [Fri, 23 Mar 2018 22:11:06 +0000 (22:11 +0000)]
Fix Layering, move instrumentation transform headers into Instrumentation subdirectory

llvm-svn: 328379

6 years ago[Commands] Add a (currently empty) `stats` command.
Davide Italiano [Fri, 23 Mar 2018 21:55:48 +0000 (21:55 +0000)]
[Commands] Add a (currently empty) `stats` command.

This one will be used to print statistics about lldb sessions
(including, e.g. number of expression evaluation succeeded or
failed). I decided to commit the skeleton first so that we have
a clean reference on how a command should be implemented.
My future commits are going to populate this command and test
it.

<rdar://problem/36555975>

llvm-svn: 328378

6 years ago[PM][FunctionAttrs] add NoUnwind attribute inference to PostOrderFunctionAttrs pass
Fedor Sergeev [Fri, 23 Mar 2018 21:46:16 +0000 (21:46 +0000)]
[PM][FunctionAttrs] add NoUnwind attribute inference to PostOrderFunctionAttrs pass

Summary:
This was motivated by absence of PrunEH functionality in new PM.
It was decided that a proper way to do PruneEH is to add NoUnwind inference
into PostOrderFunctionAttrs and then perform normal SimplifyCFG on top.

This change generalizes attribute handling implemented for (a removal of)
Convergent attribute, by introducing a generic builder-like class
   AttributeInferer

It registers all the attribute inference requests, storing per-attribute
predicates into a vector, and then goes through an SCC Node, scanning all
the instructions for not breaking attribute assumptions.

The main idea is that as soon all the instructions from all the functions
of SCC Node conform to attribute assumptions then we are free to infer
the attribute as set for all the functions of SCC Node.

It handles two distinct cases of attributes:
   - those that might break due to derefinement of the function code

     for these attributes we are allowed to apply inference only if all the
     functions are "exact definitions". Example - NoUnwind.

   - those that do not care about derefinement

     for these attributes we are allowed to apply inference as soon as we see
     any function definition. Example - removal of Convergent attribute.

Also in this commit:
* Converted all the FunctionAttrs tests to use FileCheck and added new-PM
  invocations to them

* FunctionAttrs/convergent.ll test demonstrates a difference in behavior between
   new and old PM implementations. Marked with FIXME.

* PruneEH tests were converted to new-PM as well, using function-attrs+simplify-cfg
  combo as intended

* some of "other" tests were updated since function-attrs now infers 'nounwind'
  even for old PM pipeline

* -disable-nounwind-inference hidden option added as a possible workaround for a supposedly
  rare case when nounwind being inferred by default presents a problem

Reviewers: chandlerc, jlebar

Reviewed By: jlebar

Subscribers: eraman, llvm-commits

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

llvm-svn: 328377

6 years agoFreeBSD sanitizer common, intercept couple of more functions
Vitaly Buka [Fri, 23 Mar 2018 21:44:59 +0000 (21:44 +0000)]
FreeBSD sanitizer common, intercept couple of more functions

Summary:
Intercepts lstat, acct, access, faccessat and strlcpy/strlcat

Patch by David CARLIER

Reviewers: visa, vitalybuka

Subscribers: krytarowski, fedor.sergeev, srhines, kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 328376

6 years agoRevert "Mmap interceptor providing mprotect support"
Vitaly Buka [Fri, 23 Mar 2018 21:44:59 +0000 (21:44 +0000)]
Revert "Mmap interceptor providing mprotect support"

Breaks Darwin.

This reverts commit r328369.

llvm-svn: 328375

6 years agoChange the darwin-debug target to build the standard
Jason Molenda [Fri, 23 Mar 2018 21:37:19 +0000 (21:37 +0000)]
Change the darwin-debug target to build the standard
archs.

llvm-svn: 328374

6 years ago[CMakeLists] Update file list after recent changes.
Davide Italiano [Fri, 23 Mar 2018 21:21:17 +0000 (21:21 +0000)]
[CMakeLists] Update file list after recent changes.

llvm-svn: 328373

6 years ago[InstCombine] simplify code for FP intrinsic shrinking; NFCI
Sanjay Patel [Fri, 23 Mar 2018 21:18:12 +0000 (21:18 +0000)]
[InstCombine] simplify code for FP intrinsic shrinking; NFCI

llvm-svn: 328372

6 years ago[InstCombine] increase test coverage for intrinsic shrinking; NFC
Sanjay Patel [Fri, 23 Mar 2018 21:13:53 +0000 (21:13 +0000)]
[InstCombine] increase test coverage for intrinsic shrinking; NFC

There were no tests with vector types before this.

llvm-svn: 328371

6 years ago[Commands] Remove dead code for unused `args` command.
Davide Italiano [Fri, 23 Mar 2018 21:04:34 +0000 (21:04 +0000)]
[Commands] Remove dead code for unused `args` command.

It wasn't even registered.

(lldb) apropos args
No commands found pertaining to 'args'. Try 'help' to see
a complete list of debugger commands.

llvm-svn: 328370

6 years agoMmap interceptor providing mprotect support
Vitaly Buka [Fri, 23 Mar 2018 20:59:51 +0000 (20:59 +0000)]
Mmap interceptor providing mprotect support

Summary:
- Intercepting mprotect calls.
- Fixing forgotten flag check.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

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

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

llvm-svn: 328369

6 years ago[Command] Remove dead code for the syntax command.
Davide Italiano [Fri, 23 Mar 2018 20:58:05 +0000 (20:58 +0000)]
[Command] Remove dead code for the syntax command.

I'm going to add a new commend so I figured I could do
some spring cleaning.

llvm-svn: 328368

6 years ago[Hexagon] Make findLoopInstr member of HexagonInstrInfo
Krzysztof Parzyszek [Fri, 23 Mar 2018 20:43:02 +0000 (20:43 +0000)]
[Hexagon] Make findLoopInstr member of HexagonInstrInfo

llvm-svn: 328367

6 years ago[Hexagon] Correct update of instruction offet in HW loop fixup
Krzysztof Parzyszek [Fri, 23 Mar 2018 20:41:44 +0000 (20:41 +0000)]
[Hexagon] Correct update of instruction offet in HW loop fixup

llvm-svn: 328366

6 years agoLog ObjC Runtime messages only in verbose mode
Adrian Prantl [Fri, 23 Mar 2018 20:17:39 +0000 (20:17 +0000)]
Log ObjC Runtime messages only in verbose mode

llvm-svn: 328365

6 years ago[Hexagon] Boost profit for word-mask immediates, reduce for others
Krzysztof Parzyszek [Fri, 23 Mar 2018 20:11:00 +0000 (20:11 +0000)]
[Hexagon] Boost profit for word-mask immediates, reduce for others

This avoids unnecessary splitting due to uninteresting immediates.

llvm-svn: 328364

6 years ago[PDB] Resubmit "Support embedding natvis files in PDBs."
Zachary Turner [Fri, 23 Mar 2018 19:57:25 +0000 (19:57 +0000)]
[PDB] Resubmit "Support embedding natvis files in PDBs."

This was reverted several times due to what ultimately turned out
to be incompatibilities in our serialized hash table format.

Several changes went in prior to this to fix those issues since
they were more fundamental and independent of supporting injected
sources, so now that those are fixed this change should hopefully
pass.

llvm-svn: 328363

6 years ago[CUDA] Fixed false error reporting in case of calling H->G->HD->D.
Artem Belevich [Fri, 23 Mar 2018 19:49:03 +0000 (19:49 +0000)]
[CUDA] Fixed false error reporting in case of calling H->G->HD->D.

Launching a kernel from the host code does not generate code for the
kernel itself. This fixes an issue with clang erroneously reporting
an error for a HD->D call from within the kernel.

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

llvm-svn: 328362

6 years ago[HWASan] Port HWASan to Linux x86-64 (clang)
Alex Shlyapnikov [Fri, 23 Mar 2018 19:47:45 +0000 (19:47 +0000)]
[HWASan] Port HWASan to Linux x86-64 (clang)

Summary: Porting HWASan to Linux x86-64, the third of the three patches, clang part.

Reviewers: eugenis

Subscribers: cryptoad, cfe-commits

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

llvm-svn: 328361

6 years ago[Hexagon] Assume all extendable branches to be of size 8 in relaxation
Krzysztof Parzyszek [Fri, 23 Mar 2018 19:47:13 +0000 (19:47 +0000)]
[Hexagon] Assume all extendable branches to be of size 8 in relaxation

The branch relaxation pass collects sizes of all instructions at the
beginning, before any changes have been made. It then performs one pass
over all branches to see which ones need to be extended. It does not
account for the case when a previously valid branch becomes out-of-range
due to relaxing other branches.
This approach fixes this problem by assuming from the beginning that
all extendable branches have been extended. This may cause unneeded
relaxation in some cases, but avoids iteration and recomputing instruction
sizes.

llvm-svn: 328360

6 years ago[AMDGPU] Fix codegen for inline assembly
Yaxun Liu [Fri, 23 Mar 2018 19:43:42 +0000 (19:43 +0000)]
[AMDGPU] Fix codegen for inline assembly

Need to override convertConstraint to recognise amdgpu specific register names.

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

llvm-svn: 328359

6 years ago[llvm-mca] Split the InstructionInfoView from the SummaryView.
Andrea Di Biagio [Fri, 23 Mar 2018 19:40:04 +0000 (19:40 +0000)]
[llvm-mca] Split the InstructionInfoView from the SummaryView.

llvm-svn: 328358

6 years ago[Hexagon] Incorrectly removing dead flag and adding kill flag
Krzysztof Parzyszek [Fri, 23 Mar 2018 19:39:37 +0000 (19:39 +0000)]
[Hexagon] Incorrectly removing dead flag and adding kill flag

The HexagonExpandCondsets pass is incorrectly removing the dead
flag on a definition that is really dead, and adding a kill flag
to a use that is tied to a definition. This causes an assert later
during the machine scheduler when querying the live interval
information.

Patch by Brendon Cahoon.

llvm-svn: 328357

6 years ago[Hexagon] Silence unused variable warning in Release builds
Benjamin Kramer [Fri, 23 Mar 2018 19:39:16 +0000 (19:39 +0000)]
[Hexagon] Silence unused variable warning in Release builds

llvm-svn: 328356

6 years ago[Hexagon] Fold offset in base+immediate loads/stores
Krzysztof Parzyszek [Fri, 23 Mar 2018 19:30:34 +0000 (19:30 +0000)]
[Hexagon] Fold offset in base+immediate loads/stores

Optimize Ry = add(Rx,#n); memw(Ry+#0) = Rz  =>  memw(Rx,#n) = Rz.

Patch by Jyotsna Verma.

llvm-svn: 328355

6 years agoFix misuse of llvm::YAML in clangd test.
Jordan Rose [Fri, 23 Mar 2018 19:16:07 +0000 (19:16 +0000)]
Fix misuse of llvm::YAML in clangd test.

Caught by LLVM r328345!

llvm-svn: 328354

6 years ago[X86] Add itinerary to RCPSS*_Int and similar instructions.
Craig Topper [Fri, 23 Mar 2018 19:15:05 +0000 (19:15 +0000)]
[X86] Add itinerary to RCPSS*_Int and similar instructions.

llvm-svn: 328353

6 years ago[X86] Add itineraries to ADD.*_DB instructions to match their normal counterparts.
Craig Topper [Fri, 23 Mar 2018 19:15:03 +0000 (19:15 +0000)]
[X86] Add itineraries to ADD.*_DB instructions to match their normal counterparts.

llvm-svn: 328352

6 years ago[AMDGPU] Update OpenCL to use 48 bytes of implicit arguments for AMDGPU
Tony Tye [Fri, 23 Mar 2018 18:58:47 +0000 (18:58 +0000)]
[AMDGPU] Update OpenCL to use 48 bytes of implicit arguments for AMDGPU

Add two additional implicit arguments for OpenCL for the AMDGPU target using the AMDHSA runtime to support device enqueue.

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

llvm-svn: 328351

6 years ago[AMDGPU] Update OpenCL to use 48 bytes of implicit arguments for AMDGPU (CLANG)
Tony Tye [Fri, 23 Mar 2018 18:51:45 +0000 (18:51 +0000)]
[AMDGPU] Update OpenCL to use 48 bytes of implicit arguments for AMDGPU (CLANG)

Add two additional implicit arguments for OpenCL for the AMDGPU target using the AMDHSA runtime to support device enqueue.

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

llvm-svn: 328350

6 years ago[AMDGPU] Remove use of OpenCL triple environment and replace with function attribute...
Tony Tye [Fri, 23 Mar 2018 18:45:18 +0000 (18:45 +0000)]
[AMDGPU] Remove use of OpenCL triple environment and replace with function attribute for AMDGPU

- Remove use of the opencl and amdopencl environment member of the target triple for the AMDGPU target.
- Use function attribute to communicate to the AMDGPU backend to add implicit arguments for OpenCL kernels for the AMDHSA OS.

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

llvm-svn: 328349

6 years ago[PDB] Make our PDBs look more like MS PDBs.
Zachary Turner [Fri, 23 Mar 2018 18:43:39 +0000 (18:43 +0000)]
[PDB] Make our PDBs look more like MS PDBs.

When investigating bugs in PDB generation, the first step is
often to do the same link with link.exe and then compare PDBs.

But comparing PDBs is hard because two completely different byte
sequences can both be correct, so it hampers the investigation when
you also have to spend time figuring out not just which bytes are
different, but also if the difference is meaningful.

This patch fixes a couple of cases related to string table emission,
hash table emission, and the order in which we emit strings that
makes more of our bytes the same as the bytes generated by MS PDBs.

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

llvm-svn: 328348

6 years ago[AMDGPU] Remove use of OpenCL triple environment and replace with function attribute...
Tony Tye [Fri, 23 Mar 2018 18:43:15 +0000 (18:43 +0000)]
[AMDGPU] Remove use of OpenCL triple environment and replace with function attribute for AMDGPU (CLANG)

- Remove use of the opencl and amdopencl environment member of the target triple for the AMDGPU target.
- Use a function attribute to communicate to the AMDGPU backend.

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

llvm-svn: 328347

6 years ago[Hexagon] Always generate mux out of predicated transfers if possible
Krzysztof Parzyszek [Fri, 23 Mar 2018 18:43:09 +0000 (18:43 +0000)]
[Hexagon] Always generate mux out of predicated transfers if possible

HexagonGenMux would collapse pairs of predicated transfers if it assumed
that the predicated .new forms cannot be created. Turns out that generating
mux is preferable in almost all cases.
Introduce an option -hexagon-gen-mux-threshold that controls the minimum
distance between the instruction defining the predicate and the later of
the two transfers. If the distance is closer than the threshold, mux will
not be generated. Set the threshold to 0 by default.

llvm-svn: 328346

6 years agoDelete the copy constructor for llvm::yaml::Node
Jordan Rose [Fri, 23 Mar 2018 18:05:19 +0000 (18:05 +0000)]
Delete the copy constructor for llvm::yaml::Node

The nodes keep a reference back to the original document, but the
document is streamed, not read all into memory at once, and the
position is part of the state. If nodes are ever copied, the document
position can end up being advanced more than once.

This did not reveal any problems in LLVM or Clang but caught a handful
over in Swift!

llvm-svn: 328345

6 years ago[Hexagon] Avoid early if-conversion for one sided branches
Krzysztof Parzyszek [Fri, 23 Mar 2018 18:00:18 +0000 (18:00 +0000)]
[Hexagon] Avoid early if-conversion for one sided branches

Patch by Anand Kodnani.

llvm-svn: 328344

6 years ago[X86][Btver2] Cleanup TEST instructions to use JFPA (+JFPX on ymms) function unit
Simon Pilgrim [Fri, 23 Mar 2018 17:59:22 +0000 (17:59 +0000)]
[X86][Btver2] Cleanup TEST instructions to use JFPA (+JFPX on ymms) function unit

llvm-svn: 328343

6 years ago[HWASan] Port HWASan to Linux x86-64 (LLVM)
Alex Shlyapnikov [Fri, 23 Mar 2018 17:57:54 +0000 (17:57 +0000)]
[HWASan] Port HWASan to Linux x86-64 (LLVM)

Summary:
Porting HWASan to Linux x86-64, first of the three patches, LLVM part.

The approach is similar to ARM case, trap signal is used to communicate
memory tag check failure. int3 instruction is used to generate a signal,
access parameters are stored in nop [eax + offset] instruction immediately
following the int3 one.

One notable difference is that x86-64 has to untag the pointer before use
due to the lack of feature comparable to ARM's TBI (Top Byte Ignore).

Reviewers: eugenis

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 328342

6 years ago[ARM] Fix "Constant pool entry out of range!" in Thumb1 mode
Ana Pazos [Fri, 23 Mar 2018 17:53:27 +0000 (17:53 +0000)]
[ARM] Fix "Constant pool entry out of range!" in Thumb1 mode

This patch fixes PR36658, "Constant pool entry out of range!" in Thumb1 mode.

In ARMConstantIslands::optimizeThumb2JumpTables() in Thumb1 mode,
adjustBBOffsetsAfter() is not calculating postOffset correctly by
properly accounting for the padding that is required for the constant pool
that immediately follows the jump table branch  instruction.

Reviewers: t.p.northover, eli.friedman

Reviewed By: t.p.northover

Subscribers: chrib, tstellar, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 328341

6 years ago[llvm-mca] update the ResourcePressureView after r328335. NFC.
Andrea Di Biagio [Fri, 23 Mar 2018 17:53:02 +0000 (17:53 +0000)]
[llvm-mca] update the ResourcePressureView after r328335. NFC.

This should have been part of r328335. I forgot to svn add these files.

llvm-svn: 328340

6 years ago[Hexagon] Two fixes in early if-conversion
Krzysztof Parzyszek [Fri, 23 Mar 2018 17:46:09 +0000 (17:46 +0000)]
[Hexagon] Two fixes in early if-conversion

- Fix checking for vector predicate registers.
- Avoid speculating llvm.lifetime.end intrinsic.

Patch by Harsha Jagasia and Brendon Cahoon.

llvm-svn: 328339

6 years ago[X86][Btver2] Cleanup MOVMSK instructions to use JFPA function unit
Simon Pilgrim [Fri, 23 Mar 2018 17:38:59 +0000 (17:38 +0000)]
[X86][Btver2] Cleanup MOVMSK instructions to use JFPA function unit

Add missing non-VEX and (V)PMOVMSKB instructions to the pattern

llvm-svn: 328338

6 years ago[vfs] Don't bail out after a missing -ivfsoverlay file
Ben Langmuir [Fri, 23 Mar 2018 17:37:27 +0000 (17:37 +0000)]
[vfs] Don't bail out after a missing -ivfsoverlay file

This make -ivfsoverlay behave more like other fatal errors (e.g. missing
-include file) by skipping the missing file instead of bailing out of
the whole compilation. This makes it possible for libclang to still
provide some functionallity as well as to correctly produce the fatal
error diagnostic (previously we lost the diagnostic in libclang since
there was no TU to tie it to).

rdar://33385423

llvm-svn: 328337