platform/upstream/llvm.git
7 years agoFix _recalloc redefinition link error in ASan RTL
Reid Kleckner [Tue, 11 Oct 2016 23:13:13 +0000 (23:13 +0000)]
Fix _recalloc redefinition link error in ASan RTL

Fixes PR30329

Patch by Hans-Bernhard Broeker!

llvm-svn: 283955

7 years agoFix the stage2 MSVC 2013 build with less constexpr in RNG
Reid Kleckner [Tue, 11 Oct 2016 23:02:21 +0000 (23:02 +0000)]
Fix the stage2 MSVC 2013 build with less constexpr in RNG

llvm-svn: 283954

7 years ago[DAG] Fix crash in build_vector -> vector_shuffle combine
Michael Kuperstein [Tue, 11 Oct 2016 22:44:31 +0000 (22:44 +0000)]
[DAG] Fix crash in build_vector -> vector_shuffle combine

Fixes a crash in the build_vector -> vector_shuffle combine
when the first vector input is twice as wide as the output,
and the second input vector is even wider.

llvm-svn: 283953

7 years agoGlobalISel: support same-size casts on AArch64.
Tim Northover [Tue, 11 Oct 2016 22:29:23 +0000 (22:29 +0000)]
GlobalISel: support same-size casts on AArch64.

Mostly Ahmed's work again, I'm just sprucing things up slightly before
committing.

llvm-svn: 283952

7 years agoFix LWG2683 - filesystem::copy() should always clear the user-provided error_code
Eric Fiselier [Tue, 11 Oct 2016 22:18:09 +0000 (22:18 +0000)]
Fix LWG2683 - filesystem::copy() should always clear the user-provided error_code

llvm-svn: 283951

7 years agoRevert - When optimizing for size, enable loop rerolling by default
Mike Edwards [Tue, 11 Oct 2016 22:09:13 +0000 (22:09 +0000)]
Revert - When optimizing for size, enable loop rerolling by default

This reverts r283685 as it is causing test failures on Green Dragon.

llvm-svn: 283950

7 years ago[Profile] Update testcase for r283948 (NFC)
Vedant Kumar [Tue, 11 Oct 2016 21:56:05 +0000 (21:56 +0000)]
[Profile] Update testcase for r283948 (NFC)

Old: "__DATA,__llvm_prf_data"
New: "__DATA,__llvm_prf_data,regular,live_support"

This should fix the following bot failure:

  http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55158

llvm-svn: 283949

7 years ago[profile] Add test for dead_strip+live_support functionality
Vedant Kumar [Tue, 11 Oct 2016 21:48:48 +0000 (21:48 +0000)]
[profile] Add test for dead_strip+live_support functionality

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

llvm-svn: 283948

7 years ago[InstrProf] Add support for dead_strip+live_support functionality
Vedant Kumar [Tue, 11 Oct 2016 21:48:16 +0000 (21:48 +0000)]
[InstrProf] Add support for dead_strip+live_support functionality

On Darwin, marking a section as "regular,live_support" means that a
symbol in the section should only be kept live if it has a reference to
something that is live. Otherwise, the linker is free to dead-strip it.

Turn this functionality on for the __llvm_prf_data section.

This means that counters and data associated with dead functions will be
removed from dead-stripped binaries. This will result in smaller
profiles and binaries, and should speed up profile collection.

Tested with check-profile, llvm-lit test/tools/llvm-{cov,profdata}, and
check-llvm.

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

llvm-svn: 283947

7 years ago[libFuzzer] refactoring to speed things up, NFC
Kostya Serebryany [Tue, 11 Oct 2016 21:27:37 +0000 (21:27 +0000)]
[libFuzzer] refactoring to speed things up, NFC

llvm-svn: 283946

7 years agoRemove extraneous 'const' in the implementation of is_move_assignable. Howard pleads...
Marshall Clow [Tue, 11 Oct 2016 21:24:06 +0000 (21:24 +0000)]
Remove extraneous 'const' in the implementation of is_move_assignable. Howard pleads temporary insanity about this.  Discussed at stackoverflow.com/questions/39986185

llvm-svn: 283945

7 years agoFix std::pair on FreeBSD
Eric Fiselier [Tue, 11 Oct 2016 21:22:21 +0000 (21:22 +0000)]
Fix std::pair on FreeBSD

Summary:
FreeBSD ships an old ABI for std::pair which requires that it have non-trivial copy/move constructors. Currently the non-trivial copy/move is achieved by providing explicit definitions of the constructors. This is problematic because it means the constructors don't SFINAE properly. In order to SFINAE copy/move constructors they have to be explicitly defaulted and hense non-trivial.

This patch attempts to provide SFINAE'ing copy/move constructors for std::pair while still making them non-trivial. It does this by adding a base class with a non-trivial copy constructor and then allowing pair's constructors to be generated by the compiler. This also allows the constructors to be constexpr.

Reviewers: emaste, theraven, rsmith, dim

Subscribers: cfe-commits

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

llvm-svn: 283944

7 years agoModule: for ObjectiveC, be consistent when checking hidden decls.
Manman Ren [Tue, 11 Oct 2016 21:18:20 +0000 (21:18 +0000)]
Module: for ObjectiveC, be consistent when checking hidden decls.

In MatchAllMethodDeclarations, when checking a hidden decl, be sure
to allow hidden when searching for methods.

rdar://28699972

llvm-svn: 283943

7 years agoRe-land "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"
Reid Kleckner [Tue, 11 Oct 2016 21:14:03 +0000 (21:14 +0000)]
Re-land "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"

Reverts r283938 to reinstate r283867 with a fix.

The original change had an ArrayRef referring to a destroyed temporary
initializer list. Use plain C arrays instead.

llvm-svn: 283942

7 years agoFix incorrect exception handling behavior in the uninitialized algorithms
Eric Fiselier [Tue, 11 Oct 2016 21:13:44 +0000 (21:13 +0000)]
Fix incorrect exception handling behavior in the uninitialized algorithms

llvm-svn: 283941

7 years agoAdd the radar number on our end.
Jim Ingham [Tue, 11 Oct 2016 21:08:27 +0000 (21:08 +0000)]
Add the radar number on our end.

llvm-svn: 283940

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Tue, 11 Oct 2016 21:04:39 +0000 (21:04 +0000)]
Next set of additional error checks for invalid Mach-O files for the
load commands that uses the MachO::linker_option_command
type but not used in llvm libObject code but used in llvm tool code.

This includes just LC_LINKER_OPTION load command.

llvm-svn: 283939

7 years agoRevert "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"
Reid Kleckner [Tue, 11 Oct 2016 20:54:41 +0000 (20:54 +0000)]
Revert "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"

This reverts r283867.

This appears to be an infinite loop:

    while (HiRegToSave != AllHighRegs.end() && CopyReg != AllCopyRegs.end()) {
      if (HiRegsToSave.count(*HiRegToSave)) {
        ...

        CopyReg = findNextOrderedReg(++CopyReg, CopyRegs, AllCopyRegs.end());
        HiRegToSave =
            findNextOrderedReg(++HiRegToSave, HiRegsToSave, AllHighRegs.end());
      }
    }

llvm-svn: 283938

7 years agoGlobalISel: support selection of extend operations.
Tim Northover [Tue, 11 Oct 2016 20:50:21 +0000 (20:50 +0000)]
GlobalISel: support selection of extend operations.

Patch mostly by Ahmed Bougaca.

llvm-svn: 283937

7 years agoMIRParser: allow types on registers with a RegBank.
Tim Northover [Tue, 11 Oct 2016 20:50:04 +0000 (20:50 +0000)]
MIRParser: allow types on registers with a RegBank.

This fixes some GlobalISel regression tests.

llvm-svn: 283936

7 years agoRe-apply "Disallow ArrayRef assignment from temporaries."
Jordan Rose [Tue, 11 Oct 2016 20:39:16 +0000 (20:39 +0000)]
Re-apply "Disallow ArrayRef assignment from temporaries."

This re-applies r283798, disabled in r283803, with the static_assert
tests disabled under MSVC. The deleted functions still seem to catch
mistakes in MSVC, so it's not a significant loss.

Part of rdar://problem/16375365

llvm-svn: 283935

7 years agoCodegen: Tail-duplicate during placement.
Kyle Butt [Tue, 11 Oct 2016 20:36:43 +0000 (20:36 +0000)]
Codegen: Tail-duplicate during placement.

The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.

In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.

This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.

Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.

Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.

Issue with early tail-duplication of blocks that branch to a fallthrough
predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll

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

llvm-svn: 283934

7 years agoSwift Calling Convention: Parameters are allowed after the
Arnold Schwaighofer [Tue, 11 Oct 2016 20:34:06 +0000 (20:34 +0000)]
Swift Calling Convention: Parameters are allowed after the
swift_error/swift_context parameter

We need to be able to decelare witness functions which append the self type and
the self witness tables at the end of the parameter list.

rdar://28720996

llvm-svn: 283933

7 years agoPass the end of a component to SwiftAggLowering's enumerateComponents callback
Arnold Schwaighofer [Tue, 11 Oct 2016 20:34:03 +0000 (20:34 +0000)]
Pass the end of a component to SwiftAggLowering's enumerateComponents callback

This is usefull for determining whether components overlap.

llvm-svn: 283932

7 years agoFix a test to pacify llvm-clang-lld-x86_64-scei-ps4-windows10pro bot.
Rui Ueyama [Tue, 11 Oct 2016 20:15:36 +0000 (20:15 +0000)]
Fix a test to pacify llvm-clang-lld-x86_64-scei-ps4-windows10pro bot.

I don't really understand why we get a larger .rodata section only
on this bot. I guess it may be picking up a library which contains
a .rodata. I removed the specific values since their values are not
important for this test case.

llvm-svn: 283931

7 years ago[x86] add tests for negate bool
Sanjay Patel [Tue, 11 Oct 2016 20:15:20 +0000 (20:15 +0000)]
[x86] add tests for negate bool

llvm-svn: 283930

7 years agoThis test now passes.
Jim Ingham [Tue, 11 Oct 2016 20:09:40 +0000 (20:09 +0000)]
This test now passes.

llvm-svn: 283929

7 years agoAvoid braced initialization for default member initializers for MSVC 2013
Reid Kleckner [Tue, 11 Oct 2016 20:02:57 +0000 (20:02 +0000)]
Avoid braced initialization for default member initializers for MSVC 2013

llvm-svn: 283928

7 years agoSilence -Wunused-but-set-variable warning
Arnold Schwaighofer [Tue, 11 Oct 2016 19:49:29 +0000 (19:49 +0000)]
Silence -Wunused-but-set-variable warning

llvm-svn: 283927

7 years agoRe-submit r283825: Add section header stream to PDB.
Rui Ueyama [Tue, 11 Oct 2016 19:45:07 +0000 (19:45 +0000)]
Re-submit r283825: Add section header stream to PDB.

It was reverted because the change that depends on was reverted.
Now it was submitted as r283925, so we can submit this as well.

llvm-svn: 283926

7 years agoRe-submit r283823: Define DbiStreamBuilder::addDbgStream to add stream.
Rui Ueyama [Tue, 11 Oct 2016 19:43:12 +0000 (19:43 +0000)]
Re-submit r283823: Define DbiStreamBuilder::addDbgStream to add stream.

The previous commit was failing because we filled empty slots of
the debug stream index with kInvalidStreamIndex. It should've been 0.

llvm-svn: 283925

7 years ago[sanitizer-coverage] use private linkage for coverage guards, delete old commented...
Kostya Serebryany [Tue, 11 Oct 2016 19:36:50 +0000 (19:36 +0000)]
[sanitizer-coverage] use private linkage for coverage guards, delete old commented-out code.

llvm-svn: 283924

7 years agoAdded a bugreport tracking the failure to get float return values
Jim Ingham [Tue, 11 Oct 2016 19:29:25 +0000 (19:29 +0000)]
Added a bugreport tracking the failure to get float return values
on i386.

llvm-svn: 283923

7 years agoFix build error on LP64 platforms.
Rui Ueyama [Tue, 11 Oct 2016 19:28:56 +0000 (19:28 +0000)]
Fix build error on LP64 platforms.

llvm-svn: 283922

7 years ago[raw_ostream] Raise some helper functions out of raw_ostream.
Zachary Turner [Tue, 11 Oct 2016 19:24:45 +0000 (19:24 +0000)]
[raw_ostream] Raise some helper functions out of raw_ostream.

Low level functionality to format numbers were embedded in the
implementation of raw_ostream.  I have need to use these through
an interface other than the overloaded stream operators, so they
need to be raised to a level that they can be used from either
raw_ostream operators or other code.

llvm-svn: 283921

7 years agoRevert "Change Builtins name to be stored as StringRef instead of raw pointers (NFC)"
Mehdi Amini [Tue, 11 Oct 2016 19:04:24 +0000 (19:04 +0000)]
Revert "Change Builtins name to be stored as StringRef instead of raw pointers (NFC)"

This reverts commit r283802. It introduces temporarily static
initializers, because StringRef ctor isn't (yet) constexpr for
string literals.
I plan to get there this week, but apparently GCC is so terrible
with these static initializer right now (10 min+ extra codegen
time was reported) that I'll hold on to this patch till the
constexpr one is ready, and land these at the same time.

llvm-svn: 283920

7 years ago[AMDGPU] Refactor waitcnt encoding
Konstantin Zhuravlyov [Tue, 11 Oct 2016 18:58:22 +0000 (18:58 +0000)]
[AMDGPU] Refactor waitcnt encoding

- Refactor bit packing/unpacking
- Calculate bit mask given bit shift and bit width
- Introduce function for decoding bits of waitcnt
- Introduce function for encoding bits of waitcnt
- Introduce function for getting waitcnt mask (instead of using bare numbers)
- Introduce function fot getting max waitcnt(s) (instead of using bare numbers)

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

llvm-svn: 283919

7 years agoAllow Switch instruction to have extractProfTotalWeight called as it can terminate...
Dehao Chen [Tue, 11 Oct 2016 18:53:00 +0000 (18:53 +0000)]
Allow Switch instruction to have extractProfTotalWeight called as it can terminate a basic block. (NFC)

llvm-svn: 283918

7 years ago[Driver] Use -fsyntax-only in test/Driver/show-option-names.c
Bruno Cardoso Lopes [Tue, 11 Oct 2016 18:38:33 +0000 (18:38 +0000)]
[Driver] Use -fsyntax-only in test/Driver/show-option-names.c

Make the test less expensive, follow up from r283915.

llvm-svn: 283917

7 years agoAvoid unnecessary constexpr to appease MSVC 2013
Reid Kleckner [Tue, 11 Oct 2016 18:35:13 +0000 (18:35 +0000)]
Avoid unnecessary constexpr to appease MSVC 2013

llvm-svn: 283916

7 years ago[Driver] Fix test from r283913 to unbreak bots
Bruno Cardoso Lopes [Tue, 11 Oct 2016 18:31:45 +0000 (18:31 +0000)]
[Driver] Fix test from r283913 to unbreak bots

Followup from r283913 & r283827

http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55135

llvm-svn: 283915

7 years agoFix "static initialization order fiasco" for the XCore Target.
Mehdi Amini [Tue, 11 Oct 2016 18:22:41 +0000 (18:22 +0000)]
Fix "static initialization order fiasco" for the XCore Target.

I fixed all the other Targets in r283702, and interestingly the
sanitizers are only now "sometimes" catching this bug on the only
one I missed.

llvm-svn: 283914

7 years agoReapply [Driver][Diagnostics] Make 'show option names' default for driver warnings
Bruno Cardoso Lopes [Tue, 11 Oct 2016 18:21:26 +0000 (18:21 +0000)]
Reapply [Driver][Diagnostics] Make 'show option names' default for driver warnings

Reapply r283827 by fixing the tests to not be target specific

Currently, driver level warnings do not show option names (e.g. warning:
complain about foo [-Woption-name]) in a diagnostic unless
-fdiagnostics-show-option is explictly specified. OTOH, the driver by
default turn this option on for CC1. Change the logic to show option
names by default in the driver as well.

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

rdar://problem/27300909

llvm-svn: 283913

7 years ago[Support] Fix undefined behavior in RandomNumberGenerator.
Zachary Turner [Tue, 11 Oct 2016 18:17:26 +0000 (18:17 +0000)]
[Support] Fix undefined behavior in RandomNumberGenerator.

This has existed pretty much forever AFAICT, but the code was
never being exercised because nobody was using the class.  A
user of this class surfaced, and now we're breaking with UB.
The code was obviously wrong, so it's fixed here.

llvm-svn: 283912

7 years ago[AMDGPU] Fix test that was broken by rL283893
Konstantin Zhuravlyov [Tue, 11 Oct 2016 18:16:56 +0000 (18:16 +0000)]
[AMDGPU] Fix test that was broken by rL283893

llvm-svn: 283911

7 years agoMake variable name consistent with other -z options.
Rui Ueyama [Tue, 11 Oct 2016 17:46:48 +0000 (17:46 +0000)]
Make variable name consistent with other -z options.

llvm-svn: 283910

7 years agoARMMachineFunctionInfo.cpp: Add an initializer of ARMFunctionInfo::ReturnRegsCount...
NAKAMURA Takumi [Tue, 11 Oct 2016 17:38:30 +0000 (17:38 +0000)]
ARMMachineFunctionInfo.cpp: Add an initializer of ARMFunctionInfo::ReturnRegsCount in the explicit ctor.

It caused crash since r283867.

llvm-svn: 283909

7 years agoReformat.
NAKAMURA Takumi [Tue, 11 Oct 2016 17:38:25 +0000 (17:38 +0000)]
Reformat.

llvm-svn: 283908

7 years ago[CUDA] Re-land support for <complex> (r283683 and r283680).
Justin Lebar [Tue, 11 Oct 2016 17:36:03 +0000 (17:36 +0000)]
[CUDA] Re-land support for <complex> (r283683 and r283680).

These were reverted in r283753 and r283747.

The first patch added a header to the root 'Headers' install directory,
instead of into 'Headers/cuda_wrappers'.  This was fixed in the second
patch, but by then the damage was done: The bad header stayed in the
'Headers' directory, continuing to break the build.

We reverted both patches in an attempt to fix things, but that still
didn't get rid of the header, so the Windows boostrap build remained
broken.

It's probably worth fixing up our cmake logic to remove things from the
install dirs, but in the meantime, re-land these patches, since we
believe they no longer have this bug.

llvm-svn: 283907

7 years agoFix the build with MSVC 2013 after r283856
Reid Kleckner [Tue, 11 Oct 2016 17:24:09 +0000 (17:24 +0000)]
Fix the build with MSVC 2013 after r283856

llvm-svn: 283906

7 years ago[DAG] add fold for masked negated sign-extended bool
Sanjay Patel [Tue, 11 Oct 2016 17:05:52 +0000 (17:05 +0000)]
[DAG] add fold for masked negated sign-extended bool

This enhances the fold added with:
https://reviews.llvm.org/rL283900

llvm-svn: 283905

7 years agoClarified the explanation of expr --top-level.
Sean Callanan [Tue, 11 Oct 2016 16:57:21 +0000 (16:57 +0000)]
Clarified the explanation of expr --top-level.

llvm-svn: 283904

7 years ago[x86] add sext variants of tests added with r283894
Sanjay Patel [Tue, 11 Oct 2016 16:49:52 +0000 (16:49 +0000)]
[x86] add sext variants of tests added with r283894

llvm-svn: 283903

7 years agoLet test pass for builds that support X86, but do not default to it
Bernard Ogden [Tue, 11 Oct 2016 16:34:49 +0000 (16:34 +0000)]
Let test pass for builds that support X86, but do not default to it

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

llvm-svn: 283902

7 years agoFix test on non-x86 hosts
Bernard Ogden [Tue, 11 Oct 2016 16:32:37 +0000 (16:32 +0000)]
Fix test on non-x86 hosts

Summary:
This test is allowed to run on non-x86 hosts and thus must use
llvm-nm rather than nm.

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

llvm-svn: 283901

7 years ago[DAG] add fold for masked negated extended bool
Sanjay Patel [Tue, 11 Oct 2016 16:26:36 +0000 (16:26 +0000)]
[DAG] add fold for masked negated extended bool

The non-obvious motivation for adding this fold (which already happens in InstCombine)
is that we want to canonicalize IR towards select instructions and canonicalize DAG
nodes towards boolean math. So we need to recreate some folds in the DAG to handle that
change in direction.

An interesting implementation difference for cases like this is that InstCombine
generally works top-down while the DAG goes bottom-up. That means we need to detect
different patterns. In this case, the SimplifyDemandedBits fold prevents us from
performing a zext to sext fold that would then be recognized as a negation of a sext.

llvm-svn: 283900

7 years agoSilence unused warning in non-assert builds.
Daniel Jasper [Tue, 11 Oct 2016 16:22:36 +0000 (16:22 +0000)]
Silence unused warning in non-assert builds.

llvm-svn: 283899

7 years ago[opt-viewer] Remove unnecessary call to demangle
Adam Nemet [Tue, 11 Oct 2016 16:20:40 +0000 (16:20 +0000)]
[opt-viewer] Remove unnecessary call to demangle

llvm-svn: 283898

7 years ago[opt-viewer] Print hotness as percentage of the maximum hotness
Adam Nemet [Tue, 11 Oct 2016 16:20:38 +0000 (16:20 +0000)]
[opt-viewer] Print hotness as percentage of the maximum hotness

llvm-svn: 283897

7 years ago[opt-viewer] Convert another HTML output to use a multiline string
Adam Nemet [Tue, 11 Oct 2016 16:19:06 +0000 (16:19 +0000)]
[opt-viewer] Convert another HTML output to use a multiline string

llvm-svn: 283896

7 years agoFix clang-offload-bundler test.
Zachary Turner [Tue, 11 Oct 2016 16:06:32 +0000 (16:06 +0000)]
Fix clang-offload-bundler test.

A recent change to llvm::cl slightly changed the format of
the help output, and it broke this test.  NFC

llvm-svn: 283895

7 years ago[x86] add tests to show missed folds for masked bools
Sanjay Patel [Tue, 11 Oct 2016 16:04:37 +0000 (16:04 +0000)]
[x86] add tests to show missed folds for masked bools

llvm-svn: 283894

7 years agoAMDGPU/SI: Update ISA version numbers for Tonga and Polaris10/11.
Changpeng Fang [Tue, 11 Oct 2016 16:00:47 +0000 (16:00 +0000)]
AMDGPU/SI: Update ISA version numbers for Tonga and Polaris10/11.

Differential Revision:
  http://reviews.llvm.org/D25454

Reviewers:
  tstellarAMD

llvm-svn: 283893

7 years ago[cl] Don't print subcommand help when no subcommands present.
Zachary Turner [Tue, 11 Oct 2016 15:58:48 +0000 (15:58 +0000)]
[cl] Don't print subcommand help when no subcommands present.

Previously we would print

  USAGE: <exe> [subcommand] [options]

Even if no subcommands were present.  This changes the output
format to only print "[subcommand]" if there is at least one
subcommand.

Fixes llvm.org/pr30598

Patch by Serge Guelton

llvm-svn: 283892

7 years ago[OpenCL] Allow partial initializer for array and struct
Yaxun Liu [Tue, 11 Oct 2016 15:53:28 +0000 (15:53 +0000)]
[OpenCL] Allow partial initializer for array and struct

Currently Clang allows partial initializer for C99 but not for OpenCL, e.g.

float a[16][16] = {1.0f, 2.0f};

is allowed in C99 but not allowed in OpenCL.

This patch fixes that.

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

llvm-svn: 283891

7 years agoRevert r283887 and r283882, until the issue is understood and fixed.
Vassil Vassilev [Tue, 11 Oct 2016 15:51:06 +0000 (15:51 +0000)]
Revert r283887 and r283882, until the issue is understood and fixed.

llvm-svn: 283890

7 years ago[ThinLTO/tests] Check we don't fail if --thinlto-jobs is not passed.
Davide Italiano [Tue, 11 Oct 2016 15:32:34 +0000 (15:32 +0000)]
[ThinLTO/tests] Check we don't fail if --thinlto-jobs is not passed.

While here, fix the CHECK lines of an existing test.

llvm-svn: 283889

7 years agoUse StringRef instead of raw pointer in SourceManagerInternals LineTableInfo API...
Mehdi Amini [Tue, 11 Oct 2016 15:15:32 +0000 (15:15 +0000)]
Use StringRef instead of raw pointer in SourceManagerInternals LineTableInfo API (NFC)

llvm-svn: 283888

7 years agor283882 followup. Don't demote ParmVarDecls. This should fix our module builds.
Vassil Vassilev [Tue, 11 Oct 2016 15:09:26 +0000 (15:09 +0000)]
r283882 followup. Don't demote ParmVarDecls. This should fix our module builds.

llvm-svn: 283887

7 years ago[clang-tidy] Ignore empty members and bases in cppcoreguidelines-pro-type-member...
Malcolm Parsons [Tue, 11 Oct 2016 14:49:24 +0000 (14:49 +0000)]
[clang-tidy] Ignore empty members and bases in cppcoreguidelines-pro-type-member-init

Summary: Empty/incomplete variables/members/bases don't need to be initialized

Reviewers: mgehre, aaron.ballman, alexfh

Subscribers: nemanjai, cfe-commits

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

llvm-svn: 283886

7 years ago[DAG] simplify logic; NFC
Sanjay Patel [Tue, 11 Oct 2016 14:14:30 +0000 (14:14 +0000)]
[DAG] simplify logic; NFC

llvm-svn: 283885

7 years ago[DAG] hoist DL(N) and fix formatting; NFC
Sanjay Patel [Tue, 11 Oct 2016 14:04:24 +0000 (14:04 +0000)]
[DAG] hoist DL(N) and fix formatting; NFC

llvm-svn: 283884

7 years ago[X86][SSE] Regenerate scalar i64 uitofp test
Simon Pilgrim [Tue, 11 Oct 2016 14:01:38 +0000 (14:01 +0000)]
[X86][SSE] Regenerate scalar i64 uitofp test

Added 32-bit target test

llvm-svn: 283883

7 years ago[modules] PR28752: Do not instantiate variable declarations which are not visible.
Vassil Vassilev [Tue, 11 Oct 2016 13:57:36 +0000 (13:57 +0000)]
[modules] PR28752: Do not instantiate variable declarations which are not visible.

https://reviews.llvm.org/D24508

Patch developed in collaboration with Richard Smith!

llvm-svn: 283882

7 years ago[X86][SSE] Regenerate vector load-trunc test
Simon Pilgrim [Tue, 11 Oct 2016 13:55:49 +0000 (13:55 +0000)]
[X86][SSE] Regenerate vector load-trunc test

llvm-svn: 283881

7 years ago[X86][SSE] Regenerate vsplit and tests
Simon Pilgrim [Tue, 11 Oct 2016 13:51:44 +0000 (13:51 +0000)]
[X86][SSE] Regenerate vsplit and tests

To make it more obvious how bad some of that truncation code is....

llvm-svn: 283880

7 years ago[clang-tidy] Fix template agrument false positives in unused-using-decls.
Haojian Wu [Tue, 11 Oct 2016 13:50:34 +0000 (13:50 +0000)]
[clang-tidy] Fix template agrument false positives in unused-using-decls.

Summary:
* Fix a false postive when an using class is used in an explicit template instantiation.
* Fix a false postive when an using template class is used as template argument.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 283879

7 years ago[DAG] fix formatting; NFC
Sanjay Patel [Tue, 11 Oct 2016 13:47:43 +0000 (13:47 +0000)]
[DAG] fix formatting; NFC

llvm-svn: 283878

7 years ago[LCSSA] Implement linear algorithm for the isRecursivelyLCSSAForm
Igor Laevsky [Tue, 11 Oct 2016 13:37:22 +0000 (13:37 +0000)]
[LCSSA] Implement linear algorithm for the isRecursivelyLCSSAForm

For each block check that it doesn't have any uses outside of it's innermost loop.

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

llvm-svn: 283877

7 years ago[x86] update test to use FileCheck and auto-generate checks
Sanjay Patel [Tue, 11 Oct 2016 13:36:07 +0000 (13:36 +0000)]
[x86] update test to use FileCheck and auto-generate checks

llvm-svn: 283876

7 years ago[clang-tidy] readability-avoid-const-params-in-decls template instantiation bugfix
Malcolm Parsons [Tue, 11 Oct 2016 12:02:16 +0000 (12:02 +0000)]
[clang-tidy] readability-avoid-const-params-in-decls template instantiation bugfix

Summary: Bugfix for 30398.  Don't warn for template instantiations

Reviewers: aaron.ballman, hokein, alexfh

Subscribers: omtcyfz, cfe-commits

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

llvm-svn: 283873

7 years ago[Support/ELF] - Add OpenBSD PT_OPENBSD_RANDOMIZE, PT_OPENBSD_WXNEEDED constants.
George Rimar [Tue, 11 Oct 2016 11:53:33 +0000 (11:53 +0000)]
[Support/ELF] - Add OpenBSD PT_OPENBSD_RANDOMIZE, PT_OPENBSD_WXNEEDED constants.

Docs for reference:
http://man.openbsd.org/OpenBSD-current/man5/elf.5
https://github.com/openbsd/src/commit/2a5a8fc7e30928c2cff57cfe5fb491c90d8478ad

llvm-svn: 283872

7 years agoFix Arm64InstEmulation tests for windows
Pavel Labath [Tue, 11 Oct 2016 11:05:34 +0000 (11:05 +0000)]
Fix Arm64InstEmulation tests for windows

MSVC does not like the declaration of a terminate() function (I guess it looks
too much like std::terminate()). While I'm there, move the setup/teardown code
into the functions gtest provides for that purpose.

llvm-svn: 283870

7 years ago[clang-tidy] modernize-use-default default constructor bugfix
Malcolm Parsons [Tue, 11 Oct 2016 10:47:06 +0000 (10:47 +0000)]
[clang-tidy] modernize-use-default default constructor bugfix

Summary:
Only member initializers that are written should prevent
using '= default' on a default constructor.

Reviewers: klimek, sbenza, aaron.ballman, alexfh

Subscribers: Eugene.Zelenko, alexfh, klimek, cfe-commits

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

llvm-svn: 283869

7 years agoRevert "[Driver][Diagnostics] Make 'show option names' default for driver warnings"
Renato Golin [Tue, 11 Oct 2016 10:26:33 +0000 (10:26 +0000)]
Revert "[Driver][Diagnostics] Make 'show option names' default for driver warnings"

This reverts commit r283827, as it's breaking all ARM/AARch64 bots.

llvm-svn: 283868

7 years ago[Thumb] Save/restore high registers in Thumb1 pro/epilogues
Oliver Stannard [Tue, 11 Oct 2016 10:12:25 +0000 (10:12 +0000)]
[Thumb] Save/restore high registers in Thumb1 pro/epilogues

The high registers are not allocatable in Thumb1 functions, but they
could still be used by inline assembly, so we need to save and restore
the callee-saved high registers (r8-r11) in the prologue and epilogue.

This is complicated by the fact that the Thumb1 push and pop
instructions cannot access these registers. Therefore, we have to move
them down into low registers before pushing, and move them back after
popping into low registers.

In most functions, we will have low registers that are also being
pushed/popped, which we can use as the temporary registers for
saving/restoring the high registers. However, this is not guaranteed, so
we may need to push some extra low registers to ensure that the high
registers can be saved/restored. For correctness, it would be sufficient
to use just one low register, but if we have enough low registers
available then we only need one push/pop instruction, rather than one
per high register.

We can also use the argument/return registers when they are not live,
and the link register when saving (but not restoring), reducing the
number of extra registers we need to push.

There are still a few extreme edge cases where we need two push/pop
instructions, because not enough low registers can be made live in the
prologue or epilogue.

In addition to the regression tests included here, I've also tested this
using a script to generate functions which clobber different
combinations of registers, have different numbers of argument and return
registers (including variadic arguments), allocate different fixed sized
objects on the stack, and do or don't use variable sized allocas and the
__builtin_return_address intrinsic (all of which affect the available
registers in the prologue and epilogue). I ran these functions in a test
harness which verifies that all of the callee-saved registers are
correctly preserved.

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

llvm-svn: 283867

7 years ago[ARM] Fix registers clobbered by SjLj EH on soft-float targets
Oliver Stannard [Tue, 11 Oct 2016 10:06:59 +0000 (10:06 +0000)]
[ARM] Fix registers clobbered by SjLj EH on soft-float targets

Currently, the Int_eh_sjlj_dispatchsetup intrinsic is marked as
clobbering all registers, including floating-point registers that may
not be present on the target. This is technically true, as we could get
linked against code that does use the FP registers, but that will not
actually work, as the soft-float code cannot save and restore the FP
registers. SjLj exception handling can only work correctly if either all
or none of the code is built for a target with FP registers. Therefore,
we can assume that, when Int_eh_sjlj_dispatchsetup is compiled for a
soft-float target, it is only going to be linked against other
soft-float code, and so only clobbers the general-purpose registers.
This allows us to check that no non-savable registers are clobbered when
generating the prologue/epilogue.

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

llvm-svn: 283866

7 years agoFix typo in documentation
Malcolm Parsons [Tue, 11 Oct 2016 09:42:13 +0000 (09:42 +0000)]
Fix typo in documentation

llvm-svn: 283865

7 years agoDelete clang-completion-mode.el.
Manuel Klimek [Tue, 11 Oct 2016 09:25:34 +0000 (09:25 +0000)]
Delete clang-completion-mode.el.

It has been unmaintained for a while (last change was more than four
years ago), and it appears not widely used.
By now there are multiple well-maintained alternatives (emacs-ycmd,
atuo-complete-clang), and if users try to make this work they'll likely
have a bad user experience.

Reasoning and problems pointed out by Philipp Stephani.

llvm-svn: 283864

7 years agoclang-include-fixer.el: Don't prompt the user about killing clang-include-fixer processes
Manuel Klimek [Tue, 11 Oct 2016 09:21:20 +0000 (09:21 +0000)]
clang-include-fixer.el: Don't prompt the user about killing clang-include-fixer processes

By default, Emacs prompts the user when killing processes on exit. This is useful for stateful processes such as interactive shells. However, clang-include-fixer processes are stateless; the only effect of killing them is to cancel a clang-include-fixer operation. Therefore prompting the user is just a nuisance.

Patch by Philipp Stephani.

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

llvm-svn: 283863

7 years ago[AArch64] Allow label arithmetic with add/sub/cmp
Diana Picus [Tue, 11 Oct 2016 09:17:47 +0000 (09:17 +0000)]
[AArch64] Allow label arithmetic with add/sub/cmp

Allow instructions such as 'cmp w0, #(end - start)' by folding the
expression into a constant. For ELF, we fold only if the symbols are in
the same section. For MachO, we fold if the expression contains only
symbols that are not linker visible.

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

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

llvm-svn: 283862

7 years agoMake Emacs libraries compatible with Emacs 24.
Manuel Klimek [Tue, 11 Oct 2016 09:15:10 +0000 (09:15 +0000)]
Make Emacs libraries compatible with Emacs 24.

Emacs 24 doesn't have format-message, fall back to format in that case.

Patch by Philipp Stephani.

llvm-svn: 283861

7 years agoFix formatting in findRegisterUseOperandIdx. NFC.
Fraser Cormack [Tue, 11 Oct 2016 09:09:21 +0000 (09:09 +0000)]
Fix formatting in findRegisterUseOperandIdx. NFC.

llvm-svn: 283860

7 years ago[ELF] - Fixed assertion fail when symbol table has invalid sh_info value.
George Rimar [Tue, 11 Oct 2016 09:07:14 +0000 (09:07 +0000)]
[ELF] - Fixed assertion fail when symbol table has invalid sh_info value.

This part was splitted from D25016.

When sh_info value was set in the way that non-local symbol was treated as local, lld
was asserting, patch fixes that.

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

llvm-svn: 283859

7 years agoReverted r283740 [Object/ELF] - Do not crash on invalid Header->e_shoff value.
George Rimar [Tue, 11 Oct 2016 08:12:27 +0000 (08:12 +0000)]
Reverted r283740 [Object/ELF] - Do not crash on invalid Header->e_shoff value.

Bot does not like it: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/17075

/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Object/invalid.test:70:32: error: expected string not found in input
INVALID-SEC-ADDRESS-ALIGNMENT: Invalid address alignment of section headers
                               ^
<stdin>:1:1: note: scanning from here
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<llvm::support::endianness::little, true> >', which requires 2 byte alignment
^
<stdin>:1:125: note: possible intended match here
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<llvm::support::endianness::little, true> >', which requires 2 byte alignment

llvm-svn: 283858

7 years agoRevert "Codegen: Tail-duplicate during placement."
Daniel Jasper [Tue, 11 Oct 2016 07:36:11 +0000 (07:36 +0000)]
Revert "Codegen: Tail-duplicate during placement."

This reverts commit r283842.

test/CodeGen/X86/tail-dup-repeat.ll causes and llc crash with our
internal testing. I'll share a link with you.

llvm-svn: 283857

7 years agoTurn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)
Mehdi Amini [Tue, 11 Oct 2016 07:31:29 +0000 (07:31 +0000)]
Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)

llvm-svn: 283856

7 years agoUse LLVM_CONSTEXPR to appease MSVC2013 (fixup for r283854)
Mehdi Amini [Tue, 11 Oct 2016 07:29:43 +0000 (07:29 +0000)]
Use LLVM_CONSTEXPR to appease MSVC2013 (fixup for r283854)

llvm-svn: 283855

7 years agoMake RandomNumberGenerator compatible with <random>
Mehdi Amini [Tue, 11 Oct 2016 07:13:01 +0000 (07:13 +0000)]
Make RandomNumberGenerator compatible with <random>

LLVM's RandomNumberGenerator wasn't compatible with
the random distribution from <random>.

Fixes PR25105

Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>

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

llvm-svn: 283854

7 years agoExplicitly ignore return code in test for test systems that use pipefail
Daniel Jasper [Tue, 11 Oct 2016 06:13:18 +0000 (06:13 +0000)]
Explicitly ignore return code in test for test systems that use pipefail

llvm-svn: 283853