oota-llvm.git
8 years ago[Support] Fix a race initializing a static local in MSVC
Reid Kleckner [Thu, 11 Jun 2015 22:22:45 +0000 (22:22 +0000)]
[Support] Fix a race initializing a static local in MSVC

static local initialization isn't thread safe with MSVC and a race was
reported in PR23817. We can't use std::atomic because it's not trivially
constructible, so instead do some lame volatile global integer
manipulation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239566 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUpdate stale comment before analyzeLoopUnrollCost. NFC.
Michael Zolotukhin [Thu, 11 Jun 2015 22:17:39 +0000 (22:17 +0000)]
Update stale comment before analyzeLoopUnrollCost. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239565 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Orc] Remove some unnecesary includes and whitespace that slipped in to r239561.
Lang Hames [Thu, 11 Jun 2015 22:12:24 +0000 (22:12 +0000)]
[Orc] Remove some unnecesary includes and whitespace that slipped in to r239561.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239564 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Orc] Make partition identification in the CompileOnDemand layer lazy.
Lang Hames [Thu, 11 Jun 2015 21:45:19 +0000 (21:45 +0000)]
[Orc] Make partition identification in the CompileOnDemand layer lazy.

This also breaks out the logical dylib symbol resolution logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239561 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoObject: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.
Peter Collingbourne [Thu, 11 Jun 2015 21:42:18 +0000 (21:42 +0000)]
Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.

We cannot prepend __imp_ in the IR mangler because a function reference may
be emitted unmangled in a constant initializer. The linker is expected to
resolve such references to thunks. This is covered by the new test case.

Strictly speaking we ought to emit two undefined symbols, one with __imp_ and
one without, as we cannot know which symbol the final object file will refer
to. However, this would require rather intrusive changes to IRObjectFile,
and lld works fine without it for now.

This reimplements r239437, which was reverted in r239502.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239560 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLTO: expose LTO_SYMBOL_COMDAT flag, which indicates that the definition is part of...
Peter Collingbourne [Thu, 11 Jun 2015 21:41:27 +0000 (21:41 +0000)]
LTO: expose LTO_SYMBOL_COMDAT flag, which indicates that the definition is part of a comdat group.

Reviewers: rafael

Subscribers: llvm-commits, ruiu

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239559 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix English usage in command line flag help string.
Douglas Katzman [Thu, 11 Jun 2015 20:03:23 +0000 (20:03 +0000)]
Fix English usage in command line flag help string.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239556 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ELF] Introduce getValue() for ELF Symbols.
Davide Italiano [Thu, 11 Jun 2015 19:59:04 +0000 (19:59 +0000)]
[ELF] Introduce getValue() for ELF Symbols.

Differential Revision: http://reviews.llvm.org/D10328
Reviewed by: rafael

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239555 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace string GNU Triples with llvm::Triple in TargetMachine. NFC.
Daniel Sanders [Thu, 11 Jun 2015 19:41:26 +0000 (19:41 +0000)]
Replace string GNU Triples with llvm::Triple in TargetMachine. NFC.

Summary:
For the moment, TargetMachine::getTargetTriple() still returns a StringRef.

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: ted, llvm-commits, rengolin, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239554 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CodeGen] ArrayRef'ize cond/pred in various TII APIs. NFC.
Ahmed Bougacha [Thu, 11 Jun 2015 19:30:37 +0000 (19:30 +0000)]
[CodeGen] ArrayRef'ize cond/pred in various TII APIs. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239553 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoGeneralize emitAbsoluteSymbolDiff.
Rafael Espindola [Thu, 11 Jun 2015 18:58:08 +0000 (18:58 +0000)]
Generalize emitAbsoluteSymbolDiff.

This makes emitAbsoluteSymbolDiff always succeed and moves logic from the asm
printer to it.

The object one now also works on ELF. If two symbols are in the same fragment,
we will never move them apart.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239552 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSet proper debug location for branch added in BasicBlock::splitBasicBlock().
Alexey Samsonov [Thu, 11 Jun 2015 18:25:54 +0000 (18:25 +0000)]
Set proper debug location for branch added in BasicBlock::splitBasicBlock().

This improves debug locations in passes that do a lot of basic block
transformations. Important case is LoopUnroll pass, the test for correct
debug locations accompanies this change.

Test Plan: regression test suite

Reviewers: dblaikie, sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239551 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopUnroll] Use IRBuilder to create branch instructions.
Alexey Samsonov [Thu, 11 Jun 2015 18:25:44 +0000 (18:25 +0000)]
[LoopUnroll] Use IRBuilder to create branch instructions.

Use IRBuilder::Create(Cond)?Br instead of constructing instructions
manually with BranchInst::Create(). It's consistent with other
uses of IRBuilder in this pass, and has an additional important
benefit:

Using IRBuilder will ensure that new branch instruction will get
the same debug location as original terminator instruction it will
eventually replace.

For now I'm not adding a testcase, as currently original terminator
instruction also lack debug location due to missing debug location
propagation in BasicBlock::splitBasicBlock. That is, the testcase
will accompany the fix for the latter I'm going to mail soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239550 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace an instance of custom atomics with standard ones.
Benjamin Kramer [Thu, 11 Jun 2015 17:30:34 +0000 (17:30 +0000)]
Replace an instance of custom atomics with standard ones.

Eventually I want to get rid of them entirely, but Statistic.h is still blocked
on MSVC bugs. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239545 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoThis reverts commit r239529 and r239514.
Rafael Espindola [Thu, 11 Jun 2015 17:30:33 +0000 (17:30 +0000)]
This reverts commit r239529 and  r239514.

Revert "[AArch64] Match interleaved memory accesses into ldN/stN instructions."
Revert "Fixing MSVC 2013 build error."

The  test/CodeGen/AArch64/aarch64-interleaved-accesses.ll test was failing on OS X.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239544 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Fix merges of non-zero vector stores"
Reid Kleckner [Thu, 11 Jun 2015 17:25:24 +0000 (17:25 +0000)]
Revert "Fix merges of non-zero vector stores"

This reverts commit r239539.

It was causing SDAG assertions while building freetype.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239543 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix comment typos.
Douglas Katzman [Thu, 11 Jun 2015 16:46:27 +0000 (16:46 +0000)]
Fix comment typos.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239541 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSLSR: Pass address space to isLegalAddressingMode
Matt Arsenault [Thu, 11 Jun 2015 16:13:39 +0000 (16:13 +0000)]
SLSR: Pass address space to isLegalAddressingMode

This only updates one of the uses. The other is used in cases
that may never touch memory, so I'm not sure why this is even
calling it. Perhaps there should be a new, similar hook for such
cases or pass -1 for unknown address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239540 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix merges of non-zero vector stores
Matt Arsenault [Thu, 11 Jun 2015 16:03:52 +0000 (16:03 +0000)]
Fix merges of non-zero vector stores

Now actually stores the non-zero constant instead of 0.
I somehow forgot to include this part of r238108.

The test change was just an independent instruction order swap,
so just add another check line to satisfy CHECK-NEXT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239539 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace string GNU Triples with llvm::Triple in computeDataLayout(). NFC.
Daniel Sanders [Thu, 11 Jun 2015 15:34:59 +0000 (15:34 +0000)]
Replace string GNU Triples with llvm::Triple in computeDataLayout(). NFC.

Summary:
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, jfb, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239538 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoR600/SI: Define latency for flat instructions
Tom Stellard [Thu, 11 Jun 2015 14:51:50 +0000 (14:51 +0000)]
R600/SI: Define latency for flat instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239535 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoR600/SI: Move flat instruction defs to CIInstructions.td
Tom Stellard [Thu, 11 Jun 2015 14:51:49 +0000 (14:51 +0000)]
R600/SI: Move flat instruction defs to CIInstructions.td

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239534 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoR600/SI: Add -mcpu=bonaire to a test that uses flat address space
Tom Stellard [Thu, 11 Jun 2015 14:51:46 +0000 (14:51 +0000)]
R600/SI: Add -mcpu=bonaire to a test that uses flat address space

Flat instructions don't exist on SI, but there is a bug in the backend that
allows them to be selected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239533 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoremove function names from comments; NFC
Sanjay Patel [Thu, 11 Jun 2015 14:26:49 +0000 (14:26 +0000)]
remove function names from comments; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239532 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFixing MSVC 2013 build error.
Aaron Ballman [Thu, 11 Jun 2015 13:06:02 +0000 (13:06 +0000)]
Fixing MSVC 2013 build error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239529 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRecommit "[mips] [IAS] Add support for BNE and BEQ with an immediate operand." (r239396).
Toma Tabacu [Thu, 11 Jun 2015 10:36:10 +0000 (10:36 +0000)]
Recommit "[mips] [IAS] Add support for BNE and BEQ with an immediate operand." (r239396).

Apparently, Arcanist didn't include some of my local changes in my previous
commit attempt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239523 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips][microMIPS] Implement ERET and ERETNC instructions
Zoran Jovanovic [Thu, 11 Jun 2015 10:22:46 +0000 (10:22 +0000)]
[mips][microMIPS] Implement ERET and ERETNC instructions
http://reviews.llvm.org/D10091

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239522 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] Change existing uimm10 operand to restrict the accepted immediates
Zoran Jovanovic [Thu, 11 Jun 2015 09:51:58 +0000 (09:51 +0000)]
[mips] Change existing uimm10 operand to restrict the accepted immediates
http://reviews.llvm.org/D10312

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239520 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips][microMIPSr6] Change disassembler tests to one line format
Zoran Jovanovic [Thu, 11 Jun 2015 09:42:10 +0000 (09:42 +0000)]
[mips][microMIPSr6] Change disassembler tests to one line format

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239519 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopVectorize] Revert the enabling of interleaved memory access in Loop Vectorizor...
Hao Liu [Thu, 11 Jun 2015 09:18:07 +0000 (09:18 +0000)]
[LoopVectorize] Revert the enabling of interleaved memory access in Loop Vectorizor, which was wrongly committed in r239514.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239515 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Match interleaved memory accesses into ldN/stN instructions.
Hao Liu [Thu, 11 Jun 2015 09:05:02 +0000 (09:05 +0000)]
[AArch64] Match interleaved memory accesses into ldN/stN instructions.

Add a pass AArch64InterleavedAccess to identify and match interleaved memory accesses. This pass transforms an interleaved load/store into ldN/stN intrinsic. As Loop Vectorizor disables optimization on interleaved accesses by default, this optimization is also disabled by default. To enable it by "-aarch64-interleaved-access-opt=true"

E.g. Transform an interleaved load (Factor = 2):
       %wide.vec = load <8 x i32>, <8 x i32>* %ptr
       %v0 = shuffle %wide.vec, undef, <0, 2, 4, 6>  ; Extract even elements
       %v1 = shuffle %wide.vec, undef, <1, 3, 5, 7>  ; Extract odd elements
     Into:
       %ld2 = { <4 x i32>, <4 x i32> } call aarch64.neon.ld2(%ptr)
       %v0 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 0
       %v1 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 1

E.g. Transform an interleaved store (Factor = 2):
       %i.vec = shuffle %v0, %v1, <0, 4, 1, 5, 2, 6, 3, 7>  ; Interleaved vec
       store <8 x i32> %i.vec, <8 x i32>* %ptr
     Into:
       %v0 = shuffle %i.vec, undef, <0, 1, 2, 3>
       %v1 = shuffle %i.vec, undef, <4, 5, 6, 7>
       call void aarch64.neon.st2(%v0, %v1, %ptr)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239514 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LiveVariables] Improve isLiveOut runtime performances. NFC.
Arnaud A. de Grandmaison [Thu, 11 Jun 2015 07:50:21 +0000 (07:50 +0000)]
[LiveVariables] Improve isLiveOut runtime performances. NFC.

On large goto table based interpreters, where phi nodes can have (very) large
fan-ins, isLiveOut exhibited poor performances: about 40% of the full
codegen time was spent in PHIElim, sorting MachineBasicBlock addresses.

This patch improve the performances for such cases, and does not show
compile time regressions on the LNT, at bootstrap (llvm+clang+lldb) or
any other benchmarks we have in-house.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239510 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][SSE] Vectorized i8 and i16 shift operators
Simon Pilgrim [Thu, 11 Jun 2015 07:46:37 +0000 (07:46 +0000)]
[X86][SSE] Vectorized i8 and i16 shift operators

This patch ensures that SHL/SRL/SRA shifts for i8 and i16 vectors avoid scalarization. It builds on the existing i8 SHL vectorized implementation of moving the shift bits up to the sign bit position and separating the 4, 2 & 1 bit shifts with several improvements:

1 - SSE41 targets can use (v)pblendvb directly with the sign bit instead of performing a comparison to feed into a VSELECT node.
2 - pre-SSE41 targets were masking + comparing with an 0x80 constant - we avoid this by using the fact that a set sign bit means a negative integer which can be compared against zero to then feed into VSELECT, avoiding the need for a constant mask (zero generation is much cheaper).
3 - SRA i8 needs to be unpacked to the upper byte of a i16 so that the i16 psraw instruction can be correctly used for sign extension - we have to do more work than for SHL/SRL but perf tests indicate that this is still beneficial.

The i16 implementation is similar but simpler than for i8 - we have to do 8, 4, 2 & 1 bit shifts but less shift masking is involved. SSE41 use of (v)pblendvb requires that the i16 shift amount is splatted to both bytes however.

Tested on SSE2, SSE41 and AVX machines.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239509 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PHIElim] Use ranges and const-ify, NFC.
Arnaud A. de Grandmaison [Thu, 11 Jun 2015 07:45:05 +0000 (07:45 +0000)]
[PHIElim] Use ranges and const-ify, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239508 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLLVM support for vector quad bit permute and gather instructions through builtins
Nemanja Ivanovic [Thu, 11 Jun 2015 06:21:25 +0000 (06:21 +0000)]
LLVM support for vector quad bit permute and gather instructions through builtins

This patch corresponds to review:
http://reviews.llvm.org/D10096

This is the back end portion of the patch related to D10095.
The patch adds the instructions and back end intrinsics for:
vbpermq
vgbbd

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239505 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Move dllimport name mangling to IR mangler."
Reid Kleckner [Thu, 11 Jun 2015 01:31:48 +0000 (01:31 +0000)]
Revert "Move dllimport name mangling to IR mangler."

This reverts commit r239437.

This broke clang-cl self-hosts. We'd end up calling the __imp_ symbol
directly instead of using it to do an indirect function call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239502 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove MachineModuleInfo::UsedFunctions as it has no users.
Pete Cooper [Thu, 11 Jun 2015 01:04:56 +0000 (01:04 +0000)]
Remove MachineModuleInfo::UsedFunctions as it has no users.

It hasn't been used since r130964.

This also removes MachineModuleInfo::isUsedFunction and
MachineModuleInfo::AnalyzeModule, both of which were only
there to support UsedFunctions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239501 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agochange assert that will never fire to llvm_unreachable
Sanjay Patel [Wed, 10 Jun 2015 23:27:33 +0000 (23:27 +0000)]
change assert that will never fire to llvm_unreachable

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239497 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[NFC] added a missing space
Jingyue Wu [Wed, 10 Jun 2015 22:54:02 +0000 (22:54 +0000)]
[NFC] added a missing space

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239495 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoStop returning a Use* from allocHungOffUses.
Pete Cooper [Wed, 10 Jun 2015 22:38:46 +0000 (22:38 +0000)]
Stop returning a Use* from allocHungOffUses.

This always just set the User::OperandList which is now set
in that method instead of being returned.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239493 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd User::growHungoffUses and use it to grow the hung off uses. NFC.
Pete Cooper [Wed, 10 Jun 2015 22:38:41 +0000 (22:38 +0000)]
Add User::growHungoffUses and use it to grow the hung off uses. NFC.

PhiNode, SwitchInst, LandingPad and IndirectBr all had virtually identical
logic for growing the hung off uses.
Move it to User so that they can all call a single shared implementation.

Their destructors were all empty after this change and were deleted.  They all
have virtual clone_impl methods which can be used as vtable anchors.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239492 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDelete User::dropHungOffUses and move it in to ~User which is the only caller. NFC.
Pete Cooper [Wed, 10 Jun 2015 22:38:38 +0000 (22:38 +0000)]
Delete User::dropHungOffUses and move it in to ~User which is the only caller. NFC.

Now that the subclasses which care about hung off uses let ~User clean it up,
there's no need for a separate method.  Just inline it to ~User and delete it.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239491 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake User track whether a class has 'hung off uses' and delete them in its destructor.
Pete Cooper [Wed, 10 Jun 2015 22:38:34 +0000 (22:38 +0000)]
Make User track whether a class has 'hung off uses' and delete them in its destructor.

Currently all of the logic for deleting hung off uses, which PHI/switch/etc use,
is in their classes.

This adds a bit to Value which tracks whether that user had hung off uses,
then User can be responsible for clearing them instead of the sub classes.

Note, the bit used here was taken from NumOperands which was 30-bits.
Given the reduction to 29 bits, and the average User being just over 100 bytes,
a single User with 29-bits of num operands would need 50GB of RAM for itself
so its reasonable to assume that 29-bits is enough for now.

This is a step towards hiding all the hung off uses logic in the User.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239490 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMove the special Phi logic for hung off uses in to User::allocHungOffUses. NFC.
Pete Cooper [Wed, 10 Jun 2015 22:38:30 +0000 (22:38 +0000)]
Move the special Phi logic for hung off uses in to User::allocHungOffUses. NFC.

PhiNode's need to allocate space for an array of Use[N] and then BasicBlock*[N].

They had their own allocHungOffUses to handle all of this.  This moves the logic
in to User::allocHungOffUses and PhiNode passes in a bool to say to allocate
the BB* space too.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239489 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoArgumentPromotion: Drop sret attribute on functions that are only called directly.
Peter Collingbourne [Wed, 10 Jun 2015 21:14:34 +0000 (21:14 +0000)]
ArgumentPromotion: Drop sret attribute on functions that are only called directly.

If the first argument to a function is a 'this' argument and the second
has the sret attribute, the ArgumentPromotion pass may promote the 'this'
argument to more than one argument, violating the IR constraint that 'sret'
may only be applied to the first or second argument.

Although this IR constraint is arguably unnecessary, it highlighted the fact
that ArgPromotion does not need to preserve this attribute. Dropping the
attribute reduces register pressure in the backend by avoiding the register
copy required by sret. Because sret implies noalias, we also replace the
former with the latter.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239488 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[x86] Add a reassociation optimization to increase ILP via the MachineCombiner pass
Sanjay Patel [Wed, 10 Jun 2015 20:32:21 +0000 (20:32 +0000)]
[x86] Add a reassociation optimization to increase ILP via the MachineCombiner pass

This is a reimplementation of D9780 at the machine instruction level rather than the DAG.

Use the MachineCombiner pass to reassociate scalar single-precision AVX additions (just a
starting point; see the TODO comments) to increase ILP when it's safe to do so.

The code is closely based on the existing MachineCombiner optimization that is implemented
for AArch64.

This patch should not cause the kind of spilling tragedy that led to the reversion of r236031.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239486 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agopunctuation policing; NFC
Sanjay Patel [Wed, 10 Jun 2015 19:52:58 +0000 (19:52 +0000)]
punctuation policing; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239484 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] _except_handlerN uses 0 instead of 1 to indicate catch-all
Reid Kleckner [Wed, 10 Jun 2015 18:14:07 +0000 (18:14 +0000)]
[WinEH] _except_handlerN uses 0 instead of 1 to indicate catch-all

Our usage of 1 was a holdover from __C_specific_handler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239482 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd new EliminateAvailableExternally module pass, which is performed in
Teresa Johnson [Wed, 10 Jun 2015 17:49:28 +0000 (17:49 +0000)]
Add new EliminateAvailableExternally module pass, which is performed in
O2 compiles just before GlobalDCE, unless we are preparing for LTO.

This pass eliminates available externally globals (turning them into
declarations), regardless of whether they are dead/unreferenced, since
we are guaranteed to have a copy available elsewhere at link time.
This enables additional opportunities for GlobalDCE.

If we are preparing for LTO (e.g. a -flto -c compile), the pass is not
included as we want to preserve available externally functions for possible
link time inlining. The FE indicates whether we are doing an -flto compile
via the new PrepareForLTO flag on the PassManagerBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239480 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[GVN] Set proper debug locations for some instructions created by GVN.
Alexey Samsonov [Wed, 10 Jun 2015 17:37:38 +0000 (17:37 +0000)]
[GVN] Set proper debug locations for some instructions created by GVN.

Determining proper debug locations for instructions created in
PHITransAddr is tricky. We use a simple approach here and simply copy
debug locations from instructions computing load address to
"corresponding" instructions re-creating the address computation
in predecessor basic blocks.

This may not always be correct, given all the rearrangement and
simplification going on, and debug locations may jump around a lot,
as the basic blocks we copy locations between may be very far from
each other.

Still, this would work good in most simple cases (e.g. when chain
of address computing instruction is short, or our mapping turns out
to be 1-to-1), and we desire to have *some* reasonable debug locations
associated with newly inserted instructions.

See http://reviews.llvm.org/D10351 review thread for more details.

Test Plan: regression test suite

Reviewers: spatel, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239479 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agofix typo in comment; NFC
Sanjay Patel [Wed, 10 Jun 2015 17:08:12 +0000 (17:08 +0000)]
fix typo in comment; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239478 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Adding decoders for signed operands and ensuring all signed operand types...
Colin LeMahieu [Wed, 10 Jun 2015 16:52:32 +0000 (16:52 +0000)]
[Hexagon] Adding decoders for signed operands and ensuring all signed operand types disassemble correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239477 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Make global arrays 'static const'. NFC.
Benjamin Kramer [Wed, 10 Jun 2015 14:43:59 +0000 (14:43 +0000)]
[Hexagon] Make global arrays 'static const'. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239475 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Statepoints] Add test case to check that statepoint is marked with Throwable attribute.
Igor Laevsky [Wed, 10 Jun 2015 13:24:00 +0000 (13:24 +0000)]
[Statepoints] Add test case to check that statepoint is marked with Throwable attribute.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239473 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[StatepointLowering] Reuse stack slots across basic blocks
Igor Laevsky [Wed, 10 Jun 2015 12:31:53 +0000 (12:31 +0000)]
[StatepointLowering] Reuse stack slots across basic blocks

During statepoint lowering we can sometimes avoid spilling of the value if we know that it was already spilled for previous statepoint.
We were doing this by checking if incoming statepoint value was lowered into load from stack slot. This was working only in boundaries of one basic block.

But instead of looking at the lowered node we can look directly at the llvm-ir value and if it was gc.relocate (or some simple modification of it) look up stack slot for it's derived pointer and reuse stack slot from it. This allows us to look across basic block boundaries.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239472 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace string GNU Triples with llvm::Triple in MCSubtargetInfo and create*MCSubtarge...
Daniel Sanders [Wed, 10 Jun 2015 12:11:26 +0000 (12:11 +0000)]
Replace string GNU Triples with llvm::Triple in MCSubtargetInfo and create*MCSubtargetInfo(). NFC.

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

Reviewers: rafael

Reviewed By: rafael

Subscribers: rafael, ted, jfb, llvm-commits, rengolin, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239467 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace string GNU Triples with llvm::Triple in create*MCRelocationInfo(). NFC.
Daniel Sanders [Wed, 10 Jun 2015 10:54:40 +0000 (10:54 +0000)]
Replace string GNU Triples with llvm::Triple in create*MCRelocationInfo(). NFC.

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

Reviewers: rafael

Reviewed By: rafael

Subscribers: rafael, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239465 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace string GNU Triples with llvm::Triple in MCAsmBackend subclasses and create...
Daniel Sanders [Wed, 10 Jun 2015 10:35:34 +0000 (10:35 +0000)]
Replace string GNU Triples with llvm::Triple in MCAsmBackend subclasses and create*AsmBackend(). NFC.

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

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rafael, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239464 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAVX-512: Fixed a bug in comparison of i1 vectors.
Elena Demikhovsky [Wed, 10 Jun 2015 06:49:28 +0000 (06:49 +0000)]
AVX-512: Fixed a bug in comparison of i1 vectors.
cmp eq should give kxnor instruction
cmp neq should give kxor

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239460 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace magic number 19 with the constant GlobalValueSubClassDataBits.
Yaron Keren [Wed, 10 Jun 2015 06:00:59 +0000 (06:00 +0000)]
Replace magic number 19 with the constant GlobalValueSubClassDataBits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239459 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agofix crash
Alexei Starovoitov [Wed, 10 Jun 2015 03:06:06 +0000 (03:06 +0000)]
fix crash

fix segfault by checking for UnknownArch, since
getArchTypePrefix() will return nullptr for UnknownArch.

This fixes regression caused by r238424.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239456 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove unnecessary conversion from StringRef to std::string and back to StringRef...
Craig Topper [Wed, 10 Jun 2015 02:07:37 +0000 (02:07 +0000)]
Remove unnecessary conversion from StringRef to std::string and back to StringRef. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239455 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Call llvm.stackrestore in __except blocks
Reid Kleckner [Wed, 10 Jun 2015 01:34:54 +0000 (01:34 +0000)]
[WinEH] Call llvm.stackrestore in __except blocks

We have to do this manually, the runtime only sets up ebp. Fixes a crash
when returning after catching an exception.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239451 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove safeseh debug print and remove extra braces
Reid Kleckner [Wed, 10 Jun 2015 01:13:44 +0000 (01:13 +0000)]
Remove safeseh debug print and remove extra braces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239449 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Emit .safeseh directives for all 32-bit exception handlers
Reid Kleckner [Wed, 10 Jun 2015 01:02:30 +0000 (01:02 +0000)]
[WinEH] Emit .safeseh directives for all 32-bit exception handlers

Use a "safeseh" string attribute to do this. You would think we chould
just accumulate the set of personalities like we do on dwarf, but this
fails to account for the LSDA-loading thunks we use for
__CxxFrameHandler3. Each of those needs to make it into .sxdata as well.
The string attribute seemed like the most straightforward approach.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239448 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix -Wsign-compare warning in WinException.cpp
Reid Kleckner [Wed, 10 Jun 2015 00:04:53 +0000 (00:04 +0000)]
Fix -Wsign-compare warning in WinException.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239445 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix warning of comparing different enums. NFC
Pete Cooper [Tue, 9 Jun 2015 23:33:35 +0000 (23:33 +0000)]
Fix warning of comparing different enums.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239443 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd explicit -mtriple=arm-unknown to llvm/test/CodeGen/ARM/disable-tail-calls.ll...
NAKAMURA Takumi [Tue, 9 Jun 2015 23:33:25 +0000 (23:33 +0000)]
Add explicit -mtriple=arm-unknown to llvm/test/CodeGen/ARM/disable-tail-calls.ll, to satisfy *-win32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239442 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Move MCSymbol Value in to the union of Offset and CommonSize."
Pete Cooper [Tue, 9 Jun 2015 22:35:55 +0000 (22:35 +0000)]
Revert "Move MCSymbol Value in to the union of Offset and CommonSize."

This reverts commit 2e449ec5bcdf67b52b315b16c2128aaf25d5b73c.

This was svn r239440.  Its currently failing an ARM test so reverting while I work out
what to do next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239441 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMove MCSymbol Value in to the union of Offset and CommonSize.
Pete Cooper [Tue, 9 Jun 2015 22:21:37 +0000 (22:21 +0000)]
Move MCSymbol Value in to the union of Offset and CommonSize.

It wasn't possible to have a variable Symbol with offset or 'isCommon' so
this just enables better packing of the MCSymbol class.

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239440 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RegisterScavenger] Fix handling of predicated instructions
Tobias Edler von Koch [Tue, 9 Jun 2015 22:10:58 +0000 (22:10 +0000)]
[RegisterScavenger] Fix handling of predicated instructions

Summary:
The RegisterScavenger explicitly ignores <kill> flags on operands of
predicated instructions and therefore assumes that such registers remain
live. When it then scavenges such a register, it inserts a spill of this
(killed) register. This is invalid code and gets flagged up by the
verifier.

Nowadays kill flags are set correctly on predicated instructions. This
patch makes the Scavenger respect them.

The bug has so far only been triggered by an internal pass, so I don't
have a test case unfortunately.

Fixes PR23119.

Reviewers: hfinkel, tobiasvk_caf

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239439 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[BasicBlockUtils] Set debug locations for instructions created in SplitBlockPredecessors.
Alexey Samsonov [Tue, 9 Jun 2015 22:10:29 +0000 (22:10 +0000)]
[BasicBlockUtils] Set debug locations for instructions created in SplitBlockPredecessors.

Test Plan: regression test suite

Reviewers: eugenis, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239438 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMove dllimport name mangling to IR mangler.
Peter Collingbourne [Tue, 9 Jun 2015 22:09:53 +0000 (22:09 +0000)]
Move dllimport name mangling to IR mangler.

This ensures that LTO clients see the correct external symbol name.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239437 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[NVPTX] fix a crash bug in NVPTXFavorNonGenericAddrSpaces
Jingyue Wu [Tue, 9 Jun 2015 21:50:32 +0000 (21:50 +0000)]
[NVPTX] fix a crash bug in NVPTXFavorNonGenericAddrSpaces

Summary:
We used to assume V->RAUW only modifies the operand list of V's user.
However, if V and V's user are Constants, RAUW may replace and invalidate V's
user entirely.

This patch fixes the above issue by letting the caller replace the
operand instead of calling RAUW on Constants.

Test Plan: @nested_const_expr and @rauw in access-non-generic.ll

Reviewers: broune, jholewinski

Reviewed By: broune, jholewinski

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239435 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLibDriver, llvm-lib: introduce.
Peter Collingbourne [Tue, 9 Jun 2015 21:50:22 +0000 (21:50 +0000)]
LibDriver, llvm-lib: introduce.

llvm-lib is intended to be a lib.exe compatible utility that also
understands bitcode. The implementation lives in a library so that
lld can use it to implement /lib.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239434 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Add 32-bit SEH state table emission prototype
Reid Kleckner [Tue, 9 Jun 2015 21:42:19 +0000 (21:42 +0000)]
[WinEH] Add 32-bit SEH state table emission prototype

This gets all the handler info through to the asm printer and we can
look at the .xdata tables now. I've convinced one small catch-all test
case to work, but other than that, it would be a stretch to say this is
functional.

The state numbering algorithm avoids doing any scope reconstruction as
we do for C++ to simplify the implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239433 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Remove an overly conservative check when generating store pairs.
Chad Rosier [Tue, 9 Jun 2015 20:59:41 +0000 (20:59 +0000)]
[AArch64] Remove an overly conservative check when generating store pairs.

Store instructions do not modify register values and therefore it's safe
to form a store pair even if the source register has been read in between
the two store instructions.

Previously, the read of w1 (see below) prevented the formation of a stp.

        str      w0, [x2]
        ldr     w8, [x2, #8]
        add      w0, w8, w1
        str     w1, [x2, #4]
        ret

We now generate the following code.

        stp      w0, w1, [x2]
        ldr     w8, [x2, #8]
        add      w0, w8, w1
        ret

All correctness tests with -Ofast on A57 with Spec200x and EEMBC pass.
Performance results for SPEC2K were within noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239432 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse AlignOf traits to enable static_assert.
Pete Cooper [Tue, 9 Jun 2015 20:58:03 +0000 (20:58 +0000)]
Use AlignOf traits to enable static_assert.

This is better than runtime asserts.  Thanks to David Blaikie for the help here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239431 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReplace loop with std::equal. NFC intended.
Benjamin Kramer [Tue, 9 Jun 2015 20:41:21 +0000 (20:41 +0000)]
Replace loop with std::equal. NFC intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239430 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReduce duplication in MCSymbol Name handling. NFC>
Pete Cooper [Tue, 9 Jun 2015 20:41:08 +0000 (20:41 +0000)]
Reduce duplication in MCSymbol Name handling.  NFC>

Based on feedback to r239428 by David Blaikie, use const_cast to reduce
duplication of the const and non-const versions of getNameEntryPtr.

Also have that method return the pointer to the name directly instead
of users having to then get the name from the union.

Finally, add a FIXME that we should use a static_assert once available in
the new operator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239429 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake MCSymbol::Name be a union of uint64_t and a pointer.
Pete Cooper [Tue, 9 Jun 2015 19:56:05 +0000 (19:56 +0000)]
Make MCSymbol::Name be a union of uint64_t and a pointer.

This should hopefully fix the 32-bit bots which were allocating space for a pointer
but needed to be aligned to 64-bits.

Now we allocate enough space for a uint64_t and a pointer and cast to the appropriate storage

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239428 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove DisableTailCalls from TargetOptions and the code in resetTargetOptions
Akira Hatanaka [Tue, 9 Jun 2015 19:07:19 +0000 (19:07 +0000)]
Remove DisableTailCalls from TargetOptions and the code in resetTargetOptions
that was resetting it.

Remove the uses of DisableTailCalls in subclasses of TargetLowering and use
the value of function attribute "disable-tail-calls" instead. Also,
unconditionally add pass TailCallElim to the pipeline and check the function
attribute at the start of runOnFunction to disable the pass on a per-function
basis.

This is part of the work to remove TargetMachine::resetTargetOptions, and since
DisableTailCalls was the last non-fast-math option that was being reset in that
function, we should be able to remove the function entirely after the work to
propagate IR-level fast-math flags to DAG nodes is completed.

Out-of-tree users should remove the uses of DisableTailCalls and make changes
to attach attribute "disable-tail-calls"="true" or "false" to the functions in
the IR.

rdar://problem/13752163

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239427 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[bpf] enable BPF backend in autoconf build
Alexei Starovoitov [Tue, 9 Jun 2015 18:53:30 +0000 (18:53 +0000)]
[bpf] enable BPF backend in autoconf build

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239425 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoChange from alignof to llvm::alignOf to appease Visual Studio
Pete Cooper [Tue, 9 Jun 2015 18:50:18 +0000 (18:50 +0000)]
Change from alignof to llvm::alignOf to appease Visual Studio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239424 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAllocate space for MCSymbol::Name only if required.
Pete Cooper [Tue, 9 Jun 2015 18:36:13 +0000 (18:36 +0000)]
Allocate space for MCSymbol::Name only if required.

Similarly to User which allocates a number of Use's prior to the this pointer,
allocate space for the Name* for MCSymbol only when we need a name.

Given that an MCSymbol is 48-bytes on 64-bit systems, this saves a decent % of space.

Given the verify_uselistorder test case with debug info and llc, 50k symbols have names
out of 700k so this optimises for the common case of temporary unnamed symbols.

Reviewed by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239423 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMergeFunctions: Don't replace a weak function use by another equivalent weak function
Arnold Schwaighofer [Tue, 9 Jun 2015 18:19:17 +0000 (18:19 +0000)]
MergeFunctions: Don't replace a weak function use by another equivalent weak function

We don't know whether the weak functions definition is the definitive definition.

rdar://21303727

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239422 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[DWARF] Fix a few corner cases in expression emission"
David Blaikie [Tue, 9 Jun 2015 18:01:51 +0000 (18:01 +0000)]
Revert "[DWARF] Fix a few corner cases in expression emission"

This reverts commit r239380 due to apparently GDB regressions:
http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/22562

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239420 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoThe constant initialization for globals in NVPTX is generated as an
Samuel Antao [Tue, 9 Jun 2015 16:29:34 +0000 (16:29 +0000)]
The constant initialization for globals in NVPTX is generated as an
array of bytes. The generation of this byte arrays was expecting
the host to be little endian, which prevents big endian hosts to be
used in the generation of the PTX code. This patch fixes the
problem by changing the way the bytes are extracted so that it
works for either little and big endian.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239412 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd more wrappers for symbol APIs to the C API.
Eli Bendersky [Tue, 9 Jun 2015 15:57:30 +0000 (15:57 +0000)]
Add more wrappers for symbol APIs to the C API.

This represents some of the functionality we expose in the llvmlite Python
binding.

Patch by Antoine Pitrou

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239411 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[bpf] make BPF backend non-experimental
Alexei Starovoitov [Tue, 9 Jun 2015 15:46:00 +0000 (15:46 +0000)]
[bpf] make BPF backend non-experimental

only cmake build change. autoconf build and docs will follow

email thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-June/thread.html#86523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239410 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove object_error::success and use std::error_code() instead
Rui Ueyama [Tue, 9 Jun 2015 15:20:42 +0000 (15:20 +0000)]
Remove object_error::success and use std::error_code() instead

make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239409 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRecommit "[mips] [IAS] Restore STI.FeatureBits in .set pop." (r239144).
Toma Tabacu [Tue, 9 Jun 2015 13:33:26 +0000 (13:33 +0000)]
Recommit "[mips] [IAS] Restore STI.FeatureBits in .set pop." (r239144).

Specified the llvm namespace for the 2 calls to make_unique() which caused
compilation errors in Visual Studio 2013.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239405 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoX86-MPX: Implemented encoding for MPX instructions.
Elena Demikhovsky [Tue, 9 Jun 2015 13:02:10 +0000 (13:02 +0000)]
X86-MPX: Implemented encoding for MPX instructions.
Added encoding tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239403 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemoving spurious semi colons; NFC.
Aaron Ballman [Tue, 9 Jun 2015 12:03:46 +0000 (12:03 +0000)]
Removing spurious semi colons; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239399 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[mips] [IAS] Add support for BNE and BEQ with an immediate operand." (r239396).
Toma Tabacu [Tue, 9 Jun 2015 10:43:49 +0000 (10:43 +0000)]
Revert "[mips] [IAS] Add support for BNE and BEQ with an immediate operand." (r239396).

It was breaking buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239397 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] [IAS] Add support for BNE and BEQ with an immediate operand.
Toma Tabacu [Tue, 9 Jun 2015 10:34:31 +0000 (10:34 +0000)]
[mips] [IAS] Add support for BNE and BEQ with an immediate operand.

Summary:
For some branches, GAS accepts an immediate instead of the 2nd register operand.
We only implement this for BNE and BEQ for now. Other branch instructions can be added later, if needed.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: seanbruno, emaste, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239396 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[nvptx] Only support the 'm' inline assembly memory constraint. NFC.
Daniel Sanders [Tue, 9 Jun 2015 10:34:05 +0000 (10:34 +0000)]
[nvptx] Only support the 'm' inline assembly memory constraint. NFC.

Summary:
NVPTX doesn't seem to support any additional constraints. Therefore remove
the target hook.

No functional change intended.

Reviewers: jholewinski

Reviewed By: jholewinski

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239395 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ADT] Assert that SmallVectorBase::grow_pod() successfully reallocates memory.
Daniel Sanders [Tue, 9 Jun 2015 09:47:46 +0000 (09:47 +0000)]
[ADT] Assert that SmallVectorBase::grow_pod() successfully reallocates memory.

Summary:
If malloc/realloc fails then the SmallVector becomes unusable since begin() and
end() will return NULL. This is unlikely to occur but was the cause of recent
bugpoint test failures on my machine.

It is not clear whether not checking for malloc/realloc failure is a deliberate
decision and adding checks has the potential to impact compiler performance.
Therefore, this patch only adds the check to builds with assertions enabled for
the moment.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: bkramer, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239392 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMergeFunctions: Fix gcc warning in condition
Denis Protivensky [Tue, 9 Jun 2015 09:28:37 +0000 (09:28 +0000)]
MergeFunctions: Fix gcc warning in condition

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239391 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agollvm/test/DebugInfo/X86/expressions.ll: %llc_dwarf shouldn't be used with -mtriple...
NAKAMURA Takumi [Tue, 9 Jun 2015 08:03:33 +0000 (08:03 +0000)]
llvm/test/DebugInfo/X86/expressions.ll: %llc_dwarf shouldn't be used with -mtriple, since %llc_dwarf implies the triple.

In this case, use plain "llc".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239390 91177308-0d34-0410-b5e6-96231b3b80d8