platform/upstream/llvm.git
8 years agoSplit writeResult. NFC.
Rui Ueyama [Tue, 1 Nov 2016 23:17:45 +0000 (23:17 +0000)]
Split writeResult. NFC.

This is now doable because this code doesn't have to be in the
dynamic scope of Writer::run().

llvm-svn: 285766

8 years agoAMDGPU: Use brev for materializing SGPR constants
Matt Arsenault [Tue, 1 Nov 2016 23:14:20 +0000 (23:14 +0000)]
AMDGPU: Use brev for materializing SGPR constants

This is already done with VGPR immediates and saves 4 bytes.

llvm-svn: 285765

8 years agoCreate Out members using make() to simplify.
Rui Ueyama [Tue, 1 Nov 2016 23:12:51 +0000 (23:12 +0000)]
Create Out members using make() to simplify.

llvm-svn: 285764

8 years agoRemove Out::Pool and use make() instead.
Rui Ueyama [Tue, 1 Nov 2016 23:09:07 +0000 (23:09 +0000)]
Remove Out::Pool and use make() instead.

llvm-svn: 285763

8 years agoAMDGPU: Default to using scalar mov to materialize immediate
Matt Arsenault [Tue, 1 Nov 2016 22:55:07 +0000 (22:55 +0000)]
AMDGPU: Default to using scalar mov to materialize immediate

This is the conservatively correct way because it's easy to
move or replace a scalar immediate. This was incorrect in the case
when the register class wasn't known from the static instruction
definition, but still needed to be an SGPR. The main example of this
is inlineasm has an SGPR constraint.

Also start verifying the register classes of inlineasm operands.

llvm-svn: 285762

8 years agoXfail this while I figure out why the event isn't getting sent.
Jim Ingham [Tue, 1 Nov 2016 22:53:54 +0000 (22:53 +0000)]
Xfail this while I figure out why the event isn't getting sent.

llvm-svn: 285761

8 years agoProvide a convenient function to allocate and initialize objects.
Rui Ueyama [Tue, 1 Nov 2016 22:53:18 +0000 (22:53 +0000)]
Provide a convenient function to allocate and initialize objects.

You can now write make<T>(Args) instead of new (alloc<T>()) T(Args).

llvm-svn: 285760

8 years ago[analyzer] Fix capitalization in ObjCSuperDealloc checker diagnostic.
Devin Coughlin [Tue, 1 Nov 2016 22:16:39 +0000 (22:16 +0000)]
[analyzer] Fix capitalization in ObjCSuperDealloc checker diagnostic.

Change "use of 'self'..." to "Use of 'self'...". The convention is to
start diagnostics with a capital letter.

rdar://problem/28322494

llvm-svn: 285759

8 years agoMove the initialization of PreferredLoopExit into runOnMachineFunction to be near...
Eric Christopher [Tue, 1 Nov 2016 22:15:50 +0000 (22:15 +0000)]
Move the initialization of PreferredLoopExit into runOnMachineFunction to be near the other function specific initializations.

llvm-svn: 285758

8 years agoFix uninitialized access in MachineBlockPlacement.
Sam McCall [Tue, 1 Nov 2016 22:02:14 +0000 (22:02 +0000)]
Fix uninitialized access in MachineBlockPlacement.

Summary:
Currently PreferredLoopExit is set only in buildLoopChains, which is
never called if there are no MachineLoops.

MSan is currently broken by this:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/145/steps/check-llvm%20msan/logs/stdio

This is a naive fix to get things green again. iteratee: you may have a better fix.

This change will also mean PreferredLoopExit will not carry over if
buildCFGChains() is called a second time in runOnMachineFunction, this
appears to be the right thing.

Reviewers: bkramer, iteratee, echristo

Subscribers: llvm-commits

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

llvm-svn: 285757

8 years agoAMDGPU: Stop creating unused virtual registers
Matt Arsenault [Tue, 1 Nov 2016 21:58:07 +0000 (21:58 +0000)]
AMDGPU: Stop creating unused virtual registers

These are only used in the spill to VMEM path. Move them to
the one use.

llvm-svn: 285756

8 years agoDon't fetch the section string table multiple times. NFC.
Rafael Espindola [Tue, 1 Nov 2016 21:48:00 +0000 (21:48 +0000)]
Don't fetch the section string table multiple times. NFC.

llvm-svn: 285755

8 years agoUpdate for llvm change.
Rafael Espindola [Tue, 1 Nov 2016 21:34:26 +0000 (21:34 +0000)]
Update for llvm change.

We no longer use the section names in this test.

llvm-svn: 285754

8 years agoDon't compute DotShstrtab eagerly.
Rafael Espindola [Tue, 1 Nov 2016 21:33:55 +0000 (21:33 +0000)]
Don't compute DotShstrtab eagerly.

This saves a field that is not always used. It also avoids failing a
program that doesn't need the section names.

llvm-svn: 285753

8 years ago[clang-tidy] Handle bitfields in cppcoreguidelines-pro-type-member-init
Malcolm Parsons [Tue, 1 Nov 2016 21:26:53 +0000 (21:26 +0000)]
[clang-tidy] Handle bitfields in cppcoreguidelines-pro-type-member-init

Summary:
Unnamed bitfields cannot be initialized.
Bitfields cannot be in-class initialized.

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: Prazek, nemanjai, cfe-commits

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

llvm-svn: 285752

8 years agoRemove string table offsets from tests.
Rui Ueyama [Tue, 1 Nov 2016 21:26:28 +0000 (21:26 +0000)]
Remove string table offsets from tests.

<N> where "foo (<N>)" is the offset of string "foo" in the string table.

llvm-svn: 285751

8 years ago[MemorySSA] Tighten up types to make our API prettier. NFC.
George Burgess IV [Tue, 1 Nov 2016 21:17:46 +0000 (21:17 +0000)]
[MemorySSA] Tighten up types to make our API prettier. NFC.

Patch by bryant.

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

llvm-svn: 285750

8 years agoAdd missing #include.
Zachary Turner [Tue, 1 Nov 2016 21:08:34 +0000 (21:08 +0000)]
Add missing #include.

llvm-svn: 285749

8 years agoReplace GAlloc with a template function.
Rafael Espindola [Tue, 1 Nov 2016 21:06:40 +0000 (21:06 +0000)]
Replace GAlloc with a template function.

This patch replaces GAlloc<ELFT>::<sometype>.Allocate() with
alloc<sometype<ELFT>>().

Patch by Rui!

llvm-svn: 285748

8 years agoSimplify getStringTableIndex.
Rafael Espindola [Tue, 1 Nov 2016 20:56:15 +0000 (20:56 +0000)]
Simplify getStringTableIndex.

The description in the ELF spec is just

---------------------------
If the section name string table section index is greater than or
equal to SHN_LORESERVE (0xff00), this member has the value SHN_XINDEX
(0xffff) and the actual index of the section name string table section
is contained in the sh_link field of the section header at index 0.
---------------------------

So we only have to check for it being SHN_XINDEX. Also, sh_link is
always 32 bits, so don't return an uintX_t.

llvm-svn: 285747

8 years ago[ScopInfo] Make memset etc. affine where possible.
Eli Friedman [Tue, 1 Nov 2016 20:53:11 +0000 (20:53 +0000)]
[ScopInfo] Make memset etc. affine where possible.

We don't actually check whether a MemoryAccess is affine in very many
places, but one important one is in checks for aliasing.

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

llvm-svn: 285746

8 years agoAdd missing test from r284848.
Eli Friedman [Tue, 1 Nov 2016 20:45:28 +0000 (20:45 +0000)]
Add missing test from r284848.

Original commit title: [SCEVAffinator] Make precise modular math
more correct.

llvm-svn: 285745

8 years ago[ValueTracking] remove TODO comment; NFC
Sanjay Patel [Tue, 1 Nov 2016 20:43:00 +0000 (20:43 +0000)]
[ValueTracking] remove TODO comment; NFC

InstCombine should always canonicalize patterns like the one shown in the comment
when visiting 'select' insts in adjustMinMax().

Scalars were already handled there, and vector splats are handled after:
https://reviews.llvm.org/rL285732

llvm-svn: 285744

8 years agoAMDGPU: Workaround for instruction size with literals
Matt Arsenault [Tue, 1 Nov 2016 20:42:24 +0000 (20:42 +0000)]
AMDGPU: Workaround for instruction size with literals

Instructions with a 32-bit base encoding with an optional
32-bit literal encoded after them report their size as 4
for the disassembler. Consider these when computing the
MachineInstr size. This fixes problems caused by size estimate
consistency in BranchRelaxation.

llvm-svn: 285743

8 years agoSwitch SBWatchpoint::SetEnabled over to using Process::{Enable,Disable}Watchpoint.
Jim Ingham [Tue, 1 Nov 2016 20:37:02 +0000 (20:37 +0000)]
Switch SBWatchpoint::SetEnabled over to using Process::{Enable,Disable}Watchpoint.

We don't have a good story for what happens to watchpoints when you don't
have a process, or if your process exits.  Clearing that up will instruct
how to fix this for real.

Also added a test to make sure disable->enable works as well.
This resolves llvm.org/pr30789.

llvm-svn: 285742

8 years ago[test] Fix detecting LLVM zlib support in stand-alone builds
Michal Gorny [Tue, 1 Nov 2016 20:31:52 +0000 (20:31 +0000)]
[test] Fix detecting LLVM zlib support in stand-alone builds

Fix the test run to declare missing HAVE_LIBZ value in stand-alone
builds, using the LLVM_ENABLE_ZLIB that is exported in LLVMConfig.cmake.

When using in-tree builds, HAVE_LIBZ is declared in
cmake/config-ix.cmake as a result of LLVM's CMake checks. When building
stand-alone, this value is not available and as a result caused clang to
wrongly assume that LLVM was built without zlib support.

To fix it, set it to the value of LLVM_ENABLE_ZLIB. While this variable
is originally used to control the user preference, LLVM updates its
value to 0 if zlib checks fail. Therefore, we can use it to reliably
determine whether LLVM was built with zlib support or not.

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

llvm-svn: 285741

8 years agoCreate SyntheticSections.cpp.
Rui Ueyama [Tue, 1 Nov 2016 20:28:21 +0000 (20:28 +0000)]
Create SyntheticSections.cpp.

We are going to have many more classes for linker-synthesized
input sections, so it's worth to be added to a separate file
than to the file for regular input sections.

llvm-svn: 285740

8 years agoUpdate for llvm change.
Rafael Espindola [Tue, 1 Nov 2016 20:25:27 +0000 (20:25 +0000)]
Update for llvm change.

llvm-svn: 285739

8 years agoUse the existing std::error_code out parameter.
Rafael Espindola [Tue, 1 Nov 2016 20:24:22 +0000 (20:24 +0000)]
Use the existing std::error_code out parameter.

This avoids calling exit with a partially constructed object.

llvm-svn: 285738

8 years agoFix llvm-shlib cmake build
Chris Bieneman [Tue, 1 Nov 2016 20:19:33 +0000 (20:19 +0000)]
Fix llvm-shlib cmake build

Summary:
This fixes a few things that used to work with a Makefile build, but were broken in cmake.

1. Treat MINGW like a Linux system.
2. The shlib should never contain other shared libraries.

Patch By: Valentin Churavy

Reviewers: axw, beanz

Subscribers: modocache, beanz, mgorny

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

llvm-svn: 285737

8 years agoAdd helpers for the notion of a type scavenger that is "either this or that" source...
Enrico Granata [Tue, 1 Nov 2016 20:17:14 +0000 (20:17 +0000)]
Add helpers for the notion of a type scavenger that is "either this or that" source, and one that is "both this and that" source

Use the helper to rewrite the ObjC type lookup logic (first modules, then runtime) in terms of an either scavenger

llvm-svn: 285736

8 years ago[ELF/GC] Fix pending references to garbage collected sections.
Davide Italiano [Tue, 1 Nov 2016 20:11:01 +0000 (20:11 +0000)]
[ELF/GC] Fix pending references to garbage collected sections.

The example reported in PR30793 shows a case where gc reclaims
a SHF_TLS section, but it doesn't reclaim the section containing
the debug info for it.
This is expected, as we do not reclaim non-alloc sections
during the garbage collection phase (and this is not going to
change anytime soon, at least this is what I gathered last I
talked with Rafael about it).
So, we end up with a pending reference, thinking that the input
was invalid (which is not true, as it's GC that removed the
SHT_TLS section, and therefore didn't create the PT_TLS *segment*
for it). In cases like this, just assign a VA of zero at relocation
time instead of error'ing out (this is what gold does as well, FWIW).

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

llvm-svn: 285735

8 years agoGC empty subdirectories.
Joerg Sonnenberger [Tue, 1 Nov 2016 20:09:41 +0000 (20:09 +0000)]
GC empty subdirectories.

llvm-svn: 285734

8 years agoclang/test/CodeGenOpenCL/convergent.cl: Satisfy -Asserts with "opt -instnamer".
NAKAMURA Takumi [Tue, 1 Nov 2016 20:08:17 +0000 (20:08 +0000)]
clang/test/CodeGenOpenCL/convergent.cl: Satisfy -Asserts with "opt -instnamer".

llvm-svn: 285733

8 years ago[InstCombine] allow splat vector folds in adjustMinMax()
Sanjay Patel [Tue, 1 Nov 2016 20:08:02 +0000 (20:08 +0000)]
[InstCombine] allow splat vector folds in adjustMinMax()

llvm-svn: 285732

8 years ago[clang-query] Fix Clang-tidy readability-redundant-string-cstr warnings
Malcolm Parsons [Tue, 1 Nov 2016 20:07:05 +0000 (20:07 +0000)]
[clang-query] Fix Clang-tidy readability-redundant-string-cstr warnings

Reviewers: pcc, dblaikie

Subscribers: cfe-commits

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

llvm-svn: 285731

8 years ago[RISCV] Add RISCV.def to module.modulemap
Alex Bradbury [Tue, 1 Nov 2016 19:31:30 +0000 (19:31 +0000)]
[RISCV] Add RISCV.def to module.modulemap

llvm-svn: 285730

8 years ago[InstCombine] Fold nuw left-shifts in `ugt`/`ule` comparisons.
Sanjay Patel [Tue, 1 Nov 2016 19:19:29 +0000 (19:19 +0000)]
[InstCombine] Fold nuw left-shifts in `ugt`/`ule` comparisons.

This transforms

%a = shl nuw %x, c1
%b = icmp {ugt|ule} %a, c0

into

%b = icmp {ugt|ule} %x, (c0 >> c1)

z3:

(declare-const x (_ BitVec 64))
(declare-const c0 (_ BitVec 64))
(declare-const c1 (_ BitVec 64))

(push)
(assert (= x (bvlshr (bvshl x c1) c1)))  ; nuw
(assert (not (= (bvugt (bvshl x c1) c0)
                (bvugt x
                       (bvlshr c0 c1)))))
(check-sat)
(get-model)
(pop)

(push)
(assert (= x (bvlshr (bvshl x c1) c1)))  ; nuw
(assert (not (= (bvule (bvshl x c1) c0)
                (bvule x
                       (bvlshr c0 c1)))))
(check-sat)
(get-model)
(pop)

Patch by bryant!

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

llvm-svn: 285729

8 years ago[Hexagon] Rename operand/predicate names for unshifted integers
Krzysztof Parzyszek [Tue, 1 Nov 2016 19:02:10 +0000 (19:02 +0000)]
[Hexagon] Rename operand/predicate names for unshifted integers

For example, rename s6Ext to s6_0Ext. The names for shifted integers
include the underscore and this will make the naming consistent. It
also exposed a few duplicates that were removed.

llvm-svn: 285728

8 years agoImplement a general type scavenger that can dig types from debug info + a filtering...
Enrico Granata [Tue, 1 Nov 2016 18:50:49 +0000 (18:50 +0000)]
Implement a general type scavenger that can dig types from debug info + a filtering mechanism to accept/reject results thusly obtained

Implement the C++ type lookup support in terms of this general scavenger

The idea is that we may want other languages to do debug info based search (exclusively, or as an add-on to runtime/module based searching) and it makes sense to avoid duplicating this functionality

llvm-svn: 285727

8 years agochange ProcessAttach test to no-debug-info
Todd Fiala [Tue, 1 Nov 2016 18:50:34 +0000 (18:50 +0000)]
change ProcessAttach test to no-debug-info

Fixes:
https://bugs.swift.org/browse/SR-3103

llvm-svn: 285726

8 years ago[OpenCL] Mark group functions as convergent in opencl-c.h
Yaxun Liu [Tue, 1 Nov 2016 18:45:32 +0000 (18:45 +0000)]
[OpenCL] Mark group functions as convergent in opencl-c.h

Certain OpenCL builtin functions are supposed to be executed by all threads in a work group or sub group. Such functions should not be made divergent during transformation. It makes sense to mark them with convergent attribute.

The adding of convergent attribute is based on Ettore Speziale's work and the original proposal and patch can be found at https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg22271.html.

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

llvm-svn: 285725

8 years agoBranchRelaxation: Expand unconditional branches first
Matt Arsenault [Tue, 1 Nov 2016 18:34:00 +0000 (18:34 +0000)]
BranchRelaxation: Expand unconditional branches first

It's likely if a conditional branch needs to be expanded, the following
unconditional branch will also need expansion. By expanding the
unconditional branch first, the conditional branch can be simply
inverted to jump over the inserted indirect branch block. If the
conditional branch is expanded first, it results in an additional
branch.

This avoids test regressions in future commits.

llvm-svn: 285722

8 years ago[Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by PVS-Studio
Eugene Zelenko [Tue, 1 Nov 2016 18:33:50 +0000 (18:33 +0000)]
[Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by PVS-Studio

Also fix some Include What You Use and modernize-use-bool-literals warnings.

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

llvm-svn: 285721

8 years agoImplement R_PPC_ADDR32.
Rui Ueyama [Tue, 1 Nov 2016 18:30:28 +0000 (18:30 +0000)]
Implement R_PPC_ADDR32.

Patch from Jack Andersen.

llvm-svn: 285720

8 years agoImplement R_PPC_REL24 and R_PPC_REL32 relocations.
Rui Ueyama [Tue, 1 Nov 2016 18:30:26 +0000 (18:30 +0000)]
Implement R_PPC_REL24 and R_PPC_REL32 relocations.

This enables LLD to relocate PC-relative R_PPC_REL32 and
R_PPC_REL24 types (as used in bl instructions).

Patch from Jack Andersen!

llvm-svn: 285719

8 years ago[InstCombine] clean up adjustMinMax(); NFCI
Sanjay Patel [Tue, 1 Nov 2016 18:15:03 +0000 (18:15 +0000)]
[InstCombine] clean up adjustMinMax(); NFCI

1. Change param names for readability
2. Change pointer param to ref
3. Early exit to reduce indent
4. Change switch to if/else

llvm-svn: 285718

8 years agoTest Commit, removed extraneous newline
Erich Keane [Tue, 1 Nov 2016 17:54:05 +0000 (17:54 +0000)]
Test Commit, removed extraneous newline

llvm-svn: 285717

8 years ago[AMDGPU] Check if type transforms to i16 (VI+) when getting AMDGPUISD::FFBH_U32
Konstantin Zhuravlyov [Tue, 1 Nov 2016 17:49:33 +0000 (17:49 +0000)]
[AMDGPU] Check if type transforms to i16 (VI+) when getting AMDGPUISD::FFBH_U32

This will prevent following regression when enabling i16 support (D18049):

test/CodeGen/AMDGPU/ctlz.ll
test/CodeGen/AMDGPU/ctlz_zero_undef.ll

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

llvm-svn: 285716

8 years ago[InstCombine] add helper function for adjustMinMax(); NFCI
Sanjay Patel [Tue, 1 Nov 2016 17:46:08 +0000 (17:46 +0000)]
[InstCombine] add helper function for adjustMinMax(); NFCI

This is just a cut and paste; clean-up and enhancements to follow.

llvm-svn: 285715

8 years ago[CMake] Fix rpath construction for out-of-tree builds
Chris Bieneman [Tue, 1 Nov 2016 17:44:58 +0000 (17:44 +0000)]
[CMake] Fix rpath construction for out-of-tree builds

This patch was produced in conjunction with Michał Górny. It should resolve the issues that were trying to be solved by D25304.

This moves rpath handling into `llvm_add_library` and `add_llvm_executable` so that it is available to all projects using AddLLVM whether built in-tree or out-of-tree.

llvm-svn: 285714

8 years ago[InstCombine] add vector tests for ext+adjust min/max
Sanjay Patel [Tue, 1 Nov 2016 17:34:29 +0000 (17:34 +0000)]
[InstCombine] add vector tests for ext+adjust min/max

llvm-svn: 285713

8 years ago[RISCV] Add stub backend
Alex Bradbury [Tue, 1 Nov 2016 17:27:54 +0000 (17:27 +0000)]
[RISCV] Add stub backend

This contains just enough for lib/Target/RISCV to compile. Notably a basic
RISCVTargetMachine and RISCVTargetInfo. At this point you can attempt llc
-march=riscv32 myinput.ll and will find it fails due to the lack of
MCAsmInfo.

See http://lists.llvm.org/pipermail/llvm-dev/2016-August/103748.html for
further discussion

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

llvm-svn: 285712

8 years agoAMDGPU: Fix buildbots broken by r285704
Tom Stellard [Tue, 1 Nov 2016 17:20:03 +0000 (17:20 +0000)]
AMDGPU: Fix buildbots broken by r285704

llvm-svn: 285711

8 years agoFix RHEL 6 build with missing cerrno and some other Include What You Use warnings.
Eugene Zelenko [Tue, 1 Nov 2016 17:11:10 +0000 (17:11 +0000)]
Fix RHEL 6 build with missing cerrno and some other Include What You Use warnings.

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

llvm-svn: 285710

8 years ago[RISCV] Add missing RISCV.def
Alex Bradbury [Tue, 1 Nov 2016 17:09:49 +0000 (17:09 +0000)]
[RISCV] Add missing RISCV.def

Fix rL285708

llvm-svn: 285709

8 years ago[RISCV] Add RISC-V ELF defines
Alex Bradbury [Tue, 1 Nov 2016 16:59:37 +0000 (16:59 +0000)]
[RISCV] Add RISC-V ELF defines

Add the necessary definitions for RISC-V ELF files, including relocs. Also
make necessary trivial change to ELFYaml, llvm-objdump, and llvm-readobj in
order to work with RISC-V ELFs.

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

llvm-svn: 285708

8 years ago[RISCV] Recognise riscv32 and riscv64 in triple parsing code
Alex Bradbury [Tue, 1 Nov 2016 16:47:54 +0000 (16:47 +0000)]
[RISCV] Recognise riscv32 and riscv64 in triple parsing code

This is the first in a series of 10 initial patches that incrementally add an
MC layer for RISC-V to LLVM. See
<http://lists.llvm.org/pipermail/llvm-dev/2016-August/103748.html> for more
discussion.

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

llvm-svn: 285707

8 years ago[InstCombine] move/fix tests for adjusted min/max
Sanjay Patel [Tue, 1 Nov 2016 16:39:30 +0000 (16:39 +0000)]
[InstCombine] move/fix tests for adjusted min/max

I think the former 'test50' had a typo making it functionally equivalent
to the former 'test49'; changed the predicate to provide more coverage.

llvm-svn: 285706

8 years ago[TableGen] Move OperandMatchResultTy enum to MCTargetAsmParser.h
Alex Bradbury [Tue, 1 Nov 2016 16:32:05 +0000 (16:32 +0000)]
[TableGen] Move OperandMatchResultTy enum to MCTargetAsmParser.h

As it stands, the OperandMatchResultTy is only included in the generated
header if there is custom operand parsing. However, almost all backends
make use of MatchOperand_Success and friends from OperandMatchResultTy for
e.g. parseRegister. This is a pain when starting an AsmParser for a new
backend that doesn't yet have custom operand parsing. Move the enum to
MCTargetAsmParser.h.

This patch is a prerequisite for D23563

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

llvm-svn: 285705

8 years agoAMDGPU: Implement expansion of f16 = FP_TO_FP16 f64
Tom Stellard [Tue, 1 Nov 2016 16:31:48 +0000 (16:31 +0000)]
AMDGPU: Implement expansion of f16 = FP_TO_FP16 f64

I wanted to implement this as a target independent expansion, however when
targets say they want to expand FP_TO_FP16 what they actually want is
the unsafe math expansion when possible and expansion to a libcall in all
other cases.

The only way to make this work as a target independent would be to add logic
to target's TargetLowering construction to mark theses nodes as Expand when
LegalizeDAG can use the unsafe expansion and mark them as LibCall when it
cannot.  I think this would be possible, but I think it would be too fragile
and complex as it would require targets to keep their expansion logic up
to date with the code in LegalizeDAG.

Reviewers: bogner, ab, t.p.northover, arsenm

Subscribers: wdng, llvm-commits, nhaehnle

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

llvm-svn: 285704

8 years agoFixed problem introduced by part of https://reviews.llvm.org/D21196.
Andrey Churbanov [Tue, 1 Nov 2016 16:19:04 +0000 (16:19 +0000)]
Fixed problem introduced by part of https://reviews.llvm.org/D21196.

Check Task Scheduling Constraint (TSC) on stealing of untied task.
This is needed because the untied task can produce tied children
those can break TSC if untied is not a descendant of current task.
This can cause live lock on complex tyasking tests
(e.g. kastors/strassen-task-dep).

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

llvm-svn: 285703

8 years agoRemove TimeValue usage from FileSpec.h
Pavel Labath [Tue, 1 Nov 2016 16:11:14 +0000 (16:11 +0000)]
Remove TimeValue usage from FileSpec.h

Summary:
The only usage there was in GetModificationTime(). I also took the opportunity
to move this function from FileSpec to the FileSystem class - since we are
using FileSpecs to also represent remote files for which we cannot (easily)
retrieve modification time, it makes sense to make the decision to get the
modification time more explicit.

The new function returns a llvm::sys::TimePoint<>. To aid the transition
from TimeValue, I have added a constructor to it which enables implicit
conversion from a time_point.

Reviewers: zturner, clayborg

Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits

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

llvm-svn: 285702

8 years agoThis is a 1 character fix for an ARM build attribute test (r284571): the
Sjoerd Meijer [Tue, 1 Nov 2016 15:59:37 +0000 (15:59 +0000)]
This is a 1 character fix for an ARM build attribute test (r284571): the
purpose of the test was to have 2 different function attribute sets, but due
to a typo there was only one both with number #0.

llvm-svn: 285701

8 years ago[OpenCL] Override supported OpenCL extensions with -cl-ext option
Alexey Bader [Tue, 1 Nov 2016 15:50:52 +0000 (15:50 +0000)]
[OpenCL] Override supported OpenCL extensions with -cl-ext option

Summary:
This patch adds a command line option '-cl-ext' to control a set of
supported OpenCL extensions. Option accepts a comma-separated list
of extensions prefixed with '+' or '-'.

It can be used together with a target triple to override support for some
extensions:

  // spir target supports all extensions, but we want to disable fp64
  clang -cc1 -triple spir-unknown-unknown -cl-ext=-cl_khr_fp64

Special 'all' extension allows to enable or disable all possible
extensions:

  // only fp64 will be supported
  clang -cc1 -triple spir-unknown-unknown -cl-ext=-all,+cl_khr_fp64

Patch by asavonic (Andrew Savonichev).

Reviewers: joey, yaxunl

Subscribers: yaxunl, bader, Anastasia, cfe-commits

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

llvm-svn: 285700

8 years ago[InstCombine] fix tests for adjusted min/max
Sanjay Patel [Tue, 1 Nov 2016 15:48:30 +0000 (15:48 +0000)]
[InstCombine] fix tests for adjusted min/max

1. Delete identical tests
2. Rename tests to reflect actual functionality
3. Add comments
4. Add unsigned variants
5. Add vector variants with FIXME comments
6. Rename test file

llvm-svn: 285699

8 years agoMinidump plugin: Fix flaky test
Dimitar Vlahovski [Tue, 1 Nov 2016 15:48:24 +0000 (15:48 +0000)]
Minidump plugin: Fix flaky test

Summary:
One of the tests was flaky, because similarly to
https://reviews.llvm.org/D18697 (rL265391) - if there is a process running
which is with the same PID as in the core file, the minidump
core file debugging will fail, because we get some information from the
running process.
The fix is routing the ProcessInfo requests through the Process class
and overriding it in ProcessMinidump to return correct data.

Reviewers: labath

Subscribers: lldb-commits, beanz

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

llvm-svn: 285698

8 years agoProtect exceptional paths under libcpp-no-exceptions
Roger Ferrer Ibanez [Tue, 1 Nov 2016 15:46:16 +0000 (15:46 +0000)]
Protect exceptional paths under libcpp-no-exceptions

These tests are of the form

try {
   action-that-may-throw
   assert(!exceptional-condition)
   assert(some-other-facts)
 } catch (relevant-exception) {
   assert(exceptional-condition)
 }

Under libcpp-no-exceptions there is still value in verifying
some-other-facts while avoiding the exceptional case. So for these tests
just conditionally check some-other-facts if exceptional-condition is
false. When exception are supported make sure that a true
exceptional-condition throws an exception

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

llvm-svn: 285697

8 years ago[InstCombine] Folding of shifts by the sum of positive values
Simon Pilgrim [Tue, 1 Nov 2016 15:40:30 +0000 (15:40 +0000)]
[InstCombine] Folding of shifts by the sum of positive values

This patch introduces the combine:

(C1 shift (A add C2)) -> ((C1 shift C2) shift A)
iff A and C2 are both positive

If both A and C2 are know to be positive then we can safely split into 2 shifts, permitting the folding of the Inner shift.

Fix for the spec benchmark case mentioned by @nadav on PR15141 (assuming we can prove that the inputs as positive).

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

llvm-svn: 285696

8 years agoProtect lock tests under libcpp-no-exceptions
Roger Ferrer Ibanez [Tue, 1 Nov 2016 15:00:16 +0000 (15:00 +0000)]
Protect lock tests under libcpp-no-exceptions

Skip tests that expect an exception to be thrown.

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

llvm-svn: 285695

8 years ago[PowerPC] Implement vector shift builtins - clang portion
Nemanja Ivanovic [Tue, 1 Nov 2016 14:46:20 +0000 (14:46 +0000)]
[PowerPC] Implement vector shift builtins - clang portion

This patch corresponds to review https://reviews.llvm.org/D26092.
Committing on behalf of Tony Jiang.

llvm-svn: 285694

8 years ago[InstCombine] auto-generate better checks
Sanjay Patel [Tue, 1 Nov 2016 14:38:30 +0000 (14:38 +0000)]
[InstCombine] auto-generate better checks

llvm-svn: 285693

8 years ago[Sparc][LEON] Test for FixFDIVSQRT erratum fix.
Chris Dewhurst [Tue, 1 Nov 2016 14:23:37 +0000 (14:23 +0000)]
[Sparc][LEON] Test for FixFDIVSQRT erratum fix.

Note: Test is per differential review, but the other changed code in the review was for an optimisation that din't quite work. Nevertheless, the test is valid for the unoptimised version of the fix.

Differential Review: https://reviews.llvm.org/D24658

llvm-svn: 285692

8 years agoDon't store an OutputLoc in every InputSection.
Rafael Espindola [Tue, 1 Nov 2016 13:57:19 +0000 (13:57 +0000)]
Don't store an OutputLoc in every InputSection.

It was only used by build-id and that can easily compute it.

llvm-svn: 285691

8 years ago[Thumb-1] Synthesize TBB/TBH instructions to make use of compressed jump tables
James Molloy [Tue, 1 Nov 2016 13:37:41 +0000 (13:37 +0000)]
[Thumb-1] Synthesize TBB/TBH instructions to make use of compressed jump tables

[Reapplying r284580 and r285917 with fix and testing to ensure emitted jump tables for Thumb-1 have 4-byte alignment]

The TBB and TBH instructions in Thumb-2 allow jump tables to be compressed into sequences of bytes or shorts respectively. These instructions do not exist in Thumb-1, however it is possible to synthesize them out of a sequence of other instructions.

It turns out this sequence is so short that it's almost never a lose for performance and is ALWAYS a significant win for code size.

TBB example:
Before: lsls r0, r0, #2    After: add  r0, pc
        adr  r1, .LJTI0_0         ldrb r0, [r0, #6]
        ldr  r0, [r0, r1]         lsls r0, r0, #1
        mov  pc, r0               add  pc, r0
  => No change in prologue code size or dynamic instruction count. Jump table shrunk by a factor of 4.

The only case that can increase dynamic instruction count is the TBH case:

Before: lsls r0, r4, #2    After: lsls r4, r4, #1
        adr  r1, .LJTI0_0         add  r4, pc
        ldr  r0, [r0, r1]         ldrh r4, [r4, #6]
        mov  pc, r0               lsls r4, r4, #1
                                  add  pc, r4
  => 1 more instruction in prologue. Jump table shrunk by a factor of 2.

So there is an argument that this should be disabled when optimizing for performance (and a TBH needs to be generated). I'm not so sure about that in practice, because on small cores with Thumb-1 performance is often tied to code size. But I'm willing to turn it off when optimizing for performance if people want (also note that TBHs are fairly rare in practice!)

llvm-svn: 285690

8 years ago[clang-tidy] Add check readability-redundant-declaration
Daniel Marjamaki [Tue, 1 Nov 2016 13:26:15 +0000 (13:26 +0000)]
[clang-tidy] Add check readability-redundant-declaration

Finds redundant variable and function declarations.

  extern int X;
  extern int X;  // <- redundant

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

llvm-svn: 285689

8 years ago[x86][inline-asm][clang] accept 'v' constraint
Michael Zuckerman [Tue, 1 Nov 2016 13:16:44 +0000 (13:16 +0000)]
[x86][inline-asm][clang] accept 'v' constraint
Commit on behalf of: Coby Tayree

1.'v' constraint for (x86) non-avx arch imitates the already implemented 'x' constraint, i.e. allows XMM{0-15} & YMM{0-15} depending on the apparent arch & mode (32/64).
2.for the avx512 arch it allows [X,Y,Z]MM{0-31} (mode dependent)

This patch applies the needed changes to clang
LLVM patch: https://reviews.llvm.org/D25005

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

llvm-svn: 285688

8 years agoRemove second argument to readProvideOrAssignment.
Rafael Espindola [Tue, 1 Nov 2016 11:30:45 +0000 (11:30 +0000)]
Remove second argument to readProvideOrAssignment.

With this expressions alone track if they are absolute or not.

llvm-svn: 285687

8 years ago[www] Fix a typo on the analyzer website
Alex Lorenz [Tue, 1 Nov 2016 11:12:41 +0000 (11:12 +0000)]
[www] Fix a typo on the analyzer website

llvm-svn: 285686

8 years agoFix parenthesized assert (nfc).
Manuel Klimek [Tue, 1 Nov 2016 10:30:50 +0000 (10:30 +0000)]
Fix parenthesized assert (nfc).

llvm-svn: 285685

8 years ago[AMDGPU] Expand vector mulhu/mulhs
Valery Pykhtin [Tue, 1 Nov 2016 10:26:48 +0000 (10:26 +0000)]
[AMDGPU] Expand vector mulhu/mulhs

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

llvm-svn: 285684

8 years ago[ELF] Remove unwanted typedef. NFC.
Eugene Leviant [Tue, 1 Nov 2016 10:16:52 +0000 (10:16 +0000)]
[ELF] Remove unwanted typedef. NFC.

llvm-svn: 285683

8 years agoConvert BuildIdSection to input section
Eugene Leviant [Tue, 1 Nov 2016 09:49:24 +0000 (09:49 +0000)]
Convert BuildIdSection to input section

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

llvm-svn: 285682

8 years ago[PowerPC] Implement vector shift builtins - llvm portion
Nemanja Ivanovic [Tue, 1 Nov 2016 09:42:32 +0000 (09:42 +0000)]
[PowerPC] Implement vector shift builtins - llvm portion

This patch corresponds to review https://reviews.llvm.org/D26095.
Committing on behalf of Tony Jiang.

llvm-svn: 285681

8 years agoAllow fetching source line, when multiple "AX" sections present
Eugene Leviant [Tue, 1 Nov 2016 09:17:50 +0000 (09:17 +0000)]
Allow fetching source line, when multiple "AX" sections present

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

llvm-svn: 285680

8 years ago[PPC] Add vec_absd functions to altivec.h
Nemanja Ivanovic [Tue, 1 Nov 2016 08:39:56 +0000 (08:39 +0000)]
[PPC] Add vec_absd functions to altivec.h

This patch corresponds to review https://reviews.llvm.org/D26073.
Committing on behalf of Sean Fertile.

llvm-svn: 285679

8 years agoAdd more conditions to check whether task waiting is necessary in kmp_omp_taskwait.
Andrey Churbanov [Tue, 1 Nov 2016 08:33:36 +0000 (08:33 +0000)]
Add more conditions to check whether task waiting is necessary in kmp_omp_taskwait.

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

Patch by Victor Campos

llvm-svn: 285678

8 years agoProtect tests that expect an exception for an unknown std::random_device
Roger Ferrer Ibanez [Tue, 1 Nov 2016 08:11:12 +0000 (08:11 +0000)]
Protect tests that expect an exception for an unknown std::random_device

Skip these tests under libcpp-no-exceptions.

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

llvm-svn: 285677

8 years agoAttempt to pacify buildbot
Serge Pavlov [Tue, 1 Nov 2016 07:52:10 +0000 (07:52 +0000)]
Attempt to pacify buildbot

llvm-svn: 285676

8 years agoAllow resolving response file names relative to including file
Serge Pavlov [Tue, 1 Nov 2016 06:53:29 +0000 (06:53 +0000)]
Allow resolving response file names relative to including file

If a response file included by construct @file itself includes a response file
and that file is specified by relative file name, current behavior is to resolve
the name relative to the current working directory. The change adds additional
flag to ExpandResponseFiles that may be used to resolve nested response file
names relative to including file. With the new mode a set of related response
files may be kept together and reference each other with short position
independent names.

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

llvm-svn: 285675

8 years agoclang-format: Fix bug in function reference qualifier detection.
Daniel Jasper [Tue, 1 Nov 2016 06:23:19 +0000 (06:23 +0000)]
clang-format: Fix bug in function reference qualifier detection.

Before:
  template <typename T>
      void F(T) &&
      = delete;

After:
  template <typename T>
  void F(T) && = delete;

llvm-svn: 285674

8 years agoclang-format: Fix incorrect pointer detection.
Daniel Jasper [Tue, 1 Nov 2016 06:23:14 +0000 (06:23 +0000)]
clang-format: Fix incorrect pointer detection.

Before:
  void f() { f(float{1}, a *a); }

After:
  void f() { f(float{1}, a * a); }

llvm-svn: 285673

8 years agoclang-format: [JS] Fix incorrect space when "as" is used as identifier.
Daniel Jasper [Tue, 1 Nov 2016 06:23:10 +0000 (06:23 +0000)]
clang-format: [JS] Fix incorrect space when "as" is used as identifier.

Before:
  aaaaa.as ();

After:
  aaaaa.as();

llvm-svn: 285672

8 years agoclang-format: Fix incorrect binary operator detection.
Daniel Jasper [Tue, 1 Nov 2016 06:23:05 +0000 (06:23 +0000)]
clang-format: Fix incorrect binary operator detection.

Before:
  int x = f(* + [] {});

After:
  int x = f(*+[] {});

llvm-svn: 285671

8 years agoclang-format: [JS] Fix formatting of generator functions.
Daniel Jasper [Tue, 1 Nov 2016 06:22:59 +0000 (06:22 +0000)]
clang-format: [JS] Fix formatting of generator functions.

Before:
  var x = {
    a: function*
() {
  //
}
  }

After:
  var x = {
    a: function*() {
      //
    }
  }

llvm-svn: 285670

8 years agoclang-format: [JS] Fix space when for is used as regular identifier.
Daniel Jasper [Tue, 1 Nov 2016 06:22:54 +0000 (06:22 +0000)]
clang-format: [JS] Fix space when for is used as regular identifier.

Before:
  x.for () = 1;

After:
  x.for() = 1;

llvm-svn: 285669

8 years ago[docs] remove more non-ascii stuff in the hopes to fix the bot
Kostya Serebryany [Tue, 1 Nov 2016 05:51:12 +0000 (05:51 +0000)]
[docs] remove more non-ascii stuff in the hopes to fix the bot

llvm-svn: 285668

8 years ago[AVX-512] Remove masked vector insert builtins and replace with native shufflevectors...
Craig Topper [Tue, 1 Nov 2016 05:47:56 +0000 (05:47 +0000)]
[AVX-512] Remove masked vector insert builtins and replace with native shufflevectors and selects.

Unfortunately, the backend currently doesn't fold masks into the instructions correctly when they come from these shufflevectors. I'll work on that in a future commit.

llvm-svn: 285667

8 years ago[index] Avoid using a RecursiveASTVisitor for SyntacticFormIndexer and iterate the...
Argyrios Kyrtzidis [Tue, 1 Nov 2016 04:29:39 +0000 (04:29 +0000)]
[index] Avoid using a RecursiveASTVisitor for SyntacticFormIndexer and iterate the DesignatedInitExprs of the InitListExpr directly.

This is more efficient, as per feedback by Richard.

llvm-svn: 285666

8 years ago[TBAA] Use wrapper objects instead of raw getOperand s; NFC
Sanjoy Das [Tue, 1 Nov 2016 02:58:30 +0000 (02:58 +0000)]
[TBAA] Use wrapper objects instead of raw getOperand s; NFC

This is intended to make the semantic intent clearer.

The wrapper objects are now generic to avoid `const_cast` s.  Since
`const` ness is part of the API of `MDNode::getMostGenericTBAA` (and
therefore I can't make things `const` all the way through without some
code churn outside TypeBasedAliasAnalysis.cpp), this seemed like the
cleanest solution.

llvm-svn: 285665