platform/upstream/llvm.git
7 years agoThird attempt to fix Sphinx bot
Teresa Johnson [Thu, 22 Sep 2016 13:58:33 +0000 (13:58 +0000)]
Third attempt to fix Sphinx bot

Bot now complaining about -flto=thin reference, used similar workaround
for that failure.

llvm-svn: 282154

7 years agoGlobalISel: handle stack-based parameters on AArch64.
Tim Northover [Thu, 22 Sep 2016 13:49:25 +0000 (13:49 +0000)]
GlobalISel: handle stack-based parameters on AArch64.

llvm-svn: 282153

7 years agotsan: support pie binaries on newer kernels
Dmitry Vyukov [Thu, 22 Sep 2016 13:42:02 +0000 (13:42 +0000)]
tsan: support pie binaries on newer kernels

4.1+ Linux kernels map pie binaries at 0x55:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d1fd836dcf00d2028c700c7e44d2c23404062c90
Currently tsan does not support app memory at 0x55 (https://github.com/google/sanitizers/issues/503).
Older kernels also map pie binaries at 0x55 when ASLR is disables (most notably under gdb).

This change extends tsan mapping for linux/x86_64 to cover 0x554-0x568 app range and fixes both 4.1+ kernels and gdb.

This required to slightly shrink low and high app ranges and move heap. The mapping become even more non-linear, since now we xor lower bits. Now even a continuous app range maps to split, intermixed shadow ranges. This breaks ShadowToMemImpl as it assumes linear mapping at least within a continuous app range (however it turned out to be already broken at least on arm64/42-bit vma as uncovered by r281970). So also change ShadowToMemImpl to hopefully a more robust implementation that does not assume a linear mapping.

llvm-svn: 282152

7 years agoSecond attempt to fix Sphinx bot
Teresa Johnson [Thu, 22 Sep 2016 13:41:10 +0000 (13:41 +0000)]
Second attempt to fix Sphinx bot

The fix in r282148 was not enough to fix the following error:
/home/llvmbb/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/CommandGuide/clang.rst:338:
WARNING: unknown option: -flto=full

on the sphinx bot:
  http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/16313

(not reproducible locally).

This time, simply remove the option reference.

llvm-svn: 282151

7 years ago[RS4GC] Remat in presence of phi and use live value
Anna Thomas [Thu, 22 Sep 2016 13:13:06 +0000 (13:13 +0000)]
[RS4GC] Remat in presence of phi and use live value

Summary:

Reviewers:

Subscribers:

llvm-svn: 282150

7 years agoFix VA computation for tbss.
Rafael Espindola [Thu, 22 Sep 2016 12:35:44 +0000 (12:35 +0000)]
Fix VA computation for tbss.

llvm-svn: 282149

7 years agoFixing sphinx build due to diagnostic:
Aaron Ballman [Thu, 22 Sep 2016 12:15:18 +0000 (12:15 +0000)]
Fixing sphinx build due to diagnostic:

/opt/llvm/build.attributes.src/tools/clang/docs/CommandGuide/clang.rst:338: WARNING: unknown option: -flto=full

llvm-svn: 282148

7 years agoHandle multiple .tbss sections.
Rafael Espindola [Thu, 22 Sep 2016 12:00:08 +0000 (12:00 +0000)]
Handle multiple .tbss sections.

llvm-svn: 282147

7 years ago[change-namespace] fix qualifier of function references.
Eric Liu [Thu, 22 Sep 2016 11:54:00 +0000 (11:54 +0000)]
[change-namespace] fix qualifier of function references.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 282146

7 years ago[AMDGPU][mc] Add support for absolute expressions in DPP modifiers.
Artem Tamazov [Thu, 22 Sep 2016 11:47:21 +0000 (11:47 +0000)]
[AMDGPU][mc] Add support for absolute expressions in DPP modifiers.

Also added range checking for DPP attributes.
Assembler tests added as well.

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

llvm-svn: 282145

7 years ago[PowerPC] Remove LE patterns matching generic stores/loads to VSX permuting ops
Nemanja Ivanovic [Thu, 22 Sep 2016 10:32:03 +0000 (10:32 +0000)]
[PowerPC] Remove LE patterns matching generic stores/loads to VSX permuting ops

This patch corresponds to:
https://reviews.llvm.org/D21409

The LXVD2X, LXVW4X, STXVD2X and STXVW4X instructions permute the two doublewords
in the vector register when in little-endian mode. Custom code ensures that the
necessary swaps are inserted for these. This patch simply removes the possibilty
that a load/store node will match one of these instructions in the SDAG as that
would not insert the necessary swaps.

llvm-svn: 282144

7 years ago[Power9] Add exploitation of non-permuting memory ops
Nemanja Ivanovic [Thu, 22 Sep 2016 09:52:19 +0000 (09:52 +0000)]
[Power9] Add exploitation of non-permuting memory ops

This patch corresponds to review:
https://reviews.llvm.org/D19825

The new lxvx/stxvx instructions do not require the swaps to line the elements
up correctly. In order to select them over the lxvd2x/lxvw4x instructions which
require swaps, the patterns for the old instruction have a predicate that
ensures they won't be selected on Power9 and newer CPUs.

llvm-svn: 282143

7 years ago[ESan][MIPS] Fix tests struct-simple.cpp on MIPS
Sagar Thakur [Thu, 22 Sep 2016 08:36:54 +0000 (08:36 +0000)]
[ESan][MIPS] Fix tests struct-simple.cpp on MIPS

For mips assember '#' is the start of comment. We get assembler error messages if # is used in the struct names. Therefore using '$' which works for all architectures.

Differential: D24335
Reviewed by: zhaoqin

llvm-svn: 282142

7 years ago[EfficiencySanitizer] Using '$' instead of '#' for struct counter name
Sagar Thakur [Thu, 22 Sep 2016 08:33:06 +0000 (08:33 +0000)]
[EfficiencySanitizer] Using '$' instead of '#' for struct counter name

For MIPS '#' is the start of comment line. Therefore we get assembler errors if # is used in the structure names.

Differential: D24334
Reviewed by: zhaoqin

llvm-svn: 282141

7 years agoFix revision 281960
Dorit Nuzman [Thu, 22 Sep 2016 07:56:23 +0000 (07:56 +0000)]
Fix revision 281960

llvm-svn: 282139

7 years agoclang-format: [JS] reserved words in method names.
Martin Probst [Thu, 22 Sep 2016 07:18:00 +0000 (07:18 +0000)]
clang-format: [JS] reserved words in method names.

Summary:
Before:
    class X {
      delete () {
        ...
      }
    }

After:
    class X {
      delete() {
        ...
      }
    }

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 282138

7 years ago[X86] Fix some illegal rounding modes in some builtin test cases to ones that would...
Craig Topper [Thu, 22 Sep 2016 06:13:33 +0000 (06:13 +0000)]
[X86] Fix some illegal rounding modes in some builtin test cases to ones that would properly compile to valid assembly.

llvm-svn: 282137

7 years agoclang-format: Add an option to git-clang-format to diff between to commits
Stephen Hines [Thu, 22 Sep 2016 05:52:55 +0000 (05:52 +0000)]
clang-format: Add an option to git-clang-format to diff between to commits

Summary:
When building pre-upload hooks using git-clang-format, it is useful to limit the scope to a diff of two commits (instead of from a commit against the working tree) to allow for less false positives in dependent commits.

This change adds the option of specifying two git commits to git-clang-format when using the `--diff` flag, which uses a different strategy to diff (using `git-diff-tree` instead of `git-diff-index`), and runs clang-format against the second commit instead of the working directory.

There is a slight backwards-incompatibility introduced with this change: if a filename matches a branch name or other commit-ish, then `git clang-format <commit> <file>` will no longer work as expected; use `git clang-format <commit> -- <file>` instead.

Patch by Luis Hector Chavez!

Reviewers: djasper, lodato

Subscribers: lodato, cfe-commits, srhines

Projects: #clang-c

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

llvm-svn: 282136

7 years agoFix parsing expressions to evaluate with spaces and optional args (MI)
Ilia K [Thu, 22 Sep 2016 05:08:41 +0000 (05:08 +0000)]
Fix parsing expressions to evaluate with spaces and optional args (MI)

Summary:
When extracting options for long options (starting with `--`), the use of
`MIUtilString::SplitConsiderQuotes` to split all the arguments was being
conditioned on the option type to be expected. This was wrong as this caused
other options to be parsed incorrectly since it was not taking into account the
presence of quotes.

Patch by Ed Munoz <edmunoz@microsoft.com>

Reviewers: edmunoz, ki.stfu

Subscribers: ki.stfu, lldb-commits

Projects: #lldb

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

llvm-svn: 282135

7 years agoFix failure on 03 bot
Marshall Clow [Thu, 22 Sep 2016 03:25:22 +0000 (03:25 +0000)]
Fix failure on 03 bot

llvm-svn: 282134

7 years ago[AVX-512] Add support for commuting VPTERNLOG instructions.
Craig Topper [Thu, 22 Sep 2016 03:00:50 +0000 (03:00 +0000)]
[AVX-512] Add support for commuting VPTERNLOG instructions.

VPTERNLOG is a ternary instruction with an immediate specifying the logical operation to perform. For each bit position in the 3 source vectors the bit from each source is concatenated together and the resulting 3-bit value is used to select a bit in the immediate. This bit value is written to the result vector.

We can commute this by swapping operands and modifying the immediate. To modify the immediate we need to swap two pairs of bits. The pairs correspond to the locations in the immediate where the commuted operands bits have opposite values and the uncommuted operand has the same value. Bits 0 and 7 will never be swapped since the relevant bits from all sources are the same value.

This refactors and reuses parts of the FMA3 commuting code which is also a three operand instruction.

llvm-svn: 282132

7 years ago[RegisterBankInfo] Move to statically allocated RegisterBank.
Quentin Colombet [Thu, 22 Sep 2016 02:10:37 +0000 (02:10 +0000)]
[RegisterBankInfo] Move to statically allocated RegisterBank.

This commit is basically the first step toward what will
RegisterBankInfo look when it gets TableGen'ed.

It introduces a XXXGenRegisterBankInfo.def file that is what TableGen
will issue at some point. Moreover, the RegBanks field in
RegisterBankInfo changed to reflect the static (compile time) aspect of
the information.

llvm-svn: 282131

7 years ago[RegisterBankInfo] Take advantage of the extra argument of SmallVector::resize.
Quentin Colombet [Thu, 22 Sep 2016 02:10:32 +0000 (02:10 +0000)]
[RegisterBankInfo] Take advantage of the extra argument of SmallVector::resize.

When initializing an instance of OperandsMapper, instead of using
SmallVector::resize followed by std::fill, use the function that
directly does that in SmallVector.

llvm-svn: 282130

7 years ago[libFuzzer] add 'features' to the corpus elements, allow mutations with Size > MaxSiz...
Kostya Serebryany [Thu, 22 Sep 2016 01:34:58 +0000 (01:34 +0000)]
[libFuzzer] add 'features' to the corpus elements, allow mutations with Size > MaxSize, fix sha1 in corpus stats; various refactorings

llvm-svn: 282129

7 years agofix Args function broken in r281942
Todd Fiala [Thu, 22 Sep 2016 00:59:23 +0000 (00:59 +0000)]
fix Args function broken in r281942

The method was hard-coded to check only the 0th element of the array.
This manifested as NSLog messages behaving incorrectly on macOS.
(This is independent of the broken DarwinLog feature).

llvm-svn: 282128

7 years ago[libFuzzer] one more test
Kostya Serebryany [Thu, 22 Sep 2016 00:57:29 +0000 (00:57 +0000)]
[libFuzzer] one more test

llvm-svn: 282127

7 years agoAdd missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v
Marshall Clow [Thu, 22 Sep 2016 00:23:15 +0000 (00:23 +0000)]
Add missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v

llvm-svn: 282126

7 years ago[CMake] More robust handling for bootstrap variables
Chris Bieneman [Thu, 22 Sep 2016 00:18:12 +0000 (00:18 +0000)]
[CMake] More robust handling for bootstrap variables

Checking defined isn't good enough we also need to handle defined to empty string.

llvm-svn: 282125

7 years ago[Sema] Fix PR30481: crash on checking printf args.
George Burgess IV [Thu, 22 Sep 2016 00:00:26 +0000 (00:00 +0000)]
[Sema] Fix PR30481: crash on checking printf args.

We were falling through from one case to another in a switch statement.
Oops.

llvm-svn: 282124

7 years agoFix typo in lldb --help
Ed Maste [Wed, 21 Sep 2016 23:30:36 +0000 (23:30 +0000)]
Fix typo in lldb --help

Patch by Yacine Belkadi

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

llvm-svn: 282123

7 years ago[CMake] Check if passthrough variables are defined
Chris Bieneman [Wed, 21 Sep 2016 23:24:15 +0000 (23:24 +0000)]
[CMake] Check if passthrough variables are defined

Checking if they evaluate to true cases prevents passing values that evaluate to false cases. Instead we should check if the variables are defined.

llvm-svn: 282122

7 years ago[libFuzzer] add stats to the corpus; more refactoring
Kostya Serebryany [Wed, 21 Sep 2016 22:42:17 +0000 (22:42 +0000)]
[libFuzzer] add stats to the corpus; more refactoring

llvm-svn: 282121

7 years agoFix for loop sign fix in r282112 for column = 0
Ed Maste [Wed, 21 Sep 2016 22:36:51 +0000 (22:36 +0000)]
Fix for loop sign fix in r282112 for column = 0

llvm-svn: 282119

7 years agoOnce more unto the strict weak ordering, once more.
Rafael Espindola [Wed, 21 Sep 2016 22:36:19 +0000 (22:36 +0000)]
Once more unto the strict weak ordering, once more.

This should finally give a stable sorting over all implementations.

llvm-svn: 282118

7 years agoFix an incorrect nullptr conversion.
Zachary Turner [Wed, 21 Sep 2016 22:33:30 +0000 (22:33 +0000)]
Fix an incorrect nullptr conversion.

llvm-svn: 282117

7 years ago=delete the StringRef(nullptr_t) constructor.
Zachary Turner [Wed, 21 Sep 2016 22:29:36 +0000 (22:29 +0000)]
=delete the StringRef(nullptr_t) constructor.

It's a guaranteed crash if you construct a StringRef with
nullptr, so might as well delete the constructor that allows
it.

llvm-svn: 282116

7 years ago[libFuzzer] more refactoring; don't compute sha1sum every time we mutate a unit from...
Kostya Serebryany [Wed, 21 Sep 2016 21:41:48 +0000 (21:41 +0000)]
[libFuzzer] more refactoring; don't compute sha1sum every time we mutate a unit from the corpus, use the stored one.

llvm-svn: 282115

7 years ago[libFuzzer] more refactoring
Kostya Serebryany [Wed, 21 Sep 2016 21:17:23 +0000 (21:17 +0000)]
[libFuzzer] more refactoring

llvm-svn: 282113

7 years agoFix integer sign warning from r282105
Ed Maste [Wed, 21 Sep 2016 21:14:31 +0000 (21:14 +0000)]
Fix integer sign warning from r282105

llvm-svn: 282112

7 years agoFix -Wcovered-switch-default warning in StackFrame.cpp
Ed Maste [Wed, 21 Sep 2016 21:08:30 +0000 (21:08 +0000)]
Fix -Wcovered-switch-default warning in StackFrame.cpp

The switch coveres all possible values. If a new one is added in the
future the compiler will start warning, providing a notification that
the switch needs updating.

llvm-svn: 282111

7 years ago[CMake] Initial support for LLDB.framework
Chris Bieneman [Wed, 21 Sep 2016 21:02:16 +0000 (21:02 +0000)]
[CMake] Initial support for LLDB.framework

Summary:
This patch adds a CMake option LLDB_BUILD_FRAMEWORK, which builds libLLDB as a macOS framework instead of as a *nix shared library.

With this patch any LLDB executable that has the INCLUDE_IN_FRAMEWORK option set will be built into the Framework's resources directory, and a symlink to the exeuctable will be placed under the build directory's bin folder. Creating the symlinks allows users to run commands from the build directory without altering the workflow.

The framework generated by this patch passes the LLDB test suite, but has not been tested beyond that. It is not expected to be fully ready to ship, but it is a first step.

With this patch binaries that are placed inside the framework aren't being properly installed. Fixing that would increase the patch size significantly, so I'd like to do that in a follow-up.

Reviewers: zturner, tfiala

Subscribers: beanz, lldb-commits, mgorny

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

llvm-svn: 282110

7 years ago[CMake] Pass CLANG_VERSION_* variables into later stages
Chris Bieneman [Wed, 21 Sep 2016 20:43:43 +0000 (20:43 +0000)]
[CMake] Pass CLANG_VERSION_* variables into later stages

When supporting overriding clang versions we also need to pass those through to the next stage so they remain overridden.

llvm-svn: 282109

7 years agoAdd -Wignored-pragma-intrinsic flag
Albert Gutowski [Wed, 21 Sep 2016 20:19:21 +0000 (20:19 +0000)]
Add -Wignored-pragma-intrinsic flag

Summary: People might want to receive warnings about pragmas but not about intrinsics that are implemented in intrin.h.

Reviewers: thakis, hans

Subscribers: cfe-commits

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

llvm-svn: 282108

7 years ago[asan] Reify ErrorGeneric
Filipe Cabecinhas [Wed, 21 Sep 2016 20:18:18 +0000 (20:18 +0000)]
[asan] Reify ErrorGeneric

Summary:
Finish work on PR30351 (last one, after D24551, D24552, and D24554 land)

Also replace the old ReportData structure/variable with the current_error_ static
member of the ScopedInErrorReport class.

This has the following side-effects:
  - Move ASAN_ON_ERROR(); call to the start of the destructor, instead
    of in StartReporting().
      - We only generate the error structure after the
        ScopedInErrorReport constructor finishes, so we can't call
        ASAN_ON_ERROR() during the constructor. I think this makes more
        sense, since we end up never running two of the ASAN_ON_ERROR()
        callback. This also works the same way as error reporting, since
        we end up having a lock around it. Otherwise we could end up
        with the ASAN_ON_ERROR() call for error 1, then the
        ASAN_ON_ERROR() call for error 2, and then lock the mutex for
        reporting error 1.
  - The __asan_get_report_* functions will be able to, in the future,
    provide information about other errors that aren't a "generic
    error". But we might want to rethink that API, since it's too
    restricted. Ideally we teach lldb about the current_error_ member of
    ScopedInErrorReport.

Reviewers: vitalybuka, kcc, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 282107

7 years agoProvide vstore_half helper to workaround clc restrictions
Jan Vesely [Wed, 21 Sep 2016 20:15:55 +0000 (20:15 +0000)]
Provide vstore_half helper to workaround clc restrictions

clang won't accept half precision loads and stores without cl_khr_fp16 since r281904

llvm-svn: 282106

7 years agoadd stop column highlighting support
Todd Fiala [Wed, 21 Sep 2016 20:13:14 +0000 (20:13 +0000)]
add stop column highlighting support

This change introduces optional marking of the column within a source
line where a thread is stopped.  This marking will show up when the
source code for a thread stop is displayed, when the debug info
knows the column information, and if the optional column marking is
enabled.

There are two separate methods for handling the marking of the stop
column:

* via ANSI terminal codes, which are added inline to the source line
  display.  The default ANSI mark-up is to underline the column.

* via a pure text-based caret that is added in the appropriate column
  in a newly-inserted blank line underneath the source line in
  question.

There are some new options that control how this all works.

* settings set stop-show-column

  This takes one of 4 values:

  * ansi-or-caret: use the ANSI terminal code mechanism if LLDB
    is running with color enabled; if not, use the caret-based,
    pure text method (see the "caret" mode below).

  * ansi: only use the ANSI terminal code mechanism to highlight
    the stop line.  If LLDB is running with color disabled, no
    stop column marking will occur.

  * caret: only use the pure text caret method, which introduces
    a newly-inserted line underneath the current line, where
    the only character in the new line is a caret that highlights
    the stop column in question.

  * none: no stop column marking will be attempted.

* settings set stop-show-column-ansi-prefix

  This is a text format that indicates the ANSI formatting
  code to insert into the stream immediately preceding the
  column where the stop column character will be marked up.
  It defaults to ${ansi.underline}; however, it can contain
  any valid LLDB format codes, e.g.

      ${ansi.fg.red}${ansi.bold}${ansi.underline}

* settings set stop-show-column-ansi-suffix

  This is the text format that specifies the ANSI terminal
  codes to end the markup that was started with the prefix
  described above.  It defaults to: ${ansi.normal}.  This
  should be sufficient for the common cases.

Significant leg-work was done by Adrian Prantl.  (Thanks, Adrian!)

differential review: https://reviews.llvm.org/D20835

reviewers: clayborg, jingham
llvm-svn: 282105

7 years agoNext set of additional error checks for invalid Mach-O files for bad LC_UUID
Kevin Enderby [Wed, 21 Sep 2016 20:03:09 +0000 (20:03 +0000)]
Next set of additional error checks for invalid Mach-O files for bad LC_UUID
load commands.  Added a missing check and made the check for more than
one like other other “more than one” checks.  And of course added test cases.

llvm-svn: 282104

7 years agoProbably should add the breakpoint names test directory as well...
Jim Ingham [Wed, 21 Sep 2016 19:21:38 +0000 (19:21 +0000)]
Probably should add the breakpoint names test directory as well...

llvm-svn: 282103

7 years ago[asan] Store full AddressDescription objects in ErrorInvalidPointerPair
Filipe Cabecinhas [Wed, 21 Sep 2016 19:21:01 +0000 (19:21 +0000)]
[asan] Store full AddressDescription objects in ErrorInvalidPointerPair

Reviewers: kcc, vitalybuka, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 282102

7 years ago[LoopInterchange] Track all dependencies, not just anti dependencies.
Chad Rosier [Wed, 21 Sep 2016 19:16:47 +0000 (19:16 +0000)]
[LoopInterchange] Track all dependencies, not just anti dependencies.

Currently, we give up on loop interchange if we encounter a flow dependency
anywhere in the loop list. Worse yet, we don't even track output dependencies.

This patch updates the dependency matrix computation to track flow and output
dependencies in the same way we track anti dependencies.

This improves an internal workload by 2.2x.

Note the loop interchange pass is off by default and it can be enabled with
'-mllvm -enable-loopinterchange'

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

llvm-svn: 282101

7 years ago[ThinLTO] Emit files for distributed builds for all modules
Teresa Johnson [Wed, 21 Sep 2016 19:12:05 +0000 (19:12 +0000)]
[ThinLTO] Emit files for distributed builds for all modules

With the new LTO API in r278338, we stopped emitting the individual
index files and imports files for some modules in the distributed backend
case (thinlto-index-only plugin option).

Specifically, this is when the linker decides not to include a module in the
link, because it was in an archive library and did not have a strong
reference to it. Not creating the expected output files makes the
distributed build system implementation more difficult, in terms of
checking for the expected outputs of the thin link, and scheduling the
backend jobs. To address this, the gold-plugin will write dummy empty
.thinlto.bc and .imports files for modules not included in the link
(which LTO never sees).

Augmented a gold v1.12+ test, since that version of gold has the handling
for notifying on modules not being included in the link.

llvm-svn: 282100

7 years agoImplement ONLY_IF_RO/ONLY_IF_RW like bfd.
Rafael Espindola [Wed, 21 Sep 2016 18:33:44 +0000 (18:33 +0000)]
Implement ONLY_IF_RO/ONLY_IF_RW like bfd.

The actual logic is to keep the output section if the output section
would have been ro/rw.

This is both simpler and more practical, as the intention is linker
scripts is to always keep of of a pair of ONLY_IF_RO/ONLY_IF_RW.

llvm-svn: 282099

7 years ago[MIRParser] Delete dead code. NFCI.
Davide Italiano [Wed, 21 Sep 2016 18:26:08 +0000 (18:26 +0000)]
[MIRParser] Delete dead code. NFCI.

llvm-svn: 282098

7 years agorevert 281908 because 281909 got reverted
Nico Weber [Wed, 21 Sep 2016 18:25:43 +0000 (18:25 +0000)]
revert 281908 because 281909 got reverted

llvm-svn: 282097

7 years agorevert 282085, 281909, they broke 32-bit dynamic ASan and the sanitizer-windows bot
Nico Weber [Wed, 21 Sep 2016 18:22:43 +0000 (18:22 +0000)]
revert 282085, 281909, they broke 32-bit dynamic ASan and the sanitizer-windows bot

llvm-svn: 282096

7 years agoRemove obsolete XFAIL.
Nico Weber [Wed, 21 Sep 2016 17:41:03 +0000 (17:41 +0000)]
Remove obsolete XFAIL.

The sanitizer-windows bot is currently red because this test unexpectedly passes.

llvm-svn: 282095

7 years agoFix typo in comment [NFC]
Etienne Bergeron [Wed, 21 Sep 2016 17:16:38 +0000 (17:16 +0000)]
Fix typo in comment [NFC]

llvm-svn: 282092

7 years agofix typo in comment [NFC]
Etienne Bergeron [Wed, 21 Sep 2016 17:15:23 +0000 (17:15 +0000)]
fix typo in comment [NFC]

llvm-svn: 282091

7 years agoFix failing regex tests.
Zachary Turner [Wed, 21 Sep 2016 17:13:51 +0000 (17:13 +0000)]
Fix failing regex tests.

r282079 converted the regular expression interface to accept
and return StringRefs instead of char pointers.  In one case
a null pointer check was converted to an empty string check,
but this was an incorrect conversion because an empty string
is a valid regular expression.  Removing this check should
fix the test failures.

llvm-svn: 282090

7 years ago[docs] Add ThinLTO user documentation
Teresa Johnson [Wed, 21 Sep 2016 16:57:03 +0000 (16:57 +0000)]
[docs] Add ThinLTO user documentation

Summary: Add some user facing documentation on ThinLTO and how to use it.

Reviewers: mehdi_amini

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 282089

7 years agoDisable tail calls if there is an swifterror argument
Arnold Schwaighofer [Wed, 21 Sep 2016 16:53:36 +0000 (16:53 +0000)]
Disable tail calls if there is an swifterror argument

ISel does not handle them correctly yet i.e we crash trying to emit tail call
code.

radar://28407842

llvm-svn: 282088

7 years ago[LV] Don't emit unused scalars for uniform instructions
Matthew Simpson [Wed, 21 Sep 2016 16:50:24 +0000 (16:50 +0000)]
[LV] Don't emit unused scalars for uniform instructions

If we identify an instruction as uniform after vectorization, we know that we
should only use the value corresponding to the first vector lane of each unroll
iteration. However, when scalarizing such instructions, we still produce values
for the other vector lanes. This patch prevents us from generating the unused
scalars.

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

llvm-svn: 282087

7 years ago[AMDGPU][mc] Add support for ds_add_[rtn_]f32.
Artem Tamazov [Wed, 21 Sep 2016 16:35:44 +0000 (16:35 +0000)]
[AMDGPU][mc] Add support for ds_add_[rtn_]f32.

Lit tests added.
Resolves https://github.com/RadeonOpenCompute/hcc/issues/122.

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

llvm-svn: 282086

7 years ago[compiler-rt] Fix Asan build on Android
Etienne Bergeron [Wed, 21 Sep 2016 16:32:14 +0000 (16:32 +0000)]
[compiler-rt] Fix Asan build on Android

Summary:
The dynamic shadow code is not detected correctly on Android.
The android shadow seems to start at address zero.

The bug is introduced here:
  https://reviews.llvm.org/D23363

Started here: https://build.chromium.org/p/chromium.fyi/builders/ClangToTAndroidASan/builds/4029
Likely due to an asan runtime change, filed https://llvm.org/bugs/show_bug.cgi?id=30462

From asan_mapping.h:
```
#if SANITIZER_WORDSIZE == 32
#  if SANITIZER_ANDROID
#    define SHADOW_OFFSET (0)   <<---- HERE
#  elif defined(__mips__)
```
Shadow address on android is 0.

From asan_rtl.c:
```
  if (shadow_start == 0) {
    [...]
    shadow_start = FindAvailableMemoryRange(space_size, alignment, granularity);
  }
```
We assumed that 0 is dynamic address.

On windows, the address was determined with:
```
#  elif SANITIZER_WINDOWS64
#   define SHADOW_OFFSET __asan_shadow_memory_dynamic_address
#  else
```
and __asan_shadow_memory_dynamic_address is initially zero.

Reviewers: rnk, eugenis, vitalybuka

Subscribers: kcc, tberghammer, danalbert, kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 282085

7 years agoChange the basic block weight calculation algorithm to use max instead of voting.
Dehao Chen [Wed, 21 Sep 2016 16:26:51 +0000 (16:26 +0000)]
Change the basic block weight calculation algorithm to use max instead of voting.

Summary: Now that we have more precise debug info, we should change back to use maximum to get basic block weight.

Reviewers: dnovillo

Subscribers: andreadb, llvm-commits

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

llvm-svn: 282084

7 years ago[LV] Rename "Width" to "Lane" (NFC)
Matthew Simpson [Wed, 21 Sep 2016 16:09:23 +0000 (16:09 +0000)]
[LV] Rename "Width" to "Lane" (NFC)

llvm-svn: 282083

7 years ago[AVX512] Fix return types on __builtin_ia32_gather3XivXdi builtins
Cameron McInally [Wed, 21 Sep 2016 16:07:40 +0000 (16:07 +0000)]
[AVX512] Fix return types on __builtin_ia32_gather3XivXdi builtins

The return types on the AVX512 __builtin_ia32_gather3XivXdi builtins are incorrect. The return type should match the type of the pass through vector.

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

-This line, and those below, will be ignored--

M    include/clang/Basic/BuiltinsX86.def

llvm-svn: 282082

7 years ago[AVX512] Fix return types on int_x86_avx512_gatherXXX_di intrinsics
Cameron McInally [Wed, 21 Sep 2016 16:06:10 +0000 (16:06 +0000)]
[AVX512] Fix return types on int_x86_avx512_gatherXXX_di intrinsics

The return type should match the pass through vector type.

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

llvm-svn: 282081

7 years agoFix an inefficient StringRef conversion.
Zachary Turner [Wed, 21 Sep 2016 16:01:43 +0000 (16:01 +0000)]
Fix an inefficient StringRef conversion.

Since the original object was already an llvm::SmallString<>
there's no point calling c_str() first.

llvm-svn: 282080

7 years agoMake lldb::Regex use StringRef.
Zachary Turner [Wed, 21 Sep 2016 16:01:28 +0000 (16:01 +0000)]
Make lldb::Regex use StringRef.

This updates getters and setters to use StringRef instead of
const char *.  I tested the build on Linux, Windows, and OSX
and saw no build or test failures.  I cannot test any BSD
or Android variants, however I expect the required changes
to be minimal or non-existant.

llvm-svn: 282079

7 years ago[ELF] - Linkerscript: support complex section pattern grammar.
George Rimar [Wed, 21 Sep 2016 15:56:44 +0000 (15:56 +0000)]
[ELF] - Linkerscript: support complex section pattern grammar.

This is PR30442.
Previously we were failed to parce complex expressions like:
foo : { *(SORT_BY_NAME(bar) zed) }

Main idea of patch that globs and excludes can be wrapped in a SORT.
There is a difference in semanics of ld/gold:
ld likes:
*(SORT(EXCLUDE_FILE (*file1.o) .foo.1))

gold likes:
*(EXCLUDE_FILE (*file1.o) SORT(.foo.1))

Patch implements ld grammar, complex expressions like
next is not a problem anymore:
.abc : { *(SORT(.foo.* EXCLUDE_FILE (*file1.o) .bar.*) .bar.*) }

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

llvm-svn: 282078

7 years agoRevert r281895 "Add @llvm.dbg.value entries for the phi node created by -mem2reg"
Hans Wennborg [Wed, 21 Sep 2016 15:55:53 +0000 (15:55 +0000)]
Revert r281895 "Add @llvm.dbg.value entries for the phi node created by -mem2reg"

(And follow-up r281964.)

It caused PR30468.

llvm-svn: 282077

7 years agoRevert r281715, it caused PR30475
Nico Weber [Wed, 21 Sep 2016 15:33:24 +0000 (15:33 +0000)]
Revert r281715, it caused PR30475

llvm-svn: 282076

7 years agoDeadArgElim: Don't mark swifterror arguments as unused
Arnold Schwaighofer [Wed, 21 Sep 2016 15:29:08 +0000 (15:29 +0000)]
DeadArgElim: Don't mark swifterror arguments as unused

Replacing swifterror arguments with undef creates invalid IR.

rdar://28300490

llvm-svn: 282075

7 years agoFix compiler warnings.
Haojian Wu [Wed, 21 Sep 2016 15:19:04 +0000 (15:19 +0000)]
Fix compiler warnings.

llvm-svn: 282074

7 years ago[change-namespace] fix name qualifiers in UsingShadowDecl and NestedNameSpecifier.
Eric Liu [Wed, 21 Sep 2016 15:06:12 +0000 (15:06 +0000)]
[change-namespace] fix name qualifiers in UsingShadowDecl and NestedNameSpecifier.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 282073

7 years agoRefactor NativeRegisterContextLinux_x86_64 code.
Valentina Giusti [Wed, 21 Sep 2016 13:33:01 +0000 (13:33 +0000)]
Refactor NativeRegisterContextLinux_x86_64 code.

This patch refactors the way the XState type is checked and, in order to
simplify the code, it removes the usage of the 'cpuid' instruction: just checking
if the ptrace calls done throuhg ReadFPR is enough to verify both if there is
HW support and if there is kernel support. Also the XCR0 bits are enough to check if
there is both HW and kernel support for AVX and MPX.

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

llvm-svn: 282072

7 years ago[LoopInterchange] Various cleanup. NFC.
Chad Rosier [Wed, 21 Sep 2016 13:28:41 +0000 (13:28 +0000)]
[LoopInterchange] Various cleanup. NFC.

llvm-svn: 282071

7 years ago[clang-move] A prototype tool for moving class definition to new file.
Haojian Wu [Wed, 21 Sep 2016 13:18:19 +0000 (13:18 +0000)]
[clang-move] A prototype tool for moving class definition to new file.

Summary:
This patch introduces a new tool which moves a specific class definition
from files (.h, .cc) to new files (.h, .cc), which mostly acts like
"Extract class defintion". In the long term, this tool should be
merged in to clang-refactoring as a subtool.

clang-move not only moves class definition, but also moves all the
forward declarations, functions defined in anonymous namespace and #include
headers to new files, to make sure the new files are compliable as much
as possible.

To move `Foo` from old.[h/cc] to new.[h/cc], use:

```
clang-move -name=Foo -old_header=old.h -old_cc=old.cc -new_header=new.h
-new_cc=new.cc old.cc
```

To move `Foo` from old.h to new.h, use:

```
clang-move -name=Foo -old_header=old.h -new_header=new.h old.cc
```

Reviewers: klimek, djasper, ioeric

Subscribers: mgorny, beanz, Eugene.Zelenko, bkramer, omtcyfz, cfe-commits

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

llvm-svn: 282070

7 years agoGlobalISel: produce correct code for signext/zeroext ABI flags.
Tim Northover [Wed, 21 Sep 2016 12:57:45 +0000 (12:57 +0000)]
GlobalISel: produce correct code for signext/zeroext ABI flags.

We still don't really have an equivalent of "AssertXExt" in DAG, so we don't
exploit the guarantees on the receiving side yet, but this should produce
conservatively correct code on iOS ABIs.

llvm-svn: 282069

7 years agoGlobalISel: pass Function to lowerFormalArguments directly (NFC).
Tim Northover [Wed, 21 Sep 2016 12:57:35 +0000 (12:57 +0000)]
GlobalISel: pass Function to lowerFormalArguments directly (NFC).

The only implementation that exists immediately looks it up anyway, and the
information is needed to handle various parameter attributes (stored on the
function itself).

llvm-svn: 282068

7 years agoLinker script: Fix bug with several .bss
Eugene Leviant [Wed, 21 Sep 2016 11:29:28 +0000 (11:29 +0000)]
Linker script: Fix bug with several .bss

When final image has several .bss sections, lld fails
because second .bss always has zero VA. This causes
link error "Not enough space for ELF and program headers"

llvm-svn: 282067

7 years agoRemove an invalid doxygen `@return` docstring on a void function
Luke Drummond [Wed, 21 Sep 2016 11:12:50 +0000 (11:12 +0000)]
Remove an invalid doxygen `@return` docstring on a void function

`ClangASTSource::FindExternalVisibleDecls` has void return type, so the
previous docstring was misleading.

llvm-svn: 282066

7 years ago[AMDGPU] Assembler: remove unused AMDGPUMCObjectWriter.
Sam Kolton [Wed, 21 Sep 2016 10:33:32 +0000 (10:33 +0000)]
[AMDGPU] Assembler: remove unused AMDGPUMCObjectWriter.

Summary: It is replaced by AMDGPUELFObjectWriter

Reviewers: tstellarAMD, vpykhtin, artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl

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

llvm-svn: 282065

7 years agoRevert "[sanitizers] Update sanitizers test to better match glibc internals"
Diana Picus [Wed, 21 Sep 2016 10:06:37 +0000 (10:06 +0000)]
Revert "[sanitizers] Update sanitizers test to better match glibc internals"

This reverts commit r282061 because it broke the clang-cuda-build bot.

llvm-svn: 282064

7 years ago[mips] LLVM PR/30197 - Tail call incorrectly clobbers arguments for mips
Simon Dardis [Wed, 21 Sep 2016 09:43:40 +0000 (09:43 +0000)]
[mips] LLVM PR/30197 - Tail call incorrectly clobbers arguments for mips

The postRA scheduler performs alias analysis to determine if stores and loads
can moved past each other. When a function has more arguments than argument
registers for the calling convention used, excess arguments are spilled onto the
stack. LLVM by default assumes that argument slots are immutable, unless the
function contains a tail call. Without the knowledge of that a function contains
a tail call site, stores and loads to fixed stack slots may be re-ordered
causing the out-going arguments to clobber the incoming arguments before the
incoming arguments are supposed to be dead.

Reviewers: vkalintiris

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

llvm-svn: 282063

7 years ago[libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)
Asiri Rathnayake [Wed, 21 Sep 2016 09:09:32 +0000 (09:09 +0000)]
[libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)

Align the naming / use of the macro LIBCXXABI_HAS_NO_THREADS to follow what we
have in libcxx. NFC.

llvm-svn: 282062

7 years ago[sanitizers] Update sanitizers test to better match glibc internals
Diana Picus [Wed, 21 Sep 2016 08:56:14 +0000 (08:56 +0000)]
[sanitizers] Update sanitizers test to better match glibc internals

One of the tests relying on sem_t's layout gets the wrong value for versions of
glibc newer than 2.21 on platforms that don't have 64-bit atomics (e.g. ARM).

This commit fixes the test to work with:
* versions of glibc >= 2.21 on platforms with 64-bit atomics: unchanged
* versions of glibc >= 2.21 on platforms without 64-bit atomics: the semaphore
value is shifted by SEM_VALUE_SHIFT (which is set to 1 in glibc's internal
headers)
* versions of glibc < 2.21: unchanged

See the glibc 2.23 sources:
* sysdeps/nptl/internaltypes.h (struct new_sem for glibc >= 2.21 and
                                struct old_sem for glibc < 2.21)
* nptl/sem_getvalue.c

This was uncovered on one of the new buildbots that we are trying to move to
production.

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

llvm-svn: 282061

7 years ago[ELF] - Linkerscript: reimplement readSectionExcludes()
George Rimar [Wed, 21 Sep 2016 08:53:21 +0000 (08:53 +0000)]
[ELF] - Linkerscript: reimplement readSectionExcludes()

It is not only a bit more straightforward now, but also next 2 issues are solved:

* It just crashed on ".foo : { *(EXCLUDE_FILE (*file1.o)) }" before.
* It accepted multiple EXCLUDE_FILEs in a row.

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

llvm-svn: 282060

7 years agoPR30401: Fix substitutions for functions with abi_tag
Dmitry Polukhin [Wed, 21 Sep 2016 08:27:03 +0000 (08:27 +0000)]
PR30401: Fix substitutions for functions with abi_tag

llvm-svn: 282059

7 years agoRevert "AArch64: Set shift bit of TLSLE HI12 add instruction"
Diana Picus [Wed, 21 Sep 2016 08:24:41 +0000 (08:24 +0000)]
Revert "AArch64: Set shift bit of TLSLE HI12 add instruction"

This reverts commit r282057 because it broke the buildbots - see e.g.
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12063

llvm-svn: 282058

7 years agoAArch64: Set shift bit of TLSLE HI12 add instruction
Lei Liu [Wed, 21 Sep 2016 07:41:41 +0000 (07:41 +0000)]
AArch64: Set shift bit of TLSLE HI12 add instruction

Summary: AArch64 LLVM assembler emits add instruction without shift bit to calculate the higher 12-bit address of TLS variables in local exec model.  This generates wrong code sequence to access TLS variables with thread offset larger than 0x1000.

Reviewers: t.p.northover, peter.smith, rovka

Subscribers: salim.nasser, aemerson, llvm-commits, rengolin

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

llvm-svn: 282057

7 years agoclang-format: [JS] do not wrapp @returns tags.
Martin Probst [Wed, 21 Sep 2016 06:56:38 +0000 (06:56 +0000)]
clang-format: [JS] do not wrapp @returns tags.

Summary: @returns is incorrect code, the standard is @return. However wrapping it can still confuse users.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 282056

7 years ago[AVX-512] Split the 3 different usages of the X86ISD::FSETCC opcode into 3 different...
Craig Topper [Wed, 21 Sep 2016 06:37:54 +0000 (06:37 +0000)]
[AVX-512] Split the 3 different usages of the X86ISD::FSETCC opcode into 3 different opcodes.

It turns out isel is really not robust against having different type profiles for the same opcode. It turns out that if you put an illegal rounding mode(i.e. not CUR_DIRECTION or NO_EXC) on a comiss intrinsic we would generate the FSETCC form with the rounding mode added, but then pattern match to an instruction with ROUND_CUR_DIRECTION.

We can probably get away with just one FSETCCM opcode that always contains the rounding mode and explicitly put ROUND_CUR_DIRECTION in the pattern, but I'll leave that for future work.

With this change the clang tests for the comiss intrinsics that used an incorrect rounding mode of 3 properly fail isel instead of silently doing the wrong thing. Those clang tests will be fixed in a follow up commit and I also plan to add rounding mode checking to clang.

llvm-svn: 282055

7 years ago[CMake] Rename back SIMPLE_SOURCE to compile as C++
Jonas Hahnfeld [Wed, 21 Sep 2016 05:44:06 +0000 (05:44 +0000)]
[CMake] Rename back SIMPLE_SOURCE to compile as C++

This was changed in rL276151 and causes problems if the C++ compiler does not
support the same arches as the C compiler.
For the builtins, only the C compiler is tested in try_compile_only.

Additionally, -fno-exceptions is passed in (if available) to work around
the case where no libunwind is available.

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

llvm-svn: 282054

7 years agollvm/test/CodeGen/NVPTX/zero-cs.ll: Relax an expression to match in -Asserts.
NAKAMURA Takumi [Wed, 21 Sep 2016 04:43:11 +0000 (04:43 +0000)]
llvm/test/CodeGen/NVPTX/zero-cs.ll: Relax an expression to match in -Asserts.

  LLVM ERROR: Cannot select: 0x3607bf0: i32 = ExternalSymbol'__powidf2'

llvm-svn: 282053

7 years ago[AVX-512] Don't add an additional rounding mode operand to the avx512 vcvtps2ph intri...
Craig Topper [Wed, 21 Sep 2016 03:58:44 +0000 (03:58 +0000)]
[AVX-512] Don't add an additional rounding mode operand to the avx512 vcvtps2ph intrinsic lowering.

There was no way to control its value so it was always FROUND_CURRENT making it unnecessary. The true rounding mode is encoded in the immediate operand of the instruction.

This also removes the pattern from the rb form of the instructions since there is no way to specify the FROUND_NO_EXC rounding mode it required.

llvm-svn: 282052

7 years ago[AVX-512] Simplify handling of INTR_TYPE_1OP_MASK_RM to remove support for the second...
Craig Topper [Wed, 21 Sep 2016 03:58:41 +0000 (03:58 +0000)]
[AVX-512] Simplify handling of INTR_TYPE_1OP_MASK_RM to remove support for the second opcode since its never used. This makes it consistent with INTR_TYPE_2OP_MASK_RM and INTR_TYPE_3OP_MASK_RM.

And even if it was used we were passing the same operands to both so it wouldn't make sense to have two opcodes.

llvm-svn: 282051

7 years ago[libFuzzer] fix libc++ build
Kostya Serebryany [Wed, 21 Sep 2016 03:50:37 +0000 (03:50 +0000)]
[libFuzzer] fix libc++ build

llvm-svn: 282050

7 years agoAccept sh_entsize = 0.
Rui Ueyama [Wed, 21 Sep 2016 03:22:18 +0000 (03:22 +0000)]
Accept sh_entsize = 0.

This surfaced again with Rust. As per bug 30435, rustc creates a
mergeable section with a sh_entsize zero. It bit us before, too.
I think we should relax the input check rather than being too picky.

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

llvm-svn: 282049