platform/upstream/llvm.git
9 years agoCOFF: Simplify SymbolBody::compare(SymbolBody *Other).
Rui Ueyama [Mon, 15 Jun 2015 19:06:53 +0000 (19:06 +0000)]
COFF: Simplify SymbolBody::compare(SymbolBody *Other).

We are currently handling all combinations of SymbolBody types directly.
This patch is to flip this and Other if Other->kind() < this->kind()
to reduce number of combinations. No functionality change intended.

llvm-svn: 239745

9 years ago[Hexagon] Moving pass declarations out of header and in to implementation files....
Colin LeMahieu [Mon, 15 Jun 2015 19:05:35 +0000 (19:05 +0000)]
[Hexagon] Moving pass declarations out of header and in to implementation files.  Removing unused function getSubtargetInfo from HexagonMCCodeEmitter.cpp  Removing deletion of copy construction and assignment operator since parent already deletes it.

llvm-svn: 239744

9 years ago[CodeGen] Add a pass to fold null checks into nearby memory operations.
Sanjoy Das [Mon, 15 Jun 2015 18:44:27 +0000 (18:44 +0000)]
[CodeGen] Add a pass to fold null checks into nearby memory operations.

Summary:
This change adds an "ImplicitNullChecks" target dependent pass.  This
pass folds null checks into memory operation using the FAULTING_LOAD
pseudo-op introduced in previous patches.

Depends on D10197
Depends on D10199
Depends on D10200

Reviewers: reames, rnk, pgavlin, JosephTremoulet, atrick

Reviewed By: atrick

Subscribers: ab, JosephTremoulet, llvm-commits

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

llvm-svn: 239743

9 years ago[TargetInstrInfo] Add new hook: AnalyzeBranchPredicate.
Sanjoy Das [Mon, 15 Jun 2015 18:44:21 +0000 (18:44 +0000)]
[TargetInstrInfo] Add new hook: AnalyzeBranchPredicate.

Summary:
NFC: no one uses AnalyzeBranchPredicate yet.

Add TargetInstrInfo::AnalyzeBranchPredicate and implement for x86.  A
later change adding support for page-fault based implicit null checks
depends on this.

Reviewers: reames, ab, atrick

Reviewed By: atrick

Subscribers: llvm-commits

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

llvm-svn: 239742

9 years ago[TargetInstrInfo] Rename getLdStBaseRegImmOfs and implement for x86.
Sanjoy Das [Mon, 15 Jun 2015 18:44:14 +0000 (18:44 +0000)]
[TargetInstrInfo] Rename getLdStBaseRegImmOfs and implement for x86.

Summary:

TargetInstrInfo::getLdStBaseRegImmOfs to
TargetInstrInfo::getMemOpBaseRegImmOfs and implement for x86.  The
implementation only handles a few easy cases now and will be made more
sophisticated in the future.

This is NFCI: the only user of `getLdStBaseRegImmOfs` (now
`getmemOpBaseRegImmOfs`) is `LoadClusterMotion` and `LoadClusterMotion`
is disabled for x86.

Reviewers: reames, ab, MatzeB, atrick

Reviewed By: MatzeB, atrick

Subscribers: llvm-commits

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

llvm-svn: 239741

9 years ago[CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op.
Sanjoy Das [Mon, 15 Jun 2015 18:44:08 +0000 (18:44 +0000)]
[CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op.

Summary:
This instruction encodes a loading operation that may fault, and a label
to branch to if the load page-faults.  The locations of potentially
faulting loads and their "handler" destinations are recorded in a
FaultMap section, meant to be consumed by LLVM's clients.

Nothing generates FAULTING_LOAD_OP instructions yet, but they will be
used in a future change.

The documentation (FaultMaps.rst) needs improvement and I will update
this diff with a more expanded version shortly.

Depends on D10196

Reviewers: rnk, reames, AndyAyers, ab, atrick, pgavlin

Reviewed By: atrick, pgavlin

Subscribers: llvm-commits

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

llvm-svn: 239740

9 years ago[NFC] Extract X86MCInstLower::LowerMachineOperand.
Sanjoy Das [Mon, 15 Jun 2015 18:44:01 +0000 (18:44 +0000)]
[NFC] Extract X86MCInstLower::LowerMachineOperand.

Summary: Refactoring-only change that will be used later.

Reviewers: reames, atrick

Reviewed By: atrick

Subscribers: llvm-commits

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

llvm-svn: 239739

9 years agoCOFF: Fix .reloc section attributes.
Rui Ueyama [Mon, 15 Jun 2015 18:03:47 +0000 (18:03 +0000)]
COFF: Fix .reloc section attributes.

llvm-svn: 239738

9 years agoThis patch implements clang support for the ACLE special register intrinsics
Luke Cheeseman [Mon, 15 Jun 2015 17:51:01 +0000 (17:51 +0000)]
This patch implements clang support for the ACLE special register intrinsics
in section 10.1, __arm_{w,r}sr{,p,64}.

This includes arm_acle.h definitions with builtins and codegen to support
these, the intrinsics are implemented by generating read/write_register calls
which get appropriately lowered in the backend based on the register string
provided. SemaChecking is also implemented to fault invalid parameters.

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

llvm-svn: 239737

9 years agoDe-duplicate common expression, NFC.
Yaron Keren [Mon, 15 Jun 2015 17:03:35 +0000 (17:03 +0000)]
De-duplicate common expression, NFC.

llvm-svn: 239736

9 years agoCOFF: Update README.
Rui Ueyama [Mon, 15 Jun 2015 16:25:11 +0000 (16:25 +0000)]
COFF: Update README.

llvm-svn: 239734

9 years agoRangify several for loops, NFC.
Yaron Keren [Mon, 15 Jun 2015 16:20:16 +0000 (16:20 +0000)]
Rangify several for loops, NFC.

llvm-svn: 239733

9 years agoOn behalf of Alexandros Lamprineas:
Evgeny Astigeevich [Mon, 15 Jun 2015 15:48:44 +0000 (15:48 +0000)]
On behalf of Alexandros Lamprineas:

LLVM targeting aarch64 doesn't correctly produce aligned accesses for non-aligned
data at -O0/fast-isel (-mno-unaligned-access).
The root cause seems to be in fast-isel not producing unaligned access correctly
for -mno-unaligned-access.

The patch just aborts fast-isel for loads and stores when -mno-unaligned-access is
present.
The regression test is updated to check this new test case (-mno-unaligned-access
together with fast-isel).

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

llvm-svn: 239732

9 years ago[LinkerTest] Use LLVMDisposeMessage to free error string.
Benjamin Kramer [Mon, 15 Jun 2015 15:42:26 +0000 (15:42 +0000)]
[LinkerTest] Use LLVMDisposeMessage to free error string.

LLVMDisposeMessage is just a thing wrapper around free at the moment, but it's
the proper API to use here.

llvm-svn: 239731

9 years agoclang-format: NFC. Move testing of selective formatting to a separate file.
Daniel Jasper [Mon, 15 Jun 2015 15:25:11 +0000 (15:25 +0000)]
clang-format: NFC. Move testing of selective formatting to a separate file.

This is a first step for splitting the huge FormatTest.cpp into separate
files to make it easier to find specific tests.

llvm-svn: 239730

9 years agoAvoid a "always true" warning from gcc.
Rafael Espindola [Mon, 15 Jun 2015 14:49:41 +0000 (14:49 +0000)]
Avoid a "always true" warning from gcc.

llvm-svn: 239729

9 years agoFix spelling in comment.
Douglas Katzman [Mon, 15 Jun 2015 13:46:40 +0000 (13:46 +0000)]
Fix spelling in comment.

llvm-svn: 239727

9 years agogold-plugin: save the .o when given -save-temps.
Rafael Espindola [Mon, 15 Jun 2015 13:36:27 +0000 (13:36 +0000)]
gold-plugin: save the .o when given -save-temps.

The plugin now save the bitcode before and after optimizations and the
.o that is passed to the linker.

llvm-svn: 239726

9 years agoOrthography: substracting -> subtracting
Michael Kruse [Mon, 15 Jun 2015 10:52:28 +0000 (10:52 +0000)]
Orthography: substracting -> subtracting

This is a test commit for being granted commit-after-approval access.

llvm-svn: 239725

9 years agoRevert r239721 - Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo...
Daniel Sanders [Mon, 15 Jun 2015 10:34:38 +0000 (10:34 +0000)]
Revert r239721 - Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.

It appears to cause sparc-little-endian.s to assert on Windows and Darwin.

llvm-svn: 239724

9 years ago[LinkerScript] Allow destruction of PHDR
Denis Protivensky [Mon, 15 Jun 2015 09:44:25 +0000 (09:44 +0000)]
[LinkerScript] Allow destruction of PHDR

This is needed for static variable defined in sources.

llvm-svn: 239723

9 years agoclang-format: [JS] Tweak behavior for multiline array initializer parameters
Daniel Jasper [Mon, 15 Jun 2015 09:23:17 +0000 (09:23 +0000)]
clang-format: [JS] Tweak behavior for multiline array initializer parameters

Before:
  var someVariable = SomeFuntion(aaaa, [
    aaaaaaaaaaaaaaaaaaaaaaaaaaa,
    bbbbbbbbbbbbbbbbbbbbbbbbbbb,
    ccccccccccccccccccccccccccc
  ],
                                 aaaa);

After:
  var someVariable = SomeFuntion(aaaa,
                                 [
                                   aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                                   bbbbbbbbbbbbbbbbbbbbbbbbbbb,
                                   ccccccccccccccccccccccccccc
                                 ],
                                 aaaa);

llvm-svn: 239722

9 years agoReplace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
Daniel Sanders [Mon, 15 Jun 2015 09:19:41 +0000 (09:19 +0000)]
Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.

Summary:
This affects other tools so the previous C++ API has been retained as a
deprecated function for the moment. Clang has been updated with a trivial
patch (not covered by the pre-commit review) to avoid breaking -Werror builds.
Other in-tree tools will be fixed with similar trivial patches.

This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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

llvm-svn: 239721

9 years ago[MachineSink] Improve runtime performance. NFC.
Arnaud A. de Grandmaison [Mon, 15 Jun 2015 09:09:06 +0000 (09:09 +0000)]
[MachineSink] Improve runtime performance. NFC.

This patch fixes a compilation time issue, when MachineSink faces PHIs
with a huge number of operands. This can happen for example in goto table
based interpreters, where some basic blocks can have several of those PHIs,
each one with several hundreds operands. MachineSink was spending a
significant time re-building and re-sorting the list of successors of
the current MachineBasicBlock. The computing and sorting of the current
MachineBasicBlock successors is now cached.

llvm-svn: 239720

9 years ago[LinkerScript] Add matching of output sections to segments
Denis Protivensky [Mon, 15 Jun 2015 08:00:51 +0000 (08:00 +0000)]
[LinkerScript] Add matching of output sections to segments

Add method to query segments for specified output section name.
Return error if the section is assigned to unknown segment.
Check matching of sections to segments during layout on the subject of correctness.
NOTE: no actual functionality of using custom segments is implemented.

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

llvm-svn: 239719

9 years ago[ValueTracking] do not overwrite analysis results already computed
Jingyue Wu [Mon, 15 Jun 2015 05:46:29 +0000 (05:46 +0000)]
[ValueTracking] do not overwrite analysis results already computed

Summary:
ValueTracking used to overwrite the analysis results computed from
assumes and dominating conditions. This patch fixes this issue.

Test Plan: test/Analysis/ValueTracking/assume.ll

Reviewers: hfinkel, majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 239718

9 years agoCOFF: Use ulittle32_t::operator|=. NFC.
Rui Ueyama [Mon, 15 Jun 2015 03:03:23 +0000 (03:03 +0000)]
COFF: Use ulittle32_t::operator|=. NFC.

llvm-svn: 239717

9 years ago[Support][Endian] Define |= and &= for u{big,little}{16,32,64}_t.
Rui Ueyama [Mon, 15 Jun 2015 03:00:15 +0000 (03:00 +0000)]
[Support][Endian] Define |= and &= for u{big,little}{16,32,64}_t.

llvm-svn: 239716

9 years ago[AArch64] Delete two empty files, which should be removed by r239713.
Hao Liu [Mon, 15 Jun 2015 02:56:40 +0000 (02:56 +0000)]
[AArch64] Delete two empty files, which should be removed by r239713.

llvm-svn: 239715

9 years agoCOFF: Add a brief description about LTO.
Rui Ueyama [Mon, 15 Jun 2015 02:46:18 +0000 (02:46 +0000)]
COFF: Add a brief description about LTO.

llvm-svn: 239714

9 years ago[AArch64] Revert r239711 again. We need to discuss how to share code between AArch64...
Hao Liu [Mon, 15 Jun 2015 01:56:40 +0000 (01:56 +0000)]
[AArch64] Revert r239711 again. We need to discuss how to share code between AArch64 and ARM backend.

llvm-svn: 239713

9 years agoCOFF: Fix resource table size.
Rui Ueyama [Mon, 15 Jun 2015 01:35:56 +0000 (01:35 +0000)]
COFF: Fix resource table size.

The size field shouldn't include trailing padding.

llvm-svn: 239712

9 years ago[AArch64] Match interleaved memory accesses into ldN/stN instructions.
Hao Liu [Mon, 15 Jun 2015 01:35:49 +0000 (01:35 +0000)]
[AArch64] Match interleaved memory accesses into ldN/stN instructions.

Re-commit after adding "-aarch64-neon-syntax=generic" to fix the failure on OS X.
This patch was firstly committed in r239514, then reverted in r239544 because of a syntax incompatible failure on OS X.

llvm-svn: 239711

9 years agoCOFF: Support base relocations.
Rui Ueyama [Mon, 15 Jun 2015 01:23:58 +0000 (01:23 +0000)]
COFF: Support base relocations.

PE/COFF executables/DLLs usually contain data which is called
base relocations. Base relocations are a list of addresses that
need to be fixed by the loader if load-time relocation is needed.

Base relocations are in .reloc section.

We emit one base relocation entry for each IMAGE_REL_AMD64_ADDR64
relocation.

In order to save disk space, base relocations are grouped by page.
Each group is called a block. A block starts with a 32-bit page
address followed by 16-bit offsets in the page. That is more
efficient representation of addresses than just an array of 32-bit
addresses.

llvm-svn: 239710

9 years ago[analyzer] Remove ObjCContainersChecker size information when a CFMutableArrayRef...
Devin Coughlin [Mon, 15 Jun 2015 01:00:42 +0000 (01:00 +0000)]
[analyzer] Remove ObjCContainersChecker size information when a CFMutableArrayRef escapes

Update ObjCContainersChecker to be notified when pointers escape so it can
remove size information for escaping CFMutableArrayRefs. When such pointers
escape, un-analyzed code could mutate the array and cause the size information
to be incorrect.

rdar://problem/19406485

llvm-svn: 239709

9 years agoFix std::function allocator constructors in C++03.
Eric Fiselier [Sun, 14 Jun 2015 23:30:09 +0000 (23:30 +0000)]
Fix std::function allocator constructors in C++03.

The C++03 version of function tried to default construct the allocator
in the uses allocator constructors when no allocation was performed. These
constructors would fail to compile when used with allocators that had no
default constructor.

llvm-svn: 239708

9 years agoCOFF: Change const name. NFC.
Rui Ueyama [Sun, 14 Jun 2015 22:21:29 +0000 (22:21 +0000)]
COFF: Change const name. NFC.

llvm-svn: 239707

9 years agoCOFF: Set Chunk to OutputSection backreference in addChunk().
Rui Ueyama [Sun, 14 Jun 2015 22:16:47 +0000 (22:16 +0000)]
COFF: Set Chunk to OutputSection backreference in addChunk().

When we add a chunk to an OutputSection, we always want to create
a backreference from an OutputSection to a Chunk. To make sure
we always do, do that in addChunk(). NFC.

llvm-svn: 239706

9 years agoCOFF: Add an assertion. NFC.
Rui Ueyama [Sun, 14 Jun 2015 22:01:39 +0000 (22:01 +0000)]
COFF: Add an assertion. NFC.

r239458 changed callee side of this function, so Live can never be
true when this function is called.

llvm-svn: 239705

9 years agoCOFF: Support Windows resource files.
Rui Ueyama [Sun, 14 Jun 2015 21:50:50 +0000 (21:50 +0000)]
COFF: Support Windows resource files.

Resource files are data files containing i18n messages, icon images, etc.
MSVC has a tool to convert a resource file to a regular COFF file so that
you can just link that file to embed resources to an executable.

However, you can directly pass resource files to the linker. If you do that,
the linker invokes the tool automatically. This patch implements that feature.

llvm-svn: 239704

9 years ago[CMake] Try to fix r239612, not to miss resources/windows_version_resource.rc in...
NAKAMURA Takumi [Sun, 14 Jun 2015 21:47:29 +0000 (21:47 +0000)]
[CMake] Try to fix r239612, not to miss resources/windows_version_resource.rc in clang build.

  - Who defines ${LLVM_SOURCE_DIR} ?
  - Would windows_version_resource.rc be available in an *installed* llvm tree?
    I suggest it may be installed in ${PREFIX}/share.

llvm-svn: 239703

9 years ago[InstSimplify] fsub nnan x, x -> 0.0 is valid without ninf
Benjamin Kramer [Sun, 14 Jun 2015 21:01:20 +0000 (21:01 +0000)]
[InstSimplify] fsub nnan x, x -> 0.0 is valid without ninf

Both inf - inf and (-inf) - (-inf) are NaN, so it's already covered by
nnan.

llvm-svn: 239702

9 years ago[InstSimplify] Add self-fdiv identities for -ffinite-math-only.
Benjamin Kramer [Sun, 14 Jun 2015 18:53:58 +0000 (18:53 +0000)]
[InstSimplify] Add self-fdiv identities for -ffinite-math-only.

When NaNs and Infs are ignored we can fold
 X /  X -> 1.0
-X /  X -> -1.0
 X / -X -> -1.0

llvm-svn: 239701

9 years agoAVX-512: Implemented DAG lowering for shuff62x2/shufi62x2 instuctions ( Shuffle Packe...
Igor Breger [Sun, 14 Jun 2015 13:07:47 +0000 (13:07 +0000)]
AVX-512: Implemented DAG lowering for shuff62x2/shufi62x2 instuctions ( Shuffle Packed Values at 128-bit Granularity )
Tests added , vector-shuffle-512-v8.ll test re-generated.

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

llvm-svn: 239697

9 years agoAdd test for parsing the XOR operator in Intel syntax inline assembly.
Michael Kuperstein [Sun, 14 Jun 2015 13:03:27 +0000 (13:03 +0000)]
Add  test for parsing the XOR operator in Intel syntax inline assembly.
LLVM side of the patch was committed as r239695.

Differential Revision: http://reviews.llvm.org/D10384
Patch by marina.yatsina@intel.com

llvm-svn: 239696

9 years agoAdd support for parsing the XOR operator in Intel syntax inline assembly.
Michael Kuperstein [Sun, 14 Jun 2015 12:59:45 +0000 (12:59 +0000)]
Add support for parsing the XOR operator in Intel syntax inline assembly.

Differential Revision: http://reviews.llvm.org/D10385
Patch by marina.yatsina@intel.com

llvm-svn: 239695

9 years agoAVX-512: Implemented cvtsi2ss/d cvtusi2ss/d instructions with round control for KNL.
Igor Breger [Sun, 14 Jun 2015 12:44:55 +0000 (12:44 +0000)]
AVX-512: Implemented cvtsi2ss/d cvtusi2ss/d instructions with round control for KNL.
Added intrinsics for cvtsi2ss/d instructions.
Added tests for intrinsics and encoding.

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

llvm-svn: 239694

9 years agoclang-format: [JS] Fix corner case in template string parsing.
Daniel Jasper [Sun, 14 Jun 2015 07:16:57 +0000 (07:16 +0000)]
clang-format: [JS] Fix corner case in template string parsing.

Before, these would not properly detected because of the char/string
literal found when re-lexing after the first `:

  var x = `'`;  // comment with matching quote '
  var x = `"`;  // comment with matching quote "

llvm-svn: 239693

9 years agoAsmPrinter.cpp: Avoid crashes for targeting like "arm-mingw32". CurrentFnSym might...
NAKAMURA Takumi [Sun, 14 Jun 2015 00:23:40 +0000 (00:23 +0000)]
AsmPrinter.cpp: Avoid crashes for targeting like "arm-mingw32". CurrentFnSym might not be <MCSymbolELF> here.

llvm-svn: 239692

9 years agoReformat.
NAKAMURA Takumi [Sun, 14 Jun 2015 00:23:33 +0000 (00:23 +0000)]
Reformat.

llvm-svn: 239691

9 years ago[Hexagon] Adding some codegen tests and updating some to match spec.
Colin LeMahieu [Sat, 13 Jun 2015 21:46:39 +0000 (21:46 +0000)]
[Hexagon] Adding some codegen tests and updating some to match spec.

llvm-svn: 239690

9 years agoAdd some basic support for CloudABI on i686.
Ed Schouten [Sat, 13 Jun 2015 21:33:49 +0000 (21:33 +0000)]
Add some basic support for CloudABI on i686.

Some people want to experiment with building i686 CloudABI binaries. I
am not entirely sure this is a good idea, as I'd rather see Intel x32
support appear.

As it only requires a two-line change, let's at least provide compiler
to ease experimenting.

llvm-svn: 239689

9 years ago[Statepoints] Skip a vector copy when uniquing values.
Benjamin Kramer [Sat, 13 Jun 2015 19:50:38 +0000 (19:50 +0000)]
[Statepoints] Skip a vector copy when uniquing values.

No functionality change intended.

llvm-svn: 239688

9 years ago[ExecutionEngine] ArrayRefize argument passing.
Benjamin Kramer [Sat, 13 Jun 2015 19:50:29 +0000 (19:50 +0000)]
[ExecutionEngine] ArrayRefize argument passing.

No functionality change intended.

llvm-svn: 239687

9 years agoC++11 Rangify loops in AssemblyWriter::printModule, NFC.
Yaron Keren [Sat, 13 Jun 2015 17:50:47 +0000 (17:50 +0000)]
C++11 Rangify loops in AssemblyWriter::printModule, NFC.

llvm-svn: 239686

9 years agoDon't use std::errc.
Rafael Espindola [Sat, 13 Jun 2015 17:23:15 +0000 (17:23 +0000)]
Don't use std::errc.

As noted on Errc.h:

// * std::errc is just marked with is_error_condition_enum. This means that
//   common patters like AnErrorCode == errc::no_such_file_or_directory take
//   4 virtual calls instead of two comparisons.

And on some libstdc++ those virtual functions conclude that

------------------------
int main() {
  std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
  return foo == std::errc::no_such_file_or_directory;
}
-------------------------

should exit with 0.

llvm-svn: 239685

9 years agoDon't use std::errc.
Rafael Espindola [Sat, 13 Jun 2015 17:23:13 +0000 (17:23 +0000)]
Don't use std::errc.

As noted on Errc.h:

// * std::errc is just marked with is_error_condition_enum. This means that
//   common patters like AnErrorCode == errc::no_such_file_or_directory take
//   4 virtual calls instead of two comparisons.

And on some libstdc++ those virtual functions conclude that

------------------------
int main() {
  std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
  return foo == std::errc::no_such_file_or_directory;
}
-------------------------

should exit with 0.

llvm-svn: 239684

9 years agoDon't use std::errc.
Rafael Espindola [Sat, 13 Jun 2015 17:23:04 +0000 (17:23 +0000)]
Don't use std::errc.

As noted on Errc.h:

// * std::errc is just marked with is_error_condition_enum. This means that
//   common patters like AnErrorCode == errc::no_such_file_or_directory take
//   4 virtual calls instead of two comparisons.

And on some libstdc++ those virtual functions conclude that

------------------------
int main() {
  std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
  return foo == std::errc::no_such_file_or_directory;
}
-------------------------

should exit with 0.

llvm-svn: 239683

9 years ago[DAGCombiner] Added BSWAP(BSWAP(x)) -> x combine pattern.
Simon Pilgrim [Sat, 13 Jun 2015 16:25:12 +0000 (16:25 +0000)]
[DAGCombiner] Added BSWAP(BSWAP(x)) -> x combine pattern.

llvm-svn: 239682

9 years agohoist loop-invariant; NFCI
Sanjay Patel [Sat, 13 Jun 2015 15:33:15 +0000 (15:33 +0000)]
hoist loop-invariant; NFCI

llvm-svn: 239681

9 years agoremove function names from comments and clean up; NFC
Sanjay Patel [Sat, 13 Jun 2015 15:32:45 +0000 (15:32 +0000)]
remove function names from comments and clean up; NFC

llvm-svn: 239680

9 years ago[SelectionDAG] Added assertions + UNDEF handling for BSWAP node creation.
Simon Pilgrim [Sat, 13 Jun 2015 15:23:58 +0000 (15:23 +0000)]
[SelectionDAG] Added assertions + UNDEF handling for BSWAP node creation.

llvm-svn: 239679

9 years agoremove unnecessary casts; NFCI
Sanjay Patel [Sat, 13 Jun 2015 15:06:33 +0000 (15:06 +0000)]
remove unnecessary casts; NFCI

llvm-svn: 239678

9 years ago[Mips] Support R_MIPS_PC16 relocation handling
Simon Atanasyan [Sat, 13 Jun 2015 14:48:14 +0000 (14:48 +0000)]
[Mips] Support R_MIPS_PC16 relocation handling

llvm-svn: 239677

9 years ago[Mips] Use standard relocations R_MIPS_HI16/LO16 instead of custom variants
Simon Atanasyan [Sat, 13 Jun 2015 14:48:04 +0000 (14:48 +0000)]
[Mips] Use standard relocations R_MIPS_HI16/LO16 instead of custom variants

No functional changes.

llvm-svn: 239676

9 years ago[DAGCombiner] Added BSWAP vector constant folding support.
Simon Pilgrim [Sat, 13 Jun 2015 14:08:15 +0000 (14:08 +0000)]
[DAGCombiner] Added BSWAP vector constant folding support.

llvm-svn: 239675

9 years agoStripped trailing whitespace. NFC.
Simon Pilgrim [Sat, 13 Jun 2015 12:57:36 +0000 (12:57 +0000)]
Stripped trailing whitespace. NFC.

llvm-svn: 239674

9 years ago[LinkerTest] Don't leak error string.
Benjamin Kramer [Sat, 13 Jun 2015 12:53:21 +0000 (12:53 +0000)]
[LinkerTest] Don't leak error string.

llvm-svn: 239673

9 years agoStripped trailing whitespace. NFC.
Simon Pilgrim [Sat, 13 Jun 2015 12:51:39 +0000 (12:51 +0000)]
Stripped trailing whitespace. NFC.

llvm-svn: 239672

9 years agoUpdate for llvm api change.
Rafael Espindola [Sat, 13 Jun 2015 12:50:13 +0000 (12:50 +0000)]
Update for llvm api change.

llvm-svn: 239671

9 years agoUpdate for llvm api change.
Rafael Espindola [Sat, 13 Jun 2015 12:50:07 +0000 (12:50 +0000)]
Update for llvm api change.

llvm-svn: 239670

9 years agoBring in a BumpPtrStringSaver from lld and simplify the interface.
Rafael Espindola [Sat, 13 Jun 2015 12:49:52 +0000 (12:49 +0000)]
Bring in a BumpPtrStringSaver from lld and simplify the interface.

StringSaver now always saves to a BumpPtrAllocator.

The only reason for having the virtual saveImpl is so lld can have a
thread safe version.

The reason for the distinct BumpPtrStringSaver class is to avoid the
virtual destructor.

llvm-svn: 239669

9 years agoCleanup result_of tests and fix issues with the C++03 result_of.
Eric Fiselier [Sat, 13 Jun 2015 08:25:24 +0000 (08:25 +0000)]
Cleanup result_of tests and fix issues with the C++03 result_of.

The two main fixes this patch contains are:
- use __identity_t instead of common_type. common_type was used as an
  identity metafunction but the decay resulted in incorrect results.
- Pointers to free functions were not counted as functions. Remove the pointer
  before checking if a type is a function.

llvm-svn: 239668

9 years agoRemove warnings about old CMake options
Eric Fiselier [Sat, 13 Jun 2015 07:31:55 +0000 (07:31 +0000)]
Remove warnings about old CMake options

llvm-svn: 239667

9 years agoFix PR12999 - unordered_set::insert calls operator new when no insert occurs
Eric Fiselier [Sat, 13 Jun 2015 07:18:32 +0000 (07:18 +0000)]
Fix PR12999 -  unordered_set::insert calls operator new when no insert occurs

Summary:
when `unordered_set::insert(value_type&&)` was called it would be treated like `unordered_set::emplace(Args&&)` and it would allocate and construct a node before trying to insert it.
This caused unnecessary allocations when the value was already in the set. This patch adds an overload to `__hash_table::__insert_unique` that specifically handles `value_type&&` more link `value_type const &`.

This patch also adds a single unified insert function for values into  `__hash_table` called `__insert_unique_value` that handles the cases for `__insert_unique(value_type&&)` and `__insert_unique(value_type const &)`.

This patch fixes PR12999: http://llvm.org/bugs/show_bug.cgi?id=12999.

Reviewers: mclow.lists, titus, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 239666

9 years agoAdd `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiag...
Eric Fiselier [Sat, 13 Jun 2015 07:11:40 +0000 (07:11 +0000)]
Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer

Summary:
The goal of this patch is to make `-verify` easier to use when testing libc++. The `notes` attached to compile error diagnostics are numerous and relatively unstable when they reference libc++ header internals. This patch allows libc++ to write stable compilation failure tests by allowing unexpected diagnostic messages to be ignored where they are not relevant.

This patch adds a new CC1 flag called `-verify-ignore-unexpected`. `-verify-ignore-unexpected` tells `VerifyDiagnosticsConsumer` to ignore *all* unexpected diagnostic messages. `-verify-ignore-unexpected=<LevelList>` can be used to only ignore certain diagnostic levels. `<LevelList>` is a comma separated list of diagnostic levels to ignore. The supported levels are `note`, `remark`, `warning` and `error`.

Reviewers: bogner, grosser, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 239665

9 years ago[libcxx] Fix detection of __is_final.
Eric Fiselier [Sat, 13 Jun 2015 07:08:02 +0000 (07:08 +0000)]
[libcxx] Fix detection of __is_final.

Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 239664

9 years ago[LIT] Fix failing LIT tests
Eric Fiselier [Sat, 13 Jun 2015 06:55:44 +0000 (06:55 +0000)]
[LIT] Fix failing LIT tests

Summary:
I spend some time trying to get the LIT test suite passing. Here are the changes that I needed to make on my machine.

I made the following changes for the following reasons.

1. google-test.py: The Google test format now checks for "[  PASSED  ] 1 test." to check if a test passes.
2. discovery.py: The output appears in a different order on my machine than it did in the test.
3. unittest-adaptor.py: The output appears in a different order on my machine than it did in the test.
4. The classname is now formed differently in `getJUnitXML(...)`.

I'm not sure what is causing the output order to differ in discovery.py and unittest-adaptor.py. Does anybody have any thoughts?

Reviewers: ddunbar, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: llvm-commits

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

llvm-svn: 239663

9 years ago[libcxx] Use __decltype instead of __typeof__
Eric Fiselier [Sat, 13 Jun 2015 06:27:17 +0000 (06:27 +0000)]
[libcxx] Use __decltype instead of __typeof__

Summary:
Both clang and GCC provide C++11 decltype semantics as __decltype in c++03 mode. We should use this instead of __typeof__ when availble.

GCC added __decltype in 4.6.0, and AFAIK clang provided __decltype ever since 3.3. Unfortunately `__has_builtin(__decltype)` doesn't work for clang so we need to check the compiler version instead.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 239662

9 years agoAMDGPU: s/R600/AMDGPU/ in the Makefiles
Tom Stellard [Sat, 13 Jun 2015 05:11:14 +0000 (05:11 +0000)]
AMDGPU: s/R600/AMDGPU/ in the Makefiles

Now the library names in the Makefiles match the library names in
LLVMBuild.txt.

This should hopefully fix the remaining bot failures.

llvm-svn: 239661

9 years agoconfigure: Remove non-portable fall-through operator: ;&
Tom Stellard [Sat, 13 Jun 2015 03:46:48 +0000 (03:46 +0000)]
configure: Remove non-portable fall-through operator: ;&

This was added in r239657.

llvm-svn: 239660

9 years agoRename TargetSubtargetInfo::enablePostMachineScheduler() to enablePostRAScheduler()
Matthias Braun [Sat, 13 Jun 2015 03:42:16 +0000 (03:42 +0000)]
Rename TargetSubtargetInfo::enablePostMachineScheduler() to enablePostRAScheduler()

r213101 changed the behaviour of this method to not only affect the
PostMachineScheduler scheduler but also the PostRAScheduler scheduler,
renaming should make this fact clear. Also document that the preferred
way is to specify this in the scheduling model instead of overriding
this method.

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

llvm-svn: 239659

9 years agoMachineLICM: Use TargetSchedModel instead of just itineraries
Matthias Braun [Sat, 13 Jun 2015 03:42:11 +0000 (03:42 +0000)]
MachineLICM: Use TargetSchedModel instead of just itineraries

This will use Itinieraries if available, but will also work if just a
MCSchedModel is available.

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

llvm-svn: 239658

9 years agoR600 -> AMDGPU rename
Tom Stellard [Sat, 13 Jun 2015 03:28:10 +0000 (03:28 +0000)]
R600 -> AMDGPU rename

llvm-svn: 239657

9 years agoRevert r239213: "clang-cl: Implement /GL in terms of -flto."
Hans Wennborg [Sat, 13 Jun 2015 02:53:50 +0000 (02:53 +0000)]
Revert r239213: "clang-cl: Implement /GL in terms of -flto."

Reverting until it's easier to use this in a real-world build, e.g.
when the linker can handle it.

llvm-svn: 239656

9 years agoMake __void_t unary and always provide it.
Eric Fiselier [Sat, 13 Jun 2015 02:36:07 +0000 (02:36 +0000)]
Make __void_t unary and always provide it.

llvm-svn: 239655

9 years agoLWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.
Eric Fiselier [Sat, 13 Jun 2015 02:23:00 +0000 (02:23 +0000)]
LWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.

This patch fixes LWG issue 2422 by removing the DECAY_COPY from call once.
The review can be found here: http://reviews.llvm.org/D10191

llvm-svn: 239654

9 years agoEnable __is_trivially* intrinsics for GCC 5.1
Eric Fiselier [Sat, 13 Jun 2015 02:18:44 +0000 (02:18 +0000)]
Enable __is_trivially* intrinsics for GCC 5.1

Until GCC 5.1 the __is_trivially* intrinsics were not provided. Enable use of
the builtins for GCC 5.1.

Also enable Reference qualified member functions for GCC 4.9 and greater.

This patch also defines _GNUC_VER to 0 when __GNUC__ is not defined because
libc++ assumes _GNUC_VER is always defined.

llvm-svn: 239653

9 years agodocs: grammar adjustments in clang manpage
Saleem Abdulrasool [Sat, 13 Jun 2015 01:21:58 +0000 (01:21 +0000)]
docs: grammar adjustments in clang manpage

Fix a few typos and run-on sentences in the clang POD documentation.

Patch by Brian R. Gaeke!

llvm-svn: 239652

9 years ago[CodeGen] Don't evaluate immediate inlineasm arguments using isICE().
Ahmed Bougacha [Sat, 13 Jun 2015 01:16:10 +0000 (01:16 +0000)]
[CodeGen] Don't evaluate immediate inlineasm arguments using isICE().

Instead, just EvaluateAsInt().

Follow-up to r239549: rsmith points out that isICE() is expensive;
seems like it's not the right concept anyway, as it fails on
`static const' in C, and will actually trigger the assert below on:
    test/Sema/inline-asm-validate-x86.c

llvm-svn: 239651

9 years agoRevert 239644.
Matt Wala [Sat, 13 Jun 2015 01:08:00 +0000 (01:08 +0000)]
Revert 239644.

llvm-svn: 239650

9 years agoRefactor is_member_function_pointer to use is_function and not __member_function_traits.
Eric Fiselier [Sat, 13 Jun 2015 00:33:13 +0000 (00:33 +0000)]
Refactor is_member_function_pointer to use is_function and not __member_function_traits.

Replacing the dependancy on __member_function_traits with is_function allows
is_member_function_pointer to work more often. In particular it allows it to
work when we don't have variadic templates but the function has an arity > 3.

llvm-svn: 239649

9 years agoPrevent dependancy on libatomic when using GCC to provide <atomic>.
Eric Fiselier [Sat, 13 Jun 2015 00:23:07 +0000 (00:23 +0000)]
Prevent dependancy on libatomic when using GCC to provide <atomic>.

The __atomic_is_lock_free(...) function sometimes requires linkage to libatomic
if it cannot be evaluated at compile time. Remove __c11_atomic_is_lock_free
and use __atomic_is_lock_free(sizeof(Tp)) directly so that it can be evaluated
at compile time.

llvm-svn: 239648

9 years agoAArch64: map bare-metal arm64-macho triple to MachO MC layer.
Tim Northover [Fri, 12 Jun 2015 23:37:11 +0000 (23:37 +0000)]
AArch64: map bare-metal arm64-macho triple to MachO MC layer.

Far better than an assertion about expecting ELF.

llvm-svn: 239647

9 years agoFix returning error message in LLVMLinkModules
Eli Bendersky [Fri, 12 Jun 2015 23:26:42 +0000 (23:26 +0000)]
Fix returning error message in LLVMLinkModules

On error, the temporary output stream wouldn't be flushed and therefore the
caller would see an empty error message.

Patch by Antoine Pitrou

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

llvm-svn: 239646

9 years ago[Orc] Tidy up initialization based on review feedback for r239561 from dblaikie.
Lang Hames [Fri, 12 Jun 2015 23:13:06 +0000 (23:13 +0000)]
[Orc] Tidy up initialization based on review feedback for r239561 from dblaikie.

NFC.

llvm-svn: 239645

9 years ago[Scalarizer] Fix potential for stale data in Scattered across invocations
Matt Wala [Fri, 12 Jun 2015 22:49:11 +0000 (22:49 +0000)]
[Scalarizer] Fix potential for stale data in Scattered across invocations

Summary:
Scalarizer has two data structures that hold information about changes
to the function, Gathered and Scattered. These are cleared in finish()
at the end of runOnFunction() if finish() detects any changes to the
function.

However, finish() was checking for changes by only checking if
Gathered was non-empty. The function visitStore() only modifies
Scattered without touching Gathered. As a result, Scattered could have
ended up having stale data if Scalarizer only scalarized store
instructions. Since the data in Scattered is used during the execution
of the pass, this introduced dangling pointer errors.

The fix is to check whether both Scattered and Gathered are empty
before deciding what to do in finish().

Reviewers: srhines

Reviewed By: srhines

Subscribers: llvm-commits

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

llvm-svn: 239644

9 years ago[CodeGen] Use IRBuilder to create llvm.lifetime intrinsics.
Alexey Samsonov [Fri, 12 Jun 2015 22:31:32 +0000 (22:31 +0000)]
[CodeGen] Use IRBuilder to create llvm.lifetime intrinsics.

Summary:
In addition to easier syntax, IRBuilder makes sure to set correct
debug locations for newly added instructions (bitcast and
llvm.lifetime itself). This restores the original behavior, which
was modified by r234581 (reapplied as r235553).

Extend one of the tests to check for debug locations.

Test Plan: regression test suite

Reviewers: aadg, dblaikie

Subscribers: cfe-commits, majnemer

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

llvm-svn: 239643

9 years ago[Orc] Tidy up the CompileOnDemand layer based on commit review from dblaikie.
Lang Hames [Fri, 12 Jun 2015 22:22:50 +0000 (22:22 +0000)]
[Orc] Tidy up the CompileOnDemand layer based on commit review from dblaikie.

NFC.

llvm-svn: 239642

9 years ago[COFF] Spell the namespace correctly.
Davide Italiano [Fri, 12 Jun 2015 21:37:55 +0000 (21:37 +0000)]
[COFF] Spell the namespace correctly.

llvm-svn: 239641