platform/upstream/llvm.git
9 years agoFix shl folding in DAG combiner.
Pawel Bylica [Mon, 22 Jun 2015 15:58:11 +0000 (15:58 +0000)]
Fix shl folding in DAG combiner.

Summary: The code responsible for shl folding in the DAGCombiner was assuming incorrectly that all constants are less than 64 bits. This patch simply changes the way values are compared.

Test Plan: A regression test included.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: andreadb, test, llvm-commits

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

llvm-svn: 240291

9 years agoRe-enable Visual Studio Builds.
Jonathan Peyton [Mon, 22 Jun 2015 15:53:50 +0000 (15:53 +0000)]
Re-enable Visual Studio Builds.

I tried to compile with Visual Studio using CMake and found these two sections of code
causing problems for Visual Studio.  The first one removes the use of variable length
arrays by instead using KMP_ALLOCA().  The second part eliminates a redundant cpuid
assembly call by using the already existing __kmp_x86_cpuid() call instead.

llvm-svn: 240290

9 years agoAdd a triple to the test to fix it on some hosts.
Rafael Espindola [Mon, 22 Jun 2015 15:44:20 +0000 (15:44 +0000)]
Add a triple to the test to fix it on some hosts.

The slp vectorizer doesn't optimize this case in 32 bits.

Fixes PR23453.

llvm-svn: 240289

9 years ago[ORC] Add NullResolver
Joseph Tremoulet [Mon, 22 Jun 2015 15:27:58 +0000 (15:27 +0000)]
[ORC] Add NullResolver

Summary:
This is an implementation of RuntimeDyld::SymbolResolver that simply
rejects all resolution requests; useful for clients that do not have any
cross-object symbol references.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

llvm-svn: 240288

9 years agoSupport Solaris unused sections' gc link syntax.
Rafael Espindola [Mon, 22 Jun 2015 15:06:17 +0000 (15:06 +0000)]
Support Solaris unused sections' gc link syntax.

It is not clear if this would work or not with LLVM_NO_DEAD_STRIP
binaries, so be conservative for now.

Patch by Xan López.

llvm-svn: 240287

9 years agoMake seeking on an ostream that has eofbit set work correctly. Fixes PR#21361
Marshall Clow [Mon, 22 Jun 2015 15:01:21 +0000 (15:01 +0000)]
Make seeking on an ostream that has eofbit set work correctly. Fixes PR#21361

llvm-svn: 240286

9 years agoTest Commit
Jaydeep Patil [Mon, 22 Jun 2015 13:58:30 +0000 (13:58 +0000)]
Test Commit

llvm-svn: 240280

9 years agoDon't use &* when get() will suffice; NFC.
Aaron Ballman [Mon, 22 Jun 2015 13:28:21 +0000 (13:28 +0000)]
Don't use &* when get() will suffice; NFC.

llvm-svn: 240279

9 years ago[mips] [IAS] Add support for LAReg with identical source and destination register...
Toma Tabacu [Mon, 22 Jun 2015 13:10:23 +0000 (13:10 +0000)]
[mips] [IAS] Add support for LAReg with identical source and destination register operands.

Summary: In this case, we're supposed to load the immediate in AT and then ADDu it with the source register and put it in the destination register.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240278

9 years agoAVX-512: added VPSHUFB instruction - all SKX forms
Elena Demikhovsky [Mon, 22 Jun 2015 13:00:42 +0000 (13:00 +0000)]
AVX-512: added VPSHUFB instruction - all SKX forms
Added intrinsics and encoding tests.

llvm-svn: 240277

9 years agoDo not pass optimization flags to Solaris' linker.
Rafael Espindola [Mon, 22 Jun 2015 12:41:52 +0000 (12:41 +0000)]
Do not pass optimization flags to Solaris' linker.

It is not supported.

Patch by Xan López.

llvm-svn: 240276

9 years agoUse right syntax to pass version script to Solaris' ld.
Rafael Espindola [Mon, 22 Jun 2015 12:34:54 +0000 (12:34 +0000)]
Use right syntax to pass version script to Solaris' ld.

Patch by Xan Lopez!

llvm-svn: 240275

9 years ago[mips] [IAS] Add support for LASym with identical source and destination register...
Toma Tabacu [Mon, 22 Jun 2015 12:08:39 +0000 (12:08 +0000)]
[mips] [IAS] Add support for LASym with identical source and destination register operands.

Summary:
In this case, we're supposed to load the address of the symbol in AT and then ADDu it with the source register and
put it in the destination register.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240273

9 years agoAVX-512: All forms of VCOPMRESS VEXPAND instructions,
Elena Demikhovsky [Mon, 22 Jun 2015 11:16:30 +0000 (11:16 +0000)]
AVX-512: All forms of VCOPMRESS VEXPAND instructions,
encoding tests.

llvm-svn: 240272

9 years agoFixed/added namespace ending comments using clang-tidy. NFC
Alexander Kornienko [Mon, 22 Jun 2015 09:57:54 +0000 (09:57 +0000)]
Fixed/added namespace ending comments using clang-tidy. NFC

A few more files that were fixed while preparing r240270.

llvm-svn: 240271

9 years agoFixed/added namespace ending comments using clang-tidy. NFC
Alexander Kornienko [Mon, 22 Jun 2015 09:47:44 +0000 (09:47 +0000)]
Fixed/added namespace ending comments using clang-tidy. NFC

The patch is generated using this command:

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

To reduce churn, not touching namespaces spanning less than 10 lines.

llvm-svn: 240270

9 years agoRemoving empty directories.
Alexander Kornienko [Mon, 22 Jun 2015 09:34:18 +0000 (09:34 +0000)]
Removing empty directories.

llvm-svn: 240269

9 years ago[Mips] Support R_MICROMIPS_HI0_LO16 relocation handling
Simon Atanasyan [Mon, 22 Jun 2015 09:27:05 +0000 (09:27 +0000)]
[Mips] Support R_MICROMIPS_HI0_LO16 relocation handling

llvm-svn: 240268

9 years ago[Mips] Support R_MICROMIPS_LITERAL relocation handling
Simon Atanasyan [Mon, 22 Jun 2015 09:26:57 +0000 (09:26 +0000)]
[Mips] Support R_MICROMIPS_LITERAL relocation handling

llvm-svn: 240267

9 years ago[Mips] Support R_MIPS_LITERAL relocation handling
Simon Atanasyan [Mon, 22 Jun 2015 09:26:48 +0000 (09:26 +0000)]
[Mips] Support R_MIPS_LITERAL relocation handling

llvm-svn: 240266

9 years ago[Mips] Support R_MICROMIPS_SUB relocation handling
Simon Atanasyan [Mon, 22 Jun 2015 09:26:41 +0000 (09:26 +0000)]
[Mips] Support R_MICROMIPS_SUB relocation handling

llvm-svn: 240265

9 years ago[Mips] Reject R_MIPS_GPREL32 against external symbols
Simon Atanasyan [Mon, 22 Jun 2015 09:26:33 +0000 (09:26 +0000)]
[Mips] Reject R_MIPS_GPREL32 against external symbols

llvm-svn: 240264

9 years ago[Mips] Fix test case - do not use R_MIPS_GPREL32 against external symbols
Simon Atanasyan [Mon, 22 Jun 2015 09:26:25 +0000 (09:26 +0000)]
[Mips] Fix test case - do not use R_MIPS_GPREL32 against external symbols

No functional changes.

llvm-svn: 240263

9 years ago[Mips] Reject position-dependent relocations in case of shared library linking
Simon Atanasyan [Mon, 22 Jun 2015 09:26:20 +0000 (09:26 +0000)]
[Mips] Reject position-dependent relocations in case of shared library linking

llvm-svn: 240262

9 years ago[Mips] Fix test case - do not use R_MIPS_HI16 for shared library linking
Simon Atanasyan [Mon, 22 Jun 2015 09:26:12 +0000 (09:26 +0000)]
[Mips] Fix test case - do not use R_MIPS_HI16 for shared library linking

No functional changes.

llvm-svn: 240261

9 years ago[Mips] Support R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations handling
Simon Atanasyan [Mon, 22 Jun 2015 09:26:05 +0000 (09:26 +0000)]
[Mips] Support R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations handling

llvm-svn: 240260

9 years ago[Mips] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations handling
Simon Atanasyan [Mon, 22 Jun 2015 09:25:57 +0000 (09:25 +0000)]
[Mips] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations handling

llvm-svn: 240259

9 years agoReverted AVX-512 vector shuffle
Elena Demikhovsky [Mon, 22 Jun 2015 09:01:15 +0000 (09:01 +0000)]
Reverted AVX-512 vector shuffle

llvm-svn: 240258

9 years ago[X86] Allow more call sequences to use push instructions for argument passing
Michael Kuperstein [Mon, 22 Jun 2015 08:31:22 +0000 (08:31 +0000)]
[X86] Allow more call sequences to use push instructions for argument passing

This allows more call sequences to use pushes instead of movs when optimizing for size.
In particular, calling conventions that pass some parameters in registers (e.g. thiscall) are now supported.

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

llvm-svn: 240257

9 years agoAVX-512: Added intrinsics for VPERMT2W/D/Q/PS/PD and
Elena Demikhovsky [Mon, 22 Jun 2015 06:45:48 +0000 (06:45 +0000)]
AVX-512: Added intrinsics for VPERMT2W/D/Q/PS/PD and
VPERMI2W/D/Q/PS/PD instructions.
Added tests.

llvm-svn: 240256

9 years ago[PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class.
Chandler Carruth [Mon, 22 Jun 2015 02:16:51 +0000 (02:16 +0000)]
[PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class.

This will allow classes to implement the AA interface without deriving
from the class or referencing an internal enum of some other class as
their return types.

Also, to a pretty fundamental extent, concepts such as 'NoAlias',
'MayAlias', and 'MustAlias' are first class concepts in LLVM and we
aren't saving anything by scoping them heavily.

My mild preference would have been to use a scoped enum, but that
feature is essentially completely broken AFAICT. I'm extremely
disappointed. For example, we cannot through any reasonable[1] means
construct an enum class (or analog) which has scoped names but converts
to a boolean in order to test for the possibility of aliasing.

[1]: Richard Smith came up with a "solution", but it requires class
templates, and lots of boilerplate setting up the enumeration multiple
times. Something like Boost.PP could potentially bundle this up, but
even that would be quite painful and it doesn't seem realistically worth
it. The enum class solution would probably work without the need for
a bool conversion.

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

llvm-svn: 240255

9 years ago[PM/AA] Rework the names and comments in AliasSetTracker to more
Chandler Carruth [Mon, 22 Jun 2015 02:12:52 +0000 (02:12 +0000)]
[PM/AA] Rework the names and comments in AliasSetTracker to more
accurately describe what is being tracked.

While these two enums do track mod/ref information and aliasing
information, they don't represent the exact same things as either the
mod/ref enums or the alias result enum in AA. They're definitions are
dominated by the structure of their lattice and the bit's various
semantics. This patch just calls them what they are and tries to spell
out usefully distinct names for these things.

This will clear the path for using a raw unscoped enum to represent some
of these concepts across LLVM's analysis library.

No functionality changed here.

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

llvm-svn: 240254

9 years agoAdd the testcase from pr23900.
Rafael Espindola [Mon, 22 Jun 2015 01:29:24 +0000 (01:29 +0000)]
Add the testcase from pr23900.

llvm-svn: 240253

9 years agoRemove incomplete comment.
Davide Italiano [Mon, 22 Jun 2015 01:19:59 +0000 (01:19 +0000)]
Remove incomplete comment.

llvm-svn: 240252

9 years agoSema: add a helper for enumerating the TST id (NFC)
Saleem Abdulrasool [Sun, 21 Jun 2015 23:05:52 +0000 (23:05 +0000)]
Sema: add a helper for enumerating the TST id (NFC)

The same pattern was repeated a few times.  Create a trivial helper method to
map the Type Specifier to an ID for the diagnostic.  Flip the selection order on
one of the diagnostic messages to get the same ordering across all of the
messages.  This makes the emission of the diagnostic slightly more legible by
changing the cascading ternary into a switch in a function.  NFC.

llvm-svn: 240251

9 years agoCOFF: Support delay-load import tables.
Rui Ueyama [Sun, 21 Jun 2015 22:31:52 +0000 (22:31 +0000)]
COFF: Support delay-load import tables.

DLLs are usually resolved at process startup, but you can
delay-load them by passing /delayload option to the linker.

If a /delayload is specified, the linker has to create data
which is similar to regular import table.
One notable difference is that the pointers in a delay-load
import table are originally pointing to thunks that resolves
themselves. Each thunk loads a DLL, resolve its name, and then
overwrites the pointer with the result so that subsequent
function calls directly call a desired function. The linker
has to emit thunks.

llvm-svn: 240250

9 years ago[X86] Code tidyup - Use SDValue bool operator. NFC.
Simon Pilgrim [Sun, 21 Jun 2015 21:34:32 +0000 (21:34 +0000)]
[X86] Code tidyup - Use SDValue bool operator. NFC.

llvm-svn: 240249

9 years agoClean up CLCompatOptions.td a bit.
Nico Weber [Sun, 21 Jun 2015 20:49:05 +0000 (20:49 +0000)]
Clean up CLCompatOptions.td a bit.

Move /Qvec flags from the "// Non-aliases:" section up to the "// Aliases:"
section since the flags are just aliases.  For the same reason, move the
/vm flags the other way.  Also reflow a few lines to 80 columns.

No behavior change.

llvm-svn: 240248

9 years agoASTReader: Treat InputFileOffsets as unaligned to avoid UB
Justin Bogner [Sun, 21 Jun 2015 20:32:40 +0000 (20:32 +0000)]
ASTReader: Treat InputFileOffsets as unaligned to avoid UB

This is a better approach to fixing the undefined behaviour I tried to
fix in r240228. This data doesn't necessarily have suitable alignment
for uint64_t, so use unaligned_uint64_t instead.

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

llvm-svn: 240247

9 years agoRevert "ASTReader: Copy input file offset data to avoid unaligned accesses"
Justin Bogner [Sun, 21 Jun 2015 20:32:36 +0000 (20:32 +0000)]
Revert "ASTReader: Copy input file offset data to avoid unaligned accesses"

We can do this better by changing the type to unaligned_uint64_t and
paying the cost on use instead of up front.

This reverts r240228

llvm-svn: 240246

9 years agoSema: convert decl + while loop into for loop (NFC)
Saleem Abdulrasool [Sun, 21 Jun 2015 18:20:01 +0000 (18:20 +0000)]
Sema: convert decl + while loop into for loop (NFC)

Convert a hand rolled for loop into an explicit for loop.  NFC.

llvm-svn: 240245

9 years agoAsmPrinter: Don't emit empty .debug_loc entries
Duncan P. N. Exon Smith [Sun, 21 Jun 2015 16:54:56 +0000 (16:54 +0000)]
AsmPrinter: Don't emit empty .debug_loc entries

If we don't know how to represent a .debug_loc entry, skip the entry
entirely rather than emitting an empty one.  Similarly, if a .debug_loc
list has no entries, don't create the list.

We still want to create the variables, just in an optimized-out form
that doesn't have a DW_AT_location.

llvm-svn: 240244

9 years agoAsmPrinter: Rewrite initialization of DbgVariable, NFC
Duncan P. N. Exon Smith [Sun, 21 Jun 2015 16:50:43 +0000 (16:50 +0000)]
AsmPrinter: Rewrite initialization of DbgVariable, NFC

There are three types of `DbgVariable`:
  - alloca variables, created based on the MMI table,
  - register variables, created based on DBG_VALUE instructions, and
  - optimized-out variables.

This commit reconfigures `DbgVariable` to make it easier to tell which
kind we have, and make initialization a little clearer.

For MMI/alloca variables, `FrameIndex.size()` must always equal
`Expr.size()`, and there shouldn't be an `MInsn`.  For register
variables (with a `MInsn`), `FrameIndex` must be empty, and `Expr`
should have 0 or 1 element depending on whether it has a complex
expression (registers with multiple locations use `DebugLocListIndex`).
Optimized-out variables shouldn't have any of these fields.

Moreover, this separates DBG_VALUE initialization until after the
variable is created, simplifying logic in a future commit that changes
`collectVariableInfo()` to stop creating empty .debug_loc entries/lists.

llvm-svn: 240243

9 years ago[Codegen] Don't crash if destructor is not accessible.
Davide Italiano [Sun, 21 Jun 2015 16:33:50 +0000 (16:33 +0000)]
[Codegen] Don't crash if destructor is not accessible.

Testcase provided, in the PR, by Christian Shelton and
reduced by David Majnemer.

PR: 23584
Differential Revision: http://reviews.llvm.org/D10508
Reviewed by: rnk

llvm-svn: 240242

9 years ago[X86][SSE] Added missing stack folding test for CVTSD2SS instruction.
Simon Pilgrim [Sun, 21 Jun 2015 16:07:47 +0000 (16:07 +0000)]
[X86][SSE] Added missing stack folding test for CVTSD2SS instruction.

llvm-svn: 240241

9 years agoOptTable.h: Prune a couple of \param(s), since Arg has been ArrayRef-ized. [-Wdocumen...
NAKAMURA Takumi [Sun, 21 Jun 2015 13:44:46 +0000 (13:44 +0000)]
OptTable.h: Prune a couple of \param(s), since Arg has been ArrayRef-ized. [-Wdocumentation]

llvm-svn: 240240

9 years agoUpdate for ParseARgs ArrayRef-ification
David Blaikie [Sun, 21 Jun 2015 06:58:19 +0000 (06:58 +0000)]
Update for ParseARgs ArrayRef-ification

llvm-svn: 240239

9 years agoDevirtualize ArgList's dtor now that -Wvirtual-dtor and C++11 allow a better way...
David Blaikie [Sun, 21 Jun 2015 06:51:35 +0000 (06:51 +0000)]
Devirtualize ArgList's dtor now that -Wvirtual-dtor and C++11 allow a better way to describe this situation

llvm-svn: 240238

9 years agoArrayRef-ify ParseArgs
David Blaikie [Sun, 21 Jun 2015 06:32:36 +0000 (06:32 +0000)]
ArrayRef-ify ParseArgs

llvm-svn: 240237

9 years agoArrayRef-ify Driver::parse and related functions.
David Blaikie [Sun, 21 Jun 2015 06:32:10 +0000 (06:32 +0000)]
ArrayRef-ify Driver::parse and related functions.

llvm-svn: 240236

9 years agoArrayRef-ify ParseArgs
David Blaikie [Sun, 21 Jun 2015 06:32:04 +0000 (06:32 +0000)]
ArrayRef-ify ParseArgs

llvm-svn: 240235

9 years agoArrayRef-ify libDriverMain
David Blaikie [Sun, 21 Jun 2015 06:31:56 +0000 (06:31 +0000)]
ArrayRef-ify libDriverMain

llvm-svn: 240234

9 years agoArrayRef-ify ParseArgs
David Blaikie [Sun, 21 Jun 2015 06:31:53 +0000 (06:31 +0000)]
ArrayRef-ify ParseArgs

llvm-svn: 240233

9 years agoCOFF: Use short varaible name. NFC.
Rui Ueyama [Sun, 21 Jun 2015 04:10:54 +0000 (04:10 +0000)]
COFF: Use short varaible name. NFC.

llvm-svn: 240232

9 years agoCOFF: Support exception table.
Rui Ueyama [Sun, 21 Jun 2015 04:00:54 +0000 (04:00 +0000)]
COFF: Support exception table.

.pdata section contains a list of triplets of function start address,
function end address and its unwind information. Linkers have to
sort section contents by function start address and set the section
address to the file header (so that runtime is able to find it and
do binary search.)

This change seems to resolve all but one remaining test failures in
check{,-clang,-lld} when building the entire stuff with clang-cl and
lld-link.

llvm-svn: 240231

9 years agoObject: Add load configuration structure for 64 bit PE/COFF.
Rui Ueyama [Sun, 21 Jun 2015 01:12:32 +0000 (01:12 +0000)]
Object: Add load configuration structure for 64 bit PE/COFF.

llvm-svn: 240230

9 years agoCOFF: Combine add{Object,Archive,Bitcode,Import} functions. NFC.
Rui Ueyama [Sat, 20 Jun 2015 23:10:05 +0000 (23:10 +0000)]
COFF: Combine add{Object,Archive,Bitcode,Import} functions. NFC.

llvm-svn: 240229

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