platform/upstream/llvm.git
7 years ago[docs] Fix docs build error.
Haojian Wu [Wed, 31 Aug 2016 13:17:48 +0000 (13:17 +0000)]
[docs] Fix docs build error.

llvm-svn: 280235

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.

llvm-svn: 280234

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.

llvm-svn: 280233

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.

llvm-svn: 280232

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.

llvm-svn: 280231

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.

llvm-svn: 280230

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

llvm-svn: 280229

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.

llvm-svn: 280228

7 years agoRevision r280064 adds new options -fdenormal-fp-math and passes through option
Sjoerd Meijer [Wed, 31 Aug 2016 12:31:03 +0000 (12:31 +0000)]
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

llvm-svn: 280227

7 years agoDelete DefinedBitcode.
Rafael Espindola [Wed, 31 Aug 2016 12:30:34 +0000 (12:30 +0000)]
Delete DefinedBitcode.

Given that we almost always want to handle it as DefinedRegular, just
use DefinedRegular.

llvm-svn: 280226

7 years ago[LTO/InputFiles] Merge two ifs into one. NFCI.
Davide Italiano [Wed, 31 Aug 2016 12:27:47 +0000 (12:27 +0000)]
[LTO/InputFiles] Merge two ifs into one. NFCI.

llvm-svn: 280225

7 years ago[LTO] Simplify unnamed_addr handling logic. NFCI.
Davide Italiano [Wed, 31 Aug 2016 12:20:46 +0000 (12:20 +0000)]
[LTO] Simplify unnamed_addr handling logic. NFCI.

llvm-svn: 280224

7 years ago[ELF][MIPS] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations calculation
Simon Atanasyan [Wed, 31 Aug 2016 11:47:21 +0000 (11:47 +0000)]
[ELF][MIPS] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations calculation

llvm-svn: 280223

7 years ago[ELF][MIPS] Inline function. NFC
Simon Atanasyan [Wed, 31 Aug 2016 11:47:17 +0000 (11:47 +0000)]
[ELF][MIPS] Inline function. NFC

llvm-svn: 280222

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

llvm-svn: 280221

7 years agoAttempt to pacify buildbots after r280217
James Molloy [Wed, 31 Aug 2016 11:01:41 +0000 (11:01 +0000)]
Attempt to pacify buildbots after r280217

These clang tests check diagnostics from the backend by giving it an unvectorizable loop. This loop is now vectorized :/

Make it really unvectorizable by making it unprofitable to ifconvert.

llvm-svn: 280220

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.

llvm-svn: 280219

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.

llvm-svn: 280218

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.

llvm-svn: 280217

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.

llvm-svn: 280216

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.

llvm-svn: 280215

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

llvm-svn: 280214

7 years agoFix buildbot bug: Wasn't printing scariness for DoubleFree
Filipe Cabecinhas [Wed, 31 Aug 2016 09:39:47 +0000 (09:39 +0000)]
Fix buildbot bug: Wasn't printing scariness for DoubleFree

llvm-svn: 280213

7 years ago[ELF] - Remove VersionScriptParser class and move the members to ScriptParser
George Rimar [Wed, 31 Aug 2016 09:08:26 +0000 (09:08 +0000)]
[ELF] - Remove VersionScriptParser class and move the members to ScriptParser

Patch removes VersionScriptParser class and moves the members to ScriptParser
It opens road for implementation of VERSION linkerscript command.

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

llvm-svn: 280212

7 years ago[ELF] - Fix (partial) for bug 28843 - Make sure we handle options with opposing meanings.
George Rimar [Wed, 31 Aug 2016 08:53:21 +0000 (08:53 +0000)]
[ELF] - Fix (partial) for bug 28843 - Make sure we handle options with opposing meanings.

As stated in PR28843:

we should handle command lines with

-target1-rel -target1-abs
--demangle --no-demangle
Patch implements this for specified options.
There are probably other conflicting options can exist,
so fix is called "partial".

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

llvm-svn: 280211

7 years agoAdd DT_REL(A)COUNT tag to .dynamic section
Eugene Leviant [Wed, 31 Aug 2016 08:51:39 +0000 (08:51 +0000)]
Add DT_REL(A)COUNT tag to .dynamic section

This patch groups relative relocations in a single block
in combrelocs mode and adds DT_RELCOUNT or DT_RELACOUNT
tag to .dynamic section

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

llvm-svn: 280210

7 years ago[ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.
George Rimar [Wed, 31 Aug 2016 08:46:30 +0000 (08:46 +0000)]
[ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.

DiscardPolicy is enum replacing several boolean options.
This approach is not only consistent with what we use for
unresolveds (UnresolvedPolicy), but also should help to solve a problem
of options with opposing meanings, mentioned in PR28843

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

llvm-svn: 280209

7 years agoXFail new TestPyObjSynthProvider.py on linux until I can investigate the cause of...
Pavel Labath [Wed, 31 Aug 2016 08:43:40 +0000 (08:43 +0000)]
XFail new TestPyObjSynthProvider.py on linux until I can investigate the cause of the problem

llvm-svn: 280208

7 years agoRevert r280137 and 280139 and subsequent build fixes
Pavel Labath [Wed, 31 Aug 2016 08:43:37 +0000 (08:43 +0000)]
Revert r280137 and 280139 and subsequent build fixes

The rewrite of StringExtractor::GetHexMaxU32 changes functionality in a way which makes
lldb-server crash. The crash (assert) happens when parsing the "qRegisterInfo0" packet, because
the function tries to drop_front more bytes than the packet contains. It's not clear to me
whether we should consider this a bug in the caller or the callee, but it any case, it worked
before, so I am reverting this until we can figure out what the proper interface should be.

llvm-svn: 280207

7 years ago[ELF] - Introduce StripPolicy instead of Config->StripAll/StripDebug flags.
George Rimar [Wed, 31 Aug 2016 08:38:11 +0000 (08:38 +0000)]
[ELF] - Introduce StripPolicy instead of Config->StripAll/StripDebug flags.

This approach is not only consistent with UnresolvedPolicy,
but also should help to solve a problem
of options with opposing meanings, mentioned in PR28843

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

llvm-svn: 280206

7 years agoAllow adding start/end symbols to any section
Eugene Leviant [Wed, 31 Aug 2016 08:13:33 +0000 (08:13 +0000)]
Allow adding start/end symbols to any section

Allows adding start and/or end symbols to special output sections,
like .eh_frame_hdr, which aren't lists of regular input sections.

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

llvm-svn: 280205

7 years agoRevert r280200 and put it a proper fix
Pavel Labath [Wed, 31 Aug 2016 07:49:37 +0000 (07:49 +0000)]
Revert r280200 and put it a proper fix

PeekChar returns a character, we want the whole string there.

llvm-svn: 280204

7 years agoAllow .eh_frame_hdr to be placed before .eh_frame
Eugene Leviant [Wed, 31 Aug 2016 07:43:50 +0000 (07:43 +0000)]
Allow .eh_frame_hdr to be placed before .eh_frame

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

llvm-svn: 280203

7 years agoFix lldb build on Mac.
Pavel Labath [Wed, 31 Aug 2016 07:42:38 +0000 (07:42 +0000)]
Fix lldb build on Mac.

Summary:
https://github.com/llvm-mirror/lldb/commit/e80f43fd78fa0fbc04d2d59b5713acb5d06c8308
greatly improved an API, but missed one more occurence of legacy usage.

This leads to:
  if (extractor.GetHexBytes(&payload_bytes[0], payload_bytes.size(), '\xdd') != payload_bytes.size())
                                ~~~~~~~~~~~~~~~~~~~~~                                          ^~~~~~
  /lldb/include/lldb/Utility/StringExtractor.h:151:5: note: 'GetHexBytes' declared here

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D24064
Author: Taras Tsugrii <ttsugrii@fb.com>

llvm-svn: 280202

7 years agoReify ErrorDoubleFree
Filipe Cabecinhas [Wed, 31 Aug 2016 07:38:09 +0000 (07:38 +0000)]
Reify ErrorDoubleFree

Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 280201

7 years agoUpdate the Linux code to reflect the changes done by zturner in r280139
Sylvestre Ledru [Wed, 31 Aug 2016 07:16:56 +0000 (07:16 +0000)]
Update the Linux code to reflect the changes done by zturner in r280139

llvm-svn: 280200

7 years ago[Coverage] Suppress creating a code region if the same area is covered by an expansio...
Igor Kudrin [Wed, 31 Aug 2016 07:04:16 +0000 (07:04 +0000)]
[Coverage] Suppress creating a code region if the same area is covered by an expansion region.

In most cases these code regions are just redundant, but sometimes they
could be assigned to the counter of the parent code region instead of
the counter of the nested block.

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

llvm-svn: 280199

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

llvm-svn: 280198

7 years ago[AVX-512] Implement masked floating point logical operations with native IR and remov...
Craig Topper [Wed, 31 Aug 2016 05:38:58 +0000 (05:38 +0000)]
[AVX-512] Implement masked floating point logical operations with native IR and remove the builtins.

llvm-svn: 280197

7 years ago[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.
Craig Topper [Wed, 31 Aug 2016 05:38:55 +0000 (05:38 +0000)]
[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.

These will be reused when removing some builtins from avx512vldqintrin.h and this will make the tests for that change show a better number of vector elements.

llvm-svn: 280196

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.

llvm-svn: 280195

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.

llvm-svn: 280194

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.

llvm-svn: 280193

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.

llvm-svn: 280192

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.

llvm-svn: 280191

7 years agoPR12298 et al: don't recursively instantiate a template specialization from
Richard Smith [Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)]
PR12298 et al: don't recursively instantiate a template specialization from
within the instantiation of that same specialization. This could previously
happen for eagerly-instantiated function templates, variable templates,
exception specifications, default arguments, and a handful of other cases.

We still have an issue here for default template arguments that recursively
make use of themselves and likewise for substitution into the type of a
non-type template parameter, but in those cases we're producing a different
entity each time, so they should instead be caught by the instantiation depth
limit. However, currently we will typically run out of stack before we reach
it. :(

llvm-svn: 280190

7 years agoConcatenate two FileCheck lines in a test.
Richard Trieu [Wed, 31 Aug 2016 01:57:12 +0000 (01:57 +0000)]
Concatenate two FileCheck lines in a test.

'cc1' is a valid sequence of hexadecimal and sometimes can occur in the path
when testing.  This can lead to FileCheck matching the incorrect occurance
of the 'cc1' string and causing a test failure.  Join two adjacent flags
together into one check to prevent this.

llvm-svn: 280189

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.

llvm-svn: 280188

7 years agoclangTooling: Update libdeps: LLVMOptions, since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:32 +0000 (00:46 +0000)]
clangTooling: Update libdeps: LLVMOptions, since r280118.

llvm-svn: 280187

7 years agoclangTooling depends on ClangDriverOptions since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:25 +0000 (00:46 +0000)]
clangTooling depends on ClangDriverOptions since r280118.

llvm-svn: 280186

7 years ago[sanitizer] remove kBatchClassID that is not used any more; NFC
Kostya Serebryany [Wed, 31 Aug 2016 00:37:33 +0000 (00:37 +0000)]
[sanitizer] remove kBatchClassID that is not used any more; NFC

llvm-svn: 280185

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

llvm-svn: 280184

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.

llvm-svn: 280183

7 years ago[StreamExecutor] Add Stream::blockHostUntilDone
Jason Henline [Wed, 31 Aug 2016 00:11:14 +0000 (00:11 +0000)]
[StreamExecutor] Add Stream::blockHostUntilDone

Summary: Add the type-safe wrapper to the platform-specific implementation.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

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

llvm-svn: 280182

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

llvm-svn: 280181

7 years ago[clang-tidy] modernize-make-{smart_ptr} private ctor bugfix
Piotr Padlewski [Wed, 31 Aug 2016 00:06:55 +0000 (00:06 +0000)]
[clang-tidy] modernize-make-{smart_ptr} private ctor bugfix

Summary:
Bugfix for 27321. When the constructor of stored pointer
type is private then it is invalid to change it to
make_shared or make_unique.

Reviewers: alexfh, aaron.ballman, hokein

Subscribers: cfe-commits

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

llvm-svn: 280180

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

llvm-svn: 280179

7 years agoDon't try to run a test that generates code for x86 if it's not a registered target.
Richard Smith [Tue, 30 Aug 2016 23:53:34 +0000 (23:53 +0000)]
Don't try to run a test that generates code for x86 if it's not a registered target.

llvm-svn: 280178

7 years ago[StreamExecutor] Simplify Kernel classes
Jason Henline [Tue, 30 Aug 2016 23:35:24 +0000 (23:35 +0000)]
[StreamExecutor] Simplify Kernel classes

Summary:
Make the Kernel class follow the pattern of the other classes. It now
has a type-safe user wrapper and a typeless, platform-specific handle.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

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

llvm-svn: 280176

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

llvm-svn: 280175

7 years ago[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker
Devin Coughlin [Tue, 30 Aug 2016 23:07:14 +0000 (23:07 +0000)]
[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker

Fix a crash when relexing the underlying memory buffer to find incorrect
arguments to NSLocalizedString(). With precompiled headers, the raw
buffer may be NULL. Instead, use the source manager to get the buffer,
which will lazily create the buffer for precompiled headers.

rdar://problem/27429091

llvm-svn: 280174

7 years agoRename the test class
Enrico Granata [Tue, 30 Aug 2016 23:00:52 +0000 (23:00 +0000)]
Rename the test class

llvm-svn: 280173

7 years agoAdd an helper class lldb.formatters.synth.PythonObjectSyntheticChildProvider
Enrico Granata [Tue, 30 Aug 2016 23:00:02 +0000 (23:00 +0000)]
Add an helper class lldb.formatters.synth.PythonObjectSyntheticChildProvider

This class enables one to easily write a synthetic child provider by writing a class that returns pairs of names and primitive Python values - the base class then converts those into LLDB SBValues

Comes with a test case

llvm-svn: 280172

7 years agoDriver: use the canonical static library naming
Saleem Abdulrasool [Tue, 30 Aug 2016 22:10:27 +0000 (22:10 +0000)]
Driver: use the canonical static library naming

On Windows, static libraries are named lib<name>.lib while import libraries are
named <name>.lib.  Use the appropriate naming on itanium and msvc environments.
This is setup properly so that if a dynamic builtins is used on Windows, it
would do the right thing, although this is not currently wired through the
driver (i.e. there is no equivalent to -{shared,static}-gcc).

llvm-svn: 280169

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.

llvm-svn: 280168

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.

llvm-svn: 280167

7 years agoTeach ValueObject::ReadPointedString how to read char[] in host memory
Enrico Granata [Tue, 30 Aug 2016 21:33:47 +0000 (21:33 +0000)]
Teach ValueObject::ReadPointedString how to read char[] in host memory

llvm-svn: 280166

7 years agoclang-format: Correctly calculate affected ranges when sorting #includes.
Daniel Jasper [Tue, 30 Aug 2016 21:33:41 +0000 (21:33 +0000)]
clang-format: Correctly calculate affected ranges when sorting #includes.

affectedRanges takes a start and an end offset, not offset and length.

llvm-svn: 280165

7 years agoFix a typo/thinko - this was generating the wrong kind of array
Enrico Granata [Tue, 30 Aug 2016 21:33:29 +0000 (21:33 +0000)]
Fix a typo/thinko - this was generating the wrong kind of array

llvm-svn: 280164

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.

llvm-svn: 280163

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.

llvm-svn: 280162

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.

llvm-svn: 280161

7 years ago[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
Bruno Cardoso Lopes [Tue, 30 Aug 2016 21:25:42 +0000 (21:25 +0000)]
[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.

This adds support for modules that require (no-)gnu-inline-asm
environment, such as the compiler builtin cpuid submodule.

This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871

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

rdar://problem/26931199

llvm-svn: 280159

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.

llvm-svn: 280158

7 years agoFix memory leak by storing returned pointer in std::unique_ptr
Richard Trieu [Tue, 30 Aug 2016 21:12:48 +0000 (21:12 +0000)]
Fix memory leak by storing returned pointer in std::unique_ptr

llvm-svn: 280157

7 years agoPass Binding instead of IsWeak to addBitcode.
Rafael Espindola [Tue, 30 Aug 2016 20:53:26 +0000 (20:53 +0000)]
Pass Binding instead of IsWeak to addBitcode.

We were computing the binding on both the caller and callee.

llvm-svn: 280156

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.

llvm-svn: 280155

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.

llvm-svn: 280154

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

llvm-svn: 280153

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.

llvm-svn: 280152

7 years agoAdd SBType::GetArrayType() such that - given a type - one can make an array (of a...
Enrico Granata [Tue, 30 Aug 2016 20:39:58 +0000 (20:39 +0000)]
Add SBType::GetArrayType() such that - given a type - one can make an array (of a given size) of that type

This is currently only implemented for the clang-based TypeSystem, but other languages are welcome to jump in!

llvm-svn: 280151

7 years ago[test] Pass a fake libLTO.dylib to a driver test which depends on it
Vedant Kumar [Tue, 30 Aug 2016 20:36:50 +0000 (20:36 +0000)]
[test] Pass a fake libLTO.dylib to a driver test which depends on it

This makes it possible to run 'check-clang' on Darwin without building
libLTO.dylib. See r280142 for more context.

llvm-svn: 280150

7 years agoRevert "[test] Add libLTO as a clang test dependency on Darwin"
Vedant Kumar [Tue, 30 Aug 2016 20:36:48 +0000 (20:36 +0000)]
Revert "[test] Add libLTO as a clang test dependency on Darwin"

This reverts commit r280142. Mehdi suggested a better way to fix up the
test: just create a fake libLTO.dylib and tell the driver where to find
it. Patch incoming...

llvm-svn: 280149

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

llvm-svn: 280148

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!

llvm-svn: 280147

7 years agostats: define WIN32_LEAN_AND_MEAN when including windows.h
Saleem Abdulrasool [Tue, 30 Aug 2016 20:15:46 +0000 (20:15 +0000)]
stats: define WIN32_LEAN_AND_MEAN when including windows.h

Reduce the amount of the header that we end up including in the build.  The
additional definitions are not necessary.

llvm-svn: 280146

7 years agoprofile: add missing include for Windows
Saleem Abdulrasool [Tue, 30 Aug 2016 20:15:44 +0000 (20:15 +0000)]
profile: add missing include for Windows

Add a missing Windows.h which is needed for the windows type usage in the TU
(e.g. HANDLE).

llvm-svn: 280145

7 years ago[LTO] Fix the logic for dropping unnamed_addr.
Davide Italiano [Tue, 30 Aug 2016 20:15:03 +0000 (20:15 +0000)]
[LTO] Fix the logic for dropping unnamed_addr.

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

llvm-svn: 280144

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

llvm-svn: 280143

7 years ago[test] Add libLTO as a clang test dependency on Darwin
Vedant Kumar [Tue, 30 Aug 2016 19:57:40 +0000 (19:57 +0000)]
[test] Add libLTO as a clang test dependency on Darwin

Running 'check-clang' on a stock checkout of llvm+clang doesn't work on
Darwin, because test/Driver/darwin-ld-lto.c can't find libLTO.dylib. Add
libLTO as a clang test dependency on Darwin to fix the problem.

Note: We don't have this issue with check-all because libLTO is in the
test-depends target.

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

llvm-svn: 280142

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.

llvm-svn: 280141

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 @

llvm-svn: 280140

7 years agoA few minor stylistic cleanups in StringExtractor.
Zachary Turner [Tue, 30 Aug 2016 19:47:05 +0000 (19:47 +0000)]
A few minor stylistic cleanups in StringExtractor.

Makes Peek() return a StringRef instead of a const char*.

This leads to a few callers of Peek() being able to be made a
little nicer (for example using StringRef member functions instead
of c-style strncmp and related functions) and generally safer
usage.

llvm-svn: 280139

7 years agoAppease older gcc compilers for the many-microtask-args.c test
Jonathan Peyton [Tue, 30 Aug 2016 19:28:58 +0000 (19:28 +0000)]
Appease older gcc compilers for the many-microtask-args.c test

Older gcc compilers error out with the C99 syntax of: for (int i =...)
so this change just moves the int i; declaration up above.

llvm-svn: 280138

7 years agoUse llvm to do endian conversions.
Zachary Turner [Tue, 30 Aug 2016 19:28:01 +0000 (19:28 +0000)]
Use llvm to do endian conversions.

LLDB was rolling its own endian conversion code, but functions to
do this already exist in LLVM.  While the code was probably
correct, no point reinventing the wheel when we have well tested
equivalents in LLVM that are one-liners.

llvm-svn: 280137

7 years agoPR29166: when merging declarations with typedef names for linkage purposes,
Richard Smith [Tue, 30 Aug 2016 19:13:18 +0000 (19:13 +0000)]
PR29166: when merging declarations with typedef names for linkage purposes,
don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

llvm-svn: 280136

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

llvm-svn: 280135

7 years agoUnrevert r280035 now that the clang-cl bug it exposed has been fixed by
Richard Smith [Tue, 30 Aug 2016 19:06:26 +0000 (19:06 +0000)]
Unrevert r280035 now that the clang-cl bug it exposed has been fixed by
r280133. Original commit message:

C++ Modules TS: driver support for building modules.

This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

llvm-svn: 280134

7 years agoPR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.
Richard Smith [Tue, 30 Aug 2016 18:55:16 +0000 (18:55 +0000)]
PR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.

llvm-svn: 280133

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.

llvm-svn: 280132