platform/upstream/llvm.git
9 years agoASTReader: Copy input file offset data to avoid unaligned accesses
Justin Bogner [Sat, 20 Jun 2015 22:31:04 +0000 (22:31 +0000)]
ASTReader: Copy input file offset data to avoid unaligned accesses

We interpret Blob as an array of uint64_t here, but there's no reason
to think that it has suitable alignment. Instead, read the data in in
an alignment-safe way and store it in a std::vector.

This fixes 225 test failures when clang is built with ubsan.

llvm-svn: 240228

9 years agoAdd missing dependency clangFrontend to clangQuery.
Adrian Prantl [Sat, 20 Jun 2015 19:28:07 +0000 (19:28 +0000)]
Add missing dependency clangFrontend to clangQuery.

llvm-svn: 240227

9 years agoAdd missing dependency clangFrontend to unit test.
Adrian Prantl [Sat, 20 Jun 2015 19:21:04 +0000 (19:21 +0000)]
Add missing dependency clangFrontend to unit test.

llvm-svn: 240226

9 years agoIntroduce a PCHContainerOperations interface (NFC).
Adrian Prantl [Sat, 20 Jun 2015 18:53:08 +0000 (18:53 +0000)]
Introduce a PCHContainerOperations interface (NFC).

A PCHContainerOperations abstract interface provides operations for
creating and unwrapping containers for serialized ASTs (precompiled
headers and clang modules). The default implementation is
RawPCHContainerOperations, which uses a flat file for the output.

The main application for this interface will be an
ObjectFilePCHContainerOperations implementation that uses LLVM to
wrap the module in an ELF/Mach-O/COFF container to store debug info
alongside the AST.

rdar://problem/20091852

llvm-svn: 240225

9 years agoSwitch lowering: add heuristic for filling leaf nodes in the weight-balanced binary...
Hans Wennborg [Sat, 20 Jun 2015 17:14:07 +0000 (17:14 +0000)]
Switch lowering: add heuristic for filling leaf nodes in the weight-balanced binary search tree

Sparse switches with profile info are lowered as weight-balanced BSTs. For
example, if the node weights are {1,1,1,1,1,1000}, the right-most node would
end up in a tree by itself, bringing it closer to the top.

However, a leaf in this BST can contain up to 3 cases, and having a single
case in a leaf node as in the example means the tree might become
unnecessarily high.

This patch adds a heauristic to the pivot selection algorithm that moves more
cases into leaf nodes unless that would lower their rank. It still doesn't
yield the optimal tree in every case, but I believe it's conservatibely correct.

llvm-svn: 240224

9 years ago[X86][SSE] Fix PerformSExtCombine bug that accessed the wrong return value of an...
Simon Pilgrim [Sat, 20 Jun 2015 16:19:24 +0000 (16:19 +0000)]
[X86][SSE] Fix PerformSExtCombine bug that accessed the wrong return value of an aggregate type.

Fix to rL237885 to ensure that it accesses the correct return value of an aggregate type.

llvm-svn: 240223

9 years ago[PPC] Factor vector removal into a function and remove O(n^2) behavior.
Benjamin Kramer [Sat, 20 Jun 2015 15:59:41 +0000 (15:59 +0000)]
[PPC] Factor vector removal into a function and remove O(n^2) behavior.

No functionality change intended.

llvm-svn: 240222

9 years ago[SwitchLowering] Remove quadratic vector removal.
Benjamin Kramer [Sat, 20 Jun 2015 15:59:34 +0000 (15:59 +0000)]
[SwitchLowering] Remove quadratic vector removal.

This can be triggered with giant switches. No functionality change
intended.

llvm-svn: 240221

9 years agoAvoid clearing an empty PrioritizedCXXGlobalInits, NFC
Yaron Keren [Sat, 20 Jun 2015 15:51:52 +0000 (15:51 +0000)]
Avoid clearing an empty PrioritizedCXXGlobalInits, NFC

We already test for PrioritizedCXXGlobalInits being non-empty
and process it so it makes sense to clear it only in that if.

llvm-svn: 240220

9 years ago[X86][SSE][CostModel] Added full set of sitofp/uitofp costings for SSE2/AVX/AVX2...
Simon Pilgrim [Sat, 20 Jun 2015 14:58:01 +0000 (14:58 +0000)]
[X86][SSE][CostModel] Added full set of sitofp/uitofp costings for SSE2/AVX/AVX2/AVX512F.

Merged separate (but equivalent) SSE2/AVX512F tests.

Removed codegen tests since these are already done better in test/CodeGen/X86.

The actual cost values still need to be updated to match recent codegen improvements.

llvm-svn: 240219

9 years agoUpdate ELFObjectWriter::reset() following r238073.
Yaron Keren [Sat, 20 Jun 2015 11:54:32 +0000 (11:54 +0000)]
Update ELFObjectWriter::reset() following r238073.

llvm-svn: 240218

9 years agoCOFF: Fix common symbol alignment.
Rui Ueyama [Sat, 20 Jun 2015 07:25:45 +0000 (07:25 +0000)]
COFF: Fix common symbol alignment.

llvm-svn: 240217

9 years agoCOFF: Fix a common symbol bug.
Rui Ueyama [Sat, 20 Jun 2015 07:21:57 +0000 (07:21 +0000)]
COFF: Fix a common symbol bug.

This is a case that one mistake caused a very mysterious bug.
I made a mistake to calculate addresses of common symbols, so
each common symbol pointed not to the beginning of its location
but to the end of its location. (Ouch!)

Common symbols are aligned on 16 byte boundaries. If a common
symbol is small enough to fit between the end of its real
location and whatever comes next, this bug didn't cause any harm.

However, if a common symbol is larger than that, its memory
naturally overlapped with other symbols. That means some
uninitialized variables accidentally shared memory. Because
totally unrelated memory writes mutated other varaibles, it was
hard to debug.

It's surprising that LLD was able to link itself and all LLD
tests except gunit tests passed with this nasty bug.

With this fix, the new COFF linker is able to pass all tests
for LLVM, Clang and LLD if I use MSVC cl.exe as a compiler.
Only three tests are failing when used with clang-cl.

llvm-svn: 240216

9 years agoRangify for loops in Inliner::runOnSCC(), NFC.
Yaron Keren [Sat, 20 Jun 2015 07:12:33 +0000 (07:12 +0000)]
Rangify for loops in Inliner::runOnSCC(), NFC.

llvm-svn: 240215

9 years agoIndVarSimplify: Avoid UB from binding a reference to a null pointer
Justin Bogner [Sat, 20 Jun 2015 06:24:05 +0000 (06:24 +0000)]
IndVarSimplify: Avoid UB from binding a reference to a null pointer

Calling operator* on a WeakVH whose Value is null hits undefined
behaviour, since we bind the value to a reference. Instead, go through
`operator Value*` so that we work with the pointer itself.

Found by ubsan.

llvm-svn: 240214

9 years agoReformat.
NAKAMURA Takumi [Sat, 20 Jun 2015 06:22:04 +0000 (06:22 +0000)]
Reformat.

llvm-svn: 240213

9 years agoRevert r240040, "[BranchFolding] Replace custom MachineInstr with MachineInstrExpress...
NAKAMURA Takumi [Sat, 20 Jun 2015 06:21:48 +0000 (06:21 +0000)]
Revert r240040, "[BranchFolding] Replace custom MachineInstr with MachineInstrExpressionTrait"

It caused different emission between stage2 and stage3. Investigating.

llvm-svn: 240212

9 years agoASTContext.h: Fix utf8 chars in comments.
NAKAMURA Takumi [Sat, 20 Jun 2015 04:20:23 +0000 (04:20 +0000)]
ASTContext.h: Fix utf8 chars in comments.

llvm-svn: 240211

9 years agoTargetInstrInfo.h: Fix r240192. [-Wdocumentation]
NAKAMURA Takumi [Sat, 20 Jun 2015 03:53:18 +0000 (03:53 +0000)]
TargetInstrInfo.h: Fix r240192. [-Wdocumentation]

llvm-svn: 240210

9 years agoSemaDeclObjC.cpp: Escape '@' in the comment. [-Wdocumentation]
NAKAMURA Takumi [Sat, 20 Jun 2015 03:52:52 +0000 (03:52 +0000)]
SemaDeclObjC.cpp: Escape '@' in the comment. [-Wdocumentation]

llvm-svn: 240209

9 years agoRevert "InstrProf: When reading, copy the data instead of taking a reference. NFC"
Justin Bogner [Sat, 20 Jun 2015 01:37:56 +0000 (01:37 +0000)]
Revert "InstrProf: When reading, copy the data instead of taking a reference. NFC"

Seems like MSVC doesn't like this:

  InstrProf.h(49) : error C2614: 'llvm::InstrProfRecord' : illegal member initialization: 'Hash' is not a base or member

This reverts r240206.

llvm-svn: 240208

9 years agoUse correct escaping for semicolon on Windows.
Peter Collingbourne [Sat, 20 Jun 2015 01:28:20 +0000 (01:28 +0000)]
Use correct escaping for semicolon on Windows.

llvm-svn: 240207

9 years agoInstrProf: When reading, copy the data instead of taking a reference. NFC
Justin Bogner [Sat, 20 Jun 2015 01:26:04 +0000 (01:26 +0000)]
InstrProf: When reading, copy the data instead of taking a reference. NFC

This consolidates the logic to read instrprof records into the on disk
hash table's lookup trait and makes us copy the counter data instead
of taking references to it as we read. This will simplify further
changes to the format.

Patch by Betul Buyukkurt.

llvm-svn: 240206

9 years agoLibDriver tests require x86 target.
Peter Collingbourne [Sat, 20 Jun 2015 01:14:37 +0000 (01:14 +0000)]
LibDriver tests require x86 target.

llvm-svn: 240205

9 years ago[modules] When determining whether a definition of a class is visible, check all...
Richard Smith [Sat, 20 Jun 2015 01:05:19 +0000 (01:05 +0000)]
[modules] When determining whether a definition of a class is visible, check all modules even if we've already found a definition that's not visible.

llvm-svn: 240204

9 years agoLibDriver: implement /libpath and $LIB; ignore /ignore and /machine.
Peter Collingbourne [Sat, 20 Jun 2015 00:57:12 +0000 (00:57 +0000)]
LibDriver: implement /libpath and $LIB; ignore /ignore and /machine.

llvm-svn: 240203

9 years ago[MCJIT] Add a FindGlobalVariableNamed utility
Keno Fischer [Sat, 20 Jun 2015 00:55:58 +0000 (00:55 +0000)]
[MCJIT] Add a FindGlobalVariableNamed utility

Summary: This adds FindGlobalVariableNamed to ExecutionEngine
(plus implementation in MCJIT), which is an analog of
FindFunctionNamed for GlobalVariables.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

llvm-svn: 240202

9 years agoLowerSwitch: Avoid some undefined behaviour
Justin Bogner [Sat, 20 Jun 2015 00:28:25 +0000 (00:28 +0000)]
LowerSwitch: Avoid some undefined behaviour

When a case of INT64_MIN was followed by a case that was greater than
zero, we were overflowing a signed integer here. Since we've sorted
the cases here anyway (and thus currentValue must be greater than
nextValue) it's simple enough to avoid this by using addition rather
than subtraction.

Found by UBSAN on existing tests.

llvm-svn: 240201

9 years ago[modules] Refactor and slightly simplify class definition merging.
Richard Smith [Sat, 20 Jun 2015 00:22:34 +0000 (00:22 +0000)]
[modules] Refactor and slightly simplify class definition merging.

llvm-svn: 240200

9 years agoSuppress bogus gcc -Wreturn-type warnings.
Nico Weber [Sat, 20 Jun 2015 00:06:30 +0000 (00:06 +0000)]
Suppress bogus gcc -Wreturn-type warnings.

llvm-svn: 240199

9 years ago[Statepoint] Remove unnecessary argument from Statepoint::getRelocates
Sanjoy Das [Sat, 20 Jun 2015 00:01:03 +0000 (00:01 +0000)]
[Statepoint] Remove unnecessary argument from Statepoint::getRelocates

NFC.

llvm-svn: 240198

9 years ago[Statepoint][NFC] Fix include guard style.
Sanjoy Das [Sat, 20 Jun 2015 00:00:58 +0000 (00:00 +0000)]
[Statepoint][NFC] Fix include guard style.

llvm-svn: 240197

9 years agoYet another MSVC-related fix.
Douglas Gregor [Fri, 19 Jun 2015 23:59:55 +0000 (23:59 +0000)]
Yet another MSVC-related fix.

llvm-svn: 240196

9 years agoRevert 240130, it caused crashes (repro in PR23900).
Nico Weber [Fri, 19 Jun 2015 23:43:47 +0000 (23:43 +0000)]
Revert 240130, it caused crashes (repro in PR23900).

llvm-svn: 240193

9 years agoname change: hasPattern() -> getMachineCombinerPatterns() ; NFC
Sanjay Patel [Fri, 19 Jun 2015 23:21:42 +0000 (23:21 +0000)]
name change: hasPattern() -> getMachineCombinerPatterns() ; NFC

This was suggested as part of D10460, but it's independent of
any functional change.

llvm-svn: 240192

9 years ago[CallGraph] Given -print-callgraph a stable printing order.
Sanjoy Das [Fri, 19 Jun 2015 23:20:31 +0000 (23:20 +0000)]
[CallGraph] Given -print-callgraph a stable printing order.

Summary:
Since FunctionMap has llvm::Function pointers as keys, the order in
which the traversal happens can differ from run to run, causing spurious
FileCheck failures.  Have CallGraph::print sort the CallGraphNodes by
name before printing them.

Reviewers: bogner, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 240191

9 years agoTry to fix the MSVC build
Douglas Gregor [Fri, 19 Jun 2015 23:18:05 +0000 (23:18 +0000)]
Try to fix the MSVC build

llvm-svn: 240190

9 years agoStop moving attributes off of a block literal's decl specifiers.
Douglas Gregor [Fri, 19 Jun 2015 23:18:03 +0000 (23:18 +0000)]
Stop moving attributes off of a block literal's decl specifiers.

These usually apply to the return type. At one point this was necessary to
get some of them to apply to the entire block, but it appears that's working
anyway (see block-return.c).

rdar://problem/20468034

llvm-svn: 240189

9 years agoHandle 'instancetype' in ParseDeclarationSpecifiers.
Douglas Gregor [Fri, 19 Jun 2015 23:18:00 +0000 (23:18 +0000)]
Handle 'instancetype' in ParseDeclarationSpecifiers.

...instead of as a special case in ParseObjCTypeName with lots of
duplicated logic. Besides being a nice refactoring, this also allows
"- (instancetype __nonnull)self" in addition to "- (nonnull instancetype)self".

rdar://problem/19924646

llvm-svn: 240188

9 years agoMake -Wnullability-completeness work with -Wsystem-headers.
Douglas Gregor [Fri, 19 Jun 2015 23:17:55 +0000 (23:17 +0000)]
Make -Wnullability-completeness work with -Wsystem-headers.

rdar://problem/21134250

llvm-svn: 240187

9 years agoCF_RETURNS_[NOT_]RETAINED on a param makes the inner pointer __nullable.
Douglas Gregor [Fri, 19 Jun 2015 23:17:51 +0000 (23:17 +0000)]
CF_RETURNS_[NOT_]RETAINED on a param makes the inner pointer __nullable.

That is,

  void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED);

is equivalent to

  void cf2(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED);

More rdar://problem/18742441

llvm-svn: 240186

9 years agoAllow the cf_returns_[not_]retained attributes to appear on out-parameters.
Douglas Gregor [Fri, 19 Jun 2015 23:17:46 +0000 (23:17 +0000)]
Allow the cf_returns_[not_]retained attributes to appear on out-parameters.

Includes a simple static analyzer check and not much else, but we'll also
be able to take advantage of this in Swift.

This feature can be tested for using __has_feature(cf_returns_on_parameters).

This commit also contains two fixes:
- Look through non-typedef sugar when deciding whether something is a CF type.
- When (cf|ns)_returns(_not)?_retained is applied to invalid properties,
  refer to "property" instead of "method" in the error message.

rdar://problem/18742441

llvm-svn: 240185

9 years agoCOFF: Take reference to argument vector using std::vector::data() instead of operator...
Peter Collingbourne [Fri, 19 Jun 2015 22:40:05 +0000 (22:40 +0000)]
COFF: Take reference to argument vector using std::vector::data() instead of operator[](0).

This avoids undefined behaviour caused by an out-of-range access if the
vector is empty, which can happen if an object file's directive section
contains only whitespace.

llvm-svn: 240183

9 years agoCOFF: Fix precedence between LIB and /libpath.
Rui Ueyama [Fri, 19 Jun 2015 22:39:48 +0000 (22:39 +0000)]
COFF: Fix precedence between LIB and /libpath.

/libpath should take precedence over LIB.
Previously, LIB took precedence over /libpath.

llvm-svn: 240182

9 years agoTry to fix generation of LLVMExports.cmake under Visual Studio.
Dan Liew [Fri, 19 Jun 2015 21:50:27 +0000 (21:50 +0000)]
Try to fix generation of LLVMExports.cmake under Visual Studio.
If LLVMDebugInfoPDB links against the DIA SDK then the exports file
would contain an INTERFACE_LINK_LIBRARIES property that contained an
absolute path to ``diaguids.lib`` which used a native windows path (interpreted
as escape sequences when LLVMExports.cmake is imported causing
``find_package(LLVM)`` to fail) rather than the correct CMake style path.

llvm-svn: 240181

9 years agoCOFF: Add search paths in the correct order.
Rui Ueyama [Fri, 19 Jun 2015 21:44:32 +0000 (21:44 +0000)]
COFF: Add search paths in the correct order.

Previously, we added search paths in reverse order.

llvm-svn: 240180

9 years ago[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple.
Alexey Samsonov [Fri, 19 Jun 2015 21:36:47 +0000 (21:36 +0000)]
[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple.

Introduce ToolChain::getSupportedSanitizers() that would return the set
of sanitizers available on given toolchain. By default, these are
sanitizers which don't necessarily require runtime support and are
not toolchain- or architecture-dependent.

Sanitizers (ASan, DFSan, TSan, MSan etc.) which cannot function
without runtime library are marked as supported only on platforms
for which we actually build these runtimes.

This would allow more fine-grained checks in the future: for instance,
we have to restrict availability of -fsanitize=vptr to Mac OS 10.9+
(PR23539).

Update test cases accrodingly: add tests for certain unsupported
configurations, remove test cases for -fsanitize=vptr + PS4
integration, as we don't build the runtime for PS4 at the moment.

This change was first submitted as r239953 and reverted in r239958.
The problem was and still is in Darwin toolchains, which get the
knowledge about target platform too late after initializaition, while
now we require this information when ToolChain::getSanitizerArgs() is
called. r240170 works around this issue.

llvm-svn: 240179

9 years agoCOFF: Cache Archive::Symbol::getName(). NFC.
Rui Ueyama [Fri, 19 Jun 2015 21:25:44 +0000 (21:25 +0000)]
COFF: Cache Archive::Symbol::getName(). NFC.

getName() does strlen() on the symbol table, so it's not very fast.
It's not as bad as r239332 because the number of symbols exported
from archive files are fewer than object files, and they are usually
shorter, though.

llvm-svn: 240178

9 years agoCOFF: Continue reading object files until converge.
Rui Ueyama [Fri, 19 Jun 2015 21:12:48 +0000 (21:12 +0000)]
COFF: Continue reading object files until converge.

In this linker model, adding an undefined symbol may trigger chain
reactions. It may trigger a Lazy symbol to read a new file.
A new file may contain a directive section, which may contain various
command line options.

Previously, we didn't handle chain reactions well. We visited /include'd
symbols only once, so newly-added /include symbols were ignored.
This patch fixes that bug.

Now, the symbol table is versioned; every time the symbol table is
updated, the version number is incremented. We repeat adding undefined
symbols until the version number does not change. It is guaranteed to
converge -- the number of undefined symbol in the system is finite,
and adding the same undefined symbol more than once is basically no-op.

llvm-svn: 240177

9 years agoImprove error handling of getRelocationAddend.
Rafael Espindola [Fri, 19 Jun 2015 20:58:43 +0000 (20:58 +0000)]
Improve error handling of getRelocationAddend.

This patch changes getRelocationAddend to use ErrorOr and considers it an error
to try to get the addend of a REL section.

If, for example, a x86_64 file has a REL section, that file is corrupted and
we should reject it.

Using ErrorOr is not ideal since we check the section type once per relocation
instead of once per section.

Checking once per section would involve getRelocationAddend just asserting and
callers checking the section before iterating over the relocations.

In any case, this is an improvement and includes a test.

llvm-svn: 240176

9 years agoFix header path in CMake. NFC.
Pete Cooper [Fri, 19 Jun 2015 20:49:02 +0000 (20:49 +0000)]
Fix header path in CMake.  NFC.

The ADDITIONAL_HEADER_DIRS command can be used to tell UIs that a given library
owns certain headers.  The path for MCParser was missing MC/ in it.

llvm-svn: 240175

9 years agoMIR Parser: report an error when a basic block isn't found.
Alex Lorenz [Fri, 19 Jun 2015 20:12:03 +0000 (20:12 +0000)]
MIR Parser: report an error when a basic block isn't found.

This commit reports an error when the MIR parser can't find
a basic block with the machine basic block's name.

llvm-svn: 240174

9 years agoFix the MacOSX build to include the Mips64 ABI plug-in.
Greg Clayton [Fri, 19 Jun 2015 20:08:36 +0000 (20:08 +0000)]
Fix the MacOSX build to include the Mips64 ABI plug-in.

llvm-svn: 240173

9 years agoFix the clang -Werror build (-Wbraced-scalar-init)
David Blaikie [Fri, 19 Jun 2015 20:07:18 +0000 (20:07 +0000)]
Fix the clang -Werror build (-Wbraced-scalar-init)

llvm-svn: 240172

9 years agoFix a use of err_nullability_conflicting that's triggering an assertion.
Douglas Gregor [Fri, 19 Jun 2015 20:00:10 +0000 (20:00 +0000)]
Fix a use of err_nullability_conflicting that's triggering an assertion.

llvm-svn: 240171

9 years ago[CFI] Require -flto instead of implying it.
Alexey Samsonov [Fri, 19 Jun 2015 19:57:46 +0000 (19:57 +0000)]
[CFI] Require -flto instead of implying it.

Summary:
This is unfortunate, but would let us land http://reviews.llvm.org/D10467,
that makes ToolChains responsible for computing the set of sanitizers
they support.

Unfortunately, Darwin ToolChains doesn't know about actual OS they
target until ToolChain::TranslateArgs() is called. In particular, it
means we won't be able to construct SanitizerArgs for these ToolChains
before that.

This change removes SanitizerArgs::needsLTO() method, so that now
ToolChain::IsUsingLTO(), which is called very early, doesn't need
SanitizerArgs to implement this method.

Docs and test cases are updated accordingly. See
https://llvm.org/bugs/show_bug.cgi?id=23539, which describes why we
start all these.

Test Plan: regression test suite

Reviewers: pcc

Subscribers: cfe-commits

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

llvm-svn: 240170

9 years agoFix no-asserts build failure due to unused variable, and cleanup some unique_ptr...
David Blaikie [Fri, 19 Jun 2015 19:55:25 +0000 (19:55 +0000)]
Fix no-asserts build failure due to unused variable, and cleanup some unique_ptr usage while I'm here

llvm-svn: 240169

9 years agoAdd -flto to clang flags for cfi tests.
Alexey Samsonov [Fri, 19 Jun 2015 19:48:40 +0000 (19:48 +0000)]
Add -flto to clang flags for cfi tests.

llvm-svn: 240168

9 years agoSimplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&
David Blaikie [Fri, 19 Jun 2015 19:43:43 +0000 (19:43 +0000)]
Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&

None of the implementations replace the SimpleFile with some other file,
they just modify the SimpleFile in-place, so a direct reference to the
file is sufficient.

llvm-svn: 240167

9 years agoAdd comment for workarond in DYLDRendezvous with android version
Tamas Berghammer [Fri, 19 Jun 2015 19:42:43 +0000 (19:42 +0000)]
Add comment for workarond in DYLDRendezvous with android version

llvm-svn: 240166

9 years ago[LoopDist] Rename RuntimeCheckEmitter to LoopVersioning, NFC
Adam Nemet [Fri, 19 Jun 2015 19:32:48 +0000 (19:32 +0000)]
[LoopDist] Rename RuntimeCheckEmitter to LoopVersioning, NFC

llvm-svn: 240165

9 years ago[LoopDist] Move pointer-to-partition computation out of RuntimeCheckEmitter, NFC
Adam Nemet [Fri, 19 Jun 2015 19:32:41 +0000 (19:32 +0000)]
[LoopDist] Move pointer-to-partition computation out of RuntimeCheckEmitter, NFC

This starts preparing the class to become a (more) general
LoopVersioning utility class.

llvm-svn: 240164

9 years agoFix illegal chars that snuck into <memory>
Marshall Clow [Fri, 19 Jun 2015 19:32:06 +0000 (19:32 +0000)]
Fix illegal chars that snuck into <memory>

llvm-svn: 240163

9 years agoFix build brakage caused by r240154
Tamas Berghammer [Fri, 19 Jun 2015 19:28:13 +0000 (19:28 +0000)]
Fix build brakage caused by r240154

llvm-svn: 240162

9 years agoCOFF: Don't add new undefined symbols for /alternatename.
Rui Ueyama [Fri, 19 Jun 2015 19:23:43 +0000 (19:23 +0000)]
COFF: Don't add new undefined symbols for /alternatename.

Alternatename option is in the form of /alternatename:<from>=<to>.
It's effect is to resolve <from> as <to> if <from> is still undefined
at end of name resolution.

If <from> is not undefined but completely a new symbol, alternatename
shouldn't do anything. Previously, it introduced a new undefined
symbol for <from>, which resulted in undefined symbol error.

llvm-svn: 240161

9 years agoDelete dead code. NFC.
Rafael Espindola [Fri, 19 Jun 2015 19:07:59 +0000 (19:07 +0000)]
Delete dead code. NFC.

llvm-svn: 240160

9 years agoCode completion for nullability type specifiers.
Douglas Gregor [Fri, 19 Jun 2015 18:27:52 +0000 (18:27 +0000)]
Code completion for nullability type specifiers.

Another part of rdar://problem/18868820.

llvm-svn: 240159

9 years agoCheck for consistent use of nullability type specifiers in a header.
Douglas Gregor [Fri, 19 Jun 2015 18:27:45 +0000 (18:27 +0000)]
Check for consistent use of nullability type specifiers in a header.

Adds a new warning (under -Wnullability-completeness) that complains
about pointer, block pointer, or member pointer declarations that have
not been annotated with nullability information (directly or inferred)
within a header that contains some nullability annotations. This is
intended to be used to help maintain the completeness of nullability
information within a header that has already been audited.

Note that, for performance reasons, this warning will underrepresent
the number of non-annotated pointers in the case where more than one
pointer is seen before the first nullability type specifier, because
we're only tracking one piece of information per header. Part of
rdar://problem/18868820.

llvm-svn: 240158

9 years agoLoad executable module when attaching to process; implement detach from process.
Adrian McCarthy [Fri, 19 Jun 2015 18:26:53 +0000 (18:26 +0000)]
Load executable module when attaching to process; implement detach from process.

llvm-svn: 240157

9 years agoIntroduced pragmas for audited nullability regions.
Douglas Gregor [Fri, 19 Jun 2015 18:25:57 +0000 (18:25 +0000)]
Introduced pragmas for audited nullability regions.

Introduce the clang pragmas "assume_nonnull begin" and "assume_nonnull
end" in which we make default assumptions about the nullability of many
unannotated pointers:

  - Single-level pointers are inferred to __nonnull
  - NSError** in a (function or method) parameter list is inferred to
    NSError * __nullable * __nullable.
  - CFErrorRef * in a (function or method) parameter list is inferred
    to CFErrorRef __nullable * __nullable.
  - Other multi-level pointers are never inferred to anything.

Implements rdar://problem/19191042.

llvm-svn: 240156

9 years agoImplement the 'null_resettable' attribute for Objective-C properties.
Douglas Gregor [Fri, 19 Jun 2015 18:14:46 +0000 (18:14 +0000)]
Implement the 'null_resettable' attribute for Objective-C properties.

'null_resettable' properties are those whose getters return nonnull
but whose setters take nil, to "reset" the property to some
default. Implements rdar://problem/19051334.

llvm-svn: 240155

9 years agoExtend type nullability qualifiers for Objective-C.
Douglas Gregor [Fri, 19 Jun 2015 18:14:38 +0000 (18:14 +0000)]
Extend type nullability qualifiers for Objective-C.

Introduce context-sensitive, non-underscored nullability specifiers
(nonnull, nullable, null_unspecified) for Objective-C method return
types, method parameter types, and properties.

Introduce Objective-C-specific semantics, including computation of the
nullability of the result of a message send, merging of nullability
information from the @interface of a class into its @implementation,
etc .

This is the Objective-C part of rdar://problem/18868820.

llvm-svn: 240154

9 years agoDiagnose unsafe uses of nil and __nonnull pointers.
Douglas Gregor [Fri, 19 Jun 2015 18:13:19 +0000 (18:13 +0000)]
Diagnose unsafe uses of nil and __nonnull pointers.

This generalizes the checking of null arguments to also work with
values of pointer-to-function, reference-to-function, and block
pointer type, using the nullability information within the underling
function prototype to extend non-null checking, and diagnoses returns
of 'nil' within a function with a __nonnull return type.

Note that we don't warn about nil returns from Objective-C methods,
because it's common for Objective-C methods to mimic the nil-swallowing
behavior of the receiver by checking ostensibly non-null parameters
and returning nil from otherwise non-null methods in that
case.

It also diagnoses (via a separate flag) conversions from nullable to
nonnull pointers. It's a separate flag because this warning can be noisy.

llvm-svn: 240153

9 years agoAdd a comment and FIXME based on the commit message that made the
Eric Christopher [Fri, 19 Jun 2015 18:09:33 +0000 (18:09 +0000)]
Add a comment and FIXME based on the commit message that made the
intrinsic _mm_prefetch into a builtin rather than by textual inclusion
via the intrinsic headers.

llvm-svn: 240152

9 years agoAMDGPU: Fix filename in comment
Matt Arsenault [Fri, 19 Jun 2015 17:56:51 +0000 (17:56 +0000)]
AMDGPU: Fix filename in comment

llvm-svn: 240151

9 years agoAMDGPU: Fix renamed file that was somehow dropped from last commit
Matt Arsenault [Fri, 19 Jun 2015 17:55:06 +0000 (17:55 +0000)]
AMDGPU: Fix renamed file that was somehow dropped from last commit

llvm-svn: 240150

9 years agoMake getRelocationSection MachO only.
Rafael Espindola [Fri, 19 Jun 2015 17:54:28 +0000 (17:54 +0000)]
Make getRelocationSection MachO only.

There are 3 types of relocations on MachO
* Scattered
* Section based
* Symbol based

On ELF and COFF relocations are symbol based.

We were in the strange situation that we abstracted over two of them. This makes
section based relocations MachO only.

llvm-svn: 240149

9 years agoAMDGPU: Fix places missed in rename
Matt Arsenault [Fri, 19 Jun 2015 17:54:10 +0000 (17:54 +0000)]
AMDGPU: Fix places missed in rename

llvm-svn: 240148

9 years ago[lld] Allow LLD passes to return error codes.
Lang Hames [Fri, 19 Jun 2015 17:51:46 +0000 (17:51 +0000)]
[lld] Allow LLD passes to return error codes.

llvm-svn: 240147

9 years agoIntroduce type nullability specifiers for C/C++.
Douglas Gregor [Fri, 19 Jun 2015 17:51:05 +0000 (17:51 +0000)]
Introduce type nullability specifiers for C/C++.

Introduces the type specifiers __nonnull, __nullable, and
__null_unspecified that describe the nullability of the pointer type
to which the specifier appertains. Nullability type specifiers improve
on the existing nonnull attributes in a few ways:
  - They apply to types, so one can represent a pointer to a non-null
    pointer, use them in function pointer types, etc.
  - As type specifiers, they are syntactically more lightweight than
    __attribute__s or [[attribute]]s.
  - They can express both the notion of 'should never be null' and
  also 'it makes sense for this to be null', and therefore can more
  easily catch errors of omission where one forgot to annotate the
  nullability of a particular pointer (this will come in a subsequent
  patch).

Nullability type specifiers are maintained as type sugar, and
therefore have no effect on mangling, encoding, overloading,
etc. Nonetheless, they will be used for warnings about, e.g., passing
'null' to a method that does not accept it.

This is the C/C++ part of rdar://problem/18868820.

llvm-svn: 240146

9 years agoMIR Serialization: Serialize the list of machine basic blocks with simple attributes.
Alex Lorenz [Fri, 19 Jun 2015 17:43:07 +0000 (17:43 +0000)]
MIR Serialization: Serialize the list of machine basic blocks with simple attributes.

This commit implements the initial serialization of machine basic blocks in a
machine function. Only the simple, scalar MBB attributes are serialized. The
reference to LLVM IR's basic block is preserved when that basic block has a name.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 240145

9 years ago[SLP] Vectorize for all-constant entries.
Michael Zolotukhin [Fri, 19 Jun 2015 17:40:15 +0000 (17:40 +0000)]
[SLP] Vectorize for all-constant entries.

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

llvm-svn: 240144

9 years agoAMDGPU: Fix some places missed in rename
Matt Arsenault [Fri, 19 Jun 2015 17:39:03 +0000 (17:39 +0000)]
AMDGPU: Fix some places missed in rename

llvm-svn: 240143

9 years agoMIR Serialization: use default member initializers to initialize yaml::MachineFunctio...
Alex Lorenz [Fri, 19 Jun 2015 17:36:02 +0000 (17:36 +0000)]
MIR Serialization: use default member initializers to initialize yaml::MachineFunction. NFC.

Default member initializers are permitted since r236244.

llvm-svn: 240142

9 years agoTypo. NFC.
Chad Rosier [Fri, 19 Jun 2015 17:32:57 +0000 (17:32 +0000)]
Typo. NFC.

llvm-svn: 240141

9 years agoAvoid warning about inability to cast from ptr-to-obj to ptr-to-fun.
Douglas Katzman [Fri, 19 Jun 2015 17:21:02 +0000 (17:21 +0000)]
Avoid warning about inability to cast from ptr-to-obj to ptr-to-fun.

Use POSIX.1-2003 Technical Corrigendum 1 suggested workaround.

llvm-svn: 240140

9 years agoFix ASAN bot; missing bookkeeping in r240136.
Marshall Clow [Fri, 19 Jun 2015 17:13:59 +0000 (17:13 +0000)]
Fix ASAN bot; missing bookkeeping in r240136.

llvm-svn: 240139

9 years agoFix the lldb build for the EM_486 change.
Rafael Espindola [Fri, 19 Jun 2015 17:02:25 +0000 (17:02 +0000)]
Fix the lldb build for the EM_486 change.

llvm-svn: 240138

9 years agoFixed/added namespace ending comments using clang-tidy. NFC
Alexander Kornienko [Fri, 19 Jun 2015 15:57:42 +0000 (15:57 +0000)]
Fixed/added namespace ending comments using clang-tidy. NFC

The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/

Thanks to Eugene Kosov for the original patch!

llvm-svn: 240137

9 years agoFix PR#18843. Thanks to Howard for the fix
Marshall Clow [Fri, 19 Jun 2015 15:54:13 +0000 (15:54 +0000)]
Fix PR#18843. Thanks to Howard for the fix

llvm-svn: 240136

9 years agoFix typo in comment.
Douglas Katzman [Fri, 19 Jun 2015 15:40:00 +0000 (15:40 +0000)]
Fix typo in comment.

llvm-svn: 240135

9 years agoAdd nominal support for 'shave' target.
Douglas Katzman [Fri, 19 Jun 2015 14:55:19 +0000 (14:55 +0000)]
Add nominal support for 'shave' target.

This change passes through C and assembler jobs to Movidius tools by
constructing commands which are the same as ones produces by the examples
in the SDK. But rather than reference MV_TOOLS_DIR to find tools,
we will assume that binaries are installed wherever the Driver would
find its native tools. Similarly, this change assumes that -I options
will "just work" based on where SDK headers get installed, rather than
baking into the Driver some magic paths.

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

llvm-svn: 240134

9 years agoFix the build.
Rafael Espindola [Fri, 19 Jun 2015 14:34:12 +0000 (14:34 +0000)]
Fix the build.

Sorry, I have no idea how grep failed to find this.

llvm-svn: 240133

9 years agoReplace EM_486 with EM_IAMCU.
Rafael Espindola [Fri, 19 Jun 2015 14:22:16 +0000 (14:22 +0000)]
Replace EM_486 with EM_IAMCU.

This matches the current
http://www.sco.com/developers/gabi/latest/ch4.eheader.html#machine

llvm-svn: 240132

9 years ago[ASan] Initial support for Kernel AddressSanitizer
Alexander Potapenko [Fri, 19 Jun 2015 12:19:07 +0000 (12:19 +0000)]
[ASan] Initial support for Kernel AddressSanitizer

This patch adds initial support for the -fsanitize=kernel-address flag to Clang.
Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported.
Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux.
To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used.

llvm-svn: 240131

9 years agoMake all temporary symbols unnamed.
Rafael Espindola [Fri, 19 Jun 2015 12:16:55 +0000 (12:16 +0000)]
Make all temporary symbols unnamed.

What this does is make all symbols that would otherwise start with a .L
(or L on MachO) unnamed.

Some of these symbols still show up in the symbol table, but we can just
make them unnamed.

In order to make sure we produce identical results when going thought assembly,
all .L (not just the compiler produced ones), are now unnamed.

Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to
205.57MB.

llvm-svn: 240130

9 years agoclang-format: Make exception to AlwaysBreakBeforeMultilineStrings more
Daniel Jasper [Fri, 19 Jun 2015 10:32:28 +0000 (10:32 +0000)]
clang-format: Make exception to AlwaysBreakBeforeMultilineStrings more
conservative.

In particular, this fixes an unwanted corner case.

Before:
  string s =
      someFunction("aaaa"
                   "bbbb");

After:
  string s = someFunction(
      "aaaa"
      "bbbb");

llvm-svn: 240129

9 years agoclang-format: Add TypeScript detection to git-clang-format.
Daniel Jasper [Fri, 19 Jun 2015 08:23:10 +0000 (08:23 +0000)]
clang-format: Add TypeScript detection to git-clang-format.

llvm-svn: 240128

9 years agoclang-format: Better fix to detect elaborated enum return types.
Daniel Jasper [Fri, 19 Jun 2015 08:17:32 +0000 (08:17 +0000)]
clang-format: Better fix to detect elaborated enum return types.

The previous one (r240021) regressed:
  enum E Type::f() { .. }

llvm-svn: 240127

9 years ago[ATTRIBUTE] Fixed test compatibility.
Alexey Bataev [Fri, 19 Jun 2015 08:09:27 +0000 (08:09 +0000)]
[ATTRIBUTE] Fixed test compatibility.

llvm-svn: 240126