platform/upstream/llvm.git
7 years agoRevert "[asan] Fix size of shadow incorrectly calculated in r279178"
Vitaly Buka [Fri, 19 Aug 2016 17:15:33 +0000 (17:15 +0000)]
Revert "[asan] Fix size of shadow incorrectly calculated in r279178"

This reverts commit r279222.

Speculative revert in hope to fix asan crash on arm.

llvm-svn: 279276

7 years ago[RuntimeDyld] Revert r279182 and 279201 -- they broke some ARM bots.
Lang Hames [Fri, 19 Aug 2016 17:06:39 +0000 (17:06 +0000)]
[RuntimeDyld] Revert r279182 and 279201 -- they broke some ARM bots.

llvm-svn: 279275

7 years ago[AliasSetTracker] Degrade AliasSetTracker when may-alias sets get too large.
Michael Kuperstein [Fri, 19 Aug 2016 17:05:22 +0000 (17:05 +0000)]
[AliasSetTracker] Degrade AliasSetTracker when may-alias sets get too large.

Repeated inserts into AliasSetTracker have quadratic behavior - inserting a
pointer into AST is linear, since it requires walking over all "may" alias
sets and running an alias check vs. every pointer in the set.

We can avoid this by tracking the total number of pointers in "may" sets,
and when that number exceeds a threshold, declare the tracker "saturated".
This lumps all pointers into a single "may" set that aliases every other
pointer.

(This is a stop-gap solution until we migrate to MemorySSA)

This fixes PR28832.
Differential Revision: https://reviews.llvm.org/D23432

llvm-svn: 279274

7 years ago[X86][SSE] Generalised combining to VZEXT_MOVL to any vector size
Simon Pilgrim [Fri, 19 Aug 2016 17:02:00 +0000 (17:02 +0000)]
[X86][SSE] Generalised combining to VZEXT_MOVL to any vector size

This doesn't change tests codegen as we already combined to blend+zero which is what we lower VZEXT_MOVL to on SSE41+ targets, but it does put us in a better position when we improve shuffling for optsize.

llvm-svn: 279273

7 years ago[Hexagon] Enforce LLSC packetization rules
Krzysztof Parzyszek [Fri, 19 Aug 2016 16:57:05 +0000 (16:57 +0000)]
[Hexagon] Enforce LLSC packetization rules

Ensure that load locked and store conditional instructions are only
packetized with ALU32 instructions.

Patch by Ben Craig.

llvm-svn: 279272

7 years agoFix regression in InstCombine introduced by r278944
Reid Kleckner [Fri, 19 Aug 2016 16:53:18 +0000 (16:53 +0000)]
Fix regression in InstCombine introduced by r278944

The intended transform is:
  // Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0
  // -> and (icmp eq P, null), (icmp eq Q, null).

P and Q are both pointer types, but may have different types. We need
two calls to getNullValue() to make the icmps.

llvm-svn: 279271

7 years agoMachineScheduler: Make some GenericScheduler member variables protected
Tom Stellard [Fri, 19 Aug 2016 16:44:32 +0000 (16:44 +0000)]
MachineScheduler: Make some GenericScheduler member variables protected

Summary: We will need these in AMDGPU's new SchedStrategy implmentation.

Reviewers: MatzeB, atrick

Subscribers: llvm-commits, MatzeB

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

llvm-svn: 279270

7 years ago[Hexagon] Minor updates to register definitions
Krzysztof Parzyszek [Fri, 19 Aug 2016 16:40:19 +0000 (16:40 +0000)]
[Hexagon] Minor updates to register definitions

llvm-svn: 279269

7 years ago[CloneFunction] Don't remove unrelated nodes from the CGSSC
David Majnemer [Fri, 19 Aug 2016 16:37:40 +0000 (16:37 +0000)]
[CloneFunction] Don't remove unrelated nodes from the CGSSC

CGSCC use a WeakVH to track call sites.  RAUW a call within a function
can result in that WeakVH getting confused about whether or not the call
site is still around.

llvm-svn: 279268

7 years ago[Hexagon] Fix incorrect generation of S4_subi_asl_ri
Krzysztof Parzyszek [Fri, 19 Aug 2016 16:35:05 +0000 (16:35 +0000)]
[Hexagon] Fix incorrect generation of S4_subi_asl_ri

Patch by Jyotsna Verma.

llvm-svn: 279267

7 years ago[InstCombine] use m_APInt to allow icmp (shl 1, Y), C folds for splat constant vectors
Sanjay Patel [Fri, 19 Aug 2016 16:12:16 +0000 (16:12 +0000)]
[InstCombine] use m_APInt to allow icmp (shl 1, Y), C folds for splat constant vectors

llvm-svn: 279266

7 years ago[Hexagon] Add missing pattern for C4_cmplte
Krzysztof Parzyszek [Fri, 19 Aug 2016 16:11:33 +0000 (16:11 +0000)]
[Hexagon] Add missing pattern for C4_cmplte

llvm-svn: 279265

7 years ago[ELF] - Fix for PR28976 - Corrupted section contents when using linker scripts
George Rimar [Fri, 19 Aug 2016 15:46:28 +0000 (15:46 +0000)]
[ELF] - Fix for PR28976 - Corrupted section contents when using linker scripts

This is fix for PR28976.

Problem was that in scanRelocs, we computed relocation offset too early
for case when linkerscript was used. Patch fixes the issue
delaying the calculation.

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

llvm-svn: 279264

7 years ago[InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectors
Sanjay Patel [Fri, 19 Aug 2016 15:40:44 +0000 (15:40 +0000)]
[InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectors

Of course, we really need to refactor and fix all of the cmp predicates,
but this one is interesting because without it, we later perform an
information-losing transform of icmp (shl 1, Y), C, and we can't recover
the better fold.

llvm-svn: 279263

7 years ago[ELF] - Give automatically generated __start_* and __stop_* symbols default visibility.
George Rimar [Fri, 19 Aug 2016 15:36:32 +0000 (15:36 +0000)]
[ELF] - Give automatically generated __start_* and __stop_* symbols default visibility.

This patch is opposite to D19024, which made this symbols to be hidden by default.

Unfortunately FreeBSD loader wants to see
start_set_modmetadata_set/stop_set_modmetadata_set in the dynamic symbol table.
They were not placed there because had hidden visibility.

Patch makes them to have default visibility again.

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

llvm-svn: 279262

7 years ago[LTO] Remove dead-code: collectUsedGlobalVariables has been moved to Thin and LTO...
Mehdi Amini [Fri, 19 Aug 2016 15:35:44 +0000 (15:35 +0000)]
[LTO] Remove dead-code: collectUsedGlobalVariables has been moved to Thin and LTO specifc path (NFC)

llvm-svn: 279261

7 years ago[InstCombine] add tests for missing vector icmp folds
Sanjay Patel [Fri, 19 Aug 2016 15:27:28 +0000 (15:27 +0000)]
[InstCombine] add tests for missing vector icmp folds

llvm-svn: 279259

7 years ago[ELF] - Linkerscript: set correct dynamic tag entries values when LS is used.
George Rimar [Fri, 19 Aug 2016 15:23:39 +0000 (15:23 +0000)]
[ELF] - Linkerscript: set correct dynamic tag entries values when LS is used.

Previously DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ and DT_FINI_ARRAYSZ
were set to zero when lincerscript was used becase sections sizes are
calculated later that were taken.

Patch delays values calculation for these entries. Testcase is provided.

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

llvm-svn: 279258

7 years ago[InstCombine] add missing tests for basic icmp folds
Sanjay Patel [Fri, 19 Aug 2016 15:21:45 +0000 (15:21 +0000)]
[InstCombine] add missing tests for basic icmp folds

These are implicitly included as part of larger test cases, but they don't
exist stand-alone (and don't happen for vectors...).

llvm-svn: 279257

7 years ago[ELF] - Linkerscript: implemented SUBALIGN() command.
George Rimar [Fri, 19 Aug 2016 15:18:23 +0000 (15:18 +0000)]
[ELF] - Linkerscript: implemented SUBALIGN() command.

You can force input section alignment within an output section by using SUBALIGN. The
value specified overrides any alignment given by input sections, whether larger or smaller.

SUBALIGN is used in many projects in the wild.

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

llvm-svn: 279256

7 years ago[Hexagon] Make p0 an explicit operand in VA1_clr* subinstructions, NFC
Krzysztof Parzyszek [Fri, 19 Aug 2016 15:17:19 +0000 (15:17 +0000)]
[Hexagon] Make p0 an explicit operand in VA1_clr* subinstructions, NFC

llvm-svn: 279255

7 years ago[Hexagon] Add explicit default constructor for HexagonSelectionDAGInfo
Krzysztof Parzyszek [Fri, 19 Aug 2016 15:13:54 +0000 (15:13 +0000)]
[Hexagon] Add explicit default constructor for HexagonSelectionDAGInfo

llvm-svn: 279254

7 years agobuild: allow building a specific set of sanitizers
Saleem Abdulrasool [Fri, 19 Aug 2016 15:13:21 +0000 (15:13 +0000)]
build: allow building a specific set of sanitizers

Introduce a new CMake option `COMPILER_RT_SANITIZERS_TO_BUILD` which takes
either a special token `all` (default) which will preserve the current behaviour
or a CMake list of sanitizers to build.  It will still perform the normal checks
if the sanitizer is requested.  It only permits a further means to exclude a
particular sanitizer.  This gives finer grained control than
`COMPILER_RT_BUILD_SANITIZERS` which only gives an all or nothing control.

llvm-svn: 279253

7 years agoUnxfail passing tests on Hexagon
Krzysztof Parzyszek [Fri, 19 Aug 2016 15:07:58 +0000 (15:07 +0000)]
Unxfail passing tests on Hexagon

llvm-svn: 279252

7 years ago[Hexagon] Allow tail-call optimization when mixing C and fast calling conv
Krzysztof Parzyszek [Fri, 19 Aug 2016 15:02:18 +0000 (15:02 +0000)]
[Hexagon] Allow tail-call optimization when mixing C and fast calling conv

Patch by Arnold Schwaighofer.

llvm-svn: 279251

7 years agoclang-format: [JS] handle object literals with casts.
Martin Probst [Fri, 19 Aug 2016 14:35:01 +0000 (14:35 +0000)]
clang-format: [JS] handle object literals with casts.

Summary: E.g. `{a: 1} as b`.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 279250

7 years ago[Hexagon] Check for empty live interval
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:29:43 +0000 (14:29 +0000)]
[Hexagon] Check for empty live interval

Patch by Brendon Cahoon.

llvm-svn: 279249

7 years ago[Hexagon] Consider zext/sext of a load to i32 to be free
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:22:07 +0000 (14:22 +0000)]
[Hexagon] Consider zext/sext of a load to i32 to be free

llvm-svn: 279248

7 years agoRevert r279242 - it's failing the tests
Anton Korobeynikov [Fri, 19 Aug 2016 14:18:34 +0000 (14:18 +0000)]
Revert r279242 - it's failing the tests

llvm-svn: 279247

7 years ago[Hexagon] Handle J2_jumptpt and J2_jumpfpt instructions
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:14:09 +0000 (14:14 +0000)]
[Hexagon] Handle J2_jumptpt and J2_jumpfpt instructions

llvm-svn: 279246

7 years ago[Hexagon] Fix indentation, NFC
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:12:51 +0000 (14:12 +0000)]
[Hexagon] Fix indentation, NFC

llvm-svn: 279245

7 years ago[Hexagon] Remove unnecessary llvm::, NFC
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:10:57 +0000 (14:10 +0000)]
[Hexagon] Remove unnecessary llvm::, NFC

llvm-svn: 279244

7 years ago[Hexagon] Rename the HEXAGON_MC namespace to Hexagon_MC, NFC
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:09:47 +0000 (14:09 +0000)]
[Hexagon] Rename the HEXAGON_MC namespace to Hexagon_MC, NFC

llvm-svn: 279243

7 years agoFix PR27500: on MSP430 the branch destination offset is measured in words, not bytes.
Anton Korobeynikov [Fri, 19 Aug 2016 14:07:10 +0000 (14:07 +0000)]
Fix PR27500: on MSP430 the branch destination offset is measured in words, not bytes.
In addition, the branch instructions will have proper BB destinations, not offsets, like before.

Patch by Vadzim Dambrouski!

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

llvm-svn: 279242

7 years ago[Hexagon] Mark PS_jumpret as pseudo-instruction, expand it into J2_jumpr
Krzysztof Parzyszek [Fri, 19 Aug 2016 14:04:45 +0000 (14:04 +0000)]
[Hexagon] Mark PS_jumpret as pseudo-instruction, expand it into J2_jumpr

llvm-svn: 279241

7 years agoFixed a typo (compilation_commands.json --> compile_commands.json).
Andrey Bokhanko [Fri, 19 Aug 2016 13:36:31 +0000 (13:36 +0000)]
Fixed a typo (compilation_commands.json --> compile_commands.json).

llvm-svn: 279240

7 years ago[Hexagon] Improvements to handling and generation of FP instructions
Krzysztof Parzyszek [Fri, 19 Aug 2016 13:34:31 +0000 (13:34 +0000)]
[Hexagon] Improvements to handling and generation of FP instructions

Improved handling of fma, floating point min/max, additional load/store
instructions for floating point types.

Patch by Jyotsna Verma.

llvm-svn: 279239

7 years agoFix 32-bit builds after r279232
Pavel Labath [Fri, 19 Aug 2016 13:14:13 +0000 (13:14 +0000)]
Fix 32-bit builds after r279232

GetByteSize() of a DataBuffer returns a uint64_t (it probably shouldn't), which isn't implicitly
convertible to size_t.

llvm-svn: 279238

7 years agoCleanup: Move the *AddressDescription printing code to Print() members inside those...
Filipe Cabecinhas [Fri, 19 Aug 2016 13:07:23 +0000 (13:07 +0000)]
Cleanup: Move the *AddressDescription printing code to Print() members inside those structs.

Summary:
The Print() members might take optional access_size and bug_type
parameters to still be able to provide the same information

Reviewers: kcc, samsonov

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 279237

7 years ago[ELF] - Removed excessive llvm-readobj call from linkerscript-ouputformat.s. NFC.
George Rimar [Fri, 19 Aug 2016 12:57:45 +0000 (12:57 +0000)]
[ELF] - Removed excessive llvm-readobj call from linkerscript-ouputformat.s. NFC.

llvm-svn: 279236

7 years ago[AMDGPU] add s_incperflevel/s_decperflevel builtins
Valery Pykhtin [Fri, 19 Aug 2016 12:54:31 +0000 (12:54 +0000)]
[AMDGPU] add s_incperflevel/s_decperflevel builtins

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

llvm-svn: 279235

7 years agoFixing a Darwing test thats failing on windows
Dimitar Vlahovski [Fri, 19 Aug 2016 12:44:53 +0000 (12:44 +0000)]
Fixing a Darwing test thats failing on windows

The pexpect import should be make after the skip-if-not-darwin part
because pexpect is not available on Windows

llvm-svn: 279234

7 years ago[LoopVectorize] Don't copy std::vector in for-range loop.
Benjamin Kramer [Fri, 19 Aug 2016 12:44:24 +0000 (12:44 +0000)]
[LoopVectorize] Don't copy std::vector in for-range loop.

llvm-svn: 279233

7 years agoRemove the last manually constructed packet from gdb-remote register context + small...
Pavel Labath [Fri, 19 Aug 2016 12:31:49 +0000 (12:31 +0000)]
Remove the last manually constructed packet from gdb-remote register context + small refactor

Summary:
The tricky part here was that the exisiting implementation of WriteAllRegisters was expecting
hex-encoded data (as that was what the first implementation I replaced was using, but here we had
binary data to begin with. I thought the read/write register functions would be more useful if
they handled the hex-encoding themselves (all the other client functions provide the responses in
a more-or-less digested form). The read functions return a DataBuffer, so they can allocate as
much memory as they need to, while the write functions functions take an llvm::ArrayRef, as that
can be constructed from pretty much anything.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 279232

7 years ago[PM] Revert r279227 and r279228 until I can find someone to help me
Chandler Carruth [Fri, 19 Aug 2016 10:51:55 +0000 (10:51 +0000)]
[PM] Revert r279227 and r279228 until I can find someone to help me
solve completely opaque MSVC build errors. It complains about lots of
stuff with this change without givin nearly enough information to even
try to fix.

llvm-svn: 279231

7 years ago[X86][SSE] Add support for matching commuted insertps patterns
Simon Pilgrim [Fri, 19 Aug 2016 10:31:53 +0000 (10:31 +0000)]
[X86][SSE] Add support for matching commuted insertps patterns

INSERTPS doesn't fit well with our shuffle mask canonicalization, so we need to attempt both the original mask and the commuted mask to more likely get a match

llvm-svn: 279230

7 years ago[SimplifyCFG] Rewrite SinkThenElseCodeToEnd
James Molloy [Fri, 19 Aug 2016 10:10:27 +0000 (10:10 +0000)]
[SimplifyCFG] Rewrite SinkThenElseCodeToEnd

The new version has several advantages:
  1) IMSHO it's more readable and neater
  2) It handles loads and stores properly
  3) It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.

With this change we can now finally sink load-modify-store idioms such as:

    if (a)
      return *b += 3;
    else
      return *b += 4;

    =>

    %z = load i32, i32* %y
    %.sink = select i1 %a, i32 5, i32 7
    %b = add i32 %z, %.sink
    store i32 %b, i32* %y
    ret i32 %b

When this works for switches it'll be even more powerful.

llvm-svn: 279229

7 years ago[PM] Fix a compile error with GCC. NFC.
Chandler Carruth [Fri, 19 Aug 2016 09:53:10 +0000 (09:53 +0000)]
[PM] Fix a compile error with GCC. NFC.

llvm-svn: 279228

7 years ago[PM] Make the the new pass manager support fully generic extra arguments
Chandler Carruth [Fri, 19 Aug 2016 09:45:16 +0000 (09:45 +0000)]
[PM] Make the the new pass manager support fully generic extra arguments
to run methods, both for transform passes and analysis passes.

This also allows the analysis manager to use a different set of extra
arguments from the pass manager where useful. Consider passes over
analysis produced units of IR like SCCs of the call graph or loops.
Passes of this nature will often want to refer to the analysis result
that was used to compute their IR units (the call graph or LoopInfo).
And for transformations, they may want to communicate special update
information to the outer pass manager. With this change, it becomes
possible to have a run method for a loop pass that looks more like:

  PreservedAnalyses run(Loop &L, AnalysisManager<Loop, LoopInfo> &AM,
                        LoopInfo &LI, LoopUpdateRecord &UR);

And to query the analysis manager like:

    AM.getResult<MyLoopAnalysis>(L, LI);

This makes accessing the known-available analyses convenient and clear,
and it makes passing customized data structures around easy.

My initial use case is going to be in updating the pass manager layers
when the analysis units of IR change. But there are more use cases here
such as having a layer that lets inner passes signal whether certain
additional passes should be run because of particular simplifications
made. Two desires for this have come up in the past: triggering
additional optimization after successfully unrolling loops, and
triggering additional inlining after collapsing indirect calls to direct
calls.

Despite adding this layer of generic extensibility, the *only* change to
existing, simple usage are for places where we forward declare the
AnalysisManager template. We really shouldn't be doing this because of
the fragility exposed here, but currently it makes coping with the
legacy PM code easier.

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

llvm-svn: 279227

7 years agominor header guards and help messages cleanup
Kirill Bobyrev [Fri, 19 Aug 2016 09:36:14 +0000 (09:36 +0000)]
minor header guards and help messages cleanup

llvm-svn: 279226

7 years ago[PM] Try to work-around what appears to be an MSVC SFINAE issue with
Chandler Carruth [Fri, 19 Aug 2016 09:26:00 +0000 (09:26 +0000)]
[PM] Try to work-around what appears to be an MSVC SFINAE issue with
r279217 where it fails to select the path that other compilers select.

The workaround won't be as careful to produce an error when an analysis
result is incorrect, but we can rely on non-MSVC builds to catch such
errors it seems and MSVC doesn't seem to support the alternative
techniques.

Hoping this brings the windows bots back to life. If not, will have to
revert all of this.

llvm-svn: 279225

7 years ago[CodeGen] Fix a trivial type conversion bug dating back to pre-2008
James Molloy [Fri, 19 Aug 2016 08:38:50 +0000 (08:38 +0000)]
[CodeGen] Fix a trivial type conversion bug dating back to pre-2008

The heuristic above this code is incredibly suspect, but disregarding that it mutates the cast opcode so we need to check the *mutated* opcode later to see if we need to emit an AssertSext or AssertZext node.

Fixes PR29041.

llvm-svn: 279223

7 years ago[asan] Fix size of shadow incorrectly calculated in r279178
Vitaly Buka [Fri, 19 Aug 2016 08:33:53 +0000 (08:33 +0000)]
[asan] Fix size of shadow incorrectly calculated in r279178

Summary: r279178 generates 8 times more stores than necessary.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 279222

7 years ago[PM] NFC refactoring: remove the AnalysisManagerBase class, folding it
Chandler Carruth [Fri, 19 Aug 2016 08:31:47 +0000 (08:31 +0000)]
[PM] NFC refactoring: remove the AnalysisManagerBase class, folding it
into the AnalysisManager class template.

Back when I first added this base class there were separate analysis
managers and some plausible reason why it would be a useful factoring of
common code between them. However, after a lot of refactoring cleaning,
we now have *entirely* shared code. The base class was just an arbitrary
division between code in one class template and a separate class
template. It didn't add anything and forced lots of indirection through
"derived_this" for no real gain.

We can always factor a base CRTP class out with common code if there is
ever some *other* analysis manager that wants to share a subset of
logic. But for now, folding things into the primary template is
a non-trivial simplification with no down sides I see. It shortens the
code considerably, removes an unhelpful abstraction, and will make
subsequent patches *dramatically* less complex which enhance the
analysis manager infrastructure to effectively cope with invalidation.

llvm-svn: 279221

7 years ago[ELF] - Do not change binding of symbols when creating relocatable output.
George Rimar [Fri, 19 Aug 2016 08:31:02 +0000 (08:31 +0000)]
[ELF] - Do not change binding of symbols when creating relocatable output.

Spec says "A hidden symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object".
But we previously converted symbols to STB_LOCAL even when -r was specified.

Broken binary was produced, this is PR28967, patch fixes the issue.

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

llvm-svn: 279220

7 years ago[modules] Add missing include.
Vassil Vassilev [Fri, 19 Aug 2016 08:30:42 +0000 (08:30 +0000)]
[modules] Add missing include.

llvm-svn: 279219

7 years agoRevert "[CMake] Fix ASM building in llvm/runtimes"
Jonas Hahnfeld [Fri, 19 Aug 2016 08:03:26 +0000 (08:03 +0000)]
Revert "[CMake] Fix ASM building in llvm/runtimes"

This reverts the TSAN parts of commit r279215.

llvm-svn: 279218

7 years ago[PM] Redesign how the new PM detects whether an analysis result provides
Chandler Carruth [Fri, 19 Aug 2016 07:49:23 +0000 (07:49 +0000)]
[PM] Redesign how the new PM detects whether an analysis result provides
its own invalidate method.

Previously, the technique would assume that if a result didn't have an
invalidate method that didn't exactly match the expected signature it
didn't have one at all. This is in fact not the case. And we had
analyses with incorrect signatures for the invalidate method in the
tree that would be erroneously invalidated in certain cases! Yikes.

Moreover a result might legitimately want to have multiple overloads for
the invalidate method, and if one changes or a new one is needed we
again really want a compiler error. For example in the tree we had not
added the overload for a *function* IR unit to the invalidate routine
for TLI. Doh.

So a new techique for the SFINAE detection here: if the result has *any*
member spelled "invalidate" we turn off the synthesis of a default
version. We don't care if it is a member function or a member variable
or how many overloads there are. Once a result has something by that
name it must provide suitable overloads for the contexts in which it is
used. This seems much more resilient and durable.

Huge props to Richard Smith who helped me figure out how on earth we
could even do this in C++. It took quite some doing. The technique is
remarkably clean however, and merely requires that the analysis results
are not *final* classes. I think that's a requirement we can live with
even if it is a bit odd.

I've fixed the two bad in-tree analysis results. And this will make my
next change which changes the API for invalidate much easier to
validate as correct.

llvm-svn: 279217

7 years ago[PM] Rework the new PM support for building the ModuleSummaryIndex to
Chandler Carruth [Fri, 19 Aug 2016 07:49:19 +0000 (07:49 +0000)]
[PM] Rework the new PM support for building the ModuleSummaryIndex to
directly produce the index as the value type result.

This requires making the index movable which is straightforward. It
greatly simplifies things by allowing us to completely avoid the builder
API and the layers of abstraction inherent there. Instead both pass
managers can directly construct these when run by value. They still
won't be constructed truly eagerly thanks to the optional in the legacy
PM. The code that directly builds the index can also just share a direct
function.

A notable change here is that the result type of the analysis for the
new PM is no longer a reference type. This was really problematic when
making changes to how we handle result types to make our interface
requirements *much* more strict and precise. But I think this is an
overall improvement.

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

llvm-svn: 279216

7 years ago[CMake] Fix ASM building in llvm/runtimes
Jonas Hahnfeld [Fri, 19 Aug 2016 06:46:00 +0000 (06:46 +0000)]
[CMake] Fix ASM building in llvm/runtimes

When compiler-rt's CMake is not directly invoked, it will currently not call
project() and thus ASM will not be enabled.
We also don't need to put the .S files through the C compiler then.

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

llvm-svn: 279215

7 years agoFix tests in llvm/test/tools/gold/X86 to satisfy r279014.
NAKAMURA Takumi [Fri, 19 Aug 2016 06:44:44 +0000 (06:44 +0000)]
Fix tests in llvm/test/tools/gold/X86 to satisfy r279014.

They would unexpectedly pass if test/tools/gold/X86/Output had outputs of previous tests.

llvm-svn: 279214

7 years ago[Profile] Fix edge count read bug
Xinliang David Li [Fri, 19 Aug 2016 06:31:45 +0000 (06:31 +0000)]
[Profile] Fix edge count read bug

 Use uint64_t to avoid value truncation before scaling.

llvm-svn: 279213

7 years ago[LTO] Move callback member from base class to the derived where it is used (NFC)
Mehdi Amini [Fri, 19 Aug 2016 06:10:03 +0000 (06:10 +0000)]
[LTO] Move callback member from base class to the derived where it is used (NFC)

llvm-svn: 279212

7 years agoConstify some path in the bitcode writer (NFC)
Mehdi Amini [Fri, 19 Aug 2016 06:06:18 +0000 (06:06 +0000)]
Constify some path in the bitcode writer (NFC)

llvm-svn: 279211

7 years ago[LTO] Add a move to inialize member in ctor initialization list (NFC)
Mehdi Amini [Fri, 19 Aug 2016 05:56:37 +0000 (05:56 +0000)]
[LTO] Add a move to inialize member in ctor initialization list (NFC)

llvm-svn: 279210

7 years ago[Profile] Simple code refactoring for reuse /NFC
Xinliang David Li [Fri, 19 Aug 2016 05:31:33 +0000 (05:31 +0000)]
[Profile] Simple code refactoring for reuse /NFC

llvm-svn: 279209

7 years agoadd all missing gtest tests to the Xcode lldb-gtest target
Todd Fiala [Fri, 19 Aug 2016 05:26:40 +0000 (05:26 +0000)]
add all missing gtest tests to the Xcode lldb-gtest target

Exclusions:
ModuleCacheTest: https://llvm.org/bugs/show_bug.cgi?id=29045
SymbolFilePDBTests: https://llvm.org/bugs/show_bug.cgi?id=29046

llvm-svn: 279208

7 years agoclang/test/Modules/prebuilt-module.m: Prune "-triple" to fix a configuration mismatch.
NAKAMURA Takumi [Fri, 19 Aug 2016 05:25:26 +0000 (05:25 +0000)]
clang/test/Modules/prebuilt-module.m: Prune "-triple" to fix a configuration mismatch.

llvm-svn: 279207

7 years agoRe-commit [OpenCL] AMDGCN: Fix size_t type
Yaxun Liu [Fri, 19 Aug 2016 05:17:25 +0000 (05:17 +0000)]
Re-commit [OpenCL] AMDGCN: Fix size_t type

There was a premature cast to pointer type in emitPointerArithmetic which caused assertion in tests with assertion enabled.

llvm-svn: 279206

7 years agofixup macOS gtest running
Todd Fiala [Fri, 19 Aug 2016 04:55:12 +0000 (04:55 +0000)]
fixup macOS gtest running

Needed to explicitly turn off RTTI (since lldb-core builds
with -fno-rtti) and specify -DGTEST_HAVE_RTTI=0.

llvm-svn: 279205

7 years ago[XRay] Synthesize a reference to the xray_instr_map
Dean Michael Berris [Fri, 19 Aug 2016 04:44:30 +0000 (04:44 +0000)]
[XRay] Synthesize a reference to the xray_instr_map

Without the synthesized reference to a symbol in the xray_instr_map,
linker section garbage collection will helpfully remove the whole
xray_instr_map section from the final executable (or archive). This will
cause the runtime to not be able to identify the sleds and hot-patch the
calls/jumps into the runtime trampolines.

This change adds a reference from the text section at the end of the
function to keep around the associated xray_instr_map section as well.

We also make sure that we catch this reference in the test.

Reviewers: chandlerc, echristo, majnemer, mehdi_amini

Subscribers: mehdi_amini, llvm-commits, dberris

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

llvm-svn: 279204

7 years agofix broken gdb-remote gtest
Todd Fiala [Fri, 19 Aug 2016 04:38:44 +0000 (04:38 +0000)]
fix broken gdb-remote gtest

This change adds the Process/gdb-remote gtests to the Xcode
build.  It also adds a virtual method impl to the continuation
delegate that I added with the StructuredDataPlugin change.

llvm-svn: 279203

7 years agoAdd StructuredData plugin type; showcase with new DarwinLog feature
Todd Fiala [Fri, 19 Aug 2016 04:21:48 +0000 (04:21 +0000)]
Add StructuredData plugin type; showcase with new DarwinLog feature

Take 2, with missing cmake line fixed.  Build tested on
Ubuntu 14.04 with clang-3.6.

See docs/structured_data/StructuredDataPlugins.md for details.

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

reviewers: clayborg, jingham
llvm-svn: 279202

7 years ago[RuntimeDyld][MCJIT] Un-XFAIL some tests that were fixed by r279182.
Lang Hames [Fri, 19 Aug 2016 03:12:16 +0000 (03:12 +0000)]
[RuntimeDyld][MCJIT] Un-XFAIL some tests that were fixed by r279182.

llvm-svn: 279201

7 years agoRevert "Add StructuredData plugin type; showcase with new DarwinLog feature"
Todd Fiala [Fri, 19 Aug 2016 03:03:58 +0000 (03:03 +0000)]
Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"

This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8.

llvm-svn: 279200

7 years agoRevert "RegScavenging: Add scavengeRegisterBackwards()"
Matthias Braun [Fri, 19 Aug 2016 03:03:24 +0000 (03:03 +0000)]
Revert "RegScavenging: Add scavengeRegisterBackwards()"

The ppc64 multistage bot fails on this.

This reverts commit r279124.

Also Revert "CodeGen: Add/Factor out LiveRegUnits class; NFCI" because it depends on the previous change
This reverts commit r279171.

llvm-svn: 279199

7 years agoAdd StructuredData plugin type; showcase with new DarwinLog feature
Todd Fiala [Fri, 19 Aug 2016 02:52:07 +0000 (02:52 +0000)]
Add StructuredData plugin type; showcase with new DarwinLog feature

See docs/structured_data/StructuredDataPlugins.md for details.

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

reviewers: clayborg, jingham
llvm-svn: 279198

7 years ago[ADT] Add the worlds simplest STL extra. Or at least close to it.
Chandler Carruth [Fri, 19 Aug 2016 02:07:51 +0000 (02:07 +0000)]
[ADT] Add the worlds simplest STL extra. Or at least close to it.

This is a little class template that just builds an inheritance chain of
empty classes. Despite how simple this is, it can be used to really
nicely create ranked overload sets. I've added a unittest as much to
document this as test it. You can pass an object of this type as an
argument to a function overload set an it will call the first viable and
enabled candidate at or below the rank of the object.

I'm planning to use this in a subsequent commit to more clearly rank
overload candidates used for SFINAE. All credit for this technique and
both lines of code here to Richard Smith who was helping me rewrite the
SFINAE check in question to much more effectively capture the intended
set of checks.

llvm-svn: 279197

7 years agoC++ Modules TS: support parsing the 'module' declaration (including extensions
Richard Smith [Fri, 19 Aug 2016 01:43:06 +0000 (01:43 +0000)]
C++ Modules TS: support parsing the 'module' declaration (including extensions
from p0273r0 approved by EWG). We'll eventually need to handle this from the
lexer as well, in order to disallow preprocessor directives preceding the
module declaration and to support macro import.

llvm-svn: 279196

7 years ago[www] Add analyzer FAQ about not releasing ivars in -dealloc.
Devin Coughlin [Fri, 19 Aug 2016 01:22:50 +0000 (01:22 +0000)]
[www] Add analyzer FAQ about not releasing ivars in -dealloc.

llvm-svn: 279183

7 years ago[RuntimeDyld] Add support for ELF R_ARM_REL32 and R_ARM_GOT_PREL.
Lang Hames [Fri, 19 Aug 2016 01:15:39 +0000 (01:15 +0000)]
[RuntimeDyld] Add support for ELF R_ARM_REL32 and R_ARM_GOT_PREL.

Patch by William Dillon. Thanks William!

This patch adds support for the R_ARM_REL32 and R_ARM_GOT_PREL ELF ARM
relocations to RuntimeDyld, which should allow JITing of code that
produces these relocations.

No test case: Unfortunately RuntimeDyldELF's GOT building mechanism (which
uses a separate section for GOT entries) isn't compatible with
RuntimeDyldChecker. The correct fix for this is to fix RuntimeDyldELF's GOT
support (it's fundamentally broken at the moment: separate sections aren't
guaranteed to be in range of a GOT entry load), but that's a non-trivial job.

llvm-svn: 279182

7 years ago[analyzer] Weaken assertion in trackNullOrUndefValue()
Devin Coughlin [Fri, 19 Aug 2016 01:05:31 +0000 (01:05 +0000)]
[analyzer] Weaken assertion in trackNullOrUndefValue()

We should ignore paren casts when making sure that the semantic expression
in a PseudoObjectExpr for an ObjC getter is a message send.

This has no other intended functionality change.

Adding a test for this exposed an interesting issue in another test case
that only manifests under ARC. trackNullOrUndefValue() is not properly
suppressing for nil values that are the result of nil propagation from a nil
receiver when the nil is returned from a function. I've added a FIXME for that
missing suppression.

rdar://problem/27290568

llvm-svn: 279181

7 years agoEHABI: cover switch once more
Saleem Abdulrasool [Thu, 18 Aug 2016 23:59:12 +0000 (23:59 +0000)]
EHABI: cover switch once more

When making WMMX support optional, we uncovered the switch.  Add the missing
entries.  Since the entry is a break leading to a dead path, it should get
optimized out yet retain the switch overage.

llvm-svn: 279180

7 years ago[asan] Optimize store size in FunctionStackPoisoner::poisonRedZones
Vitaly Buka [Thu, 18 Aug 2016 23:51:15 +0000 (23:51 +0000)]
[asan] Optimize store size in FunctionStackPoisoner::poisonRedZones

Summary: Reduce store size to avoid leading and trailing zeros.

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 279178

7 years agoInclude X86CallFrameOptimization in the opt-bisect process.
Andrew Kaylor [Thu, 18 Aug 2016 22:49:51 +0000 (22:49 +0000)]
Include X86CallFrameOptimization in the opt-bisect process.

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

llvm-svn: 279175

7 years agoAArch64: remove extraneous padding
Saleem Abdulrasool [Thu, 18 Aug 2016 22:35:06 +0000 (22:35 +0000)]
AArch64: remove extraneous padding

The structs BarrierOp, PrefetchOp, PSBHintOp are in AArch64AsmParser.cpp
(inside anonymous namespace).  This diff changes the order of fields and
removes the excessive padding (8 bytes).

Patch by Alexander Shaposhnikov!

llvm-svn: 279173

7 years ago[CMake] Add variables for tracking which runtimes are included
Chris Bieneman [Thu, 18 Aug 2016 22:18:11 +0000 (22:18 +0000)]
[CMake] Add variables for tracking which runtimes are included

This allows sub-projects to have conditionals based on the presence of other projects.

llvm-svn: 279172

7 years agoCodeGen: Add/Factor out LiveRegUnits class; NFCI
Matthias Braun [Thu, 18 Aug 2016 22:11:28 +0000 (22:11 +0000)]
CodeGen: Add/Factor out LiveRegUnits class; NFCI

This is a set of register units intended to track register liveness, it
is similar in spirit to LivePhysRegs.
You can also think of this as the liveness tracking parts of the
RegisterScavenger factored out into an own class.

This was proposed in http://llvm.org/PR27609

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

llvm-svn: 279171

7 years ago[Documentation] Fixed style in modernize-use-emplace.rst.
Eugene Zelenko [Thu, 18 Aug 2016 22:11:27 +0000 (22:11 +0000)]
[Documentation] Fixed style in modernize-use-emplace.rst.

llvm-svn: 279170

7 years agoFix link quotes on AArch64's CompilerWriterInfo section.
Jacques Pienaar [Thu, 18 Aug 2016 22:10:06 +0000 (22:10 +0000)]
Fix link quotes on AArch64's CompilerWriterInfo section.

Reviewers: t.p.northover

Subscribers: t.p.northover, aemerson, rengolin

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

llvm-svn: 279169

7 years agoCodeGen: If Convert blocks that would form a diamond when tail-merged.
Kyle Butt [Thu, 18 Aug 2016 22:09:27 +0000 (22:09 +0000)]
CodeGen: If Convert blocks that would form a diamond when tail-merged.

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

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

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

Regression on self-hosting bots with no obvious explanation. Tidied up range
handling to be more obviously correct, but there was no smoking gun.

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

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

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

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

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

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

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

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

llvm-svn: 279168

7 years agoIfConversion: Rescan diamonds.
Kyle Butt [Thu, 18 Aug 2016 22:09:25 +0000 (22:09 +0000)]
IfConversion: Rescan diamonds.

The cost of predicating a diamond is only the instructions that are not shared
between the two branches. Additionally If a predicate clobbering instruction
occurs in the shared portion of the branches (e.g. a cond move), it may still
be possible to if convert the sub-cfg. This change handles these two facts by
rescanning the non-shared portion of a diamond sub-cfg to recalculate both the
predication cost and whether both blocks are pred-clobbering.

llvm-svn: 279167

7 years agoIfConversion: Handle inclusive ranges more carefully.
Kyle Butt [Thu, 18 Aug 2016 22:09:23 +0000 (22:09 +0000)]
IfConversion: Handle inclusive ranges more carefully.

This may affect calculations for thresholds, but is not a significant change
in behavior.

The problem was that an inclusive range must have an additonal flag to showr
that it is empty, because otherwise begin == end implies that the range has one
element, and it may not be possible to move past on either side.

llvm-svn: 279166

7 years agoAMDGPU: Add clang builtin for ds_swizzle.
Changpeng Fang [Thu, 18 Aug 2016 22:04:54 +0000 (22:04 +0000)]
AMDGPU: Add clang builtin for ds_swizzle.

Summary:
  int __builtin_amdgcn_ds_swizzle (int a, int imm);
while imm is a constant.

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

llvm-svn: 279165

7 years agoPR28794: Don't try to instantiate function templates which are not visible.
Vassil Vassilev [Thu, 18 Aug 2016 22:01:25 +0000 (22:01 +0000)]
PR28794: Don't try to instantiate function templates which are not visible.

Reviewed by Richard Smith.

llvm-svn: 279164

7 years agoC++ Modules TS: Add parsing support for module import declaration.
Richard Smith [Thu, 18 Aug 2016 21:59:42 +0000 (21:59 +0000)]
C++ Modules TS: Add parsing support for module import declaration.

llvm-svn: 279163

7 years ago[ELF] Improve error reporting for relocations
Petr Hosek [Thu, 18 Aug 2016 21:55:23 +0000 (21:55 +0000)]
[ELF] Improve error reporting for relocations

We should always include symbol name when reporting relocations
error to simplify debugging of these issues. Without symbol names
users have to manually investigate which of the libraries contain
invalid relocations which can be cumbersome when linking multiple
libraries.

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

llvm-svn: 279162

7 years agollvm-objdump: Add Hexagon printer changes for -S/-l options
Hemant Kulkarni [Thu, 18 Aug 2016 21:50:13 +0000 (21:50 +0000)]
llvm-objdump: Add Hexagon printer changes for -S/-l options

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

llvm-svn: 279161

7 years ago[CMake] Create convenience targets for runtime projects
Chris Bieneman [Thu, 18 Aug 2016 21:47:18 +0000 (21:47 +0000)]
[CMake] Create convenience targets for runtime projects

Each runtime project has a top-level target that is the name of the runtime (minus the "lib" prefix if applicable). This creates top-level targets mapping to runtime projects.

llvm-svn: 279160

7 years agoCodeGen: Rename a variable to better fit LLVM style. NFC
Justin Bogner [Thu, 18 Aug 2016 21:46:54 +0000 (21:46 +0000)]
CodeGen: Rename a variable to better fit LLVM style. NFC

llvm-svn: 279159