platform/upstream/llvm.git
8 years ago[Support] Make all Errors convertible to std::error_code.
Lang Hames [Wed, 23 Mar 2016 23:57:28 +0000 (23:57 +0000)]
[Support] Make all Errors convertible to std::error_code.

This is a temporary crutch to enable code that currently uses std::error_code
to be incrementally moved over to Error. Requiring all Error instances be
convertible enables clients to call errorToErrorCode on any error (not just
ECErrors created by conversion *from* an error_code).

This patch also moves code for Error from ErrorHandling.cpp into a new
Error.cpp file.

llvm-svn: 264221

8 years agoAPFloat: Fix signalling nans for scalbn
Matt Arsenault [Wed, 23 Mar 2016 23:51:45 +0000 (23:51 +0000)]
APFloat: Fix signalling nans for scalbn

llvm-svn: 264219

8 years agoFix a typo, Tiles -> Files, NFC
Vedant Kumar [Wed, 23 Mar 2016 23:51:36 +0000 (23:51 +0000)]
Fix a typo, Tiles -> Files, NFC

llvm-svn: 264218

8 years ago[JITLoaderGDB] Read jit entry struct manually.
Siva Chandra [Wed, 23 Mar 2016 23:27:23 +0000 (23:27 +0000)]
[JITLoaderGDB] Read jit entry struct manually.

Summary:
Though r264012 was fancy enough to make reading the jit entry struct
work with templates, the packing and alignment attributes do not work on
Windows. So, this change makes it plain and simple with manual reading
of the jit entry struct.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 264217

8 years agoclang-cl: Add a FIXME for bumping the default msc version.
Nico Weber [Wed, 23 Mar 2016 23:26:59 +0000 (23:26 +0000)]
clang-cl: Add a FIXME for bumping the default msc version.

llvm-svn: 264216

8 years agoAMDGPU: Remove atomic inc/dec patterns
Matt Arsenault [Wed, 23 Mar 2016 23:23:38 +0000 (23:23 +0000)]
AMDGPU: Remove atomic inc/dec patterns

There is no benefit to these since materializing the constant 1
requires the same number of instructions as materializing uint_max

llvm-svn: 264215

8 years agoAMDGPU: Promote alloca should skip volatiles
Matt Arsenault [Wed, 23 Mar 2016 23:17:29 +0000 (23:17 +0000)]
AMDGPU: Promote alloca should skip volatiles

llvm-svn: 264214

8 years ago[sancov] code readability improvement.
Mike Aizatsky [Wed, 23 Mar 2016 23:15:03 +0000 (23:15 +0000)]
[sancov] code readability improvement.

Summary: Reply to http://reviews.llvm.org/D18341

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

llvm-svn: 264213

8 years ago[llgo] Increment "Debug Info Version"
Andrew Wilkins [Wed, 23 Mar 2016 23:09:00 +0000 (23:09 +0000)]
[llgo] Increment "Debug Info Version"

Patch by Michal Cierniak!

This patch increments the "Debug Info Version" from 2 to 3.
This is a nop if you just want to generate binaries. I verified
that with and without this patch, when I run llgo -g on a Go
source file, I get exactly the same binary. The purpose of the
patch is to make it possible to run the llvm-dis tool. Without
the patch, it is impossible to disassemble files generated with
llgo:

  $ llgo -c -g -emit-llvm src/hello.go
  $ llvm-dis hello.o
  llvm-dis: warning: ignoring debug info with an invalid version (2) in hello.o

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

llvm-svn: 264212

8 years agoFix typo in test from r264210, sigh.
Nico Weber [Wed, 23 Mar 2016 23:01:38 +0000 (23:01 +0000)]
Fix typo in test from r264210, sigh.

(The test passes both with and without this change, but it's confusing without
it.)

llvm-svn: 264211

8 years agoclang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.
Nico Weber [Wed, 23 Mar 2016 22:57:55 +0000 (22:57 +0000)]
clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.

Remove tests that have neither a triple nor an explicit -fmsc-version flag,
since in the absence of an -fmsc-version flag, the implicit value of the flag
is 17 (MSVC2013) with MSVC triples but 0 (not set) for other triples, and
the default triple is platform dependent.

This relands r263974 with a test fix.

llvm-svn: 264210

8 years agodocs: Fix a missing language in a code-block
Justin Bogner [Wed, 23 Mar 2016 22:54:19 +0000 (22:54 +0000)]
docs: Fix a missing language in a code-block

This should fix the docs build.
Spotted by spstarr, thanks!

llvm-svn: 264209

8 years ago[CUDA] Update docs to reflect that we no longer define __NVCC__.
Justin Lebar [Wed, 23 Mar 2016 22:43:10 +0000 (22:43 +0000)]
[CUDA] Update docs to reflect that we no longer define __NVCC__.

llvm-svn: 264208

8 years ago[CUDA] Merge most of CodeGenCUDA/function-overload.cu into SemaCUDA/function-overload.cu.
Justin Lebar [Wed, 23 Mar 2016 22:42:30 +0000 (22:42 +0000)]
[CUDA] Merge most of CodeGenCUDA/function-overload.cu into SemaCUDA/function-overload.cu.

Summary:
Previously we were using the codegen test to ensure that we choose the
right overload.  But we can do this within sema, with a bit of
cleverness.

I left the constructor/destructor checks in CodeGen, because these
overloads (particularly on the destructors) are hard to check in Sema.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 264207

8 years ago[CUDA] Simplify SemaCUDA/function-overload.cu test.
Justin Lebar [Wed, 23 Mar 2016 22:42:28 +0000 (22:42 +0000)]
[CUDA] Simplify SemaCUDA/function-overload.cu test.

Summary:
Principally, don't hardcode the line numbers of various notes.  This
lets us make changes to the test without recomputing linenos everywhere.

Instead, just tell -verify that we may get 0 or more notes pointing to
the relevant function definitions.  Checking that we get exactly the
right note isn't so important (and anyway is checked elsewhere).

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 264206

8 years ago[CUDA] Don't define __NVCC__.
Justin Lebar [Wed, 23 Mar 2016 22:42:27 +0000 (22:42 +0000)]
[CUDA] Don't define __NVCC__.

Summary:
We decided this makes life too difficult for code authors.  For example,
people may want to detect NVCC and disable variadic templates, which
NVCC does not support, but which we do.

Since people are going to have to change compiler flags *anyway* in
order to compile with clang, if they really want the old behavior, they
can pass -D__NVCC__.

Tested with tensorflow and thrust, no apparent problems.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 264205

8 years agoFix more cases of UB from allocating 0 sized data. NFC.
Pete Cooper [Wed, 23 Mar 2016 22:19:16 +0000 (22:19 +0000)]
Fix more cases of UB from allocating 0 sized data.  NFC.

The size of a section can be zero, even when it contains atoms, so
long as all of the atoms are also size 0.  In this case we were
allocating space for a 0 sized buffer.

Changed this to only allocate when we need the space, but also cleaned
up all the code to use MutableArrayRef instead of uint8_t* so its much much
safer as we get bounds checking on all of our section creation logic.

llvm-svn: 264204

8 years agoAdd missing __builtin_bitreverse8
Matt Arsenault [Wed, 23 Mar 2016 22:14:43 +0000 (22:14 +0000)]
Add missing __builtin_bitreverse8

Also add documentation for bitreverse builtins

llvm-svn: 264203

8 years agoUse a memcpy to avoid unaligned store UB.
Pete Cooper [Wed, 23 Mar 2016 22:00:09 +0000 (22:00 +0000)]
Use a memcpy to avoid unaligned store UB.

On a 32-bit output, we may write LC_SOURCE_VERSION (which contains a uint64_t) to
an unaligned address.  This changes it to use a memcpy instead which is UB safe.

llvm-svn: 264202

8 years agoStringRef::copy shouldn't allocate anything for length 0 strings.
Pete Cooper [Wed, 23 Mar 2016 21:49:31 +0000 (21:49 +0000)]
StringRef::copy shouldn't allocate anything for length 0 strings.

The BumpPtrAllocator currently doesn't handle zero length allocations well.
The discussion for how to fix that is ongoing.  However, there's no need
for StringRef::copy to actually allocate anything here anyway, so just
return StringRef() when we get a zero length copy.

Reviewed by David Blaikie

llvm-svn: 264201

8 years agoAMDGPU: Insert moves of frame index to value operands
Matt Arsenault [Wed, 23 Mar 2016 21:49:25 +0000 (21:49 +0000)]
AMDGPU: Insert moves of frame index to value operands

Strengthen tests of storing frame indices.

Right now this just creates irrelevant scheduling changes.

We don't want to have multiple frame index operands
on an instruction. There seem to be various assumptions
that at least the same frame index will not appear twice
in the LocalStackSlotAllocation pass.

There's no reason to have this happen, and it just
makes it easy to introduce bugs where the immediate
offset is appplied to the storing instruction when it should
really be applied to the value being stored as a separate
add.

This might not be sufficient. It might still be problematic
to have an add fi, fi situation, but that's even less unlikely
to happen in real code.

llvm-svn: 264200

8 years agoAllow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed.
Cong Hou [Wed, 23 Mar 2016 21:45:37 +0000 (21:45 +0000)]
Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed.

Currently, AnalyzeBranch() fails non-equality comparison between floating points
on X86 (see https://llvm.org/bugs/show_bug.cgi?id=23875). This is because this
function can modify the branch by reversing the conditional jump and removing
unconditional jump if there is a proper fall-through. However, in the case of
non-equality comparison between floating points, this can turn the branch
"unanalyzable". Consider the following case:

jne.BB1
jp.BB1
jmp.BB2
.BB1:
...
.BB2:
...

AnalyzeBranch() will reverse "jp .BB1" to "jnp .BB2" and then "jmp .BB2" will be
removed:

jne.BB1
jnp.BB2
.BB1:
...
.BB2:
...

However, AnalyzeBranch() cannot analyze this branch anymore as there are two
conditional jumps with different targets. This may disable some optimizations
like block-placement: in this case the fall-through behavior is enforced even if
the fall-through block is very cold, which is suboptimal.

Actually this optimization is also done in block-placement pass, which means we
can remove this optimization from AnalyzeBranch(). However, currently
X86::COND_NE_OR_P and X86::COND_NP_OR_E are not reversible: there is no defined
negation conditions for them.

In order to reverse them, this patch defines two new CondCode X86::COND_E_AND_NP
and X86::COND_P_AND_NE. It also defines how to synthesize instructions for them.
Here only the second conditional jump is reversed. This is valid as we only need
them to do this "unconditional jump removal" optimization.

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

llvm-svn: 264199

8 years agoFix a cut-and-paste error in the changes for r264187 which I think is
Kevin Enderby [Wed, 23 Mar 2016 21:45:21 +0000 (21:45 +0000)]
Fix a cut-and-paste error in the changes for r264187 which I think is
the cause of the tools/llvm-objdump/X86/macho-symbolized-disassembly.test
crashing on linux.  Either way clearly incorrect code.

llvm-svn: 264198

8 years agoreorganize llc checks script to allow more flexibility; NFCI
Sanjay Patel [Wed, 23 Mar 2016 21:40:53 +0000 (21:40 +0000)]
reorganize llc checks script to allow more flexibility; NFCI

The goal is to enhance this script to be used with opt and clang:
Group all of the regexes together, so it's easier to see what's going on.
This will make it easier to break main() up into pieces too.
Also, note that some of the regexes are for x86-specific asm.

llvm-svn: 264197

8 years agoObjC: add getter/setter for class properties to global pool.
Manman Ren [Wed, 23 Mar 2016 21:39:31 +0000 (21:39 +0000)]
ObjC: add getter/setter for class properties to global pool.

rdar://problem/25323072

llvm-svn: 264196

8 years ago[sanitizer] Add strnlen to the common interceptors
Derek Bruening [Wed, 23 Mar 2016 21:24:28 +0000 (21:24 +0000)]
[sanitizer] Add strnlen to the common interceptors

Summary:
Adds strnlen to the common interceptors, under the existing flag
intercept_strlen.

Removes the now-duplicate strnlen interceptor from asan and msan.
This adds strnlen to tsan, which previously did not intercept it.

Adds a new test of strnlen to the sanitizer_common test cases.

Reviewers: samsonov

Subscribers: zhaoqin, llvm-commits, kcc

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

llvm-svn: 264195

8 years agoMore more change need as part of r264187 where ErrorOr<> was added
Kevin Enderby [Wed, 23 Mar 2016 21:20:16 +0000 (21:20 +0000)]
More more change need as part of r264187 where ErrorOr<> was added
to getSymbolType().

llvm-svn: 264194

8 years agoELF: Split BitcodeCompiler::compile.
Rui Ueyama [Wed, 23 Mar 2016 21:19:27 +0000 (21:19 +0000)]
ELF: Split BitcodeCompiler::compile.

http://reviews.llvm.org/D18410

llvm-svn: 264193

8 years agoFix logic for which symbols to keep with comdats.
Rafael Espindola [Wed, 23 Mar 2016 21:16:33 +0000 (21:16 +0000)]
Fix logic for which symbols to keep with comdats.

If a comdat is dropped, all symbols in it are dropped.
If a comdat is kept, the symbols survive to pass regular symbol
resolution.
With this patch we do that for all global symbols.

The added test is a copy of test/tools/gold/X86/comdat.ll that we now
pass.

llvm-svn: 264192

8 years agoGuard a number of tests relying on threads support when built in
Richard Barton [Wed, 23 Mar 2016 21:04:11 +0000 (21:04 +0000)]
Guard a number of tests relying on threads support when built in
single-threaded mode.

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

llvm-svn: 264191

8 years ago[asan] Export new and delete operators on Windows
Reid Kleckner [Wed, 23 Mar 2016 20:45:52 +0000 (20:45 +0000)]
[asan] Export new and delete operators on Windows

This is necessary to support the dynamic CRT (/MD) with VS2015. In
VS2015, these symbols are no longer imported from a DLL, they provided
statically by msvcrt.lib. This means our approach of hotpatching the DLL
no longer works.

By exporting the symbols, we end up relying on the same mechanism that
we use to intercept symbols in the static CRT (/MT) case. The ASan
runtime always needs to appear first on the link line, and the linker
searches for symbol definitions from left to right. This means we can
stop hotpatching operator new and delete in the CRT, which is nice.

I think that the only reason we weren't exporting the symbols already is
because MSVC doesn't allow you to do it directly with
__declspec(dllexport). Instead, we can use
`#pragma comment(linker, "/export:foo")`, which is most of what the
attribute does under the hood. It does mean we have to write down the
mangled names of the operators, but that's not too bad.

llvm-svn: 264190

8 years agoMake SemaAccess smarter about determining when a dependent class might
Richard Smith [Wed, 23 Mar 2016 20:39:06 +0000 (20:39 +0000)]
Make SemaAccess smarter about determining when a dependent class might
instantiate to match a friend class declaration. It's still pretty dumb,
though.

llvm-svn: 264189

8 years agoAdd the needed lld change for r264187 in llvm.
Kevin Enderby [Wed, 23 Mar 2016 20:37:23 +0000 (20:37 +0000)]
Add the needed lld change for r264187 in llvm.

Sorry had this fixed in my check out but failed mention it in my
commit message for r264187.

llvm-svn: 264188

8 years agoFix a crash in running llvm-objdump -t with an invalid Mach-O file already
Kevin Enderby [Wed, 23 Mar 2016 20:27:00 +0000 (20:27 +0000)]
Fix a crash in running llvm-objdump -t with an invalid Mach-O file already
in the test suite. While this is not really an interesting tool and option to run
on a Mach-O file to show the symbol table in a generic libObject format
it shouldn’t crash.

The reason for the crash was in MachOObjectFile::getSymbolType() when it was
calling MachOObjectFile::getSymbolSection() without checking its return value
for the error case.

What makes this fix require a fair bit of diffs is that the method getSymbolType() is
in the class ObjectFile defined without an ErrorOr<> so I needed to add that all
the sub classes.  And all of the uses needed to be updated and the return value
needed to be checked for the error case.

The MachOObjectFile version of getSymbolType() “can” get an error in trying to
come up with the libObject’s internal SymbolRef::Type when the Mach-O symbol
symbol type is an N_SECT type because the code is trying to select from the
SymbolRef::ST_Data or SymbolRef::ST_Function values for the SymbolRef::Type.
And it needs the Mach-O section to use isData() and isBSS to determine if
it will return SymbolRef::ST_Data.

One other possible fix I considered is to simply return SymbolRef::ST_Other
when MachOObjectFile::getSymbolSection() returned an error.  But since in
the past when I did such changes that “ate an error in the libObject code” I
was asked instead to push the error out of the libObject code I chose not
to implement the fix this way.

As currently written both the COFF and ELF versions of getSymbolType()
can’t get an error.  But if isReservedSectionNumber() wanted to check for
the two known negative values rather than allowing all negative values or
the code wanted to add the same check as in getSymbolAddress() to use
getSection() and check for the error then these versions of getSymbolType()
could return errors.

At the end of the day the error printed now is the generic “Invalid data was
encountered while parsing the file” for object_error::parse_failed.  In the
future when we thread Lang’s new TypedError for recoverable error handling
though libObject this will improve.  And where the added // Diagnostic(…
comment is, it would be changed to produce and error message
like “bad section index (42) for symbol at index 8” for this case.

llvm-svn: 264187

8 years ago[x86] make peekThroughBitcasts() a helper function
Sanjay Patel [Wed, 23 Mar 2016 20:16:37 +0000 (20:16 +0000)]
[x86] make peekThroughBitcasts() a helper function

This should be hoisted further up so it can be used in DAGCombiner and other backends,
but I'm limiting the scope in the interest of patch minimalism.

It's not quite NFC because some of the replaced code was using an 'if' check rather
than a 'while' loop, so those cases would only look through a single bitcast.

llvm-svn: 264186

8 years ago[AArch64] Replace return 0 with return false. NFC.
Chad Rosier [Wed, 23 Mar 2016 20:07:28 +0000 (20:07 +0000)]
[AArch64] Replace return 0 with return false. NFC.

llvm-svn: 264185

8 years agoMake sure to perform dependent access checks when instantiating a
Richard Smith [Wed, 23 Mar 2016 20:07:07 +0000 (20:07 +0000)]
Make sure to perform dependent access checks when instantiating a
lambda-expression. We don't actually instantiate the closure type / operator()
in the template in order to produce the closure type / operator() in the
instantiation, so this isn't caught by the normal path.

llvm-svn: 264184

8 years agoCodegen: [PPC] Word Rotates are Zero Extending.
Kyle Butt [Wed, 23 Mar 2016 19:51:22 +0000 (19:51 +0000)]
Codegen: [PPC] Word Rotates are Zero Extending.

Add Word rotates to the list of instructions that are zero extending.
This allows them to be used in dot form to compare with zero.

llvm-svn: 264183

8 years agoclang-cl: Fix remaining bugs in interaction of /Yc and /FI /showIncludes.
Nico Weber [Wed, 23 Mar 2016 18:46:57 +0000 (18:46 +0000)]
clang-cl: Fix remaining bugs in interaction of /Yc and /FI /showIncludes.

Instead of putting the /Yc header into ExtraDeps, give DependencyOutputOptions
a dedicated field for /Yc mode, and let HeaderIncludesCallback hang on to the
full DependencyOutputOptions object, not just ExtraDeps.

Reverts parts of r263352 that are now no longer needed.

llvm-svn: 264182

8 years ago[LTO] Keep linkonce symbols when required.
Davide Italiano [Wed, 23 Mar 2016 18:41:48 +0000 (18:41 +0000)]
[LTO] Keep linkonce symbols when required.

Similarly to how we do with linkonce_odr symbols already, but
change their linkage to weak.

llvm-svn: 264181

8 years agoFix bugs in the MemorySSA walker.
George Burgess IV [Wed, 23 Mar 2016 18:31:55 +0000 (18:31 +0000)]
Fix bugs in the MemorySSA walker.

There are a few bugs in the walker that this patch addresses.
Primarily:
- Caching can break when we have multiple BBs without phis
- We weren't optimizing some phis properly
- Because of how the DFS iterator works, there were times where we
  wouldn't cache any results of our DFS

I left the test cases with FIXMEs in, because I'm not sure how much
effort it will take to get those to work (read: We'll probably
ultimately have to end up redoing the walker, or we'll have to come up
with some creative caching tricks), and more test coverage = better.

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

llvm-svn: 264180

8 years agoAdd getBlockProfileCount method to BlockFrequencyInfo
Easwaran Raman [Wed, 23 Mar 2016 18:18:26 +0000 (18:18 +0000)]
Add getBlockProfileCount method to BlockFrequencyInfo

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

llvm-svn: 264179

8 years agoclang-cl: Add more tests for the interaction of /FI and /Yc /Yu.
Nico Weber [Wed, 23 Mar 2016 18:17:02 +0000 (18:17 +0000)]
clang-cl: Add more tests for the interaction of /FI and /Yc /Yu.

Most things even work; see the included FIXMEs for things that need polishing.

Also don't warn about unused flags for the `/Yuh2.h /FIh1.h /FIh2.h`.  The
common case is that the pch was built with `/Ych2.h /FIh1.h /FIh2.h`, so h1.h
is in the PCH, and we shouldn't warn about /FIh1.h not having an effect.
(If we wanted to get fancy, we could store the list of -include flags in the
pch and then check that it matches later on.)

llvm-svn: 264178

8 years agoSelectionDAG: Remove a tautological dyn_cast. NFC
Justin Bogner [Wed, 23 Mar 2016 18:15:33 +0000 (18:15 +0000)]
SelectionDAG: Remove a tautological dyn_cast. NFC

Index is already a StoreSDNode, so this dyn_cast doesn't do anything.

llvm-svn: 264177

8 years ago[LTO/Tests] Fix typo. Visibility -> Linkage. Pointy-hat to me.
Davide Italiano [Wed, 23 Mar 2016 18:15:06 +0000 (18:15 +0000)]
[LTO/Tests] Fix typo. Visibility -> Linkage. Pointy-hat to me.

llvm-svn: 264176

8 years ago[LTO/tests] Check optimized bitcode instead of produced shared library.
Davide Italiano [Wed, 23 Mar 2016 18:13:32 +0000 (18:13 +0000)]
[LTO/tests] Check optimized bitcode instead of produced shared library.

As requested by Rafael.

llvm-svn: 264175

8 years agoclang-cl: Include /FI headers in /showIncludes output.
Nico Weber [Wed, 23 Mar 2016 18:00:22 +0000 (18:00 +0000)]
clang-cl: Include /FI headers in /showIncludes output.

-H in gcc mode doesn't print -include headers, but they are included in
depfiles written by MMD and friends. Since /showIncludes is what's used instead
of depfiles, printing /FI there seems important (and matches cl.exe).

Instead of giving HeaderIncludeGen more options, just switch on ShowAllHeaders
in clang-cl mode and let clang::InitializePreprocessor() not put -include flags
in the <command line> block. This changes the behavior of -E slightly, and it
removes the <command line> flag from the output triggered by setting the
obscure CC_PRINT_HEADERS=1 env var to true while running clang. Both of these
seem ok to change.

http://reviews.llvm.org/D18401

llvm-svn: 264174

8 years agoImplement ObjectFilePECOFF::GetEntryPointAddress.
Stephane Sezer [Wed, 23 Mar 2016 18:00:13 +0000 (18:00 +0000)]
Implement ObjectFilePECOFF::GetEntryPointAddress.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 264173

8 years agoCopy MachO struct to temporary to avoid unaligned load UB.
Pete Cooper [Wed, 23 Mar 2016 18:00:10 +0000 (18:00 +0000)]
Copy MachO struct to temporary to avoid unaligned load UB.

We were already copying this data to a temporary for endian swaps.  Now
we just always copy it, but still only do the endian swaps when needed.

llvm-svn: 264172

8 years ago[LTO] Only change linkage if we keep the symbol.
Davide Italiano [Wed, 23 Mar 2016 17:59:07 +0000 (17:59 +0000)]
[LTO] Only change linkage if we keep the symbol.

llvm-svn: 264171

8 years ago[NFC] Delete an unused function parameter from a static function
Faisal Vali [Wed, 23 Mar 2016 17:39:51 +0000 (17:39 +0000)]
[NFC] Delete an unused function parameter from a static function

llvm-svn: 264170

8 years agoVisualize fields of records as they were declared in Visual Studio debugger
Mike Spertus [Wed, 23 Mar 2016 17:29:42 +0000 (17:29 +0000)]
Visualize fields of records as they were declared in Visual Studio debugger

llvm-svn: 264169

8 years agoFollow-up for r264162 to fix the CMake build (update LLDBDependencies.cmake).
Kuba Brecka [Wed, 23 Mar 2016 16:54:23 +0000 (16:54 +0000)]
Follow-up for r264162 to fix the CMake build (update LLDBDependencies.cmake).

llvm-svn: 264168

8 years agoObjC: Handle boolean fixed type for enum.
Manman Ren [Wed, 23 Mar 2016 16:28:28 +0000 (16:28 +0000)]
ObjC: Handle boolean fixed type for enum.

Before this commit, we assert failure in ImplicitCastExpr
"unheralded conversion to bool". This commit fixes the assertion by using
the correct cast type when the fixed type is boolean.

This commit also fixes the behavior for Microsoft mode as well, since
Obj-C and Microsoft mode share the same code path.

rdar://24999533

llvm-svn: 264167

8 years agoFix Visual Studio builds
Jonathan Peyton [Wed, 23 Mar 2016 16:27:25 +0000 (16:27 +0000)]
Fix Visual Studio builds

Have Visual Studio use MemoryBarrier() instead of _mm_mfence() and remove
__declspec align attribute from function parameters in kmp_atomic.h

llvm-svn: 264166

8 years agoReplace a string comparison in ARMSubtarget.h with a tablegen entry in ARM.td (NFC)
Artyom Skrobov [Wed, 23 Mar 2016 16:18:13 +0000 (16:18 +0000)]
Replace a string comparison in ARMSubtarget.h with a tablegen entry in ARM.td (NFC)

Reviewers: rengolin, t.p.northover

Subscribers: aemerson, llvm-commits, rengolin

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

llvm-svn: 264165

8 years ago[analyzer] Fix typo s/initalize/initialize/
Chih-Hung Hsieh [Wed, 23 Mar 2016 16:14:12 +0000 (16:14 +0000)]
[analyzer] Fix typo s/initalize/initialize/

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

llvm-svn: 264164

8 years agoclang-cl: Don't warn about /Oy- being unused in 64-bit builds.
Nico Weber [Wed, 23 Mar 2016 15:37:41 +0000 (15:37 +0000)]
clang-cl: Don't warn about /Oy- being unused in 64-bit builds.

http://reviews.llvm.org/D18392

llvm-svn: 264163

8 years agoAdd ThreadSanitizer debugging support.
Kuba Brecka [Wed, 23 Mar 2016 15:36:22 +0000 (15:36 +0000)]
Add ThreadSanitizer debugging support.

This patch adds ThreadSanitizer support into LLDB:
- Adding a new InstrumentationRuntime plugin, ThreadSanitizerRuntime, in the same way ASan is implemented.
- A breakpoint stops in `__tsan_on_report`, then we extract all sorts of information by evaluating an expression. We then populate this into StopReasonExtendedInfo.
- SBThread gets a new API, SBThread::GetStopReasonExtendedBacktraces(), which returns TSan’s backtraces in the form of regular SBThreads. Non-TSan stop reasons return an empty collection.
- Added some test cases.

Reviewed by Greg Clayton.

llvm-svn: 264162

8 years ago[SCEV] Change the SCEV Predicates interfaces for conversion to AddRecExpr to return...
Silviu Baranga [Wed, 23 Mar 2016 15:29:30 +0000 (15:29 +0000)]
[SCEV] Change the SCEV Predicates interfaces for conversion to AddRecExpr to return SCEVAddRecExpr* instead of SCEV*

Summary:
This changes the conversion functions from SCEV * to SCEVAddRecExpr from
ScalarEvolution and PredicatedScalarEvolution to return a SCEVAddRecExpr*
instead of a SCEV* (which removes the need of most clients to do a
dyn_cast right after calling these functions).

We also don't add new predicates if the transformation was not successful.

This is not entirely a NFC (as it can theoretically remove some predicates
from LAA when we have an unknown dependece), but I couldn't find an obvious
regression test for it.

Reviewers: sanjoy

Subscribers: sanjoy, mzolotukhin, llvm-commits

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

llvm-svn: 264161

8 years agoNot every x86 relocation is relative.
Rafael Espindola [Wed, 23 Mar 2016 14:58:25 +0000 (14:58 +0000)]
Not every x86 relocation is relative.

Without this predicate we were not producing R_386_RELATIVE relocations.

llvm-svn: 264160

8 years agoUse an enum instead of hardcoded indices. NFC.
Alexander Kornienko [Wed, 23 Mar 2016 14:28:52 +0000 (14:28 +0000)]
Use an enum instead of hardcoded indices. NFC.

llvm-svn: 264158

8 years ago[X86] Regenerated WidenArith test
Simon Pilgrim [Wed, 23 Mar 2016 14:00:28 +0000 (14:00 +0000)]
[X86] Regenerated WidenArith test

llvm-svn: 264157

8 years ago[AArch64] Replace some uses of report_fatal_error with reportError in AArch64 ELF...
Oliver Stannard [Wed, 23 Mar 2016 13:45:03 +0000 (13:45 +0000)]
[AArch64] Replace some uses of report_fatal_error with reportError in AArch64 ELF object writer

If we can't handle a relocation type, report it as an error in the source,
rather than asserting. I've added a more descriptive message and a test for the
only cases of this that I've been able to trigger.

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

llvm-svn: 264156

8 years agoCombine identical check-prefixes in Clang test/Preprocessor/arm-target-features.c
Artyom Skrobov [Wed, 23 Mar 2016 13:32:33 +0000 (13:32 +0000)]
Combine identical check-prefixes in Clang test/Preprocessor/arm-target-features.c

Reviewers: rengolin, t.p.northover

Subscribers: aemerson, cfe-commits, rengolin

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

llvm-svn: 264155

8 years agoDrop explicit -polly-delinearize parameter
Tobias Grosser [Wed, 23 Mar 2016 13:21:02 +0000 (13:21 +0000)]
Drop explicit -polly-delinearize parameter

Delinearization is now enabled by default and does not need to explicitly need
to be enabled in our tests.

llvm-svn: 264154

8 years ago[cmake] fix libgo-llgo paths in install target
Andrew Wilkins [Wed, 23 Mar 2016 12:39:21 +0000 (12:39 +0000)]
[cmake] fix libgo-llgo paths in install target

llvm-svn: 264153

8 years agoRevert "[tsan] Disable randomized address space on linux aarch64."
Renato Golin [Wed, 23 Mar 2016 11:24:30 +0000 (11:24 +0000)]
Revert "[tsan] Disable randomized address space on linux aarch64."

This reverts commits r264068 and r264079, and they were breaking the build and
weren't reverted in time, nor they exhibited expected behaviour from the
reviewers. There is more to discuss than just a test fix.

llvm-svn: 264150

8 years ago[X86] Add "x87" in x86 target feature map.
Andrey Turetskiy [Wed, 23 Mar 2016 11:15:10 +0000 (11:15 +0000)]
[X86] Add "x87" in x86 target feature map.

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

llvm-svn: 264149

8 years ago[X86] Introduction of FeatureX87.
Andrey Turetskiy [Wed, 23 Mar 2016 11:13:54 +0000 (11:13 +0000)]
[X86] Introduction of FeatureX87.

Add FeatureX87 in X86 backend to be able to define CPUs which doesn't have x87.

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

llvm-svn: 264148

8 years ago[mips][microMIPS] Delay slot filler modifications
Hrvoje Varga [Wed, 23 Mar 2016 10:29:38 +0000 (10:29 +0000)]
[mips][microMIPS] Delay slot filler modifications
Differential Revision: http://reviews.llvm.org/D18181

llvm-svn: 264147

8 years agoAdd check for unneeded copies of locals
Haojian Wu [Wed, 23 Mar 2016 09:33:07 +0000 (09:33 +0000)]
Add check for unneeded copies of locals

Summary: Extends the UnnecessaryCopyInitialization to detect copies of local variables and parameters that are unneeded.

Patch by Matt Kulukundis!

Reviewers: alexfh, hokein

Subscribers: cfe-commits

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

llvm-svn: 264146

8 years ago[ELF][MIPS] Add comment with MIPS GOT relocations handling description. NFC.
Simon Atanasyan [Wed, 23 Mar 2016 09:28:02 +0000 (09:28 +0000)]
[ELF][MIPS] Add comment with MIPS GOT relocations handling description. NFC.

llvm-svn: 264145

8 years agowww: Drop one more </div>
Tobias Grosser [Wed, 23 Mar 2016 09:27:41 +0000 (09:27 +0000)]
www: Drop one more </div>

llvm-svn: 264144

8 years agowww: Drop polyhedral news reference.
Tobias Grosser [Wed, 23 Mar 2016 09:26:39 +0000 (09:26 +0000)]
www: Drop polyhedral news reference.

The feed2html service used has been unavailable a couple of times and always
causes the polly website to fail to load correctly.

llvm-svn: 264143

8 years agoCodegen:Do not invalidate dominator tree when bailing out during code generation
Tobias Grosser [Wed, 23 Mar 2016 06:57:51 +0000 (06:57 +0000)]
Codegen:Do not invalidate dominator tree when bailing out during code generation

When codegenerating invariant loads in some rare cases we cannot generate code
and bail out. This change ensures that we maintain a valid dominator tree
in these situations. This fixes llvm.org/PR26736

Contributed-by: Matthias Reisinger <d412vv1n@gmail.com>
llvm-svn: 264142

8 years agoFAQ: Remove the entire Build Problems section
Justin Bogner [Wed, 23 Mar 2016 06:54:42 +0000 (06:54 +0000)]
FAQ: Remove the entire Build Problems section

This is all horribly outdated, and is mostly about the autoconf build
system that doesn't even exist anymore. These questions aren't
frequent, and these answers aren't useful.

llvm-svn: 264141

8 years agoAdd option to disallow modref function calls in scops.
Tobias Grosser [Wed, 23 Mar 2016 06:40:15 +0000 (06:40 +0000)]
Add option to disallow modref function calls in scops.

This might be useful to evaluate the benefit of us handling modref funciton
calls. Also, a new bug that was triggered by modref function calls was
recently reported http://llvm.org/PR27035. To ensure the same issue does not
cause troubles for other people, we temporarily disable this until the bug
is resolved.

llvm-svn: 264140

8 years agoFAQ: We require GCC 4.7 - nobody's asking about build failures with 3.3.2
Justin Bogner [Wed, 23 Mar 2016 06:38:53 +0000 (06:38 +0000)]
FAQ: We require GCC 4.7 - nobody's asking about build failures with 3.3.2

llvm-svn: 264139

8 years ago[docs] Fix typo in ProgrammersManual.rst
Vedant Kumar [Wed, 23 Mar 2016 05:18:50 +0000 (05:18 +0000)]
[docs] Fix typo in ProgrammersManual.rst

Patch by Miod Vallat!

llvm-svn: 264138

8 years ago[AMDGPU] Fix missing assembler predicates.
Valery Pykhtin [Wed, 23 Mar 2016 04:27:26 +0000 (04:27 +0000)]
[AMDGPU] Fix missing assembler predicates.

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

llvm-svn: 264137

8 years ago[Tests] Remove the correct files.
Davide Italiano [Wed, 23 Mar 2016 03:20:46 +0000 (03:20 +0000)]
[Tests] Remove the correct files.

llvm-svn: 264136

8 years ago[Docs] Clarify boolean conversion for Error and Expected<T> in the Programmer's
Lang Hames [Wed, 23 Mar 2016 03:18:16 +0000 (03:18 +0000)]
[Docs] Clarify boolean conversion for Error and Expected<T> in the Programmer's
Manual.

llvm-svn: 264135

8 years ago[LTO] Remove dead code.
Davide Italiano [Wed, 23 Mar 2016 02:45:53 +0000 (02:45 +0000)]
[LTO] Remove dead code.

llvm-svn: 264133

8 years ago[Sema] Allow implicit conversions of &overloaded_fn in C.
George Burgess IV [Wed, 23 Mar 2016 02:33:58 +0000 (02:33 +0000)]
[Sema] Allow implicit conversions of &overloaded_fn in C.

Also includes a minor ``enable_if`` docs update.

Currently, our address-of overload machinery will only allow implicit
conversions of overloaded functions to void* in C. For example:

```
void f(int) __attribute__((overloadable));
void f(double) __attribute__((overloadable, enable_if(0, "")));

void *fp = f; // OK. This is C and the target is void*.
void (*fp2)(void) = f; // Error. This is C, but the target isn't void*.
```

This patch makes the assignment of `fp2` select the `f(int)` overload,
rather than emitting an error (N.B. you'll still get a warning about the
`fp2` assignment if you use -Wincompatible-pointer-types).

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

llvm-svn: 264132

8 years agoRemove stale comment
Sanjoy Das [Wed, 23 Mar 2016 02:28:35 +0000 (02:28 +0000)]
Remove stale comment

llvm-svn: 264131

8 years ago[StatepointLowering] Don't do two DenseMap lookups; nfci
Sanjoy Das [Wed, 23 Mar 2016 02:24:15 +0000 (02:24 +0000)]
[StatepointLowering] Don't do two DenseMap lookups; nfci

llvm-svn: 264130

8 years ago[StatepointLowering] Minor NFC cleanups
Sanjoy Das [Wed, 23 Mar 2016 02:24:13 +0000 (02:24 +0000)]
[StatepointLowering] Minor NFC cleanups

 - Use auto
 - Name variables in LLVM style
 - Use llvm::find instead of std::find
 - Blank lines between declarations

llvm-svn: 264129

8 years ago[StatepointLowering] Minor nfc refactoring
Sanjoy Das [Wed, 23 Mar 2016 02:24:10 +0000 (02:24 +0000)]
[StatepointLowering] Minor nfc refactoring

Now that StatepointLoweringInfo represents base pointers, derived
pointers and gc relocates as SmallVectors and not ArrayRefs, we no
longer need to allocate "backing storage" on stack in LowerStatepoint.
So elide the backing storage, and inline the trivial body of
getIncomingStatepointGCValues.

llvm-svn: 264128

8 years ago[StatepointLowering] Schedule gc relocates before uniqueing them
Sanjoy Das [Wed, 23 Mar 2016 02:24:07 +0000 (02:24 +0000)]
[StatepointLowering] Schedule gc relocates before uniqueing them

Otherwise we can see an "unexpected" gc.relocate that we uniqued away.

llvm-svn: 264127

8 years agoAMDGPU: Cache information about register pressure sets
Tom Stellard [Wed, 23 Mar 2016 01:53:22 +0000 (01:53 +0000)]
AMDGPU: Cache information about register pressure sets

We can statically decide whether or not a register pressure set is for
SGPRs or VGPRs, so we don't need to re-compute this information in
SIRegisterInfo::getRegPressureSetLimit().

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

llvm-svn: 264126

8 years ago[Apple Clang] Expose llvm-config from stage2 builds in stage1
Chris Bieneman [Wed, 23 Mar 2016 01:47:05 +0000 (01:47 +0000)]
[Apple Clang] Expose llvm-config from stage2 builds in stage1

This exposes the stage2-llvm-config target though the stage1 build configuration.

llvm-svn: 264125

8 years agoMinor code cleanup. NFC.
Junmo Park [Wed, 23 Mar 2016 01:38:35 +0000 (01:38 +0000)]
Minor code cleanup. NFC.

llvm-svn: 264124

8 years agoChange 'apropos' such that it doesn't look into the "long help/syntax" strings for...
Enrico Granata [Wed, 23 Mar 2016 01:21:55 +0000 (01:21 +0000)]
Change 'apropos' such that it doesn't look into the "long help/syntax" strings for commands

This solves issues such as 'apropos foo' returning valid matches just because syntax examples happen to use 'foo' as a placeholder token

Fixes rdar://9043025

llvm-svn: 264123

8 years ago[ModuleUtils] Use range-based loop. NFC.
Davide Italiano [Wed, 23 Mar 2016 00:43:35 +0000 (00:43 +0000)]
[ModuleUtils] Use range-based loop. NFC.

llvm-svn: 264122

8 years ago[docs] Use reST link.
Sean Silva [Wed, 23 Mar 2016 00:31:21 +0000 (00:31 +0000)]
[docs] Use reST link.

llvm-svn: 264121

8 years agoBring back Makefile.sphinx
Sean Silva [Wed, 23 Mar 2016 00:30:57 +0000 (00:30 +0000)]
Bring back Makefile.sphinx

It is not part of autoconf and should not have been removed in r258861.

llvm-svn: 264120

8 years ago[docs] Clarify the sense of --compile-command
Sean Silva [Wed, 23 Mar 2016 00:25:13 +0000 (00:25 +0000)]
[docs] Clarify the sense of --compile-command

In retrospect, it seems "obvious" that the sense of the return code is
the same as if it crashed on "interesting" inputs. But that didn't stop
me from spending more time than I care to admit verifying this.

llvm-svn: 264119

8 years ago[ScopInfo] Fix domains after loops.
Michael Kruse [Tue, 22 Mar 2016 23:27:42 +0000 (23:27 +0000)]
[ScopInfo] Fix domains after loops.

ISL can conclude additional conditions on parameters from restrictions
on loop variables. Such conditions persist when leaving the loop and the
loop variable is projected out. This results in a narrower domain for
exiting the loop than entering it and is logically impossible for
non-infinite loops.

We fix this by not adding a lower bound i>=0 when constructing BB
domains, but defer it to when also the upper bound it computed, which
was done redundantly even before this patch.

This reduces the number of LNT fails with -polly-process-unprofitable
-polly-position=before-vectorizer from 8 to 6.

llvm-svn: 264118

8 years agoTidy up this test a bit.
Sean Silva [Tue, 22 Mar 2016 23:19:40 +0000 (23:19 +0000)]
Tidy up this test a bit.

llvm-svn: 264117