platform/upstream/llvm.git
9 years ago[Stackmaps][X86] Remove EFLAGS and IP registers from the live-out mask.
Juergen Ributzka [Thu, 11 Jun 2015 22:40:04 +0000 (22:40 +0000)]
[Stackmaps][X86] Remove EFLAGS and IP registers from the live-out mask.

Remove the EFLAGS from the stackmap live-out mask. The EFLAGS register is not
supposed to be part of that set, because the X86 calling conventions mark the
register as NOT preserved.

Also remove the IP registers, since spilling and restoring those doesn't really
make any sense.

Related to rdar://problem/21019635.

llvm-svn: 239568

9 years ago[WinEH] Create an llvm.x86.seh.exceptioninfo intrinsic
Reid Kleckner [Thu, 11 Jun 2015 22:32:23 +0000 (22:32 +0000)]
[WinEH] Create an llvm.x86.seh.exceptioninfo intrinsic

This intrinsic is like framerecover plus a load. It recovers the EH
registration stack allocation from the parent frame and loads the
exception information field out of it, giving back a pointer to an
EXCEPTION_POINTERS struct. It's designed for clang to use in SEH filter
expressions instead of accessing the EXCEPTION_POINTERS parameter that
is available on x64.

This required a minor change to MC to allow defining a label variable to
another absolute framerecover label variable.

llvm-svn: 239567

9 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.

llvm-svn: 239566

9 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.

llvm-svn: 239565

9 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.

llvm-svn: 239564

9 years agoCOFF: Symbol resolution for common and comdat symbols defined in bitcode.
Peter Collingbourne [Thu, 11 Jun 2015 21:49:54 +0000 (21:49 +0000)]
COFF: Symbol resolution for common and comdat symbols defined in bitcode.

In the case where either a bitcode file and a regular file or two bitcode
files export a common or comdat symbol with the same name, the linker needs
to pick one of them following COFF semantics. This patch implements a design
for resolving such symbols that pushes most of the work onto either LLD's
regular mechanism for resolving common or comdat symbols or the IR linker's
mechanism for doing the same.

We modify SymbolBody::compare to always prefer non-bitcode symbols, so that
during the initial phase of symbol resolution, the symbol table always contains
a regular symbol in any case where we need to choose between a regular and
a bitcode symbol. In SymbolTable::addCombinedLTOObject, we force export
any bitcode symbols that were initially pre-empted by a regular symbol,
and later use SymbolBody::compare to choose between the regular symbol in
the symbol table and the regular symbol from the combined LTO object file.

This design seems to be sound, so long as the resolution mechanism is defined
to be commutative and associative modulo arbitrary choices between symbols
(which seems to be the case for COFF).

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

llvm-svn: 239563

9 years agoChange #ifdefs in test to UNSUPPORTED. No functionality change in the tests
Marshall Clow [Thu, 11 Jun 2015 21:47:39 +0000 (21:47 +0000)]
Change #ifdefs in test to UNSUPPORTED. No functionality change in the tests

llvm-svn: 239562

9 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.

llvm-svn: 239561

9 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

llvm-svn: 239560

9 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

llvm-svn: 239559

9 years ago[ms] Do lookup in dependent base classes also when overload resolution fails (PR23810)
Hans Wennborg [Thu, 11 Jun 2015 21:21:57 +0000 (21:21 +0000)]
[ms] Do lookup in dependent base classes also when overload resolution fails (PR23810)

This patch does two things in order to enable compilation of the problematic code in PR23810:

1. In Sema::buildOverloadedCallSet, it postpones lookup for MS mode when no
viable candidate is found in the overload set. Previously, lookup would only
be postponed here if the overload set was empty.

2. Make BuildRecoveryCallExpr call Sema::DiagnoseEmptyLookup under more circumstances.
There is a comment in DiagnoseTwoPhaseLookup that says "Don't diagnose names we find in
classes; we get much better diagnostics for these from DiagnoseEmptyLookup." The problem
was that DiagnoseEmptyLookup might not get called later, and we failed to recover.

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

llvm-svn: 239558

9 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.

llvm-svn: 239556

9 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

llvm-svn: 239555

9 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

llvm-svn: 239554

9 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.

llvm-svn: 239553

9 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.

llvm-svn: 239552

9 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

llvm-svn: 239551

9 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.

llvm-svn: 239550

9 years ago[CodeGen] Emit Constants for immediate inlineasm arguments.
Ahmed Bougacha [Thu, 11 Jun 2015 18:19:34 +0000 (18:19 +0000)]
[CodeGen] Emit Constants for immediate inlineasm arguments.

For inline assembly immediate constraints, we currently always use
EmitScalarExpr, instead of directly emitting the constant. When the
overflow sanitizer is enabled, this generates overflow intrinsics
instead of constants.

Instead, emit a constant for constraints that either require an
immediate (e.g. 'I' on X86), or only accepts constants (immediate
or symbolic; i.e., don't accept registers or memory).

Fixes PR19763.

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

llvm-svn: 239549

9 years agoclang-cl: Add an alias for /wd4910
Hans Wennborg [Thu, 11 Jun 2015 18:14:11 +0000 (18:14 +0000)]
clang-cl: Add an alias for /wd4910

llvm-svn: 239548

9 years agoSpell -Wdllexport-explicit-instantiation-decl correctly.
Hans Wennborg [Thu, 11 Jun 2015 17:51:58 +0000 (17:51 +0000)]
Spell -Wdllexport-explicit-instantiation-decl correctly.

llvm-svn: 239547

9 years agoRemove unused variables '__kmp_build_check_*' for non assert builds.
Jonathan Peyton [Thu, 11 Jun 2015 17:36:16 +0000 (17:36 +0000)]
Remove unused variables '__kmp_build_check_*' for non assert builds.

Add new LIBOMP_ENABLE_ASSERTIONS macro which can be set in a standalone build
or takes the value of LLVM_ENABLE_ASSERTIONS when inside llvm/projects.  This
change also defines the KMP_BUILD_ASSERT() macro to do nothing when ENABLE_ASSERTIONS
is off.  This means the __kmp_build_check_* types won't be defined and thus, no warnings.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000719.html

Patch by Jack Howarth and Jonathan Peyton

llvm-svn: 239546

9 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.

llvm-svn: 239545

9 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.

llvm-svn: 239544

9 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.

llvm-svn: 239543

9 years agoImplement recursive CMake.
Jonathan Peyton [Thu, 11 Jun 2015 17:23:57 +0000 (17:23 +0000)]
Implement recursive CMake.

Most CMake build systems put CMakeLists.txt files inside source directories where
items need to get built. This change follows that convention by adding a new
runtime/src/CMakeLists.txt file. An additional benefit is this helps logically
seperate configuring with building as well. This change is mostly just copying and
pasting the bottom half of runtime/CMakeLists.txt into runtime/src/CMakeLists.txt,
but a few changes had to be made to get it to work. Most of those changes were to
directory prefixes.

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

llvm-svn: 239542

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

llvm-svn: 239541

9 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.

llvm-svn: 239540

9 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.

llvm-svn: 239539

9 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

llvm-svn: 239538

9 years agoAdd comments to PrintActions1 and Driver::PrintActions.
Douglas Katzman [Thu, 11 Jun 2015 15:05:22 +0000 (15:05 +0000)]
Add comments to PrintActions1 and Driver::PrintActions.

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

llvm-svn: 239537

9 years agoadd the -mrecip driver flag and process its options (3rd try)
Sanjay Patel [Thu, 11 Jun 2015 14:53:41 +0000 (14:53 +0000)]
add the -mrecip driver flag and process its options (3rd try)

The 1st and 2nd tries to land this (r238055, r238851) were reverted due to
bot failures caused by the LLVM part of the patch. That was hopefully fixed
after r239001.

This is the front-end counterpart to D8982.

The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289

...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).

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

llvm-svn: 239536

9 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

llvm-svn: 239535

9 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

llvm-svn: 239534

9 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.

llvm-svn: 239533

9 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

llvm-svn: 239532

9 years agoclang-format: Make SFS_Inline imply SFS_Empty.
Daniel Jasper [Thu, 11 Jun 2015 13:31:45 +0000 (13:31 +0000)]
clang-format: Make SFS_Inline imply SFS_Empty.

In the long run, these two might be independent or we might to only
allow specific combinations. Until we have a corresponding request,
however, it is hard to do the right thing and choose the right
configuration options. Thus, just don't touch the options yet and
just modify the behavior slightly.

llvm-svn: 239531

9 years agoclang-format: [JS] Ensure that formatting actually takes place in tests.
Daniel Jasper [Thu, 11 Jun 2015 13:29:20 +0000 (13:29 +0000)]
clang-format: [JS] Ensure that formatting actually takes place in tests.

And fix formatting issue discovered by that :-).

llvm-svn: 239530

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

llvm-svn: 239529

9 years agoC++11 rangify several loops.
Yaron Keren [Thu, 11 Jun 2015 12:33:25 +0000 (12:33 +0000)]
C++11 rangify several loops.

llvm-svn: 239528

9 years agoAllow case-insensitive values for -march for ARM in line with GCC.
Gabor Ballabas [Thu, 11 Jun 2015 12:29:56 +0000 (12:29 +0000)]
Allow case-insensitive values for -march for ARM in line with GCC.

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

llvm-svn: 239527

9 years agoToken: complement is() method with isOneOf() to allow easier usage
Daniel Marjamaki [Thu, 11 Jun 2015 12:28:14 +0000 (12:28 +0000)]
Token: complement is() method with isOneOf() to allow easier usage

llvm-svn: 239526

9 years ago[mips] Pass on -m{single,double}-float to GAS.
Toma Tabacu [Thu, 11 Jun 2015 12:13:18 +0000 (12:13 +0000)]
[mips] Pass on -m{single,double}-float to GAS.

Summary: We already pass these to the IAS, but not to GAS.

Reviewers: dsanders, atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

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

llvm-svn: 239525

9 years ago[OPENMP] Fox for http://llvm.org/PR23663: OpenMP crash
Alexey Bataev [Thu, 11 Jun 2015 10:53:56 +0000 (10:53 +0000)]
[OPENMP] Fox for llvm.org/PR23663: OpenMP crash

Destroy RuntimeCleanupScope before generation of termination instruction in parallel loop precondition.

llvm-svn: 239524

9 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.

llvm-svn: 239523

9 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

llvm-svn: 239522

9 years agoFix crash in clang-format.
Manuel Klimek [Thu, 11 Jun 2015 10:14:13 +0000 (10:14 +0000)]
Fix crash in clang-format.

The following example used to crash clang-format.
 #define a\
  /**/}

Adjusting the indentation level cache for the line starting with the
comment would lead to an out-of-bounds array read.

llvm-svn: 239521

9 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

llvm-svn: 239520

9 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

llvm-svn: 239519

9 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.

llvm-svn: 239515

9 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)

llvm-svn: 239514

9 years agoclang-format: Don't add spaces in foreach macro definition.
Daniel Jasper [Thu, 11 Jun 2015 08:38:19 +0000 (08:38 +0000)]
clang-format: Don't add spaces in foreach macro definition.

Before clang-format would e.g. add a space into

   #define Q_FOREACH(x, y)

which turns this into a non-function-like macro.

Patch by Strager Neds, thank you!

llvm-svn: 239513

9 years agoReinstate r239499 and r239503
David Majnemer [Thu, 11 Jun 2015 08:12:44 +0000 (08:12 +0000)]
Reinstate r239499 and r239503

They were reverted because the FileCheck patterns didn't match on
release builds.

llvm-svn: 239512

9 years agoRevert "[MS ABI] Allow fastcall member function pointers to get CodeGen'd"
Manuel Klimek [Thu, 11 Jun 2015 07:54:35 +0000 (07:54 +0000)]
Revert "[MS ABI] Allow fastcall member function pointers to get CodeGen'd"

Revert "[MS ABI] Allow memfn pointers with unconvertible types to be formed"

This reverts r239499 and r239503; the former breaks tests [1] and the
latter is based on the former.

[1]
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/4473/testReport/Clang/CodeGenCXX/microsoft_abi_virtual_member_pointers_cpp/

llvm-svn: 239511

9 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.

llvm-svn: 239510

9 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

llvm-svn: 239509

9 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.

llvm-svn: 239508

9 years agoClang support for vector quad bit permute and gather instructions through builtins
Nemanja Ivanovic [Thu, 11 Jun 2015 06:25:36 +0000 (06:25 +0000)]
Clang support for vector quad bit permute and gather instructions through builtins

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

This is for just two instructions and related builtins:
vbpermq
vgbbd

llvm-svn: 239506

9 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

llvm-svn: 239505

9 years ago[modules] Fix a few places where merging wasn't performed if modules was disabled...
Richard Smith [Thu, 11 Jun 2015 03:05:39 +0000 (03:05 +0000)]
[modules] Fix a few places where merging wasn't performed if modules was disabled but local module visibilty was enabled.

llvm-svn: 239504

9 years ago[MS Compatibility] Handle cleanups we create for a ctor closure
David Majnemer [Thu, 11 Jun 2015 02:38:06 +0000 (02:38 +0000)]
[MS Compatibility] Handle cleanups we create for a ctor closure

This fixes PR23801.

llvm-svn: 239503

9 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.

llvm-svn: 239502

9 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.

llvm-svn: 239501

9 years ago[MS ABI] Allow fastcall member function pointers to get CodeGen'd
David Majnemer [Thu, 11 Jun 2015 00:45:44 +0000 (00:45 +0000)]
[MS ABI] Allow fastcall member function pointers to get CodeGen'd

This restriction appears unnecessary and most likely came about during
early work for musttail.

llvm-svn: 239500

9 years ago[MS ABI] Allow memfn pointers with unconvertible types to be formed
David Majnemer [Thu, 11 Jun 2015 00:20:57 +0000 (00:20 +0000)]
[MS ABI] Allow memfn pointers with unconvertible types to be formed

Remove the restriction which forbade forming pointers to member
functions which had parameter types or return types which were not
convertible.

llvm-svn: 239499

9 years ago[CMake] Cleanup add_compiler_rt_object_library to be platform-agnostic
Chris Bieneman [Wed, 10 Jun 2015 23:55:07 +0000 (23:55 +0000)]
[CMake] Cleanup add_compiler_rt_object_library to be platform-agnostic

Summary:
This change takes darwin-specific goop that was scattered around CMakeLists files and spread between add_compiler_rt_object_library and add_compiler_rt_darwin_object_library and moves it all under add_compiler_rt_object_library.

The goal of this is to try to push platform handling as low in the utility functions as possible.

Reviewers: rnk, samsonov

Reviewed By: rnk, samsonov

Subscribers: rnk, rsmith, llvm-commits

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

llvm-svn: 239498

9 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

llvm-svn: 239497

9 years ago[bpf] add support for BPF backend
Alexei Starovoitov [Wed, 10 Jun 2015 22:59:13 +0000 (22:59 +0000)]
[bpf] add support for BPF backend

add support for bpfel/bpfeb targets

llvm-svn: 239496

9 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

llvm-svn: 239495

9 years agoWork around MSVC miscompilation.
Richard Smith [Wed, 10 Jun 2015 22:49:14 +0000 (22:49 +0000)]
Work around MSVC miscompilation.

llvm-svn: 239494

9 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.

llvm-svn: 239493

9 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.

llvm-svn: 239492

9 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.

llvm-svn: 239491

9 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.

llvm-svn: 239490

9 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.

llvm-svn: 239489

9 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

llvm-svn: 239488

9 years ago[modules] Don't allow use of non-visible (inherited) default template arguments.
Richard Smith [Wed, 10 Jun 2015 20:36:34 +0000 (20:36 +0000)]
[modules] Don't allow use of non-visible (inherited) default template arguments.

llvm-svn: 239487

9 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

llvm-svn: 239486

9 years ago[modules] Track all default template arguments for a given parameter across
Richard Smith [Wed, 10 Jun 2015 20:30:23 +0000 (20:30 +0000)]
[modules] Track all default template arguments for a given parameter across
modules, and allow use of a default template argument if any of the parameters
providing it is visible.

llvm-svn: 239485

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

llvm-svn: 239484

9 years agoDo not parse members of incomplete class.
Serge Pavlov [Wed, 10 Jun 2015 19:06:59 +0000 (19:06 +0000)]
Do not parse members of incomplete class.

If definition of a class is unknown and out-of-line definition of its
member is encountered, do not parse the member declaration.
This change fixes PR18542.

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

llvm-svn: 239483

9 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.

llvm-svn: 239482

9 years agoPass down the -flto option to the -cc1 job, and from there into the
Teresa Johnson [Wed, 10 Jun 2015 17:49:45 +0000 (17:49 +0000)]
Pass down the -flto option to the -cc1 job, and from there into the
CodeGenOptions and onto the PassManagerBuilder. This enables gating
the new EliminateAvailableExternally module pass on whether we are
preparing for LTO.

If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not
included as we want to preserve available externally functions for possible
link time inlining.

llvm-svn: 239481

9 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.

llvm-svn: 239480

9 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

llvm-svn: 239479

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

llvm-svn: 239478

9 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.

llvm-svn: 239477

9 years agosome StmtExprs do not have side-effects
Scott Douglass [Wed, 10 Jun 2015 15:18:23 +0000 (15:18 +0000)]
some StmtExprs do not have side-effects

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

llvm-svn: 239476

9 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.

llvm-svn: 239475

9 years agoadd ConstEvaluatedExprVisitor
Scott Douglass [Wed, 10 Jun 2015 13:53:15 +0000 (13:53 +0000)]
add ConstEvaluatedExprVisitor

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

llvm-svn: 239474

9 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

llvm-svn: 239473

9 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

llvm-svn: 239472

9 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

llvm-svn: 239467

9 years agoPR5172: Fix for a bug in pragma redefine_extname implementation:
Alexander Musman [Wed, 10 Jun 2015 11:20:26 +0000 (11:20 +0000)]
PR5172: Fix for a bug in pragma redefine_extname implementation:
it doesn't work correctly when a structure is declared before pragma
and then a function with the same name declared after pragma.

Patch by Andrey Bokhanko

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

llvm-svn: 239466

9 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

llvm-svn: 239465

9 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

llvm-svn: 239464

9 years ago[LLDB][MIPS] Getting correct signals for MIPS Host
Mohit K. Bhakkad [Wed, 10 Jun 2015 10:02:21 +0000 (10:02 +0000)]
[LLDB][MIPS] Getting correct signals for MIPS Host
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov.
Subscribers: jaydeep, bhushan, dsanders, mohit.bhakkad, sagar, labath, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10180

llvm-svn: 239463

9 years agoclang-format: [JS] Only special case top level object literal
Daniel Jasper [Wed, 10 Jun 2015 09:21:09 +0000 (09:21 +0000)]
clang-format: [JS] Only special case top level object literal
assignments as enums.

Top level object literals are treated as enums, and their k/v pairs are put on
separate lines:

  X.Y = {
    A: 1,
    B: 2
  };

However assignments within blocks should not be affected:

  function x() {
    y = {a:1, b:2};
  }

This change fixes the second case. Patch by Martin Probst.

llvm-svn: 239462

9 years ago[ASan] Quick-fix tests for new string interceptors.
Yury Gribov [Wed, 10 Jun 2015 07:16:02 +0000 (07:16 +0000)]
[ASan] Quick-fix tests for new string interceptors.
Patch by Maria Guseva.

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

llvm-svn: 239461

9 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

llvm-svn: 239460