platform/upstream/llvm.git
7 years agoAdd an interesting test.
Rafael Espindola [Wed, 14 Sep 2016 18:06:02 +0000 (18:06 +0000)]
Add an interesting test.

llvm-svn: 281515

7 years agoRevert "AMDGPU: Use SOPK compare instructions"
Matt Arsenault [Wed, 14 Sep 2016 18:04:42 +0000 (18:04 +0000)]
Revert "AMDGPU: Use SOPK compare instructions"

Accidentally committed

llvm-svn: 281514

7 years agoAMDGPU: Use SOPK compare instructions
Matt Arsenault [Wed, 14 Sep 2016 18:03:53 +0000 (18:03 +0000)]
AMDGPU: Use SOPK compare instructions

llvm-svn: 281513

7 years ago[cmake] Make libgomp & libiomp5 alias install optional
Michal Gorny [Wed, 14 Sep 2016 17:46:27 +0000 (17:46 +0000)]
[cmake] Make libgomp & libiomp5 alias install optional

Introduce a new LIBOMP_INSTALL_VARIABLES cache variable that can be used
to disable creating libgomp and libiomp5 aliases on 'make install'.
Those aliases are undesired e.g. on Gentoo systems where libomp is used
purely by clang.

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

llvm-svn: 281512

7 years ago[Release notes] Mention readability-container-size-empty improvements.
Eugene Zelenko [Wed, 14 Sep 2016 17:41:51 +0000 (17:41 +0000)]
[Release notes] Mention readability-container-size-empty improvements.

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

llvm-svn: 281510

7 years agoConvert finite to builtin
Dehao Chen [Wed, 14 Sep 2016 17:34:14 +0000 (17:34 +0000)]
Convert finite to builtin

Summary: This patch converts finite/__finite to builtin functions so that it will be inlined by compiler.

Reviewers: hfinkel, davidxl, efriedma

Subscribers: efriedma, llvm-commits

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

llvm-svn: 281509

7 years agoVerifier: Mark orphaned DICompileUnits as a debug info failure.
Adrian Prantl [Wed, 14 Sep 2016 17:30:37 +0000 (17:30 +0000)]
Verifier: Mark orphaned DICompileUnits as a debug info failure.
This is a follow-up to r268778 that adds a couple of missing cases,
most notably orphaned compile units.

rdar://problem/28193346

llvm-svn: 281508

7 years agoUse Intel CPU flags to determine target supported features.
Valentina Giusti [Wed, 14 Sep 2016 17:27:48 +0000 (17:27 +0000)]
Use Intel CPU flags to determine target supported features.

Summary:
This patch uses the instruction CPUID to verify that FXSAVE, XSAVE, AVX
and MPX are supported by the target hardware. In case the HW supports XSAVE,
and at least one of the extended register sets, it further checks if the
target software has the kernel support for such features, by verifying that
their XSAVE part is correctly managed.

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

llvm-svn: 281507

7 years agoMake analyzeBranch family of instruction names consistent
Matt Arsenault [Wed, 14 Sep 2016 17:24:15 +0000 (17:24 +0000)]
Make analyzeBranch family of instruction names consistent

analyzeBranch was renamed to use lowercase first, rename
the related set to match.

llvm-svn: 281506

7 years agoAArch64: Use TTI branch functions in branch relaxation
Matt Arsenault [Wed, 14 Sep 2016 17:23:48 +0000 (17:23 +0000)]
AArch64: Use TTI branch functions in branch relaxation

The main change is to return the code size from
InsertBranch/RemoveBranch.

Patch mostly by Tim Northover

llvm-svn: 281505

7 years ago[x86] fix formatting; NFC
Sanjay Patel [Wed, 14 Sep 2016 17:23:18 +0000 (17:23 +0000)]
[x86] fix formatting; NFC

llvm-svn: 281504

7 years ago[compiler-rt] Avoid instrumenting sanitizer functions
Etienne Bergeron [Wed, 14 Sep 2016 17:18:37 +0000 (17:18 +0000)]
[compiler-rt] Avoid instrumenting sanitizer functions

Summary:
Function __asan_default_options is called by __asan_init before the
shadow memory got initialized. Instrumenting that function may lead
to flaky execution.

As the __asan_default_options is provided by users, we cannot expect
them to add the appropriate function atttributes to avoid
instrumentation.

Reviewers: kcc, rnk

Subscribers: dberris, chrisha, llvm-commits

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

llvm-svn: 281503

7 years ago[X86][SSE] Improve recognition of i64 sitofp conversions that can be performed as...
Simon Pilgrim [Wed, 14 Sep 2016 17:15:26 +0000 (17:15 +0000)]
[X86][SSE] Improve recognition of i64 sitofp conversions that can be performed as i32 (PR29078)

Until AVX512DQ we only support i64/vXi64 sitofp conversion as scalars.

This patch sees if the sign bit extends far enough that we can truncate to a i32 type and then perform sitofp without loss of precision.

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

llvm-svn: 281502

7 years ago[LoopInterchange] Typo. NFC.
Chad Rosier [Wed, 14 Sep 2016 17:12:30 +0000 (17:12 +0000)]
[LoopInterchange] Typo. NFC.

llvm-svn: 281501

7 years ago[LoopInterchange] Add CL option to override cost threshold.
Chad Rosier [Wed, 14 Sep 2016 17:07:13 +0000 (17:07 +0000)]
[LoopInterchange] Add CL option to override cost threshold.

Mostly useful for getting consistent lit testing.

llvm-svn: 281500

7 years ago[X86][SSE] Don't use PSHUFD directly - lower with generic shuffle
Simon Pilgrim [Wed, 14 Sep 2016 17:04:22 +0000 (17:04 +0000)]
[X86][SSE] Don't use PSHUFD directly - lower with generic shuffle

Remove the last user of the old getTargetShuffleNode helpers

llvm-svn: 281499

7 years agogetValueType().getScalarSizeInBits() -> getScalarValueSizeInBits(), round 2 ; NFCI
Sanjay Patel [Wed, 14 Sep 2016 16:54:10 +0000 (16:54 +0000)]
getValueType().getScalarSizeInBits() -> getScalarValueSizeInBits(), round 2 ; NFCI

llvm-svn: 281498

7 years ago[LoopInterchange] Cleanup debug whitespace. NFC.
Chad Rosier [Wed, 14 Sep 2016 16:43:19 +0000 (16:43 +0000)]
[LoopInterchange] Cleanup debug whitespace. NFC.

llvm-svn: 281497

7 years agoAdd a test showing we handle .tbss sections in linker scripts.
Rafael Espindola [Wed, 14 Sep 2016 16:40:33 +0000 (16:40 +0000)]
Add a test showing we handle .tbss sections in linker scripts.

llvm-svn: 281496

7 years agogetVectorElementType().getSizeInBits() -> getScalarSizeInBits() ; NFCI
Sanjay Patel [Wed, 14 Sep 2016 16:37:15 +0000 (16:37 +0000)]
getVectorElementType().getSizeInBits() -> getScalarSizeInBits() ; NFCI

llvm-svn: 281495

7 years ago[ELF] Do not adjust TLS symbol value when produce relocatable object
Simon Atanasyan [Wed, 14 Sep 2016 16:26:19 +0000 (16:26 +0000)]
[ELF] Do not adjust TLS symbol value when produce relocatable object

When the linker generates a relocatable object there is no TLS program
header and we should not adjust TLS symbols value.

llvm-svn: 281494

7 years agogetValueType().getSizeInBits() -> getValueSizeInBits() ; NFCI
Sanjay Patel [Wed, 14 Sep 2016 16:05:51 +0000 (16:05 +0000)]
getValueType().getSizeInBits() -> getValueSizeInBits() ; NFCI

llvm-svn: 281493

7 years agoFix typo in comment [NFC]
Etienne Bergeron [Wed, 14 Sep 2016 15:59:32 +0000 (15:59 +0000)]
Fix typo in comment [NFC]

llvm-svn: 281492

7 years agoAMDGPU: Support folding FrameIndex operands
Matt Arsenault [Wed, 14 Sep 2016 15:51:33 +0000 (15:51 +0000)]
AMDGPU: Support folding FrameIndex operands

This avoids test regressions in a future commit.

llvm-svn: 281491

7 years agogetValueType().getScalarSizeInBits() -> getScalarValueSizeInBits() ; NFCI
Sanjay Patel [Wed, 14 Sep 2016 15:43:44 +0000 (15:43 +0000)]
getValueType().getScalarSizeInBits() -> getScalarValueSizeInBits() ; NFCI

llvm-svn: 281490

7 years agogetScalarType().getSizeInBits() -> getScalarSizeInBits() ; NFCI
Sanjay Patel [Wed, 14 Sep 2016 15:21:00 +0000 (15:21 +0000)]
getScalarType().getSizeInBits() -> getScalarSizeInBits() ; NFCI

llvm-svn: 281489

7 years agoAMDGPU: Improve splitting 64-bit bit ops by constants
Matt Arsenault [Wed, 14 Sep 2016 15:19:03 +0000 (15:19 +0000)]
AMDGPU: Improve splitting 64-bit bit ops by constants

This addresses a TODO to handle operations besides and. This
also starts eliminating no-op operations with a constant that
can emerge later.

llvm-svn: 281488

7 years agoCodeGen: simplify the logic a slight bit
Saleem Abdulrasool [Wed, 14 Sep 2016 15:17:46 +0000 (15:17 +0000)]
CodeGen: simplify the logic a slight bit

Move the definition of `getTriple()` into the header.  It would just call
`getTarget().getTriple()`.  Inline the definition to allow the compiler to see
the same amount of the layout as previously.  Remove the more verbose
`getTarget().getTriple()` in favour of `getTriple()`.

llvm-svn: 281487

7 years ago[interception] Avoid duplicate declaration of isdigit in test
Jonas Hahnfeld [Wed, 14 Sep 2016 15:02:32 +0000 (15:02 +0000)]
[interception] Avoid duplicate declaration of isdigit in test

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

llvm-svn: 281486

7 years ago[LV] Process pointer IVs with PHINodes in collectLoopUniforms
Matthew Simpson [Wed, 14 Sep 2016 14:47:40 +0000 (14:47 +0000)]
[LV] Process pointer IVs with PHINodes in collectLoopUniforms

This patch moves the processing of pointer induction variables in
collectLoopUniforms from the consecutive pointer phase of the analysis to the
phi node phase. Previously, if a pointer induction variable was used by both a
scalarized non-memory instruction as well as a vectorized memory instruction,
we would incorrectly identify the pointer as uniform. Pointer induction
variables should be treated the same as other phi nodes. That is, they are
uniform if all users of the induction variable and induction variable update
are uniform.

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

llvm-svn: 281485

7 years ago[ARM] Promote small global constants to constant pools
James Molloy [Wed, 14 Sep 2016 14:47:27 +0000 (14:47 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

llvm-svn: 281484

7 years agoMCInstrDesc: this fixes an issue setting/getting member Flags, which
Sjoerd Meijer [Wed, 14 Sep 2016 14:32:17 +0000 (14:32 +0000)]
MCInstrDesc: this fixes an issue setting/getting member Flags, which
is an uint64_t. However, getter function getFlags returned an unsigned,
and in function hasProperty (1 << MCFlag) was used instead of (1ULL << MCFlag).

llvm-svn: 281483

7 years agoMove helper function higher in the file. NFC
Rafael Espindola [Wed, 14 Sep 2016 14:32:08 +0000 (14:32 +0000)]
Move helper function higher in the file. NFC

This just makes a followup patch easier to read.

llvm-svn: 281482

7 years ago[X86][SSE] Removed unused getTargetShuffleNode function
Simon Pilgrim [Wed, 14 Sep 2016 14:30:00 +0000 (14:30 +0000)]
[X86][SSE] Removed unused getTargetShuffleNode function

llvm-svn: 281481

7 years ago[X86] Added i128 lshr+shl -> mask combine test
Simon Pilgrim [Wed, 14 Sep 2016 14:29:16 +0000 (14:29 +0000)]
[X86] Added i128 lshr+shl -> mask combine test

llvm-svn: 281480

7 years agoFix code-gen crash on Power9 for insert_vector_elt with variable index (PR30189)
Nemanja Ivanovic [Wed, 14 Sep 2016 14:19:09 +0000 (14:19 +0000)]
Fix code-gen crash on Power9 for insert_vector_elt with variable index (PR30189)

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

In the initial implementation of this instruction, I forgot to account for
variable indices. This patch fixes PR30189 and should probably be merged into
3.9.1 (I'll open a bug according to the new instructions).

llvm-svn: 281479

7 years ago[InstCombine] Merged two test files and regenerated checks using update_test_checks...
Andrea Di Biagio [Wed, 14 Sep 2016 14:18:21 +0000 (14:18 +0000)]
[InstCombine] Merged two test files and regenerated checks using update_test_checks.py. NFC.

llvm-svn: 281478

7 years ago[libcxx] Add a TSan regression test for a data race in call_once
Kuba Brecka [Wed, 14 Sep 2016 14:15:42 +0000 (14:15 +0000)]
[libcxx] Add a TSan regression test for a data race in call_once

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

llvm-svn: 281477

7 years ago[libcxx] Fix a typo in test/libcxx/test/target_info.py that prevents running tests...
Kuba Brecka [Wed, 14 Sep 2016 14:13:50 +0000 (14:13 +0000)]
[libcxx] Fix a typo in test/libcxx/test/target_info.py that prevents running tests on Darwin with sanitizers

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

llvm-svn: 281476

7 years ago[libcxx] Enable building and testing of libcxx with ThreadSanitizer on OS X
Kuba Brecka [Wed, 14 Sep 2016 14:12:50 +0000 (14:12 +0000)]
[libcxx] Enable building and testing of libcxx with ThreadSanitizer on OS X

This patch enables building and testing libcxx under ThreadSanitizer on OS X. CMake builds that have -DLLVM_USE_SANITIZER=Thread will automatically build libcxx with -fsanitize=thread and testing via lit then runs under TSan.

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

llvm-svn: 281475

7 years ago[StackProtector] Use INITIALIZE_TM_PASS instead of INITIALIZE_PASS
Silviu Baranga [Wed, 14 Sep 2016 14:09:43 +0000 (14:09 +0000)]
[StackProtector] Use INITIALIZE_TM_PASS instead of INITIALIZE_PASS
in order to make sure that its TargetMachine constructor is
registered.

This allows us to run the PEI machine pass with MIR input
(see PR30324).

llvm-svn: 281474

7 years agoAdding missing directive for Power9.
Nemanja Ivanovic [Wed, 14 Sep 2016 14:09:39 +0000 (14:09 +0000)]
Adding missing directive for Power9.
There is currently no codegen for Power9 that depends on the directive
so this is NFC for now but will be important in the future. This was
missed in r268950 so I'm adding it now.

llvm-svn: 281473

7 years ago[asan] Enable -asan-use-private-alias on Darwin/Mach-O, add test for ODR false positi...
Kuba Brecka [Wed, 14 Sep 2016 14:09:18 +0000 (14:09 +0000)]
[asan] Enable -asan-use-private-alias on Darwin/Mach-O, add test for ODR false positive with LTO (compiler-rt part)

The '-asan-use-private-alias’ option (disabled by default) option is currently only enabled for Linux and ELF, but it also works on Darwin and Mach-O. This option also fixes a known problem with LTO on Darwin (https://github.com/google/sanitizers/issues/647). This patch enables the support for Darwin (but still keeps it off by default) and adds the LTO test case.

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

llvm-svn: 281472

7 years ago[X86][SSE] Don't blend vector shifts with MOVSS/MOVSD directly, lower from generic...
Simon Pilgrim [Wed, 14 Sep 2016 14:08:18 +0000 (14:08 +0000)]
[X86][SSE] Don't blend vector shifts with MOVSS/MOVSD directly, lower from generic shuffle

Shuffle lowering will correctly lower to MOVSS/MOVSD/PBLEND, improving commutation opportunities

llvm-svn: 281471

7 years ago[asan] Enable -asan-use-private-alias on Darwin/Mach-O, add test for ODR false positi...
Kuba Brecka [Wed, 14 Sep 2016 14:06:33 +0000 (14:06 +0000)]
[asan] Enable -asan-use-private-alias on Darwin/Mach-O, add test for ODR false positive with LTO (llvm part)

The '-asan-use-private-alias’ option (disabled by default) option is currently only enabled for Linux and ELF, but it also works on Darwin and Mach-O. This option also fixes a known problem with LTO on Darwin (https://github.com/google/sanitizers/issues/647). This patch enables the support for Darwin (but still keeps it off by default) and adds the LTO test case.

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

llvm-svn: 281470

7 years agoFix documentation of MemberExpr::getMemberDecl
Stephan Bergmann [Wed, 14 Sep 2016 14:03:50 +0000 (14:03 +0000)]
Fix documentation of MemberExpr::getMemberDecl

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

llvm-svn: 281469

7 years ago[OMPT] fix task frame information for gomp interface
Jonas Hahnfeld [Wed, 14 Sep 2016 13:59:39 +0000 (13:59 +0000)]
[OMPT] fix task frame information for gomp interface

Previous differencials D23305-D23310 changed task frame information management only for the kmp interface, but not for the whole gomp interface. This broke some testcases when building with gcc.
This patch fixes the broken task frame information for the gomp interface.

Patch by Joachim Protze!

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

llvm-svn: 281468

7 years ago[OMPT] save exit address to lwt if available
Jonas Hahnfeld [Wed, 14 Sep 2016 13:59:31 +0000 (13:59 +0000)]
[OMPT] save exit address to lwt if available

In case, the current team is a serialized team (lwt), the frame information should be written to this data structure.
Before, nested serialized teams would overwrite the same task information.

Patch by Joachim Protze!

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

llvm-svn: 281467

7 years ago[OMPT] fix __ompt_get_teaminfo to consult lwt entries of parent teams
Jonas Hahnfeld [Wed, 14 Sep 2016 13:59:24 +0000 (13:59 +0000)]
[OMPT] fix __ompt_get_teaminfo to consult lwt entries of parent teams

The comment already states, that this function should work similarly as __ompt_get_taskinfo.

The function only looked for lwt entries of the current team, but not when unrolling the parents. This fix aligns the implementation to __ompt_get_taskinfo.

The new test case creates a single theaded team (->lwt) and then a nested active team.
Before the innermost print_id(1) would deliver a different team then the outer print_id(0).

Patch by Joachim Protze!

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

llvm-svn: 281466

7 years ago[OMPT] Reset task exit frame when execution is finished
Jonas Hahnfeld [Wed, 14 Sep 2016 13:59:19 +0000 (13:59 +0000)]
[OMPT] Reset task exit frame when execution is finished

The exit address is set when execution of a task is started and should be reset as soon as the execution is finished.
Especially for the asm implementation of __kmp_invoke_microtask, resetting in this call would be painfull, so reset just after the invokation.

The testcase shows the effect of this patch:
Before, the implicit barriers at the end of an implicit task would see an exit address for the implicit task.

This barrier is a task scheduling point. Thus, any explicit task scheduled there would see an exit, but no reenter address for the implicit task.

Patch by Joachim Protze!

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

llvm-svn: 281465

7 years ago[OMPT] Align implementation of reenter frame address to latest (frozen) version of...
Jonas Hahnfeld [Wed, 14 Sep 2016 13:59:13 +0000 (13:59 +0000)]
[OMPT] Align implementation of reenter frame address to latest (frozen) version of OMPT spec

The latest OMPT spec changed the semantic of a tasks reenter frame to be the application frame, that will be entered, when the runtime frame drops.
Before it was the last frame in the runtime. This doesn't work for some gcc execution pathes or even clang generated code for :
Since there is no runtime frame between the executed task and the encountering task.

The test case compares exit and reenter addresses against addresses captured in application code

Patch by Joachim Protze!

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

llvm-svn: 281464

7 years ago[OMPT] extend ompt tests by checks for frame pointers
Jonas Hahnfeld [Wed, 14 Sep 2016 13:59:05 +0000 (13:59 +0000)]
[OMPT] extend ompt tests by checks for frame pointers

OMPT tests can check for right frame information of tasks:
 * parent_task_frame was directly printed as a pointer, but actually points to a struct ompt_frame {void*, void*}
 * NULL is printed in the beginning of execution and loaded to FileChecker variable [[NULL]]
 * implicit tasks now also print their frame information
 * macro to print frame address from application
 * print task info for barrier begin

Patch by Joachim Protze!

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

llvm-svn: 281463

7 years ago[tsan] Fix hanging gcd-apply and gcd-apply-race tests on macOS Sierra
Kuba Brecka [Wed, 14 Sep 2016 13:53:06 +0000 (13:53 +0000)]
[tsan] Fix hanging gcd-apply and gcd-apply-race tests on macOS Sierra

llvm-svn: 281462

7 years ago[cmake] Support overriding llvm-config query results
Michal Gorny [Wed, 14 Sep 2016 13:42:31 +0000 (13:42 +0000)]
[cmake] Support overriding llvm-config query results

Support overriding LLVM_* variables obtained from llvm-config when doing
stand-alone builds. The override of LLVM_MAIN_SRC_DIR is necessary to
provide LLVM sources when the initial directory used to build LLVM does
no longer exist when compiler-rt is built stand-alone. This is
especially the case when building the projects separately in temporary
directories with unpredictable names.

The code is based on existing CMakeLists.txt from clang. Alike clang, it
extends the override to all queried variables.

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

llvm-svn: 281461

7 years ago[clang-tidy] Add dependency on clangAnalysis to clangTidyMiscModule
Martin Bohme [Wed, 14 Sep 2016 13:33:11 +0000 (13:33 +0000)]
[clang-tidy] Add dependency on clangAnalysis to clangTidyMiscModule

Summary:
This is needed for the recently submitted misc-use-after-move check (rL281453).
For some reason, this still built under Linux, but it caused the PPC build bot
to fail.

Subscribers: beanz, cfe-commits, mgorny

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

llvm-svn: 281460

7 years agoreverting r281456
Kirill Bobyrev [Wed, 14 Sep 2016 13:23:14 +0000 (13:23 +0000)]
reverting r281456

llvm-svn: 281459

7 years ago[ELF] - Implemented --section-start, -Ttext, -Tdata, -Tbss options.
George Rimar [Wed, 14 Sep 2016 13:07:13 +0000 (13:07 +0000)]
[ELF] - Implemented --section-start, -Ttext, -Tdata, -Tbss options.

--section-start=sectionname=org
Locate a section in the output file at the absolute address given by org.
You may use this option as many times as necessary to locate multiple sections in the command line.
 org must be a single hexadecimal integer; for compatibility with other linkers,
you may omit the leading `0x' usually associated with hexadecimal values.
Note: there should be no white space between sectionname, the equals sign (“<=>”), and org.

-Tbss=org
-Tdata=org
-Ttext=org
Same as --section-start, with .bss, .data or .text as the sectionname.

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

llvm-svn: 281458

7 years agoSupports adding insertion around non-insertion replacements.
Eric Liu [Wed, 14 Sep 2016 13:04:51 +0000 (13:04 +0000)]
Supports adding insertion around non-insertion replacements.

Summary:
Extend `tooling::Replacements::add()` to support adding order-independent replacements.

Two replacements are considered order-independent if one of the following conditions is true:
  - They do not overlap. (This is already supported.)
  - One replacement is insertion, and the other is a replacement with
    length > 0, and the insertion is adjecent to but not contained in the
    other replacement. In this case, the replacement should always change
    the original code instead of the inserted text.

Reviewers: klimek, djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 281457

7 years ago[clang-rename] Merge rename-{at|all} & optimize.
Kirill Bobyrev [Wed, 14 Sep 2016 13:00:36 +0000 (13:00 +0000)]
[clang-rename] Merge rename-{at|all} & optimize.

Having both rename-at and rename-all both seems confusing and introduces
unneeded difficulties. Allowing to use both -qualified-name and -offset at once
while performing efficient renamings seems like a feature, too. Maintaining main
function wrappers and custom help becomes redundant while CLI becomes less
confusing.

Reviewers: alexfh

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

llvm-svn: 281456

7 years ago[clang-tidy] Make test for misc-use-after-move pass under Windows
Martin Bohme [Wed, 14 Sep 2016 12:22:35 +0000 (12:22 +0000)]
[clang-tidy] Make test for misc-use-after-move pass under Windows

Summary: Adds -fno-delayed-template-parsing

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 281455

7 years agoUse murmurhash2 instead of fnv.
Rafael Espindola [Wed, 14 Sep 2016 11:32:57 +0000 (11:32 +0000)]
Use murmurhash2 instead of fnv.

It is substantially faster by processing 8 bytes at a time.

llvm-svn: 281454

7 years ago[clang-tidy] Add check 'misc-use-after-move'
Martin Bohme [Wed, 14 Sep 2016 10:29:32 +0000 (10:29 +0000)]
[clang-tidy] Add check 'misc-use-after-move'

Summary:
The check warns if an object is used after it has been moved, without an
intervening reinitialization.

See user-facing documentation for details.

Reviewers: sbenza, Prazek, alexfh

Subscribers: beanz, mgorny, shadeware, omtcyfz, Eugene.Zelenko, Prazek, fowles, ioeric, cfe-commits

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

llvm-svn: 281453

7 years agoRevert "[modules] When merging one definition into another, propagate the list of...
Eric Liu [Wed, 14 Sep 2016 10:05:10 +0000 (10:05 +0000)]
Revert "[modules] When merging one definition into another, propagate the list of re-exporting modules from the discarded definition to the retained definition."

This reverts commit r281429.

llvm-svn: 281452

7 years agoRevert "[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently"
James Molloy [Wed, 14 Sep 2016 09:45:28 +0000 (09:45 +0000)]
Revert "[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently"

This reverts commit r281323. It caused chromium test failures and a selfhost failure.

llvm-svn: 281451

7 years agoMissing includes.
Vassil Vassilev [Wed, 14 Sep 2016 08:55:18 +0000 (08:55 +0000)]
Missing includes.

llvm-svn: 281450

7 years ago[ELF] Replace HasContents with HasSections. NFC
Eugene Leviant [Wed, 14 Sep 2016 08:32:36 +0000 (08:32 +0000)]
[ELF] Replace HasContents with HasSections. NFC

llvm-svn: 281449

7 years agoGlobalISel: mark pointer stores as legal on AArch64.
Tim Northover [Wed, 14 Sep 2016 08:28:54 +0000 (08:28 +0000)]
GlobalISel: mark pointer stores as legal on AArch64.

llvm-svn: 281448

7 years agoThis reapplies r281304. The issue was that I had missed
Sjoerd Meijer [Wed, 14 Sep 2016 08:20:03 +0000 (08:20 +0000)]
This reapplies r281304. The issue was that I had missed
to copy the new isAdd field in the tablegen data structure.

llvm-svn: 281447

7 years agoAVX-512: Fixed a bug in kortest.z intrinsic
Elena Demikhovsky [Wed, 14 Sep 2016 08:06:54 +0000 (08:06 +0000)]
AVX-512: Fixed a bug in kortest.z intrinsic

Lowering was wrong - X86ISD::SETCC node should return i8 type.

llvm-svn: 281446

7 years ago[AVX512BW] Change truncStore action (v16i16->v16i18). It can be legal only with AVX512VL.
Igor Breger [Wed, 14 Sep 2016 08:04:28 +0000 (08:04 +0000)]
[AVX512BW] Change truncStore action (v16i16->v16i18). It can be legal only with AVX512VL.

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

llvm-svn: 281445

7 years ago[asan] Reify ErrorStringFunctionSizeOverflow
Filipe Cabecinhas [Wed, 14 Sep 2016 07:37:20 +0000 (07:37 +0000)]
[asan] Reify ErrorStringFunctionSizeOverflow

Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html

Reviewers: kcc, eugenis, vitalybuka

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281444

7 years ago[asan] Reify ErrorStringFunctionMemoryRangesOverlap
Filipe Cabecinhas [Wed, 14 Sep 2016 07:37:14 +0000 (07:37 +0000)]
[asan] Reify ErrorStringFunctionMemoryRangesOverlap

Summary: Continuing implementation mentioned in this thread: http://lists.llvm.org/pipermail/llvm-dev/2016-July/101933.html

Reviewers: kcc, eugenis, vitalybuka

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 281443

7 years ago[X86] Remove the VCVTSI2SD32 with rounding intrinsic. It's not used by clang and...
Craig Topper [Wed, 14 Sep 2016 06:27:46 +0000 (06:27 +0000)]
[X86] Remove the VCVTSI2SD32 with rounding intrinsic. It's not used by clang and not needed since 32-bit integer to double is always exact.

llvm-svn: 281442

7 years agoPerform copying to created arrays according to the packing transformation
Roman Gareev [Wed, 14 Sep 2016 06:26:09 +0000 (06:26 +0000)]
Perform copying to created arrays according to the packing transformation

This is the fourth patch to apply the BLIS matmul optimization pattern on matmul
kernels (http://www.cs.utexas.edu/users/flame/pubs/TOMS-BLIS-Analytical.pdf).
BLIS implements gemm as three nested loops around a macro-kernel, plus two
packing routines. The macro-kernel is implemented in terms of two additional
loops around a micro-kernel. The micro-kernel is a loop around a rank-1
(i.e., outer product) update. In this change we perform copying to created
arrays, which is the last step to implement the packing transformation.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D23260

llvm-svn: 281441

7 years agoDocument option '-rtlib' in clang's man page and help info
Jonas Hahnfeld [Wed, 14 Sep 2016 05:52:21 +0000 (05:52 +0000)]
Document option '-rtlib' in clang's man page and help info

This patch adds an entry for "-rtlib" in the output of `man clang` and `clang -help`.

Patch by Lei Zhang!

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

llvm-svn: 281440

7 years agoCreate a getelementptr instead of sub expr for ValueOffsetPair if the
Wei Mi [Wed, 14 Sep 2016 04:39:50 +0000 (04:39 +0000)]
Create a getelementptr instead of sub expr for ValueOffsetPair if the
value is a pointer.

This patch is to fix PR30213. When expanding an expr based on ValueOffsetPair,
if the value is of pointer type, we can only create a getelementptr instead
of sub expr.

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

llvm-svn: 281439

7 years agoEnsure Polly linking works without BUILD_SHARED_LIBS
Tobias Grosser [Wed, 14 Sep 2016 03:09:48 +0000 (03:09 +0000)]
Ensure Polly linking works without BUILD_SHARED_LIBS

This change ensures all necessary symbols are resolved correctly. Before this
change on some systems, the linker may have eliminated some symbols not directly
used in bugpoint, but used in Polly.

Suggested-by: Michael Kruse <lvm@meinersbur.de>
llvm-svn: 281438

7 years agogold: Simplify. Do not unnecessarily enumerate Obj's symbols.
Peter Collingbourne [Wed, 14 Sep 2016 02:55:16 +0000 (02:55 +0000)]
gold: Simplify. Do not unnecessarily enumerate Obj's symbols.

llvm-svn: 281437

7 years ago[docs] Fix formatting of &nbsp; characters so that tables line up properly. Add
Richard Smith [Wed, 14 Sep 2016 02:24:50 +0000 (02:24 +0000)]
[docs] Fix formatting of &nbsp; characters so that tables line up properly. Add
padding around table cells so the borders of adjacent tables don't run into
each other (now that they're perfectly aligned).

llvm-svn: 281436

7 years ago[libFuzzer] start using trace-pc-guard as an alternative source of coverage
Kostya Serebryany [Wed, 14 Sep 2016 02:13:06 +0000 (02:13 +0000)]
[libFuzzer] start using trace-pc-guard as an alternative source of coverage

llvm-svn: 281435

7 years ago[docs] Order diagnostic cross-references alphabetically rather than based on
Richard Smith [Wed, 14 Sep 2016 01:55:42 +0000 (01:55 +0000)]
[docs] Order diagnostic cross-references alphabetically rather than based on
order in the .td file.

llvm-svn: 281434

7 years agoUpdate DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics and groups...
Richard Smith [Wed, 14 Sep 2016 01:51:10 +0000 (01:51 +0000)]
Update DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics and groups in a deterministic order.

llvm-svn: 281433

7 years ago[sanitizer-coverage] add yet another flavour of coverage instrumentation: trace-pc...
Kostya Serebryany [Wed, 14 Sep 2016 01:39:49 +0000 (01:39 +0000)]
[sanitizer-coverage] add yet another flavour of coverage instrumentation: trace-pc-guard. The intent is to eventually replace all of {bool coverage, 8bit-counters, trace-pc} with just this one. Clang part

llvm-svn: 281432

7 years ago[sanitizer-coverage] add yet another flavour of coverage instrumentation: trace-pc...
Kostya Serebryany [Wed, 14 Sep 2016 01:39:35 +0000 (01:39 +0000)]
[sanitizer-coverage] add yet another flavour of coverage instrumentation: trace-pc-guard. The intent is to eventually replace all of {bool coverage, 8bit-counters, trace-pc} with just this one. LLVM part

llvm-svn: 281431

7 years agoFollow-up to r281367: Compare uuids case-insensitively.
Nico Weber [Wed, 14 Sep 2016 01:16:54 +0000 (01:16 +0000)]
Follow-up to r281367: Compare uuids case-insensitively.

llvm-svn: 281430

7 years ago[modules] When merging one definition into another, propagate the list of
Richard Smith [Wed, 14 Sep 2016 01:05:35 +0000 (01:05 +0000)]
[modules] When merging one definition into another, propagate the list of
re-exporting modules from the discarded definition to the retained definition.

llvm-svn: 281429

7 years agoCleaned up the code that handles function return addresses in "frame diagnose."
Sean Callanan [Wed, 14 Sep 2016 00:48:19 +0000 (00:48 +0000)]
Cleaned up the code that handles function return addresses in "frame diagnose."

llvm-svn: 281428

7 years agoColor warnings purple rather than orange, to match actual Clang output.
Richard Smith [Wed, 14 Sep 2016 00:35:56 +0000 (00:35 +0000)]
Color warnings purple rather than orange, to match actual Clang output.

llvm-svn: 281427

7 years agoTurn a no-op assignment into an assertion.
Rui Ueyama [Wed, 14 Sep 2016 00:09:50 +0000 (00:09 +0000)]
Turn a no-op assignment into an assertion.

r279456 guarantees that this condition is always satisfied.

llvm-svn: 281426

7 years agoSimplify InputFile ownership management.
Rui Ueyama [Wed, 14 Sep 2016 00:05:51 +0000 (00:05 +0000)]
Simplify InputFile ownership management.

Previously, all input files were owned by the symbol table.
Files were created at various places, such as the Driver, the lazy
symbols, or the bitcode compiler, and the ownership of new files
was transferred to the symbol table using std::unique_ptr.
All input files were then free'd when the symbol table is freed
which is on program exit.

I think we don't have to transfer ownership just to free all
instance at once on exit.

In this patch, all instances are automatically collected to a
vector and freed on exit. In this way, we no longer have to
use std::unique_ptr.

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

llvm-svn: 281425

7 years ago[SE] Pack global dev handle addresses
Jason Henline [Tue, 13 Sep 2016 23:59:10 +0000 (23:59 +0000)]
[SE] Pack global dev handle addresses

Summary:
We were packing global device memory handles in
`PackedKernelArgumentArray`, but as I was implementing the CUDA
platform, I realized that CUDA wants the address of the handle, not the
handle itself. So this patch switches to packing the address of the
handle.

Reviewers: jlebar

Subscribers: jprice, jlebar, parallel_libs-commits

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

llvm-svn: 281424

7 years agoDevice doc says device is small
Jason Henline [Tue, 13 Sep 2016 23:56:47 +0000 (23:56 +0000)]
Device doc says device is small

llvm-svn: 281423

7 years ago[SE] Platforms return Device values
Jason Henline [Tue, 13 Sep 2016 23:56:46 +0000 (23:56 +0000)]
[SE] Platforms return Device values

Summary:
Platforms were returning Device pointers, but a Device is now basically
just a pointer to an underlying PlatformDevice, so we will now just pass
it around as a value.

Reviewers: jlebar

Subscribers: jprice, jlebar, parallel_libs-commits

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

llvm-svn: 281422

7 years agoAddress Pete's review comment and define OrigArg on its own line.
Akira Hatanaka [Tue, 13 Sep 2016 23:53:43 +0000 (23:53 +0000)]
Address Pete's review comment and define OrigArg on its own line.

This is a follow-up to r281419.

llvm-svn: 281421

7 years agoForce c++14 when running tests on Windows.
Zachary Turner [Tue, 13 Sep 2016 23:45:11 +0000 (23:45 +0000)]
Force c++14 when running tests on Windows.

VS 2015 and higher begin making use of c++14 in their standard
library headers.  As such, -std=c++11 makes it so you can't compile
trivial programs.  Bump this to -std=c++14 when this situation is
detected.

llvm-svn: 281420

7 years ago[ObjCARC] Traverse chain downwards to replace uses of argument passed to
Akira Hatanaka [Tue, 13 Sep 2016 23:43:11 +0000 (23:43 +0000)]
[ObjCARC] Traverse chain downwards to replace uses of argument passed to
ObjC library call with call return.

ARC contraction tries to replace uses of an argument passed to an
objective-c library call with the call return value. For example, in the
following IR, it replaces uses of argument %9 and uses of the values
discovered traversing the chain upwards (%7 and %8) with the call return
%10, if they are dominated by the call to @objc_autoreleaseReturnValue.
This transformation enables code-gen to tail-call the call to
@objc_autoreleaseReturnValue, which is necessary to enable auto release
return value optimization.

%7 = tail call i8* @objc_loadWeakRetained(i8** %6)
%8 = bitcast i8* %7 to %0*
%9 = bitcast %0* %8 to i8*
%10 = tail call i8* @objc_autoreleaseReturnValue(i8* %9)
ret %0* %8

Since r276727, llvm started removing redundant bitcasts and as a result
started feeding the following IR to ARC contraction:

%7 = tail call i8* @objc_loadWeakRetained(i8** %6)
%8 = bitcast i8* %7 to %0*
%9 = tail call i8* @objc_autoreleaseReturnValue(i8* %7)
ret %0* %8

ARC contraction no longer does the optimization described above since it
only traverses the chain upwards and fails to recognize that the
function return can be replaced by the call return. This commit changes
ARC contraction to traverse the chain downwards too and replace uses of
bitcasts with the call return.

rdar://problem/28011339

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

llvm-svn: 281419

7 years agoTestQueues could error out because the one second sleep main.c was
Jason Molenda [Tue, 13 Sep 2016 23:29:46 +0000 (23:29 +0000)]
TestQueues could error out because the one second sleep main.c was
using to enqueue all the jobs wasn't enough time on a slow/overloaded
system.  Instead use a global to indicate when all the work has
been enqueued, let's see if this makes the CIs work more reliably.

llvm-svn: 281418

7 years ago[SE] KernelSpec return best PTX
Jason Henline [Tue, 13 Sep 2016 23:29:25 +0000 (23:29 +0000)]
[SE] KernelSpec return best PTX

Summary:
Before, the kernel spec would only return PTX for exactly the requested
compute capability. With this patch it will now return the PTX with the
largest compute capability that does not exceed that requested compute
capability.

Reviewers: jlebar

Subscribers: jprice, jlebar, parallel_libs-commits

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

llvm-svn: 281417

7 years agoMissed update from r281412.
Richard Smith [Tue, 13 Sep 2016 23:03:41 +0000 (23:03 +0000)]
Missed update from r281412.

llvm-svn: 281415

7 years ago[llvm-cov] Just emit the version number in the index file
Vedant Kumar [Tue, 13 Sep 2016 23:00:13 +0000 (23:00 +0000)]
[llvm-cov] Just emit the version number in the index file

Having the version information in every view is distracting, especially
if there are several sub-views.

llvm-svn: 281414