OSDN Git Service

android-x86/external-llvm.git
7 years ago[EarlyCSE] Optionally use MemorySSA. NFC.
Geoff Berry [Wed, 31 Aug 2016 19:24:10 +0000 (19:24 +0000)]
[EarlyCSE] Optionally use MemorySSA. NFC.

Summary:
Use MemorySSA, if requested, to do less conservative memory dependency
checking.

This change doesn't enable the MemorySSA enhanced EarlyCSE in the
default pipelines, so should be NFC.

Reviewers: dberlin, sanjoy, reames, majnemer

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280279 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoActually check for the diagnostic to be emitted!
Quentin Colombet [Wed, 31 Aug 2016 18:53:32 +0000 (18:53 +0000)]
Actually check for the diagnostic to be emitted!

This makes the test case in r280273 actually useful!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280276 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Deal with undefs when extending live intervals
Krzysztof Parzyszek [Wed, 31 Aug 2016 18:52:09 +0000 (18:52 +0000)]
[Hexagon] Deal with undefs when extending live intervals

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280275 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned
Tom Stellard [Wed, 31 Aug 2016 18:46:07 +0000 (18:46 +0000)]
AMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned

Summary: This fixes some OpenCV tests that were broken by libclc commit r276443.

Reviewers: arsenm, jvesely

Subscribers: arsenm, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280274 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.
Quentin Colombet [Wed, 31 Aug 2016 18:43:04 +0000 (18:43 +0000)]
[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.

Thanks to this patch, we know have a way to easly see if GlobalISel
failed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280273 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ResetMachineFunction] Emit the diagnostic isel fallback when asked.
Quentin Colombet [Wed, 31 Aug 2016 18:43:01 +0000 (18:43 +0000)]
[ResetMachineFunction] Emit the diagnostic isel fallback when asked.

This pass is now able to report when the function is being reset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280272 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.
Quentin Colombet [Wed, 31 Aug 2016 18:42:55 +0000 (18:42 +0000)]
[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.

This will be used to warm when we fallback in GlobalISel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280271 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix indent. NFC.
Chad Rosier [Wed, 31 Aug 2016 18:37:52 +0000 (18:37 +0000)]
Fix indent. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280270 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd an optional parameter with a list of undefs to extendToIndices
Krzysztof Parzyszek [Wed, 31 Aug 2016 18:02:19 +0000 (18:02 +0000)]
Add an optional parameter with a list of undefs to extendToIndices

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280268 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNext set of additional error checks for invalid Mach-O files for bad load commands
Kevin Enderby [Wed, 31 Aug 2016 17:57:46 +0000 (17:57 +0000)]
Next set of additional error checks for invalid Mach-O files for bad load commands
that use the Mach::linkedit_data_command type for the load commands that are
currently used in the MachOObjectFile constructor.

This contains the missing checks for LC_DATA_IN_CODE and
LC_LINKER_OPTIMIZATION_HINT load commands and the fields for the
Mach::linkedit_data_command type.  Checking for other load commands that
use this type will be added later.

Also fixed a couple of places that was using sizeof(MachOObjectFile::LoadCommandInfo)
that should have been using sizeof(MachO::load_command).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280267 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[EarlyCSE] Allow forwarding a non-invariant load into an invariant load.
Geoff Berry [Wed, 31 Aug 2016 17:45:31 +0000 (17:45 +0000)]
[EarlyCSE] Allow forwarding a non-invariant load into an invariant load.

Reviewers: sanjoy

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280265 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Update the debug based on Michael's suggestion.
Chad Rosier [Wed, 31 Aug 2016 17:41:12 +0000 (17:41 +0000)]
[SLP] Update the debug based on Michael's suggestion.

Passing the types/opcode check still doesn't guarantee we'll actually vectorize.
Therefore, just make it clear we're attempting to vectorize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280263 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LangRef] Clarify !invariant.load semantics.
Geoff Berry [Wed, 31 Aug 2016 17:39:21 +0000 (17:39 +0000)]
[LangRef] Clarify !invariant.load semantics.

Based on discussion on llvm-dev.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280262 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Sink debug after checking for matching types/opcode.
Chad Rosier [Wed, 31 Aug 2016 17:31:09 +0000 (17:31 +0000)]
[SLP] Sink debug after checking for matching types/opcode.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280260 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/LTO] Factor out logic for running passes.
Davide Italiano [Wed, 31 Aug 2016 17:02:44 +0000 (17:02 +0000)]
[lib/LTO] Factor out logic for running passes.

This is in preparation for adding an option
to run a custom pipeline with the new PM. It's
currently used in lld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280258 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agos/static inline/static/ for headers I have changed in r279475. NFC.
Tim Shen [Wed, 31 Aug 2016 16:48:13 +0000 (16:48 +0000)]
s/static inline/static/ for headers I have changed in r279475. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280257 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LTO] Fix common test to reflect r279911 and move to X86 subdirectory
Teresa Johnson [Wed, 31 Aug 2016 16:15:39 +0000 (16:15 +0000)]
[LTO] Fix common test to reflect r279911 and move to X86 subdirectory

Adjust the test to reflect the changes to common handling in r279911.
This test wasn't running due to an incorrect REQUIRES and thus missed
being modified for r279911 before. It was changed to XFAIL when the
bad REQUIRES was discovered.

Remove the XFAIL and move to a new X86 subdirectory that will properly
disable on non-X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280256 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[codeview] Emit vtable shape information
Reid Kleckner [Wed, 31 Aug 2016 15:59:30 +0000 (15:59 +0000)]
[codeview] Emit vtable shape information

The shape of the vtable is passed down as the size of the
__vtbl_ptr_type. This special pointer type appears both as the pointee
type of the vptr type, and by itself in every dynamic class. For classes
with multiple vtables, only the shape of the primary vftable is
included, as the shape of all secondary vftables will be the same as in
the base class.

Fixes PR28150

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280254 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[statepoints][experimental] Add support for live-in semantics of values in deopt...
Philip Reames [Wed, 31 Aug 2016 15:12:17 +0000 (15:12 +0000)]
[statepoints][experimental] Add support for live-in semantics of values in deopt bundles

This is a first step towards supporting deopt value lowering and reporting entirely with the register allocator. I hope to build on this in the near future to support live-on-return semantics, but I have a use case which allows me to test and investigate code quality with just the live-in semantics so I've chosen to start there. For those curious, my use cases is our implementation of the "__llvm_deoptimize" function we bind to @llvm.deoptimize. I'm choosing not to hard code that fact in the patch and instead make it configurable via function attributes.

The basic approach here is modelled on what is done for the "Live In" values on stackmaps and patchpoints. (A secondary goal here is to remove one of the last barriers to merging the pseudo instructions.) We start by adding the operands directly to the STATEPOINT SDNode. Once we've lowered to MI, we extend the remat logic used by the register allocator to fold virtual register uses into StackMap::Indirect entries as needed. This does rely on the fact that the register allocator rematerializes. If it didn't along some code path, we could end up with more vregs than physical registers and fail to allocate.

Today, we *only* fold in the register allocator. This can create some weird effects when combined with arguments passed on the stack because we don't fold them appropriately. I have an idea how to fix that, but it needs this patch in place to work on that effectively. (There's some weird interaction with the scheduler as well, more investigation needed.)

My near term plan is to land this patch off-by-default, experiment in my local tree to identify any correctness issues and then start fixing codegen problems one by one as I find them. Once I have the live-in lowering fully working (both correctness and code quality), I'm hoping to move on to the live-on-return semantics. Note: I don't have any *known* miscompiles with this patch enabled, but I'm pretty sure I'll find at least a couple. Thus, the "experimental" tag and the fact it's off by default.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280250 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Improve awareness of (v)cvtpd2ps implicit zeroing of upper 64-bits of...
Simon Pilgrim [Wed, 31 Aug 2016 15:09:34 +0000 (15:09 +0000)]
[X86][SSE] Improve awareness of (v)cvtpd2ps implicit zeroing of upper 64-bits of xmm result

Associate x86_sse2_cvtpd2ps with X86ISD::VFPROUND to avoid inserting unnecessary zeroing shuffles.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280249 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Arguments should be camel case, and start with an upper case letter. NFC.
Chad Rosier [Wed, 31 Aug 2016 15:06:58 +0000 (15:06 +0000)]
[SLP] Arguments should be camel case, and start with an upper case letter. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280248 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChanging a code block to text because Sphinx does not like it on the builder (http...
Aaron Ballman [Wed, 31 Aug 2016 14:37:20 +0000 (14:37 +0000)]
Changing a code block to text because Sphinx does not like it on the builder (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12517/steps/docs-llvm-html/logs/stdio)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280247 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoClang patch r280064 introduced ways to set the FP exceptions and denormal
Sjoerd Meijer [Wed, 31 Aug 2016 14:17:38 +0000 (14:17 +0000)]
Clang patch r280064 introduced ways to set the FP exceptions and denormal
types. This is the LLVM counterpart and it adds options that map onto FP
exceptions and denormal build attributes allowing better fp math library
selections.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280246 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixed spill stack objects are mutable
Krzysztof Parzyszek [Wed, 31 Aug 2016 13:52:17 +0000 (13:52 +0000)]
Fixed spill stack objects are mutable

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280244 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix comments about IndirectBrInst in Instructions.h
Chad Rosier [Wed, 31 Aug 2016 13:39:34 +0000 (13:39 +0000)]
Fix comments about IndirectBrInst in Instructions.h

Patch by yo (Chiang, Yi-Yo) <yo@skymizer.com>.
Differential Revision: https://reviews.llvm.org/D23982

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280241 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more...
James Molloy [Wed, 31 Aug 2016 13:32:28 +0000 (13:32 +0000)]
Revert "[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases"

This reverts commit r280218. This *also* causes buildbot errors. Sigh. Not a successful day all around!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280239 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChanging a code block to text because Sphinx does not like it on the builder (http...
Aaron Ballman [Wed, 31 Aug 2016 13:29:23 +0000 (13:29 +0000)]
Changing a code block to text because Sphinx does not like it on the builder (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12516/steps/docs-llvm-html/logs/stdio)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280238 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd"
James Molloy [Wed, 31 Aug 2016 13:16:52 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd"

This reverts commit r280216 - it caused buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280234 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches"
James Molloy [Wed, 31 Aug 2016 13:16:45 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches"

This reverts commit r280217. r280216 caused buildbot failures - backing out the entire chain.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280233 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SimplifyCFG] Add a workaround to fix PR30188"
James Molloy [Wed, 31 Aug 2016 13:16:36 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Add a workaround to fix PR30188"

This reverts commit r280219. r280216 caused buildbot failures - backing out the entire chain.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280232 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SimplifyCFG] Fix bootstrap failure after r280220"
James Molloy [Wed, 31 Aug 2016 13:16:30 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Fix bootstrap failure after r280220"

This reverts commit r280228. r280216 caused buildbot failures - backing out the entire sequence.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280231 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse abstraction in AArch64AsmPrinter::lowerSTACKMAP. NFCI
Diana Picus [Wed, 31 Aug 2016 12:43:49 +0000 (12:43 +0000)]
Use abstraction in AArch64AsmPrinter::lowerSTACKMAP. NFCI

Use functionality from StackMapOpers instead of hardcoding an operand access.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280230 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTypo fixes. NFC
Diana Picus [Wed, 31 Aug 2016 12:43:44 +0000 (12:43 +0000)]
Typo fixes. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280229 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Fix bootstrap failure after r280220
James Molloy [Wed, 31 Aug 2016 12:33:48 +0000 (12:33 +0000)]
[SimplifyCFG] Fix bootstrap failure after r280220

We check that a sinking candidate is used by only one PHI node during our legality checks. However for instructions that are used by other sinking candidates our heuristic is less conservative. This can result in a candidate actually being illegal when we come to sink it because of how we sunk a predecessor. Do the used-by-only-one-PHI checks again during sinking to ensure we don't crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280228 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/SI: Handle aliases in AMDGPUAlwaysInlinePass
Nikolay Haustov [Wed, 31 Aug 2016 11:18:33 +0000 (11:18 +0000)]
AMDGPU/SI: Handle aliases in AMDGPUAlwaysInlinePass

Summary:
Simply replace usage of aliases to functions with aliasee.
This came up when bitcode linking to builtin library and
calls to aliases not being resolved.

Also made minor improvements to existing test.

Reviewers: tstellarAMD, alex-t, vpykhtin

Subscribers: arsenm, wdng, rampitec

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280221 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Add a workaround to fix PR30188
James Molloy [Wed, 31 Aug 2016 10:46:45 +0000 (10:46 +0000)]
[SimplifyCFG] Add a workaround to fix PR30188

We're sinking stores, which is a good thing, but in the process creating selects for the store address operand, which SROA/Mem2Reg can't look through, which caused serious regressions.

The real fix is in SROA, which I'll be looking into.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280219 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases
James Molloy [Wed, 31 Aug 2016 10:46:39 +0000 (10:46 +0000)]
[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases

A very important case is not handled here: multiple arcs to a single block with a PHI. Consider:

    a:
      %1 = icmp %b, 1
      br %1, label %c, label %e
    c:
      %2 = icmp %b, 2
      br %2, label %d, label %e
    d:
      br %e
    e:
      phi [0, %a], [1, %c], [2, %d]

FoldValueComparisonIntoPredecessors will refuse to fold this, as it doesn't know how to deal with two arcs to a common destination with different PHI values. The answer is obvious - just split all conflicting arcs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280218 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches
James Molloy [Wed, 31 Aug 2016 10:46:33 +0000 (10:46 +0000)]
[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches

This was a real restriction in the original version of SinkIfThenCodeToEnd. Now it's been rewritten, the restriction can be lifted.

As part of this, we handle a very common and useful case where one of the incoming branches is actually conditional. Consider:

   if (a)
     x(1);
   else if (b)
     x(2);

This produces the following CFG:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \    |  /
          [ end ]

[end] has two unconditional predecessor arcs and one conditional. The conditional refers to the implicit empty 'else' arc. This same pattern can also be caused by an empty default block in a switch.

We can't sink the call to x() down to end because no call to x() happens on the third incoming arc (assume that x() has sideeffects for the sake of argument; if something is safe to speculate we could indeed sink nevertheless but this cannot happen in the general case and causes many extra selects).

We are now able to detect this case and split off the unconditional arcs to a common successor:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \   /    |
     [sink.split] |
           \     /
           [ end ]

Now we can sink the call to x() into %sink.split. This can cause significant code simplification in many testcases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280217 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd
James Molloy [Wed, 31 Aug 2016 10:46:23 +0000 (10:46 +0000)]
[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd

r279460 rewrote this function to be able to handle more than two incoming edges and took pains to ensure this didn't regress anything.

This time we change the logic for determining if an instruction should be sunk. Previously we used a single pass greedy algorithm - sink instructions until one requires more than one PHI node or we run out of instructions to sink.

This had the problem that sinking instructions that had non-identical but trivially the same operands needed extra logic so we sunk them aggressively. For example:

    %a = load i32* %b          %d = load i32* %b
    %c = gep i32* %a, i32 0    %e = gep i32* %d, i32 1

Sinking %c and %e would naively require two PHI merges as %a != %d. But the loads are obviously equivalent (and maybe can't be hoisted because there is no common predecessor).

This is why we implemented the fairly complex function areValuesTriviallySame(), to look through trivial differences like this. However it's just not clever enough.

Instead, throw areValuesTriviallySame away, use pointer equality to check equivalence of operands and switch to a two-stage algorithm.

In the "scan" stage, we look at every sinkable instruction in isolation from end of block to front. If it's sinkable, we keep track of all operands that required PHI merging.

In the "sink" stage, we iteratively sink the last non-terminator in the source blocks. But when calculating how many PHIs are actually required to be inserted (to work out if we should stop or not) we remove any values that have already been sunk from the set of PHI-merges required, which allows us to be more aggressive.

This turns an algorithm with potentially recursive lookahead (looking through GEPs, casts, loads and any other instruction potentially not CSE'd) to two linear scans.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280216 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Tail-merge calls with sideeffects
James Molloy [Wed, 31 Aug 2016 10:46:16 +0000 (10:46 +0000)]
[SimplifyCFG] Tail-merge calls with sideeffects

This was deliberately disabled during my rewrite of SinkIfThenToEnd to keep behaviour
at least vaguely consistent with the previous version and keep it as close to NFC as
I could.

There's no real reason not to merge sideeffect calls though, so let's do it! Small fixup
along the way to ensure we don't create indirect calls.

Should fix PR28964.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280215 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm...
Simon Pilgrim [Wed, 31 Aug 2016 10:35:13 +0000 (10:35 +0000)]
[X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm result

Add patterns to avoid inserting unnecessary zeroing shuffles when lowering fptrunc to (v)cvtpd2ps

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280214 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Coverage] Make sorting criteria for CounterMappingRegions local.
Igor Kudrin [Wed, 31 Aug 2016 07:01:17 +0000 (07:01 +0000)]
[Coverage] Make sorting criteria for CounterMappingRegions local.

Move the comparison function into the only place there it is used,
i.e. the call to std::stable_sort in CoverageMappingWriter::write().

Add sorting by region kinds as it is required to ensure stable order
in our tests and to simplify D23987.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280198 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Add patterns to select masked logical operations if the select has a floati...
Craig Topper [Wed, 31 Aug 2016 05:37:52 +0000 (05:37 +0000)]
[AVX-512] Add patterns to select masked logical operations if the select has a floating point type.

This is needed in order to replace the masked floating point logical op intrinsics with native IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280195 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Add test cases for masked floating point logic operations with bitcasts...
Craig Topper [Wed, 31 Aug 2016 05:37:50 +0000 (05:37 +0000)]
[AVX-512] Add test cases for masked floating point logic operations with bitcasts between the logic ops and the select. We don't currently select masked operations for these cases.

Test cases taken from optimized clang output after trying to convert the masked floating point logical op intrinsics to native IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280194 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Regenerate a test using update_llc_test_checks.py.
Craig Topper [Wed, 31 Aug 2016 05:37:47 +0000 (05:37 +0000)]
[X86] Regenerate a test using update_llc_test_checks.py.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280193 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XRay] Support multiple return instructions in a single basic block
Dean Michael Berris [Wed, 31 Aug 2016 05:20:08 +0000 (05:20 +0000)]
[XRay] Support multiple return instructions in a single basic block

Add a .mir test to catch this case, and fix the xray-instrumentation
pass to handle it appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280192 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer
David Majnemer [Wed, 31 Aug 2016 03:22:32 +0000 (03:22 +0000)]
[Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer

There were paths where we wouldn't populate the visited set, causing us
to recurse forever if an SSA variable was defined in terms of itself.

This fixes PR30210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280191 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PowerPC] Don't spill the frame pointer twice
Hal Finkel [Wed, 31 Aug 2016 00:52:03 +0000 (00:52 +0000)]
[PowerPC] Don't spill the frame pointer twice

When a function contains something, such as inline asm, which explicitly
clobbers the register used as the frame pointer, don't spill it twice. If we
need a frame pointer, it will be saved/restored in the prologue/epilogue code.
Explicitly spilling it again will reuse the same spill slot used by the
prologue/epilogue code, thus clobbering the saved value. The same applies
to the base-pointer or PIC-base register.

Partially fixes PR26856. Thanks to Ulrich for his analysis and the small
inline-asm reproducer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280188 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Coroutines] Part 10: Add coroutine promise support.
Gor Nishanov [Wed, 31 Aug 2016 00:35:41 +0000 (00:35 +0000)]
[Coroutines] Part 10: Add coroutine promise support.

Summary:
1) CoroEarly now lowers llvm.coro.promise intrinsic that allows to obtain
a coroutine promise pointer from a coroutine frame and vice versa.

2) CoroFrame now interprets Promise argument of llvm.coro.begin to
place CoroutinPromise alloca at a deterministic offset from the coroutine frame.

Now, the coroutine promise example from docs\Coroutines.rst compiles and produces expected result (see test/Transform/Coroutines/ex4.ll).

Reviewers: majnemer

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280184 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] clean up InsertRangeTest; NFCI
Sanjay Patel [Wed, 31 Aug 2016 00:19:35 +0000 (00:19 +0000)]
[InstCombine] clean up InsertRangeTest; NFCI

It's much less code and easier to read if we don't duplicate
everything between the 'Inside' and not 'Inside' cases.

As noted with the FIXME, the goal is to make this vector-friendly
in a follow-up patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280183 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-cov] Drop redundant "No." suffix in a column title
Vedant Kumar [Wed, 31 Aug 2016 00:09:44 +0000 (00:09 +0000)]
[llvm-cov] Drop redundant "No." suffix in a column title

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280181 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoadStoreVectorizer] Change VectorSet to Vector to match head and tail positions...
Alina Sbirlea [Tue, 30 Aug 2016 23:53:59 +0000 (23:53 +0000)]
[LoadStoreVectorizer] Change VectorSet to Vector to match head and tail positions. Resolves PR29148.

Summary:
LSV was using two vector sets (heads and tails) to track pairs of adjiacent position to vectorize.
A recent optimization is trying to obtain the longest chain to vectorize and assumes the positions
in heads(H) and tails(T) match, which is not the case is there are multiple tails for the same head.

e.g.:
i1: store a[0]
i2: store a[1]
i3: store a[1]
Leads to:
H: i1
T: i2 i3
Instead of:
H: i1 i1
T: i2 i3
So the positions for instructions that follow i3 will have different indexes in H/T.
This patch resolves PR29148.

This issue also surfaced the fact that if the chain is too long, and TLI
returns a "not-fast" answer, the whole chain will be abandoned for
vectorization, even though a smaller one would be beneficial.
Added a testcase and FIXME for this.

Reviewers: tstellarAMD, arsenm, jlebar

Subscribers: mzolotukhin, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280179 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add tests to show type limitations of InsertRangeTest and callers
Sanjay Patel [Tue, 30 Aug 2016 23:16:59 +0000 (23:16 +0000)]
[InstCombine] add tests to show type limitations of InsertRangeTest and callers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280175 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[codeview] Remove redundant TypeTable lookup
Reid Kleckner [Tue, 30 Aug 2016 21:48:14 +0000 (21:48 +0000)]
[codeview] Remove redundant TypeTable lookup

As written, the code should assert if this lookup would have ever
succeeded.  Without looking through composite types, the type graph
should be acyclic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280168 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a test file, macho-invalid-dysymtab-extreloff-nextrel,
Kevin Enderby [Tue, 30 Aug 2016 21:48:06 +0000 (21:48 +0000)]
Add a test file, macho-invalid-dysymtab-extreloff-nextrel,
I forgot to do an svn add on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280167 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ORC][RPC] Fix some bugs in the callB primitive.
Lang Hames [Tue, 30 Aug 2016 21:29:48 +0000 (21:29 +0000)]
[ORC][RPC] Fix some bugs in the callB primitive.

Still no unit test due to synchronization bugs on s390. These issues were
discovered in an out-of-tree utility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280163 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Ensure that compiler-rt is added first
Chris Bieneman [Tue, 30 Aug 2016 21:29:21 +0000 (21:29 +0000)]
[CMake] Ensure that compiler-rt is added first

This will enable other runtime projects to detect the presence of sanitizer runtimes by referring to the sanitizer targets directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280162 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNext set of additional error checks for invalid Mach-O files for bad LC_DYSYMTAB’s.
Kevin Enderby [Tue, 30 Aug 2016 21:28:30 +0000 (21:28 +0000)]
Next set of additional error checks for invalid Mach-O files for bad LC_DYSYMTAB’s.

This contains the missing checks for LC_DYSYMTAB load command fields.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280161 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm-readobj: speculative fix for MSVC
Saleem Abdulrasool [Tue, 30 Aug 2016 21:21:07 +0000 (21:21 +0000)]
llvm-readobj: speculative fix for MSVC

Use the typedef rather than using to type alias the typename.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280158 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGlobalISel: combine extracts & sequences created for legalization
Tim Northover [Tue, 30 Aug 2016 20:51:25 +0000 (20:51 +0000)]
GlobalISel: combine extracts & sequences created for legalization

Legalization ends up creating many G_SEQUENCE/G_EXTRACT pairs which leads to
inefficient codegen (even for -O0), so add a quick pass over the function to
remove them again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280155 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Relax SGPR asm constraint register class
Matt Arsenault [Tue, 30 Aug 2016 20:50:08 +0000 (20:50 +0000)]
AMDGPU: Relax SGPR asm constraint register class

s should be SReg_32 to be as general as possible. This can avoid a copy
from m0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280154 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libfuzzer] simplified unit truncation; do not write trunc items to disc
Mike Aizatsky [Tue, 30 Aug 2016 20:49:07 +0000 (20:49 +0000)]
[libfuzzer] simplified unit truncation; do not write trunc items to disc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280153 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "ELFDumper: Unversioned symbols must not have trailing @"
Hemant Kulkarni [Tue, 30 Aug 2016 20:42:46 +0000 (20:42 +0000)]
Revert "ELFDumper: Unversioned symbols must not have trailing @"

This reverts commit 8df7a877949e8782a3a28e3ecdb0770c1e444056.

Fixing other repositories and adding changes together.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280152 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopVectorizer] Predicate instructions in blocks with several incoming edges
Michael Kuperstein [Tue, 30 Aug 2016 20:22:21 +0000 (20:22 +0000)]
[LoopVectorizer] Predicate instructions in blocks with several incoming edges

We don't need to limit predication to blocks that have a single incoming
edge, we just need to use the right mask.
This fixes PR30172.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280148 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[COFFObjectFile] Ignore broken symbol table
David Majnemer [Tue, 30 Aug 2016 20:20:24 +0000 (20:20 +0000)]
[COFFObjectFile] Ignore broken symbol table

When binaries are compressed by UPX, information about symbol table
offset and symbol count remain unchanged (but became invalid due to
compression).
This causes failure in the constructor and the rest of the binary cannot
be processed.

Instead, reset symbol related information (symbol/string table pointers,
sizes) - this should disable the related iterators and functions while
the rest of the binary can still be processed.

Patch by Bandzi Michal!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280147 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIntrArgMemOnly is only defined (and current AA machinery only sanely supports) pointe...
Daniel Berlin [Tue, 30 Aug 2016 19:58:48 +0000 (19:58 +0000)]
IntrArgMemOnly is only defined (and current AA machinery only sanely supports) pointer arguments, and these intrinsics have vector of pointer arguments.  Remove ArgMemOnly until we either have the machinery, define a new attribute, or something similar

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280143 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-instate recent RPC updates (r280016, r280017, r280027, r280051) with a
Lang Hames [Tue, 30 Aug 2016 19:56:15 +0000 (19:56 +0000)]
Re-instate recent RPC updates (r280016, r280017, r280027, r280051) with a
workaround for the limitations of MSVC 2013's std::future class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280141 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoELFDumper: Unversioned symbols must not have trailing @
Hemant Kulkarni [Tue, 30 Aug 2016 19:50:02 +0000 (19:50 +0000)]
ELFDumper: Unversioned symbols must not have trailing @

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280140 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: Fixup for r280128, since GCC isn't as permissive as Clang
Duncan P. N. Exon Smith [Tue, 30 Aug 2016 19:11:11 +0000 (19:11 +0000)]
CodeGen: Fixup for r280128, since GCC isn't as permissive as Clang

Fixes the bots, e.g.:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/10055

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280135 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGlobalISel: forbid physical registers on generic MIs.
Tim Northover [Tue, 30 Aug 2016 18:52:46 +0000 (18:52 +0000)]
GlobalISel: forbid physical registers on generic MIs.

We're intending to move to a world where the type of a register is determined
by its (unique) def. This is incompatible with physregs, which are untyped.

It also means the other passes don't have to worry quite so much about
register-class compatibility and inserting COPYs appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280132 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm-readobj: add support for printing GNU Notes
Saleem Abdulrasool [Tue, 30 Aug 2016 18:52:02 +0000 (18:52 +0000)]
llvm-readobj: add support for printing GNU Notes

Add support for printing the GNU Notes.  This allows an easy way to view the
build id for a binary built with the build id.  Currently, this only handles the
GNU notes, though it would be easy to extend for other note types (default,
FreeBSD, NetBSD, etc).  Only the GNU style is supported currently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280131 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSupport: add some more ELF constants
Saleem Abdulrasool [Tue, 30 Aug 2016 18:51:59 +0000 (18:51 +0000)]
Support: add some more ELF constants

Add constants for additional GNU note types and the GNU Notes OS type id.  This
is needed to support printing the notes in ELF binaries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280130 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix unit test after function name change.
Zachary Turner [Tue, 30 Aug 2016 18:45:32 +0000 (18:45 +0000)]
Fix unit test after function name change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280129 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Split ilist_node_traits into alloc and callback, NFC
Duncan P. N. Exon Smith [Tue, 30 Aug 2016 18:40:47 +0000 (18:40 +0000)]
ADT: Split ilist_node_traits into alloc and callback, NFC

Many lists want to override only allocation semantics, or callbacks for
iplist.  Split these up to prevent code duplication.
- Specialize ilist_alloc_traits to change the implementations of
  deleteNode() and createNode().
- One common desire is to do nothing deleteNode() and disable
  createNode().  Specialize ilist_alloc_traits to inherit from
  ilist_noalloc_traits for that behaviour.
- Specialize ilist_callback_traits to use the addNodeToList(),
  removeNodeFromList(), and transferNodesFromList() callbacks.

As a drive-by, add some coverage to the callback-related unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280128 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRename ArrayRef::keep_front / keep_back to take_front / take_back.
Zachary Turner [Tue, 30 Aug 2016 18:19:18 +0000 (18:19 +0000)]
Rename ArrayRef::keep_front / keep_back to take_front / take_back.

The name decided on was take_, but I only updated it for StringRef
and forgot to do it for ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280126 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTailDuplication: Extract Indirect-Branch block limit as option. NFC
Kyle Butt [Tue, 30 Aug 2016 18:18:54 +0000 (18:18 +0000)]
TailDuplication: Extract Indirect-Branch block limit as option. NFC

The existing code hard-coded a limit of 20 instructions for duplication
when a block ended with an indirect branch. Extract this as an option.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280125 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Guarantee transferNodesFromList is only called on transfers
Duncan P. N. Exon Smith [Tue, 30 Aug 2016 18:00:45 +0000 (18:00 +0000)]
ADT: Guarantee transferNodesFromList is only called on transfers

Guarantee that ilist_traits<T>::transferNodesFromList is only called
when nodes are actually changing lists.

I also moved all the callbacks to occur *first*, before the operation.
This is the only choice for iplist<T>::merge, so we might as well be
consistent.  I expect this to have no effect in practice, although it
simplifies the logic in both iplist<T>::transfer and iplist<T>::insert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280122 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAppease buildbots after r280114.
Zachary Turner [Tue, 30 Aug 2016 17:38:28 +0000 (17:38 +0000)]
Appease buildbots after r280114.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280117 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIR: Appease MSVC after r280107 with an & or two
Duncan P. N. Exon Smith [Tue, 30 Aug 2016 17:34:58 +0000 (17:34 +0000)]
IR: Appease MSVC after r280107 with an & or two

Fixes the bot:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15192

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280116 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] replace divide-by-constant checks with asserts; NFC
Sanjay Patel [Tue, 30 Aug 2016 17:31:34 +0000 (17:31 +0000)]
[InstCombine] replace divide-by-constant checks with asserts; NFC

These folds already have tests for scalar and vector types, except
for the vector div-by-0 case, so I'm adding tests for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280115 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd StringRef::take_front and StringRef::take_back
Zachary Turner [Tue, 30 Aug 2016 17:29:59 +0000 (17:29 +0000)]
Add StringRef::take_front and StringRef::take_back

Reviewed By: majnemer, rnk
Differential Revision: https://reviews.llvm.org/D23965

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280114 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd StringRef::contains()
Zachary Turner [Tue, 30 Aug 2016 17:29:46 +0000 (17:29 +0000)]
Add StringRef::contains()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280113 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] clean up foldICmpDivConstant; NFCI
Sanjay Patel [Tue, 30 Aug 2016 17:10:49 +0000 (17:10 +0000)]
[InstCombine] clean up foldICmpDivConstant; NFCI

1. Fix comments to match variable names
2. Remove redundant CmpRHS variable
3. Add FIXME to replace some checks with asserts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280112 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Clean up docs and formatting for ilist_traits, NFC
Duncan P. N. Exon Smith [Tue, 30 Aug 2016 17:01:05 +0000 (17:01 +0000)]
ADT: Clean up docs and formatting for ilist_traits, NFC

This is a prep commit before splitting up ilist_node_traits and
updating/simplifying call sites.
- Move to top of file (I considered moving to a different file,
  llvm/ADT/ilist_traits.h, but it's really not much code).
- Clang-format.
- Convert comments to doxygen, clean them up, and add TODOs for what I'm
  doing next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280109 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Split out simple_ilist, a simple intrusive list
Duncan P. N. Exon Smith [Tue, 30 Aug 2016 16:23:55 +0000 (16:23 +0000)]
ADT: Split out simple_ilist, a simple intrusive list

Split out a new, low-level intrusive list type with clear semantics.
Unlike iplist (and ilist), all operations on simple_ilist are intrusive,
and simple_ilist never takes ownership of its nodes.  This enables an
intuitive API that has the right defaults for intrusive lists.
- insert() takes references (not pointers!) to nodes (in iplist/ilist,
  passing a reference will cause the node to be copied).
- erase() takes only iterators (like std::list), and does not destroy
  the nodes.
- remove() takes only references and has the same behaviour as erase().
- clear() does not destroy the nodes.
- The destructor does not destroy the nodes.
- New API {erase,remove,clear}AndDispose() take an extra Disposer
  functor for callsites that want to call some disposal routine (e.g.,
  std::default_delete).

This list is not currently configurable, and has no callbacks.

The initial motivation was to fix iplist<>::sort to work correctly (even
with callbacks in ilist_traits<>).  iplist<> uses simple_ilist<>::sort
directly.  The new test in unittests/IR/ModuleTest.cpp crashes without
this commit.

Fixing sort() via a low-level layer provided a good opportunity to:
- Unit test the low-level functionality thoroughly.
- Modernize the API, largely inspired by other intrusive list
  implementations.

Here's a sketch of a longer-term plan:
- Create BumpPtrList<>, a non-intrusive list implemented using
  simple_ilist<>, and use it for the Token list in
  lib/Support/YAMLParser.cpp.  This will factor out the only real use of
  createNode().
- Evolve the iplist<> and ilist<> APIs in the direction of
  simple_ilist<>, making allocation/deallocation explicit at call sites
  (similar to simple_ilist<>::eraseAndDispose()).
- Factor out remaining calls to createNode() and deleteNode() and remove
  the customization from ilist_traits<>.
- Transition uses of iplist<>/ilist<> that don't need callbacks over to
  simple_ilist<>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280107 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixup r279618, instantiate *AnalysisManagerProxy<*AnalysisManager,LazyCallGraph:...
NAKAMURA Takumi [Tue, 30 Aug 2016 15:47:13 +0000 (15:47 +0000)]
Fixup r279618, instantiate *AnalysisManagerProxy<*AnalysisManager,LazyCallGraph::SCC>, instead of  *AnalysisManagerProxy<*AnalysisManager,LazyCallGraph::SCC,LazyCallGraph&>, for PassID.

Or they were not instantiated as expected;

  llvm::InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::Function>, llvm::LazyCallGraph::SCC>::PassID
  llvm::InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::Function>, llvm::LazyCallGraph::SCC>::PassID

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280105 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Refactor SOP instructions TD files.
Valery Pykhtin [Tue, 30 Aug 2016 15:20:31 +0000 (15:20 +0000)]
[AMDGPU] Refactor SOP instructions TD files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280101 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[ORC][RPC] Make the future type of an Orc RPC call Error/Expected rather...
Reid Kleckner [Tue, 30 Aug 2016 15:12:58 +0000 (15:12 +0000)]
Revert "[ORC][RPC] Make the future type of an Orc RPC call Error/Expected rather than"

This reverts commit r280016, and the followups of r280017, r280027,
r280051, r280058, and r280059.

MSVC's implementation of std::promise does not get along with
llvm::Error. It uses its promised value too much like a normal value
type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280100 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] fix a bug when running a single unit of N bytes with -max_len=M, M<N...
Kostya Serebryany [Tue, 30 Aug 2016 14:52:05 +0000 (14:52 +0000)]
[libFuzzer] fix a bug when running a single unit of N bytes with -max_len=M, M<N, caused a buffer overflow

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280098 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] stop using bits for memcmp's value profile -- seems to blow up the corpus...
Kostya Serebryany [Tue, 30 Aug 2016 14:39:33 +0000 (14:39 +0000)]
[libFuzzer] stop using bits for memcmp's value profile -- seems to blow up the corpus too much

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280096 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MC] Move parser helper functions from Asmparser to MCAsmParser
Nirav Dave [Tue, 30 Aug 2016 14:15:43 +0000 (14:15 +0000)]
[MC] Move parser helper functions from Asmparser to MCAsmParser

NFC Intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280092 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Reassociate] Add additional debug output. NFC.
Chad Rosier [Tue, 30 Aug 2016 13:58:35 +0000 (13:58 +0000)]
[Reassociate] Add additional debug output. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280090 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSILoadStoreOptimizer.cpp: Fix a warning in r279991. [-Wunused-variable]
NAKAMURA Takumi [Tue, 30 Aug 2016 11:50:21 +0000 (11:50 +0000)]
SILoadStoreOptimizer.cpp: Fix a warning in r279991. [-Wunused-variable]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280075 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Properly CSE metadata in SinkThenElseCodeToEnd
James Molloy [Tue, 30 Aug 2016 10:56:08 +0000 (10:56 +0000)]
[SimplifyCFG] Properly CSE metadata in SinkThenElseCodeToEnd

This was missing, meaning the metadata in sunk instructions was potentially bogus and could cause miscompiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280072 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agodocs: mention that clobbering output regs in inline asm is illegal.
Peter Zotov [Tue, 30 Aug 2016 10:48:31 +0000 (10:48 +0000)]
docs: mention that clobbering output regs in inline asm is illegal.

I've found this out the hard way; LLVM will not normally catch this
error (unless -verify-machineinstrs is passed), and under certain
very specific circumstances (such as register scavenger running
under pressure) this would result in an opaque crash in codegen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280071 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-cov] Use the native path in the coverage report.
Ying Yi [Tue, 30 Aug 2016 07:01:37 +0000 (07:01 +0000)]
[llvm-cov] Use the native path in the coverage report.

The coverage reports contain the source or binary file paths. On Windows,
the file path might contain the seperators of both '/' and '\'. This patch
uses the native path in the coverage reports. For example, on Windows,
all '/' are converted to '\'.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280061 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support][Error] Suppress warning about unused result.
Lang Hames [Tue, 30 Aug 2016 06:00:21 +0000 (06:00 +0000)]
[Support][Error] Suppress warning about unused result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280059 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support] Add a conditionally defined default constructor (available on MSVC
Lang Hames [Tue, 30 Aug 2016 05:32:41 +0000 (05:32 +0000)]
[Support] Add a conditionally defined default constructor (available on MSVC
only) for Expected<T> so that it can interoperate with MSVC's std::future
implementation.

MSVC 2013's std::future implementation requires the wrapped type to be default
constructible.

Hopefully this will fix the bot breakage in
http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/9937 .

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280058 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReplace incorrect "#ifdef DEBUG" with "#ifndef NDEBUG".
James Y Knight [Tue, 30 Aug 2016 03:16:16 +0000 (03:16 +0000)]
Replace incorrect "#ifdef DEBUG" with "#ifndef NDEBUG".

The former is simply wrong -- the code will either never be used or will
always be used, rather than being dependent upon whether it's built with
debug assertions enabled.

The macro DEBUG isn't ever set by the llvm build system. But, the macro
DEBUG(X) is defined (unconditionally) if you happen to include
llvm/Support/Debug.h.

The code in Value.h which was erroneously protected by the #ifdef DEBUG
didn't even compile -- you can't cast<> from an LLVMOpaqueValue
directly. Fortunately, it was never invoked, as Core.cpp included
Value.h before Debug.h.

The conditionalized code in AArch64CollectLOH.cpp was previously always
used, as it includes Debug.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280056 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] use bits instead of bytes for memcmp/strcmp value profile -- the fuzzer...
Kostya Serebryany [Tue, 30 Aug 2016 03:05:50 +0000 (03:05 +0000)]
[libFuzzer] use bits instead of bytes for memcmp/strcmp value profile -- the fuzzer reaches the goal much faster, at least on the simple puzzles

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280054 91177308-0d34-0410-b5e6-96231b3b80d8