platform/upstream/llvm.git
7 years agoRevert "[AMDGPU] fix failure on printing of non-existing instruction operands."
Valery Pykhtin [Thu, 11 Aug 2016 14:22:05 +0000 (14:22 +0000)]
Revert "[AMDGPU] fix failure on printing of non-existing instruction operands."

This reverts revision 278333, newly added test failed.

llvm-svn: 278336

7 years agoMake sure files include what they use (part 2/2)
Pavel Labath [Thu, 11 Aug 2016 14:12:10 +0000 (14:12 +0000)]
Make sure files include what they use (part 2/2)

This makes lldb still compile on linux after a project-wide clang-format

llvm-svn: 278335

7 years agoExtend trip count instead of truncating IV in LFTR, when legal
Ehsan Amiri [Thu, 11 Aug 2016 13:51:20 +0000 (13:51 +0000)]
Extend trip count instead of truncating IV in LFTR, when legal

When legal, extending trip count in the loop control logic generates better code compared to truncating IV. This is because

(1) extending trip count is a loop invariant operation (see genLoopLimit where we prove trip count is loop invariant).
(2) Scalar Evolution seems to have problems understanding trunc when computing loop trip count. So removing them allows better analysis performed in Scalar Evolution. (In particular this fixes PR 28363 which is the motivation for this change).

I am not going to perform any performance test. Any degradation caused by this should be an indication of a bug elsewhere.

To prove legality, we rely on SCEV to prove zext(trunc(IV)) == IV (or similarly for sext). If this holds, we can prove equivalence of trunc(IV)==ExitCnt (1) and IV == zext(ExitCnt). Simply take zext of boths sides of (1) and apply the proven equivalence.

https://reviews.llvm.org/D23075

llvm-svn: 278334

7 years ago[AMDGPU] fix failure on printing of non-existing instruction operands.
Valery Pykhtin [Thu, 11 Aug 2016 13:49:46 +0000 (13:49 +0000)]
[AMDGPU] fix failure on printing of non-existing instruction operands.

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

llvm-svn: 278333

7 years agoFixes for hierarchical barrier (possible hang if team size changed).
Andrey Churbanov [Thu, 11 Aug 2016 13:04:00 +0000 (13:04 +0000)]
Fixes for hierarchical barrier (possible hang if team size changed).

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

llvm-svn: 278332

7 years agoRevert "Resolution-based LTO API."
Teresa Johnson [Thu, 11 Aug 2016 13:03:56 +0000 (13:03 +0000)]
Revert "Resolution-based LTO API."

This reverts commit r278330.

I made a change to the save temps output that is causing issues with the
bots. Didn't realize this because I had older output files sitting on
disk in my test output directory.

llvm-svn: 278331

7 years agoResolution-based LTO API.
Teresa Johnson [Thu, 11 Aug 2016 12:56:40 +0000 (12:56 +0000)]
Resolution-based LTO API.

Summary:
This introduces a resolution-based LTO API. The main advantage of this API over
existing APIs is that it allows the linker to supply a resolution for each
symbol in each object, rather than the combined object as a whole. This will
become increasingly important for use cases such as ThinLTO which require us
to process symbol resolutions in a more complicated way than just adjusting
linkage.

Patch by Peter Collingbourne.

Reviewers: rafael, tejohnson, mehdi_amini

Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits

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

Address review comments

llvm-svn: 278330

7 years agoFixed VS2015 (Update 3) warning - differing const/volatile qualifiers for overridden...
Simon Pilgrim [Thu, 11 Aug 2016 12:19:43 +0000 (12:19 +0000)]
Fixed VS2015 (Update 3) warning - differing const/volatile qualifiers for overridden function

Dropped the const qualifier to match llvm::CallLowering::lowerCall

llvm-svn: 278329

7 years ago[AVX512] Fix extractelement i1 lowering.
Igor Breger [Thu, 11 Aug 2016 12:13:46 +0000 (12:13 +0000)]
[AVX512] Fix extractelement i1 lowering.
The previous implementation (not custom) doesn't enforce zeroing off upper bits. The assumption is that i1 PRODUCER (truncate and extractelement) must zero all upper bits, so i1 CONSUMER instructions ( test, zext, save, etc) can be done without additional zeroing.
Make extractelement i1 lowering custom for all vector i1.

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

llvm-svn: 278328

7 years ago[Core] Retire addReplacement() member function.
Davide Italiano [Thu, 11 Aug 2016 10:50:01 +0000 (10:50 +0000)]
[Core] Retire addReplacement() member function.

llvm-svn: 278327

7 years agoMake sure LldbGdbServerTestCase is built in arm mode to avoid failures due thumb...
Omair Javaid [Thu, 11 Aug 2016 10:35:05 +0000 (10:35 +0000)]
Make sure LldbGdbServerTestCase is built in arm mode to avoid failures due thumb instructions

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

llvm-svn: 278326

7 years agoRemove a double send of eRunPacketSent event
Pavel Labath [Thu, 11 Aug 2016 09:22:22 +0000 (09:22 +0000)]
Remove a double send of eRunPacketSent event

I accidentaly added the send both to the base class and the derived class in my refactor. Fix
that.

llvm-svn: 278325

7 years ago[clang-tidy] fix readability-else-after-return test
Kirill Bobyrev [Thu, 11 Aug 2016 08:18:39 +0000 (08:18 +0000)]
[clang-tidy] fix readability-else-after-return test

As pointed by Yung Douglas, exceptions in
test/clang-tidy/readability-else-after-return.cpp are causing PS4 bots to be
red, because exceptions aren't enabled by default on PS4 target. This patch is a
fix.

llvm-svn: 278324

7 years agoUnbreak C++03 build.
Eric Fiselier [Thu, 11 Aug 2016 08:15:35 +0000 (08:15 +0000)]
Unbreak C++03 build.

llvm-svn: 278323

7 years ago[ELF] Symbol assignment within output section description
Eugene Leviant [Thu, 11 Aug 2016 07:56:43 +0000 (07:56 +0000)]
[ELF] Symbol assignment within output section description

llvm-svn: 278322

7 years agoAvoid false dependencies of undef machine operands
Marina Yatsina [Thu, 11 Aug 2016 07:32:08 +0000 (07:32 +0000)]
Avoid false dependencies of undef machine operands

This patch helps avoid false dependencies on undef registers by updating the machine instructions' undef operand to use a register that the instruction is truly dependent on, or use a register with clearance higher than Pref.

Pseudo example:

loop:
xmm0 = ...
xmm1 = vcvtsi2sdl eax, xmm0<undef>
... = inst xmm0
jmp loop

In this example, selecting xmm0 as the undef register creates false dependency between loop iterations.
This false dependency cannot be solved by inserting an xor before vcvtsi2sdl because xmm0 is alive at the point of the vcvtsi2sdl instruction.
Selecting a different register instead of xmm0, especially a register that is not used in the loop, will eliminate this problem.

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

llvm-svn: 278321

7 years ago[Debug Info] Added a LIT test that covers the fix committed in rL277290.
Amjad Aboud [Thu, 11 Aug 2016 07:22:53 +0000 (07:22 +0000)]
[Debug Info] Added a LIT test that covers the fix committed in rL277290.

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

llvm-svn: 278320

7 years agoRefactor test archetypes implementation.
Eric Fiselier [Thu, 11 Aug 2016 07:04:14 +0000 (07:04 +0000)]
Refactor test archetypes implementation.

llvm-svn: 278319

7 years ago[AVX-512] Promote 512-bit integer loads to v8i64 similar to what is done for 128...
Craig Topper [Thu, 11 Aug 2016 06:04:07 +0000 (06:04 +0000)]
[AVX-512] Promote 512-bit integer loads to v8i64 similar to what is done for 128/256-bit vectors for overall consistency.

llvm-svn: 278318

7 years ago[AVX-512] Add patterns to allow EVEX encoded stores of v16i16/v8i16/v16i8/v32i8 even...
Craig Topper [Thu, 11 Aug 2016 06:04:04 +0000 (06:04 +0000)]
[AVX-512] Add patterns to allow EVEX encoded stores of v16i16/v8i16/v16i8/v32i8 even when BWI is not supported.

llvm-svn: 278317

7 years ago[AVX-512] Fix the 128-bit and 256-bit nontemporal load patterns with elements type...
Craig Topper [Thu, 11 Aug 2016 06:04:00 +0000 (06:04 +0000)]
[AVX-512] Fix the 128-bit and 256-bit nontemporal load patterns with elements type other than i64. These loads have all been promoted to v2i64/v4i64 loads so we need bitcasts or we end up selecting VMOVDQA32/VMOVDQU32 instead.

llvm-svn: 278316

7 years agobindings: expose diagnostic formatting to Python
Saleem Abdulrasool [Thu, 11 Aug 2016 05:31:07 +0000 (05:31 +0000)]
bindings: expose diagnostic formatting to Python

This makes it easier for tools using the Python libclang bindings to display
diagnostics in a manner consistent with clang.

Patch by Omar Sandoval!

llvm-svn: 278315

7 years ago[Profile] improve warning control option
Xinliang David Li [Thu, 11 Aug 2016 05:09:30 +0000 (05:09 +0000)]
[Profile] improve warning control option

Change --no-pgo-warn-missing to -pgo-warn-missing-function
and negate the default. /NFC

Add more test to make sure the warning is off by default

llvm-svn: 278314

7 years ago[WebAssembly] Cleanup trailing whitespace
Dominic Chen [Thu, 11 Aug 2016 04:10:56 +0000 (04:10 +0000)]
[WebAssembly] Cleanup trailing whitespace

Summary: Test for commit access.

Subscribers: jfb, dschuff

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

llvm-svn: 278313

7 years agoMake more fields of InlineParams Optional.
Easwaran Raman [Thu, 11 Aug 2016 03:58:05 +0000 (03:58 +0000)]
Make more fields of InlineParams Optional.

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

llvm-svn: 278312

7 years agoAdd missing REQUIRES for C++14
Eric Fiselier [Thu, 11 Aug 2016 03:33:41 +0000 (03:33 +0000)]
Add missing REQUIRES for C++14

llvm-svn: 278311

7 years ago[libcxx] Add std::any
Eric Fiselier [Thu, 11 Aug 2016 03:13:11 +0000 (03:13 +0000)]
[libcxx] Add std::any

Summary:
This patch adds std::any by moving/adapting <experimental/any>.

This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf)
and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509).

I plan to push it in a day or two if there are no comments.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 278310

7 years ago[Statepoints] Minor cosmetic change; NFC
Sanjoy Das [Thu, 11 Aug 2016 00:56:46 +0000 (00:56 +0000)]
[Statepoints] Minor cosmetic change; NFC

The verification failure message was missing a space.

llvm-svn: 278309

7 years ago[asan] abort_on_error=1 by default on Android.
Evgeniy Stepanov [Thu, 11 Aug 2016 00:26:29 +0000 (00:26 +0000)]
[asan] abort_on_error=1 by default on Android.

With this change, the default behavior on error is to call abort()
instead of _exit(). This should help the OS to capture a tombstone of
the error.

RAM usage of the lit test suite goes up because of all the tombstone
gathering, so I'm limiting the parallelism of the test target.
Previously it was based on the number of the CPUs on the host
machine, which is definitely wrong.

llvm-svn: 278308

7 years ago[MachOYAML] Don't output empty ExportTrie
Chris Bieneman [Thu, 11 Aug 2016 00:20:03 +0000 (00:20 +0000)]
[MachOYAML] Don't output empty ExportTrie

The YAML representation was always outputting the root node of an export trie even if the trie was empty. While this doesn't really have any functional impact, it does add visual clutter to the yaml file.

llvm-svn: 278307

7 years ago[Order Files] Don't use empty order files
Chris Bieneman [Thu, 11 Aug 2016 00:19:51 +0000 (00:19 +0000)]
[Order Files] Don't use empty order files

LD64 does optimization on symbol layouts that gets disabled whenever an order file is passed (even if it is empty). This change prevents disabling that optimization, and still enables iterative generation and usage of order files.

If the order file is empty it does not setup the order file flags, instead it sets the empty order file as a configuration dependency. When the order file changes it will then trigger a re-configuration that adds the linker flag.

llvm-svn: 278306

7 years agodlopen & dlclose can't throw C++ or ObjC exceptions, so don't do the extra work of
Jim Ingham [Thu, 11 Aug 2016 00:15:28 +0000 (00:15 +0000)]
dlopen & dlclose can't throw C++ or ObjC exceptions, so don't do the extra work of
setting & deleting the breakpoints to watch for this.

<rdar://problem/27780214>

llvm-svn: 278305

7 years agoFix a problem where if a uint64_t value is placed into a python dictionary and sent...
Greg Clayton [Wed, 10 Aug 2016 23:25:57 +0000 (23:25 +0000)]
Fix a problem where if a uint64_t value is placed into a python dictionary and sent up to LLDB and converted to StructuredData, it would not be able to parse the full 64 bit value. A number like 0xf000000000000000L could be placed into a dictionary, and sent to LLDB and it would end up being 0xffffffffffffffff since it would overflow a int64_t. We leave the old code there, but if it overflows, we treat the number like a uint64_t and get it to decode correctly. Added a gtest to cover this so we don't regress. I verified the gtest failed prior to the fix, and it succeeds after it.

<rdar://problem/27409265>

llvm-svn: 278304

7 years agoGlobalISel: support same ConstantExprs as Instructions.
Tim Northover [Wed, 10 Aug 2016 23:02:41 +0000 (23:02 +0000)]
GlobalISel: support same ConstantExprs as Instructions.

It's more than just inttoptr, but the others can't be tested until we have
support for non-trivial constants (they currently get unavoidably folded to a
ConstantInt).

llvm-svn: 278303

7 years agoMake pascal debugging work again.
Greg Clayton [Wed, 10 Aug 2016 22:55:26 +0000 (22:55 +0000)]
Make pascal debugging work again.

<rdar://problem/27652051>

llvm-svn: 278302

7 years agoImplement LWG 2148: Make non-enum default hash specialization well-formed
Eric Fiselier [Wed, 10 Aug 2016 22:45:26 +0000 (22:45 +0000)]
Implement LWG 2148: Make non-enum default hash specialization well-formed

Summary:
This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable.

See also:
  * http://cplusplus.github.io/LWG/lwg-active.html#2543
  * https://llvm.org/bugs/show_bug.cgi?id=28917

Reviewers: mclow.lists, EricWF

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 278300

7 years agoCentralize all select() calls into one place so that we can take advantage of system...
Greg Clayton [Wed, 10 Aug 2016 22:43:48 +0000 (22:43 +0000)]
Centralize all select() calls into one place so that we can take advantage of system specific optimizations to deal with more file descriptors than FD_SETSIZE on some systems.

<rdar://problem/25325383>
https://reviews.llvm.org/D22950

llvm-svn: 278299

7 years ago[ADT] Move LLVM_ATTRIBUTE_UNUSED_RESULT to the function, otherwise gcc 4.8 complains...
Tim Shen [Wed, 10 Aug 2016 22:35:38 +0000 (22:35 +0000)]
[ADT] Move LLVM_ATTRIBUTE_UNUSED_RESULT to the function, otherwise gcc 4.8 complains about it.

It's a fix for the original patch r278251.

llvm-svn: 278298

7 years ago[lld][MachO] Fix LC_SEGEMENT[_64] filesize computation in -r mode.
Lang Hames [Wed, 10 Aug 2016 22:15:09 +0000 (22:15 +0000)]
[lld][MachO] Fix LC_SEGEMENT[_64] filesize computation in -r mode.

Using vmsize to populate this file works when outputing MachO images, but fails
when outputting relocatable objects. This patch fixes the computation to use
file offsets, which works for both output types.

Fixes <rdar://problem/27727666>

llvm-svn: 278297

7 years agoGlobalISel: add tests forgotten in r278293.
Tim Northover [Wed, 10 Aug 2016 22:13:48 +0000 (22:13 +0000)]
GlobalISel: add tests forgotten in r278293.

llvm-svn: 278296

7 years ago[Documentation] Improve consistency.
Eugene Zelenko [Wed, 10 Aug 2016 22:00:49 +0000 (22:00 +0000)]
[Documentation] Improve consistency.

Mention Clang-rename Emacs integration in release notes.

llvm-svn: 278295

7 years ago[LangRef] Fix formatting (no semantic change)
Sanjoy Das [Wed, 10 Aug 2016 21:48:24 +0000 (21:48 +0000)]
[LangRef] Fix formatting (no semantic change)

llvm-svn: 278294

7 years agoGlobalISel: implement simple function calls on AArch64.
Tim Northover [Wed, 10 Aug 2016 21:44:01 +0000 (21:44 +0000)]
GlobalISel: implement simple function calls on AArch64.

We're still limited in the arguments we support, but this at least handles the
basic cases.

llvm-svn: 278293

7 years agotsan: Remove __pointer_chk_guard@GLIBC_PRIVATE requirement for AArch64
Adhemerval Zanella [Wed, 10 Aug 2016 21:39:28 +0000 (21:39 +0000)]
tsan: Remove __pointer_chk_guard@GLIBC_PRIVATE requirement for AArch64

Current AArch64 {sig}{set,long}jmp interposing requires accessing glibc
private __pointer_chk_guard to get process xor mask to demangled the
internal {sig}jmp_buf function pointers.

It causes some packing issues, as described in gcc PR#71042 [1], and is
is not a godd practice to rely on a private glibc namespace (since ABI is
not meant to be stable).

This patch fixes it by changing how libtsan obtains the guarded pointer
value: at initialization a specific routine issues a setjmp call and
using the mangled function pointer and the original value derive the
random guarded pointer.

Checked on aarch64 39-bit VMA.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71042

llvm-svn: 278292

7 years agoAMDGPU/SI: Implement amdgcn image intrinsics with sampler
Changpeng Fang [Wed, 10 Aug 2016 21:15:30 +0000 (21:15 +0000)]
AMDGPU/SI: Implement amdgcn image intrinsics with sampler

Summary:
  This patch define and implement amdgcn image intrinsics with sampler.

    1. define vdata type to be llvm_anyfloat_ty, address type to be llvm_anyfloat_ty,
       and rsrc type to be llvm_anyint_ty. As a result, we expect the intrinsics name
       to have three suffixes to overload each of these three types;

    2. D128 as well as two other flags are implied in the three types, for example,
       if you use v8i32 as resource type, then r128 is 0!

    3. don't expose TFE flag, and other flags are exposed in the instruction order:
       unrm, glc, slc, lwe and da.

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

Reviewed by:
  arsenm and tstellarAMD

llvm-svn: 278291

7 years agoChanged sign of LastCallToStaticBouns
Piotr Padlewski [Wed, 10 Aug 2016 21:15:22 +0000 (21:15 +0000)]
Changed sign of LastCallToStaticBouns

Summary:
I think it is much better this way.
When I firstly saw line:
  Cost += InlineConstants::LastCallToStaticBonus;
I though that this is a bug, because everywhere where the cost is being reduced
it is usuing -=.

Reviewers: eraman, tejohnson, mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 278290

7 years agoxfailed TestObjCNewSyntax.py on macOS for gmodules
Todd Fiala [Wed, 10 Aug 2016 21:07:48 +0000 (21:07 +0000)]
xfailed TestObjCNewSyntax.py on macOS for gmodules

Tracked by:
rdar://27792848

llvm-svn: 278289

7 years agoCodegen: Don't tail-duplicate blocks with un-analyzable fallthrough.
Kyle Butt [Wed, 10 Aug 2016 21:03:27 +0000 (21:03 +0000)]
Codegen: Don't tail-duplicate blocks with un-analyzable fallthrough.

If AnalyzeBranch can't analyze a block and it is possible to
fallthrough, then duplicating the block doesn't make sense, as only one
block can be the layout predecessor for the un-analyzable fallthrough.

Submitted wit a test case, but NOTE: the test case doesn't currently
fail. However, the test case fails with D20505 and would have saved me
some time debugging.

llvm-svn: 278288

7 years agoCodeGen: If Convert blocks that would form a diamond when tail-merged.
Kyle Butt [Wed, 10 Aug 2016 20:45:56 +0000 (20:45 +0000)]
CodeGen: If Convert blocks that would form a diamond when tail-merged.

The following function currently relies on tail-merging for if
conversion to succeed. The common tail of cond_true and cond_false is
extracted, and this then forms a diamond pattern that can be
successfully if converted.

If this block does not get extracted, either because tail-merging is
disabled or the threshold is higher, we should still recognize this
pattern and if-convert it.

Fixed a regression in the original commit. Need to un-reverse branches after
reversing them, or other conversions go awry.

define i32 @t2(i32 %a, i32 %b) nounwind {
entry:
        %tmp1434 = icmp eq i32 %a, %b           ; <i1> [#uses=1]
        br i1 %tmp1434, label %bb17, label %bb.outer

bb.outer:               ; preds = %cond_false, %entry
        %b_addr.021.0.ph = phi i32 [ %b, %entry ], [ %tmp10, %cond_false ]
        %a_addr.026.0.ph = phi i32 [ %a, %entry ], [ %a_addr.026.0, %cond_false ]
        br label %bb

bb:             ; preds = %cond_true, %bb.outer
        %indvar = phi i32 [ 0, %bb.outer ], [ %indvar.next, %cond_true ]
        %tmp. = sub i32 0, %b_addr.021.0.ph
        %tmp.40 = mul i32 %indvar, %tmp.
        %a_addr.026.0 = add i32 %tmp.40, %a_addr.026.0.ph
        %tmp3 = icmp sgt i32 %a_addr.026.0, %b_addr.021.0.ph
        br i1 %tmp3, label %cond_true, label %cond_false

cond_true:              ; preds = %bb
        %tmp7 = sub i32 %a_addr.026.0, %b_addr.021.0.ph
        %tmp1437 = icmp eq i32 %tmp7, %b_addr.021.0.ph
        %indvar.next = add i32 %indvar, 1
        br i1 %tmp1437, label %bb17, label %bb

cond_false:             ; preds = %bb
        %tmp10 = sub i32 %b_addr.021.0.ph, %a_addr.026.0
        %tmp14 = icmp eq i32 %a_addr.026.0, %tmp10
        br i1 %tmp14, label %bb17, label %bb.outer

bb17:           ; preds = %cond_false, %cond_true, %entry
        %a_addr.026.1 = phi i32 [ %a, %entry ], [ %tmp7, %cond_true ], [ %a_addr.026.0, %cond_false ]
        ret i32 %a_addr.026.1
}

Without tail-merging or diamond-tail if conversion:
LBB1_1:                                 @ %bb
                                        @ =>This Inner Loop Header: Depth=1
        cmp     r0, r1
        ble     LBB1_3
@ BB#2:                                 @ %cond_true
                                        @   in Loop: Header=BB1_1 Depth=1
        subs    r0, r0, r1
        cmp     r1, r0
        it      ne
        cmpne   r0, r1
        bgt     LBB1_4
LBB1_3:                                 @ %cond_false
                                        @   in Loop: Header=BB1_1 Depth=1
        subs    r1, r1, r0
        cmp     r1, r0
        bne     LBB1_1
LBB1_4:                                 @ %bb17
        bx      lr

With diamond-tail if conversion, but without tail-merging:
@ BB#0:                                 @ %entry
        cmp     r0, r1
        it      eq
        bxeq    lr
LBB1_1:                                 @ %bb
                                        @ =>This Inner Loop Header: Depth=1
        cmp     r0, r1
        ite     le
        suble   r1, r1, r0
        subgt   r0, r0, r1
        cmp     r1, r0
        bne     LBB1_1
@ BB#2:                                 @ %bb17
        bx      lr

llvm-svn: 278287

7 years agoFix the lookup of dictionary values by name to not do a linear search.
Greg Clayton [Wed, 10 Aug 2016 20:37:45 +0000 (20:37 +0000)]
Fix the lookup of dictionary values by name to not do a linear search.

llvm-svn: 278286

7 years agoDisable sancov tests failing due to apparent endianness issues
Reid Kleckner [Wed, 10 Aug 2016 20:11:35 +0000 (20:11 +0000)]
Disable sancov tests failing due to apparent endianness issues

Undoes some of the effect of r278271

llvm-svn: 278285

7 years ago[sancov] Port sancov -print-coverage-pcs to COFF
Reid Kleckner [Wed, 10 Aug 2016 20:08:19 +0000 (20:08 +0000)]
[sancov] Port sancov -print-coverage-pcs to COFF

The export table is not considered part of the object file symbol table,
so we have to look through it separately.

Reviewers: kcc

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

llvm-svn: 278284

7 years agostd:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.
Marshall Clow [Wed, 10 Aug 2016 20:04:46 +0000 (20:04 +0000)]
std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.

llvm-svn: 278282

7 years agoFix UB in APInt::ashr
Jonathan Roelofs [Wed, 10 Aug 2016 19:50:14 +0000 (19:50 +0000)]
Fix UB in APInt::ashr

i64 -1, whose sign bit is the 0th one, can't be left shifted without invoking UB.

https://reviews.llvm.org/D23362

llvm-svn: 278280

7 years ago[Documentation] Fix style and grammar mistake in Clang-tidy readability-else-after...
Eugene Zelenko [Wed, 10 Aug 2016 19:49:38 +0000 (19:49 +0000)]
[Documentation] Fix style and grammar mistake in Clang-tidy readability-else-after-return description spotted by Alexander Kornienko.

llvm-svn: 278279

7 years agoAMDGPU: s_setpc_b64 should be an indirect branch
Matt Arsenault [Wed, 10 Aug 2016 19:20:02 +0000 (19:20 +0000)]
AMDGPU: s_setpc_b64 should be an indirect branch

llvm-svn: 278278

7 years agoAMDGPU: Set sizes on control flow pseudos
Matt Arsenault [Wed, 10 Aug 2016 19:11:51 +0000 (19:11 +0000)]
AMDGPU: Set sizes on control flow pseudos

llvm-svn: 278276

7 years agoAMDGPU: Remove empty file comment
Matt Arsenault [Wed, 10 Aug 2016 19:11:48 +0000 (19:11 +0000)]
AMDGPU: Remove empty file comment

llvm-svn: 278275

7 years agoAMDGPU: Remove unnecessary cast
Matt Arsenault [Wed, 10 Aug 2016 19:11:45 +0000 (19:11 +0000)]
AMDGPU: Remove unnecessary cast

llvm-svn: 278274

7 years agoAMDGPU: Change insertion point of si_mask_branch
Matt Arsenault [Wed, 10 Aug 2016 19:11:42 +0000 (19:11 +0000)]
AMDGPU: Change insertion point of si_mask_branch

Insert before the skip branch if one is created.
This is a somewhat more natural placement relative
to the skip branches, and makes it possible to implement
analyzeBranch for skip blocks.

The test changes are mostly due to a quirk where
the block label is not emitted if there is a terminator
that is not also a branch.

llvm-svn: 278273

7 years agoAMDGPU: Use CreateStackObject instead of CreateSpillStackObject
Matt Arsenault [Wed, 10 Aug 2016 19:11:36 +0000 (19:11 +0000)]
AMDGPU: Use CreateStackObject instead of CreateSpillStackObject

I'm not sure what the difference is, but no other target
uses this for emergency spill slots.

llvm-svn: 278272

7 years ago[sancov] Run more sancov tests on non-x86-Linux machines
Reid Kleckner [Wed, 10 Aug 2016 19:03:18 +0000 (19:03 +0000)]
[sancov] Run more sancov tests on non-x86-Linux machines

Add the $arch-registered-target features that clang uses to disable
tests that require a registered backend, so that we can run the sancov
tests on Windows. LLVM's lit suite did not appear to have a per-test way
to do this, and I would rather not split up the sancov tests into
architecture directories.

Split out of https://reviews.llvm.org/D23321

llvm-svn: 278271

7 years ago[x86, AVX] allow FP vector select folding to bitwise logic ops (PR28895)
Sanjay Patel [Wed, 10 Aug 2016 19:00:11 +0000 (19:00 +0000)]
[x86, AVX] allow FP vector select folding to bitwise logic ops (PR28895)

This handles the case in:
https://llvm.org/bugs/show_bug.cgi?id=28895

...but we are not getting all of the possibilities yet.
Eg, we use 'X86::FANDN' for scalar FP select combines.

That enhancement is filed as:
https://llvm.org/bugs/show_bug.cgi?id=28925

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

llvm-svn: 278270

7 years ago[IndVarSimplify] Eliminate zext of a signed IV when the IV is known to be non-negative
Andrew Kaylor [Wed, 10 Aug 2016 18:56:35 +0000 (18:56 +0000)]
[IndVarSimplify] Eliminate zext of a signed IV when the IV is known to be non-negative

Patch by Li Huang

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

llvm-svn: 278269

7 years agoLiveIntervalAnalysis: fix a crash in repairOldRegInRange
Nicolai Haehnle [Wed, 10 Aug 2016 18:51:14 +0000 (18:51 +0000)]
LiveIntervalAnalysis: fix a crash in repairOldRegInRange

Summary:
See the new test case for one that was (non-deterministically) crashing
on trunk and deterministically hit the assertion that I added in D23302.
Basically, the machine function contains a sequence

     DS_WRITE_B32 %vreg4, %vreg14:sub0, ...
     DS_WRITE_B32 %vreg4, %vreg14:sub0, ...
     %vreg14:sub1<def> = COPY %vreg14:sub0

and SILoadStoreOptimizer::mergeWrite2Pair merges the two DS_WRITE_B32
instructions into one before calling repairIntervalsInRange.

Now repairIntervalsInRange wants to repair %vreg14, in particular, and
ends up trying to repair %vreg14:sub1 as well, but that only becomes
active _after_ the range that is to be repaired, hence the crash due
to LR.find(...) == LR.begin() at the start of repairOldRegInRange.

I believe that just skipping those subrange is fine, but again, not too
familiar with that code.

Reviewers: MatzeB, kparzysz, tstellarAMD

Subscribers: llvm-commits, MatzeB

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

llvm-svn: 278268

7 years ago[ValueTracking] An improvement to IR ValueTracking on Non-negative Integers
Andrew Kaylor [Wed, 10 Aug 2016 18:47:19 +0000 (18:47 +0000)]
[ValueTracking] An improvement to IR ValueTracking on Non-negative Integers

Patch by Li Huang

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

llvm-svn: 278267

7 years ago[Hexagon] Remove unused variants of LO/HI instructions
Krzysztof Parzyszek [Wed, 10 Aug 2016 18:40:36 +0000 (18:40 +0000)]
[Hexagon] Remove unused variants of LO/HI instructions

llvm-svn: 278266

7 years agoCodegen: Tail Merge: Be less aggressive with special cases.
Kyle Butt [Wed, 10 Aug 2016 18:36:18 +0000 (18:36 +0000)]
Codegen: Tail Merge: Be less aggressive with special cases.

This change makes it possible for tail-duplication and tail-merging to
be disjoint. By being less aggressive when merging during layout, there are no
overlapping cases between tail-duplication and tail-merging, provided the
thresholds are disjoint.

There is a remaining TODO to benchmark the succ_size() test for non-layout tail
merging.

llvm-svn: 278265

7 years agoReapply [Sema] Add sizeof diagnostics for bzero
Bruno Cardoso Lopes [Wed, 10 Aug 2016 18:34:47 +0000 (18:34 +0000)]
Reapply [Sema] Add sizeof diagnostics for bzero

Reapply r277787. For memset (and others) we can get diagnostics like:

  struct stat { int x; };
  void foo(struct stat *stamps) {
    bzero(stamps, sizeof(stamps));
    memset(stamps, 0, sizeof(stamps));
  }

  t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess]
    memset(stamps, 0, sizeof(stamps));
           ~~~~~~            ^~~~~~
  t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset(stamps, 0, sizeof(stamps));
                             ^~~~~~

This patch implements the same class of warnings for bzero.

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

rdar://problem/18963514

llvm-svn: 278264

7 years ago[Documentation] Highlighting consistency and spelling mistake fix in Clang-tidy reada...
Eugene Zelenko [Wed, 10 Aug 2016 18:30:14 +0000 (18:30 +0000)]
[Documentation] Highlighting consistency and spelling mistake fix in Clang-tidy readability-else-after-return description.

llvm-svn: 278263

7 years ago[Release Notes] Consistency in Clang-tidy entries' style.
Eugene Zelenko [Wed, 10 Aug 2016 18:15:51 +0000 (18:15 +0000)]
[Release Notes] Consistency in Clang-tidy entries' style.

llvm-svn: 278262

7 years ago[ELF] Support LLVM-style casting for OutputSectionBase<ELFT> derived classes
Eugene Leviant [Wed, 10 Aug 2016 18:10:41 +0000 (18:10 +0000)]
[ELF] Support LLVM-style casting for OutputSectionBase<ELFT> derived classes

llvm-svn: 278261

7 years ago[X86][SSE] Dropped blend(insertps(x,y),zero) combine - this is now handled by target...
Simon Pilgrim [Wed, 10 Aug 2016 18:10:29 +0000 (18:10 +0000)]
[X86][SSE] Dropped blend(insertps(x,y),zero) combine - this is now handled by target shuffle chain combining

llvm-svn: 278260

7 years ago[ADT] Removed synthesized constructor introduced in r278251, since MSVC doesn't suppo...
Tim Shen [Wed, 10 Aug 2016 18:08:38 +0000 (18:08 +0000)]
[ADT] Removed synthesized constructor introduced in r278251, since MSVC doesn't support them

llvm-svn: 278259

7 years agoTargetOpcodes: Rewrite the documentation for SUBREG_TO_REG
Matthias Braun [Wed, 10 Aug 2016 18:05:50 +0000 (18:05 +0000)]
TargetOpcodes: Rewrite the documentation for SUBREG_TO_REG

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

llvm-svn: 278258

7 years ago[clang-tidy] enhance readability-else-after-return
Kirill Bobyrev [Wed, 10 Aug 2016 18:05:47 +0000 (18:05 +0000)]
[clang-tidy] enhance readability-else-after-return

`readability-else-after-return` only warns about `return` calls, but LLVM Coding
Standars stat that `throw`, `continue`, `goto`, etc after `return` calls are
bad, too.

Reviwers: alexfh, aaron.ballman

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

llvm-svn: 278257

7 years ago[Hexagon] Simplify the SplitConst32/64 pass
Krzysztof Parzyszek [Wed, 10 Aug 2016 18:05:47 +0000 (18:05 +0000)]
[Hexagon] Simplify the SplitConst32/64 pass

llvm-svn: 278256

7 years ago[Documentation] Fix grammar mistakes in docs/clang-tidy/index.rst spotted by Alexande...
Eugene Zelenko [Wed, 10 Aug 2016 18:02:15 +0000 (18:02 +0000)]
[Documentation] Fix grammar mistakes in docs/clang-tidy/index.rst spotted by Alexander Kornienko.

llvm-svn: 278255

7 years ago[clang-tidy] minor improvements in modernise-deprecated-headers check
Kirill Bobyrev [Wed, 10 Aug 2016 18:01:45 +0000 (18:01 +0000)]
[clang-tidy] minor improvements in modernise-deprecated-headers check

This patch introduces a minor list of changes as proposed by Richard Smith in
the mailing list.

See original comments with an impact on the future check state below:

[comments.begin

> +                          {"complex.h", "ccomplex"},

It'd be better to convert this one to <complex>, or leave it alone.
<ccomplex> is an unnecessary wart.

(The contents of C++11's <complex.h> / <ccomplex> / <complex> (all of
which are identical) aren't comparable to C99's <complex.h>, so if
this was C++98 code using the C99 header, the code will be broken with
or without this transformation.)

> +                          {"iso646.h", "ciso646"},

Just delete #includes of this one. <ciso646> does nothing.

> +              {"stdalign.h", "cstdalign"},
> +              {"stdbool.h", "cstdbool"},

We should just delete these two includes. These headers do nothing in C++.

comments.end]

Reviewers: alexfh, aaron.ballman

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

llvm-svn: 278254

7 years agoRemove a circular include dependency.
Zachary Turner [Wed, 10 Aug 2016 17:59:03 +0000 (17:59 +0000)]
Remove a circular include dependency.

lldb-private-interfaces.h included lldb-private.h, and
lldb-private.h included lldb-private-interfaces.h.

llvm-svn: 278253

7 years ago[Hexagon] Add extra patterns for single-precision min/max instructions
Krzysztof Parzyszek [Wed, 10 Aug 2016 17:56:24 +0000 (17:56 +0000)]
[Hexagon] Add extra patterns for single-precision min/max instructions

llvm-svn: 278252

7 years ago[ADT] Add make_scope_exit().
Tim Shen [Wed, 10 Aug 2016 17:52:09 +0000 (17:52 +0000)]
[ADT] Add make_scope_exit().

Summary: make_scope_exit() is described in C++ proposal p0052r2, which uses RAII to do cleanup works at scope exit.

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 278251

7 years agoFix LCSSA increased compile time
Rong Xu [Wed, 10 Aug 2016 17:49:11 +0000 (17:49 +0000)]
Fix LCSSA increased compile time

We are seeing r276077 drastically increasing compiler time for our larger
benchmarks in PGO profile generation build (both clang based and IR based
mode) -- it can be 20x slower than without the patch (like from 30 secs to
780 secs)

The increased time are all in pass LCSSA. The problematic code is about
PostProcessPHIs after use-rewrite. Note that the InsertedPhis from ssa_updater
is accumulating (never been cleared). Since the inserted PHIs are added to the
candidate for each rewrite, The earlier ones will be repeatedly added. Later
when adding the new PHIs to the work-list, we don't check the duplication
either. This can result in extremely long work-list that containing tons of
duplicated PHIs.

This patch fixes the issue by hoisting the code out of the loop.

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

llvm-svn: 278250

7 years agoCheck for availability of `cpio` command.
Rui Ueyama [Wed, 10 Aug 2016 17:42:26 +0000 (17:42 +0000)]
Check for availability of `cpio` command.

cpio may not be available on Windows, so it is better to check
for availability before running the command in a test.

llvm-svn: 278249

7 years ago[Hexagon] Fix table-gen decode conflict warnings for CONST32/64
Krzysztof Parzyszek [Wed, 10 Aug 2016 17:22:24 +0000 (17:22 +0000)]
[Hexagon] Fix table-gen decode conflict warnings for CONST32/64

llvm-svn: 278247

7 years agoGlobalISel: fixup copy/paste comment error
Tim Northover [Wed, 10 Aug 2016 16:51:18 +0000 (16:51 +0000)]
GlobalISel: fixup copy/paste comment error

llvm-svn: 278246

7 years agoGlobalISel: avoid inserting redundant COPYs for bitcasts.
Tim Northover [Wed, 10 Aug 2016 16:51:14 +0000 (16:51 +0000)]
GlobalISel: avoid inserting redundant COPYs for bitcasts.

If the value produced by the bitcast hasn't been referenced yet, we can simply
reuse the input register avoiding an unnecessary COPY instruction.

llvm-svn: 278245

7 years ago[Hexagon] Use integer instructions for floating point immediates
Krzysztof Parzyszek [Wed, 10 Aug 2016 16:46:36 +0000 (16:46 +0000)]
[Hexagon] Use integer instructions for floating point immediates

Floating point instructions use general purpose registers, so the few
instructions that can put floating point immediates into registers are,
in fact, integer instruction. Use them explicitly instead of having
pseudo-instructions specifically for dealing with floating point values.

Simplify the constant loading instructions (from sdata) to have only two:
one for 32-bit values and one for 64-bit values: CONST32 and CONST64.

llvm-svn: 278244

7 years ago[Coroutines] Part 6: Elide dynamic allocation of a coroutine frame when possible
Gor Nishanov [Wed, 10 Aug 2016 16:40:39 +0000 (16:40 +0000)]
[Coroutines] Part 6: Elide dynamic allocation of a coroutine frame when possible

Summary:
A particular coroutine usage pattern, where a coroutine is created, manipulated and
destroyed by the same calling function, is common for coroutines implementing
RAII idiom and is suitable for allocation elision optimization which avoid
dynamic allocation by storing the coroutine frame as a static `alloca` in its
caller.

coro.free and coro.alloc intrinsics are used to indicate which code needs to be suppressed
when dynamic allocation elision happens:
```
entry:
  %elide = call i8* @llvm.coro.alloc()
  %need.dyn.alloc = icmp ne i8* %elide, null
  br i1 %need.dyn.alloc, label %coro.begin, label %dyn.alloc
dyn.alloc:
  %alloc = call i8* @CustomAlloc(i32 4)
  br label %coro.begin
coro.begin:
  %phi = phi i8* [ %elide, %entry ], [ %alloc, %dyn.alloc ]
  %hdl = call i8* @llvm.coro.begin(i8* %phi, i32 0, i8* null,
                          i8* bitcast ([2 x void (%f.frame*)*]* @f.resumers to i8*))
```
and
```
  %mem = call i8* @llvm.coro.free(i8* %hdl)
  %need.dyn.free = icmp ne i8* %mem, null
  br i1 %need.dyn.free, label %dyn.free, label %if.end
dyn.free:
  call void @CustomFree(i8* %mem)
  br label %if.end
if.end:
  ...
```

If heap allocation elision is performed, we replace coro.alloc with a static alloca on the caller frame and coro.free with null constant.

Also, we need to make sure that if there are any tail calls referencing the coroutine frame, we need to remote tail call attribute, since now coroutine frame lives on the stack.

Documentation and overview is here: http://llvm.org/docs/Coroutines.html.

Upstreaming sequence (rough plan)
1.Add documentation. (https://reviews.llvm.org/D22603)
2.Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
3.Add empty coroutine passes. (https://reviews.llvm.org/D22847)
4.Add coroutine devirtualization + tests.
ab) Lower coro.resume and coro.destroy (https://reviews.llvm.org/D22998)
c) Do devirtualization (https://reviews.llvm.org/D23229)
5.Add CGSCC restart trigger + tests. (https://reviews.llvm.org/D23234)
6.Add coroutine heap elision + tests.  <= we are here
7.Add the rest of the logic (split into more patches)

Reviewers: mehdi_amini, majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 278242

7 years agoFix build break of VS 2013 debug builds
Roger Ferrer Ibanez [Wed, 10 Aug 2016 16:39:58 +0000 (16:39 +0000)]
Fix build break of VS 2013 debug builds

In debug mode extra macros are enabled for several C++ algorithms. Some of them
may cause unfortunate build failures.

This commit adds a redundant operator() to work around one of those troublesome
macros which was hit accidentally by change r278012.

llvm-svn: 278241

7 years ago[analyzer] Fix a crash in CloneDetector when calling functions by pointers.
Artem Dergachev [Wed, 10 Aug 2016 16:25:16 +0000 (16:25 +0000)]
[analyzer] Fix a crash in CloneDetector when calling functions by pointers.

CallExpr may have a null direct callee when the callee function is not
known in compile-time. Do not try to take callee name in this case.

Patch by Raphael Isemann!

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

llvm-svn: 278238

7 years ago[Hexagon] Delete HexagonSelectCCInfo.td
Krzysztof Parzyszek [Wed, 10 Aug 2016 16:23:53 +0000 (16:23 +0000)]
[Hexagon] Delete HexagonSelectCCInfo.td

This file is not used. The location assignment of call arguments and
return values is implemented directly in HexagonISelLowering.

llvm-svn: 278237

7 years ago[Hexagon] Remove unneeded/unused ISD opcodes ARGEXTEND and FCONST32
Krzysztof Parzyszek [Wed, 10 Aug 2016 16:20:33 +0000 (16:20 +0000)]
[Hexagon] Remove unneeded/unused ISD opcodes ARGEXTEND and FCONST32

llvm-svn: 278236

7 years ago[OpenCL] Fix typo in test that I accidentally introduced in my previous commit.
Joey Gouly [Wed, 10 Aug 2016 16:04:14 +0000 (16:04 +0000)]
[OpenCL] Fix typo in test that I accidentally introduced in my previous commit.

llvm-svn: 278235

7 years ago[OpenCL] Change block descriptor address space to constant.
Joey Gouly [Wed, 10 Aug 2016 15:57:02 +0000 (15:57 +0000)]
[OpenCL] Change block descriptor address space to constant.

The block descriptor is a GlobalVariable in the LLVM IR, so it shouldn't be
in the private address space.

llvm-svn: 278234

7 years ago[X86][XOP] Tweak vpermil2pd test to stop it being combined away
Simon Pilgrim [Wed, 10 Aug 2016 15:15:56 +0000 (15:15 +0000)]
[X86][XOP] Tweak vpermil2pd test to stop it being combined away

The target shuffle combined to a BLENDPD pattern which we will shortly add support for.

llvm-svn: 278233

7 years ago[X86][SSE] Regenerate vector shift lowering tests
Simon Pilgrim [Wed, 10 Aug 2016 15:13:49 +0000 (15:13 +0000)]
[X86][SSE] Regenerate vector shift lowering tests

llvm-svn: 278232

7 years ago[LVI] Handle conditions in the form of (cond1 && cond2)
Artur Pilipenko [Wed, 10 Aug 2016 15:13:15 +0000 (15:13 +0000)]
[LVI] Handle conditions in the form of (cond1 && cond2)

Teach LVI how to gather information from conditions in the form of (cond1 && cond2). Our out-of-tree front-end emits range checks in this form.

Reviewed By: sanjoy

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

llvm-svn: 278231

7 years ago[ELF][MIPS] Take into account combination of EF_MIPS_ARCH and EF_MIPS_MACH flags...
Simon Atanasyan [Wed, 10 Aug 2016 15:06:45 +0000 (15:06 +0000)]
[ELF][MIPS] Take into account combination of EF_MIPS_ARCH and EF_MIPS_MACH flags while checking ISA compatibility

MIPS ISA encoded using two ELF flags: general architecture flag like
EF_MIPS_ARCH_32, EF_MIPS_ARCH_64R6 etc and optional machine variant flag
like EF_MIPS_MACH_4111, EF_MIPS_MACH_OCTEON3 etc. When we check
compatibility between two input files and deduce ELF flags for generated
output we need to take into account both of these flags.

llvm-svn: 278230

7 years agouse different comparison predicates for better test coverage
Sanjay Patel [Wed, 10 Aug 2016 15:06:11 +0000 (15:06 +0000)]
use different comparison predicates for better test coverage

llvm-svn: 278229