platform/upstream/llvm.git
7 years ago[NFC][ObjC Availability] Refactor DiagnoseAvailabilityOfDecl
Erik Pilkington [Fri, 5 Aug 2016 22:59:03 +0000 (22:59 +0000)]
[NFC][ObjC Availability] Refactor DiagnoseAvailabilityOfDecl

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

llvm-svn: 277887

7 years agoDisable a few more flaky asan64 tests.
Nico Weber [Fri, 5 Aug 2016 22:51:10 +0000 (22:51 +0000)]
Disable a few more flaky asan64 tests.

llvm-svn: 277886

7 years ago[clang-tblgen] Remove unused #include (NFC)
Vedant Kumar [Fri, 5 Aug 2016 22:48:53 +0000 (22:48 +0000)]
[clang-tblgen] Remove unused #include (NFC)

llvm-svn: 277885

7 years agoMention is_stale in the scripted step doc.
Jim Ingham [Fri, 5 Aug 2016 22:47:43 +0000 (22:47 +0000)]
Mention is_stale in the scripted step doc.

llvm-svn: 277884

7 years ago[InstCombine] refactor ctlz/cttz folds (NFCI)
Sanjay Patel [Fri, 5 Aug 2016 22:42:46 +0000 (22:42 +0000)]
[InstCombine] refactor ctlz/cttz folds (NFCI)

Note that this fold really belongs in InstSimplify.
Refactoring here anyway as an intermediate step because
there's a planned addition to this function in D23134.

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

llvm-svn: 277883

7 years agoDisable a few win asan64 tests that don't reliably pass, https://reviews.llvm.org...
Nico Weber [Fri, 5 Aug 2016 22:36:30 +0000 (22:36 +0000)]
Disable a few win asan64 tests that don't reliably pass, https://reviews.llvm.org/D23230

llvm-svn: 277882

7 years agoRevert "Make YAML support SmallVector"
Justin Bogner [Fri, 5 Aug 2016 22:32:33 +0000 (22:32 +0000)]
Revert "Make YAML support SmallVector"

This breaks building dsymutil, causing my local build and many bots to
fail.

This reverts r277870.

llvm-svn: 277881

7 years ago[MSSA] Use depth first iterator instead of custom version.
Daniel Berlin [Fri, 5 Aug 2016 22:09:14 +0000 (22:09 +0000)]
[MSSA] Use depth first iterator instead of custom version.

Summary:
Originally the plan was to use the custom worklist to do some block popping,
and because we don't actually need a visited set. The custom one we have
here is slightly broken, and it's not worth fixing vs using depth_first_iterator since we aren't going to go the route we originally
were.

Fixes PR28874
Reviewers: george.burgess.iv

Subscribers: llvm-commits, gberry

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

llvm-svn: 277880

7 years agoAdd a few more needed bits to the scripted thread plans.
Jim Ingham [Fri, 5 Aug 2016 22:06:12 +0000 (22:06 +0000)]
Add a few more needed bits to the scripted thread plans.

llvm-svn: 277879

7 years agoCodeView: Remove an unused variable
Justin Bogner [Fri, 5 Aug 2016 21:57:10 +0000 (21:57 +0000)]
CodeView: Remove an unused variable

It was breaking the -Werror build.

llvm-svn: 277878

7 years ago[LoopSimplify] Fix updating LCSSA after separating nested loops.
Michael Zolotukhin [Fri, 5 Aug 2016 21:52:58 +0000 (21:52 +0000)]
[LoopSimplify] Fix updating LCSSA after separating nested loops.

This fixes PR28825. The problem was that we only checked if a value from
a created inner loop is used in the outer loop, and fixed LCSSA for
them. But we missed to fixup LCSSA for values used in exits of the outer
loop.

llvm-svn: 277877

7 years agoFix non portable include path.
Zachary Turner [Fri, 5 Aug 2016 21:50:02 +0000 (21:50 +0000)]
Fix non portable include path.

llvm-svn: 277876

7 years agoPowerPC: Add a triple to this test
Justin Bogner [Fri, 5 Aug 2016 21:49:54 +0000 (21:49 +0000)]
PowerPC: Add a triple to this test

This is running opt without specifying a triple, which isn't correct.

llvm-svn: 277875

7 years agoFix two tests in Win64 ASan
Reid Kleckner [Fri, 5 Aug 2016 21:47:46 +0000 (21:47 +0000)]
Fix two tests in Win64 ASan

Go back to intercepting kernel32!RaiseException, and only go for
ntdll!RtlRaiseException if that fails. Fixes throw_and_catch.cc test.

Work around an issue in LLVM's win64 epilogues. We end up with an
epilogue that looks like this, and it drives the Win64 unwinder crazy
until stack overflow:
        call    ill_cc!__asan_handle_no_return
        xor     eax,eax
        add     rsp,40h // epilogue starts
        pop     rbp     // CSR
        ud2             // Trap here
        ret             // Ret?
        nop     word ptr [rax+rax]
        sub     rsp,28h // Next function

Will file a PR soon.

llvm-svn: 277874

7 years ago[MSSA] Match assert vs llvm_unreachable style in verification functions.
Daniel Berlin [Fri, 5 Aug 2016 21:47:20 +0000 (21:47 +0000)]
[MSSA] Match assert vs llvm_unreachable style in verification functions.

llvm-svn: 277873

7 years agoRewrite domination verifier to handle local domination as well.
Daniel Berlin [Fri, 5 Aug 2016 21:46:52 +0000 (21:46 +0000)]
Rewrite domination verifier to handle local domination as well.

Summary:
Rewrite domination verifier to handle local domination as well.
This catches a bug Geoff Berry noticed.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 277872

7 years ago[CodeView] Decouple record deserialization from visitor dispatch.
Zachary Turner [Fri, 5 Aug 2016 21:45:34 +0000 (21:45 +0000)]
[CodeView] Decouple record deserialization from visitor dispatch.

Until now, our use case for the visitor has been to take a stream of bytes
representing a type stream, deserialize the records in sequence, and do
something with them, where "something" is determined by how the user
implements a particular set of callbacks on an abstract class.

For actually writing PDBs, however, we want to do the reverse. We have
some kind of description of the list of records in their in-memory format,
and we want to process each one. Perhaps by serializing them to a byte
stream, or perhaps by converting them from one description format (Yaml)
to another (in-memory representation).

This was difficult in the current model because deserialization and
invoking the callbacks were tightly coupled.

With this patch we change this so that TypeDeserializer is itself an
implementation of the particular set of callbacks. This decouples
deserialization from the iteration over a list of records and invocation
of the callbacks.  TypeDeserializer is initialized with another
implementation of the callback interface, so that upon deserialization it
can pass the deserialized record through to the next set of callbacks. In
a sense this is like an implementation of the Decorator design pattern,
where the Deserializer is a decorator.

This will be useful for writing Pdbs from yaml, where we have a
description of the type records in Yaml format. In this case, the visitor
implementation would have each visitation callback method implemented in
such a way as to extract the proper set of fields from the Yaml, and it
could maintain state that builds up a list of these records. Finally at
the end we can pass this information through to another set of callbacks
which serializes them into a byte stream.

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

llvm-svn: 277871

7 years agoMake YAML support SmallVector
Zachary Turner [Fri, 5 Aug 2016 21:45:19 +0000 (21:45 +0000)]
Make YAML support SmallVector

Currently YAML sequences require std::vectors. All of the methods that the
YAML parser accesses though are present in SmallVector, so there's no
reason we can't support SmallVector inherently. This patch does that.

Reviewed By: majnemer
Differential Revision: https://reviews.llvm.org/D23213

llvm-svn: 277870

7 years agoExportTrie nodes need to be visisted in order.
Pete Cooper [Fri, 5 Aug 2016 21:37:12 +0000 (21:37 +0000)]
ExportTrie nodes need to be visisted in order.

The export trie was being emitted in the order the nodes were
added to the vector, but instead needs to be visited in the order
that the nodes are traversed.  This matches the behaviour of ld64.

llvm-svn: 277869

7 years agounwind: disable executable stacks
Saleem Abdulrasool [Fri, 5 Aug 2016 21:35:28 +0000 (21:35 +0000)]
unwind: disable executable stacks

Similar to compiler-rt, ensure that we disable executable stacks for the custom
assembly.

llvm-svn: 277868

7 years agoAMDGPU/SI: Increase SGPR limit to 96 on Tonga/Iceland
Marek Olsak [Fri, 5 Aug 2016 21:23:29 +0000 (21:23 +0000)]
AMDGPU/SI: Increase SGPR limit to 96 on Tonga/Iceland

Summary:
This is the setting of the Vulkan closed source driver.

It decreases the max wave count from 10 to 8.

26010 shaders in 14650 tests
Totals:
VGPRS: 829593 -> 808440 (-2.55 %)
Spilled SGPRs: 81878 -> 42226 (-48.43 %)
Spilled VGPRs: 367 -> 358 (-2.45 %)
Scratch VGPRs: 1764 -> 1748 (-0.91 %) dwords per thread
Code Size: 36677864 -> 35923932 (-2.06 %) bytes

There is a massive decrease in SGPR spilling in general and -7.4% spilled
VGPRs for DiRT Showdown (= SGPRs spilled to scratch?)

Reviewers: arsenm, tstellarAMD, nhaehnle

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 277867

7 years agoFix false positive in -Wunsequenced and templates.
Richard Trieu [Fri, 5 Aug 2016 21:02:34 +0000 (21:02 +0000)]
Fix false positive in -Wunsequenced and templates.

For builtin logical operators, there is a well-defined ordering of argument
evaluation.  For overloaded operator of the same type, there is no argument
evaluation order, similar to other function calls.  When both are present,
uninstantiated templates with an operator&& is treated as an unresolved
function call.  Unresolved function calls are treated as normal function calls,
and may result in false positives when the builtin logical operator is used.
Have the unsequenced checker ignore dependent expressions to avoid this
false positive.  The check also happens in template instantiations to catch
when the overloaded operator is used.

llvm-svn: 277866

7 years ago[ARM] Constant Materialize: imms with specific value can be encoded into mov.w
Weiming Zhao [Fri, 5 Aug 2016 20:58:29 +0000 (20:58 +0000)]
[ARM] Constant Materialize: imms with specific value can be encoded into mov.w

Summary: Thumb2 supports encoding immediates with specific patterns into mov.w by splatting the low 8 bits into other bytes.

I'm resubmitting this patch. The test case in the original commit
r277610 does not specify triple, so builds with differnt default triple
will have different output.

This patch fixed trile as thumb-darwin-apple.

Reviewers: john.brawn, jmolloy, bruno

Subscribers: jmolloy, aemerson, rengolin, samparker, llvm-commits

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

llvm-svn: 277865

7 years ago[FlattenCFG] Simplify + remove unused variable. NFCI.
Davide Italiano [Fri, 5 Aug 2016 20:53:35 +0000 (20:53 +0000)]
[FlattenCFG] Simplify + remove unused variable. NFCI.

llvm-svn: 277864

7 years agoRemove cold callsite heuristic that is not necessary because of cold callee heuristic.
Dehao Chen [Fri, 5 Aug 2016 20:49:04 +0000 (20:49 +0000)]
Remove cold callsite heuristic that is not necessary because of cold callee heuristic.

llvm-svn: 277863

7 years ago[sanitizers] remove failing test.
Mike Aizatsky [Fri, 5 Aug 2016 20:48:48 +0000 (20:48 +0000)]
[sanitizers] remove failing test.

The test often fails on Windows because there are more branches
in the code that is generated.

llvm-svn: 277862

7 years ago[SCEV] Un-grep'ify tests; NFC
Sanjoy Das [Fri, 5 Aug 2016 20:33:49 +0000 (20:33 +0000)]
[SCEV] Un-grep'ify tests; NFC

llvm-svn: 277861

7 years agoReplace hot-callsite based heuristic to use its own threshold parameter instead of...
Dehao Chen [Fri, 5 Aug 2016 20:28:41 +0000 (20:28 +0000)]
Replace hot-callsite based heuristic to use its own threshold parameter instead of share inline-hint parameter

Summary: Hot callsites should have higher threshold than inline hints. This patch uses separate threshold parameter for hot callsites.

Reviewers: davidxl, eraman

Subscribers: Prazek, llvm-commits

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

llvm-svn: 277860

7 years ago[sanitizers] trace buffer API to use user-allocated buffer.
Mike Aizatsky [Fri, 5 Aug 2016 20:09:53 +0000 (20:09 +0000)]
[sanitizers] trace buffer API to use user-allocated buffer.

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

llvm-svn: 277859

7 years ago[sanitizers] trace buffer API to use user-allocated buffer.
Mike Aizatsky [Fri, 5 Aug 2016 20:09:42 +0000 (20:09 +0000)]
[sanitizers] trace buffer API to use user-allocated buffer.

Subscribers: kubabrecka

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

llvm-svn: 277858

7 years agoUpdate outdated comments in the new PM internals (NFC)
Mehdi Amini [Fri, 5 Aug 2016 19:51:00 +0000 (19:51 +0000)]
Update outdated comments in the new PM internals (NFC)

The analysis manager was made not optional and turned into a
reference instead of a pointer in r272978. Some comments were
still refering to the previous behavior.

llvm-svn: 277857

7 years agoWholeProgramDevirt: print remarks with devirtualized method names.
Ivan Krasin [Fri, 5 Aug 2016 19:45:16 +0000 (19:45 +0000)]
WholeProgramDevirt: print remarks with devirtualized method names.

Summary:
Chrome on Linux uses WholeProgramDevirt for speed ups, and it's
important to detect regressions on both sides: the toolchain,
if fewer methods get devirtualized after an update, and Chrome,
if an innocently looking change caused many hot methods become
virtual again.

The need to track devirtualized methods is not Chrome-specific,
but it's probably the only user of the pass at this time.

Reviewers: kcc

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

llvm-svn: 277856

7 years ago[ADCE] Refactoring for new functionality (NFC)
David Callahan [Fri, 5 Aug 2016 19:38:11 +0000 (19:38 +0000)]
[ADCE] Refactoring for new functionality (NFC)

Summary:
This is another refactoring to break up the one function into three logical components functions.
Another non-functional change before we start added in features.

Reviewers: nadav, mehdi_amini, majnemer

Subscribers: twoh, freik, llvm-commits

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

llvm-svn: 277855

7 years ago[ConstantFolding] Don't create illegal (non-integral) inttoptrs
Sanjoy Das [Fri, 5 Aug 2016 19:23:29 +0000 (19:23 +0000)]
[ConstantFolding] Don't create illegal (non-integral) inttoptrs

Reviewers: majnemer, arsenm

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 277854

7 years agofix documentation comments; NFC
Sanjay Patel [Fri, 5 Aug 2016 19:09:25 +0000 (19:09 +0000)]
fix documentation comments; NFC

llvm-svn: 277853

7 years agoPR26423: Assert on valid use of using declaration of a function with an undeduced...
David Blaikie [Fri, 5 Aug 2016 19:03:01 +0000 (19:03 +0000)]
PR26423: Assert on valid use of using declaration of a function with an undeduced auto return type

For now just disregard the using declaration in this case. Suboptimal,
but wiring up the ability to have declarations of functions that are
separate from their definition (we currently only do that for member
functions) and have differing return types (we don't have any support
for that) is more work than seems reasonable to at least fix this crash.

llvm-svn: 277852

7 years agofix random typos [NFC]
Etienne Bergeron [Fri, 5 Aug 2016 18:49:08 +0000 (18:49 +0000)]
fix random typos [NFC]

llvm-svn: 277850

7 years ago[AutoFDO] Fix handling of empty profiles
David Callahan [Fri, 5 Aug 2016 18:38:19 +0000 (18:38 +0000)]
[AutoFDO] Fix handling of empty profiles

Summary:
If a profile has no samples for a function, then the function "entry count" is set to the value 0. Several places in the code test that if the Function::getEntryCount is defined at all. Here we change to treat a 0 entry count the same as undefined.

In particular, this fixes a problem in getLayoutSuccessorProbThreshold in MachineBlockPlacement.cpp where we use a different and inferior heuristic for laying out basic blocks.

Reviewers: danielcdh, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 277849

7 years ago[SCEV] Don't infinitely recurse on unreachable code
Sanjoy Das [Fri, 5 Aug 2016 18:34:14 +0000 (18:34 +0000)]
[SCEV] Don't infinitely recurse on unreachable code

llvm-svn: 277848

7 years ago[ORC] Change LogicalDylib::LogicalModuleHandle from an iterator to an index.
Lang Hames [Fri, 5 Aug 2016 18:26:56 +0000 (18:26 +0000)]
[ORC] Change LogicalDylib::LogicalModuleHandle from an iterator to an index.

This prevents handles from being invalidated (through iterator invalidation)
when new modules are added.

No test-case yet: This bug was uncovered during work on an upcoming patch for
weak symbol support and the testcase for that feature will implicitly test for
correct behavior here.

llvm-svn: 277847

7 years agoCOFF ARM: Apply an existing offset in MOV32T relocations
Saleem Abdulrasool [Fri, 5 Aug 2016 18:20:31 +0000 (18:20 +0000)]
COFF ARM: Apply an existing offset in MOV32T relocations

Don't blindly OR in the new value, but clear the existing one, since it can be
nonzero. Read out the existing value before, and add into the desired offset.
(The add is done outside of the applyMOV, to handle potential overflow between
the two.)

Patch by Martin Storsjö!

llvm-svn: 277846

7 years agoAdd the first of what will be a long line of additional error checks for invalid...
Kevin Enderby [Fri, 5 Aug 2016 18:19:40 +0000 (18:19 +0000)]
Add the first of what will be a long line of additional error checks for invalid Mach-O files.

This is where an LC_SEGMENT load command has a fileoff field that
extends past the end of the file.

Also fix llvm-nm and llvm-size to remove the errorToErrorCode() call so error messages are printed.
And needed to update a few test cases now that they do print the error messages just a
bit differently.

llvm-svn: 277845

7 years agoTweaks to the reporting of "missing dyld shared cached" that make it easier to grab...
Enrico Granata [Fri, 5 Aug 2016 18:09:50 +0000 (18:09 +0000)]
Tweaks to the reporting of "missing dyld shared cached" that make it easier to grab logs when such issues occur, make the logs more helpful, and also tweaks to the user messaging to make it easier to pinpoint an investigation avenue early on

llvm-svn: 277844

7 years agoDo not assign new discriminator for all intrinsics.
Dehao Chen [Fri, 5 Aug 2016 17:56:49 +0000 (17:56 +0000)]
Do not assign new discriminator for all intrinsics.

Summary: We do not care about intrinsic calls when assigning discriminators.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 277843

7 years agoFix dumping of process module list and test it
Reid Kleckner [Fri, 5 Aug 2016 17:55:00 +0000 (17:55 +0000)]
Fix dumping of process module list and test it

I probably broke this a year ago in r243895.

llvm-svn: 277842

7 years agoGlobalISel: clear pending phis after MachineFunction translated
Tim Northover [Fri, 5 Aug 2016 17:50:36 +0000 (17:50 +0000)]
GlobalISel: clear pending phis after MachineFunction translated

Test is just reordering the existing functions (it would trigger for any
function after one with a phi).

llvm-svn: 277841

7 years ago[SemaOpenMP] Some miscellaneous cleanups
David Majnemer [Fri, 5 Aug 2016 17:44:54 +0000 (17:44 +0000)]
[SemaOpenMP] Some miscellaneous cleanups

Clean up some typos, follow the coding style a little more rigorously.

No functionality change is intended.

llvm-svn: 277840

7 years ago[X86][SSE] Add initial support for 2 input target shuffle combining.
Simon Pilgrim [Fri, 5 Aug 2016 17:36:14 +0000 (17:36 +0000)]
[X86][SSE] Add initial support for 2 input target shuffle combining.

At the moment only the INSERTPS matching can actually use 2 inputs but the plumbing is now in place.

llvm-svn: 277839

7 years agoCOFF ARM: Error out if 24 bit thumb branches are out of range
Saleem Abdulrasool [Fri, 5 Aug 2016 17:33:24 +0000 (17:33 +0000)]
COFF ARM: Error out if 24 bit thumb branches are out of range

In the ELF linker, the same situation already errors out with "relocation
R_ARM_THM_CALL out of range".

Patch by Martin Storsjö!

llvm-svn: 277838

7 years ago[asan] Remove unused include (NFC)
Vedant Kumar [Fri, 5 Aug 2016 17:28:28 +0000 (17:28 +0000)]
[asan] Remove unused include (NFC)

llvm-svn: 277837

7 years agoCOFF ARM: Clear the J1 and J2 bits when applying relocations to 24 bit branches
Saleem Abdulrasool [Fri, 5 Aug 2016 17:28:21 +0000 (17:28 +0000)]
COFF ARM: Clear the J1 and J2 bits when applying relocations to 24 bit branches

The opcode for the bl branches can initially be F000 F800, i.e.
the J1 and J2 bits are already set. Therefore mask these bits out
before or'ing in the new bits.

Patch by Martin Storsjö!

llvm-svn: 277836

7 years agoGlobalISel: IRTranslate PHI instructions
Tim Northover [Fri, 5 Aug 2016 17:16:40 +0000 (17:16 +0000)]
GlobalISel: IRTranslate PHI instructions

llvm-svn: 277835

7 years agobuiltins: windows has only one flavour on ARM
Saleem Abdulrasool [Fri, 5 Aug 2016 16:53:05 +0000 (16:53 +0000)]
builtins: windows has only one flavour on ARM

Windows on ARM is a hard-float only environment.  Don't try to build two copies
of the same library.

llvm-svn: 277834

7 years agoFix gdb pretty printers to work with Python 3.
Igor Kudrin [Fri, 5 Aug 2016 16:48:31 +0000 (16:48 +0000)]
Fix gdb pretty printers to work with Python 3.

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

llvm-svn: 277833

7 years ago[CodeGen] Use MapVector instead of DenseMap.
Michael Kruse [Fri, 5 Aug 2016 16:45:51 +0000 (16:45 +0000)]
[CodeGen] Use MapVector instead of DenseMap.

The map is iterated over when generating the values escaping the SCoP. The
indeterministic iteration order of DenseMap causes the output IR to change at
every compilation, adding noise to comparisons.

Replace DenseMap by a MapVector to ensure the same iteration order at every
compilation.

llvm-svn: 277832

7 years agoFix TargetParser unit tests for ARM / AArch64.
Zachary Turner [Fri, 5 Aug 2016 16:45:07 +0000 (16:45 +0000)]
Fix TargetParser unit tests for ARM / AArch64.

String pooling is not guaranteed by the standard, so if
you're comparing two different string literals for equality,
you have to use strcmp.

llvm-svn: 277831

7 years agoRevert "[Sema] Add sizeof diagnostics for bzero"
Bruno Cardoso Lopes [Fri, 5 Aug 2016 16:41:00 +0000 (16:41 +0000)]
Revert "[Sema] Add sizeof diagnostics for bzero"

This reverts commit r277787, which caused PR28870.

llvm-svn: 277830

7 years agoopt: Adding -O0 to opt tool
Gor Nishanov [Fri, 5 Aug 2016 16:27:33 +0000 (16:27 +0000)]
opt: Adding -O0 to opt tool

Summary:
Having -O0 in opt allows testing that -O0 optimization
pipeline is built correctly.

Reviewers: majnemer

Subscribers: llvm-commits

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

llvm-svn: 277829

7 years agobuiltins: better categorisation of Thumb1 builtins
Saleem Abdulrasool [Fri, 5 Aug 2016 16:24:56 +0000 (16:24 +0000)]
builtins: better categorisation of Thumb1 builtins

Adjust the builtins to better annotate the Thumb1 routines and their purpose.
Exclude the remaining thumb1 sources on Windows ARM.

llvm-svn: 277828

7 years ago[StreamExecutor] Add kernel types
Jason Henline [Fri, 5 Aug 2016 16:05:44 +0000 (16:05 +0000)]
[StreamExecutor] Add kernel types

Summary: Add StreamExecutor kernel types.

Reviewers: jlebar, tra

Subscribers: parallel_libs-commits

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

llvm-svn: 277827

7 years agoPrint a more useful BP value from MSVC-built ASan runtimes
Reid Kleckner [Fri, 5 Aug 2016 16:01:57 +0000 (16:01 +0000)]
Print a more useful BP value from MSVC-built ASan runtimes

MSVC doesn't have an exact equivalent for __builtin_frame_address, but
_AddressOfReturnAddress() + sizeof(void*) should be equivalent for all
frames build with -fno-omit-frame-pointer.

llvm-svn: 277826

7 years agoFixed x2APIC discovery for 256-processor architectures.
Andrey Churbanov [Fri, 5 Aug 2016 15:59:11 +0000 (15:59 +0000)]
Fixed x2APIC discovery for 256-processor architectures.

Mask for value read from ebx register returned by CPUID expanded to 0xFFFF.

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

llvm-svn: 277825

7 years agoAMDGPU : Add Clang builtin intrinsics for compare with the full
Wei Ding [Fri, 5 Aug 2016 15:38:46 +0000 (15:38 +0000)]
AMDGPU : Add Clang builtin intrinsics for compare with the full
wavefront result.

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

llvm-svn: 277824

7 years ago[PowerPC] Wrong fast-isel codegen for VSX floating-point loads
Ulrich Weigand [Fri, 5 Aug 2016 15:22:05 +0000 (15:22 +0000)]
[PowerPC] Wrong fast-isel codegen for VSX floating-point loads

There were two locations where fast-isel would generate a LFD instruction
with a target register class VSFRC instead of F8RC when VSX was enabled.
This can ccause invalid registers to be used in certain cases, like:
   lfd 36, ...
instead of using a VSX load instruction.  The wrong register number gets
silently truncated, causing invalid code to be generated.

The first place is PPCFastISel::PPCEmitLoad, which had multiple problems:

1.) The IsVSSRC and IsVSFRC flags are not initialized correctly, since they
are computed from resultReg, which is still zero at this point in many cases.
Fixed by changing the helper routines to operate on a register class instead
of a register and passing in UseRC.

2.) Even with this fixed, Is64VSXLoad is still wrong due to a typo:

bool Is32VSXLoad = IsVSSRC && Opc == PPC::LFS;
bool Is64VSXLoad = IsVSSRC && Opc == PPC::LFD;

The second line needs to use isVSFRC (like PPCEmitStore does).

3.) Once both the above are fixed, we're now generating a VSX instruction --
but an incorrect one, since generation of an indexed instruction with null
index is wrong. Fixed by copying the code handling the same issue in
PPCEmitStore.

The second place is PPCFastISel::PPCMaterializeFP, where we would emit an
LFD to load a constant from the literal pool, and use the wrong result
register class. Fixed by hardcoding a F8RC class even on systems
supporting VSX.

Fixes: https://llvm.org/bugs/show_bug.cgi?id=28630

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

llvm-svn: 277823

7 years ago[SystemZ] Add missing classes and instructions
Zhan Jun Liau [Fri, 5 Aug 2016 15:14:34 +0000 (15:14 +0000)]
[SystemZ] Add missing classes and instructions

Summary:
Add instruction formats E, RSI, SSd, SSE, and SSF.

Added BRXH, BRXLE, PR, MVCK, STRAG, and ECTG instructions to test out
those formats.

Reviewers: uweigand

Subscribers: llvm-commits

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

llvm-svn: 277822

7 years agoActually, r277337 was fine. Just kill the DAGs that made the test allow nondeterminism.
Benjamin Kramer [Fri, 5 Aug 2016 14:58:34 +0000 (14:58 +0000)]
Actually, r277337 was fine. Just kill the DAGs that made the test allow nondeterminism.

llvm-svn: 277821

7 years ago[SimplifyCFG] Make range reduction code deterministic.
Benjamin Kramer [Fri, 5 Aug 2016 14:55:02 +0000 (14:55 +0000)]
[SimplifyCFG] Make range reduction code deterministic.

This generated IR based on the order of evaluation, which is different
between GCC and Clang. With that in mind you get bootstrap miscompares
if you compare a Clang built with GCC-built Clang vs. Clang built with
Clang-built Clang. Diagnosing that made my head hurt.

This also reverts commit r277337, which "fixed" the test case.

llvm-svn: 277820

7 years agoreduce tests; auto-generate checks
Sanjay Patel [Fri, 5 Aug 2016 14:50:11 +0000 (14:50 +0000)]
reduce tests; auto-generate checks

llvm-svn: 277819

7 years ago[OpenMP] Sema and parsing for 'teams distribute' pragma
Kelvin Li [Fri, 5 Aug 2016 14:37:37 +0000 (14:37 +0000)]
[OpenMP] Sema and parsing for 'teams distribute' pragma

This patch is to implement sema and parsing for 'teams distribute' pragma.

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

llvm-svn: 277818

7 years ago[X86][SSE] Update the the target shuffle matches to use the effective mask's value...
Simon Pilgrim [Fri, 5 Aug 2016 14:33:11 +0000 (14:33 +0000)]
[X86][SSE] Update the the target shuffle matches to use the effective mask's value type directly instead of via the input value type.

Preparation for adding 2 input support so we want to avoid unnecessary references to the input value type.

llvm-svn: 277817

7 years agotesting commit access
Gor Nishanov [Fri, 5 Aug 2016 13:17:06 +0000 (13:17 +0000)]
testing commit access

llvm-svn: 277816

7 years ago[X86][SSE] Consistently use the target shuffle root value type for vector size calcul...
Simon Pilgrim [Fri, 5 Aug 2016 13:02:53 +0000 (13:02 +0000)]
[X86][SSE] Consistently use the target shuffle root value type for vector size calculations. NFCI.

Preparation for adding 2 input support so we want to avoid unnecessary references to the input value type.

llvm-svn: 277814

7 years agoLLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000...
NAKAMURA Takumi [Fri, 5 Aug 2016 11:59:49 +0000 (11:59 +0000)]
LLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000000".

We should not use double (or float) in the LLVM, unless it is really needed. x87 FP register doesn't preserve SNaN to move the value.

FIXME: APFloat() may have the constructor by raw bit.
llvm-svn: 277813

7 years agoReformat.
NAKAMURA Takumi [Fri, 5 Aug 2016 11:59:45 +0000 (11:59 +0000)]
Reformat.

llvm-svn: 277812

7 years ago[include-fixer] Correct some header mappings.
Haojian Wu [Fri, 5 Aug 2016 11:54:34 +0000 (11:54 +0000)]
[include-fixer] Correct some header mappings.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 277811

7 years ago[DependenceInfo] Reset operations counter when setting limit.
Michael Kruse [Fri, 5 Aug 2016 11:31:02 +0000 (11:31 +0000)]
[DependenceInfo] Reset operations counter when setting limit.

When entering the dependence computation and the max_operations is set, the
operations counter may have already exceeded the counter, thus aborting any ISL
computation from the start. The counter is reset at the end of the dependence
calculation such that a follow-up recomputation might succeed, ie. the success
of the first dependence calculation depends on unrelated ISL operations that
happened before, giving it a disadvantage to the following calculations.

This patch resets the operations counter at the beginning of the dependence
recalculation to not depend on previous actions. Otherwise additional
preprocessing of the Scop that aims to improve its schedulability (eg. DeLICM)
do have the effect that DependenceInfo and hence the scheduling fail more
likely, contraproductive to the goal of said preprocessing.

llvm-svn: 277810

7 years agoAdd a missing backslash to my previous commit
John Brawn [Fri, 5 Aug 2016 11:17:43 +0000 (11:17 +0000)]
Add a missing backslash to my previous commit

llvm-svn: 277809

7 years ago[X86][SSE] Added target shuffle combine binary compute matching function. NFCI.
Simon Pilgrim [Fri, 5 Aug 2016 11:16:53 +0000 (11:16 +0000)]
[X86][SSE] Added target shuffle combine binary compute matching function. NFCI.

Added matchBinaryPermuteVectorShuffle and moved the blend+zero and insertps matching code into it.

llvm-svn: 277808

7 years agoReapply r276973 "Adjust Registry interface to not require plugins to export a registry"
John Brawn [Fri, 5 Aug 2016 11:01:08 +0000 (11:01 +0000)]
Reapply r276973 "Adjust Registry interface to not require plugins to export a registry"

This differs from the previous version by being more careful about template
instantiation/specialization in order to prevent errors when building with
clang -Werror. Specifically:
 * begin is not defined in the template and is instead instantiated when Head
   is. I think the warning when we don't do that is wrong (PR28815) but for now
   at least do it this way to avoid the warning.
 * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY
   instead provide a template definition then do explicit instantiation. No
   compiler I've tried has problems with doing it the other way, but strictly
   speaking it's not permitted by the C++ standard so better safe than sorry.

Original commit message:

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

llvm-svn: 277806

7 years ago[PowerPC] fix passing long double arguments to function (soft-float)
Strahinja Petrovic [Fri, 5 Aug 2016 08:47:26 +0000 (08:47 +0000)]
[PowerPC] fix passing long double arguments to function (soft-float)

This patch fixes passing long double type arguments to function in
soft float mode. If there is less than 4 argument registers free
(long double type is mapped in 4 gpr registers in soft float mode)
long double type argument must be passed through stack.
Differential Revision: https://reviews.llvm.org/D20114.

llvm-svn: 277804

7 years agoGPGPU: Sort dimension sizes of multi-dimensional shared memory arrays correctly
Tobias Grosser [Fri, 5 Aug 2016 08:27:24 +0000 (08:27 +0000)]
GPGPU: Sort dimension sizes of multi-dimensional shared memory arrays correctly

Before this commit we generated the array type in reverse order and we also
added the outermost dimension size to the new array declaration, which is
incorrect as Polly additionally assumed an additional unsized outermost
dimension, such that we had an off-by-one error in the linearization of access
expressions.

llvm-svn: 277802

7 years ago[InstCombine] try to fold (select C, (sext A), B) into logical ops
Nicolai Haehnle [Fri, 5 Aug 2016 08:22:29 +0000 (08:22 +0000)]
[InstCombine] try to fold (select C, (sext A), B) into logical ops

Summary:
Turn (select C, (sext A), B) into (sext (select C, A, B')) when A is i1 and
B is a compatible constant, also for zext instead of sext. This will then be
further folded into logical operations.

The transformation would be valid for non-i1 types as well, but other parts of
InstCombine prefer to have sext from non-i1 as an operand of select.

Motivated by the shader compiler frontend in Mesa for AMDGPU, which emits i32
for boolean operations. With this change, the boolean logic is fully
recovered.

Reviewers: majnemer, spatel, tstellarAMD

Subscribers: llvm-commits

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

llvm-svn: 277801

7 years agoAdd missing 'REQUIRES' line
Tobias Grosser [Fri, 5 Aug 2016 07:08:45 +0000 (07:08 +0000)]
Add missing 'REQUIRES' line

llvm-svn: 277800

7 years agoGPGPU: Add cuda annotations to specify maximal number of threads per block
Tobias Grosser [Fri, 5 Aug 2016 06:47:43 +0000 (06:47 +0000)]
GPGPU: Add cuda annotations to specify maximal number of threads per block

These annotations ensure that the NVIDIA PTX assembler limits the number of
registers used such that we can be certain the resulting kernel can be executed
for the number of threads in a thread block that we are planning to use.

llvm-svn: 277799

7 years agoReverting r277632 as it breaks the build on MacOS.
Ivan Krasin [Fri, 5 Aug 2016 03:18:27 +0000 (03:18 +0000)]
Reverting r277632 as it breaks the build on MacOS.

Reviewers: kcc

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

llvm-svn: 277798

7 years agoFix crash in template type diffing.
Richard Trieu [Fri, 5 Aug 2016 03:16:36 +0000 (03:16 +0000)]
Fix crash in template type diffing.

When the type being diffed is a type alias, and the orginal type is not a
templated type, then there will be no unsugared TemplateSpecializationType.
When this happens, exit early from the constructor.  Also add assertions to
the other iterator accessor to prevent the iterator from being used.

llvm-svn: 277797

7 years agoAllow -1 to assign max value to unsigned bitfields.
Richard Trieu [Fri, 5 Aug 2016 02:39:30 +0000 (02:39 +0000)]
Allow -1 to assign max value to unsigned bitfields.

Silence the -Wbitfield-constant-conversion warning for when -1 or other
negative values are assigned to unsigned bitfields, provided that the bitfield
is wider than the minimum number of bits needed to encode the negative value.

llvm-svn: 277796

7 years agoCFI: add XFAIL test for a future optimization of two vcalls.
Ivan Krasin [Fri, 5 Aug 2016 01:45:54 +0000 (01:45 +0000)]
CFI: add XFAIL test for a future optimization of two vcalls.

Summary:
Often, a code will call multiple virtual methods of a given object.
If they go in a linear block, it should be possible to check vtable
before the first call, then store vtable pointer and reuse it for
the second vcall without any additional checks.

This is expected to have a positive performance impact on a hot
path in Blink, see https://crbug.com/634139.

Reviewers: kcc

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

llvm-svn: 277795

7 years agoSimplify. NFC.
Rui Ueyama [Fri, 5 Aug 2016 01:25:45 +0000 (01:25 +0000)]
Simplify. NFC.

llvm-svn: 277794

7 years agoInstCombine: Clean up some trailing whitespace. NFC
Justin Bogner [Fri, 5 Aug 2016 01:09:48 +0000 (01:09 +0000)]
InstCombine: Clean up some trailing whitespace. NFC

llvm-svn: 277793

7 years agoInstCombine: Replace some never-null pointers with references. NFC
Justin Bogner [Fri, 5 Aug 2016 01:06:44 +0000 (01:06 +0000)]
InstCombine: Replace some never-null pointers with references. NFC

llvm-svn: 277792

7 years agoMove invariants outside of a lambda. NFC.
Rui Ueyama [Fri, 5 Aug 2016 01:05:01 +0000 (01:05 +0000)]
Move invariants outside of a lambda. NFC.

llvm-svn: 277791

7 years agoMake combine() non-member function.
Rui Ueyama [Fri, 5 Aug 2016 01:04:59 +0000 (01:04 +0000)]
Make combine() non-member function.

Because this function depends only on its arguments.

llvm-svn: 277790

7 years agoChange the indexing done for kernel/kext directories to be recursive.
Jason Molenda [Fri, 5 Aug 2016 00:44:34 +0000 (00:44 +0000)]
Change the indexing done for kernel/kext directories to be recursive.
Also re-write how most of the directory indexing is done - as it has
grown over the years, it has become a bit of a mess and was overdue
for a cleanup.

Most importantly, this allows you to specify a directory with the
platform.plugin.darwin-kernel.kext-directories setting and now lldb
will search for kexts and kernels in those directories recursively.

<rdar://problem/20754467>

llvm-svn: 277789

7 years ago[LIT][Darwin] Change %ld64 to be prefixed with DYLD_INSERT_LIBRARIES
Bruno Cardoso Lopes [Thu, 4 Aug 2016 23:58:30 +0000 (23:58 +0000)]
[LIT][Darwin] Change %ld64 to be prefixed with DYLD_INSERT_LIBRARIES

Followup from r277778, after Mehdi's comments.

Expand %ld64 to perform the necessary preload instead, that way new
tests do not need to worry about setting up DYLD_INSERT_LIBRARIES
themselves.

rdar://problem/24300926

llvm-svn: 277788

7 years ago[Sema] Add sizeof diagnostics for bzero
Bruno Cardoso Lopes [Thu, 4 Aug 2016 23:55:22 +0000 (23:55 +0000)]
[Sema] Add sizeof diagnostics for bzero

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

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

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

This patch implements the same class of warnings for bzero.

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

rdar://problem/18963514

llvm-svn: 277787

7 years agoGVN-hoist: enable by default
Sebastian Pop [Thu, 4 Aug 2016 23:49:07 +0000 (23:49 +0000)]
GVN-hoist: enable by default

llvm-svn: 277786

7 years agoGVN-hoist: fix early exit logic
Sebastian Pop [Thu, 4 Aug 2016 23:49:05 +0000 (23:49 +0000)]
GVN-hoist: fix early exit logic

The patch splits a complex && if condition into easier to read and understand
logic.  That wrong early exit condition was letting some instructions with not
all operands available pass through when HoistingGeps was true.

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

llvm-svn: 277785

7 years agoIR: Provide an IRBuilder Inserter that calls a callback after insertion
Justin Bogner [Thu, 4 Aug 2016 23:41:01 +0000 (23:41 +0000)]
IR: Provide an IRBuilder Inserter that calls a callback after insertion

Add a generalized IRBuilderCallbackInserter, which is just given a
callback to execute after insertion. This can be used to get rid of
the custom inserter in InstCombine, which will in turn allow me to add
target specific InstCombineCalls API for intrinsics without horrible
layering violations.

llvm-svn: 277784

7 years ago[ADT] Migrate DepthFirstIterator to use NodeRef
Tim Shen [Thu, 4 Aug 2016 23:03:44 +0000 (23:03 +0000)]
[ADT] Migrate DepthFirstIterator to use NodeRef

Summary: The corresponding LLVM change is D23146.

Reviewers: dblaikie, chandlerc

Subscribers: cfe-commits

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

llvm-svn: 277783