platform/upstream/llvm.git
9 years agoFix error handling in AdbClient - PushFile and PullFile.
Oleksiy Vyalov [Fri, 5 Jun 2015 01:32:45 +0000 (01:32 +0000)]
Fix error handling in AdbClient - PushFile and PullFile.

http://reviews.llvm.org/D10176

llvm-svn: 239130

9 years agoInstrProf: Fix reading of consecutive 32 bit coverage maps
Justin Bogner [Fri, 5 Jun 2015 01:23:42 +0000 (01:23 +0000)]
InstrProf: Fix reading of consecutive 32 bit coverage maps

When we generate coverage data, we explicitly set each coverage map's
alignment to 8 (See InstrProfiling::lowerCoverageData), but when we
read the coverage data, we assume consecutive maps are exactly
adjacent. When we're dealing with 32 bit, maps can end on a 4 byte
boundary, causing us to think the padding is part of the next record.

Fix this by adjusting the buffer to an appropriately aligned address
between records.

This is pretty awkward to test, as it requires a binary with multiple
coverage maps to hit, so we'd need to check in multiple source files
and a binary blob as inputs.

llvm-svn: 239129

9 years ago[Concepts] lex keywords: concept and requires
Hubert Tong [Fri, 5 Jun 2015 01:10:24 +0000 (01:10 +0000)]
[Concepts] lex keywords: concept and requires

Summary:
This patch enables lexing of `concept` and `requires` as keywords.
Further changes which add messages for future keyword compat are to
follow.

Test Plan:
Testing of C++14 + Concepts TS mode is added to
`test/Lexer/keywords_test.cpp`, which expects that the new keywords are
enabled under said mode.

Reviewers: faisalv, fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 239128

9 years agoDelegate path operations to FileSpec.
Chaoren Lin [Fri, 5 Jun 2015 00:28:06 +0000 (00:28 +0000)]
Delegate path operations to FileSpec.

Summary:
- Added PrependPathComponent utility functions to FileSpec.
- Delegate path operations in ParseCompileUnit to FileSpec.
- Delegate path operations in ParseSupportFiles to FileSpec.

Reviewers: clayborg, vharron, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 239127

9 years ago[TestChangeProcessGroup] Mark the test as xfail for Android API 16
Siva Chandra [Fri, 5 Jun 2015 00:22:49 +0000 (00:22 +0000)]
[TestChangeProcessGroup] Mark the test as xfail for Android API 16

Summary:
This change adds the infrastructure to mark tests as xfail for specific
Android API levels.

Test Plan: dotest.py TestChangeProcessGroup on an Android API 16 device.

Reviewers: chying, labath, chaoren

Reviewed By: labath, chaoren

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 239126

9 years agoRevert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()."
Alexey Samsonov [Thu, 4 Jun 2015 23:58:31 +0000 (23:58 +0000)]
Revert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()."

This reverts commit r239124.

llvm-svn: 239125

9 years ago[Object, ELF] Fix segmentation fault in ELFFile::getSectionName().
Alexey Samsonov [Thu, 4 Jun 2015 23:40:23 +0000 (23:40 +0000)]
[Object, ELF] Fix segmentation fault in ELFFile::getSectionName().

Don't do a null dereference if .shstrtab section is missing.

llvm-svn: 239124

9 years agoRemove unused defaulted argument `IncludeTextualHeaders`.
Sean Silva [Thu, 4 Jun 2015 23:38:11 +0000 (23:38 +0000)]
Remove unused defaulted argument `IncludeTextualHeaders`.

llvm-svn: 239123

9 years agoFixed modularize to warn about missing headers referenced in a module map.
John Thompson [Thu, 4 Jun 2015 23:35:19 +0000 (23:35 +0000)]
Fixed modularize to warn about missing headers referenced in a module map.

llvm-svn: 239122

9 years agoMC: Clean up naming in MCObjectFileInfo.h.
Jim Grosbach [Thu, 4 Jun 2015 23:35:03 +0000 (23:35 +0000)]
MC: Clean up naming in MCObjectFileInfo.h.

Init*() methods to init*().

llvm-svn: 239121

9 years agoMC: Tidy up formatting and doc comments. NFC.
Jim Grosbach [Thu, 4 Jun 2015 23:35:00 +0000 (23:35 +0000)]
MC: Tidy up formatting and doc comments. NFC.

llvm-svn: 239120

9 years agoMC: Clean up the naming for MCMachObjectWriter. NFC.
Jim Grosbach [Thu, 4 Jun 2015 23:25:54 +0000 (23:25 +0000)]
MC: Clean up the naming for MCMachObjectWriter. NFC.

s/ExecutePostLayoutBinding/executePostLayoutBinding/
s/ComputeSymbolTable/computeSymbolTable/
s/BindIndirectSymbols/bindIndirectSymbols/
s/RecordTLVPRelocation/recordTLVPRelocation/
s/RecordScatteredRelocation/recordScatteredRelocation/
s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/
s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/
s/WriteNlist/writeNlist/
s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/
s/WriteSymtabLoadCommand/writeSymtabLoadCommand/
s/WriteSection/writeSection/
s/WriteSegmentLoadCommand/writeSegmentLoadCommand/
s/WriteHeader/writeHeader/

llvm-svn: 239119

9 years agoMC: Move MachObjectWriter::SectionAddress to private.
Jim Grosbach [Thu, 4 Jun 2015 23:25:19 +0000 (23:25 +0000)]
MC: Move MachObjectWriter::SectionAddress to private.

There's already a get() method everything that needs it is using.

llvm-svn: 239118

9 years agoMC: Tidy up formatting and doc comments. NFC.
Jim Grosbach [Thu, 4 Jun 2015 23:25:05 +0000 (23:25 +0000)]
MC: Tidy up formatting and doc comments. NFC.

llvm-svn: 239117

9 years ago[Object, ELF] Don't assert on invalid magic in createELFObjectFile.
Alexey Samsonov [Thu, 4 Jun 2015 23:14:43 +0000 (23:14 +0000)]
[Object, ELF] Don't assert on invalid magic in createELFObjectFile.

Instead, return a proper error code from factory.

llvm-svn: 239116

9 years ago[InstCombine] Don't miscompile safe increment idiom
David Majnemer [Thu, 4 Jun 2015 23:11:30 +0000 (23:11 +0000)]
[InstCombine] Don't miscompile safe increment idiom

We cleverly handle cases where computation done in one argument of a select
instruction is suitable for the other operand, thus obviating the need
of the select and the comparison.  However, the other operand cannot
have flags.

This fixes PR23757.

llvm-svn: 239115

9 years agoStatepoint: Fix handling of Far Immediate calls
Swaroop Sridhar [Thu, 4 Jun 2015 23:03:21 +0000 (23:03 +0000)]
Statepoint: Fix handling of Far Immediate calls

gc.statepoint intrinsics with a far immediate call target
were lowered incorrectly as pc-rel32 calls.

This change fixes the problem, and generates an indirect call
via a scratch register.

For example:

Intrinsic:
  %safepoint_token = call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* inttoptr (i64 140727162896504 to void ()*), i32 0, i32 0, i32 0, i32 0)

Old Incorrect Lowering:
  callq 140727162896504

New Correct Lowering:
  movabsq $140727162896504, %rax
  callq *%rax

In lowerCallFromStatepoint(), the callee-target was modified and
represented as a "TargetConstant" node, rather than a "Constant" node.
Undoing this modification enabled LowerCall() to generate the
correct CALL instruction.

llvm-svn: 239114

9 years ago[Object, ELF] Don't call llvm_unreachable() from createELFObjectFile.
Alexey Samsonov [Thu, 4 Jun 2015 22:58:25 +0000 (22:58 +0000)]
[Object, ELF] Don't call llvm_unreachable() from createELFObjectFile.

Instead, return a proper error code from factory.

llvm-svn: 239113

9 years agoTest commit access.
Hubert Tong [Thu, 4 Jun 2015 22:53:21 +0000 (22:53 +0000)]
Test commit access.

Fixes trailing whitespace in lib/Sema/JumpDiagnostics.cpp.

llvm-svn: 239112

9 years ago[Target/X86] Don't use callee-saved registers in a Win64 tail call on non-Windows.
Charles Davis [Thu, 4 Jun 2015 22:50:05 +0000 (22:50 +0000)]
[Target/X86] Don't use callee-saved registers in a Win64 tail call on non-Windows.

Summary:
A small bit that I missed when I updated the X86 backend to account for
the Win64 calling convention on non-Windows. Now we don't use dead
non-volatile registers when emitting a Win64 indirect tail call on
non-Windows.

Should fix PR23710.

Test Plan: Added test for the correct behavior based on the case I posted to PR23710.

Reviewers: rnk

Subscribers: llvm-commits

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

llvm-svn: 239111

9 years ago[Object, MachO] Fixup for r239075: use union to store mach_header and mach_header_64.
Alexey Samsonov [Thu, 4 Jun 2015 22:49:55 +0000 (22:49 +0000)]
[Object, MachO] Fixup for r239075: use union to store mach_header and mach_header_64.

llvm-svn: 239110

9 years ago[Object, MachO] Don't crash on incomplete MachO segment load commands.
Alexey Samsonov [Thu, 4 Jun 2015 22:26:44 +0000 (22:26 +0000)]
[Object, MachO] Don't crash on incomplete MachO segment load commands.

Report proper error code from MachOObjectFile constructor if we
can't parse another segment load command (we already return a proper
error if segment load command contents is suspicious).

llvm-svn: 239109

9 years agoMC: Clean up naming in MCObjectWriter. NFC.
Jim Grosbach [Thu, 4 Jun 2015 22:24:41 +0000 (22:24 +0000)]
MC: Clean up naming in MCObjectWriter. NFC.

s/WriteObject/writeObject/
s/RecordRelocation/recordRelocation/
s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/
s/Write8/write8/
s/WriteLE16/writeLE16/
s/WriteLE32/writeLE32/
s/WriteLE64/writeLE64/
s/WriteBE16/writeBE16/
s/WriteBE32/writeBE32/
s/WriteBE64/writeBE64/
s/Write16/write16/
s/Write32/write32/
s/Write64/write64/
s/WriteZeroes/writeZeroes/
s/WriteBytes/writeBytes/

llvm-svn: 239108

9 years agoMC: Tidy up formatting and doc comments. NFC.
Jim Grosbach [Thu, 4 Jun 2015 22:24:29 +0000 (22:24 +0000)]
MC: Tidy up formatting and doc comments. NFC.

llvm-svn: 239107

9 years ago[Object, MachO] Simplify load segment parsing code. NFC.
Alexey Samsonov [Thu, 4 Jun 2015 22:08:37 +0000 (22:08 +0000)]
[Object, MachO] Simplify load segment parsing code. NFC.

llvm-svn: 239106

9 years ago[SDAG switch lowering] Fix switch case -> or merging for 0 and INT_MIN
Benjamin Kramer [Thu, 4 Jun 2015 22:05:51 +0000 (22:05 +0000)]
[SDAG switch lowering] Fix switch case -> or merging for 0 and INT_MIN

The big/small ordering here is based on signed values so SmallValue will
be INT_MIN and BigValue 0. This shouldn't be a problem but the code
assumed that BigValue always had more bits set than SmallValue.

We used to just miss the transformation, but a recent refactoring of
mine turned this into an assertion failure.

llvm-svn: 239105

9 years ago[TestGdbRemoteRegisterState] Do not flip ARM *psr register in the test
Siva Chandra [Thu, 4 Jun 2015 22:04:04 +0000 (22:04 +0000)]
[TestGdbRemoteRegisterState] Do not flip ARM *psr register in the test

Summary:
Not all of that register is readable/writable in user mode. This means
that even if the inferior is stopped, parts of the register could be
changing. So, do not flip this register to check if its value can be
restored.

Reviewers: tberghammer, chaoren

Reviewed By: tberghammer

Subscribers: rengolin, aemerson, lldb-commits

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

llvm-svn: 239104

9 years agoShouldn't be XFAIL'ed.
Colin LeMahieu [Thu, 4 Jun 2015 21:49:43 +0000 (21:49 +0000)]
Shouldn't be XFAIL'ed.

llvm-svn: 239103

9 years agoRevert r239095 incorrect test tree.
Colin LeMahieu [Thu, 4 Jun 2015 21:32:42 +0000 (21:32 +0000)]
Revert r239095 incorrect test tree.

llvm-svn: 239102

9 years agoSimplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), following r239099
Artyom Skrobov [Thu, 4 Jun 2015 21:31:41 +0000 (21:31 +0000)]
Simplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), following r239099

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: cfe-commits

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

llvm-svn: 239101

9 years ago[NVPTX] roll forward r239082
Jingyue Wu [Thu, 4 Jun 2015 21:28:26 +0000 (21:28 +0000)]
[NVPTX] roll forward r239082

NVPTXISelDAGToDAG translates "addrspacecast to param" to
NVPTX::nvvm_ptr_gen_to_param

Added an llc test in bug21465.

llvm-svn: 239100

9 years agoSimplify ARMTargetParser::getArchSynonym
Artyom Skrobov [Thu, 4 Jun 2015 21:26:58 +0000 (21:26 +0000)]
Simplify ARMTargetParser::getArchSynonym

Summary:
1) The only caller, ARMTargetParser::parseArch, uses the results for an "endswith" test; so, including the "arm" prefix into the result is unnecessary.
2) Most ARMTargetParser::parseArch callers pass it the output from ARMTargetParser::getCanonicalArchName; so, make this behaviour the default. Then, including the "arm" prefix into the cases is unnecessary.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits

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

llvm-svn: 239099

9 years agoFix terrible python goof in clang-format.py which broke my vim
Chandler Carruth [Thu, 4 Jun 2015 21:23:07 +0000 (21:23 +0000)]
Fix terrible python goof in clang-format.py which broke my vim
integration.

Nothing is more important in life than clang-format integration with
vim. ;]

llvm-svn: 239098

9 years ago[Hexagon] Removing unused variable.
Colin LeMahieu [Thu, 4 Jun 2015 21:22:12 +0000 (21:22 +0000)]
[Hexagon] Removing unused variable.

llvm-svn: 239097

9 years ago[MachOWriter] Use for-range and roll some duplicated code into loops.
Benjamin Kramer [Thu, 4 Jun 2015 21:17:27 +0000 (21:17 +0000)]
[MachOWriter] Use for-range and roll some duplicated code into loops.

No functionality change intended.

llvm-svn: 239096

9 years ago[Hexagon] Adding functionality for duplexing. Duplexing is a way to compress commonl...
Colin LeMahieu [Thu, 4 Jun 2015 21:16:16 +0000 (21:16 +0000)]
[Hexagon] Adding functionality for duplexing.  Duplexing is a way to compress commonly used pairs of instructions in order to reduce code size.  The test case duplex.ll normally would be 8 bytes, assign register to 0 and jump to link register.  After duplexing this is only 4 bytes.  This also tests the HexagonMCShuffler code path which is used to make sure duplexed instructions still follow slot requirements.

llvm-svn: 239095

9 years agoRevert r239082
Jingyue Wu [Thu, 4 Jun 2015 21:07:08 +0000 (21:07 +0000)]
Revert r239082

llc crashed for NVPTX backend

llvm-svn: 239094

9 years ago[CodeGen] Add testcase for r239002.
Ahmed Bougacha [Thu, 4 Jun 2015 20:58:49 +0000 (20:58 +0000)]
[CodeGen] Add testcase for r239002.

Just realized I forgot to add it when committing.

llvm-svn: 239093

9 years agoRemove unused argument. NFC.
Rafael Espindola [Thu, 4 Jun 2015 20:55:49 +0000 (20:55 +0000)]
Remove unused argument. NFC.

llvm-svn: 239092

9 years agoRe-unique_ptrify LoadedObjectInfo::clone after it was reverted due to some other...
David Blaikie [Thu, 4 Jun 2015 20:54:32 +0000 (20:54 +0000)]
Re-unique_ptrify LoadedObjectInfo::clone after it was reverted due to some other changes that broke on GCC around the same time

Apparently this functionality isn't used in-tree (or I would go & make
the explicit unique_ptr constructions into implicit constructions to
make them more self documenting now that clone doesn't return a raw
owning pointer anymore) but only by the Julia frontend. This isn't
ideal.

llvm-svn: 239091

9 years agoTidy comment. NFC.
Diego Novillo [Thu, 4 Jun 2015 20:49:52 +0000 (20:49 +0000)]
Tidy comment. NFC.

llvm-svn: 239090

9 years agoErase constant dbgloc on reuse in PHI node
Sergey Dmitrouk [Thu, 4 Jun 2015 20:48:40 +0000 (20:48 +0000)]
Erase constant dbgloc on reuse in PHI node

Basic block selection involves checking successor BBs for PHI nodes
that depend on the current BB.  In case such BBs are found, the value
being selected is a constant and such constant already exists in
current BB, it's value is reused.

This might lead to wrong locations in some situations, especially if
same constant value ends up being materialized twice in two different
ways, which discards that sharing and leaves us with wrong debug
location in the successor BB.

In code this involves the following sequence of calls:

 SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks ->
 SelectionDAGBuilder::CopyValueToVirtualRegister ->
 SelectionDAGBuilder::getNonRegisterValue

llvm-svn: 239089

9 years agoRetry defaulting the virtual dtor in LoadedObjectInfo
David Blaikie [Thu, 4 Jun 2015 20:41:51 +0000 (20:41 +0000)]
Retry defaulting the virtual dtor in LoadedObjectInfo

Originally committed in r237975, GCC 4.7 gave a compilation error
regarding "looser throw specification" though it seemed to be pointing
to a virtual defaulted dtor in a base class and an override defaulted
dtor in a derived class - so I'm not quite sure why/how they could end
up with different throw specifications. To simplify and reduce the risk
of this, I've just removed the pointless override in the derived class,
the base class's should be sufficient. *fingers crossed*

llvm-svn: 239088

9 years ago[GlobalMerge] Take into account minsize on Global users' parents.
Ahmed Bougacha [Thu, 4 Jun 2015 20:39:23 +0000 (20:39 +0000)]
[GlobalMerge] Take into account minsize on Global users' parents.

Now that we can look at users, we can trivially do this: when we would
have otherwise disabled GlobalMerge (currently -O<3), we can just run
it for minsize functions, as it's usually a codesize win.

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

llvm-svn: 239087

9 years ago[docs] Document "LGTM" in the lexicon.
Sean Silva [Thu, 4 Jun 2015 20:28:09 +0000 (20:28 +0000)]
[docs] Document "LGTM" in the lexicon.

llvm-svn: 239085

9 years agoMC: Remove obsolete MachO UseAggressiveSymbolFolding.
Jim Grosbach [Thu, 4 Jun 2015 20:27:42 +0000 (20:27 +0000)]
MC: Remove obsolete MachO UseAggressiveSymbolFolding.

Fix the FIXME and remove this old as(1) compat option. It was useful for
bringup of the integrated assembler to diff object files, but now it's
just causing more relocations than strictly necessary to be generated.

rdar://21201804

llvm-svn: 239084

9 years agoHaving another go at some simple cleanup from r237975/r237976
David Blaikie [Thu, 4 Jun 2015 20:23:13 +0000 (20:23 +0000)]
Having another go at some simple cleanup from r237975/r237976

I made a few changes here in a couple of commits - breaking them out
into smaller ones in case I hit the GCC oddities again.

I'm still not /entirely/ sure what the issues were, so apologies if any
of these experiments break things again. Feel free to revert
immediately.

llvm-svn: 239083

9 years ago[NVPTX] kernel pointer arguments point to the global address space
Jingyue Wu [Thu, 4 Jun 2015 20:19:38 +0000 (20:19 +0000)]
[NVPTX] kernel pointer arguments point to the global address space

Summary:
With this patch, NVPTXLowerKernelArgs converts a kernel pointer argument to a
pointer in the global address space. This change, along with
NVPTXFavorNonGenericAddrSpaces, allows the NVPTX backend to emit ld.global.*
and st.global.* for accessing kernel pointer arguments.

Minor changes:
1. refactor: extract function convertToPointerInAddrSpace
2. fix a bug in the test case in bug21465.ll

Test Plan: lower-kernel-ptr-arg.ll

Reviewers: eliben, meheff, jholewinski

Reviewed By: jholewinski

Subscribers: wengxt, jholewinski, llvm-commits

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

llvm-svn: 239082

9 years ago[Object, MachO] Don't crash on invalid MachO segment load commands.
Alexey Samsonov [Thu, 4 Jun 2015 20:08:52 +0000 (20:08 +0000)]
[Object, MachO] Don't crash on invalid MachO segment load commands.

Summary:
Properly report the error in segment load commands from MachOObjectFile
constructor instead of crashing the program.

Adjust the test case accordingly.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits
llvm-svn: 239081

9 years ago[Object, MachO] Don't crash on invalid MachO load commands.
Alexey Samsonov [Thu, 4 Jun 2015 19:57:46 +0000 (19:57 +0000)]
[Object, MachO] Don't crash on invalid MachO load commands.

Summary:
Currently all load commands are parsed in MachOObjectFile constructor.
If the next load command cannot be parsed, or if command size is too
small, properly report it through the error code and fail to construct
the object, instead of crashing the program.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits
llvm-svn: 239080

9 years ago[MC] Allowing operands to be erased from MCInst.
Colin LeMahieu [Thu, 4 Jun 2015 19:49:52 +0000 (19:49 +0000)]
[MC] Allowing operands to be erased from MCInst.

llvm-svn: 239079

9 years ago[Object, MachO] Don't crash on parsing invalid MachO header.
Alexey Samsonov [Thu, 4 Jun 2015 19:45:22 +0000 (19:45 +0000)]
[Object, MachO] Don't crash on parsing invalid MachO header.

Summary: Instead, properly report this error from MachOObjectFile constructor.

Test Plan: regression test suite

Reviewers: rafael

Subscribers: llvm-commits
llvm-svn: 239078

9 years ago[Object, MachO] Remove some code duplication. NFC.
Alexey Samsonov [Thu, 4 Jun 2015 19:34:14 +0000 (19:34 +0000)]
[Object, MachO] Remove some code duplication. NFC.

llvm-svn: 239077

9 years ago[CMake] Fixing the check for Ninja
Chris Bieneman [Thu, 4 Jun 2015 19:33:23 +0000 (19:33 +0000)]
[CMake] Fixing the check for Ninja

Enabling Ninja Job Pools needs to be dependent on the CMAKE_MAKE_PROGRAM not the CMAKE_GENERATOR. There are generators (like "Sublime Text 2 - Ninja") that also generate ninja build files. Basing of the CMAKE_MAKE_PROGRAM is the best future-proof way to handle this.

llvm-svn: 239076

9 years ago[Object, MachO] Cache parsed MachO header in MachOObjectFile. NFC.
Alexey Samsonov [Thu, 4 Jun 2015 19:22:03 +0000 (19:22 +0000)]
[Object, MachO] Cache parsed MachO header in MachOObjectFile. NFC.

Summary:
Avoid parsing object file each time MachOObjectFile::getHeader() is
called. Instead, cache the header in MachOObjectFile constructor, where
it's parsed anyway. In future, we must avoid constructing the object
at all if the header can't be parsed.

Test Plan: regression test suite.

Reviewers: rafael

Subscribers: llvm-commits
llvm-svn: 239075

9 years agoFix buildbot failure on Windows by relaxing test expectations.
Alexey Samsonov [Thu, 4 Jun 2015 19:22:00 +0000 (19:22 +0000)]
Fix buildbot failure on Windows by relaxing test expectations.

llvm-svn: 239074

9 years agoCOFF: Add /failifmismatch option.
Rui Ueyama [Thu, 4 Jun 2015 19:21:24 +0000 (19:21 +0000)]
COFF: Add /failifmismatch option.

llvm-svn: 239073

9 years agoAdd comments.
Rui Ueyama [Thu, 4 Jun 2015 19:21:22 +0000 (19:21 +0000)]
Add comments.

llvm-svn: 239072

9 years ago[bpf] add big- and host- endian support
Alexei Starovoitov [Thu, 4 Jun 2015 19:15:05 +0000 (19:15 +0000)]
[bpf] add big- and host- endian support

Summary:
-march=bpf    -> host endian
-march=bpf_le -> little endian
-match=bpf_be -> big endian

Test Plan:
v1 was tested by IBM s390 guys and appears to be working there.
It bit rots too fast here.

Reviewers: chandlerc, tstellarAMD

Subscribers: llvm-commits

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

llvm-svn: 239071

9 years ago[DAGCombiner] Fix wrong folding of a build_vector into a blend with zero.
Andrea Di Biagio [Thu, 4 Jun 2015 19:15:01 +0000 (19:15 +0000)]
[DAGCombiner] Fix wrong folding of a build_vector into a blend with zero.

Method 'visitBUILD_VECTOR' in the DAGCombiner knows how to combine a
build_vector of a bunch of extract_vector_elt nodes and constant zero nodes
into a shuffle blend with a zero vector.

However, method 'visitBUILD_VECTOR' forgot that a floating point
build_vector may contain negative zero as well as positive zero.

Example:

define <2 x double> @example(<2 x double> %A) {
entry:
  %0 = extractelement <2 x double> %A, i32 0
  %1 = insertelement <2 x double> undef, double %0, i32 0
  %2 = insertelement <2 x double> %1, double -0.0, i32 1
  ret <2 x double> %2
}

Before this patch, llc (with -mattr=+sse4.1) wrongly generated
  movq   %xmm0, %xmm0  # xmm0 = xmm0[0],zero

So, the sign bit of the negative zero was effectively lost.

This patch fixes the problem by adding explicit checks for positive zero.

With this patch, llc produces the following code for the example above:
  movhpd .LCPI0_0(%rip), %xmm0

where .LCPI0_0 referes to a 'double -0'.

llvm-svn: 239070

9 years agoFix the check for Ninja in the CMake build.
Evgeniy Stepanov [Thu, 4 Jun 2015 18:54:16 +0000 (18:54 +0000)]
Fix the check for Ninja in the CMake build.

The current check never passes, because CMAKE_MAKE_PROGRAM, at least on Linux,
includes the full path to the "ninja" binary; this effectively disables
compile/link jobs pools.

Use CMAKE_GENERATOR STREQUAL "Ninja" as a more reliable check.

llvm-svn: 239069

9 years agoMake test case more readable: move CHECK-lines next to corresponding RUN-lines.
Alexey Samsonov [Thu, 4 Jun 2015 18:50:04 +0000 (18:50 +0000)]
Make test case more readable: move CHECK-lines next to corresponding RUN-lines.

llvm-svn: 239068

9 years agoFix the test to use the correct size.
Rafael Espindola [Thu, 4 Jun 2015 18:49:12 +0000 (18:49 +0000)]
Fix the test to use the correct size.

For some reason llvm's r239045 made lld propagate data_1's size. This indicates
a bug somewhere in lld.

I hesitated between changing the test or just checking in a .o produced with
the old llvm-mc. Since the size is now correct, it seemed better to update the
test.

llvm-svn: 239067

9 years ago[PowerPC] This revision adds 68 of the missing "Predefined Functions for Vector Progr...
Bill Seurer [Thu, 4 Jun 2015 18:45:44 +0000 (18:45 +0000)]
[PowerPC] This revision adds 68 of the missing "Predefined Functions for Vector Programming" from appendix A of the OpenPOWER ABI for Linux Supplement document.

I also added tests for the new functions and updated another test that was looking for specific line numbers in error messages from altivec.h.

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

http://reviews.llvm.org/D10131

llvm-svn: 239066

9 years agollvm-objdump: return non-zero exit code for certain cases of invalid input
Alexey Samsonov [Thu, 4 Jun 2015 18:34:11 +0000 (18:34 +0000)]
llvm-objdump: return non-zero exit code for certain cases of invalid input

* If the input file is missing;
* If the type of input object file can't be recognized;
* If the object file can't be parsed correctly.

llvm-svn: 239065

9 years agoC++11 rangify for loop.
Yaron Keren [Thu, 4 Jun 2015 18:33:04 +0000 (18:33 +0000)]
C++11 rangify for loop.

llvm-svn: 239064

9 years ago[tsan] Disable a flaky test.
Evgeniy Stepanov [Thu, 4 Jun 2015 18:28:35 +0000 (18:28 +0000)]
[tsan] Disable a flaky test.

llvm-svn: 239063

9 years ago[APInt] Remove special case for i1.
Benjamin Kramer [Thu, 4 Jun 2015 18:19:13 +0000 (18:19 +0000)]
[APInt] Remove special case for i1.

Add a unit test.

llvm-svn: 239062

9 years agoUse owning pointers to avoid memory leaks
Tobias Grosser [Thu, 4 Jun 2015 17:59:54 +0000 (17:59 +0000)]
Use owning pointers to avoid memory leaks

This fixes a memory leak caused by us not freeing the expanded region nodes.

llvm-svn: 239061

9 years agoDisable output for test case that does not need output
Tobias Grosser [Thu, 4 Jun 2015 17:59:51 +0000 (17:59 +0000)]
Disable output for test case that does not need output

llvm-svn: 239060

9 years agoAllow case-insensitive values for -mcpu for ARM
Gabor Ballabas [Thu, 4 Jun 2015 17:56:32 +0000 (17:56 +0000)]
Allow case-insensitive values for -mcpu for ARM

GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.

llvm-svn: 239059

9 years agoTest commit access.
Gabor Ballabas [Thu, 4 Jun 2015 17:30:26 +0000 (17:30 +0000)]
Test commit access.

Fix trailing whitespace.

llvm-svn: 239058

9 years agoFix some sign compare warnings.
Jonathan Peyton [Thu, 4 Jun 2015 17:29:13 +0000 (17:29 +0000)]
Fix some sign compare warnings.

This change changes kmp_bstate.old_tid to sign integer instead of unsigned integer.
It also defines two new macros KMP_NSEC_PER_SEC and KMP_USEC_PER_SEC which lets us take
control of the sign (we want them to be longs).  Also, in kmp_wait_release.h, the byteref()
function's return type is changed from char to unsigned char.

llvm-svn: 239057

9 years ago[SDag switch lowering] Simplify code a bit. No functional change intended.
Benjamin Kramer [Thu, 4 Jun 2015 17:07:59 +0000 (17:07 +0000)]
[SDag switch lowering] Simplify code a bit. No functional change intended.

llvm-svn: 239056

9 years agoFix doxygen warnings.
Bruce Mitchener [Thu, 4 Jun 2015 16:53:46 +0000 (16:53 +0000)]
Fix doxygen warnings.

Summary:
Building the doxygen target presented some warnings which are now
addressed by this patch.

Test Plan: Ran doxygen build target and these warnings were no longer present.

Subscribers: lldb-commits

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

llvm-svn: 239055

9 years ago[clang-tidy] Force braces around leaf 'else if' for consistency.
Samuel Benzaquen [Thu, 4 Jun 2015 16:36:58 +0000 (16:36 +0000)]
[clang-tidy] Force braces around leaf 'else if' for consistency.

Summary:
Force braces around leaf 'else if' for consistency.
This complements r233697.

Reviewers: alexfh

Subscribers: curdeius, cfe-commits

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

llvm-svn: 239054

9 years agoR600/SI: Reimplement isLegalAddressingMode
Matt Arsenault [Thu, 4 Jun 2015 16:17:42 +0000 (16:17 +0000)]
R600/SI: Reimplement isLegalAddressingMode

Now that we sometimes know the address space, this can
theoretically do a better job.

This needs better test coverage, but this mostly depends on
first updating the loop optimizatiosn to provide the address
space.

llvm-svn: 239053

9 years agoCodeGenPrepare: Provide address space to isLegalAddressingMode
Matt Arsenault [Thu, 4 Jun 2015 16:17:38 +0000 (16:17 +0000)]
CodeGenPrepare: Provide address space to isLegalAddressingMode

Use -1 as the address space if it can't be determined.

llvm-svn: 239052

9 years agoPass address space to isLegalAddressingMode in DAGCombiner
Matt Arsenault [Thu, 4 Jun 2015 16:17:34 +0000 (16:17 +0000)]
Pass address space to isLegalAddressingMode in DAGCombiner

No test because I don't know of a target that makes use
of address spaces and indexed load / store.

llvm-svn: 239051

9 years agoStore ArrayShape in shared_ptr and MemAccs as actual objects
Tobias Grosser [Thu, 4 Jun 2015 16:03:16 +0000 (16:03 +0000)]
Store ArrayShape in shared_ptr and MemAccs as actual objects

This fixes two more memory leaks.

llvm-svn: 239050

9 years agoR600/SI: Fix some cases for load / store of half
Matt Arsenault [Thu, 4 Jun 2015 16:00:27 +0000 (16:00 +0000)]
R600/SI: Fix some cases for load / store of half

Mostly argument loads were producing broken zextloads
from an FP type.

llvm-svn: 239049

9 years agoSwitch lowering: fix assert in buildBitTests (PR23738)
Hans Wennborg [Thu, 4 Jun 2015 15:55:00 +0000 (15:55 +0000)]
Switch lowering: fix assert in buildBitTests (PR23738)

When checking (High - Low + 1).sle(BitWidth), BitWidth would be truncated
to the size of the left-hand side. In the case of this PR, the left-hand
side was i4, so BitWidth=64 got truncated to 0 and the assert failed.

llvm-svn: 239048

9 years ago[SPARC] Fix multiarch path detection for sparc and sparcv9.
James Y Knight [Thu, 4 Jun 2015 15:36:30 +0000 (15:36 +0000)]
[SPARC] Fix multiarch path detection for sparc and sparcv9.

llvm-svn: 239047

9 years ago[SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on Linux.
James Y Knight [Thu, 4 Jun 2015 15:36:29 +0000 (15:36 +0000)]
[SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on Linux.

They should be 'int' instead of 'long int' everywhere else except
NetBSD too, from what I gather in GCC's spec files. So, optimistically
changing it for everyone else, too.

llvm-svn: 239046

9 years agoOmit unused section symbols from the symbol table.
Rafael Espindola [Thu, 4 Jun 2015 15:33:30 +0000 (15:33 +0000)]
Omit unused section symbols from the symbol table.

Section symbols exist as an optimization: instead of having multiple relocations
point to different symbols, many of them can point to a single section symbol.

When that optimization is unused, a section symbol is also unused and adds no
extra information to the object file.

This saves a bit of space on the object files and makes the output of
llvm-objdump -t easier to read and consequently some tests get quite a bit
simpler.

llvm-svn: 239045

9 years ago[CMake] Add warning for using compile and link pools on unsupported versions of CMake...
Chris Bieneman [Thu, 4 Jun 2015 15:33:08 +0000 (15:33 +0000)]
[CMake] Add warning for using compile and link pools on unsupported versions of CMake or non-ninja generators.

Summary: I've gotten feedback from users on CMake 2.8 that the compile and link pool options were not working. This is expected so I'm adding a warning so we can report invalid configurations to users.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 239044

9 years agoMove test that depends on x86 to the x86 directory.
Rafael Espindola [Thu, 4 Jun 2015 15:25:47 +0000 (15:25 +0000)]
Move test that depends on x86 to the x86 directory.

llvm-svn: 239043

9 years agoNo need to check the raw relocation bytes if checking the parsed dump.
Rafael Espindola [Thu, 4 Jun 2015 15:21:17 +0000 (15:21 +0000)]
No need to check the raw relocation bytes if checking the parsed dump.

llvm-svn: 239042

9 years agollvm-readobj can parse relocations, no need to check the raw bytes.x
Rafael Espindola [Thu, 4 Jun 2015 15:15:12 +0000 (15:15 +0000)]
llvm-readobj can parse relocations, no need to check the raw bytes.x

llvm-svn: 239041

9 years agoReplace custom fixed endian to raw_ostream emission with EndianStream.
Benjamin Kramer [Thu, 4 Jun 2015 15:03:02 +0000 (15:03 +0000)]
Replace custom fixed endian to raw_ostream emission with EndianStream.

Less code, clearer and more efficient. No functionality change intended.

llvm-svn: 239040

9 years agoDisassemble the start of sections even if there is no symbol there.
Rafael Espindola [Thu, 4 Jun 2015 15:01:05 +0000 (15:01 +0000)]
Disassemble the start of sections even if there is no symbol there.

We already handled a section with no symbols, extend that to also handle a
section with symbols that don't include the section start.

llvm-svn: 239039

9 years agoRemove extraneous qualifiers due to "using namespace". NFC
Douglas Katzman [Thu, 4 Jun 2015 14:40:44 +0000 (14:40 +0000)]
Remove extraneous qualifiers due to "using namespace". NFC

llvm-svn: 239038

9 years agoDon't create a MIN/MAX node if the underlying compare has more than one use.
James Molloy [Thu, 4 Jun 2015 13:48:23 +0000 (13:48 +0000)]
Don't create a MIN/MAX node if the underlying compare has more than one use.

If the compare in a select pattern has another use then it can't be removed, so we'd just
be creating repeated code if we created a min/max node.

Spotted by Matt Arsenault!

llvm-svn: 239037

9 years agoReplace string GNU Triples with llvm::Triple in MCAsmInfo subclasses and create*AsmIn...
Daniel Sanders [Thu, 4 Jun 2015 13:12:25 +0000 (13:12 +0000)]
Replace string GNU Triples with llvm::Triple in MCAsmInfo subclasses and create*AsmInfo(). NFC.

Summary:
This is the first of several patches to eliminate StringRef forms of GNU
triples from the internals of LLVM. After this is complete, GNU triples
will be replaced by a more authoratitive representation in the form of
an LLVM TargetTuple.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: ted, llvm-commits, rengolin, jholewinski

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

llvm-svn: 239036

9 years agoInclude BPF target in CMake builds.
Daniel Sanders [Thu, 4 Jun 2015 12:51:20 +0000 (12:51 +0000)]
Include BPF target in CMake builds.

llvm-svn: 239035

9 years agoTidy code in InstrProfiling.cpp. NFC.
Diego Novillo [Thu, 4 Jun 2015 11:45:32 +0000 (11:45 +0000)]
Tidy code in InstrProfiling.cpp. NFC.

Removed the redundant "llvm::" from class names in InstrProfiling.cpp
clang-format is ran on the changes.

Patch from Betul Buyukkurt.

llvm-svn: 239034

9 years agoStore comparison objects as objects, not pointers
Tobias Grosser [Thu, 4 Jun 2015 11:44:09 +0000 (11:44 +0000)]
Store comparison objects as objects, not pointers

This fixes a memory leak. If we store the actual objects we can not forget to
free them.

llvm-svn: 239033

9 years ago[C API] Add LLVMStructGetTypeAtIndex.
Peter Zotov [Thu, 4 Jun 2015 09:09:53 +0000 (09:09 +0000)]
[C API] Add LLVMStructGetTypeAtIndex.

Patch by deadalnix (Amaury SECHET).

llvm-svn: 239029

9 years agoUse the appropriate PIE level for OpenBSD/sparc.
Brad Smith [Thu, 4 Jun 2015 08:45:23 +0000 (08:45 +0000)]
Use the appropriate PIE level for OpenBSD/sparc.

llvm-svn: 239028

9 years ago[ASan] Fix Darwin and Windows builds.
Yury Gribov [Thu, 4 Jun 2015 07:56:19 +0000 (07:56 +0000)]
[ASan] Fix Darwin and Windows builds.

llvm-svn: 239027