platform/upstream/llvm.git
7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 years agoImplement ABI proposal for throwing noexcept function pointers, per discussion
Richard Smith [Tue, 1 Nov 2016 01:34:46 +0000 (01:34 +0000)]
Implement ABI proposal for throwing noexcept function pointers, per discussion
on cxx-abi-dev (thread starting 2016-10-11). This is currently hidden behind a
cc1-only -m flag, pending discussion of how best to deal with language changes
that require use of new symbols from the ABI library.

llvm-svn: 285664

7 years agop0012: Teach resolving address of overloaded function with dependent exception
Richard Smith [Tue, 1 Nov 2016 01:31:23 +0000 (01:31 +0000)]
p0012: Teach resolving address of overloaded function with dependent exception
specification to resolve the exception specification as part of the type check,
in C++1z onwards. This is not actually part of P0012 / CWG1330 rules for when
an exception specification is "needed", but is necessary for sanity.

llvm-svn: 285663

7 years agoFix a bug where the EmulateInstructionARM64 handling of STP/LDP instructions
Jason Molenda [Tue, 1 Nov 2016 01:26:54 +0000 (01:26 +0000)]
Fix a bug where the EmulateInstructionARM64 handling of STP/LDP instructions
for floating point registers was not recording them correctly.  I needed to
change the EmulateInstructionARM64 unwind plans from using the DWARF
register numbering scheme to using the LLDB register numbering scheme
(because dwarf doesn't define register numbers for the 64-bit "d" registers).
Updated the EmulateInstructionARM64 unit tests to work with the LLDB
register numbering scheme and added a unit test to check the floating
point register spills & restores are correctly recorded.

https://reviews.llvm.org/D25864
<rdar://problem/28745483>

llvm-svn: 285662

7 years ago[TBAA] Rename accessors to be more idiomatic; NFC
Sanjoy Das [Tue, 1 Nov 2016 01:21:57 +0000 (01:21 +0000)]
[TBAA] Rename accessors to be more idiomatic; NFC

llvm-svn: 285661

7 years agoBitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.
Peter Collingbourne [Tue, 1 Nov 2016 01:18:57 +0000 (01:18 +0000)]
Bitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.

No block info block should need to define local abbreviations, so we can
always use a code width of 2.

Also change all block info block writers to use EnterBlockInfoBlock.

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

llvm-svn: 285660

7 years agoAMDGPU: Whitespace fixes
Matt Arsenault [Tue, 1 Nov 2016 00:55:14 +0000 (00:55 +0000)]
AMDGPU: Whitespace fixes

llvm-svn: 285659

7 years agoRemove executable bit on a source file
Stephane Sezer [Tue, 1 Nov 2016 00:21:57 +0000 (00:21 +0000)]
Remove executable bit on a source file

llvm-svn: 285658

7 years ago[ReachableCode] Skip over ExprWithCleanups in isConfigurationValue
Tim Shen [Tue, 1 Nov 2016 00:19:04 +0000 (00:19 +0000)]
[ReachableCode] Skip over ExprWithCleanups in isConfigurationValue

Summary: Fixes pr29152.

Reviewers: rsmith, pirama, krememek

Subscribers: cfe-commits

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

llvm-svn: 285657

7 years ago[DAG] disable nsw/nuw for add/sub/mul when simplifying based on demanded bits (PR30841)
Sanjay Patel [Mon, 31 Oct 2016 23:28:45 +0000 (23:28 +0000)]
[DAG] disable nsw/nuw for add/sub/mul when simplifying based on demanded bits (PR30841)

This bug was exposed by using nsw/nuw for more aggressive folds in:
https://reviews.llvm.org/rL284844

The changes mimic the IR demanded bits logic in InstCombiner::SimplifyDemandedUseBits(),
but we can't just flip flag bits in the DAG; we have to create a new node that has the
bits cleared.

This should fix:
https://llvm.org/bugs/show_bug.cgi?id=30841

llvm-svn: 285656

7 years ago[modules] Mark deleted functions as implicitly inline to allow merging
Eric Fiselier [Mon, 31 Oct 2016 23:07:15 +0000 (23:07 +0000)]
[modules] Mark deleted functions as implicitly inline to allow  merging

Summary: When merging definitions with ModulesLocalVisibility enabled it's important to make deleted definitions implicitly inline, otherwise they'll be diagnosed as a redefinition.

Reviewers: silvas, manmanren, rsmith

Subscribers: cfe-commits

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

llvm-svn: 285655

7 years ago[Hexagon] Garbage collect dead code.
Davide Italiano [Mon, 31 Oct 2016 22:56:56 +0000 (22:56 +0000)]
[Hexagon] Garbage collect dead code.

llvm-svn: 285654

7 years ago[clang-tidy] Update cert-err58-cpp to match its new generalised form.
Malcolm Parsons [Mon, 31 Oct 2016 22:47:04 +0000 (22:47 +0000)]
[clang-tidy] Update cert-err58-cpp to match its new generalised form.

Summary:
Aaron modified cert-err58-cpp to include all exceptions thrown before main()
Update the check to match.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 285653

7 years agoFix a typo.
Evgeniy Stepanov [Mon, 31 Oct 2016 22:42:39 +0000 (22:42 +0000)]
Fix a typo.

Found with PVS-Studio here: http://www.viva64.com/en/b/0446/

llvm-svn: 285652

7 years ago[CMake] Populate the build directory's framework
Chris Bieneman [Mon, 31 Oct 2016 22:31:07 +0000 (22:31 +0000)]
[CMake] Populate the build directory's framework

This ensures that the Resources and clang headers are properly symlinked in LLDB's framework. This should fix the modules-related tests when building on Darwin with CMake if you are building a framework.

I have another fix coming which gets them working on Darwin if you're building liblldb instead of a framework.

llvm-svn: 285651

7 years ago[cfi] Fix missing !type annotation.
Evgeniy Stepanov [Mon, 31 Oct 2016 22:28:10 +0000 (22:28 +0000)]
[cfi] Fix missing !type annotation.

CFI (only in the cross-dso mode) fails to set !type annotations when
a function is used before it is defined.

llvm-svn: 285650

7 years agoCodeGen: further loosen -O0 CG for WoA division
Saleem Abdulrasool [Mon, 31 Oct 2016 22:12:37 +0000 (22:12 +0000)]
CodeGen: further loosen -O0 CG for WoA division

Generate the slowest possible codepath for noopt CodeGen.  Even trying to be
clever with the negated jump can cause out-of-range jumps.  Use a wide branch
instead. Although the code is modelled simplistically, the later optimizations
would recombine the branching into `cbz` if possible.  This re-enables the
previous optimization as well as hopefully gives us working code in all cases.

Addresses PR30356!

llvm-svn: 285649

7 years ago[ThinLTO] Disable importing and other cross-module optis at -O0
Teresa Johnson [Mon, 31 Oct 2016 22:12:21 +0000 (22:12 +0000)]
[ThinLTO] Disable importing and other cross-module optis at -O0

Summary:
There is no point to importing at -O0, since we won't inline. We should
also disable other cross-module optimizations.

(Plan to backport this fix to the 3.9 branch to fix PR30774)

Reviewers: pcc

Subscribers: johanengelen, mehdi_amini

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

llvm-svn: 285648

7 years ago[index] Fix repeated visitation of the same InitListExpr for indexing.
Argyrios Kyrtzidis [Mon, 31 Oct 2016 22:12:12 +0000 (22:12 +0000)]
[index] Fix repeated visitation of the same InitListExpr for indexing.

It was visited multiple times unnecessarily.

rdar://28985038

llvm-svn: 285647

7 years ago[Test-Suite] Speculative fix for darwin bots
Chris Bieneman [Mon, 31 Oct 2016 22:06:52 +0000 (22:06 +0000)]
[Test-Suite] Speculative fix for darwin bots

When building with Xcode it looks like some of the logic in my test changes went haywire. This should fix it.

llvm-svn: 285646

7 years ago[Release notes] Highlight reset() as language/library artifact.
Eugene Zelenko [Mon, 31 Oct 2016 22:05:45 +0000 (22:05 +0000)]
[Release notes] Highlight reset() as language/library artifact.

llvm-svn: 285645

7 years ago[ASTMatcher] Add CXXNewExpr support to hasDeclaration
Malcolm Parsons [Mon, 31 Oct 2016 22:04:07 +0000 (22:04 +0000)]
[ASTMatcher] Add CXXNewExpr support to hasDeclaration

Reviewers: sbenza, lukasza, aaron.ballman, klimek

Subscribers: lukasza, sbenza, cfe-commits

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

llvm-svn: 285644

7 years agoA compound literal within a global lambda or block is still within
John McCall [Mon, 31 Oct 2016 21:56:26 +0000 (21:56 +0000)]
A compound literal within a global lambda or block is still within
the body of a function for the purposes of computing its storage
duration and deciding whether its initializer must be constant.

There are a number of problems in our current treatment of compound
literals.  C specifies that a compound literal yields an l-value
referring to an object with either static or automatic storage
duration, depending on where it was written; in the latter case,
the literal object has a lifetime tied to the enclosing scope (much
like an ObjC block), not the enclosing full-expression.  To get these
semantics fully correct in our current design, we would need to
collect compound literals on the ExprWithCleanups, just like we do
with ObjC blocks; we would probably also want to identify literals
like we do with materialized temporaries.  But it gets stranger;
GCC adds compound literals to C++ as an extension, but makes them
r-values, which are generally assumed to have temporary storage
duration.  Ignoring destructor ordering, the difference only matters
if the object's address escapes the full-expression, which for an
r-value can only happen with reference binding (which extends
temporaries) or array-to-pointer decay (which does not).  GCC then
attempts to lock down on array-to-pointer decay in ad hoc ways.
Arguably a far superior language solution for C++ (and perhaps even
array r-values in C, which can occur in other ways) would be to
propagate lifetime extension through array-to-pointer decay, so
that initializing a pointer object to a decayed r-value array
extends the lifetime of the complete object containing the array.
But this would be a major change in semantics which arguably ought
to be blessed by the committee(s).

Anyway, I'm not fixing any of that in this patch; I did try, but
it got out of hand.

Fixes rdar://28949016.

llvm-svn: 285643

7 years ago[NVPTX] Remove NVPTXFavorNonGenericAddrSpaces pass.
Justin Lebar [Mon, 31 Oct 2016 21:51:42 +0000 (21:51 +0000)]
[NVPTX] Remove NVPTXFavorNonGenericAddrSpaces pass.

Summary:
This has been replaced by the NVPTXInferAddressSpaces pass.  We've had
the new one as the default with the old one accessible via a flag for
some months now, and we've had no problems.

Reviewers: tra

Subscribers: llvm-commits, jholewinski, jingyue, mgorny

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

llvm-svn: 285642

7 years agoThe expr '.' is not absolute.
Rafael Espindola [Mon, 31 Oct 2016 21:36:23 +0000 (21:36 +0000)]
The expr '.' is not absolute.

With this patch we keep track of the fact that . is a position in the
file and therefore not absolute. This allow us to compute relative
relocations that involve symbol that are defined in linker scripts
with '.'.

This fixes https://llvm.org/bugs/show_bug.cgi?id=30406

There is still more work to track absoluteness over the various
expressions, but this should unblock linking the EFI bootloader.

llvm-svn: 285641

7 years ago[analyzer] Allow undefined values in performTrivialCopy.
Artem Dergachev [Mon, 31 Oct 2016 21:11:20 +0000 (21:11 +0000)]
[analyzer] Allow undefined values in performTrivialCopy.

Reading from a garbage pointer should be modeled as garbage,
and performTrivialCopy should be able to deal with any SVal input.

Patch by Ilya Palachev!

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

llvm-svn: 285640

7 years agodocs: trying to fix the docs bot by removing non-ASCII characters. The docs build...
Kostya Serebryany [Mon, 31 Oct 2016 21:10:26 +0000 (21:10 +0000)]
docs: trying to fix the docs bot by removing non-ASCII characters. The docs build fine on my machine, bot fail on the bot (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/25/steps/docs-llvm-html/logs/stdio)

llvm-svn: 285639

7 years agoRe-commit r285607: Emit Section Map stream."
Rui Ueyama [Mon, 31 Oct 2016 21:09:21 +0000 (21:09 +0000)]
Re-commit r285607: Emit Section Map stream."

Removed some test fields that overspecified test conditions.

llvm-svn: 285638

7 years ago[analyzer] MacOSXAPIChecker: Improve warnings for __block vars in dispatch_once.
Artem Dergachev [Mon, 31 Oct 2016 21:04:54 +0000 (21:04 +0000)]
[analyzer] MacOSXAPIChecker: Improve warnings for __block vars in dispatch_once.

The checker already warns for __block-storage variables being used as a
dispatch_once() predicate, however it refers to them as local which is not quite
accurate, so we fix that.

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

llvm-svn: 285637

7 years agofix _dyld_find_unwind_sections() for pre-10.7. Patch by Jeremy Sequoia
Nick Kledzik [Mon, 31 Oct 2016 21:04:17 +0000 (21:04 +0000)]
fix _dyld_find_unwind_sections() for pre-10.7.  Patch by Jeremy Sequoia

llvm-svn: 285636

7 years ago[tsan] Enable the tsan/libcxx/ testcase(s) on Darwin
Kuba Brecka [Mon, 31 Oct 2016 20:50:15 +0000 (20:50 +0000)]
[tsan] Enable the tsan/libcxx/ testcase(s) on Darwin

Apparently, the std_shared_ptr.cc testcase works fine on Darwin, even without the instrumented libcxx. Let's enable it.

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

llvm-svn: 285634

7 years agoRemove llc -jump-table-type option, it hasn't been functional for years.
Joerg Sonnenberger [Mon, 31 Oct 2016 20:35:20 +0000 (20:35 +0000)]
Remove llc -jump-table-type option, it hasn't been functional for years.

llvm-svn: 285633

7 years agoMore additional error checks for invalid Mach-O files when
Kevin Enderby [Mon, 31 Oct 2016 20:29:48 +0000 (20:29 +0000)]
More additional error checks for invalid Mach-O files when
the offsets and sizes of an element of the file overlaps with
another element in the Mach-O file.

This shows the approach to this testing for three elements
and contains for tests for their overlap.  Checking for all the
remain elements will be added next.

llvm-svn: 285632

7 years agoAdd comment explaining this mysterious macro name.
Richard Smith [Mon, 31 Oct 2016 20:25:52 +0000 (20:25 +0000)]
Add comment explaining this mysterious macro name.

llvm-svn: 285631

7 years ago[tsan] Implement WriteMemoryProfile for Darwin
Kuba Brecka [Mon, 31 Oct 2016 20:17:13 +0000 (20:17 +0000)]
[tsan] Implement WriteMemoryProfile for Darwin

TSan’s memory usage profiling currently doesn’t work on Darwin. This patch implements measuring the amount of resident and dirty memory for each memory region. I also removed the GetShadowMemoryConsumption function, which seems to be unused.

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

llvm-svn: 285630

7 years agoRevert "Add a space to work around a Windows CPython / MSys quoting bug"
Reid Kleckner [Mon, 31 Oct 2016 20:13:41 +0000 (20:13 +0000)]
Revert "Add a space to work around a Windows CPython / MSys quoting bug"

This reverts commit r284768.

After LLVM r285237, the lit shell interpreter works around this bug for
us.

llvm-svn: 285629

7 years agoDelay computation of IsAbsolute.
Rafael Espindola [Mon, 31 Oct 2016 19:56:37 +0000 (19:56 +0000)]
Delay computation of IsAbsolute.

We parse linker scripts very early, but whether an expression is
absolute or not can depend on a symbol defined in a .o. Given that, we
have to delay the computation of IsAbsolute. We can do that by storing
an AST when parsing or by also making IsAbsolute a function like we do
for the expression value. This patch implements the second option.

llvm-svn: 285628

7 years ago[PPC] add absolute difference altivec instructions and matching intrinsics
Nemanja Ivanovic [Mon, 31 Oct 2016 19:47:52 +0000 (19:47 +0000)]
[PPC] add absolute difference altivec instructions and matching intrinsics

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

llvm-svn: 285627

7 years agoDebugInfo: support for DW_TAG_atomic_type
Victor Leschuk [Mon, 31 Oct 2016 19:09:47 +0000 (19:09 +0000)]
DebugInfo: support for DW_TAG_atomic_type

Mark C11 _Atomic variables with DW_TAG_atomic_type tag.

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

llvm-svn: 285625

7 years agoDebugInfo: make DW_TAG_atomic_type valid
Victor Leschuk [Mon, 31 Oct 2016 19:09:38 +0000 (19:09 +0000)]
DebugInfo: make DW_TAG_atomic_type valid

DW_TAG_atomic_type was already included in Dwarf.defs and emitted correctly,
however Verifier didn't recognize it as valid.
Thus we introduce the following changes:

  * Make DW_TAG_atomic_type valid tag for IR and DWARF (enabled only with -gdwarf-5)
  * Add it to related docs
  * Add DebugInfo tests

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

llvm-svn: 285624

7 years agoNFC - Reorder test case names in a PPC test case
Nemanja Ivanovic [Mon, 31 Oct 2016 19:02:54 +0000 (19:02 +0000)]
NFC - Reorder test case names in a PPC test case

A few recent commits have messed up the order of some tests
in a PPC test case. This just reorders them in a sensible way.

llvm-svn: 285623

7 years agoFix per-processor model scheduler definition completeness check
Ulrich Weigand [Mon, 31 Oct 2016 18:59:52 +0000 (18:59 +0000)]
Fix per-processor model scheduler definition completeness check

The CodeGenSchedModels::checkCompleteness routine in TableGen/
CodeGenSchedule.cpp is supposed to verify for each processor
model that is marked as "complete" that it actually defines a
scheduling class for each instruction.

However, this did not work correctly due to an incorrect
check whether a scheduling class has an itinerary.

Reviewer: atrick
Differential revision: https://reviews.llvm.org/D26156

llvm-svn: 285622

7 years agoSimple numeric constants are absolute.
Rafael Espindola [Mon, 31 Oct 2016 18:56:02 +0000 (18:56 +0000)]
Simple numeric constants are absolute.

llvm-svn: 285621

7 years ago[asan] Move instrumented null-terminated strings to a special section, compiler-rt...
Kuba Brecka [Mon, 31 Oct 2016 18:52:32 +0000 (18:52 +0000)]
[asan] Move instrumented null-terminated strings to a special section, compiler-rt part

On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

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

llvm-svn: 285620

7 years ago[asan] Move instrumented null-terminated strings to a special section, LLVM part
Kuba Brecka [Mon, 31 Oct 2016 18:51:58 +0000 (18:51 +0000)]
[asan] Move instrumented null-terminated strings to a special section, LLVM part

On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

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

llvm-svn: 285619